- Move private package stubs to stubs/ (tracked), reference via file: in package.json
Stubs: color-diff-napi, modifiers-napi, @ant/claude-for-chrome-mcp,
@anthropic-ai/mcpb, @anthropic-ai/sandbox-runtime
- Add patches/commander@14.0.3.patch via pnpm patch:
Allow multi-char short flags (/^-[^-]+$/) so -d2e works with commander v14
- Pin all dependency versions to exact versions from original cli.js bundle
(extracted from node_modules package.json files in source map)
- Add @anthropic-ai/bedrock-sdk, foundry-sdk, vertex-sdk to dependencies
- Update .gitignore: node_modules/ fully ignored (regenerated by pnpm install)
- Update scripts to use plain `bun` instead of hardcoded path
- Verified: rm -rf node_modules && pnpm install && bun run build.ts succeeds
Output: dist/cli.js (22.1MB), `bun dist/cli.js --version` → 2.1.88 (Claude Code)
54 lines
1.6 KiB
JavaScript
54 lines
1.6 KiB
JavaScript
import { encodeSandboxedCommand } from './sandbox-utils.js';
|
|
/**
|
|
* In-memory tail for sandbox violations
|
|
*/
|
|
export class SandboxViolationStore {
|
|
constructor() {
|
|
this.violations = [];
|
|
this.totalCount = 0;
|
|
this.maxSize = 100;
|
|
this.listeners = new Set();
|
|
}
|
|
addViolation(violation) {
|
|
this.violations.push(violation);
|
|
this.totalCount++;
|
|
if (this.violations.length > this.maxSize) {
|
|
this.violations = this.violations.slice(-this.maxSize);
|
|
}
|
|
this.notifyListeners();
|
|
}
|
|
getViolations(limit) {
|
|
if (limit === undefined) {
|
|
return [...this.violations];
|
|
}
|
|
return this.violations.slice(-limit);
|
|
}
|
|
getCount() {
|
|
return this.violations.length;
|
|
}
|
|
getTotalCount() {
|
|
return this.totalCount;
|
|
}
|
|
getViolationsForCommand(command) {
|
|
const commandBase64 = encodeSandboxedCommand(command);
|
|
return this.violations.filter(v => v.encodedCommand === commandBase64);
|
|
}
|
|
clear() {
|
|
this.violations = [];
|
|
// Don't reset totalCount when clearing
|
|
this.notifyListeners();
|
|
}
|
|
subscribe(listener) {
|
|
this.listeners.add(listener);
|
|
listener(this.getViolations());
|
|
return () => {
|
|
this.listeners.delete(listener);
|
|
};
|
|
}
|
|
notifyListeners() {
|
|
// Always notify with all violations so listeners can track the full count
|
|
const violations = this.getViolations();
|
|
this.listeners.forEach(listener => listener(violations));
|
|
}
|
|
}
|
|
//# sourceMappingURL=sandbox-violation-store.js.map
|