@molecule/api-ai-tools 1.10.6 → 1.10.8

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/cut-run.js CHANGED
@@ -397,6 +397,7 @@ export function cutRunFacts(result) {
397
397
  noun: c.noun === 'tests' ? 'tests' : 'files',
398
398
  doing: typeof c.doing === 'string' && c.doing ? c.doing : null,
399
399
  inlineScript: typeof c.inlineScript === 'string' && c.inlineScript ? c.inlineScript : null,
400
+ browserProbe: typeof c.browserProbe === 'string' && c.browserProbe ? c.browserProbe : null,
400
401
  };
401
402
  }
402
403
  /**
@@ -430,11 +431,15 @@ export function cutRunSentence(run) {
430
431
  ? // An inline local-file program finished in milliseconds or is stuck; backgrounding it only
431
432
  // moves the hang (xr-molecule-flash-m200 +03:45). The full rewrite advice rides the error.
432
433
  'do not run it in the background — the transform is stuck, not slow'
433
- : run.background
434
- ? run.stoppedBy === 'command-timeout'
435
- ? `drop the \`timeout\` prefix and send it again — in the background a run is bounded by \`wait_for_task\` and the turn's deadline, not by this tool's ceiling, so the bound you wrote is what killed it`
436
- : 'send it again when you are ready'
437
- : 'run it in the background (run_in_background + wait_for_task)';
434
+ : run.browserProbe
435
+ ? // A leaked browser is a live handle: the process never ends, and a background task has no
436
+ // exit to wait for either (xr-molecule-flash-m257 +15:34). The close is the fix.
437
+ `do not run it in the background — the browser (\`${run.browserProbe}\`) is never closed, so it would hang there too; close it in a \`finally\` block, or let the Playwright runner's browser fixture own it`
438
+ : run.background
439
+ ? run.stoppedBy === 'command-timeout'
440
+ ? `drop the \`timeout\` prefix and send it again — in the background a run is bounded by \`wait_for_task\` and the turn's deadline, not by this tool's ceiling, so the bound you wrote is what killed it`
441
+ : 'send it again when you are ready'
442
+ : 'run it in the background (run_in_background + wait_for_task)';
438
443
  const missing = run.ran !== null && run.total !== null ? run.total - run.ran : null;
439
444
  const lead = missing !== null
440
445
  ? `Ran ${run.ran} of ${run.total} ${run.noun} in ${run.seconds} s and was stopped by ${by} — the ${missing} it never reached ${missing === 1 ? 'has' : 'have'} not run; ${background}`
package/dist/index.d.ts CHANGED
@@ -132,6 +132,7 @@
132
132
  export * from './backends/local.js';
133
133
  export * from './backends/sandbox.js';
134
134
  export * from './browser-guard.js';
135
+ export * from './browser-probe.js';
135
136
  export * from './command-position.js';
136
137
  export * from './cut-run.js';
137
138
  export * from './failure-kind.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkIG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,yBAAyB,CAAA;AACvC,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA;AAC1B,cAAc,sBAAsB,CAAA;AACpC,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkIG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,yBAAyB,CAAA;AACvC,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA;AAC1B,cAAc,sBAAsB,CAAA;AACpC,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA"}
package/dist/index.js CHANGED
@@ -132,6 +132,7 @@
132
132
  export * from './backends/local.js';
133
133
  export * from './backends/sandbox.js';
134
134
  export * from './browser-guard.js';
135
+ export * from './browser-probe.js';
135
136
  export * from './command-position.js';
136
137
  export * from './cut-run.js';
137
138
  export * from './failure-kind.js';
@@ -15,6 +15,11 @@
15
15
  * a short budget ({@link INLINE_SCRIPT_BUDGET_MS}), and a cut says what happened: a runaway
16
16
  * transform, not slow work ({@link inlineScriptRunawaySentence}).
17
17
  *
18
+ * The short budget needs the WHOLE command to be that shape. xr-molecule-flash-m254 (+12:48)
19
+ * chained the m200 heredoc with `node …/smoke.mjs | tail -25` — a Playwright walk whose import
20
+ * lives inside the file — and the walk was stopped after 20 s while the result blamed the python
21
+ * transform. Every statement must be proven local ({@link LOCAL_UTILITY}) before the budget applies.
22
+ *
18
23
  * @module
19
24
  */
20
25
  /**
@@ -29,7 +34,12 @@ export declare const INLINE_SCRIPT_BUDGET_MS = 20000;
29
34
  * The interpreter of an INLINE program that only reads and writes local files — the shape that gets
30
35
  * {@link INLINE_SCRIPT_BUDGET_MS} instead of the tool's command budget.
31
36
  *
32
- * An inline program with any external effect keeps the full budget: no network, install, test
37
+ * EVERY statement of the command must be proven local, not just one of them: each is either an
38
+ * inline interpreter program or a plain file utility ({@link LOCAL_UTILITY}). A statement that runs
39
+ * a script FILE (`node smoke.mjs`, `python3 x.py`, `bash x.sh`) or names a program this module does
40
+ * not know can do anything at all, so the command keeps the full budget.
41
+ *
42
+ * An inline program with any external effect keeps the full budget too: no network, install, test
33
43
  * runner, build or server verb may appear anywhere in the command ({@link EXTERNAL_EFFECT}), and
34
44
  * the command must not be a suite run or a foreground server (the platform's own classifiers).
35
45
  *
@@ -1 +1 @@
1
- {"version":3,"file":"inline-script.d.ts","sourceRoot":"","sources":["../src/inline-script.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAMH;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,QAAS,CAAA;AAsD7C;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CASvE;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAOxF"}
1
+ {"version":3,"file":"inline-script.d.ts","sourceRoot":"","sources":["../src/inline-script.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAMH;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,QAAS,CAAA;AAoF7C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAcvE;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAOxF"}
@@ -15,6 +15,11 @@
15
15
  * a short budget ({@link INLINE_SCRIPT_BUDGET_MS}), and a cut says what happened: a runaway
16
16
  * transform, not slow work ({@link inlineScriptRunawaySentence}).
17
17
  *
18
+ * The short budget needs the WHOLE command to be that shape. xr-molecule-flash-m254 (+12:48)
19
+ * chained the m200 heredoc with `node …/smoke.mjs | tail -25` — a Playwright walk whose import
20
+ * lives inside the file — and the walk was stopped after 20 s while the result blamed the python
21
+ * transform. Every statement must be proven local ({@link LOCAL_UTILITY}) before the budget applies.
22
+ *
18
23
  * @module
19
24
  */
20
25
  import { commandSegments } from './command-position.js';
@@ -56,7 +61,36 @@ const HEREDOC = /^<<-?\s*['"]?[A-Za-z_]/;
56
61
  * the long budget and the old advice). That is the safe direction: this list must never shrink the
57
62
  * budget of a command that reaches outside the box.
58
63
  */
59
- const EXTERNAL_EFFECT = /\b(?:curl|wget|aria2c|rsync|scp|sftp|ftp|ssh|urllib3?|httpx|aiohttp|axios|requests|fetch|XMLHttpRequest|socket|net\.connect|https?:\/\/|npm|npx|pnpm|yarn|bun|pip3?|conda|cargo|gem|composer|playwright|vitest|jest|hurl|vite|tsc|webpack|esbuild|rollup|docker|cmake|gradle|mvn|make|subprocess|Popen|child_process|execSync|spawnSync|git|psql|mysql|mongosh?|redis-cli|sqlite3)\b|\bos\.system\b|\b(?:http\.server|flask|fastapi|uvicorn|gunicorn)\b/i;
64
+ const EXTERNAL_EFFECT = /\b(?:curl|wget|aria2c|rsync|scp|sftp|ftp|ssh|urllib3?|httpx|aiohttp|axios|requests|fetch|XMLHttpRequest|socket|net\.connect|https?:\/\/|npm|npx|pnpm|yarn|bun|pip3?|conda|cargo|gem|composer|playwright|vitest|jest|hurl|vite|tsc|webpack|esbuild|rollup|docker|cmake|gradle|mvn|make|subprocess|Popen|child_process|execSync|spawnSync|git|psql|mysql|mongosh?|redis-cli|sqlite3)\b|\bos\.system\b|\b(?:http\.server|flask|fastapi|uvicorn|gunicorn)\b|\/dev\/(?:tcp|udp)/i;
65
+ /**
66
+ * The only OTHER programs a proven-local inline program may share its command with: plain file
67
+ * utilities (`cd app && python3 - <<'EOF' … EOF`, `… EOF | tail -25`).
68
+ *
69
+ * xr-molecule-flash-m254 (+12:48) ran `python3 - <<'EOF' … EOF` and then, in the same command,
70
+ * `node /workspace/.mol-scratch/smoke.mjs | tail -25` — the agent's Playwright UI walk. The
71
+ * heredoc alone is local, so the whole chain got the 20 s budget, the walk was stopped, and the
72
+ * result blamed the python transform. A script FILE can do anything (the `playwright` import is
73
+ * inside it, not in the command text), so a statement that runs one — or any program this set does
74
+ * not list — means the command is not proven local and keeps the full budget.
75
+ *
76
+ * Every program here reads and writes local files and nothing else.
77
+ */
78
+ const LOCAL_UTILITY = new Set([
79
+ 'cat',
80
+ 'cd',
81
+ 'cp',
82
+ 'echo',
83
+ 'grep',
84
+ 'head',
85
+ 'ls',
86
+ 'mkdir',
87
+ 'mv',
88
+ 'rm',
89
+ 'sort',
90
+ 'tail',
91
+ 'test',
92
+ 'wc',
93
+ ]);
60
94
  /**
61
95
  * Whether one parsed statement runs an interpreter program written inline.
62
96
  *
@@ -78,7 +112,12 @@ function inlineProgram(segment) {
78
112
  * The interpreter of an INLINE program that only reads and writes local files — the shape that gets
79
113
  * {@link INLINE_SCRIPT_BUDGET_MS} instead of the tool's command budget.
80
114
  *
81
- * An inline program with any external effect keeps the full budget: no network, install, test
115
+ * EVERY statement of the command must be proven local, not just one of them: each is either an
116
+ * inline interpreter program or a plain file utility ({@link LOCAL_UTILITY}). A statement that runs
117
+ * a script FILE (`node smoke.mjs`, `python3 x.py`, `bash x.sh`) or names a program this module does
118
+ * not know can do anything at all, so the command keeps the full budget.
119
+ *
120
+ * An inline program with any external effect keeps the full budget too: no network, install, test
82
121
  * runner, build or server verb may appear anywhere in the command ({@link EXTERNAL_EFFECT}), and
83
122
  * the command must not be a suite run or a foreground server (the platform's own classifiers).
84
123
  *
@@ -92,12 +131,17 @@ export function inlineLocalScriptCommand(command) {
92
131
  return null;
93
132
  if (isSuiteRunCommand(command) || startsServerProgram(command))
94
133
  return null;
134
+ let interpreter = null;
95
135
  for (const segment of commandSegments(command)) {
96
- const interpreter = inlineProgram(segment);
97
- if (interpreter !== null)
98
- return interpreter;
136
+ const inline = inlineProgram(segment);
137
+ if (inline !== null) {
138
+ interpreter ??= inline;
139
+ continue;
140
+ }
141
+ if (!LOCAL_UTILITY.has(segment.program))
142
+ return null;
99
143
  }
100
- return null;
144
+ return interpreter;
101
145
  }
102
146
  /**
103
147
  * What a cut inline program's result says instead of the background advice: the work never was
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,UAAU,CAAA;CACvB;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CA8U1C,CAAA"}
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,UAAU,CAAA;CACvB;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CA8V1C,CAAA"}
package/dist/schemas.js CHANGED
@@ -85,7 +85,7 @@ export const TOOL_SCHEMAS = {
85
85
  },
86
86
  edit_file: {
87
87
  name: 'edit_file',
88
- description: 'Make targeted search-and-replace edits to a file. Preferred over write_file for small changes. Each old_string must match exactly once in the file, unless that replacement sets replace_all to change every occurrence (a rename, a repeated call). The result shows each edited region as it now reads, with line numbers, so there is no need to re-read the file to check an edit. Independent calls go in ONE response: edits to different files you already know how to make go together in the same response, one edit_file call per file. Only a call that needs another call’s result waits for it.',
88
+ description: 'Make targeted search-and-replace edits to a file. Preferred over write_file for small changes. Send exactly ONE edit form: either a nonempty replacements array (every edit, in order) or a single top-level old_string/new_string pair — never both, and the two forms are not merged. Each old_string must match exactly once in the file, unless that replacement sets replace_all to change every occurrence (a rename, a repeated call). The result shows each edited region as it now reads, with line numbers, so there is no need to re-read the file to check an edit. Independent calls go in ONE response: edits to different files you already know how to make go together in the same response, one edit_file call per file. Only a call that needs another call’s result waits for it.',
89
89
  parameters: {
90
90
  type: 'object',
91
91
  properties: {
@@ -95,7 +95,7 @@ export const TOOL_SCHEMAS = {
95
95
  },
96
96
  replacements: {
97
97
  type: 'array',
98
- description: 'List of search-and-replace operations to apply sequentially.',
98
+ description: 'Batch edit form: search-and-replace operations applied sequentially. Use this OR the top-level old_string/new_string pair, never both.',
99
99
  items: {
100
100
  type: 'object',
101
101
  properties: {
@@ -115,8 +115,20 @@ export const TOOL_SCHEMAS = {
115
115
  required: ['old_string', 'new_string'],
116
116
  },
117
117
  },
118
+ old_string: {
119
+ type: 'string',
120
+ description: 'Single-edit form: exact string to find. Must match exactly once in the file. Send with new_string, and without replacements.',
121
+ },
122
+ new_string: {
123
+ type: 'string',
124
+ description: 'Single-edit form: replacement for the top-level old_string. Send with old_string, and without replacements.',
125
+ },
126
+ replace_all: {
127
+ type: 'boolean',
128
+ description: 'Single-edit form: replace every occurrence of the top-level old_string instead of requiring exactly one (default false).',
129
+ },
118
130
  },
119
- required: ['path', 'replacements'],
131
+ required: ['path'],
120
132
  },
121
133
  },
122
134
  search_files: {
@@ -16,6 +16,7 @@
16
16
  *
17
17
  * @module
18
18
  */
19
+ import { type ForegroundBrowserProbe } from './browser-probe.js';
19
20
  /**
20
21
  * A background launch: a single `&` (not `&&`, not a `2>&1`) or an explicit detacher. A
21
22
  * backgrounded launch never holds the tool, so every reading here stops at it.
@@ -56,6 +57,21 @@ export interface ForegroundServer {
56
57
  * @returns The serving program, or null when the command starts no server in the foreground.
57
58
  */
58
59
  export declare function foregroundServerCommand(command: string, readScript: (path: string) => Promise<string>): Promise<ForegroundServer | null>;
60
+ /**
61
+ * A FOREGROUND command that directly runs a standalone script which launches a browser and never
62
+ * closes it — the same never-returns lifecycle class as {@link foregroundServerCommand}, read from
63
+ * the script's SOURCE by {@link standaloneBrowserLeak}.
64
+ *
65
+ * The boundaries are the server preflight's, so the two readers cannot disagree about what they are
66
+ * allowed to touch: a backgrounded launch, a test runner and a test file are left alone, and a
67
+ * script the backend will not answer for is a command this reading cannot classify, never a
68
+ * refusal. A Playwright suite is owned by its runner's browser fixture and is never read here.
69
+ *
70
+ * @param command - The command as the executor sent it.
71
+ * @param readScript - Reads a script file the command names (`backend.readFile`).
72
+ * @returns The leaked probe's variable and script path, or null when the command is not one.
73
+ */
74
+ export declare function foregroundBrowserProbe(command: string, readScript: (path: string) => Promise<string>): Promise<ForegroundBrowserProbe | null>;
59
75
  /**
60
76
  * The refusal for a foreground command that starts a server: why it would never return, and the
61
77
  * two shapes that do work — a background launch, or a probe of the API already running.
@@ -1 +1 @@
1
- {"version":3,"file":"server-command.d.ts","sourceRoot":"","sources":["../src/server-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH;;;GAGG;AACH,eAAO,MAAM,YAAY,QAA6C,CAAA;AAEtE;;;;;GAKG;AACH,eAAO,MAAM,cAAc,QACmP,CAAA;AAmF9Q;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAI5D;AAED,0EAA0E;AAC1E,MAAM,WAAW,gBAAgB;IAC/B,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB;AAED;;;;;;;;;;;GAWG;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AAC,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAO5F;AAED;;;GAGG;AACH,eAAO,MAAM,yBAAyB,QAG0B,CAAA"}
@@ -16,6 +16,7 @@
16
16
  *
17
17
  * @module
18
18
  */
19
+ import { standaloneBrowserLeak } from './browser-probe.js';
19
20
  import { commandSegments } from './command-position.js';
20
21
  import { withoutHeredocs } from './suite-overlap.js';
21
22
  /**
@@ -157,6 +158,42 @@ export async function foregroundServerCommand(command, readScript) {
157
158
  }
158
159
  return null;
159
160
  }
161
+ /**
162
+ * A FOREGROUND command that directly runs a standalone script which launches a browser and never
163
+ * closes it — the same never-returns lifecycle class as {@link foregroundServerCommand}, read from
164
+ * the script's SOURCE by {@link standaloneBrowserLeak}.
165
+ *
166
+ * The boundaries are the server preflight's, so the two readers cannot disagree about what they are
167
+ * allowed to touch: a backgrounded launch, a test runner and a test file are left alone, and a
168
+ * script the backend will not answer for is a command this reading cannot classify, never a
169
+ * refusal. A Playwright suite is owned by its runner's browser fixture and is never read here.
170
+ *
171
+ * @param command - The command as the executor sent it.
172
+ * @param readScript - Reads a script file the command names (`backend.readFile`).
173
+ * @returns The leaked probe's variable and script path, or null when the command is not one.
174
+ */
175
+ export async function foregroundBrowserProbe(command, readScript) {
176
+ const text = withoutHeredocs(command);
177
+ if (BACKGROUNDED.test(text))
178
+ return null;
179
+ for (const segment of commandSegments(text)) {
180
+ const script = scriptPath(segment);
181
+ if (script === null)
182
+ continue;
183
+ let source;
184
+ try {
185
+ source = await readScript(script);
186
+ }
187
+ catch (_error) {
188
+ // A script the backend cannot read is not classified: the refusal must never be a guess.
189
+ continue;
190
+ }
191
+ const leak = standaloneBrowserLeak(source);
192
+ if (leak !== null)
193
+ return { ...leak, script };
194
+ }
195
+ return null;
196
+ }
160
197
  /**
161
198
  * The refusal for a foreground command that starts a server: why it would never return, and the
162
199
  * two shapes that do work — a background launch, or a probe of the API already running.
@@ -1 +1 @@
1
- {"version":3,"file":"tools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;AACH,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,qBAAqB,GAC5B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAiCxB;AA2GD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,CAAC,EAAE,eAAe,GAAG,MAAM,EAAE,CAm4FxF"}
package/dist/tools.js CHANGED
@@ -7,6 +7,7 @@
7
7
  * @module
8
8
  */
9
9
  import { posix } from 'path';
10
+ import { browserProbeOverBudgetAdvice, browserProbeRefusal } from './browser-probe.js';
10
11
  import { commandCutRun, CUT_AT_BUDGET, cutRunSentence, suiteRunExitCode, suiteSummary, } from './cut-run.js';
11
12
  import { addChangeSpan, changedSpan, countLines, renderEditExcerpt, renderSmallFile, } from './edit-excerpt.js';
12
13
  import { INLINE_SCRIPT_BUDGET_MS, inlineLocalScriptCommand, inlineScriptRunawaySentence, } from './inline-script.js';
@@ -14,7 +15,7 @@ import { guardToolExecute, missingParamError, ToolInputError } from './input-nor
14
15
  import { diffLineCount } from './line-diff.js';
15
16
  import { pipelineExitCodeNote } from './pipeline-exit-note.js';
16
17
  import { TOOL_SCHEMAS } from './schemas.js';
17
- import { foregroundServerCommand, SERVER_OVER_BUDGET_ADVICE, serverCommandRefusal, startsServerProgram, } from './server-command.js';
18
+ import { foregroundBrowserProbe, foregroundServerCommand, SERVER_OVER_BUDGET_ADVICE, serverCommandRefusal, startsServerProgram, } from './server-command.js';
18
19
  import { leadingSleepPeek } from './sleep-peek.js';
19
20
  /**
20
21
  * Total waiting, per background task, after which wait_for_task reports it
@@ -1797,6 +1798,27 @@ export function buildTools(backend, config) {
1797
1798
  const argErr = pathArgError(input.path, 'edit_file');
1798
1799
  if (argErr)
1799
1800
  return { error: argErr };
1801
+ // The batch and the single top-level pair are EXCLUSIVE forms. A call that
1802
+ // carried a nonempty batch AND either top-level string used to apply the
1803
+ // batch and silently discard the pair, so the executor believed both edits
1804
+ // landed (xr-molecule-flash-m257 +06:08). Refuse BEFORE resolving, reading or
1805
+ // writing the file: which form wins, and where the pair would sit in the
1806
+ // batch order, cannot be inferred — and merging the two would silently apply
1807
+ // an overlap the model never asked the tool to resolve.
1808
+ const hasBatch = Array.isArray(input.replacements) && input.replacements.length > 0;
1809
+ const hasTopLevelEdit = input.old_string !== undefined || input.new_string !== undefined;
1810
+ if (hasBatch && hasTopLevelEdit) {
1811
+ // Name the edit that would have vanished (its first line) so the model
1812
+ // recognises it in the re-sent call.
1813
+ const head = typeof input.old_string === 'string'
1814
+ ? input.old_string.split('\n')[0].trim().slice(0, 80)
1815
+ : '';
1816
+ return {
1817
+ error: 'Nothing changed: edit_file received both edit formats' +
1818
+ (head ? ` (the top-level edit starts "${head}")` : '') +
1819
+ '. Put EVERY edit, including the top-level old_string/new_string pair, in replacements, in the intended order — or send only the top-level pair with no replacements array. Never mix the two.',
1820
+ };
1821
+ }
1800
1822
  const path = await resolveWrite(input.path);
1801
1823
  // Support both formats: { replacements: [...] } (batch) and { old_string, new_string } (single, backwards-compatible)
1802
1824
  let replacements = input.replacements;
@@ -2543,6 +2565,20 @@ export function buildTools(backend, config) {
2543
2565
  error: serverCommandRefusal(server, Math.max(1, Math.round((commandBudgetMs ?? 290_000) / 1000))),
2544
2566
  };
2545
2567
  }
2568
+ // The same never-returns class, one handle lower: a standalone script that launches a
2569
+ // browser and never closes it. X1 xr-molecule-flash-m257 (+10:44 → +15:34) ran a 30-line
2570
+ // `fav-probe.mjs` whose `const browser = await chromium.launch()` had no `close()`; Chromium
2571
+ // is a live handle, so Node never exited. Behind `| tail` it printed nothing, the tool
2572
+ // waited its whole 290 s budget, and the over-budget message then advised "run it in the
2573
+ // background" — which only moves the hang. The source reading is narrow and closed-world
2574
+ // (browser-probe.ts): an alias, a helper, a context/page disposal or any other cleanup path
2575
+ // is left alone.
2576
+ const browserProbe = await foregroundBrowserProbe(rawCommand, (path) => backend.readFile(path));
2577
+ if (browserProbe) {
2578
+ return {
2579
+ error: browserProbeRefusal(browserProbe, Math.max(1, Math.round((commandBudgetMs ?? 290_000) / 1000)), /\|\s*(?:tail|head)\b/.test(rawCommand)),
2580
+ };
2581
+ }
2546
2582
  }
2547
2583
  // A Playwright run of a suite whose config records no trace gets one recorded anyway
2548
2584
  // (`diagnosisTraceCommand`, trace-artifacts.ts): the failing tests' own network log is what
@@ -2956,6 +2992,16 @@ export function buildTools(backend, config) {
2956
2992
  // what the result quotes is still the sanitized, truncated text.
2957
2993
  `${result.stdout}\n${result.stderr}`);
2958
2994
  if (cut) {
2995
+ // A probe that wrote its own script and then ran it is only readable NOW: the preflight
2996
+ // read a file that did not exist yet (m257's `fav-probe.mjs` was written in an earlier
2997
+ // turn, but a `cat > probe.mjs <<EOF … && node probe.mjs` is the same seam). Re-read it
2998
+ // before falling back to "run a smaller unit", which is advice about the wrong axis —
2999
+ // and would send a leaked handle to the background, where it hangs just the same.
3000
+ const cutBrowserProbe = inlineScript === null && !startsServerProgram(command) && !isSuiteRunCommand(command)
3001
+ ? await foregroundBrowserProbe(command, (path) => backend.readFile(path))
3002
+ : null;
3003
+ if (cutBrowserProbe !== null)
3004
+ cut.browserProbe = cutBrowserProbe.variable;
2959
3005
  const cutLead = cutRunSentence(cut);
2960
3006
  return {
2961
3007
  stdout,
@@ -2979,9 +3025,11 @@ export function buildTools(backend, config) {
2979
3025
  ? inlineScriptRunawaySentence(inlineScript, cut.seconds)
2980
3026
  : startsServerProgram(command)
2981
3027
  ? SERVER_OVER_BUDGET_ADVICE
2982
- : isSuiteRunCommand(command)
2983
- ? SUITE_OVER_BUDGET_ADVICE
2984
- : SPLIT_WORK_ADVICE),
3028
+ : cutBrowserProbe !== null
3029
+ ? browserProbeOverBudgetAdvice(cutBrowserProbe)
3030
+ : isSuiteRunCommand(command)
3031
+ ? SUITE_OVER_BUDGET_ADVICE
3032
+ : SPLIT_WORK_ADVICE),
2985
3033
  };
2986
3034
  }
2987
3035
  // A pipeline reports its LAST stage's code: `tsc | head` says 0 beside a printed type
@@ -208,8 +208,7 @@ export declare function streamingBackgroundCommand(command: string, context?: Di
208
208
  * Every statement of a command that starts a whole test suite, in command order.
209
209
  *
210
210
  * This is the ONE count of suite runs in a command: {@link isSuiteRunCommand} asks it,
211
- * {@link streamingBackgroundCommand} refuses a command carrying more than one — each statement
212
- * starts a whole walk of the same suite, and only the last of them is rewritten — and a re-run
211
+ * {@link repeatedSuiteRunError} refuses only simple identical invocations, and a re-run
213
212
  * composed from a command ({@link ./suite-overlap.js} `scopedRerunCommand`) keeps only the first.
214
213
  *
215
214
  * A statement that invokes a runner only to print is not one of these
@@ -229,23 +228,15 @@ export declare function suiteRunStatements(command: string): string[];
229
228
  */
230
229
  export declare function isSuiteRunCommand(command: string): boolean;
231
230
  /**
232
- * The refusal for a command that starts the suite MORE THAN ONCE — the ONE reading every launch
233
- * site asks, foreground and background alike.
231
+ * Refuse only a command made entirely of identical suite invocations.
234
232
  *
235
- * Each statement is a whole walk of the same suite against the same app, and only the last of them
236
- * is rewritten, so the earlier ones measure nothing the first did. X1 xr-molecule-flash-m157
237
- * (+14:02) chained two whole walks of one 138-test suite with `;` (4.5 minutes each) and the
238
- * background launcher refused it; X1 xr-molecule-flash-m170 (+06:02) chained two invocations of the
239
- * suite's own runner script in the foreground, where nothing counted them, and the note reported
240
- * the passing second walk as the first walk's 13 failures.
241
- *
242
- * The one run handed back is the LAST suite statement, rewritten exactly as
243
- * {@link streamingBackgroundCommand} rewrites a run (a filter or `| tail` after the runner is
244
- * dropped, and a Playwright run gets the reporter that prints failures). Its own count is one —
245
- * guarded, so this cannot recurse.
233
+ * Mixed shell commands execute as written. Rebuilding their prefix or suffix can lose writes,
234
+ * break heredoc delimiters or turn an && guard into unconditional work (m277). Different args
235
+ * or environments may select different suites or targets; they are not known duplicates either.
236
+ * This is an optimization, so uncertainty always allows the original command.
246
237
  *
247
238
  * @param command - The shell command as the executor sent it.
248
- * @returns The refusal sentence, or null when the command starts the suite zero or one time.
239
+ * @returns The duplicate-only refusal, or null when the original command should run.
249
240
  */
250
241
  export declare function repeatedSuiteRunError(command: string): string | null;
251
242
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAE3E,OAAO,EACL,KAAK,mBAAmB,EAExB,KAAK,aAAa,EAMnB,MAAM,oBAAoB,CAAA;AAE3B;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAS5C;AAED;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAAI,GAAG,MAAM,KAAG,MAEE,CAAA;AAuGhD;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAK/C;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAErD;AAKD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAsCzD;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGnD;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,GAAG,MAAM,CAUpF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAElE;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQnE;AAuDD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,8BAA8B,0CAA0C,CAAA;AAsBrF;;;;;;;;;;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ED
@@ -675,8 +675,7 @@ const SUITE_RUN_COMMANDS = [
675
675
  * Every statement of a command that starts a whole test suite, in command order.
676
676
  *
677
677
  * This is the ONE count of suite runs in a command: {@link isSuiteRunCommand} asks it,
678
- * {@link streamingBackgroundCommand} refuses a command carrying more than one — each statement
679
- * starts a whole walk of the same suite, and only the last of them is rewritten — and a re-run
678
+ * {@link repeatedSuiteRunError} refuses only simple identical invocations, and a re-run
680
679
  * composed from a command ({@link ./suite-overlap.js} `scopedRerunCommand`) keeps only the first.
681
680
  *
682
681
  * A statement that invokes a runner only to print is not one of these
@@ -690,10 +689,7 @@ export function suiteRunStatements(command) {
690
689
  if (commandRunsNoTests(command))
691
690
  return [];
692
691
  return commandSegments(command)
693
- .filter((segment) => SUITE_RUN_COMMANDS.some((re) => re.test(segment.text)) &&
694
- // A statement that only PRINTS (`playwright test --list`) is not a walk, so
695
- // `npx playwright test --list && npx playwright test` is one run, not two.
696
- !commandRunsNoTests(segment.text))
692
+ .filter((segment) => SUITE_RUN_COMMANDS.some((re) => re.test(segment.text)) && !commandRunsNoTests(segment.text))
697
693
  .map((segment) => segment.text);
698
694
  }
699
695
  /**
@@ -707,41 +703,42 @@ export function isSuiteRunCommand(command) {
707
703
  return suiteRunStatements(command).length > 0;
708
704
  }
709
705
  /**
710
- * The refusal for a command that starts the suite MORE THAN ONCE — the ONE reading every launch
711
- * site asks, foreground and background alike.
706
+ * Refuse only a command made entirely of identical suite invocations.
712
707
  *
713
- * Each statement is a whole walk of the same suite against the same app, and only the last of them
714
- * is rewritten, so the earlier ones measure nothing the first did. X1 xr-molecule-flash-m157
715
- * (+14:02) chained two whole walks of one 138-test suite with `;` (4.5 minutes each) and the
716
- * background launcher refused it; X1 xr-molecule-flash-m170 (+06:02) chained two invocations of the
717
- * suite's own runner script in the foreground, where nothing counted them, and the note reported
718
- * the passing second walk as the first walk's 13 failures.
719
- *
720
- * The one run handed back is the LAST suite statement, rewritten exactly as
721
- * {@link streamingBackgroundCommand} rewrites a run (a filter or `| tail` after the runner is
722
- * dropped, and a Playwright run gets the reporter that prints failures). Its own count is one —
723
- * guarded, so this cannot recurse.
708
+ * Mixed shell commands execute as written. Rebuilding their prefix or suffix can lose writes,
709
+ * break heredoc delimiters or turn an && guard into unconditional work (m277). Different args
710
+ * or environments may select different suites or targets; they are not known duplicates either.
711
+ * This is an optimization, so uncertainty always allows the original command.
724
712
  *
725
713
  * @param command - The shell command as the executor sent it.
726
- * @returns The refusal sentence, or null when the command starts the suite zero or one time.
714
+ * @returns The duplicate-only refusal, or null when the original command should run.
727
715
  */
728
716
  export function repeatedSuiteRunError(command) {
729
717
  if (commandRunsNoTests(command))
730
718
  return null;
731
- const suiteSteps = suiteRunStatements(command);
732
- if (suiteSteps.length <= 1)
719
+ const steps = locatedCommandSegments(command);
720
+ if (steps.length <= 1)
721
+ return null;
722
+ const first = steps[0];
723
+ const segment = first.segment;
724
+ if (segment === null)
725
+ return null;
726
+ if (steps.some((step) => step.segment === null ||
727
+ step.start === null ||
728
+ step.end === null ||
729
+ step.redirectTarget !== null ||
730
+ step.separator === '|' ||
731
+ step.terminator === '|' ||
732
+ step.segment.args.some((arg) => /[<>]/.test(arg)) ||
733
+ !SUITE_RUN_COMMANDS.some((re) => re.test(step.segment.text)) ||
734
+ step.segment.text !== segment.text ||
735
+ step.assignments.join('\0') !== first.assignments.join('\0')))
733
736
  return null;
734
- const lastSuitePart = command
735
- .split(/&&|\|\||;/)
736
- .reverse()
737
- .map((p) => p.trim())
738
- .find((p) => isSuiteRunCommand(p));
739
- const single = lastSuitePart && suiteRunStatements(lastSuitePart).length === 1
740
- ? streamingBackgroundCommand(lastSuitePart).command
741
- : (lastSuitePart ?? '');
742
- return (`This command runs the suite ${suiteSteps.length === 2 ? 'twice' : `${suiteSteps.length} times`} ` +
743
- `(${suiteSteps.map((s, i) => `step ${i + 1}: \`${s}\``).join(', ')}). One walk is the ` +
744
- `measurement; run exactly one: \`${single}\``);
737
+ const last = steps.at(-1);
738
+ const single = streamingBackgroundCommand(command.slice(last.start, last.end)).command;
739
+ return (`This command runs the suite ${steps.length === 2 ? 'twice' : `${steps.length} times`} ` +
740
+ `(${steps.map((step, i) => `step ${i + 1}: \`${step.segment.text}\``).join(', ')}). ` +
741
+ `One walk is the measurement; run exactly one: \`${single}\``);
745
742
  }
746
743
  /** A flag with its value, as {@link suiteRunBudgetCommand} writes it: `--timeout=15000`. */
747
744
  const BUDGET_FLAG = /^(--[A-Za-z][\w-]*)=(\S+)$/;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/api-ai-tools",
3
- "version": "1.10.6",
3
+ "version": "1.10.8",
4
4
  "description": "Shared AI agent tools with backend abstraction for sandbox and local execution",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",