@sema-agent/core 1.452.0 → 2.0.0

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.
Files changed (162) hide show
  1. package/dist/agents/agent-transcript-tool.d.ts +15 -0
  2. package/dist/agents/agent-transcript-tool.js +122 -0
  3. package/dist/agents/cascade.js +5 -8
  4. package/dist/agents/repair-loop.d.ts +1 -1
  5. package/dist/agents/repair-loop.js +1 -1
  6. package/dist/agents/retain-ledger.d.ts +60 -0
  7. package/dist/agents/retain-ledger.js +225 -0
  8. package/dist/agents/roster-store.d.ts +1 -0
  9. package/dist/agents/roster-store.js +9 -0
  10. package/dist/agents/send-message-tool.d.ts +41 -0
  11. package/dist/agents/send-message-tool.js +469 -0
  12. package/dist/agents/subagent.d.ts +33 -108
  13. package/dist/agents/subagent.js +22 -834
  14. package/dist/agents/teacher.d.ts +0 -1
  15. package/dist/agents/teacher.js +0 -9
  16. package/dist/bin/sema-tb.js +3 -3
  17. package/dist/brain/anthropic.js +15 -40
  18. package/dist/brain/openai.js +15 -40
  19. package/dist/brain/reasoning.d.ts +1 -1
  20. package/dist/brain/stream-engine.js +2 -2
  21. package/dist/brain/stream-shared.d.ts +17 -0
  22. package/dist/brain/stream-shared.js +50 -0
  23. package/dist/brain/timeout.d.ts +1 -1
  24. package/dist/brain/timeout.js +1 -1
  25. package/dist/config/catalog.js +1 -3
  26. package/dist/config/defaults.d.ts +6 -0
  27. package/dist/config/defaults.js +6 -0
  28. package/dist/core/ask-question.d.ts +1 -1
  29. package/dist/core/background-shell.d.ts +1 -1
  30. package/dist/core/checkpoint-store.d.ts +0 -1
  31. package/dist/core/exec-gate.d.ts +1 -1
  32. package/dist/core/exec-output-tail.d.ts +1 -0
  33. package/dist/core/exec-output-tail.js +6 -0
  34. package/dist/core/file-snapshot-store.d.ts +1 -1
  35. package/dist/core/fs-write-gate-policy.d.ts +1 -1
  36. package/dist/core/git-worktree-env.d.ts +1 -1
  37. package/dist/core/hooks.d.ts +1 -1
  38. package/dist/core/image-downsample.d.ts +44 -0
  39. package/dist/core/image-downsample.js +97 -0
  40. package/dist/core/lsp.d.ts +1 -1
  41. package/dist/core/mcp.d.ts +3 -45
  42. package/dist/core/mcp.js +2 -97
  43. package/dist/core/media-byte-cap.d.ts +1 -1
  44. package/dist/core/memory-recall.d.ts +0 -12
  45. package/dist/core/memory-recall.js +0 -222
  46. package/dist/core/memory.d.ts +0 -6
  47. package/dist/core/memory.js +0 -88
  48. package/dist/core/message-utils.d.ts +1 -1
  49. package/dist/core/oracle-isolation.d.ts +1 -1
  50. package/dist/core/remote-env.d.ts +1 -1
  51. package/dist/core/roles.d.ts +1 -1
  52. package/dist/core/runner/active-skill-scope.d.ts +1 -1
  53. package/dist/core/runner/assemble-result.d.ts +0 -2
  54. package/dist/core/runner/memory-consolidation.d.ts +1 -1
  55. package/dist/core/runner/prepare-memory.d.ts +16 -0
  56. package/dist/core/runner/prepare-memory.js +191 -0
  57. package/dist/core/runner/prepare-task.d.ts +4 -28
  58. package/dist/core/runner/prepare-task.js +19 -207
  59. package/dist/core/runner/prompt-suggestions.d.ts +1 -1
  60. package/dist/core/runner/runtask.d.ts +2 -3
  61. package/dist/core/runner/runtask.js +337 -529
  62. package/dist/core/runner/session-rule-policy.d.ts +1 -1
  63. package/dist/core/runner/synthetic-tools.d.ts +5 -5
  64. package/dist/core/runner/synthetic-tools.js +4 -4
  65. package/dist/core/runner/tool-disclosure.d.ts +3 -3
  66. package/dist/core/runner/tool-disclosure.js +2 -2
  67. package/dist/core/runner/tool-output-projection.d.ts +6 -0
  68. package/dist/core/runner/tool-output-projection.js +81 -0
  69. package/dist/core/runtime.d.ts +1 -1
  70. package/dist/core/scheduler.d.ts +1 -1
  71. package/dist/core/sensitive-path-policy.d.ts +1 -1
  72. package/dist/core/session-reconcile.d.ts +1 -1
  73. package/dist/core/session-store.d.ts +2 -1
  74. package/dist/core/session-store.js +2 -1
  75. package/dist/core/session.d.ts +0 -1
  76. package/dist/core/task-registry-agent.d.ts +115 -0
  77. package/dist/core/task-registry-agent.js +1163 -0
  78. package/dist/core/task-registry-monitor.d.ts +13 -0
  79. package/dist/core/task-registry-monitor.js +347 -0
  80. package/dist/core/task-registry-shared.d.ts +294 -0
  81. package/dist/core/task-registry-shared.js +271 -0
  82. package/dist/core/task-registry-workflow.d.ts +5 -0
  83. package/dist/core/task-registry-workflow.js +143 -0
  84. package/dist/core/task-registry.d.ts +51 -216
  85. package/dist/core/task-registry.js +127 -1940
  86. package/dist/core/task-tool-shape.d.ts +32 -0
  87. package/dist/core/task-tool-shape.js +83 -0
  88. package/dist/core/tool-policy.d.ts +1 -2
  89. package/dist/core/tool-result-budget.d.ts +1 -1
  90. package/dist/core/tool-result-store.d.ts +2 -2
  91. package/dist/core/tool-result-store.js +1 -1
  92. package/dist/core/tools.d.ts +2 -3
  93. package/dist/core/tools.js +0 -8
  94. package/dist/core/trace.d.ts +2 -2
  95. package/dist/core/types.d.ts +0 -29
  96. package/dist/core/workflow-run-store-contract.d.ts +1 -1
  97. package/dist/core/workflow-run-store-contract.js +19 -19
  98. package/dist/engine/execution-env/node-execution-env.d.ts +13 -0
  99. package/dist/engine/execution-env/node-execution-env.js +55 -25
  100. package/dist/engine/lsp/frame-decoder.d.ts +1 -1
  101. package/dist/engine/lsp/frame-decoder.js +1 -1
  102. package/dist/engine/lsp/node-lsp-manager.d.ts +1 -1
  103. package/dist/engine/lsp/stdio-lsp-transport.js +2 -2
  104. package/dist/index.d.ts +16 -14
  105. package/dist/index.js +13 -11
  106. package/dist/internal/harness-types.d.ts +7 -0
  107. package/dist/internal/harness-types.js +1 -0
  108. package/dist/internal/harness.d.ts +1 -7
  109. package/dist/internal/harness.js +1 -0
  110. package/dist/orchestration/goal.js +2 -2
  111. package/dist/orchestration/run-workflow-tool.d.ts +1 -1
  112. package/dist/orchestration/workflow-types.d.ts +193 -0
  113. package/dist/orchestration/workflow-types.js +54 -0
  114. package/dist/orchestration/workflow.d.ts +3 -193
  115. package/dist/orchestration/workflow.js +7 -59
  116. package/dist/prompt-assembly/assemble.d.ts +3 -3
  117. package/dist/prompt-assembly/assemble.js +0 -16
  118. package/dist/prompt-assembly/explain.d.ts +1 -1
  119. package/dist/prompt-assembly/tool-catalog.d.ts +1 -1
  120. package/dist/prompts/default.d.ts +1 -6
  121. package/dist/prompts/default.js +3 -11
  122. package/dist/scenarios/env.d.ts +1 -1
  123. package/dist/scenarios/full-body.d.ts +0 -3
  124. package/dist/scenarios/full-body.js +0 -2
  125. package/dist/stores/file/background-agent-store.d.ts +2 -15
  126. package/dist/stores/file/background-agent-store.js +30 -100
  127. package/dist/stores/file/checkpoint-store.d.ts +1 -14
  128. package/dist/stores/file/checkpoint-store.js +47 -119
  129. package/dist/stores/file/file-snapshot-store.d.ts +1 -1
  130. package/dist/stores/file/shared-ledger.d.ts +35 -0
  131. package/dist/stores/file/shared-ledger.js +94 -0
  132. package/dist/stores/file/workflow-run-store.d.ts +1 -14
  133. package/dist/stores/file/workflow-run-store.js +24 -93
  134. package/dist/tools/fs/bash-readonly-classifier.d.ts +8 -0
  135. package/dist/tools/fs/bash-readonly-classifier.js +166 -0
  136. package/dist/tools/fs/fs-bash.d.ts +31 -0
  137. package/dist/tools/fs/fs-bash.js +672 -0
  138. package/dist/tools/fs/fs-pdf.d.ts +22 -0
  139. package/dist/tools/fs/fs-pdf.js +236 -0
  140. package/dist/tools/fs/fs-read.d.ts +8 -0
  141. package/dist/tools/fs/fs-read.js +286 -0
  142. package/dist/tools/fs/fs-search-tools.d.ts +5 -0
  143. package/dist/tools/fs/fs-search-tools.js +173 -0
  144. package/dist/tools/fs/fs-shared.d.ts +55 -0
  145. package/dist/tools/fs/fs-shared.js +144 -0
  146. package/dist/tools/fs/fs-write.d.ts +8 -0
  147. package/dist/tools/fs/fs-write.js +423 -0
  148. package/dist/tools/fs/index.d.ts +12 -65
  149. package/dist/tools/fs/index.js +26 -2090
  150. package/dist/tools/fs/pdf.d.ts +1 -1
  151. package/dist/tools/fs/repo-map.d.ts +3 -3
  152. package/dist/tools/fs/repo-map.js +1 -1
  153. package/dist/tools/fs/safety.d.ts +1 -1
  154. package/dist/tools/fs/search.d.ts +1 -1
  155. package/dist/tools/monitor.d.ts +1 -1
  156. package/dist/tools/scheduler-tools.d.ts +1 -1
  157. package/dist/tools/web.d.ts +2 -2
  158. package/dist/tools/web.js +1 -1
  159. package/dist/tools/worktree.d.ts +1 -1
  160. package/package.json +1 -1
  161. package/dist/core/dynamic-recall.d.ts +0 -32
  162. package/dist/core/dynamic-recall.js +0 -76
@@ -1,95 +1,40 @@
1
1
  import { join } from "node:path";
2
2
  import { WorkflowRunStoreError, isTerminalWorkflowStatus, summarizeWorkflowRun, } from "../../core/workflow-run-store.js";
3
- import { canonicalStoreKey, AppendLog, atomicWriteFile, ensureDir, readJsonlRecords } from "./fs-atomic.js";
4
- const sharedRunDirs = new Map();
3
+ import { SharedLedgerTable } from "./shared-ledger.js";
4
+ const runLedgers = new SharedLedgerTable({
5
+ keyOf: (run) => run.id,
6
+ apply: (runs, ev) => {
7
+ if (ev.t === "delete") {
8
+ runs.delete(ev.id);
9
+ return;
10
+ }
11
+ runs.set(ev.id, ev.run);
12
+ },
13
+ });
5
14
  export class FileWorkflowRunStore {
6
- dir;
7
- tmpDir;
8
- ledgerPath;
9
- snapshotPath;
10
15
  fsyncEnabled;
11
16
  compactEvery;
12
- shared;
17
+ ledger;
13
18
  closed = false;
14
- canonicalDir;
15
19
  get runs() {
16
- return this.shared.runs;
17
- }
18
- get locks() {
19
- return this.shared.locks;
20
- }
21
- get ledgerEvents() {
22
- return this.shared.ledgerEvents;
23
- }
24
- set ledgerEvents(v) {
25
- this.shared.ledgerEvents = v;
26
- }
27
- get log() {
28
- return this.shared.log;
29
- }
30
- set log(v) {
31
- this.shared.log = v;
20
+ return this.ledger.rows;
32
21
  }
33
22
  constructor(root, opts = {}) {
34
- this.dir = join(root, "workflow-runs");
35
- this.tmpDir = join(root, "tmp");
36
- this.ledgerPath = join(this.dir, "runs.jsonl");
37
- this.snapshotPath = join(this.dir, "runs.snapshot.jsonl");
38
23
  this.fsyncEnabled = opts.fsync !== false;
39
24
  this.compactEvery = opts.compactEvery ?? 1000;
40
- ensureDir(this.dir);
41
- ensureDir(this.tmpDir);
42
- const canonical = canonicalStoreKey(this.dir);
43
- this.canonicalDir = canonical;
44
- const existing = sharedRunDirs.get(canonical);
45
- if (existing !== undefined) {
46
- existing.refs += 1;
47
- this.shared = existing;
48
- return;
49
- }
50
- this.shared = { runs: new Map(), locks: new Map(), ledgerEvents: 0, log: undefined, refs: 1 };
51
- sharedRunDirs.set(canonical, this.shared);
52
- this.replay();
53
- this.log = new AppendLog(this.ledgerPath);
54
- }
55
- replay() {
56
- for (const snap of readJsonlRecords(this.snapshotPath)) {
57
- this.runs.set(snap.id, snap);
58
- }
59
- const events = readJsonlRecords(this.ledgerPath);
60
- this.ledgerEvents = events.length;
61
- for (const ev of events)
62
- this.applyEvent(ev);
63
- }
64
- applyEvent(ev) {
65
- if (ev.t === "delete") {
66
- this.runs.delete(ev.id);
67
- return;
68
- }
69
- this.runs.set(ev.id, ev.run);
25
+ const dir = join(root, "workflow-runs");
26
+ this.ledger = runLedgers.acquire({
27
+ dir,
28
+ tmpDir: join(root, "tmp"),
29
+ ledgerPath: join(dir, "runs.jsonl"),
30
+ snapshotPath: join(dir, "runs.snapshot.jsonl"),
31
+ });
70
32
  }
71
33
  withLock(id, fn) {
72
- const prev = this.locks.get(id) ?? Promise.resolve();
73
- const run = prev.then(() => fn(), () => fn());
74
- const tail = run.then(() => { }, () => { });
75
- this.locks.set(id, tail);
76
- void tail.then(() => {
77
- if (this.locks.get(id) === tail)
78
- this.locks.delete(id);
79
- });
80
- return run;
34
+ return this.ledger.withLock(id, fn);
81
35
  }
82
36
  commit(ev, fsync) {
83
- this.log.append(ev, fsync);
84
- this.applyEvent(ev);
85
- this.ledgerEvents++;
86
- if (this.ledgerEvents >= this.compactEvery) {
87
- try {
88
- this.compact();
89
- }
90
- catch {
91
- }
92
- }
37
+ this.ledger.commit(ev, fsync, this.compactEvery);
93
38
  }
94
39
  async put(id, run) {
95
40
  return this.withLock(id, () => {
@@ -161,15 +106,8 @@ export class FileWorkflowRunStore {
161
106
  }
162
107
  return n;
163
108
  }
164
- compact() {
165
- const lines = [...this.runs.values()].map((r) => JSON.stringify(r)).join("\n");
166
- atomicWriteFile(this.tmpDir, this.snapshotPath, lines.length ? `${lines}\n` : "");
167
- this.log.closeForSwap();
168
- atomicWriteFile(this.tmpDir, this.ledgerPath, "");
169
- this.ledgerEvents = 0;
170
- }
171
109
  compactNow() {
172
- this.compact();
110
+ this.ledger.compact();
173
111
  }
174
112
  get size() {
175
113
  return this.runs.size;
@@ -178,13 +116,6 @@ export class FileWorkflowRunStore {
178
116
  if (this.closed)
179
117
  return;
180
118
  this.closed = true;
181
- const st = sharedRunDirs.get(this.canonicalDir);
182
- if (st !== undefined && st === this.shared) {
183
- st.refs -= 1;
184
- if (st.refs > 0)
185
- return;
186
- sharedRunDirs.delete(this.canonicalDir);
187
- }
188
- this.log.close();
119
+ this.ledger.release();
189
120
  }
190
121
  }
@@ -0,0 +1,8 @@
1
+ export declare const BASH_READONLY_DEFAULT_ALLOW: readonly string[];
2
+ export declare function parseLeadingCommandName(command: string): {
3
+ name: string;
4
+ } | {
5
+ reject: string;
6
+ };
7
+ export declare function coarseReadonlyCheck(command: string, allow: ReadonlySet<string>): string | undefined;
8
+ export declare function classifyCompoundReadonly(command: string, allow: ReadonlySet<string>): string | undefined;
@@ -0,0 +1,166 @@
1
+ import { isBlockedDevicePath, normalizeAbsPathLexically } from "./safety.js";
2
+ export const BASH_READONLY_DEFAULT_ALLOW = [
3
+ "ls", "cat", "head", "tail", "wc", "pwd", "echo", "whoami", "uname",
4
+ "grep", "cut", "tr", "basename", "dirname", "stat", "du", "df", "which",
5
+ ];
6
+ const SHELL_OPERATORS = /[;&|<>$()`\n\r\\]/;
7
+ export function parseLeadingCommandName(command) {
8
+ const trimmed = command.trim();
9
+ if (!trimmed)
10
+ return { reject: "empty command" };
11
+ if (SHELL_OPERATORS.test(trimmed)) {
12
+ return {
13
+ reject: "shell operators (pipes, redirects, ;, &&, command substitution, subshells, variable expansion) are not allowed — run a single simple command",
14
+ };
15
+ }
16
+ const first = trimmed.split(/\s+/)[0];
17
+ if (first.includes("/"))
18
+ return { reject: "the command must be a bare name resolved via PATH (no path prefix)" };
19
+ if (first.includes("="))
20
+ return { reject: "leading environment-variable assignments are not allowed" };
21
+ if (/["'{}*?[\]~]/.test(first))
22
+ return { reject: "the command name must be a bare token (no quotes, braces, globs, or ~)" };
23
+ return { name: first };
24
+ }
25
+ export function coarseReadonlyCheck(command, allow) {
26
+ const parsed = parseLeadingCommandName(command);
27
+ if ("reject" in parsed)
28
+ return parsed.reject;
29
+ if (!allow.has(parsed.name))
30
+ return `command "${parsed.name}" is not in the read-only allowlist`;
31
+ return undefined;
32
+ }
33
+ const SHELL_SEGMENT_HARD_REJECT = /[<>$()`\n\r\\]/;
34
+ export function classifyCompoundReadonly(command, allow) {
35
+ const trimmed = command.trim();
36
+ if (!trimmed)
37
+ return "empty command";
38
+ if (SHELL_SEGMENT_HARD_REJECT.test(trimmed)) {
39
+ return "redirection, command/variable substitution, subshells, escapes, and line breaks are not allowed";
40
+ }
41
+ const source = trimmed.endsWith(";") ? trimmed.slice(0, -1) : trimmed;
42
+ const segments = [];
43
+ const pipeFed = [false];
44
+ let cur = "";
45
+ for (let i = 0; i < source.length; i++) {
46
+ const c = source[i];
47
+ if (c === "&") {
48
+ if (source[i + 1] === "&") {
49
+ segments.push(cur);
50
+ cur = "";
51
+ pipeFed.push(false);
52
+ i++;
53
+ }
54
+ else
55
+ return "`&` backgrounding is not allowed — a backgrounded process outlives the command";
56
+ }
57
+ else if (c === "|") {
58
+ if (source[i + 1] === "|") {
59
+ segments.push(cur);
60
+ cur = "";
61
+ pipeFed.push(false);
62
+ i++;
63
+ }
64
+ else {
65
+ segments.push(cur);
66
+ cur = "";
67
+ pipeFed.push(true);
68
+ }
69
+ }
70
+ else if (c === ";") {
71
+ segments.push(cur);
72
+ cur = "";
73
+ pipeFed.push(false);
74
+ }
75
+ else
76
+ cur += c;
77
+ }
78
+ segments.push(cur);
79
+ for (const segment of segments) {
80
+ const reason = coarseReadonlyCheck(segment, allow);
81
+ if (reason !== undefined)
82
+ return reason;
83
+ }
84
+ const HEAD_AUTO_ALLOW_MAX = 1_000_000;
85
+ const headBoundIsSmall = (name, toks) => {
86
+ if (name !== "head")
87
+ return false;
88
+ let byteBound = false;
89
+ for (let k = 1; k < toks.length; k++) {
90
+ const t = toks[k];
91
+ if (!t.startsWith("-") || t === "-")
92
+ continue;
93
+ const inline = /^-[A-Za-z]*c(\d+)$/.exec(t) ?? /^--bytes=(\d+)$/.exec(t);
94
+ if (inline) {
95
+ if (Number(inline[1]) > HEAD_AUTO_ALLOW_MAX)
96
+ return false;
97
+ byteBound = true;
98
+ continue;
99
+ }
100
+ if (/^-[A-Za-z]*c$/.test(t) || t === "--bytes") {
101
+ const v = toks[k + 1];
102
+ if (v === undefined || !/^\d+$/.test(v) || Number(v) > HEAD_AUTO_ALLOW_MAX)
103
+ return false;
104
+ byteBound = true;
105
+ k++;
106
+ continue;
107
+ }
108
+ return false;
109
+ }
110
+ return byteBound;
111
+ };
112
+ const STDIN_FILE_FLOOR = { cat: 1, grep: 2, head: 1, tail: 1, wc: 1, cut: 1, tr: Infinity };
113
+ for (let si = 0; si < segments.length; si++) {
114
+ const toks = segments[si].trim().split(/\s+/).filter((t) => t.length > 0);
115
+ if (toks.length === 0)
116
+ continue;
117
+ const name = toks[0];
118
+ const nonOption = toks.slice(1).filter((t) => !t.startsWith("-"));
119
+ if (!(pipeFed[si] ?? false)) {
120
+ const floor = STDIN_FILE_FLOOR[name];
121
+ const restArgs = toks.slice(1);
122
+ const grepPatternSuppliedByFlag = name === "grep" && restArgs.some((t) => t === "-e" || t.startsWith("-e") || t === "-f" || t.startsWith("--regexp") || t.startsWith("--file"));
123
+ let sawNonFlagOperand = false;
124
+ let hasStdinDash = false;
125
+ if (name !== "tr") {
126
+ for (let k = 0; k < restArgs.length; k++) {
127
+ const t = restArgs[k];
128
+ if (name === "cut" && (t === "-d" || t === "--delimiter")) {
129
+ k++;
130
+ continue;
131
+ }
132
+ if (name === "grep" && (t === "-f-" || t === "--file=-")) {
133
+ hasStdinDash = true;
134
+ break;
135
+ }
136
+ if (t.startsWith("-") && t !== "-")
137
+ continue;
138
+ const isGrepPatternPosition = name === "grep" && !grepPatternSuppliedByFlag && !sawNonFlagOperand;
139
+ sawNonFlagOperand = true;
140
+ if (isGrepPatternPosition)
141
+ continue;
142
+ if (t === "-") {
143
+ hasStdinDash = true;
144
+ break;
145
+ }
146
+ }
147
+ }
148
+ if (floor !== undefined && hasStdinDash) {
149
+ return `"${name}" reads stdin via an explicit "-" argument and would block until the tool timeout — not auto-allowed`;
150
+ }
151
+ if (floor !== undefined && nonOption.length < floor) {
152
+ return `"${name}" with no file argument reads stdin and would block until the tool timeout — not auto-allowed`;
153
+ }
154
+ }
155
+ if (name === "tail" && toks.slice(1).some((t) => t === "--follow" || t.startsWith("--follow=") || /^[-+][^\s]*[fF]/.test(t))) {
156
+ return "`tail` in follow mode never terminates — not auto-allowed";
157
+ }
158
+ const GENERATOR_DEVICES = new Set(["/dev/zero", "/dev/random", "/dev/urandom", "/dev/full"]);
159
+ const deviceArgs = toks.slice(1).filter((t) => !t.startsWith("-")).map(normalizeAbsPathLexically).filter(isBlockedDevicePath);
160
+ const rescuedByHead = headBoundIsSmall(name, toks) && deviceArgs.every((d) => GENERATOR_DEVICES.has(d));
161
+ if (!rescuedByHead && deviceArgs.length > 0) {
162
+ return "an unbounded device source (/dev/zero, /dev/stdin, /proc/<pid>/fd/0, …) would block the pipeline until the tool timeout — not auto-allowed";
163
+ }
164
+ }
165
+ return undefined;
166
+ }
@@ -0,0 +1,31 @@
1
+ import type { AgentTool, ExecutionEnv } from "../../internal/harness-types.js";
2
+ import { type TaskRegistry } from "../../core/task-registry.js";
3
+ import { type CwdRef } from "./fs-shared.js";
4
+ export declare function bashReversibilityProbe(allow?: readonly string[]): (args: unknown) => {
5
+ reversible: boolean;
6
+ };
7
+ export interface ExecClampOption {
8
+ deadlineMs: () => number | undefined;
9
+ onClamp?: (requestedSec: number, clampedSec: number) => void;
10
+ registerKillHandle?: (toolCallId: string, handle: {
11
+ pid: number;
12
+ kill: () => void;
13
+ }) => () => void;
14
+ }
15
+ export declare function bashExitOneInterpretation(command: string): string | undefined;
16
+ export declare function canAutoBackground(command: string): boolean;
17
+ export declare function createBashTool(env: ExecutionEnv, rootCanonical: string, coAuthor?: string | false, cwdRef?: CwdRef, taskOpts?: {
18
+ taskRegistry?: TaskRegistry;
19
+ taskOwner?: string;
20
+ taskScope?: string;
21
+ sessionId?: string;
22
+ onTaskNotification?: (n: import("../../core/task-notification.js").TaskNotificationPayload, opts?: {
23
+ priority?: "now" | "next" | "later";
24
+ }) => void;
25
+ detachHub?: import("../../core/tool-detach.js").ToolDetachHub;
26
+ execClamp?: ExecClampOption;
27
+ autoBackgroundOnTimeout?: boolean;
28
+ }): AgentTool;
29
+ export declare function createBashReadonlyTool(env: ExecutionEnv, rootCanonical: string, allow: ReadonlySet<string>, execClamp?: ExecClampOption): AgentTool;
30
+ export declare function createEnvTaskOutputTool(env: ExecutionEnv): AgentTool;
31
+ export declare function createEnvTaskStopTool(env: ExecutionEnv, registry?: TaskRegistry): AgentTool;