@molecule/api-ai-tools 1.0.2 → 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/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-08-13T21:34:34.535Z
6
+ Generated: 2026-09-13T01:33:38.011Z
7
7
  -->
8
8
 
9
9
  # @molecule/api-ai-tools
@@ -208,6 +208,16 @@ interface ToolBuildConfig {
208
208
  */
209
209
  execTimeoutMs?: number
210
210
 
211
+ /**
212
+ * Budget (ms) enforced INSIDE the sandbox for a single `exec_command`: the
213
+ * command runs under `timeout`, so when it overruns it is stopped and the
214
+ * tool still returns everything it printed until then (exit code 124 plus
215
+ * an `error` naming the limit). Without this, an outer per-tool timeout
216
+ * races the run and discards minutes of build or test output along with
217
+ * the result. Set it a little under that outer timeout. Unset = no wrapper.
218
+ */
219
+ commandBudgetMs?: number
220
+
211
221
  /**
212
222
  * Directory names `search_files` and `find_files` skip (VS Code
213
223
  * `search.exclude` semantics). Defaults to `DEFAULT_SEARCH_EXCLUDED_DIRS`
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAG9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAsBnE;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,CAAC,EAAE,eAAe,GAAG,MAAM,EAAE,CAopBxF"}
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAG9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAsBnE;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,CAAC,EAAE,eAAe,GAAG,MAAM,EAAE,CAwqBxF"}
package/dist/tools.js CHANGED
@@ -16,7 +16,7 @@ import { checkBlockedCommand, DEFAULT_SEARCH_EXCLUDED_DIRS, directoryReadHint, i
16
16
  * @returns Array of AITool objects ready to pass to an AI provider
17
17
  */
18
18
  export function buildTools(backend, config) {
19
- const { include, exclude, pathGuards = true, symlinkGuards = false, redactSecrets: doRedact = true, blockDangerousCommands = false, blockCommand, execTimeoutMs = 120_000, searchExcludedDirs, onAfterWrite, onFileDiff, onFileChange, } = config ?? {};
19
+ const { include, exclude, pathGuards = true, symlinkGuards = false, redactSecrets: doRedact = true, blockDangerousCommands = false, blockCommand, execTimeoutMs = 120_000, commandBudgetMs, searchExcludedDirs, onAfterWrite, onFileDiff, onFileChange, } = config ?? {};
20
20
  const root = backend.projectRoot;
21
21
  // One synchronized excluded-dir set for BOTH search tools (VS Code
22
22
  // `search.exclude` semantics). Names are validated defensively — they are
@@ -502,12 +502,30 @@ export function buildTools(backend, config) {
502
502
  try {
503
503
  // exec_command runs installs/builds/tests — the old 30s hardcap killed
504
504
  // those spuriously; use the (generous, caller-configurable) budget.
505
- const result = await backend.run(command, { cwd, timeout: execTimeoutMs });
505
+ // With a command budget, the command runs under `timeout` inside the
506
+ // sandbox: an overrun is stopped there (the whole process group) and
507
+ // everything printed until then comes back with exit code 124, instead
508
+ // of an outer timeout discarding the run and its output together.
509
+ const budgetSeconds = commandBudgetMs ? Math.max(1, Math.round(commandBudgetMs / 1000)) : 0;
510
+ const wrapped = budgetSeconds
511
+ ? `timeout -k 5 ${budgetSeconds} bash -c ${shellQuote(command)}`
512
+ : command;
513
+ const result = await backend.run(wrapped, { cwd, timeout: execTimeoutMs });
506
514
  // truncateMiddle (not truncate): a failing build/test/migration puts its
507
515
  // error at the TAIL, so keep the head AND the tail — head-only truncation
508
516
  // strands the executor with passing progress and no failure reason.
509
517
  const stdout = sanitizeOutput(truncateMiddle(result.stdout, MAX_OUTPUT_SIZE));
510
518
  const stderr = sanitizeOutput(truncateMiddle(result.stderr, MAX_OUTPUT_SIZE));
519
+ if (budgetSeconds && result.exitCode === 124) {
520
+ return {
521
+ stdout,
522
+ stderr,
523
+ exitCode: result.exitCode,
524
+ error: `The command was stopped after ${budgetSeconds}s, this tool's limit; the output above is ` +
525
+ 'everything it printed until then. Run a smaller unit per command (one test file, one ' +
526
+ 'build step) instead of chaining a build and a whole suite.',
527
+ };
528
+ }
511
529
  return { stdout, stderr, exitCode: result.exitCode };
512
530
  }
513
531
  catch (e) {
package/dist/types.d.ts CHANGED
@@ -74,6 +74,15 @@ export interface ToolBuildConfig {
74
74
  * this is only the ceiling before a wedged command is killed.
75
75
  */
76
76
  execTimeoutMs?: number;
77
+ /**
78
+ * Budget (ms) enforced INSIDE the sandbox for a single `exec_command`: the
79
+ * command runs under `timeout`, so when it overruns it is stopped and the
80
+ * tool still returns everything it printed until then (exit code 124 plus
81
+ * an `error` naming the limit). Without this, an outer per-tool timeout
82
+ * races the run and discards minutes of build or test output along with
83
+ * the result. Set it a little under that outer timeout. Unset = no wrapper.
84
+ */
85
+ commandBudgetMs?: number;
77
86
  /**
78
87
  * Directory names `search_files` and `find_files` skip (VS Code
79
88
  * `search.exclude` semantics). Defaults to `DEFAULT_SEARCH_EXCLUDED_DIRS`
@@ -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,W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;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,IAAI,CAyBf"}
package/dist/utilities.js CHANGED
@@ -154,8 +154,17 @@ export function isEnvFilePath(path) {
154
154
  return base === '.env' || base.startsWith('.env.') || base.endsWith('.env');
155
155
  }
156
156
  // ── Command blocking ──────────────────────────────────────────────────────────
157
- /** Commands that dump environment variables — blocked to prevent secret leakage. */
158
- const BLOCKED_COMMANDS = /(?:^|[;&|`]\s*|(?:sh|bash|zsh|dash)\s+-c\s+['"]?\s*)(?:\/usr\/bin\/)?(?:\benv\b|\bprintenv\b|\bexport\s*$|\bset\s*$|\bdeclare\s+-x|cat\s+\/etc\/environment|cat\s+\/root\/\.bashrc|cat\s+\/proc\/\d+\/environ|cat\s+\/proc\/self\/environ|strings\s+\/proc|xargs[^;&|\n]*\/proc\/[^;&|\n]*environ|less\s+\/proc|head\s+\/proc|tail\s+\/proc|xxd\s+\/proc|od\s+\/proc|base64\s+\/proc|dd\s[^\n]*\/proc|sed\s[^\n]*\/proc\/[^\n]*environ|awk\s[^\n]*\/proc\/[^\n]*environ|cp\s[^\n]*\/proc\/[^\n]*environ)/i;
157
+ /**
158
+ * Commands that dump environment variables — blocked to prevent secret leakage.
159
+ *
160
+ * `env` counts only when it DUMPS: bare, or with the `-0` / `--null` output
161
+ * flags, followed by the end of the command or a separator / pipe / redirect.
162
+ * `env -u KEY cmd`, `env KEY=value cmd` and `env -i cmd` run a command with a
163
+ * changed environment and print nothing; an executor reaches for them to prove
164
+ * a keyless build still succeeds, and blocking those sent it looking for
165
+ * workarounds (X0 rehearsal 14).
166
+ */
167
+ const BLOCKED_COMMANDS = /(?:^|[;&|`]\s*|(?:sh|bash|zsh|dash)\s+-c\s+['"]?\s*)(?:\/usr\/bin\/)?(?:\benv(?:\s+(?:-0|--null|--))?\s*(?:$|[;&|>)`'"])|\bprintenv\b|\bexport\s*$|\bset\s*$|\bdeclare\s+-x|cat\s+\/etc\/environment|cat\s+\/root\/\.bashrc|cat\s+\/proc\/\d+\/environ|cat\s+\/proc\/self\/environ|strings\s+\/proc|xargs[^;&|\n]*\/proc\/[^;&|\n]*environ|less\s+\/proc|head\s+\/proc|tail\s+\/proc|xxd\s+\/proc|od\s+\/proc|base64\s+\/proc|dd\s[^\n]*\/proc|sed\s[^\n]*\/proc\/[^\n]*environ|awk\s[^\n]*\/proc\/[^\n]*environ|cp\s[^\n]*\/proc\/[^\n]*environ)/i;
159
168
  /** Block shell redirects from /proc environ. */
160
169
  const BLOCKED_PROC_REDIRECT = /(?:<\s*\/proc\/(?:\d+|self)\/environ)/i;
161
170
  /** Interpreter-based env dumping (python, node, ruby, perl). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/api-ai-tools",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
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",
@@ -31,10 +31,10 @@
31
31
  "@molecule/api-ai": "^1.0.1"
32
32
  },
33
33
  "devDependencies": {
34
- "@molecule/api-ai": "1.0.1",
34
+ "@molecule/api-ai": "1.2.0",
35
35
  "@types/node": "26.1.2",
36
36
  "typescript": "6.0.3",
37
- "vitest": "4.1.10"
37
+ "vitest": "4.1.11"
38
38
  },
39
39
  "repository": {
40
40
  "type": "git",