fixo-cli 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/command-parser.d.ts +37 -0
- package/dist/agent/command-parser.d.ts.map +1 -1
- package/dist/agent/command-parser.js +297 -1
- package/dist/agent/command-parser.js.map +1 -1
- package/dist/agent/conversation.d.ts +18 -1
- package/dist/agent/conversation.d.ts.map +1 -1
- package/dist/agent/conversation.js +31 -2
- package/dist/agent/conversation.js.map +1 -1
- package/dist/agent/duration.d.ts +24 -0
- package/dist/agent/duration.d.ts.map +1 -0
- package/dist/agent/duration.js +42 -0
- package/dist/agent/duration.js.map +1 -0
- package/dist/agent/file-writing-rules.d.ts +19 -0
- package/dist/agent/file-writing-rules.d.ts.map +1 -0
- package/dist/agent/file-writing-rules.js +31 -0
- package/dist/agent/file-writing-rules.js.map +1 -0
- package/dist/agent/parser-adapter.d.ts.map +1 -1
- package/dist/agent/parser-adapter.js +57 -5
- package/dist/agent/parser-adapter.js.map +1 -1
- package/dist/agent/provider-cooldown.d.ts.map +1 -1
- package/dist/agent/provider-cooldown.js +3 -2
- package/dist/agent/provider-cooldown.js.map +1 -1
- package/dist/agent/single-agent.d.ts +13 -0
- package/dist/agent/single-agent.d.ts.map +1 -1
- package/dist/agent/single-agent.js +102 -21
- package/dist/agent/single-agent.js.map +1 -1
- package/dist/agent/telemetry.d.ts.map +1 -1
- package/dist/agent/telemetry.js +4 -1
- package/dist/agent/telemetry.js.map +1 -1
- package/dist/agent/tool-executor.js +4 -4
- package/dist/agent/tool-executor.js.map +1 -1
- package/dist/agent/worker-agent.d.ts.map +1 -1
- package/dist/agent/worker-agent.js +5 -2
- package/dist/agent/worker-agent.js.map +1 -1
- package/dist/config.d.ts +11 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -1
- package/dist/config.js.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/runtime/loop-mitigation.d.ts +48 -0
- package/dist/runtime/loop-mitigation.d.ts.map +1 -0
- package/dist/runtime/loop-mitigation.js +79 -0
- package/dist/runtime/loop-mitigation.js.map +1 -0
- package/dist/runtime/session-snapshots.d.ts +52 -2
- package/dist/runtime/session-snapshots.d.ts.map +1 -1
- package/dist/runtime/session-snapshots.js +76 -1
- package/dist/runtime/session-snapshots.js.map +1 -1
- package/dist/ui/prompt.d.ts.map +1 -1
- package/dist/ui/prompt.js +102 -5
- package/dist/ui/prompt.js.map +1 -1
- package/dist/ui/session-header.d.ts +13 -0
- package/dist/ui/session-header.d.ts.map +1 -1
- package/dist/ui/session-header.js +6 -0
- package/dist/ui/session-header.js.map +1 -1
- package/package.json +6 -2
- package/scripts/check-vendor-wasm.js +44 -0
- package/vendor/tree-sitter-bash.wasm +0 -0
- package/vendor/tree-sitter.wasm +0 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* duration.ts — Human-readable formatting for millisecond durations
|
|
3
|
+
* surfaced in user-facing messages (cooldown errors, telemetry
|
|
4
|
+
* summaries, status bar tooltips).
|
|
5
|
+
*
|
|
6
|
+
* The previous CLI showed raw `134555ms` in messages like
|
|
7
|
+
* "Provider 'zen' is in cooldown for 134555ms"
|
|
8
|
+
* which forced the user to mentally divide. This helper turns that
|
|
9
|
+
* into "2m 14s" or "45s" or "1h 3m" — exactly the granularity humans
|
|
10
|
+
* read durations at.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Format a millisecond duration as a compact human-readable string.
|
|
14
|
+
*
|
|
15
|
+
* formatDuration(750) → "750ms"
|
|
16
|
+
* formatDuration(45_000) → "45s"
|
|
17
|
+
* formatDuration(134_555) → "2m 14s"
|
|
18
|
+
* formatDuration(3_750_000) → "1h 2m"
|
|
19
|
+
*
|
|
20
|
+
* Returns `"0ms"` for non-finite or negative values rather than
|
|
21
|
+
* throwing, so it is always safe to interpolate into error strings.
|
|
22
|
+
*/
|
|
23
|
+
export function formatDuration(ms) {
|
|
24
|
+
if (!Number.isFinite(ms) || ms < 0)
|
|
25
|
+
return '0ms';
|
|
26
|
+
if (ms < 1000)
|
|
27
|
+
return `${Math.round(ms)}ms`;
|
|
28
|
+
const totalSeconds = Math.round(ms / 1000);
|
|
29
|
+
const hours = Math.floor(totalSeconds / 3600);
|
|
30
|
+
const minutes = Math.floor((totalSeconds % 3600) / 60);
|
|
31
|
+
const seconds = totalSeconds % 60;
|
|
32
|
+
if (hours > 0) {
|
|
33
|
+
// For multi-hour spans we drop seconds — humans read "1h 3m",
|
|
34
|
+
// not "1h 3m 47s".
|
|
35
|
+
return minutes > 0 ? `${hours}h ${minutes}m` : `${hours}h`;
|
|
36
|
+
}
|
|
37
|
+
if (minutes > 0) {
|
|
38
|
+
return seconds > 0 ? `${minutes}m ${seconds}s` : `${minutes}m`;
|
|
39
|
+
}
|
|
40
|
+
return `${seconds}s`;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=duration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duration.js","sourceRoot":"","sources":["../../src/agent/duration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,UAAU,cAAc,CAAC,EAAU;IACvC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IACjD,IAAI,EAAE,GAAG,IAAI;QAAE,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC;IAE5C,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;IAC3C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IACvD,MAAM,OAAO,GAAG,YAAY,GAAG,EAAE,CAAC;IAElC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACd,8DAA8D;QAC9D,mBAAmB;QACnB,OAAO,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC;IAC7D,CAAC;IACD,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;QAChB,OAAO,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,KAAK,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC;IACjE,CAAC;IACD,OAAO,GAAG,OAAO,GAAG,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* file-writing-rules.ts — Shared system-prompt fragment that steers
|
|
3
|
+
* the LLM toward the sanctioned write tools and away from shell-based
|
|
4
|
+
* file mutation.
|
|
5
|
+
*
|
|
6
|
+
* The shell sandbox (see `command-parser.ts` → `extractWriteTargets`)
|
|
7
|
+
* already rejects `cat > file`, `sed -i`, `tee`, `mv` into platform
|
|
8
|
+
* paths, `python3 -c "open(...,'w')"`, and heredoc smuggling. But a
|
|
9
|
+
* rejection still costs a turn and an approval prompt. This block
|
|
10
|
+
* tells the model up-front not to try, so the typical session never
|
|
11
|
+
* floods the user with security warnings the way Test 1 in the log
|
|
12
|
+
* did.
|
|
13
|
+
*
|
|
14
|
+
* Keep this fragment short: every agent persona that gets tool
|
|
15
|
+
* access (single-agent, code worker, test worker) pastes it into
|
|
16
|
+
* its system prompt.
|
|
17
|
+
*/
|
|
18
|
+
export declare const FILE_WRITING_RULES_BLOCK: string;
|
|
19
|
+
//# sourceMappingURL=file-writing-rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-writing-rules.d.ts","sourceRoot":"","sources":["../../src/agent/file-writing-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,wBAAwB,QAYzB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* file-writing-rules.ts — Shared system-prompt fragment that steers
|
|
3
|
+
* the LLM toward the sanctioned write tools and away from shell-based
|
|
4
|
+
* file mutation.
|
|
5
|
+
*
|
|
6
|
+
* The shell sandbox (see `command-parser.ts` → `extractWriteTargets`)
|
|
7
|
+
* already rejects `cat > file`, `sed -i`, `tee`, `mv` into platform
|
|
8
|
+
* paths, `python3 -c "open(...,'w')"`, and heredoc smuggling. But a
|
|
9
|
+
* rejection still costs a turn and an approval prompt. This block
|
|
10
|
+
* tells the model up-front not to try, so the typical session never
|
|
11
|
+
* floods the user with security warnings the way Test 1 in the log
|
|
12
|
+
* did.
|
|
13
|
+
*
|
|
14
|
+
* Keep this fragment short: every agent persona that gets tool
|
|
15
|
+
* access (single-agent, code worker, test worker) pastes it into
|
|
16
|
+
* its system prompt.
|
|
17
|
+
*/
|
|
18
|
+
export const FILE_WRITING_RULES_BLOCK = [
|
|
19
|
+
``,
|
|
20
|
+
`## File Writing Rules (HARD CONSTRAINT)`,
|
|
21
|
+
`The ONLY sanctioned tools for writing files are \`write_file\`, \`str_replace\`, \`apply_patch\`, \`replace_range\`, \`insert_after\`, and \`rename_file\`. They are atomic, LSP-gated, and respect the platform path lock.`,
|
|
22
|
+
`Writing files via \`run_command\` is **sandbox-blocked**. The following patterns will be rejected with a security error and waste a tool call:`,
|
|
23
|
+
`- \`cat > file\`, \`cat >> file\`, \`echo … > file\`, or any \`>\`/\`>>\` redirect that writes a workspace file`,
|
|
24
|
+
`- heredocs like \`cat > file <<'EOF' … EOF\` or \`python3 << 'PYEOF' … PYEOF\``,
|
|
25
|
+
`- \`tee\`, \`sed -i\`, \`perl -i\`, \`awk … > file\``,
|
|
26
|
+
`- \`mv\`/\`cp\` whose destination is a tracked source file`,
|
|
27
|
+
`- interpreter payloads that write: \`python3 -c "open('x','w')…"\`, \`node -e "fs.writeFileSync('x', …)"\`, \`perl -e "open(FH,'>','x')…"\``,
|
|
28
|
+
`If you find yourself reaching for any of these, stop and use \`write_file\` (or \`str_replace\`/\`apply_patch\` for edits) instead — it is faster, safer, and the only path that actually succeeds.`,
|
|
29
|
+
`\`run_command\` is for running things (tests, builds, git, lint, format), not for producing files.`,
|
|
30
|
+
].join('\n');
|
|
31
|
+
//# sourceMappingURL=file-writing-rules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-writing-rules.js","sourceRoot":"","sources":["../../src/agent/file-writing-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,EAAE;IACF,yCAAyC;IACzC,6NAA6N;IAC7N,gJAAgJ;IAChJ,iHAAiH;IACjH,gFAAgF;IAChF,sDAAsD;IACtD,4DAA4D;IAC5D,6IAA6I;IAC7I,qMAAqM;IACrM,oGAAoG;CACrG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser-adapter.d.ts","sourceRoot":"","sources":["../../src/agent/parser-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;
|
|
1
|
+
{"version":3,"file":"parser-adapter.d.ts","sourceRoot":"","sources":["../../src/agent/parser-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAuFH,MAAM,MAAM,UAAU,GAClB,YAAY,GACZ,YAAY,GACZ,QAAQ,GACR,IAAI,GACJ,MAAM,GACN,MAAM,GACN,MAAM,GACN,UAAU,GACV,SAAS,CAAC;AAEd,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EACA,OAAO,GACP,UAAU,GACV,WAAW,GACX,M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,MAAM,GAAG,IAAI;CAM/D"}
|
|
@@ -22,12 +22,57 @@
|
|
|
22
22
|
* share the same in-flight `init()` promise.
|
|
23
23
|
*/
|
|
24
24
|
import * as ParserModule from 'web-tree-sitter';
|
|
25
|
+
import { existsSync, statSync } from 'node:fs';
|
|
26
|
+
import { createRequire } from 'node:module';
|
|
25
27
|
import path from 'node:path';
|
|
26
28
|
import { fileURLToPath } from 'node:url';
|
|
27
29
|
import { extractShellTokens, isCommandSafeShellFallback } from './parsers/shell.js';
|
|
28
30
|
import { extractSymbols as regexExtractSymbols } from './parsers/symbols.js';
|
|
29
31
|
import { extractImports as regexExtractImports } from './parsers/imports.js';
|
|
30
32
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
33
|
+
const requireFromHere = createRequire(import.meta.url);
|
|
34
|
+
/**
|
|
35
|
+
* Returns the first existing, non-empty path for a vendored WASM blob.
|
|
36
|
+
*
|
|
37
|
+
* Resolution order:
|
|
38
|
+
* 1. `<package>/vendor/<file>` (the canonical location written to the
|
|
39
|
+
* tarball by `npm pack`).
|
|
40
|
+
* 2. `<package>/../vendor/<file>` (handles the dev layout where this
|
|
41
|
+
* file lives in `src/agent/` rather than `dist/agent/`).
|
|
42
|
+
* 3. For `tree-sitter.wasm` only: the copy shipped inside the
|
|
43
|
+
* `web-tree-sitter` dependency. This is the safety net that keeps
|
|
44
|
+
* symbol indexing working even if a future publish accidentally
|
|
45
|
+
* drops the vendor/ directory again (the regression that caused
|
|
46
|
+
* the v1.0.x ENOENT crashes).
|
|
47
|
+
*
|
|
48
|
+
* Returns `null` if nothing usable was found; callers fall back to the
|
|
49
|
+
* regex adapter and log a single warning.
|
|
50
|
+
*/
|
|
51
|
+
function resolveVendorWasm(fileName) {
|
|
52
|
+
const candidates = [
|
|
53
|
+
path.resolve(__dirname, '../../vendor', fileName),
|
|
54
|
+
path.resolve(__dirname, '../vendor', fileName),
|
|
55
|
+
];
|
|
56
|
+
if (fileName === 'tree-sitter.wasm') {
|
|
57
|
+
try {
|
|
58
|
+
const pkg = requireFromHere.resolve('web-tree-sitter/package.json');
|
|
59
|
+
candidates.push(path.resolve(path.dirname(pkg), 'tree-sitter.wasm'));
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
// web-tree-sitter not resolvable from this module — ignore.
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
for (const c of candidates) {
|
|
66
|
+
try {
|
|
67
|
+
if (existsSync(c) && statSync(c).size > 0)
|
|
68
|
+
return c;
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
/* ignore stat errors and try the next candidate */
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
31
76
|
const ParserCtor = ParserModule.Parser;
|
|
32
77
|
const LanguageCtor = ParserModule.Language;
|
|
33
78
|
// ──── Helpers ─────────────────────────────────────────────────────
|
|
@@ -66,15 +111,22 @@ export class TreeSitterAdapter {
|
|
|
66
111
|
}
|
|
67
112
|
this.initialised = true;
|
|
68
113
|
try {
|
|
114
|
+
const coreWasm = resolveVendorWasm('tree-sitter.wasm');
|
|
115
|
+
if (!coreWasm) {
|
|
116
|
+
throw new Error('tree-sitter.wasm not found in vendor/ or web-tree-sitter package');
|
|
117
|
+
}
|
|
118
|
+
const bashWasm = resolveVendorWasm('tree-sitter-bash.wasm');
|
|
119
|
+
if (!bashWasm) {
|
|
120
|
+
throw new Error('tree-sitter-bash.wasm not found in vendor/');
|
|
121
|
+
}
|
|
69
122
|
await ParserCtor.init({
|
|
70
123
|
locateFile: (scriptName) => {
|
|
71
|
-
if (scriptName === 'tree-sitter.wasm')
|
|
72
|
-
return
|
|
73
|
-
|
|
74
|
-
return path.resolve(__dirname, '../../vendor', scriptName);
|
|
124
|
+
if (scriptName === 'tree-sitter.wasm')
|
|
125
|
+
return coreWasm;
|
|
126
|
+
return resolveVendorWasm(scriptName) ?? scriptName;
|
|
75
127
|
},
|
|
76
128
|
});
|
|
77
|
-
const Bash = await LanguageCtor.load(
|
|
129
|
+
const Bash = await LanguageCtor.load(bashWasm);
|
|
78
130
|
this.parser = new ParserCtor();
|
|
79
131
|
this.parser.setLanguage(Bash);
|
|
80
132
|
this.supported = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser-adapter.js","sourceRoot":"","sources":["../../src/agent/parser-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,YAAY,MAAM,iBAAiB,CAAC;AAChD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AACpF,OAAO,EAAE,cAAc,IAAI,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,cAAc,IAAI,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE7E,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"parser-adapter.js","sourceRoot":"","sources":["../../src/agent/parser-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,YAAY,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AACpF,OAAO,EAAE,cAAc,IAAI,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,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KAAK,KAAK,KAAK,EAAE,CAAC;YAC1B,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;YACpB,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC;QACtB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-cooldown.d.ts","sourceRoot":"","sources":["../../src/agent/provider-cooldown.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;
|
|
1
|
+
{"version":3,"file":"provider-cooldown.d.ts","sourceRoot":"","sources":["../../src/agent/provider-cooldown.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAOH,6CAA6C;AAC7C,KAAK,aAAa,GAAG,YAAY,GAAG,cAAc,GAAG,iBAAiB,GAAG,MAAM,CAAC;AAEhF,8DAA8D;AAC9D,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAa5D;AAWD,mDAAmD;AACnD,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,6EAA6E;IAC7E,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wCAAwC;AACxC,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,CAAC,CAAC;CACZ;AAED,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,QAAQ,CAAC,UAAU,EAAE,MA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,aAAa,CACX,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,GAAG,GAAE,MAAmB,GACvB,IAAI;IAkBP;sCACkC;IAClC,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG;QAC9B,OAAO,EAAE,MAAM,CAAC;QAChB,aAAa,EAAE,MAAM,CAAC;QACtB,cAAc,EAAE,MAAM,CAAC;QACvB,aAAa,EAAE,MAAM,CAAC;KACvB,GAAG,IAAI;IAQR,OAAO,CAAC,WAAW;IAoBnB,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,QAAQ;CAgBjB;AAED;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,yBAAgC,CAAC;AAE9D;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,IAAI,CAEN;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB,IAAI,CAEN"}
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
* - Other retryable status → 15s, 30s, 60s, 120s, 180s cap
|
|
21
21
|
* - Non-retryable (4xx other) → no cooldown, just record
|
|
22
22
|
*/
|
|
23
|
+
import { formatDuration } from './duration.js';
|
|
23
24
|
const ONE_SECOND_MS = 1_000;
|
|
24
25
|
const ONE_MINUTE_MS = 60 * ONE_SECOND_MS;
|
|
25
26
|
/** Status code → backoff family. Exported for testability. */
|
|
@@ -52,8 +53,8 @@ export class ProviderInCooldownError extends Error {
|
|
|
52
53
|
cooldownMs;
|
|
53
54
|
until;
|
|
54
55
|
constructor(providerId, cooldownMs, until) {
|
|
55
|
-
super(`Provider '${providerId}' is in cooldown for ${cooldownMs}
|
|
56
|
-
`(until ${new Date(until).
|
|
56
|
+
super(`Provider '${providerId}' is in cooldown for ${formatDuration(cooldownMs)} ` +
|
|
57
|
+
`(until ${new Date(until).toLocaleTimeString()})`);
|
|
57
58
|
this.name = 'ProviderInCooldownError';
|
|
58
59
|
this.providerId = providerId;
|
|
59
60
|
this.cooldownMs = cooldownMs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-cooldown.js","sourceRoot":"","sources":["../../src/agent/provider-cooldown.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,aAAa,GAAG,KAAK,CAAC;AAC5B,MAAM,aAAa,GAAG,EAAE,GAAG,aAAa,CAAC;AAKzC,8DAA8D;AAC9D,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,YAAY,CAAC;IACxC,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG;QAAE,OAAO,cAAc,CAAC;IACzD,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;QAC3F,OAAO,cAAc,CAAC;IACxB,CAAC;IACD,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG,EAAE,CAAC;QAClC,sDAAsD;QACtD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,2EAA2E;IAC3E,IAAI,MAAM,KAAK,CAAC;QAAE,OAAO,iBAAiB,CAAC;IAC3C,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,uFAAuF;AACvF,MAAM,iBAAiB,GAA+D;IACpF,UAAU,EAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC;IAC7D,YAAY,EAAM,CAAC,MAAM,EAAG,MAAM,EAAG,MAAM,EAAG,MAAM,EAAE,OAAO,CAAC;IAC9D,eAAe,EAAG,CAAC,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AED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACnC,UAAkB,EAClB,UAAkB,EAClB,WAAmB;IAEnB,gBAAgB,CAAC,aAAa,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;AACtE,CAAC"}
|
|
@@ -13,6 +13,19 @@ export declare const promptsWrapper: {
|
|
|
13
13
|
isCancel: typeof p.isCancel;
|
|
14
14
|
};
|
|
15
15
|
import type readline from 'readline';
|
|
16
|
+
/**
|
|
17
|
+
* Tools that mutate the workspace, the git tree, the network, or any
|
|
18
|
+
* external state. Exported so the budget logic and the permission
|
|
19
|
+
* prompt logic share one source of truth — keeping the
|
|
20
|
+
* "investigation vs mutation" classification aligned with what the
|
|
21
|
+
* user sees in the approval prompt.
|
|
22
|
+
*/
|
|
23
|
+
export declare const MUTATING_TOOL_NAMES: ReadonlySet<string>;
|
|
24
|
+
/**
|
|
25
|
+
* Returns true when the given tool name is a pure read / analysis
|
|
26
|
+
* operation (read_file, search_code, list_dir, extract_symbols, ...).
|
|
27
|
+
*/
|
|
28
|
+
export declare function isReadOnlyTool(name: string): boolean;
|
|
16
29
|
export declare function evaluateInputIntent(task: string): 'CHAT_ONLY' | 'MUTATION';
|
|
17
30
|
export declare class SingleAgent {
|
|
18
31
|
private client;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"single-agent.d.ts","sourceRoot":"","sources":["../../src/agent/single-agent.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAqC,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAIxD,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"single-agent.d.ts","sourceRoot":"","sources":["../../src/agent/single-agent.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAqC,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAE,mBAAmB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M,EACnB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,SAAS,EAAE,OAAO,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAyCzE,sCAAsC;IAChC,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC;CAG/B"}
|
|
@@ -10,6 +10,7 @@ import { loadTodoList, summariseTodoList, } from '../context/todo.js';
|
|
|
10
10
|
import { C } from '../ui/colors.js';
|
|
11
11
|
import { MarkdownStreamRenderer, renderMarkdown } from '../ui/markdown-stream.js';
|
|
12
12
|
import { SemanticLoopDetector, SemanticLoopAbortedError, toSafetyAlertDirective, } from '../runtime/loop-trap.js';
|
|
13
|
+
import { LoopMitigationTracker, isReadTool, buildLoopBlockedReadResult, } from '../runtime/loop-mitigation.js';
|
|
13
14
|
import { dashboard } from '../ui/render.js';
|
|
14
15
|
import { TaskStatusIndicator } from '../ui/render-primitives.js';
|
|
15
16
|
import * as p from '@clack/prompts';
|
|
@@ -22,8 +23,38 @@ export const promptsWrapper = {
|
|
|
22
23
|
import { TaskSession } from '../runtime/task-session.js';
|
|
23
24
|
import { BackgroundAwareness } from './background-awareness.js';
|
|
24
25
|
import { FixoMdWatcher } from '../context/fixo-md-watcher.js';
|
|
26
|
+
import { FILE_WRITING_RULES_BLOCK } from './file-writing-rules.js';
|
|
25
27
|
/* ──────────────────────── Constants ──────────────────────── */
|
|
26
28
|
const MAX_TOOL_RESULT_LENGTH = 30_000;
|
|
29
|
+
/**
|
|
30
|
+
* Tools that mutate the workspace, the git tree, the network, or any
|
|
31
|
+
* external state. Exported so the budget logic and the permission
|
|
32
|
+
* prompt logic share one source of truth — keeping the
|
|
33
|
+
* "investigation vs mutation" classification aligned with what the
|
|
34
|
+
* user sees in the approval prompt.
|
|
35
|
+
*/
|
|
36
|
+
export const MUTATING_TOOL_NAMES = new Set([
|
|
37
|
+
'write_file',
|
|
38
|
+
'run_command',
|
|
39
|
+
'run_command_async',
|
|
40
|
+
'apply_patch',
|
|
41
|
+
'replace_range',
|
|
42
|
+
'insert_after',
|
|
43
|
+
'str_replace',
|
|
44
|
+
'rename_file',
|
|
45
|
+
'delete_file',
|
|
46
|
+
'create_branch',
|
|
47
|
+
'commit_changes',
|
|
48
|
+
'push_branch',
|
|
49
|
+
'create_pull_request',
|
|
50
|
+
]);
|
|
51
|
+
/**
|
|
52
|
+
* Returns true when the given tool name is a pure read / analysis
|
|
53
|
+
* operation (read_file, search_code, list_dir, extract_symbols, ...).
|
|
54
|
+
*/
|
|
55
|
+
export function isReadOnlyTool(name) {
|
|
56
|
+
return !MUTATING_TOOL_NAMES.has(name);
|
|
57
|
+
}
|
|
27
58
|
const colors = {
|
|
28
59
|
reset: C.RESET,
|
|
29
60
|
bold: C.BOLD,
|
|
@@ -115,7 +146,7 @@ function buildUserContent(context) {
|
|
|
115
146
|
function buildSystemPrompt(repoMap, context, enableTools = true) {
|
|
116
147
|
const parts = [];
|
|
117
148
|
if (enableTools) {
|
|
118
|
-
parts.push(`You are FixO CLI, an autonomous AI coding agent. You help developers by reading, writing, and modifying code files in their workspace.`, ``, `## Capabilities`, `You have access to these tools:`, `- **read_file(path)** — Read a file's contents`, `- **write_file(path, content)** — Create or overwrite a file`, `- **run_command(command)** — Execute a shell command (npm test, git status, etc.)`, `- **search_code(query)** — Search for patterns in the codebase`, `- **list_dir(path)** — List directory contents`, ``, `## Guidelines`, `1. ALWAYS read existing files before modifying them to understand current code.`, `2. For new files, write complete contents — never use placeholders like "// ... rest of the file". For edits to existing files, follow the Editing Discipline below.`, `3. After making changes, run the verification command if one is configured.`, `4. Keep your text responses concise. Focus on what you did and why.`, `5. If the task is ambiguous, ask a clarifying question instead of guessing.`, `6. Preserve existing code comments and formatting unless asked to change them.`, ``, `## Editing Discipline`, `Pick the narrowest tool that fits the change. Rewriting a file you only need to tweak burns tokens, defeats the LSP pre-save granularity, and risks clobbering concurrent edits.`, `- **Single-region edit on an existing file** (one symbol, one block, one line) → use \`str_replace\`. It is surgical and atomic. By default it errors when the snippet is non-unique — narrow the snippet, don't disable the check.`, `- **Multi-region or hunked edit on an existing file** (several non-adjacent changes, or a diff you already have) → use \`apply_patch\` with a unified diff. One tool call, all hunks atomic.`, `- **New file** OR **full rewrite** where the prior content is genuinely irrelevant → use \`write_file\`. This is the only sanctioned use of \`write_file\` on an existing path.`, `Never use \`write_file\` to "edit" an existing file by rewriting it whole. If the diff is small enough to describe, it is small enough for \`str_replace\` or \`apply_patch
|
|
149
|
+
parts.push(`You are FixO CLI, an autonomous AI coding agent. You help developers by reading, writing, and modifying code files in their workspace.`, ``, `## Capabilities`, `You have access to these tools:`, `- **read_file(path)** — Read a file's contents`, `- **write_file(path, content)** — Create or overwrite a file`, `- **run_command(command)** — Execute a shell command (npm test, git status, etc.)`, `- **search_code(query)** — Search for patterns in the codebase`, `- **list_dir(path)** — List directory contents`, ``, `## Guidelines`, `1. ALWAYS read existing files before modifying them to understand current code.`, `2. For new files, write complete contents — never use placeholders like "// ... rest of the file". For edits to existing files, follow the Editing Discipline below.`, `3. After making changes, run the verification command if one is configured.`, `4. Keep your text responses concise. Focus on what you did and why.`, `5. If the task is ambiguous, ask a clarifying question instead of guessing.`, `6. Preserve existing code comments and formatting unless asked to change them.`, ``, `## Editing Discipline`, `Pick the narrowest tool that fits the change. Rewriting a file you only need to tweak burns tokens, defeats the LSP pre-save granularity, and risks clobbering concurrent edits.`, `- **Single-region edit on an existing file** (one symbol, one block, one line) → use \`str_replace\`. It is surgical and atomic. By default it errors when the snippet is non-unique — narrow the snippet, don't disable the check.`, `- **Multi-region or hunked edit on an existing file** (several non-adjacent changes, or a diff you already have) → use \`apply_patch\` with a unified diff. One tool call, all hunks atomic.`, `- **New file** OR **full rewrite** where the prior content is genuinely irrelevant → use \`write_file\`. This is the only sanctioned use of \`write_file\` on an existing path.`, `Never use \`write_file\` to "edit" an existing file by rewriting it whole. If the diff is small enough to describe, it is small enough for \`str_replace\` or \`apply_patch\`.`, FILE_WRITING_RULES_BLOCK);
|
|
119
150
|
}
|
|
120
151
|
else {
|
|
121
152
|
parts.push(`You are FixO CLI, a friendly AI coding assistant. You help developers by answering questions, explaining code, and discussing software engineering concepts.`, ``, `## Guidelines`, `1. Provide clear, detailed, and accurate explanations.`, `2. Keep your responses focused and helpful.`, `3. If you refer to code structure, do so conceptually as you currently do not have active tool access to modify code.`);
|
|
@@ -284,6 +315,18 @@ export class SingleAgent {
|
|
|
284
315
|
const budget = safety.toolCalls;
|
|
285
316
|
let toolCallLimit = Math.max(1, budget.softLimit);
|
|
286
317
|
const toolCallHardLimit = Math.max(toolCallLimit, budget.hardLimit);
|
|
318
|
+
/**
|
|
319
|
+
* Investigation budget — applies when the agent has only invoked
|
|
320
|
+
* read-only tools so far. Audits, reviews, and "find vulnerabilities"
|
|
321
|
+
* tasks routinely need to read 80+ files before answering; if we
|
|
322
|
+
* cap them at `hardLimit` they force the user to type `continue`
|
|
323
|
+
* mid-investigation (the failure mode seen in Test 2 of the log).
|
|
324
|
+
* Snaps back to `hardLimit` the moment a mutation fires.
|
|
325
|
+
*/
|
|
326
|
+
const investigationMultiplier = Math.max(1, budget.investigationMultiplier ?? 1);
|
|
327
|
+
const toolCallInvestigationCeiling = Math.max(toolCallHardLimit, Math.floor(toolCallHardLimit * investigationMultiplier));
|
|
328
|
+
let anyMutationSeen = false;
|
|
329
|
+
let investigationModeAnnounced = false;
|
|
287
330
|
// Pillar 2 — semantic loop detector. Tracks per-file frequency so
|
|
288
331
|
// an LLM which varies its search arguments but keeps hammering
|
|
289
332
|
// the same file still trips. The composite LoopTrapDetector is
|
|
@@ -291,6 +334,7 @@ export class SingleAgent {
|
|
|
291
334
|
// detectors run in parallel; the semantic one covers the most
|
|
292
335
|
// common accidental "stare at one file" failure mode.
|
|
293
336
|
const semanticLoopDetector = new SemanticLoopDetector(safety.semanticLoopTrap);
|
|
337
|
+
const loopMitigation = new LoopMitigationTracker();
|
|
294
338
|
let pendingSafetyDirective = null;
|
|
295
339
|
// Pillar 5 — per-turn background-job awareness. The LLM
|
|
296
340
|
// routinely forgets jobs it spawned earlier; we counter that by
|
|
@@ -310,15 +354,29 @@ export class SingleAgent {
|
|
|
310
354
|
while (toolCallCount < toolCallLimit) {
|
|
311
355
|
// Auto-extend the budget when the agent is at the soft limit
|
|
312
356
|
// but the semantic loop detector is quiet — i.e. the work is
|
|
313
|
-
// still progressing, not thrashing. Capped at hardLimit
|
|
357
|
+
// still progressing, not thrashing. Capped at hardLimit for
|
|
358
|
+
// mutating runs; lifted to the investigation ceiling
|
|
359
|
+
// (hardLimit * investigationMultiplier) while only read-only
|
|
360
|
+
// tools have fired.
|
|
314
361
|
if (budget.autoExtend &&
|
|
315
362
|
toolCallCount + 1 >= toolCallLimit &&
|
|
316
|
-
toolCallLimit < toolCallHardLimit &&
|
|
317
363
|
pendingSafetyDirective === null) {
|
|
318
|
-
const
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
364
|
+
const ceiling = !anyMutationSeen && investigationMultiplier > 1
|
|
365
|
+
? toolCallInvestigationCeiling
|
|
366
|
+
: toolCallHardLimit;
|
|
367
|
+
if (toolCallLimit < ceiling) {
|
|
368
|
+
const previous = toolCallLimit;
|
|
369
|
+
toolCallLimit = Math.min(ceiling, toolCallLimit * 2);
|
|
370
|
+
if (toolCallLimit > previous) {
|
|
371
|
+
const investigation = !anyMutationSeen && investigationMultiplier > 1;
|
|
372
|
+
if (investigation && !investigationModeAnnounced) {
|
|
373
|
+
console.log(`${colors.dim}ⓘ Investigation mode — extended budget to ${toolCallLimit} (read-only tools only).${colors.reset}`);
|
|
374
|
+
investigationModeAnnounced = true;
|
|
375
|
+
}
|
|
376
|
+
else if (!investigation) {
|
|
377
|
+
console.log(`${colors.dim}↳ tool-call budget extended ${previous} → ${toolCallLimit} (no loop detected)${colors.reset}`);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
322
380
|
}
|
|
323
381
|
}
|
|
324
382
|
// Background-job awareness: surface newly-finished and
|
|
@@ -439,6 +497,11 @@ export class SingleAgent {
|
|
|
439
497
|
pendingSafetyDirective = toSafetyAlertDirective(verdict);
|
|
440
498
|
console.log(`${colors.yellow}⚠ Semantic loop warning: ${verdict.target} ` +
|
|
441
499
|
`accessed ${verdict.count}× in the last ${verdict.windowSize} turns.${colors.reset}`);
|
|
500
|
+
const nowBlocking = loopMitigation.recordWarn(verdict.target);
|
|
501
|
+
if (nowBlocking) {
|
|
502
|
+
console.log(`${colors.yellow}⚠ Further reads of ${verdict.target} will be ` +
|
|
503
|
+
`rejected this session — agent will be forced to pivot.${colors.reset}`);
|
|
504
|
+
}
|
|
442
505
|
}
|
|
443
506
|
else if (verdict.state === 'hard-abort') {
|
|
444
507
|
// Rollback any staged writes from this run before
|
|
@@ -462,6 +525,26 @@ export class SingleAgent {
|
|
|
462
525
|
injectSafetyDirective(pendingSafetyDirective);
|
|
463
526
|
pendingSafetyDirective = null;
|
|
464
527
|
}
|
|
528
|
+
// Active loop mitigation: if the model is trying to read
|
|
529
|
+
// a target the loop-trap has already warned on N times,
|
|
530
|
+
// short-circuit with a tool-error result instead of letting
|
|
531
|
+
// the LLM stare at the same file again. The mitigation
|
|
532
|
+
// tracker is per-session, so a future user task can re-read
|
|
533
|
+
// the same file freely.
|
|
534
|
+
if (isReadTool(toolCall.function.name) &&
|
|
535
|
+
typeof parsedArgs.path === 'string' &&
|
|
536
|
+
loopMitigation.isBlocked(parsedArgs.path)) {
|
|
537
|
+
const warns = loopMitigation.warnsFor(parsedArgs.path);
|
|
538
|
+
const blockedResult = buildLoopBlockedReadResult(parsedArgs.path, warns);
|
|
539
|
+
console.log(`${colors.yellow}⚠ Loop-blocked read intercepted: ${parsedArgs.path}${colors.reset}`);
|
|
540
|
+
messages.push({
|
|
541
|
+
role: 'tool',
|
|
542
|
+
tool_call_id: toolCall.id,
|
|
543
|
+
content: blockedResult,
|
|
544
|
+
});
|
|
545
|
+
toolCallCount++;
|
|
546
|
+
continue;
|
|
547
|
+
}
|
|
465
548
|
const allowed = await this.askPermission(toolCall.function.name, parsedArgs, rl, context.yes);
|
|
466
549
|
let event;
|
|
467
550
|
if (!allowed) {
|
|
@@ -507,6 +590,17 @@ export class SingleAgent {
|
|
|
507
590
|
modifiedFiles.push(event.affectedPath);
|
|
508
591
|
}
|
|
509
592
|
}
|
|
593
|
+
// Investigation-budget gate: any mutating tool snaps the
|
|
594
|
+
// ceiling back to hardLimit on the next iteration. We check
|
|
595
|
+
// the tool name (not just event.isWrite) because run_command
|
|
596
|
+
// is mutating-by-default even when it doesn't touch a file.
|
|
597
|
+
if (!anyMutationSeen &&
|
|
598
|
+
(event.isWrite || MUTATING_TOOL_NAMES.has(toolCall.function.name))) {
|
|
599
|
+
anyMutationSeen = true;
|
|
600
|
+
if (toolCallLimit > toolCallHardLimit) {
|
|
601
|
+
toolCallLimit = toolCallHardLimit;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
510
604
|
let toolResult = event.result;
|
|
511
605
|
if (toolResult.length > MAX_TOOL_RESULT_LENGTH) {
|
|
512
606
|
toolResult =
|
|
@@ -553,20 +647,7 @@ export class SingleAgent {
|
|
|
553
647
|
* are auto-allowed.
|
|
554
648
|
*/
|
|
555
649
|
async askPermission(name, args, rl, allowWithoutPrompt) {
|
|
556
|
-
|
|
557
|
-
'write_file',
|
|
558
|
-
'run_command',
|
|
559
|
-
'apply_patch',
|
|
560
|
-
'replace_range',
|
|
561
|
-
'insert_after',
|
|
562
|
-
'rename_file',
|
|
563
|
-
'delete_file',
|
|
564
|
-
'create_branch',
|
|
565
|
-
'commit_changes',
|
|
566
|
-
'push_branch',
|
|
567
|
-
'create_pull_request',
|
|
568
|
-
]);
|
|
569
|
-
if (!MUTATING_TOOLS.has(name)) {
|
|
650
|
+
if (!MUTATING_TOOL_NAMES.has(name)) {
|
|
570
651
|
return true;
|
|
571
652
|
}
|
|
572
653
|
if (allowWithoutPrompt || this.allowAll) {
|