@molecule/api-ai-tools 1.17.5 → 1.17.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/README.md CHANGED
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-11-06T21:09:39.519Z
6
+ Generated: 2026-11-08T00:13:16.790Z
7
7
  -->
8
8
 
9
9
  # @molecule/api-ai-tools
@@ -1491,6 +1491,9 @@ interface ToolBuildConfig {
1491
1491
  /** Post-write hook (e.g. auto-format via Prettier/ESLint). */
1492
1492
  onAfterWrite?: (path: string) => Promise<void>
1493
1493
 
1494
+ /** Prepare a background command script after it is written, before launching it. */
1495
+ prepareBackgroundScript?: (path: string, content: string) => Promise<void>
1496
+
1494
1497
  /** Diff tracking callback. */
1495
1498
  onFileDiff?: (event: FileDiffEvent) => void
1496
1499
 
@@ -5470,6 +5473,14 @@ survives the real launch path.
5470
5473
  const PLATFORM_PROOF: unique symbol
5471
5474
  ```
5472
5475
 
5476
+ #### `supportsBackgroundScriptPreparation`
5477
+
5478
+ Hosts can retain their script-write fallback when an older package lacks this hook.
5479
+
5480
+ ```typescript
5481
+ const supportsBackgroundScriptPreparation: true
5482
+ ```
5483
+
5473
5484
  #### `SPLIT_WORK_ADVICE`
5474
5485
 
5475
5486
  The closing advice on an over-budget message for a command that is not a test
@@ -6105,6 +6116,11 @@ Peer dependencies:
6105
6116
  read, then the write with its parse check. Diff tracking and redaction checks
6106
6117
  stay in the tools. Format and change hooks retain their ordering before parsing;
6107
6118
  large files and backends without these operations use the native file APIs.
6119
+ Hosts that validate/compose background shell scripts use `prepareBackgroundScript`
6120
+ instead of overriding the backend's ordinary `writeFile`: it runs after the script
6121
+ is written and before launch, and a rejection prevents the command from starting.
6122
+ `supportsBackgroundScriptPreparation` advertises this hook; hosts keep their existing
6123
+ script-write preparation when running against older package versions.
6108
6124
  - **Scope the tool set per agent** with `include`/`exclude` — a read-only agent
6109
6125
  should not receive `write_file`/`exec_command`.
6110
6126
  - Outputs are size-capped (`MAX_READ_SIZE`, `MAX_OUTPUT_SIZE`, …) and searches
package/dist/index.d.ts CHANGED
@@ -109,6 +109,11 @@
109
109
  * read, then the write with its parse check. Diff tracking and redaction checks
110
110
  * stay in the tools. Format and change hooks retain their ordering before parsing;
111
111
  * large files and backends without these operations use the native file APIs.
112
+ * Hosts that validate/compose background shell scripts use `prepareBackgroundScript`
113
+ * instead of overriding the backend's ordinary `writeFile`: it runs after the script
114
+ * is written and before launch, and a rejection prevents the command from starting.
115
+ * `supportsBackgroundScriptPreparation` advertises this hook; hosts keep their existing
116
+ * script-write preparation when running against older package versions.
112
117
  * - **Scope the tool set per agent** with `include`/`exclude` — a read-only agent
113
118
  * should not receive `write_file`/`exec_command`.
114
119
  * - Outputs are size-capped (`MAX_READ_SIZE`, `MAX_OUTPUT_SIZE`, …) and searches
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyKG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA;AACrC,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,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AA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,YAAY,CAAA;AAC1B,cAAc,sBAAsB,CAAA;AACpC,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA"}
package/dist/index.js CHANGED
@@ -109,6 +109,11 @@
109
109
  * read, then the write with its parse check. Diff tracking and redaction checks
110
110
  * stay in the tools. Format and change hooks retain their ordering before parsing;
111
111
  * large files and backends without these operations use the native file APIs.
112
+ * Hosts that validate/compose background shell scripts use `prepareBackgroundScript`
113
+ * instead of overriding the backend's ordinary `writeFile`: it runs after the script
114
+ * is written and before launch, and a rejection prevents the command from starting.
115
+ * `supportsBackgroundScriptPreparation` advertises this hook; hosts keep their existing
116
+ * script-write preparation when running against older package versions.
112
117
  * - **Scope the tool set per agent** with `include`/`exclude` — a read-only agent
113
118
  * should not receive `write_file`/`exec_command`.
114
119
  * - Outputs are size-capped (`MAX_READ_SIZE`, `MAX_OUTPUT_SIZE`, …) and searches
@@ -1 +1 @@
1
- {"version":3,"file":"no-test-run.d.ts","sourceRoot":"","sources":["../src/no-test-run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAkLH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAiB3D"}
1
+ {"version":3,"file":"no-test-run.d.ts","sourceRoot":"","sources":["../src/no-test-run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAoLH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAiB3D"}
@@ -181,9 +181,11 @@ const NO_TEST_PROGRAMS = new Set([
181
181
  /**
182
182
  * A heredoc body is data a command writes, not what it runs: a `playwright test --list` inside
183
183
  * the config a command writes is not a run of this command either way. The pattern consumes the
184
- * writer's own line prefix, the same shape `outputRedirectTarget` reads.
184
+ * writer's own line prefix, the same shape `outputRedirectTarget` reads. Start only at a
185
+ * statement boundary: retrying that prefix at every character makes lines without heredocs
186
+ * quadratic (a 55 KiB comment delayed runner classification by seconds).
185
187
  */
186
- const HEREDOC = /[^\n;&|]*<<-?\s*(['"]?)(\w+)\1[\s\S]*?\n\s*\2\b/g;
188
+ const HEREDOC = /(?:^|(?<=[\n;&|]))[^\n;&|]*<<-?\s*(['"]?)(\w+)\1[\s\S]*?\n\s*\2\b/g;
187
189
  /**
188
190
  * Whether this runner's invocation — the text from just after its name to the end of its
189
191
  * segment ({@link commandSegments}) — only prints.
@@ -1 +1 @@
1
- {"version":3,"file":"playwright-feedback-process.d.ts","sourceRoot":"","sources":["../src/playwright-feedback-process.ts"],"names":[],"mappings":"AASA,UAAU,sBAAsB;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;CAClB;AAkLD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,CAE5E"}
1
+ {"version":3,"file":"playwright-feedback-process.d.ts","sourceRoot":"","sources":["../src/playwright-feedback-process.ts"],"names":[],"mappings":"AASA,UAAU,sBAAsB;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;CAClB;AA6LD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,CAE5E"}
@@ -111,6 +111,18 @@ function feedbackProcess(loadModule, config) {
111
111
  const other = fs.statSync(`/proc/${pid}/root${config.root}`);
112
112
  if (other.dev !== project.dev || other.ino !== project.ino)
113
113
  continue;
114
+ // Another background feedback run is not foreground work. A killed run keeps its idle CPU class, so on a
115
+ // saturated machine its Playwright processes can wait to be scheduled long after their supervisor exited,
116
+ // with their command line still readable; the next run then yielded to them and reported `cancelled`.
117
+ let environ = '';
118
+ try {
119
+ environ = fs.readFileSync(`/proc/${pid}/environ`, 'utf8');
120
+ }
121
+ catch (_error) {
122
+ /* an unreadable environment leaves the decision to the command line below */
123
+ }
124
+ if (environ.split('\0').some((entry) => entry.startsWith('MOL_TEST_FEEDBACK_EVENTS=')))
125
+ continue;
114
126
  const argv = fs.readFileSync(`/proc/${pid}/cmdline`, 'utf8').split('\0').filter(Boolean);
115
127
  const executable = path.basename(argv[0] || '');
116
128
  // npm replaces argv with its process title before it starts the script.
package/dist/tools.d.ts CHANGED
@@ -8,6 +8,8 @@
8
8
  */
9
9
  import type { AITool } from '@molecule/api-ai';
10
10
  import { type PlaywrightRunReport } from './playwright-report.js';
11
+ /** Hosts can retain their script-write fallback when an older package lacks this hook. */
12
+ export declare const supportsBackgroundScriptPreparation = true;
11
13
  /**
12
14
  * One report file's bounded facts and retained native attachments, or honest omissions.
13
15
  *
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AA4B9C,OAAO,EAIL,KAAK,mBAAmB,EAEzB,MAAM,wBAAwB,CAAA;AAuC/B;;;;;;;;;;GAUG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,UAAU,GAAG,KAAK,CAAC,EACnD,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GACjC,OAAO,CAAC,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AAE,OAAO,CAAA;IACzB,8FAA8F;IAC9F,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAC5B;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAA;AAoBpF;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,CAAC,GACxE,qBAAqB,CAkBvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;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,CAyxGxF"}
package/dist/tools.js CHANGED
@@ -22,6 +22,8 @@ import { requestScopedCommand } from './request-test-exclusions.js';
22
22
  import { TOOL_SCHEMAS } from './schemas.js';
23
23
  import { foregroundBrowserProbe, foregroundServerCommand, SERVER_OVER_BUDGET_ADVICE, serverCommandRefusal, startsServerProgram, } from './server-command.js';
24
24
  import { leadingSleepPeek } from './sleep-peek.js';
25
+ /** Hosts can retain their script-write fallback when an older package lacks this hook. */
26
+ export const supportsBackgroundScriptPreparation = true;
25
27
  /**
26
28
  * Total waiting, per background task, after which wait_for_task reports it
27
29
  * stuck instead of waiting again. Env-tunable so a test can exercise it.
@@ -1084,7 +1086,7 @@ function packageCatalog(path) {
1084
1086
  * @returns Array of AITool objects ready to pass to an AI provider
1085
1087
  */
1086
1088
  export function buildTools(backend, config) {
1087
- const { include, exclude, pathGuards = true, symlinkGuards = false, redactSecrets: doRedact = true, blockDangerousCommands = false, blockCommand, execTimeoutMs = 120_000, commandBudgetMs, waitBudgetMs, overCeilingGraceMs = OVER_CEILING_GRACE_MS, searchExcludedDirs, outlineLargeHtml, excludedTestTitles, requiredSuiteEnv, suiteRunMs, onAfterWrite, onFileDiff, onFileChange, } = config ?? {};
1089
+ const { include, exclude, pathGuards = true, symlinkGuards = false, redactSecrets: doRedact = true, blockDangerousCommands = false, blockCommand, execTimeoutMs = 120_000, commandBudgetMs, waitBudgetMs, overCeilingGraceMs = OVER_CEILING_GRACE_MS, searchExcludedDirs, outlineLargeHtml, excludedTestTitles, requiredSuiteEnv, suiteRunMs, onAfterWrite, prepareBackgroundScript, onFileDiff, onFileChange, } = config ?? {};
1088
1090
  // A host may opt into a longer background wait without lengthening foreground commands.
1089
1091
  // Unset is deliberately the old expression, so every other host keeps its exact ceiling.
1090
1092
  const waitCeilingMs = waitBudgetMs === undefined
@@ -3092,6 +3094,8 @@ export function buildTools(backend, config) {
3092
3094
  launched.add(id);
3093
3095
  launchedByBackend.set(backend, launched);
3094
3096
  await backend.writeFile(script, `${streaming.command}\n`);
3097
+ if (prepareBackgroundScript)
3098
+ await prepareBackgroundScript(script, `${streaming.command}\n`);
3095
3099
  // The clock the grace return below reports a stopped run against: the command is
3096
3100
  // started here, and how long it ran is what a stop at its own bound is read from.
3097
3101
  const launchedAt = Date.now();
@@ -3796,10 +3800,9 @@ export function buildTools(backend, config) {
3796
3800
  newFailureCauses: fresh.map((cause) => sanitizeOutput(cause)),
3797
3801
  // This yield fires only on a FINAL failure (the `finalOnly` read above), so the
3798
3802
  // deployed run it belongs to can no longer pass and a local edit cannot void a green
3799
- // proof. The note therefore spends its words on what to do with that: start the fix
3800
- // while the walk continues, and only talk to the app once the run has ended. Wording it
3801
- // as patience alone cost 4 min 45 s of idle on an already-red run (xr-molecule-flash-
3802
- // hl01), against ≈4.5 min saved when the same yield was acted on (l69).
3803
+ // proof. Keep discovering causes during the repair, then replace the failed build:
3804
+ // waiting after its known causes were fixed cost l1671 another 295 s without learning
3805
+ // another cause. Retirement must precede replacement so no walk mixes builds or data.
3803
3806
  note: localDiagnostic
3804
3807
  ? 'A test in this local diagnostic has failed on its final attempt. This is partial ' +
3805
3808
  'output, not a completed result; the task is still running against mutable local source. ' +
@@ -3821,11 +3824,13 @@ export function buildTools(backend, config) {
3821
3824
  })
3822
3825
  : '')
3823
3826
  : 'A test in this run has failed on its final attempt, so this deployed run will not ' +
3824
- 'pass. This is partial log output, not a completed result: leave the task running — ' +
3825
- "its end names the run's other failures. Local edits do not change this deployed " +
3827
+ 'pass. This is partial log output, not a completed result: leave the task running while you fix ' +
3828
+ 'and collect any new causes it exposes. Local edits do not change this deployed ' +
3826
3829
  'build, so start on this failure now: read the failing spec and the code it drives, ' +
3827
- 'and fix it while the run keeps walking. Send nothing against this app until the run ' +
3828
- 'ends, then collect its final result with `wait_for_task`.',
3830
+ 'and fix it while the run keeps walking. Once every known cause is fixed, deploy now ' +
3831
+ 'rather than waiting for this failed walk to finish. The deploy must retire this task before replacing the build; ' +
3832
+ 'collect its stopped or completed result with `wait_for_task`. Do not start a second test run while this task is running. ' +
3833
+ 'Its remaining tests stay unmeasured; hand-back still requires the full supplied suite against the new deployed build to pass with its own settings.',
3829
3834
  };
3830
3835
  }
3831
3836
  // A lead: this wait goes on, and the finding rides its result as a note — the executor has
package/dist/types.d.ts CHANGED
@@ -268,6 +268,12 @@ export interface ToolBuildConfig {
268
268
  suiteRunMs?: (command: string, cwd: string) => Promise<number | null | undefined>;
269
269
  /** Post-write hook (e.g. auto-format via Prettier/ESLint). Called after every write_file/edit_file. */
270
270
  onAfterWrite?: (path: string) => Promise<void>;
271
+ /**
272
+ * Prepare a background command script after it is written, before launching it.
273
+ * Hosts may validate or rewrite this script without overriding ordinary file writes
274
+ * (which would disable safe transport batching). A rejection prevents launch.
275
+ */
276
+ prepareBackgroundScript?: (path: string, content: string) => Promise<void>;
271
277
  /** Diff tracking callback. Called before writes with old/new content. */
272
278
  onFileDiff?: (event: FileDiffEvent) => void;
273
279
  /** Structural change callback. Called on create_directory, delete_file, rename_file. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,yFAAyF;IACzF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAE5B;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;IAEzB,6CAA6C;IAC7C,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAEvC,qEAAqE;IACrE,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAEvD;;;;;;OAMG;IACH,iBAAiB,CAAC,CAChB,IAAI,EAAE,MAAM,EACZ,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAA;IAEzD;;;;;OAKG;IACH,iBAAiB,CAAC,CAChB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAAA;IAEvE,qBAAqB;IACrB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAEvC,mCAAmC;IACnC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,GAAG,WAAW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ED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,CAAA;IACxC,IAAI,EAAE,MAAM,CAAA;CACb;AAED,+DAA+D;AAC/D,MAAM,WAAW,UAAU;IACzB,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,yBAAyB;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,wDAAwD;IACxD,SAAS,EAAE,MAAM,CAAA;IAEjB,yBAAyB;IACzB,WAAW,EAAE,MAAM,CAAA;IAEnB,+DAA+D;IAC/D,KAAK,EAAE,MAAM,EAAE,CAAA;IAEf,+DAA+D;IAC/D,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IAEjB,kFAAkF;IAClF,gBAAgB,CAAC,EAAE,UAAU,EAAE,CAAA;IAE/B,+CAA+C;IAC/C,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;CAC1B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/api-ai-tools",
3
- "version": "1.17.5",
3
+ "version": "1.17.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",