@sema-agent/core 7.50.2 → 7.51.1

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 (200) hide show
  1. package/CHANGELOG.md +313 -0
  2. package/dist/agents/child-failure.d.ts +5 -16
  3. package/dist/agents/child-failure.js +4 -24
  4. package/dist/agents/subagent-steps.js +2 -2
  5. package/dist/agents/subagent.d.ts +4 -13
  6. package/dist/agents/subagent.js +94 -204
  7. package/dist/agents/tool-filter.d.ts +2 -2
  8. package/dist/brain/anthropic.d.ts +1 -1
  9. package/dist/brain/anthropic.js +7 -5
  10. package/dist/brain/open-responses.d.ts +1 -1
  11. package/dist/brain/open-responses.js +3 -2
  12. package/dist/brain/openai.d.ts +1 -1
  13. package/dist/brain/openai.js +3 -2
  14. package/dist/brain/request-route.d.ts +2 -2
  15. package/dist/brain/route-adjudicator.d.ts +16 -7
  16. package/dist/brain/route-adjudicator.js +23 -7
  17. package/dist/brain/route-conformance.js +23 -5
  18. package/dist/brain/stream-engine.js +9 -3
  19. package/dist/core/a2a.js +6 -8
  20. package/dist/core/allow-entry.d.ts +45 -26
  21. package/dist/core/allow-entry.js +48 -24
  22. package/dist/core/arg-summary.d.ts +8 -85
  23. package/dist/core/arg-summary.js +4 -386
  24. package/dist/core/ask-origin.d.ts +35 -33
  25. package/dist/core/ask-origin.js +9 -11
  26. package/dist/core/checkpoint-requirements.d.ts +6 -0
  27. package/dist/core/checkpoint-requirements.js +1 -0
  28. package/dist/core/checkpoint-store.d.ts +15 -34
  29. package/dist/core/checkpoint-store.js +5 -4
  30. package/dist/core/classifier-unavailable-arm.d.ts +12 -8
  31. package/dist/core/classifier-unavailable-arm.js +7 -2
  32. package/dist/core/credential-vocabulary.d.ts +3 -2
  33. package/dist/core/credential-vocabulary.js +27 -18
  34. package/dist/core/delegation-frames.d.ts +40 -15
  35. package/dist/core/delegation-frames.js +34 -0
  36. package/dist/core/engine-capabilities.d.ts +15 -0
  37. package/dist/core/engine-capabilities.js +1 -0
  38. package/dist/core/engine-notice.d.ts +41 -14
  39. package/dist/core/gate-fold.js +9 -7
  40. package/dist/core/gate-lanes.js +6 -4
  41. package/dist/core/gate-outcome.d.ts +81 -15
  42. package/dist/core/gate-outcome.js +168 -67
  43. package/dist/core/governance-codes.d.ts +7 -1
  44. package/dist/core/governance-codes.js +9 -0
  45. package/dist/core/hooks.d.ts +4 -4
  46. package/dist/core/hooks.js +4 -3
  47. package/dist/core/mcp-connection-pool.d.ts +2 -0
  48. package/dist/core/mcp-connection-pool.js +2 -1
  49. package/dist/core/mcp-failure.js +2 -1
  50. package/dist/core/mcp-server-spec.d.ts +27 -5
  51. package/dist/core/mcp.d.ts +13 -38
  52. package/dist/core/mcp.js +28 -23
  53. package/dist/core/media-byte-cap.d.ts +25 -0
  54. package/dist/core/media-byte-cap.js +18 -2
  55. package/dist/core/memory-engine/consolidation-driver.js +1 -1
  56. package/dist/core/mode-policy.d.ts +25 -1
  57. package/dist/core/mode-policy.js +28 -13
  58. package/dist/core/own-property-receipt.d.ts +18 -0
  59. package/dist/core/own-property-receipt.js +39 -0
  60. package/dist/core/permission-rule-model.d.ts +32 -11
  61. package/dist/core/permission-rule-model.js +12 -7
  62. package/dist/core/persisted-rule-arms.d.ts +3 -3
  63. package/dist/core/prompt-section-seat.d.ts +54 -0
  64. package/dist/core/prompt-section-seat.js +49 -0
  65. package/dist/core/protocol-http-auth.d.ts +44 -0
  66. package/dist/core/protocol-http-auth.js +45 -0
  67. package/dist/core/read-face-seats.d.ts +30 -0
  68. package/dist/core/read-face-seats.js +38 -0
  69. package/dist/core/redaction-passes.d.ts +82 -0
  70. package/dist/core/redaction-passes.js +378 -0
  71. package/dist/core/remote-env.d.ts +4 -3
  72. package/dist/core/resume-startup-cause.d.ts +56 -0
  73. package/dist/core/resume-startup-cause.js +43 -0
  74. package/dist/core/rule-denial-sentence.d.ts +2 -2
  75. package/dist/core/runner/announce-once-ledger.js +2 -2
  76. package/dist/core/runner/classifier-ladder.d.ts +17 -13
  77. package/dist/core/runner/classifier-ladder.js +12 -10
  78. package/dist/core/runner/construction-doors.js +9 -20
  79. package/dist/core/runner/contracts.d.ts +4 -4
  80. package/dist/core/runner/gate-exit.js +2 -2
  81. package/dist/core/runner/memory-consolidation-write-judge.d.ts +53 -9
  82. package/dist/core/runner/memory-consolidation-write-judge.js +39 -1
  83. package/dist/core/runner/permission-rule-lanes.d.ts +8 -13
  84. package/dist/core/runner/person-path-rows.d.ts +4 -3
  85. package/dist/core/runner/policy-throw.js +4 -4
  86. package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -3
  87. package/dist/core/runner/prepare-caps-and-workflow.js +8 -6
  88. package/dist/core/runner/prepare-gate-stations.js +4 -4
  89. package/dist/core/runner/prepare-hands-readface.js +1 -19
  90. package/dist/core/runner/prepare-inherited-gate.js +10 -9
  91. package/dist/core/runner/prepare-policy-chain.d.ts +3 -5
  92. package/dist/core/runner/prepare-policy-chain.js +10 -13
  93. package/dist/core/runner/prepare-project-context.d.ts +4 -4
  94. package/dist/core/runner/prepare-project-context.js +2 -1
  95. package/dist/core/runner/prepare-prompt-assembly.js +1 -0
  96. package/dist/core/runner/prepare-prompt-inputs.d.ts +1 -1
  97. package/dist/core/runner/prepare-prompt-inputs.js +4 -4
  98. package/dist/core/runner/prepare-protocol-tools.d.ts +4 -3
  99. package/dist/core/runner/prepare-protocol-tools.js +3 -2
  100. package/dist/core/runner/prepare-task.js +6 -4
  101. package/dist/core/runner/prepare-turn-wiring.d.ts +16 -13
  102. package/dist/core/runner/prepare-turn-wiring.js +8 -7
  103. package/dist/core/runner/run-harness-handlers.js +2 -2
  104. package/dist/core/runner/run-leg.js +10 -9
  105. package/dist/core/runner/run-settle-and-teardown.js +5 -5
  106. package/dist/core/runner/run-turn-boundary.js +3 -2
  107. package/dist/core/runner/runtask.d.ts +1 -2
  108. package/dist/core/runner/runtask.js +8 -12
  109. package/dist/core/runner/session-rule-policy.d.ts +15 -11
  110. package/dist/core/runner/session-rule-policy.js +43 -33
  111. package/dist/core/runner/stream-lifecycle-verbs.js +2 -2
  112. package/dist/core/runner/stream-settle-backstop.js +2 -1
  113. package/dist/core/runner/sub-agent-deny-lists.d.ts +12 -8
  114. package/dist/core/runner/sub-agent-deny-lists.js +23 -12
  115. package/dist/core/runner/terminal-account.js +3 -3
  116. package/dist/core/runner/tool-output-projection.d.ts +5 -0
  117. package/dist/core/runner/tool-output-projection.js +6 -11
  118. package/dist/core/runner/tool-result-media-seat.d.ts +19 -0
  119. package/dist/core/runner/tool-result-media-seat.js +13 -0
  120. package/dist/core/runner/turn-attachments.d.ts +13 -12
  121. package/dist/core/runner/turn-attachments.js +11 -7
  122. package/dist/core/runner-deps.d.ts +4 -3
  123. package/dist/core/safety-merge-corpus.js +21 -21
  124. package/dist/core/secret-env.d.ts +41 -15
  125. package/dist/core/secret-env.js +85 -19
  126. package/dist/core/session-policy-store.d.ts +89 -72
  127. package/dist/core/session-policy-store.js +100 -93
  128. package/dist/core/shell-read-silence.d.ts +38 -4
  129. package/dist/core/shell-read-silence.js +102 -0
  130. package/dist/core/side-query.d.ts +7 -8
  131. package/dist/core/skill-grant-binding.d.ts +32 -11
  132. package/dist/core/skill-grant-binding.js +11 -3
  133. package/dist/core/skill-grant.d.ts +4 -3
  134. package/dist/core/skill-grant.js +5 -4
  135. package/dist/core/skills-directory.d.ts +12 -1
  136. package/dist/core/skills-directory.js +17 -8
  137. package/dist/core/spec-contract.d.ts +5 -3
  138. package/dist/core/store-contracts/checkpoint-store-contract.d.ts +2 -0
  139. package/dist/core/store-contracts/checkpoint-store-contract.js +3 -0
  140. package/dist/core/swappable-deps.d.ts +15 -1
  141. package/dist/core/swappable-deps.js +25 -1
  142. package/dist/core/synthetic-read-verdict.d.ts +16 -14
  143. package/dist/core/synthetic-read-verdict.js +28 -8
  144. package/dist/core/task-notification.d.ts +13 -3
  145. package/dist/core/task-notification.js +12 -1
  146. package/dist/core/task-spec.d.ts +14 -15
  147. package/dist/core/tool-name-readings.d.ts +0 -4
  148. package/dist/core/tool-name-readings.js +0 -1
  149. package/dist/core/tool-policy.d.ts +40 -9
  150. package/dist/core/tool-policy.js +25 -7
  151. package/dist/core/types.d.ts +3 -3
  152. package/dist/core/types.js +1 -1
  153. package/dist/core/untrusted-egress.d.ts +60 -11
  154. package/dist/core/untrusted-egress.js +120 -9
  155. package/dist/core/untrusted-text.js +16 -0
  156. package/dist/core/wiring-manifest.d.ts +22 -8
  157. package/dist/core/wiring-manifest.js +12 -4
  158. package/dist/engine/execution-env/kill-tree.js +4 -4
  159. package/dist/engine/execution-env/node-execution-env.d.ts +11 -4
  160. package/dist/engine/execution-env/node-execution-env.js +9 -4
  161. package/dist/engine/harness/agent-harness.d.ts +2 -1
  162. package/dist/engine/harness/agent-harness.js +4 -1
  163. package/dist/engine/harness/types.d.ts +3 -0
  164. package/dist/engine/llm/types.d.ts +7 -9
  165. package/dist/engine/loop/agent-loop.d.ts +8 -3
  166. package/dist/engine/loop/agent-loop.js +26 -9
  167. package/dist/engine/loop/types.d.ts +10 -0
  168. package/dist/engine/lsp/node-lsp-manager.d.ts +2 -1
  169. package/dist/engine/lsp/node-lsp-manager.js +2 -2
  170. package/dist/index.d.ts +22 -5
  171. package/dist/index.js +18 -5
  172. package/dist/orchestration/run-workflow-tool.js +8 -8
  173. package/dist/orchestration/workflow.js +2 -2
  174. package/dist/prompt-assembly/assemble.d.ts +3 -1
  175. package/dist/prompt-assembly/assemble.js +6 -0
  176. package/dist/prompts/cowork.d.ts +42 -0
  177. package/dist/prompts/cowork.js +529 -0
  178. package/dist/prompts/default.d.ts +14 -1
  179. package/dist/prompts/default.js +3 -0
  180. package/dist/stores/file/fs-atomic.js +2 -2
  181. package/dist/stores/file/session-policy-store.d.ts +6 -3
  182. package/dist/stores/file/session-policy-store.js +5 -16
  183. package/dist/tools/artifact/artifact-tool.js +2 -0
  184. package/dist/tools/fs/image-admission.d.ts +57 -4
  185. package/dist/tools/fs/image-admission.js +85 -0
  186. package/dist/tools/fs/path-containment.d.ts +2 -0
  187. package/dist/tools/fs/path-containment.js +5 -0
  188. package/dist/tools/fs/shell-read-check.d.ts +31 -6
  189. package/dist/tools/fs/shell-read-check.js +2 -4
  190. package/dist/tools/fs/shell-read-environment.d.ts +10 -25
  191. package/dist/tools/fs/shell-read-environment.js +6 -18
  192. package/dist/tools/fs/shell-read-establish.d.ts +3 -2
  193. package/dist/tools/fs/shell-read-establish.js +5 -5
  194. package/dist/tools/fs/shell-read-judge.d.ts +38 -8
  195. package/dist/tools/fs/shell-read-judge.js +12 -10
  196. package/dist/tools/web.js +2 -2
  197. package/package.json +1 -1
  198. package/test/export-surface.snapshot.json +112 -10
  199. package/wire-changes/core@7.51.0.json +2421 -0
  200. package/wire-changes/core@7.51.1.json +259 -0
@@ -88,6 +88,10 @@ export declare class NodeExecutionEnv implements ExecutionEnv, BackgroundShellCa
88
88
  /** `ExecutionEnv.cdPath` = the `CDPATH` the shell child receives, read LIVE off the same merge each exec gets (never the
89
89
  * engine process's own environment): its entries, `[]` when the child gets none. Residual: a per-exec `env.CDPATH`. */
90
90
  get cdPath(): readonly string[];
91
+ /** The environment the next shell child would receive, for a READ (the scrub seat is a no-op: a read reports nothing).
92
+ * `undefined` when no child would be spawned at all — the policy is refused against the own credentials declared
93
+ * since construction, and every spawn throws that reason — so a reader sees "the child gets none", never a throw. */
94
+ private childEnvForRead;
91
95
  private shellPath?;
92
96
  private shellEnv?;
93
97
  private inheritEnv;
@@ -108,7 +112,9 @@ export declare class NodeExecutionEnv implements ExecutionEnv, BackgroundShellCa
108
112
  * fail-closed (drop secret-pattern keys, keep PATH/build/locale). `"all"` = full inherit (trusted env);
109
113
  * `string[]` = strict allowlist. `shellEnv`/per-exec `env` always pass through. Any other value — an unknown
110
114
  * word, a non-string, a list entry that is not a variable name — throws here (`inheritEnvPolicyProblem`'s
111
- * reason), the same judgment the oracle gate's `inheritEnv` meets. */
115
+ * reason), the same judgment the oracle gate's `inheritEnv` meets. Whatever the policy, the deployment's declared
116
+ * own credentials (`declareWithheldEnv`) are withheld from the inherited part; a list naming one throws here when
117
+ * the declaration came first, and every spawn refuses it (`spawn_error` / `spawn_failed`) whenever it came. */
112
118
  inheritEnv?: "all" | "scrub" | string[];
113
119
  /** design/105: inject a resident scheduler daemon backend (the shell daemon). Absent ⇒ scheduling INERT. */
114
120
  scheduler?: SchedulerCapability;
@@ -125,9 +131,10 @@ export declare class NodeExecutionEnv implements ExecutionEnv, BackgroundShellCa
125
131
  * deployments (their pre-suspend dispose becomes a no-op too — do not combine).
126
132
  */
127
133
  retainBackgroundProcesses?: boolean;
128
- /** The D1 scrub decision's observation seat: called with every NON-EMPTY finding set the default
129
- * "scrub" leg withholds from a shell child. Absent ⇒ a once-per-process console summary (loud
130
- * enough to notice, quiet enough not to spam). Never called on the "all"/allowlist legs. */
134
+ /** The D1 scrub decision's observation seat: called with every NON-EMPTY finding set withheld from a
135
+ * shell child — the default "scrub" leg's, and on any leg the declared own credentials the inherited part
136
+ * held (kind `own-credential`). Absent ⇒ a once-per-process console summary (loud enough to notice,
137
+ * quiet enough not to spam). An allow list withholds nothing else, so it reports nothing. */
131
138
  onSecretEnvScrub?: (findings: readonly SecretEnvFinding[]) => void;
132
139
  /** #1081 — the structured-notice seat for the SAME withheld-keys disclosure (`EngineNotice`,
133
140
  * `code: "config.secret_env_scrubbed"`, `detail.names`); independent of `onSecretEnvScrub` (a raw
@@ -7,7 +7,7 @@ import { isAbsolute, join, resolve } from "node:path";
7
7
  import { createInterface } from "node:readline";
8
8
  import { ExecutionError, err, FileError, ok, toError, } from "../harness/types.js";
9
9
  import { killProcessTree, shutdownDebug } from "./kill-tree.js";
10
- import { __resetSecretEnvScrubNoticeAnnouncement, announceSecretEnvScrub, inheritEnvPolicyProblem, inheritedHostEnv, scrubSecretEnv } from "../../core/secret-env.js";
10
+ import { __resetSecretEnvScrubNoticeAnnouncement, announceSecretEnvScrub, inheritEnvPolicyProblem, inheritedHostEnv } from "../../core/secret-env.js";
11
11
  import { physicalPathOfAsync } from "../../core/physical-path.js";
12
12
  import { posixModeBitsMeaningful } from "../../core/posix-mode-face.js";
13
13
  import { walkSymlinkChain } from "./symlink-chain.js";
@@ -157,7 +157,7 @@ async function runCommand(command, args, timeoutMs) {
157
157
  child = spawn(command, args, {
158
158
  stdio: ["ignore", "pipe", "ignore"],
159
159
  windowsHide: true,
160
- env: scrubSecretEnv(process.env),
160
+ env: inheritedHostEnv("scrub"),
161
161
  });
162
162
  }
163
163
  catch {
@@ -315,12 +315,17 @@ export function openSpoolPair(base) {
315
315
  export class NodeExecutionEnv {
316
316
  cwd;
317
317
  get homeDir() {
318
- return getShellEnv(this.inheritEnv, this.shellEnv, undefined, () => { }).HOME;
318
+ return this.childEnvForRead()?.HOME;
319
319
  }
320
320
  get cdPath() {
321
- const value = getShellEnv(this.inheritEnv, this.shellEnv, undefined, () => { }).CDPATH;
321
+ const value = this.childEnvForRead()?.CDPATH;
322
322
  return value === undefined || value === "" ? [] : value.split(":");
323
323
  }
324
+ childEnvForRead() {
325
+ if (inheritEnvPolicyProblem(this.inheritEnv) !== undefined)
326
+ return undefined;
327
+ return getShellEnv(this.inheritEnv, this.shellEnv, undefined, () => { });
328
+ }
324
329
  shellPath;
325
330
  shellEnv;
326
331
  inheritEnv;
@@ -310,6 +310,7 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
310
310
  private abortResultDetails?;
311
311
  private loopTrace?;
312
312
  private onToolInputValidationFault?;
313
+ private onToolMediaRefused?;
313
314
  private resilience?;
314
315
  private maxToolConcurrency?;
315
316
  private streamingToolExecution?;
@@ -538,7 +539,7 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
538
539
  /**
539
540
  * Finalize a call this harness's caller executed OUTSIDE a turn (a resumed, already-approved call) exactly as the
540
541
  * loop finalizes its own: the same {@link finalizeToolOutcome} over the same `tool_result` emit, so the call meets the
541
- * same handlers, the same patch application and the same throwing-hook posture as a live one.
542
+ * same handlers, the same patch application, the same throwing-hook posture and the same media admission as a live one.
542
543
  */
543
544
  finalizeToolCall(toolCall: AgentToolCall, args: unknown, executed: ExecutedToolCallOutcome): Promise<ExecutedToolCallOutcome & {
544
545
  toolCall: AgentToolCall;
@@ -294,6 +294,7 @@ export class AgentHarness {
294
294
  abortResultDetails;
295
295
  loopTrace;
296
296
  onToolInputValidationFault;
297
+ onToolMediaRefused;
297
298
  resilience;
298
299
  maxToolConcurrency;
299
300
  streamingToolExecution;
@@ -329,6 +330,7 @@ export class AgentHarness {
329
330
  this.abortResultDetails = options.abortResultDetails;
330
331
  this.loopTrace = options.loopTrace;
331
332
  this.onToolInputValidationFault = options.onToolInputValidationFault;
333
+ this.onToolMediaRefused = options.onToolMediaRefused;
332
334
  this.resilience = options.resilience;
333
335
  this.maxToolConcurrency = options.maxToolConcurrency;
334
336
  this.streamingToolExecution = options.streamingToolExecution;
@@ -640,6 +642,7 @@ export class AgentHarness {
640
642
  ...(this.stallTimeoutsPerCall !== undefined ? { stallTimeoutsPerCall: this.stallTimeoutsPerCall } : {}),
641
643
  ...(this.abortResultDetails !== undefined ? { abortResultDetails: this.abortResultDetails } : {}),
642
644
  ...(this.onToolInputValidationFault !== undefined ? { onToolInputValidationFault: this.onToolInputValidationFault } : {}),
645
+ ...(this.onToolMediaRefused !== undefined ? { onToolMediaRefused: this.onToolMediaRefused } : {}),
643
646
  ...(this.resilience !== undefined ? { resilience: this.resilience } : {}),
644
647
  ...(this.maxToolConcurrency !== undefined ? { maxToolConcurrency: this.maxToolConcurrency } : {}),
645
648
  ...(this.streamingToolExecution === true && (this.getHandlers("tool_call")?.size ?? 0) === 0
@@ -1231,7 +1234,7 @@ export class AgentHarness {
1231
1234
  return patch;
1232
1235
  }
1233
1236
  finalizeToolCall(toolCall, args, executed) {
1234
- return finalizeToolOutcome(toolCall, executed, (result, isError) => this.afterToolCallHook(toolCall, args, result, isError));
1237
+ return finalizeToolOutcome(toolCall, executed, (result, isError) => this.afterToolCallHook(toolCall, args, result, isError), this.onToolMediaRefused);
1235
1238
  }
1236
1239
  getModel() {
1237
1240
  return this.model;
@@ -1444,6 +1444,9 @@ export interface AgentHarnessOptions<TSkill extends Skill = Skill, TPromptTempla
1444
1444
  /** Loop-config pass-through — see `AgentLoopConfig.onToolInputValidationFault` (a throwing
1445
1445
  * `AgentTool.validateInput` is read as no verdict and disclosed here). */
1446
1446
  onToolInputValidationFault?: import("../loop/types.js").AgentLoopConfig["onToolInputValidationFault"];
1447
+ /** Loop-config pass-through — see `AgentLoopConfig.onToolMediaRefused` (the tool-result seat's account of the media it
1448
+ * refused); the harness's own finalization of a resumed approved call reports through the same sink. */
1449
+ onToolMediaRefused?: import("../loop/types.js").AgentLoopConfig["onToolMediaRefused"];
1447
1450
  /**
1448
1451
  * design/131 (拍): per-task resilience intent flags, forwarded to every provider
1449
1452
  * call (`StreamOptions.resilience`) so the deployment's decorator stack (degrading / failover /
@@ -1020,21 +1020,19 @@ export interface RouteCredential {
1020
1020
  * knob+header pair counts as ONE deployment credential — see `resolveRouteCredential`). */
1021
1021
  carrierBag?: RouteCarrierBag;
1022
1022
  }
1023
- /** The deployment half of the pairing judgment: the brain construction config's DECLARED root.
1024
- * Absent/empty ⇒ the deployment did not declare its credential's URL half (the unpinned
1025
- * quick-start posture — see `adjudicateModelRoute`). */
1023
+ /** The deployment half of the pairing judgment: the root the brain sends to when an entry names none —
1024
+ * its construction config's DECLARED root (`baseUrl`), else the lane's own default endpoint
1025
+ * (`laneDefault`, a constant the brain owns; absent for a lane with no default). That root is the
1026
+ * deployment credential's one root (see `adjudicateModelRoute`). */
1026
1027
  export interface RoutePairingConfig {
1027
1028
  baseUrl?: string;
1029
+ laneDefault?: string;
1028
1030
  }
1029
1031
  /** How an OK verdict is paired.
1030
1032
  * - `"per-model"` — per-model credential, paired by construction.
1031
- * - `"paired"` — deployment credential on the deployment's own declared root.
1032
- * - `"unpinned"` — deployment credential whose URL half is UNDECLARED (no `config.baseUrl`): allowed
1033
- * for compatibility with single-endpoint configs (key on config, URL on the model), but the pairing
1034
- * is unverifiable — a multi-entry deployment in this posture should declare `config.baseUrl` or move
1035
- * to per-model credentials. Surfaced (not refused) so read faces can annotate it.
1033
+ * - `"paired"` — deployment credential on the deployment's own root (declared, or the lane default).
1036
1034
  * - `"keyless"` — no credential anywhere; nothing to protect. */
1037
- export type RoutePairingPosture = "per-model" | "paired" | "unpinned" | "keyless";
1035
+ export type RoutePairingPosture = "per-model" | "paired" | "keyless";
1038
1036
  /** Machine codes an adjudication refusal carries (minted here, forwarded verbatim by consumers). */
1039
1037
  export type RouteRefusalCode = "route.credential_mismatch" | "route.credential_missing";
1040
1038
  /** The structured account of a refusal — the two halves and the fix, every URL a DISPLAY spelling. */
@@ -183,10 +183,15 @@ export declare const TOOL_INPUT_VALIDATION_TIMEOUT_MS = 10000;
183
183
  * The post-execution half EVERY executed tool call passes through — the loop's own calls here, and a call
184
184
  * the harness executed outside a turn (a resumed approved call, `AgentHarness.finalizeToolCall`) through the
185
185
  * same function, so the two cannot drift into two dialects of one finalization: the `afterToolCall` patch
186
- * (content / details / terminate / isError), the D4 posture on a throwing hook, and the delivery mark.
187
- * `after` absent ⇒ the executed outcome stands as is (same object).
186
+ * (content / details / terminate / isError), the D4 posture on a throwing hook, the delivery mark, and last
187
+ * the media admission — the tool-result seat every supply of media reaches after the last hand that can change
188
+ * it (`admitToolResultMedia`): a refused block becomes its text placeholder in the result, and `onMediaRefused`
189
+ * hears the call's refusals once. `after` absent and no media ⇒ the executed outcome stands as is (same object).
188
190
  */
189
- export declare function finalizeToolOutcome<C>(toolCall: C, executed: ExecutedToolCallOutcome, after: ((result: AgentToolResult<unknown>, isError: boolean) => Promise<AfterToolCallResult | undefined>) | undefined): Promise<ExecutedToolCallOutcome & {
191
+ export declare function finalizeToolOutcome<C extends {
192
+ id: string;
193
+ name: string;
194
+ }>(toolCall: C, executed: ExecutedToolCallOutcome, after: ((result: AgentToolResult<unknown>, isError: boolean) => Promise<AfterToolCallResult | undefined>) | undefined, onMediaRefused?: AgentLoopConfig["onToolMediaRefused"]): Promise<ExecutedToolCallOutcome & {
190
195
  toolCall: C;
191
196
  }>;
192
197
  export {};
@@ -3,7 +3,9 @@ import { truncateError } from "../../core/tool-errors.js";
3
3
  import { judgeToolNameMiss, mountedToolNames } from "../../core/tool-name-aliases.js";
4
4
  import { INTERRUPTED_BY_USER_FOR_TOOL_USE_MARKER, INTERRUPTED_BY_USER_MARKER, } from "../../core/session-reconcile.js";
5
5
  import { resolveAgentCoreStreamFn } from "./runtime-deps.js";
6
- import { isErrorLike, readMember, thrownMarksOf, thrownText } from "../../core/thrown-value.js";
6
+ import { isErrorLike, readMember, thrownMarksOf } from "../../core/thrown-value.js";
7
+ import { egressThrownText, egressValue } from "../../core/untrusted-egress.js";
8
+ import { admitToolResultMedia } from "../../tools/fs/image-admission.js";
7
9
  function appendTextDeltaToAssistantMessage(message, contentIndex, delta) {
8
10
  const content = [...message.content];
9
11
  const currentContent = content[contentIndex];
@@ -1111,7 +1113,7 @@ class StreamToolExecutor {
1111
1113
  this.retainCancellation(error);
1112
1114
  entry.immediate = {
1113
1115
  kind: "immediate",
1114
- result: createErrorToolResult(thrownText(error), error),
1116
+ result: thrownErrorToolResult(error),
1115
1117
  isError: true,
1116
1118
  };
1117
1119
  }
@@ -1374,7 +1376,7 @@ async function prepareToolCall(currentContext, assistantMessage, toolCall, confi
1374
1376
  catch (error) {
1375
1377
  return {
1376
1378
  kind: "immediate",
1377
- result: createErrorToolResult(thrownText(error), error),
1379
+ result: thrownErrorToolResult(error),
1378
1380
  isError: true,
1379
1381
  };
1380
1382
  }
@@ -1415,7 +1417,7 @@ async function executePreparedToolCall(prepared, signal, emit, abortResultDetail
1415
1417
  }
1416
1418
  catch (error) {
1417
1419
  outcome = {
1418
- result: createErrorToolResult(thrownText(error), error),
1420
+ result: thrownErrorToolResult(error),
1419
1421
  isError: true,
1420
1422
  };
1421
1423
  }
@@ -1425,7 +1427,7 @@ async function executePreparedToolCall(prepared, signal, emit, abortResultDetail
1425
1427
  return outcome;
1426
1428
  const reason = deliveryFailure.reason;
1427
1429
  const details = annotateDeliveryFailure(outcome.result, {
1428
- message: thrownText(reason),
1430
+ message: egressThrownText("same-principal", reason),
1429
1431
  });
1430
1432
  return details === UNANNOTATED ? outcome : { result: { ...outcome.result, details }, isError: outcome.isError };
1431
1433
  })();
@@ -1497,7 +1499,7 @@ async function executePreparedWithDisclosure(currentContext, assistantMessage, p
1497
1499
  if (isAbortSemanticsError(error))
1498
1500
  throw error;
1499
1501
  executed = {
1500
- result: createErrorToolResult(`[tool execution harness failed: ${thrownText(error)}]`, error),
1502
+ result: thrownErrorToolResult(error, (words) => `[tool execution harness failed: ${words}]`),
1501
1503
  isError: true,
1502
1504
  };
1503
1505
  }
@@ -1506,9 +1508,9 @@ async function executePreparedWithDisclosure(currentContext, assistantMessage, p
1506
1508
  function finalizeExecutedToolCall(currentContext, assistantMessage, prepared, executed, config, signal) {
1507
1509
  return finalizeToolOutcome(prepared.toolCall, executed, config.afterToolCall === undefined
1508
1510
  ? undefined
1509
- : (result, isError) => config.afterToolCall({ assistantMessage, toolCall: prepared.toolCall, args: prepared.args, result, isError, context: currentContext }, signal));
1511
+ : (result, isError) => config.afterToolCall({ assistantMessage, toolCall: prepared.toolCall, args: prepared.args, result, isError, context: currentContext }, signal), config.onToolMediaRefused);
1510
1512
  }
1511
- export async function finalizeToolOutcome(toolCall, executed, after) {
1513
+ export async function finalizeToolOutcome(toolCall, executed, after, onMediaRefused) {
1512
1514
  let result = executed.result;
1513
1515
  let isError = executed.isError;
1514
1516
  const deliveryMark = readDeliveryFailureMark(executed.result.details);
@@ -1525,7 +1527,7 @@ export async function finalizeToolOutcome(toolCall, executed, after) {
1525
1527
  }
1526
1528
  }
1527
1529
  catch (error) {
1528
- const note = truncateError(`[post-tool processing failed (the tool already executed): ${thrownText(error)}]`);
1530
+ const note = truncateError(`[post-tool processing failed (the tool already executed): ${egressThrownText("same-principal", error)}]`);
1529
1531
  result = { ...result, content: [...result.content, { type: "text", text: note }] };
1530
1532
  }
1531
1533
  if (deliveryMark !== undefined && readDeliveryFailureMark(result.details) === undefined) {
@@ -1534,6 +1536,18 @@ export async function finalizeToolOutcome(toolCall, executed, after) {
1534
1536
  result = { ...result, details };
1535
1537
  }
1536
1538
  }
1539
+ const admitting = admitToolResultMedia(result.content, toolCall.name);
1540
+ if (admitting !== undefined) {
1541
+ const admitted = await admitting;
1542
+ result = { ...result, content: admitted.content };
1543
+ if (admitted.refused.length > 0) {
1544
+ try {
1545
+ onMediaRefused?.({ toolName: toolCall.name, toolCallId: toolCall.id, refused: admitted.refused });
1546
+ }
1547
+ catch {
1548
+ }
1549
+ }
1550
+ }
1537
1551
  return { toolCall, result, isError };
1538
1552
  }
1539
1553
  function safeAbortDetails(fn) {
@@ -1563,6 +1577,9 @@ function createErrorToolResult(message, source) {
1563
1577
  details,
1564
1578
  };
1565
1579
  }
1580
+ function thrownErrorToolResult(error, frame = (words) => words) {
1581
+ return createErrorToolResult(frame(egressThrownText("same-principal", error)), { details: egressValue("same-principal", thrownMarksOf(error)) });
1582
+ }
1566
1583
  async function emitToolExecutionEnd(finalized, emit) {
1567
1584
  await emit({
1568
1585
  type: "tool_execution_end",
@@ -566,6 +566,16 @@ export interface AgentLoopConfig extends SimpleStreamOptions {
566
566
  toolCallId: string;
567
567
  error: unknown;
568
568
  }) => void;
569
+ /**
570
+ * Told, once per executed call, of the media blocks the tool-result seat refused (`admitToolResultMedia`, the last step
571
+ * of the post-execution half): each already stands in the result as a text placeholder naming the tool and the refusal,
572
+ * so this is the run's account of it, not a decision. Advisory: a throwing sink changes nothing.
573
+ */
574
+ onToolMediaRefused?: (info: {
575
+ toolName: string;
576
+ toolCallId: string;
577
+ refused: readonly import("../../tools/fs/image-admission.js").ToolResultMediaRefusal[];
578
+ }) => void;
569
579
  /**
570
580
  * Called after a tool finishes executing, before `tool_execution_end` and tool-result message events are emitted.
571
581
  *
@@ -21,7 +21,8 @@ export interface NodeLspManagerOptions {
21
21
  /** Injectable spawn (tests supply a fake server; default = {@link defaultLspSpawn} over `child_process.spawn`). */
22
22
  spawn?: LspSpawn;
23
23
  /** The language server's environment for the default spawn, verbatim. Omitted ⇒ the host environment scrubbed of
24
- * credential-shaped names (`scrubSecretEnv`, a tool child's scrub). Unread when {@link spawn} is supplied. */
24
+ * credential-shaped names and of the declared own credentials (`inheritedHostEnv("scrub")`, a tool child's
25
+ * reading; `declareWithheldEnv`). Unread when {@link spawn} is supplied. */
25
26
  env?: Record<string, string>;
26
27
  /** #1081 — the withheld-keys notice sink, SAME shared once-per-process latch/code as the shell-exec
27
28
  * site's `NodeExecutionEnv.onNotice`. Absent ⇒ console only. Unread when {@link spawn} is supplied. */
@@ -9,7 +9,7 @@ import { TransportLspSession } from "../../core/lsp-session.js";
9
9
  import { StdioLspTransport } from "./stdio-lsp-transport.js";
10
10
  import { MAX_LSP_FILE_BYTES, SharedAbortScope, settleOnAbort } from "../../core/lsp.js";
11
11
  import { asThrownError, thrownText } from "../../core/thrown-value.js";
12
- import { announceSecretEnvScrub, scrubSecretEnv } from "../../core/secret-env.js";
12
+ import { announceSecretEnvScrub, inheritedHostEnv } from "../../core/secret-env.js";
13
13
  export const DEFAULT_LSP_SERVERS = {
14
14
  typescript: "typescript-language-server --stdio",
15
15
  javascript: "typescript-language-server --stdio",
@@ -336,7 +336,7 @@ const lspSpawnWithEnv = (env, onNotice) => (command, args, cwd, signal) => new P
336
336
  let scrubbedEnv = env;
337
337
  if (scrubbedEnv == null) {
338
338
  const findings = [];
339
- scrubbedEnv = scrubSecretEnv(process.env, findings);
339
+ scrubbedEnv = inheritedHostEnv("scrub", findings);
340
340
  announceSecretEnvScrub(onNotice, findings);
341
341
  }
342
342
  child = spawn(command, args, { ...lspSpawnOptions(cwd), env: scrubbedEnv });
package/dist/index.d.ts CHANGED
@@ -11,6 +11,7 @@ export type { RunInternals, ResolvedWorkspace } from "./core/runner/prepare-task
11
11
  export type { RunnerSelfSeat } from "./core/runner/contracts.js";
12
12
  export type { BudgetAxis } from "./core/runner/assemble-result.js";
13
13
  export { terminalProjection } from "./core/runner/terminal-projection.js";
14
+ export { toolOutputBlockChars } from "./core/runner/tool-output-projection.js";
14
15
  export { SESSION_LOG_DIGEST_SCHEME, sessionEntryDigest, sessionLogDigest, sessionLogDigestsComparable, } from "./engine/session/log-digest.js";
15
16
  export type { ResumeTaskConfig } from "./core/runner/runtask.js";
16
17
  export { defineTool } from "./core/tools.js";
@@ -32,6 +33,7 @@ export { assembleCodeTools, type CodeToolsConfig, CODE_ROLE } from "./scenarios/
32
33
  export { TOOL_MODEL_GATE_CLASSES, isModelGatedForClass, type ToolModelGateRule } from "./core/tool-model-gate.js";
33
34
  export { capAggregateToolResults, AGGREGATE_TOOL_RESULT_BUDGET_CHARS, type AggregateBudgetOptions, } from "./core/tool-result-budget.js";
34
35
  export { capAggregateMediaBytes, AGGREGATE_MEDIA_BUDGET_BYTES, type MediaStripInfo } from "./core/media-byte-cap.js";
36
+ export { isMediaBlock, mediaBlockDescriptor, type MediaDescriptor } from "./core/media-byte-cap.js";
35
37
  export { createAskUserQuestionTool, createDurableQuestionPolicy, QUESTION_AWAITS_RESUME, isQuestionUnavailable, type OnQuestionOutcome, type QuestionUnavailable, type OnQuestion, type AskQuestion, type AskQuestionOption, type AskQuestionRequest, type QuestionAnswer, type QuestionAnswerItem, type AskQuestionCardDetails, type AskUserQuestionToolOptions, type AskAnswerContinuationSource, type SyntheticContinuationReason, ASK_USER_QUESTION_TOOL_NAME, } from "./core/ask-question.js";
36
38
  export { createLspTool, gitCheckIgnoreFilter, LSP_OPERATIONS, LSP_FAILURE_BRAND, brandLspFailure, lspFailureOf, SharedAbortScope, settleOnAbort, type LspNoneReason, type LspOperation, type LspServerManager, type LspSession, type LspResult, type LspLocation, type LspSymbolInfo, type LspRequestParams, type LspToolOptions, type LspTransport, type LspReadText, } from "./core/lsp.js";
37
39
  export { buildRequest, parseResult, callHierarchyMethod, pathToUri } from "./core/lsp-protocol.js";
@@ -74,7 +76,7 @@ export { WORKFLOW_SIZE_GUIDELINE_AGENT_CAPS } from "./orchestration/workflow-siz
74
76
  export { ENGINE_AUTHORITY_ENVELOPE_TAGS } from "./core/untrusted-text.js";
75
77
  export { materializeA2aTools, A2aRpcError, type MaterializedA2a, type A2aPeerStatus, type A2aRefreshResult, type A2aToolAxis } from "./core/a2a.js";
76
78
  export { PROTOCOL_TABLE, MCP_NAMESPACE, A2A_NAMESPACE, protocolOf, type ProtocolNamespace, type ProtocolId } from "./core/protocol-table.js";
77
- export { InMemorySessionPolicyStore, SessionPolicyError, loosenReasons, normalizeRules, stripRev, assertSessionRuleNamesCurrent, type SessionPolicyStoreOptions, type SessionRuleNameRefusal, type SessionPolicyStore, type SessionPermissionRules, type StoredSessionRules, type SessionRulesRecord, type PutRulesOptions, } from "./core/session-policy-store.js";
79
+ export { InMemorySessionPolicyStore, SessionPolicyError, loosenReasons, normalizeRules, judgeSessionRulesWrite, readSessionRulesShape, type SessionPolicyStoreOptions, type SessionRuleShapeRefusal, type SessionRuleEntryRefusal, type SessionRuleEntryField, type SessionPolicyStore, type SessionPermissionRules, type StoredSessionRules, type SessionRulesRecord, type PutRulesOptions, } from "./core/session-policy-store.js";
78
80
  export { SAFETY_MERGE_CONFORMANCE_CORPUS, type SafetyMergeVector } from "./core/safety-merge-corpus.js";
79
81
  export { SAFETY_AXIS_VOCABULARY } from "./core/safety-axis-vocab.js";
80
82
  export { createSessionRulePolicy } from "./core/runner/session-rule-policy.js";
@@ -97,6 +99,8 @@ export { getShellConfig, isWslBashLauncher } from "./engine/execution-env/node-e
97
99
  export { walkSymlinkChain, SYMLINK_CHAIN_MAX_HOPS, type SymlinkHopReader } from "./engine/execution-env/symlink-chain.js";
98
100
  export { isSecretEnvKey, scrubSecretEnv } from "./core/secret-env.js";
99
101
  export type { SecretEnvFinding, SecretEnvFindingKind } from "./core/secret-env.js";
102
+ export { declareWithheldEnv, inheritedHostEnv, inheritEnvPolicyProblem, type InheritEnvPolicy } from "./core/secret-env.js";
103
+ export { ENGINE_CAPABILITIES, type EngineCapability } from "./core/engine-capabilities.js";
100
104
  export { MAX_EXEC_OUTPUT_BYTES, RollingTailBuffer, markTruncated } from "./core/exec-output-tail.js";
101
105
  export { physicalPathOf, physicalPathOfExisting } from "./core/physical-path.js";
102
106
  export type { ExecutionEnv, FileInfo, Result, FileErrorCode, ExecutionErrorCode, WriteExpectation, WriteReceipt, SymlinkChain, BoundFileObject } from "./internal/harness.js";
@@ -120,6 +124,7 @@ export { deploymentFaceClampNotice, resolveContainmentFace, type ContainmentFace
120
124
  export { WRITE_PROTECTED_DEFAULT_TABLE, resolveWriteProtectedTable, compileWriteProtection, type WriteProtectedEntry, type WriteProtectedRow, type WriteProtectedKind, type WriteProtectedHit, type WriteProtectionMatcher, type WriteProtectionVerdict, type WriteProtectionViewAbsence, type WriteProtectionJudgeContext, type WriteProtectionCompileOptions, type WriteProtectionCheck, WRITE_PROTECTION_TARGET_VIEWS, type WriteProtectionTargetView, type WriteProtectionMount, } from "./core/write-protect.js";
121
125
  export { InMemoryToolResultStore, OFFLOAD_TOOL_NAME, DEFAULT_TOOL_RESULT_THRESHOLD_CHARS, assertSafeToolResultRef, buildToolResultRef, toolResultContentSegment, MAX_MINTED_TOOL_RESULT_REF_CHARS, type ToolResultProvenance, assertToolResultProvenanceMatch, normalizeToolResultProvenance, toolResultProvenanceOf, ToolResultRefConflictError, TOOL_RESULT_REF_CONFLICT_CODE, type ToolResultStore, type ToolResultSlice, type ToolResultDeletionReport, } from "./core/tool-result-store.js";
122
126
  export { InMemoryCheckpointStore, CheckpointError, mintCheckpointId, mintCheckpointToken, checkpointVersionOf, CURRENT_CHECKPOINT_VERSION, MAX_SUPPORTED_CHECKPOINT_VERSION, ORG_ADMISSION_CHECKPOINT_VERSION, F012_CHECKPOINT_VERSION, REAL_APPROVAL_CHECKPOINT_VERSION, RESOURCE_CHECKPOINT_VERSION, TOKEN_CHECKPOINT_VERSION, debitLedger, remainingBudgetMicroUsd, remainingTokens, winnerFromOutcome, validatePendingSteer, readPendingSteerQueue, appendPendingSteer, MAX_PENDING_STEER_CHARS, MAX_PENDING_STEER_ENTRIES, PENDING_STEER_QUEUE_BYTE_BUDGET_BYTES, PENDING_STEER_FROZEN_FIELDS, ACTOR_ASSERTION_FROZEN_FIELDS, MAX_ACTOR_FIELD_CHARS, MAX_STEER_INPUT_ID_CHARS, type ActorAssertion, type PendingSteerEntry, type PendingSteerInput, riskSeverity, buildRiskDescriptor, summarizeCheckpoint, type RiskDescriptor, type ProbeCause, type ProbeCauseOperands, type CheckpointStore, type CheckpointSummary, type Checkpoint, type CheckpointToken, type CheckpointGate, type CheckpointState, type SerializedCheckpointState, type CheckpointFaultMode, type PendingAction, type ResumeOutcome, type ResolvedOutcome, type ReopenReason, type ResolveExpectation, type TerminalClaimIntent, type TerminalClaimOutcome, type SafetyAxis, type RealApprovalGateBit, type ResourceLedger, type ResourceLimitReason, type PlatformLimitReason, type CheckpointRow, realApprovalOrgFact, resolveCheckpointStore, checkpointStoreExecutionUndeclared, } from "./core/checkpoint-store.js";
127
+ export { REOPEN_REASONS, RESUME_STARTUP_CAUSES, resumeStartupCauseOf, reopenReasonOf, type ResumeStartupCause } from "./core/resume-startup-cause.js";
123
128
  export { EXECUTION_OUTCOME_RECORD_WORDS, EXECUTION_RECORD_LEAVES_ROW_UNRECORDED, type ExecutionOutcomeRecordWord, type ExecutionRecordRowFacts, type ExecutionVerdict, ExecutionOutcomeConflictError, checkpointExecutionRecorded, executionRecordDisposition, sameExecutionRecord, executionVerdict, } from "./core/checkpoint-execution-record.js";
124
129
  export { PAUSE_REGISTRY, type GateKind, type PendingKind, type ResumeGate, isGateKind, resumeGateMatches, type CheckpointPause, type CheckpointFields, pauseOf, checkpointFrom, facetOf } from "./core/pause-registry.js";
125
130
  export { REQUIREMENT_WORDS, type RequirementWord, checkpointRequirementsFor } from "./core/checkpoint-requirements.js";
@@ -147,7 +152,8 @@ export { createFsWriteGatePolicy, WRITE_EXEMPT_DIR_COVERS_ROOT_CODE, type FsWrit
147
152
  export { RETIRED_TOOL_NAMES } from "./core/tool-name-aliases.js";
148
153
  export { judgeRuleToolName, RULE_TOOL_NAME_VERDICTS, type RuleToolNameVerdict } from "./core/tool-name-aliases.js";
149
154
  export { DEFAULT_SUBAGENT_TOOL_NAME } from "./agents/subagent.js";
150
- export { renderTaskNotificationXml, RESUPPLIED_FRAME_PREAMBLE, taskNotificationDedupKey, isDelegatedAgentTerminal, isTerminalTaskNotification, SystemInjectionQueue, type TaskNotificationPayload, type TaskNotificationStatus, type ExternalNotificationInput, type SystemInjection, type SystemInjectionPriority, type NotificationInjectionOutcome, // the injector's outcome words (`parked_durably` = the session's durable box took the frame)
155
+ export { renderTaskNotificationXml, RESUPPLIED_FRAME_PREAMBLE, taskNotificationDedupKey, isDelegatedAgentTerminal, isTerminalTaskNotification, TASK_NOTIFICATION_TERMINAL_STATUSES, // the terminal words that predicate reads, as a value: a host's own terminal check reads these, never a second list
156
+ type TaskNotificationTerminalStatus, SystemInjectionQueue, type TaskNotificationPayload, type TaskNotificationStatus, type ExternalNotificationInput, type SystemInjection, type SystemInjectionPriority, type NotificationInjectionOutcome, // the injector's outcome words (`parked_durably` = the session's durable box took the frame)
151
157
  NOTIFICATION_INJECTION_OUTCOMES, // …and their value half + guard, so a host wiring its own uplink validates a reported outcome without duplicating the vocabulary
152
158
  isNotificationInjectionOutcome, SYSTEM_INJECTION_PRIORITIES, isSystemInjectionPriority, steerPriorityOf, injectionLaneOf, type UserInputLane, AGENT_MESSAGE_TAG, renderAgentMessageFrame, type SemaProvenance, HANDBACK_STATES, type HandbackState, COMPACTION_KINDS, type CompactionKind, handbackStateOf, terminalFrameFacets, } from "./core/task-notification.js";
153
159
  export { TOOL_FAMILIES, TOOL_MOUNT_TAGS, TOOL_APPROVAL_CARDS, TOOL_PATH_ACCESSES, TOOL_PATH_BASES, TOOL_PATH_ABSENCES, TOOL_WIRE_NAME_MAX_CHARS, TOOL_CONTRACT_MAX_CHARS, TOOL_CARD_ID_MAX_CHARS, TOOL_KEY_MAX_CHARS, TOOL_KEYS_MAX, RENDER_HINT_MAX_CHARS, RENDER_HINT_ACTIVITY_MAX_CHARS, RENDER_HINT_MAX_LIST, type ToolFamily, type ToolMountTag, type ToolApprovalCard, type ToolPathAccess, type ToolPathBase, type ToolPathAbsence, type ToolPathTarget, type ToolCallPathTarget, type ToolRosterPathTarget, pathTargetSlotOnly, type ToolRuleFace, type ToolRenderHints, type ToolFaceDeclaration, type ToolCatalogEntry, } from "./core/tool-face.js";
@@ -194,7 +200,7 @@ export { createAllowDenyPolicy, createApprovalPolicy,
194
200
  * members that seat has no lane for (`"unavailable"`, a routing answer; `updatedInput`, an operator edit a
195
201
  * policy verdict cannot get re-adjudicated). Exported so a host can NAME it instead of deriving it through
196
202
  * `Parameters<typeof createApprovalPolicy>[0]["approve"]`. */
197
- type ApprovalSeatOutcome, COARSE_SHELL_TOOLS, createCoarseCommandNamePolicy, createTranscriptIntegrityPolicy, createUnverifiableDeletePolicy, combinePolicies, abortedSeatDeny, receiveHookResult, isEngineRefusal, wrapToolPolicy, decisionText, resolveAsk, toolPolicyNameSets, toolPolicyPathRules, type ToolPolicyNameSets, type NamedToolPolicy, type ToolPolicyProjection, type ToolPolicyProjectionComponent, type ConstraintChainEntry, checkToolPolicyProjection, constraintChainEntryOf, constraintChainDigest, type ToolPolicy, type ToolCallRequest, type PermissionResult, type DecisionReason, screenApproverAttribution, APPROVER_ATTRIBUTION_MAX_CHARS, BIDI_CONTROL_CHARS, carriesBidiControls, type OnAsk, type AskOutcome, type ResolvedAsk, type EngineAttestation, type AskRequest, type AskDelegationProvenance, type AskRuleEvidence, type AskEvidenceAbsence, ASK_EVIDENCE_ABSENCE_VALUES, } from "./core/tool-policy.js";
203
+ type ApprovalSeatOutcome, COARSE_SHELL_TOOLS, createCoarseCommandNamePolicy, createTranscriptIntegrityPolicy, createUnverifiableDeletePolicy, combinePolicies, abortedSeatDeny, noApproverSeatDeny, receiveHookResult, isEngineRefusal, wrapToolPolicy, decisionText, resolveAsk, toolPolicyNameSets, toolPolicyPathRules, type ToolPolicyNameSets, type NamedToolPolicy, type ToolPolicyProjection, type ToolPolicyProjectionComponent, type ConstraintChainEntry, checkToolPolicyProjection, constraintChainEntryOf, constraintChainDigest, type ToolPolicy, type ToolCallRequest, type PermissionResult, type DecisionReason, screenApproverAttribution, APPROVER_ATTRIBUTION_MAX_CHARS, BIDI_CONTROL_CHARS, carriesBidiControls, type OnAsk, type AskOutcome, type ResolvedAsk, type EngineAttestation, type AskRequest, type AskDelegationProvenance, type AskRuleEvidence, type AskEvidenceAbsence, ASK_EVIDENCE_ABSENCE_VALUES, } from "./core/tool-policy.js";
198
204
  export { type ReadRootGrantScreen } from "./core/read-root-grant-screen.js";
199
205
  export { type AskOrigin, ASK_ORIGINS, isAskOrigin, ORIGIN_IMPLIES_REAL_APPROVAL, PERSISTED_RULE_MANDATES, type PersistedRuleMandate, isPersistedRuleMandate, screenAskClassMembers } from "./core/ask-origin.js";
200
206
  export { PERMISSION_MODES, type PermissionMode, isPermissionMode, PERMISSION_MODE_RANK, clampPermissionMode, ASK_CLASSES, type AskClass, isAskClass, MODE_ARBITRATION, type ModeArbitrationRow, ASK_FACES, type AskFace, askFaceOf, releasableAskClassesFor, MODE_RELEASE_REASONS, type ModeReleaseReason, isModeReleaseReason, RRA_EXPLAINERS, classifyAsk, foldArbitrationRow, type AskClassification, type AskClassFacts, type ToolMarkSource, arbitrateByMode, type Arbitration, fileCommandOptionsSentence } from "./core/ask-origin.js";
@@ -203,12 +209,12 @@ export type { PermissionSeatInputs, PermissionSeatReading } from "./core/mode-po
203
209
  export type { SkillGateSeats, SkillGrantHit, SkillGrantLane, SkillGrantOrigin, SkillGrantRecord } from "./core/skill-grant.js";
204
210
  export { SKILL_GRANT_ORIGINS } from "./core/skill-grant.js";
205
211
  export type { BoundSkillGrants } from "./core/skill-grant-binding.js";
206
- export { ALLOW_ENTRY_INERT_REASONS, compileAllowEntry, compileAllowList, renderListEntry, type AllowEntryInertReason, type CompiledAllowEntry, type AllowEntryGateSeats, type AllowEntryLane, type AllowEntryHit } from "./core/allow-entry.js";
212
+ export { ALLOW_ENTRY_INERT_REASONS, readRuleEntry, compileAllowList, renderListEntry, type RuleEntryReading, type AllowEntryInertReason, type AllowEntryInertDetail, type CompiledAllowEntry, type AllowEntryGateSeats, type AllowEntryLane, type AllowEntryHit } from "./core/allow-entry.js";
207
213
  export { ALLOW_RULE_MEMBERS, type AllowRuleMember, type AllowRuleShadow } from "./core/allow-rule-shadow.js";
208
214
  export { mintNamespacePrefix } from "./core/protocol-naming.js";
209
215
  export { readDenyClassifierRules, renderClassifierDenyRules, type DerivedDenyRule } from "./core/auto-mode-prompt.js";
210
216
  export { AUTO_MODE_DENY_SOURCES, isAutoModeDenySource, type AutoModeDenySource } from "./core/runtime-caps.js";
211
- export { SETTLEMENT_KINDS, type SettlementKind, isSettlementKind, type Settlement, SETTLEMENT_PARTIES, type SettlementParty, isSettlementParty, HOST_DECIDERS, type HostDecider, type HostDecisionFacts, isHostDecider, SETTLEMENT_IS_REFUSAL, DENIED_BY_VALUES, type DeniedBy, isDeniedBy, DENIED_BY_MAY_VETO, CLASSIFIER_DENY_CAUSES, type ClassifierDenyCause, isClassifierDenyCause, DENIED_BY_MAY_CARRY_CAUSE, type GateDisposition, type GateOutcome, type ModeRelease, type ModeRefusal, screenGateOutcome } from "./core/gate-outcome.js";
217
+ export { SETTLEMENT_KINDS, type SettlementKind, isSettlementKind, type Settlement, SETTLEMENT_PARTIES, type SettlementParty, isSettlementParty, HOST_DECIDERS, type HostDecider, type HostDecisionFacts, isHostDecider, SETTLEMENT_IS_REFUSAL, DENIED_BY_VALUES, type DeniedBy, isDeniedBy, DENIED_BY_MAY_VETO, CLASSIFIER_DENY_CAUSES, type ClassifierDenyCause, isClassifierDenyCause, DENIED_BY_MAY_CARRY_CAUSE, type GateDisposition, type GateOutcome, type ModeRelease, type ModeRefusal, screenGateOutcome, RETIRED_MEMBERS, isRetiredMember } from "./core/gate-outcome.js";
212
218
  export { ENGINE_BUILTIN_TOOL_NAMES, isEngineBuiltinToolName } from "./core/tool-catalog-entries.js";
213
219
  export { policyCannotAnswer, type HeldQuestion } from "./core/real-approval.js";
214
220
  export { type AskCarry } from "./core/hooks.js";
@@ -256,6 +262,7 @@ export { formatHookFeedback, runToolGate, createHookEnvCapabilities, createPreTo
256
262
  export { HOOK_FAMILIES, HOOKS_INVALID_CODE, type HookFamily, type WiringManifestHookEntry } from "./core/hook-seats.js";
257
263
  export { InMemoryMemoryStore, composeMemoryBlock, composeLayeredMemoryBlock, normalizeMemorySpec, type NormalizedMemorySpec, type MemorySpecInput, supportsConsolidation, supportsPeriodicConsolidation, firstSentence, expandLexicalTerms, lexicalSearchMatch, type Embedder, classifyPromotable, enforcePromotableWriteGate, guardedMemoryStore, MemoryGateError, MemoryProjectionError, detectSecret, enforceSecretWriteGate, enforceStructuredNoteSecretGate, type UtilityGate, type MemoryStore, type MemoryVectorMode, type ScoredMemory, type MemoryNoteHeader, type MemoryNoteRecord, type MemoryNoteType, type StructuredNoteInput, MEMORY_PROJECT_KEY_ABSENT_REASONS, type MemoryProjectKeyAbsentReason, type MemoryProjectKey, } from "./core/memory.js";
258
264
  export { MemoryEngine, FileMemoryEngineBackend, memoryBackendContract, assertMemoryBackendSearchEquivalence, type MemoryBackendContractHooks, buildMemoryInstruction, writableRootOf, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, deriveRepoControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, MEMORY_ORIGIN_CAUSES, committedOriginOf, originEquals, consolidationExposedFrontmatter, ambiguousOriginRepresentation, type OriginClearanceRow, type OriginClearanceEvent, type OriginClearanceShadow, committedDistilledOf, distilledEquals, type MemoryEntryDistilled, type MemoryEntryDistilledInput, CONSOLIDATION_DEFAULTS, ConsolidationRefusedError, MEMORY_SEARCH_SUPERSEDED_TAG, consolidationTypeEligible, deriveSupersededSet, memorySupersededNote, readIntentCredentials, supersessionFuseCeiling, deriveShadowedSet, memoryConsolidationRecommendedNotice, memoryConsolidationCommittedNotice, memoryConsolidationConflictNotice, memoryConsolidationIncompleteNotice, memoryConsolidationRefusedNotice, memoryConsolidationWithheldNotice, type ConsolidationGateRead, type ConsolidationGateRow, type ConsolidationIntent, type ConsolidationIntentCredentialRow, type ConsolidationLeaseSeat, type ConsolidationProductProposal, type ConsolidationProposal, type ConsolidationWriteGate, type MemoryConsolidationOptions, type ConsolidationCommitReceipt, type ConsolidationReconcileReport, type ConsolidationResolveReceipt, type ConsolidationPlanSummary, type ConsolidationPlanFoldEvidence, type SessionMemoryStatus, DISTILLER_DEFAULT_MAX_INPUTS_PER_PRODUCT, LLM_DISTILLER_CONTRACT, LLM_DISTILLER_CONTRACT_DL2, LLM_DISTILLER_CONTRACT_DL3, LLM_DISTILLER_CONTRACTS, MEMORY_DISTILLER_CONTRACT_V1, contractGroupingDiff, driveConsolidationToFixpoint, isAliasModelId, llmPlanDistiller, mintExposurePartitionedPlan, mintLlmConsolidationPlan, MEMORY_DISTILLER_PURITY_CONTRACT_V1, detectCleanArmVerbatimLeak, type CleanArmLeakFinding, type CleanArmLeakVerdict, type MemoryDistillerPurityContract, openAiCompatChatSeat, parseJsonAnswer, planParseRepairs, sanitizeLlmGroups, scheduleUnderFuse, type ConsolidationDistillFn, type ConsolidationDriveCycleRow, type ConsolidationDriveEngine, type ConsolidationDriveResult, type ConsolidationFoldState, type DistillerCandidate, type DistillerChatAnswer, type DistillerChatFn, type DistillerChatRequest, type FuseSchedule, type LlmConsolidationPlan, type LlmConsolidationPlanArm, type LlmConsolidationPlanProduct, type LlmDistillerContract, type MintLlmConsolidationPlanResult, type PlanParseRepairs, type SanitizedLlmGroups, CONSOLIDATION_DRIVER_PLANS_DIR, CONSOLIDATION_DRIVER_RUNS_FILE, CONSOLIDATION_RUN_STOP_REASONS, CONSOLIDATION_WRITE_REFUSED_CODE, archiveDistillerPlan, readConsolidationDriverRun, runMemoryConsolidationDriver, type ConsolidationDriverEngine, type ConsolidationDriverRunRow, type ConsolidationRunReceipt, type ConsolidationRunStopReason, type ConsolidationWriteJudge, type ConsolidationWriteTarget, type RunMemoryConsolidationOptions, isInstructionEntry, type MemoryEntryOrigin, type MemoryOriginCause, MEMORY_INSTRUCTION_TEMPLATE, MEMORY_RECALL_DISCIPLINE, MEMORY_PREFERENCE_DISCIPLINE, MEMORY_READONLY_NOTICE, MEMORY_CAPTURE_OPTOUT_NOTICE, memoryCaptureOptedOutNotice, memoryCaptureOptOutUnpersistedNotice, SESSION_CAPTURE_OPTOUT_DIR, markSessionCaptureOptOut, readSessionCaptureOptOut, listSessionCaptureOptOut, fileSessionCaptureRecordStore, type SessionCaptureOptOutRecord, type SessionCaptureOptOutMarkOutcome, type SessionCaptureRecordStore, readV2HeaderHints, type V2HeaderHints, LINEAGE_FILE, CHALLENGES_FILE, CHALLENGED_HISTORY_FILE, CHALLENGE_LEDGER_MAX_EVENTS, rebuildStrictControlPlaneLedger, type ControlPlaneRebuildReceipt, type StrictControlPlaneLedger, type ChallengeAssignment, type ChallengeEvent, type ChallengedHistoryRow, type LineagePendingTxn, type LineagePromotion, MEMORY_INDEX_FILENAME, MEMORY_INDEX_MAX_LINES, MEMORY_INDEX_MAX_BYTES, MEMORY_SEARCH_TOOL_NAME, MEMORY_GET_TOOL_NAME, MEMORY_INDEX_TOOL_NAME, MEMORY_ENGINE_TOOL_NAMES, type MemorySearchDetails, type MemorySearchHit, type CleanMemorySearchHit, type ExposedMemorySearchHit, MEMORY_EXPOSURE_BANNER, MEMORY_EXPOSURE_HANDLE_TAG, memoryExposureIndexRow, type MemoryGetDetails, type MemoryIndexDetails, type MemoryIndexRow, type CleanMemoryIndexRow, type ExposedMemoryIndexRow, STUB_ARCHIVED_LINE, DEFAULT_MAX_MEMORY_FILES, DEFAULT_MAX_ENTRY_DEPTH, DEFAULT_HARVEST_DEADLINE_MS, DEFAULT_HARVEST_FILE_BUDGET, MASS_DELETION_FUSE_RATIO, scanMemoryWrite, scanMemoryFileName, scanRemediation, MEMORY_FILENAME_SEGMENT_RE, renderAnnouncements, enqueueMemoryAnnouncement, drainMemoryAnnouncements, peekMemoryAnnouncements, bumpScanFuse, scanFuseCount, clearScanFuse, ANNOUNCEMENTS_FILE, MEMORY_ANNOUNCEMENTS_MAX, SCAN_FUSE_FILE, SCAN_FUSE_THRESHOLD, type MemoryAnnouncement, type ScanFinding, type MemoryEngineOptions, type MemoryInjection, type EntryProvenanceAccount, type TransferEvidence, type CommittedBinding, type CommittedEntrySnapshot, type CommittedScopeSnapshots, type EntryCustodyReport, erasureSelectHash, type EraseMemoryEntriesInput, type ErasureSelect, type ErasedBinding, type MemoryErasureAttestation, computeMemoryBundleHash, type MemoryExportBundle, type MemoryImportReport, type MemoryExportSnapshot, type MemoryBundleImportPlan, type BundleChallengeRow, type BundleLineageRow, type BundlePollutedSession, type MemoryBackend, type MemoryEntry, type MemoryEntryFrontmatter, type MemoryEntryHeader, type MemoryScopeEnumeration, type ScoredMemoryEntry, type NotePatch, type PatchReport, type MaterializedFile, type MemorySessionHandle, type HarvestReport, type HarvestRejection, type HarvestRejectionCode, type ParsedEntryFile, type ScannedEntryFile, SCOPE_SEGMENT_MAX_ENCODED, PROJECT_MARKER_PATH, encodeScopeSegment, decodeScopeSegment, parseScopeKey, formatUserScope, formatOrgScope, formatProjScope, formatUserProjScope, isPersonalScope, isOrgScopeKey, assertScopeContractPlacement, formatProjectMarker, parseProjectMarker, resolveProjectId, PROJECT_ID_REGEX, type ParsedScopeKey, migrateScope, type MigrateScopeReport, materializeEntriesToFiles, harvestFilesToPatches, projectionsToWriteBack, screenInboundEntries, REMOTE_HARVEST_PER_FILE_BYTES, REMOTE_MASS_DELETION_FUSE_RATIO, type RemoteMemoryFile, type RemoteMemoryBaseline, type RemoteMaterialization, type RemoteHarvestResult, type InboundEntryFinding, deriveProjectMemoryDir, deriveProjectControlDir, recordProjectIdHint, lookupProjectIdHint, PROJECT_ID_HINTS_FILE, reconcileMemoryEntries, nextSyncBaseline, mergeRecallHits, type MemorySyncCursor, type MemorySyncConflict, type MemorySyncPlan, type RecallSource, syncMemoryScope, type MemorySyncTransport, type MemorySyncRequestBody, type MemorySyncResponseBody, type MemorySyncClientConflict, type SyncMemoryScopeOptions, type MemorySyncClientResult, } from "./core/memory-engine/index.js";
265
+ export { createConsolidationWriteJudge, deliverWriteRefusal, type ConsolidationWriteJudgeInput } from "./core/runner/memory-consolidation-write-judge.js";
259
266
  export { STORE_FORM_REFUSAL_CODES, TARGET_OUTSIDE_STORE, SCOPE_HOME_NOT_DIRECTORY, SCOPE_HOME_FORMS, type StoreFormRefusalCode, type StoreFormRefusalDetail, type StoreFormRefusal, type ScopeHomeForm } from "./core/memory-engine/layout.js";
260
267
  export { reanchorMemoryStoreRoot, type StoreRootReanchor } from "./core/memory-engine/layout.js";
261
268
  export { SHARED_MEMORY_READ_CAP_BYTES, SHARED_MEMORY_LIST_PAGE_SIZE, SharedMemoryStoreError, type SharedMemoryStoreProvider, type SharedMemoryStoreReader, type SharedMemoryPagedList, type SharedMemoryStoreInfo, type SharedMemoryDocumentEntry, type SharedMemorySnapshot, type SharedMemoryRequestContext, type MemoryListDetails, type MemoryReadDetails, } from "./core/shared-memory/types.js";
@@ -270,6 +277,7 @@ type MemoryConsolidationDriverDeps, } from "./core/runner/memory-consolidation-d
270
277
  export { DEFAULT_COMPACTION_INSTRUCTIONS } from "./core/auto-compaction.js";
271
278
  export { DEFAULT_SYSTEM_PROMPT, CODE_AGENT_PROMPT, SUBAGENT_PROMPT, CODE_SYSTEM_PROMPT, MEMORY_GUIDANCE, MEMORY_SAFETY, MEMORY_HYGIENE, NO_PERSISTENT_MEMORY_NOTICE, OUTPUT_EFFICIENCY, CYBER_RISK, HARNESS_SECTION_ANCHOR, URL_SAFETY, SUMMARIZE_TOOL_RESULTS, EXECUTION_ENVIRONMENT, EXECUTION_ENVIRONMENT_OPEN_READS, executionEnvironmentBlockFor, harnessContext, buildEnvironmentContext, buildGitSnapshot, buildScratchpadSection, GIT_STATUS_MAX_CHARS, formatLocalDate, type EnvironmentFacts, defaultPromptProvider, composeSystemPrompt, composeConstitution, constitutionBlocks, type PromptBlock, analyzePromptCacheFriendliness, assertPromptCacheFriendly, type PromptProvider, type StablePromptContext, type PromptCacheReport, type PromptTextDeclaration, } from "./prompts/default.js";
272
279
  export { SUPERVISOR_PROMPT, ORCHESTRATION_GUIDANCE, ORCHESTRATION_AWARENESS, GOAL_COMPLETION_GUIDANCE } from "./prompts/supervisor.js";
280
+ export { coworkPromptProvider, COWORK_PROMPT_SECTIONS } from "./prompts/cowork.js";
273
281
  export { compose, validatePack } from "./prompt-assembly/composer.js";
274
282
  export { SEMA_DEFAULT_PACK } from "./prompt-assembly/packs/sema-default.js";
275
283
  export { attachToolContract, getToolContract, hasToolContract, computeShapeDigest, projectToolManifest, type ToolContractDescriptor, type ToolOrigin } from "./prompt-assembly/tool-catalog.js";
@@ -330,8 +338,11 @@ export { FileBackgroundAgentStore, type FileBackgroundAgentStoreOptions } from "
330
338
  export { A2A_TASK_STATES, type A2ATaskState, type A2ATaskStateReversal, type A2ATaskStateReversalFaithful, type A2ATaskStateReversalLossy, toA2ATaskState, fromA2ATaskState, } from "./core/a2a-task-state.js";
331
339
  export { type WorkflowJournalStore, type WorkflowJournalEntry, InMemoryWorkflowJournalStore, callKeyOrdinal, JOURNAL_OVERSIZE_ERROR_CODE, WorkflowJournalOversizeError, assertJournalEntryFits, } from "./core/workflow-journal-store.js";
332
340
  export { untrustedEgressForHuman, redactHostLeaks, redactSecrets, boundedRedactedSummary } from "./core/untrusted-egress.js";
341
+ export type { Egress, EgressTier } from "./core/untrusted-egress.js";
333
342
  export type { RedactionFinding, RedactionReport, RedactionConfidence, RedactionSource, SummarizableFinding, } from "./core/untrusted-egress.js";
334
343
  export { summarizeRedactions } from "./core/untrusted-egress.js";
344
+ export { headerOwnershipCollision } from "./core/protocol-http-auth.js";
345
+ export type { ProtocolHttpAuth } from "./core/protocol-http-auth.js";
335
346
  export { MemoryRosterStore, FileRosterStore, type RosterStore, type RosterEntry, type RosterAccess, type RosterGcOptions } from "./agents/roster-store.js";
336
347
  export { CONFIG_CATALOG_VERSION, describeConfigCatalog, resolveEffectiveConfig, type ConfigKnob, type ConfigOverrideDeclaration, type ConfigProvenance, type EffectiveConfigField, } from "./config/catalog.js";
337
348
  export { normalizeAgentName } from "./core/task-registry.js";
@@ -383,3 +394,9 @@ export type { AgentDefinition, BeforeWriteHook, BeforeWriteRequest, BeforeWriteR
383
394
  export { Type } from "typebox";
384
395
  export type { TSchema, Static } from "typebox";
385
396
  export { explainPromptAssembly, describeDefaultPack, type DefaultPackDescription, type ExplainInput } from "./prompt-assembly/explain.js";
397
+ export { APPROVAL_ROUTES, approvalRouteOf, type ApprovalRoute } from "./core/wiring-manifest.js";
398
+ export { SHADOW_REASON, allowRuleShadowSentence, cardDisclosureOf } from "./core/allow-entry.js";
399
+ export { RULE_OFFERS_ABSENCES, type RuleOffersAbsence } from "./core/ask-origin.js";
400
+ export { BOUND_GRANT_ABSENCES, type BoundGrantAbsence } from "./core/skill-grant-binding.js";
401
+ export { DISPOSABLE_PROMPT_SECTIONS, type DisposablePromptSection, type PromptSectionEntry, type PromptSectionDisposition, type PromptSectionAuthor, type McpInstructionsEntry } from "./core/prompt-section-seat.js";
402
+ export type { McpRevocationLedger, McpMountIdentity } from "./core/mcp-server-spec.js";