@sema-agent/core 7.49.5 → 7.50.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 (193) hide show
  1. package/CHANGELOG.md +138 -0
  2. package/dist/agents/observer.js +3 -10
  3. package/dist/agents/subagent-steps.d.ts +6 -14
  4. package/dist/agents/subagent-steps.js +3 -17
  5. package/dist/brain/stream-shared.d.ts +1 -1
  6. package/dist/core/allow-entry.d.ts +1 -1
  7. package/dist/core/allow-entry.js +1 -1
  8. package/dist/core/ask-origin.d.ts +15 -11
  9. package/dist/core/ask-origin.js +6 -14
  10. package/dist/core/auto-mode-prompt.js +6 -2
  11. package/dist/core/checkpoint-store.d.ts +6 -4
  12. package/dist/core/checkpoint-store.js +1 -1
  13. package/dist/core/context-edit.d.ts +2 -2
  14. package/dist/core/decision-receipt.d.ts +2 -2
  15. package/dist/core/decision-receipt.js +30 -11
  16. package/dist/core/delegation-frames.d.ts +66 -18
  17. package/dist/core/delegation-frames.js +22 -0
  18. package/dist/core/engine-notice.d.ts +7 -5
  19. package/dist/core/frame-settlement.d.ts +6 -1
  20. package/dist/core/gate-fold.js +19 -13
  21. package/dist/core/gate-lanes.js +12 -11
  22. package/dist/core/gate-outcome.d.ts +2 -2
  23. package/dist/core/governance-codes.js +2 -0
  24. package/dist/core/hooks.d.ts +28 -20
  25. package/dist/core/human-input-projection.js +2 -0
  26. package/dist/core/lsp-diagnostics.d.ts +3 -0
  27. package/dist/core/lsp-diagnostics.js +6 -0
  28. package/dist/core/lsp-session.d.ts +39 -17
  29. package/dist/core/lsp-session.js +118 -58
  30. package/dist/core/lsp.d.ts +83 -3
  31. package/dist/core/lsp.js +146 -16
  32. package/dist/core/mcp.js +2 -1
  33. package/dist/core/media-byte-cap.d.ts +14 -0
  34. package/dist/core/media-byte-cap.js +15 -3
  35. package/dist/core/memory-engine/consolidation-driver.d.ts +23 -1
  36. package/dist/core/memory-engine/consolidation-driver.js +54 -6
  37. package/dist/core/memory-engine/consolidation-write-gate.d.ts +46 -0
  38. package/dist/core/memory-engine/consolidation-write-gate.js +82 -0
  39. package/dist/core/memory-engine/consolidation.d.ts +17 -0
  40. package/dist/core/memory-engine/consolidation.js +1 -0
  41. package/dist/core/memory-engine/distiller.d.ts +8 -2
  42. package/dist/core/memory-engine/distiller.js +8 -6
  43. package/dist/core/memory-engine/engine.d.ts +37 -4
  44. package/dist/core/memory-engine/engine.js +127 -38
  45. package/dist/core/memory-engine/file-backend.d.ts +8 -3
  46. package/dist/core/memory-engine/file-backend.js +44 -16
  47. package/dist/core/memory-engine/index.d.ts +2 -2
  48. package/dist/core/memory-engine/index.js +1 -1
  49. package/dist/core/memory-engine/landing-admission.d.ts +65 -0
  50. package/dist/core/memory-engine/landing-admission.js +68 -0
  51. package/dist/core/memory-engine/types.d.ts +23 -0
  52. package/dist/core/mode-policy.d.ts +3 -2
  53. package/dist/core/mode-policy.js +2 -0
  54. package/dist/core/permission-rule-model.d.ts +19 -13
  55. package/dist/core/permission-rule-model.js +7 -4
  56. package/dist/core/permission-rule-provider.d.ts +11 -0
  57. package/dist/core/permission-rules.d.ts +1 -1
  58. package/dist/core/permission-rules.js +5 -2
  59. package/dist/core/persisted-rule-arms.d.ts +15 -7
  60. package/dist/core/persisted-rule-arms.js +13 -6
  61. package/dist/core/reminder-mint.d.ts +5 -0
  62. package/dist/core/reminder-mint.js +1 -0
  63. package/dist/core/retired-keys.d.ts +8 -0
  64. package/dist/core/retired-keys.js +4 -0
  65. package/dist/core/rule-lane-reads.d.ts +4 -4
  66. package/dist/core/rule-lane-reads.js +10 -1
  67. package/dist/core/runner/construction-doors.d.ts +10 -4
  68. package/dist/core/runner/construction-doors.js +25 -2
  69. package/dist/core/runner/contracts.d.ts +20 -3
  70. package/dist/core/runner/env-capability-census.js +1 -1
  71. package/dist/core/runner/gate-exit.js +2 -1
  72. package/dist/core/runner/memory-consolidation-driver.d.ts +6 -4
  73. package/dist/core/runner/memory-consolidation-driver.js +5 -2
  74. package/dist/core/runner/memory-consolidation-write-judge.d.ts +17 -0
  75. package/dist/core/runner/memory-consolidation-write-judge.js +14 -0
  76. package/dist/core/runner/permission-rule-lanes.d.ts +16 -22
  77. package/dist/core/runner/permission-rule-lanes.js +13 -43
  78. package/dist/core/runner/person-path-rows.d.ts +244 -0
  79. package/dist/core/runner/person-path-rows.js +387 -0
  80. package/dist/core/runner/prepare-acquire-reconcile.js +8 -1
  81. package/dist/core/runner/prepare-artifact.d.ts +5 -3
  82. package/dist/core/runner/prepare-artifact.js +2 -8
  83. package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -3
  84. package/dist/core/runner/prepare-caps-and-workflow.js +1 -1
  85. package/dist/core/runner/prepare-context-lane.js +2 -2
  86. package/dist/core/runner/prepare-gate-stations.d.ts +3 -3
  87. package/dist/core/runner/prepare-gate-stations.js +1 -1
  88. package/dist/core/runner/prepare-hands-readface.d.ts +19 -10
  89. package/dist/core/runner/prepare-hands-readface.js +57 -43
  90. package/dist/core/runner/prepare-lsp.d.ts +15 -13
  91. package/dist/core/runner/prepare-lsp.js +11 -11
  92. package/dist/core/runner/prepare-policy-chain.d.ts +8 -4
  93. package/dist/core/runner/prepare-policy-chain.js +6 -7
  94. package/dist/core/runner/prepare-run-refs.js +1 -1
  95. package/dist/core/runner/prepare-task.js +24 -16
  96. package/dist/core/runner/prepare-turn-wiring.d.ts +13 -6
  97. package/dist/core/runner/prepare-turn-wiring.js +19 -8
  98. package/dist/core/runner/read-root-grant.d.ts +1 -25
  99. package/dist/core/runner/read-root-grant.js +1 -17
  100. package/dist/core/runner/retired-runner-deps.d.ts +2 -2
  101. package/dist/core/runner/run-brain-sinks.d.ts +1 -5
  102. package/dist/core/runner/run-brain-sinks.js +2 -4
  103. package/dist/core/runner/run-harness-handlers.js +5 -4
  104. package/dist/core/runner/run-identity-wiring.d.ts +4 -4
  105. package/dist/core/runner/run-identity-wiring.js +10 -1
  106. package/dist/core/runner/run-leg.d.ts +1 -1
  107. package/dist/core/runner/run-leg.js +22 -9
  108. package/dist/core/runner/run-settle-and-teardown.d.ts +0 -4
  109. package/dist/core/runner/run-settle-and-teardown.js +7 -4
  110. package/dist/core/runner/run-terminal-adoption.d.ts +1 -1
  111. package/dist/core/runner/run-terminal-adoption.js +1 -1
  112. package/dist/core/runner/run-turn-boundary.js +2 -2
  113. package/dist/core/runner/runtask.js +8 -8
  114. package/dist/core/runner/session-file-state-replay.d.ts +14 -4
  115. package/dist/core/runner/session-file-state-replay.js +8 -0
  116. package/dist/core/runner/stream-steer-verb.js +3 -0
  117. package/dist/core/runner/tool-end-body.d.ts +5 -4
  118. package/dist/core/runner/tool-end-body.js +4 -4
  119. package/dist/core/runner/tool-output-projection.d.ts +6 -4
  120. package/dist/core/runner/tool-output-projection.js +66 -47
  121. package/dist/core/runner-deps.d.ts +6 -3
  122. package/dist/core/shared-memory/types.d.ts +2 -2
  123. package/dist/core/shell-read-silence.d.ts +23 -0
  124. package/dist/core/shell-read-silence.js +18 -0
  125. package/dist/core/synthetic-read-verdict.d.ts +80 -21
  126. package/dist/core/synthetic-read-verdict.js +89 -18
  127. package/dist/core/task-event.d.ts +113 -25
  128. package/dist/core/task-spec.d.ts +44 -0
  129. package/dist/core/task-tool-shape.d.ts +1 -1
  130. package/dist/core/tool-catalog-entries.js +16 -2
  131. package/dist/core/tool-policy.d.ts +25 -15
  132. package/dist/core/tool-policy.js +9 -13
  133. package/dist/core/trace.d.ts +3 -2
  134. package/dist/core/types.d.ts +3 -3
  135. package/dist/core/types.js +1 -1
  136. package/dist/core/untrusted-text.d.ts +2 -2
  137. package/dist/core/user-attachment.d.ts +164 -0
  138. package/dist/core/user-attachment.js +437 -0
  139. package/dist/engine/compaction/compaction.js +10 -3
  140. package/dist/engine/compaction/utils.js +6 -0
  141. package/dist/engine/execution-env/node-execution-env.d.ts +19 -1
  142. package/dist/engine/execution-env/node-execution-env.js +125 -0
  143. package/dist/engine/harness/agent-harness.d.ts +12 -2
  144. package/dist/engine/harness/agent-harness.js +15 -3
  145. package/dist/engine/harness/types.d.ts +21 -0
  146. package/dist/engine/llm/content-block-render.d.ts +15 -0
  147. package/dist/engine/llm/content-block-render.js +10 -0
  148. package/dist/engine/llm/index.d.ts +1 -0
  149. package/dist/engine/llm/index.js +1 -0
  150. package/dist/engine/llm/types.d.ts +80 -4
  151. package/dist/engine/llm/types.js +43 -1
  152. package/dist/engine/session/import-validate.js +2 -0
  153. package/dist/index.d.ts +6 -4
  154. package/dist/index.js +2 -1
  155. package/dist/internal/harness-types.d.ts +1 -1
  156. package/dist/internal/llm.d.ts +2 -2
  157. package/dist/internal/llm.js +1 -1
  158. package/dist/orchestration/workflow.d.ts +4 -5
  159. package/dist/orchestration/workflow.js +2 -2
  160. package/dist/prompts/default.d.ts +1 -1
  161. package/dist/tools/artifact/artifact-tool.js +1 -1
  162. package/dist/tools/fs/bash-readonly-classifier.d.ts +1 -1
  163. package/dist/tools/fs/dir-entries.d.ts +4 -10
  164. package/dist/tools/fs/dir-entries.js +4 -11
  165. package/dist/tools/fs/file-read-check.js +3 -3
  166. package/dist/tools/fs/fs-pdf.js +2 -4
  167. package/dist/tools/fs/fs-read.d.ts +47 -4
  168. package/dist/tools/fs/fs-read.js +63 -19
  169. package/dist/tools/fs/fs-search-tools.d.ts +3 -3
  170. package/dist/tools/fs/fs-search-tools.js +7 -2
  171. package/dist/tools/fs/fs-write.d.ts +1 -1
  172. package/dist/tools/fs/fs-write.js +7 -6
  173. package/dist/tools/fs/index.d.ts +7 -1
  174. package/dist/tools/fs/index.js +56 -34
  175. package/dist/tools/fs/read-deny-home.d.ts +19 -1
  176. package/dist/tools/fs/read-deny-home.js +32 -22
  177. package/dist/tools/fs/read-deny.d.ts +14 -0
  178. package/dist/tools/fs/read-deny.js +8 -0
  179. package/dist/tools/fs/repo-map.d.ts +3 -2
  180. package/dist/tools/fs/repo-map.js +11 -3
  181. package/dist/tools/fs/safety.d.ts +41 -2
  182. package/dist/tools/fs/safety.js +12 -3
  183. package/dist/tools/fs/shell-read-check.d.ts +12 -3
  184. package/dist/tools/fs/shell-read-check.js +28 -15
  185. package/dist/tools/fs/shell-read-device.d.ts +1 -1
  186. package/dist/tools/fs/shell-read-judge.d.ts +9 -4
  187. package/dist/tools/fs/shell-read-judge.js +1 -1
  188. package/dist/tools/loop-tick.d.ts +2 -2
  189. package/package.json +3 -1
  190. package/test/export-surface.snapshot.json +39 -1
  191. package/wire-changes/core@7.50.0.json +1699 -0
  192. package/dist/core/runner/persisted-path-rows.d.ts +0 -88
  193. package/dist/core/runner/persisted-path-rows.js +0 -108
@@ -43,6 +43,40 @@ function fileKindFromStats(stats) {
43
43
  return undefined;
44
44
  }
45
45
  const HAS_POSIX_MODE_FACE = posixModeBitsMeaningful();
46
+ async function readAllFrom(handle, max, aborted) {
47
+ const overCap = (bytes) => new FileError("invalid", `The held file is over the ${max}-byte read cap (${bytes} bytes or more); it was not read`);
48
+ const readAt = async (into, offset, length, position) => {
49
+ const { bytesRead } = await handle.read(into, offset, length, position);
50
+ if (aborted())
51
+ throw new FileError("aborted", "Operation aborted");
52
+ return bytesRead;
53
+ };
54
+ const size = Number((await handle.stat()).size);
55
+ if (size > max)
56
+ throw overCap(size);
57
+ if (size > 0) {
58
+ const out = Buffer.allocUnsafe(size);
59
+ let at = 0;
60
+ while (at < size) {
61
+ const bytesRead = await readAt(out, at, size - at, at);
62
+ if (bytesRead === 0)
63
+ break;
64
+ at += bytesRead;
65
+ }
66
+ return out.subarray(0, at);
67
+ }
68
+ const scratch = Buffer.allocUnsafe(Math.min(1 << 16, max + 1));
69
+ const chunks = [];
70
+ for (let at = 0;;) {
71
+ const bytesRead = await readAt(scratch, 0, Math.min(scratch.length, max + 1 - at), at);
72
+ if (bytesRead === 0)
73
+ return Buffer.concat(chunks, at);
74
+ at += bytesRead;
75
+ if (at > max)
76
+ throw overCap(at);
77
+ chunks.push(Buffer.from(scratch.subarray(0, bytesRead)));
78
+ }
79
+ }
46
80
  function fileInfoFromStats(path, stats) {
47
81
  const kind = fileKindFromStats(stats);
48
82
  if (!kind) {
@@ -1031,6 +1065,97 @@ export class NodeExecutionEnv {
1031
1065
  return err(toFileError(error, resolved));
1032
1066
  }
1033
1067
  }
1068
+ async openBound(path, abortSignal) {
1069
+ const resolved = resolvePath(this.cwd, path);
1070
+ const aborted = abortResult(abortSignal, resolved);
1071
+ if (aborted)
1072
+ return aborted;
1073
+ let handle;
1074
+ try {
1075
+ handle = await open(resolved, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0));
1076
+ }
1077
+ catch (error) {
1078
+ if (isNodeError(error) && error.code === "ELOOP")
1079
+ return err(new FileError("precondition_failed", "The path is now a link, not the object that was checked", resolved));
1080
+ return err(toFileError(error, resolved));
1081
+ }
1082
+ const refuse = async (code, message) => {
1083
+ await handle.close().catch(() => { });
1084
+ return err(new FileError(code, message, resolved));
1085
+ };
1086
+ try {
1087
+ const held = await handle.stat({ bigint: true });
1088
+ if (!(await this.heldIsAt(handle, held, resolved)))
1089
+ return refuse("precondition_failed", "The path named another object than the one opened");
1090
+ if (!held.isFile() && !held.isDirectory())
1091
+ return refuse("invalid", "Neither a regular file nor a directory");
1092
+ const identity = `${held.dev}:${held.ino}`;
1093
+ const kind = held.isDirectory() ? "directory" : "file";
1094
+ return ok({
1095
+ identity,
1096
+ kind,
1097
+ size: async () => {
1098
+ try {
1099
+ return ok(Number((await handle.stat()).size));
1100
+ }
1101
+ catch (error) {
1102
+ return err(toFileError(error, resolved));
1103
+ }
1104
+ },
1105
+ readBytes: async (max, signal) => {
1106
+ if (kind !== "file")
1107
+ return err(new FileError("is_directory", "The held object is a directory", resolved));
1108
+ try {
1109
+ return ok(await readAllFrom(handle, max, () => abortResult(signal, resolved) !== undefined));
1110
+ }
1111
+ catch (error) {
1112
+ return err(toFileError(error, resolved));
1113
+ }
1114
+ },
1115
+ list: async (signal) => {
1116
+ if (kind !== "directory")
1117
+ return err(new FileError("not_directory", "The held object is a file", resolved));
1118
+ if (process.platform === "win32")
1119
+ return err(new FileError("not_supported", "This platform cannot list a held directory", resolved));
1120
+ try {
1121
+ return await this.listOpenDirectory(handle, resolved, identity, signal);
1122
+ }
1123
+ catch (error) {
1124
+ return err(toFileError(error, resolved));
1125
+ }
1126
+ },
1127
+ close: () => handle.close().catch(() => { }),
1128
+ });
1129
+ }
1130
+ catch (error) {
1131
+ return refuse(toFileError(error, resolved).code, error.message ?? "open failed");
1132
+ }
1133
+ }
1134
+ async heldIsAt(handle, held, resolved) {
1135
+ if (process.platform === "linux")
1136
+ return (await readlink(`/proc/self/fd/${handle.fd}`).catch(() => undefined)) === resolved;
1137
+ const named = await lstat(resolved, { bigint: true });
1138
+ return held.dev === named.dev && held.ino === named.ino && (await physicalPathOfAsync(resolved)) === resolved;
1139
+ }
1140
+ async listOpenDirectory(held, resolved, identity, abortSignal) {
1141
+ const throughHandle = process.platform === "linux";
1142
+ const listed = throughHandle ? `/proc/self/fd/${held.fd}` : resolved;
1143
+ const infos = [];
1144
+ for (const entry of await readdir(listed, { withFileTypes: true })) {
1145
+ const loopAbort = abortResult(abortSignal, resolved);
1146
+ if (loopAbort)
1147
+ return loopAbort;
1148
+ const info = fileInfoFromStats(resolve(resolved, entry.name), await lstat(join(listed, entry.name)));
1149
+ if (info.ok)
1150
+ infos.push(info.value);
1151
+ }
1152
+ if (!throughHandle) {
1153
+ const after = await stat(resolved, { bigint: true });
1154
+ if (`${after.dev}:${after.ino}` !== identity)
1155
+ return err(new FileError("precondition_failed", "The path named another directory by the time it was listed", resolved));
1156
+ }
1157
+ return ok(infos);
1158
+ }
1034
1159
  async readLink(path) {
1035
1160
  return readLinkTarget(resolvePath(this.cwd, path));
1036
1161
  }
@@ -1,4 +1,4 @@
1
- import type { ActorAssertion, AssistantMessage, ImageContent, Model, UserMessage } from "../llm/index.js";
1
+ import type { ActorAssertion, AssistantMessage, ImageContent, Model, TextContent, UserMessage, UserMessageAttachment } from "../llm/index.js";
2
2
  import { type ToolTurnRepair } from "../llm/index.js";
3
3
  import { type ExecutedToolCallOutcome } from "../loop/agent-loop.js";
4
4
  import type { HaltRemainingDirective } from "../loop/types.js";
@@ -38,6 +38,16 @@ export interface TrailingToolBatchOptions {
38
38
  * their frames are emitted and committed. Not called when a trailing-batch settlement ends the run first — the
39
39
  * caller then still owns whatever the prompt was carrying. */
40
40
  export type PromptDeliveredCallback = () => void;
41
+ /** An engine-minted message that TRAILS the prompt's human message in the same request (a user-attachment frame):
42
+ * minted from its content blocks, always an engine note, carrying its delivery record. */
43
+ export interface TrailingMessageSeed {
44
+ readonly content: ReadonlyArray<TextContent | ImageContent>;
45
+ readonly attachment: UserMessageAttachment;
46
+ }
47
+ /** `prompt()` option: the messages that follow the human message, in order (see {@link TrailingMessageSeed}). */
48
+ export interface PromptTrailing {
49
+ trailing?: readonly TrailingMessageSeed[];
50
+ }
41
51
  export interface UserMessageProvenance {
42
52
  /** Exact char length of the engine-prepended prefix on `text` (first-frame reminders etc.).
43
53
  * Sugar for the single segment `[0, chars)` — when `engineSegments` is also supplied, segments win. */
@@ -390,7 +400,7 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
390
400
  images?: ImageContent[];
391
401
  settleUnansweredToolCalls?: TrailingToolBatchOptions;
392
402
  onDelivered?: PromptDeliveredCallback;
393
- } & UserMessageProvenance): Promise<AssistantMessage | undefined>;
403
+ } & UserMessageProvenance & PromptTrailing): Promise<AssistantMessage | undefined>;
394
404
  /** R2-③: an empty/whitespace-only injection with no images carries ZERO information — it
395
405
  * must not mint a user frame (strict endpoints reject empty user content, and an empty follow-up would
396
406
  * pointlessly extend the run by one turn). No-op, not a throw: injection callers are fire-and-
@@ -1,4 +1,4 @@
1
- import { createAssistantMessageEventStream, ensureToolTurnInvariants, snapshotActorAssertion, stripEngineMetadata } from "../llm/index.js";
1
+ import { createAssistantMessageEventStream, ensureToolTurnInvariants, snapshotActorAssertion, stripEngineMetadata, userAttachmentOf } from "../llm/index.js";
2
2
  import { finalizeToolOutcome, runAgentLoop } from "../loop/agent-loop.js";
3
3
  import { resolveAgentCoreStreamFn } from "../loop/runtime-deps.js";
4
4
  import { normalizeEngineSegments } from "../../core/untrusted-text.js";
@@ -38,6 +38,9 @@ function createUserMessage(text, images, provenance) {
38
38
  : {}),
39
39
  };
40
40
  }
41
+ function createTrailingMessage(seed) {
42
+ return { role: "user", content: [...seed.content], timestamp: Date.now(), provenance: "engine-note", attachment: seed.attachment };
43
+ }
41
44
  const engineNotePayloads = new WeakMap();
42
45
  const engineAuthoredInjections = new WeakSet();
43
46
  const userInputParkRecords = new WeakMap();
@@ -826,6 +829,14 @@ export class AgentHarness {
826
829
  catch {
827
830
  }
828
831
  }
832
+ const attachment = entryId !== undefined ? userAttachmentOf(event.message) : undefined;
833
+ if (attachment !== undefined) {
834
+ try {
835
+ this.onFrameCommitted?.({ kind: "attachment", inputId: attachment.inputId, ordinal: attachment.ordinal }, entryId);
836
+ }
837
+ catch {
838
+ }
839
+ }
829
840
  }
830
841
  else if (event.message.isApiErrorMessage === true) {
831
842
  await this.recordApiFailure(event.message);
@@ -877,6 +888,7 @@ export class AgentHarness {
877
888
  async executeTurn(turnState, text, options, abortController) {
878
889
  let activeTurnState = turnState;
879
890
  const userMessage = createUserMessage(text, options?.images, options);
891
+ const trailingMessages = (options?.trailing ?? []).map(createTrailingMessage);
880
892
  this.runHistory = new WeakSet(turnState.messages.filter((m) => m.role === "assistant"));
881
893
  const beforeResult = await this.emitHook({
882
894
  type: "before_agent_start",
@@ -886,7 +898,7 @@ export class AgentHarness {
886
898
  resources: turnState.resources,
887
899
  });
888
900
  const takePrompts = async () => {
889
- let messages = [userMessage];
901
+ let messages = [userMessage, ...trailingMessages];
890
902
  if (this.nextTurnQueue.length > 0) {
891
903
  const queuedMessages = this.nextTurnQueue.splice(0);
892
904
  try {
@@ -907,7 +919,7 @@ export class AgentHarness {
907
919
  }
908
920
  engineNotePayloads.delete(m);
909
921
  }
910
- messages = [...queuedMessages, messages[0]];
922
+ messages = [...queuedMessages, ...messages];
911
923
  }
912
924
  if (beforeResult?.messages) {
913
925
  messages = [...messages, ...beforeResult.messages];
@@ -271,6 +271,22 @@ export interface FileInfo {
271
271
  */
272
272
  mode?: number;
273
273
  }
274
+ /** A filesystem object held open by {@link FileSystem.openBound}: every answer is about THIS object, whatever the path
275
+ * names later. `list` reads a directory's entries through the held object where the backend can; where it cannot, it
276
+ * lists the path once and requires the path to name the held object afterwards (the implementation says where). */
277
+ export interface BoundFileObject {
278
+ /** `<device>:<inode>` of the held object. */
279
+ readonly identity: string;
280
+ readonly kind: "file" | "directory";
281
+ /** The held object's current size in bytes. */
282
+ size(): Promise<Result<number, FileError>>;
283
+ /** The held file's whole content, never more than `max` bytes: a file over `max` when the read starts, or a stream that
284
+ * passes it while read, is refused (`invalid`) without holding more than `max` of it. */
285
+ readBytes(max: number, abortSignal?: AbortSignal): Promise<Result<Uint8Array, FileError>>;
286
+ /** The held directory's direct children (links not followed). */
287
+ list(abortSignal?: AbortSignal): Promise<Result<FileInfo[], FileError>>;
288
+ close(): Promise<void>;
289
+ }
274
290
  /**
275
291
  * @contract fs.canonical_chain.leaf_hops_only — `hops` lists, in order, the target each link on the LEAF chain writes
276
292
  * ({@link FileSystem.canonicalChain}): a relative target anchored, unfolded, at its own link's directory (`..` is the
@@ -406,6 +422,11 @@ export interface FileSystem {
406
422
  /** OPTIONAL: the identity of the object `path` names, links followed (`<device>:<inode>` on POSIX, exact): equal answers name one object, where
407
423
  * a firmlink or bind mount keeps its own {@link canonicalPath}. Home-anchored deny rows are placed by it; omitted ⇒ by spelling only. */
408
424
  fileIdentity?(path: string, abortSignal?: AbortSignal): Promise<Result<string, FileError>>;
425
+ /** OPTIONAL: open the file or directory at a canonical `path` and HOLD it ({@link BoundFileObject}): the leaf link is not
426
+ * followed, and the path must still name that object, through no link, right after the open (else `precondition_failed`).
427
+ * A caller judges the held object and then reads, sizes or lists that same object; it closes it. Omitted ⇒ a caller that
428
+ * must bind its read to what it judged does not read. */
429
+ openBound?(path: string, abortSignal?: AbortSignal): Promise<Result<BoundFileObject, FileError>>;
409
430
  /** Return false for missing paths. Other errors, such as permission failures, return a {@link FileError}. */
410
431
  exists(path: string, abortSignal?: AbortSignal): Promise<Result<boolean, FileError>>;
411
432
  /** Create a directory. Defaults: `recursive: true`, no abort signal. */
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The one text rendering of a content block, for every model-facing reader that shows a block as text: a text block is
3
+ * its own text; any other block is its marker — `[image: image/png]`, `[document: application/pdf]`, `[<type>]` — never
4
+ * its payload. Readers: the `tool_end.output` projection's cut block, the observer digest, the sub-agent step outcome,
5
+ * the auto-mode classifier window and the user-attachment view. Two readers omit non-text blocks instead of showing them
6
+ * (no second rendering): the compaction summarizer's message flatten and the host-facing post-tool-batch digest.
7
+ * A leaf module (no imports); consumers outside `src/engine` reach it through the `src/internal/llm.ts` facade.
8
+ */
9
+ /** A text block: `{ type: "text", text: string }`. */
10
+ export declare const isTextBlock: (b: unknown) => b is {
11
+ type: "text";
12
+ text: string;
13
+ };
14
+ /** The block as text: a text block's text, any other block's marker. */
15
+ export declare const renderContentBlock: (b: unknown) => string;
@@ -0,0 +1,10 @@
1
+ export const isTextBlock = (b) => {
2
+ const block = b;
3
+ return block?.type === "text" && typeof block.text === "string";
4
+ };
5
+ export const renderContentBlock = (b) => {
6
+ if (isTextBlock(b))
7
+ return b.text;
8
+ const block = b;
9
+ return `[${typeof block?.type === "string" ? block.type : "block"}${typeof block?.mimeType === "string" ? `: ${block.mimeType}` : ""}]`;
10
+ };
@@ -10,3 +10,4 @@ export * from "./diagnostics.js";
10
10
  export * from "./event-stream.js";
11
11
  export * from "./validation.js";
12
12
  export * from "./tool-turns.js";
13
+ export * from "./content-block-render.js";
@@ -3,3 +3,4 @@ export * from "./diagnostics.js";
3
3
  export * from "./event-stream.js";
4
4
  export * from "./validation.js";
5
5
  export * from "./tool-turns.js";
6
+ export * from "./content-block-render.js";
@@ -386,7 +386,83 @@ export interface UserMessage {
386
386
  * old-session-verbatim posture as the engine-provenance fields above.
387
387
  */
388
388
  actor?: ActorAssertion;
389
+ /**
390
+ * The DELIVERY RECORD of a user-attachment frame: this message is the engine-minted frame carrying one attachment
391
+ * the user declared on the human message it follows (it always rides with `provenance:"engine-note"`). The one
392
+ * source of "what was delivered": read-state commit and rebuild, the `human_input` projection, the receipt, the
393
+ * derived views, compaction cut points and `resumeAt` read this record, never the frame's text. Metadata only —
394
+ * never sent to a provider (brains rebuild wire messages field by field; {@link stripEngineMetadata} strips it for a
395
+ * custom Brain); the session import door strips it (an imported frame is an ordinary engine note).
396
+ */
397
+ attachment?: UserMessageAttachment;
398
+ }
399
+ /** What the engine found an attachment to be: the four Read lanes, a directory, or bytes the host supplied. */
400
+ export type UserAttachmentKind = "text" | "notebook" | "image" | "pdf" | "directory" | "client_text" | "client_image";
401
+ /** Who held the bytes: the engine read a path in its workspace, or the host supplied text / an image. */
402
+ export type UserAttachmentSupply = "path" | "content_text" | "content_image";
403
+ /** What reached the model of the attachment's contents (the Read layer's outcome words). */
404
+ export type UserAttachmentOutcome = "attached" | "partial" | "unchanged" | "not_attached";
405
+ /** The read-state entry a path attachment's delivery committed (the Read layer's observation, verbatim). */
406
+ export interface UserAttachmentObservation {
407
+ readonly key: string;
408
+ readonly entry: {
409
+ readonly hash: string;
410
+ readonly totalLines: number;
411
+ readonly truncated: boolean;
412
+ readonly isPartialView?: boolean;
413
+ readonly view?: {
414
+ readonly start: number;
415
+ readonly end: number;
416
+ };
417
+ };
418
+ }
419
+ /** See {@link UserMessage.attachment}. */
420
+ export interface UserMessageAttachment {
421
+ /** The human input the attachment was declared on (its `human_input` event's `inputId`). */
422
+ readonly inputId: string;
423
+ /** 1-based position among that input's declared attachments, and how many it declared. */
424
+ readonly ordinal: number;
425
+ readonly count: number;
426
+ /** Absent when the read was refused before the kind was known (never guessed from a name). */
427
+ readonly kind?: UserAttachmentKind;
428
+ readonly supply: UserAttachmentSupply;
429
+ readonly outcome: UserAttachmentOutcome;
430
+ /** The path or name the frame's data region shows — the frame text and every projection render this value. */
431
+ readonly label: string;
432
+ /** Present on a path attachment whose delivery recorded read state. */
433
+ readonly observation?: UserAttachmentObservation;
434
+ /** `[start, end)` indices into the message's `content` of the data the attachment delivered (the file's own blocks,
435
+ * or the engine's refusal sentence); the engine's marked sentences and the label line sit outside it. */
436
+ readonly dataBlocks: {
437
+ readonly start: number;
438
+ readonly end: number;
439
+ };
440
+ /** The kinds of the engine's notes about this delivery, in order (each rendered as a marked sentence). */
441
+ readonly notes: readonly string[];
442
+ /** Characters of text data delivered. */
443
+ readonly chars: number;
444
+ /** The data is not the whole file: a partial view, or a line range. */
445
+ readonly truncated: boolean;
389
446
  }
447
+ /** Code points that would let a name break the line it is written on, or hide in it: C0/C1 controls, format
448
+ * characters, and the line / paragraph separators. */
449
+ export declare const DATA_LABEL_UNSAFE: RegExp;
450
+ /**
451
+ * A data label (a path, a file name) as a JSON string literal with every C0/C1 control, format character and line /
452
+ * paragraph separator written as `\uXXXX` — lossless (JSON.parse gives the original back), and one line whatever the
453
+ * name holds. JSON's own escaping alone leaves U+2028 / U+2029 / U+0085 and the format characters raw.
454
+ */
455
+ export declare function quoteDataLabel(label: string): string;
456
+ /** The record a user message carries, when it is a well-formed attachment frame; otherwise `undefined` (a malformed
457
+ * record reads as none — the message is then an ordinary engine note, the conservative direction). */
458
+ export declare function userAttachmentOf(m: unknown): UserMessageAttachment | undefined;
459
+ /**
460
+ * A derived view's rendering of one attachment frame (the compaction summarizer's input and the auto-mode classifier's
461
+ * window read this one function): a header line naming the attachment from its record, then the delivered data — never
462
+ * the frame's marked sentences, and never under the user's authority. `cap` bounds the data excerpt; the header states
463
+ * the cut, so the excerpt itself is the data's own characters.
464
+ */
465
+ export declare function renderUserAttachmentView(m: UserMessage, a: UserMessageAttachment, cap?: number): string;
390
466
  /** A cut turn's output-cap facts: the lane's own cap stop fired, the output the provider counted, the cap the request
391
467
  * carried. The cap cut the call when `capStop` or `outputTokens >= capTokens`. */
392
468
  export interface OutputLimit {
@@ -533,7 +609,7 @@ export interface AssistantMessage {
533
609
  * final content instead of failing the turn (CC 198 queryModelStreaming parity: avoid re-billing +
534
610
  * keep the displayed content consistent with the result). `stopReason` is synthesized from the
535
611
  * content ("toolUse" when a completed tool call streamed, else "stop"); `errorMessage` carries the
536
- * CC-verbatim warning ("Response stalled mid-stream." / "Connection closed mid-response."), visible
612
+ * warning in CC 2.1.220's words ("Response stalled mid-stream." / "Connection closed mid-response."; gone from 2.1.245 on), visible
537
613
  * to the model in the transcript. Downstream semantics (agent-loop): `partialFinalized &&
538
614
  * stopReason==="stop"` gets a BOUNDED continue nudge (an unattended run must not book the cut as an
539
615
  * incomplete success); `partialFinalized && stopReason==="toolUse"` executes normally (a truncated
@@ -585,10 +661,10 @@ export interface ToolResultMessage<TDetails = unknown> {
585
661
  export type Message = UserMessage | AssistantMessage | ToolResultMessage;
586
662
  /**
587
663
  * RB-3 (stage S4 carry): strip the engine-provenance metadata fields from user messages before
588
- * serializing a Context to an external wire. The six fields (`enginePrefixChars`/`engineSegments`/
589
- * `engineMinted`/`provenance`/`actor`/`engineNoteKey`) are INTERNAL coordination between the engine's
664
+ * serializing a Context to an external wire. The seven fields (`enginePrefixChars`/`engineSegments`/
665
+ * `engineMinted`/`provenance`/`actor`/`engineNoteKey`/`attachment`) are INTERNAL coordination between the engine's
590
666
  * minting side and its consumers (permission classifier, compaction summarizer, prompt suggestions,
591
- * multiplayer attribution) — they must never reach a provider payload. The built-in brains construct
667
+ * multiplayer attribution, attachment delivery) — they must never reach a provider payload. The built-in brains construct
592
668
  * their own wire shapes and are immune; a CUSTOM Brain that whole-object-serializes messages
593
669
  * (`JSON.stringify(context.messages)`) would leak them — run the array through this projection first.
594
670
  */
@@ -1,3 +1,4 @@
1
+ import { renderContentBlock } from "./content-block-render.js";
1
2
  export function snapshotActorAssertion(actor) {
2
3
  return {
3
4
  id: actor.id,
@@ -5,11 +6,52 @@ export function snapshotActorAssertion(actor) {
5
6
  ...(actor.issuer !== undefined ? { issuer: actor.issuer } : {}),
6
7
  };
7
8
  }
9
+ export const DATA_LABEL_UNSAFE = /[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u;
10
+ export function quoteDataLabel(label) {
11
+ let out = "";
12
+ for (const ch of JSON.stringify(label)) {
13
+ out += DATA_LABEL_UNSAFE.test(ch) ? `\\u${ch.codePointAt(0).toString(16).padStart(4, "0")}` : ch;
14
+ }
15
+ return out;
16
+ }
17
+ export function userAttachmentOf(m) {
18
+ if (m === null || typeof m !== "object" || m.role !== "user")
19
+ return undefined;
20
+ const a = m.attachment;
21
+ if (a === null || typeof a !== "object")
22
+ return undefined;
23
+ const content = m.content;
24
+ const blocks = Array.isArray(content) ? content.length : 0;
25
+ const db = a.dataBlocks;
26
+ const wellFormed = typeof a.inputId === "string" &&
27
+ typeof a.label === "string" &&
28
+ typeof a.outcome === "string" &&
29
+ Number.isInteger(a.ordinal) &&
30
+ Number.isInteger(a.count) &&
31
+ a.ordinal >= 1 &&
32
+ a.ordinal <= a.count &&
33
+ db !== undefined &&
34
+ Number.isInteger(db.start) &&
35
+ Number.isInteger(db.end) &&
36
+ db.start >= 0 &&
37
+ db.start <= db.end &&
38
+ db.end <= blocks;
39
+ return wellFormed ? a : undefined;
40
+ }
41
+ export function renderUserAttachmentView(m, a, cap) {
42
+ const blocks = Array.isArray(m.content) ? m.content.slice(a.dataBlocks.start, a.dataBlocks.end) : [];
43
+ const data = blocks.map(renderContentBlock).join("\n");
44
+ const cut = cap !== undefined && data.length > cap;
45
+ const facts = [a.kind ?? "kind unknown", a.outcome, ...(a.truncated ? ["not the whole file"] : []), ...(cut ? [`excerpt: first ${cap} of ${data.length} characters`] : [])];
46
+ const head = `user attachment ${a.ordinal} of ${a.count} (${facts.join("; ")}): ${quoteDataLabel(a.label)}`;
47
+ const body = cut ? data.slice(0, cap) : data;
48
+ return body.length > 0 ? `${head}\n${body}` : head;
49
+ }
8
50
  export function stripEngineMetadata(messages) {
9
51
  return messages.map((m) => {
10
52
  if (m.role !== "user")
11
53
  return m;
12
- const { enginePrefixChars: _a, engineSegments: _b, engineMinted: _c, provenance: _d, actor: _e, engineNoteKey: _f, ...rest } = m;
54
+ const { enginePrefixChars: _a, engineSegments: _b, engineMinted: _c, provenance: _d, actor: _e, engineNoteKey: _f, attachment: _g, ...rest } = m;
13
55
  return rest;
14
56
  });
15
57
  }
@@ -289,6 +289,8 @@ function normalizeEngineProvenanceStamp(message, preserveActorAssertions = false
289
289
  delete m.actor;
290
290
  }
291
291
  }
292
+ if (m.attachment !== undefined)
293
+ delete m.attachment;
292
294
  if (m.engineMinted !== undefined && m.engineMinted !== true)
293
295
  delete m.engineMinted;
294
296
  if (m.provenance !== undefined && m.provenance !== "engine-note")
package/dist/index.d.ts CHANGED
@@ -99,7 +99,7 @@ export { isSecretEnvKey, scrubSecretEnv } from "./core/secret-env.js";
99
99
  export type { SecretEnvFinding, SecretEnvFindingKind } from "./core/secret-env.js";
100
100
  export { MAX_EXEC_OUTPUT_BYTES, RollingTailBuffer, markTruncated } from "./core/exec-output-tail.js";
101
101
  export { physicalPathOf, physicalPathOfExisting } from "./core/physical-path.js";
102
- export type { ExecutionEnv, FileInfo, Result, FileErrorCode, ExecutionErrorCode, WriteExpectation, WriteReceipt, SymlinkChain } from "./internal/harness.js";
102
+ export type { ExecutionEnv, FileInfo, Result, FileErrorCode, ExecutionErrorCode, WriteExpectation, WriteReceipt, SymlinkChain, BoundFileObject } from "./internal/harness.js";
103
103
  export type { ExecResult } from "./internal/harness.js";
104
104
  export { RemoteExecutionError, hasDestroy, isRemoteExecutionEnv, isSuspendable, isIsolated, canonicalPathIsAuthoritative, missingRestoreSurface, isRetryableRemoteErrorCode, RETRYABLE_REMOTE_ERROR_CODES, } from "./core/remote-env.js";
105
105
  export { withRetry } from "./core/with-retry.js";
@@ -172,6 +172,8 @@ export { probeParkRoundTrip, durableParkGapOf, durableParkGapFor, PARK_SELFCHECK
172
172
  export { type StoreDurability } from "./core/checkpoint-store.js";
173
173
  export { type StoreFidelity } from "./core/checkpoint-store.js";
174
174
  export { projectHumanInput, buildHumanInputEvent, type HumanInputSource, type HumanInputFrame, type HumanInputEvent, type HumanInputDelivery, } from "./core/human-input-projection.js";
175
+ export { USER_ATTACHMENT_SEAT, USER_ATTACHMENT_KINDS, USER_ATTACHMENT_SUPPLIES, USER_ATTACHMENT_OUTCOMES, USER_ATTACHMENTS_MAX, USER_ATTACHMENT_LABEL_MAX, type UserAttachmentDeclaration, } from "./core/user-attachment.js";
176
+ export type { HumanInputAttachment } from "./core/types.js";
175
177
  export { TaskRegistry, defaultTaskRegistry, createTaskOutputTool, createTaskStopTool, type SemaTaskType, type SemaTaskStatus, type SemaTaskHandle, type ParkedClaimTicket, type TaskAccess, type UnifiedTaskOutput, type TaskRetrievalStatus, type StopSource, type RegisterMonitorInput, type MonitorTimers, MONITOR_BATCH_WINDOW_MS, MONITOR_DEFAULT_TIMEOUT_MS, MONITOR_MAX_TIMEOUT_MS, MONITOR_MAX_BATCHES_PER_MINUTE, canAccessWorkflowRun, DURABLE_AGENT_HANDLE_RE, type BackgroundShellHardKillReceipt, } from "./core/task-registry.js";
176
178
  export { InMemoryMailboxStore, type MailboxStore, type MailboxMessage, type MailboxLease, MailboxStoreError, type MailboxStoreErrorCode, MAILBOX_TOMBSTONED_RECIPIENT_CODE, type MailboxAppendMessage, type MailboxPeerMeta, type MailboxPeerFromMode, type MailboxPeerRecordKind, type MailboxPeerNoticeMeta, type MailboxPeerNoticeState, MAILBOX_PEER_NOTICE_STATES, MAILBOX_PEER_FROM_MODES, MAILBOX_PEER_RECORD_KINDS, MAILBOX_INVALID_PEER_META_CODE, MAILBOX_CROSS_PROCESS_UNSAFE_CODE, readMailboxPeerMeta, mailboxCrossProcessMountVerdict, type MailboxCrossProcessVerdict, type MailboxAckResult, } from "./core/mailbox-store.js";
177
179
  export { FileMailboxStore, type FileMailboxStoreOptions } from "./stores/file/mailbox-store.js";
@@ -253,7 +255,7 @@ export { adoptLocalDataRoot, ackAdoptionConfig, witnessAdoptionConfig, listAdopt
253
255
  export { formatHookFeedback, runToolGate, createHookEnvCapabilities, createPreToolUseConstraintPolicy, type PersistedRuleHit, type PersistedRuleHitRule, type PersistedRuleUnreadable, type PersistedRuleCoverage, type PersistedRuleAnswer, normalizePersistedRuleHit, type Hooks, type HookToolContext, type HookInvocationIdentity, type UserPromptSubmitContext, type PostToolBatchContext, type HookEnvCapabilities, type HookToolOutput, type PreToolUseResult, type PostToolUseResult, type UserPromptSubmitResult, type HookToolFailure, type PostToolUseFailureResult, type PostToolBatchCall, type PostToolBatchResult, type PreCompactContext, type PreCompactResult, type PostCompactContext, type StopFailureContext, type PermissionDeniedPayload, } from "./core/hooks.js";
254
256
  export { HOOK_FAMILIES, HOOKS_INVALID_CODE, type HookFamily, type WiringManifestHookEntry } from "./core/hook-seats.js";
255
257
  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";
256
- 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 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, archiveDistillerPlan, readConsolidationDriverRun, runMemoryConsolidationDriver, type ConsolidationDriverEngine, type ConsolidationDriverRunRow, type ConsolidationRunReceipt, type ConsolidationRunStopReason, 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";
258
+ 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";
257
259
  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";
258
260
  export { reanchorMemoryStoreRoot, type StoreRootReanchor } from "./core/memory-engine/layout.js";
259
261
  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";
@@ -376,8 +378,8 @@ export type { RouteAdjudication, RouteCredential, RouteCredentialSource, RoutePa
376
378
  export { ROUTE_ADJUDICATION_CONFORMANCE_CORPUS, type RouteAdjudicationVector } from "./brain/route-conformance.js";
377
379
  export { type BrainTimeoutConfig } from "./brain/timeout.js";
378
380
  export { createAssistantMessageEventStream } from "./internal/llm.js";
379
- export type { AssistantMessage, AssistantMessageEvent, CompleteSimpleFn, Context, DocumentContent, ImageContent, Message, StopReason, StreamFn, TextContent, ThinkingContent, ToolCall, ToolResultMessage, Usage, UserMessage, } from "./internal/llm.js";
380
- export type { AgentDefinition, BeforeWriteHook, BeforeWriteRequest, BeforeWriteResult, TrackFileEditHook, TrackEditRequest, TrackEditResult, FileEditedHook, FileEditedNotice, HandsBandOptions, Brain, BrainStatus, BrainStatusPhase, BrainRetryErrClass, ImageInput, McpElicitRequest, McpElicitResponse, McpServerSpec, A2aServerSpec, OnElicit, Model, ModelRef, ProjectMemoryLoad, RunnerDeps, ResumePreflightInfo, ResumePreflightVerdict, EngineNotice, RuntimeCaps, BackgroundChildEvent, DelegationLifecycleEvent, SkillSpec, TaskEvent, TaskEventIdentity, ToolActivity, TaskLimits, StaleToolResultOffloadOptions, TaskResult, TerminalCause, PausedCause, EffectiveMemoryScopes, RemoteEnvFailureNote, TaskSpec, ShellGateDoctrine, TaskStatus, TaskStream, CompactOutcome, ThinkingLevel, ToolExecuteContext, ToolReturn, ToolSpec, ToolInputVerdict, ToolInputValidationContext, ReversibilityVerdict, ReadRootGrantCandidate, ToolEffect, ToolContentOrigin, WorkflowGovernanceBaseline, DelegationTaskType, } from "./core/types.js";
381
+ export type { AssistantMessage, AssistantMessageEvent, CompleteSimpleFn, Context, DocumentContent, ImageContent, Message, StopReason, StreamFn, TextContent, ThinkingContent, ToolCall, ToolResultMessage, Usage, UserMessage, UserMessageAttachment, UserAttachmentKind, UserAttachmentObservation, UserAttachmentOutcome, UserAttachmentSupply, } from "./internal/llm.js";
382
+ export type { AgentDefinition, BeforeWriteHook, BeforeWriteRequest, BeforeWriteResult, TrackFileEditHook, TrackEditRequest, TrackEditResult, FileEditedHook, FileEditedNotice, HandsBandOptions, Brain, BrainStatus, BrainStatusPhase, BrainRetryErrClass, ImageInput, UserAttachment, McpElicitRequest, McpElicitResponse, McpServerSpec, A2aServerSpec, OnElicit, Model, ModelRef, ProjectMemoryLoad, RunnerDeps, ResumePreflightInfo, ResumePreflightVerdict, EngineNotice, RuntimeCaps, BackgroundChildEvent, DelegationLifecycleEvent, SkillSpec, TaskEvent, TaskEventIdentity, ToolActivity, TaskLimits, StaleToolResultOffloadOptions, TaskResult, TerminalCause, PausedCause, EffectiveMemoryScopes, RemoteEnvFailureNote, TaskSpec, ShellGateDoctrine, TaskStatus, TaskStream, CompactOutcome, ThinkingLevel, ToolExecuteContext, ToolReturn, ToolSpec, ToolInputVerdict, ToolInputValidationContext, ReversibilityVerdict, ReadRootGrantCandidate, ToolEffect, ToolContentOrigin, WorkflowGovernanceBaseline, DelegationTaskType, } from "./core/types.js";
381
383
  export { Type } from "typebox";
382
384
  export type { TSchema, Static } from "typebox";
383
385
  export { explainPromptAssembly, describeDefaultPack, type DefaultPackDescription, type ExplainInput } from "./prompt-assembly/explain.js";
package/dist/index.js CHANGED
@@ -144,6 +144,7 @@ export { probeParkRoundTrip, durableParkGapOf, durableParkGapFor, PARK_SELFCHECK
144
144
  export {} from "./core/checkpoint-store.js";
145
145
  export {} from "./core/checkpoint-store.js";
146
146
  export { projectHumanInput, buildHumanInputEvent, } from "./core/human-input-projection.js";
147
+ export { USER_ATTACHMENT_SEAT, USER_ATTACHMENT_KINDS, USER_ATTACHMENT_SUPPLIES, USER_ATTACHMENT_OUTCOMES, USER_ATTACHMENTS_MAX, USER_ATTACHMENT_LABEL_MAX, } from "./core/user-attachment.js";
147
148
  export { TaskRegistry, defaultTaskRegistry, createTaskOutputTool, createTaskStopTool, MONITOR_BATCH_WINDOW_MS, MONITOR_DEFAULT_TIMEOUT_MS, MONITOR_MAX_TIMEOUT_MS, MONITOR_MAX_BATCHES_PER_MINUTE, canAccessWorkflowRun, DURABLE_AGENT_HANDLE_RE, } from "./core/task-registry.js";
148
149
  export { InMemoryMailboxStore, MailboxStoreError, MAILBOX_TOMBSTONED_RECIPIENT_CODE, MAILBOX_PEER_NOTICE_STATES, MAILBOX_PEER_FROM_MODES, MAILBOX_PEER_RECORD_KINDS, MAILBOX_INVALID_PEER_META_CODE, MAILBOX_CROSS_PROCESS_UNSAFE_CODE, readMailboxPeerMeta, mailboxCrossProcessMountVerdict, } from "./core/mailbox-store.js";
149
150
  export { FileMailboxStore } from "./stores/file/mailbox-store.js";
@@ -199,7 +200,7 @@ export { adoptLocalDataRoot, ackAdoptionConfig, witnessAdoptionConfig, listAdopt
199
200
  export { formatHookFeedback, runToolGate, createHookEnvCapabilities, createPreToolUseConstraintPolicy, normalizePersistedRuleHit, } from "./core/hooks.js";
200
201
  export { HOOK_FAMILIES, HOOKS_INVALID_CODE } from "./core/hook-seats.js";
201
202
  export { InMemoryMemoryStore, composeMemoryBlock, composeLayeredMemoryBlock, normalizeMemorySpec, supportsConsolidation, supportsPeriodicConsolidation, firstSentence, expandLexicalTerms, lexicalSearchMatch, classifyPromotable, enforcePromotableWriteGate, guardedMemoryStore, MemoryGateError, MemoryProjectionError, detectSecret, enforceSecretWriteGate, enforceStructuredNoteSecretGate, MEMORY_PROJECT_KEY_ABSENT_REASONS, } from "./core/memory.js";
202
- export { MemoryEngine, FileMemoryEngineBackend, memoryBackendContract, assertMemoryBackendSearchEquivalence, buildMemoryInstruction, writableRootOf, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, deriveRepoControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, MEMORY_ORIGIN_CAUSES, committedOriginOf, originEquals, consolidationExposedFrontmatter, ambiguousOriginRepresentation, committedDistilledOf, distilledEquals, CONSOLIDATION_DEFAULTS, ConsolidationRefusedError, MEMORY_SEARCH_SUPERSEDED_TAG, consolidationTypeEligible, deriveSupersededSet, memorySupersededNote, readIntentCredentials, supersessionFuseCeiling, deriveShadowedSet, memoryConsolidationRecommendedNotice, memoryConsolidationCommittedNotice, memoryConsolidationConflictNotice, memoryConsolidationIncompleteNotice, memoryConsolidationRefusedNotice, memoryConsolidationWithheldNotice, 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, openAiCompatChatSeat, parseJsonAnswer, planParseRepairs, sanitizeLlmGroups, scheduleUnderFuse, CONSOLIDATION_DRIVER_PLANS_DIR, CONSOLIDATION_DRIVER_RUNS_FILE, CONSOLIDATION_RUN_STOP_REASONS, archiveDistillerPlan, readConsolidationDriverRun, runMemoryConsolidationDriver, isInstructionEntry, 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, readV2HeaderHints, LINEAGE_FILE, CHALLENGES_FILE, CHALLENGED_HISTORY_FILE, CHALLENGE_LEDGER_MAX_EVENTS, rebuildStrictControlPlaneLedger, 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, MEMORY_EXPOSURE_BANNER, MEMORY_EXPOSURE_HANDLE_TAG, memoryExposureIndexRow, 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, erasureSelectHash, computeMemoryBundleHash, SCOPE_SEGMENT_MAX_ENCODED, PROJECT_MARKER_PATH, encodeScopeSegment, decodeScopeSegment, parseScopeKey, formatUserScope, formatOrgScope, formatProjScope, formatUserProjScope, isPersonalScope, isOrgScopeKey, assertScopeContractPlacement, formatProjectMarker, parseProjectMarker, resolveProjectId, PROJECT_ID_REGEX, migrateScope, materializeEntriesToFiles, harvestFilesToPatches, projectionsToWriteBack, screenInboundEntries, REMOTE_HARVEST_PER_FILE_BYTES, REMOTE_MASS_DELETION_FUSE_RATIO, deriveProjectMemoryDir, deriveProjectControlDir, recordProjectIdHint, lookupProjectIdHint, PROJECT_ID_HINTS_FILE, reconcileMemoryEntries, nextSyncBaseline, mergeRecallHits, syncMemoryScope, } from "./core/memory-engine/index.js";
203
+ export { MemoryEngine, FileMemoryEngineBackend, memoryBackendContract, assertMemoryBackendSearchEquivalence, buildMemoryInstruction, writableRootOf, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, deriveRepoControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, MEMORY_ORIGIN_CAUSES, committedOriginOf, originEquals, consolidationExposedFrontmatter, ambiguousOriginRepresentation, committedDistilledOf, distilledEquals, CONSOLIDATION_DEFAULTS, ConsolidationRefusedError, MEMORY_SEARCH_SUPERSEDED_TAG, consolidationTypeEligible, deriveSupersededSet, memorySupersededNote, readIntentCredentials, supersessionFuseCeiling, deriveShadowedSet, memoryConsolidationRecommendedNotice, memoryConsolidationCommittedNotice, memoryConsolidationConflictNotice, memoryConsolidationIncompleteNotice, memoryConsolidationRefusedNotice, memoryConsolidationWithheldNotice, 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, openAiCompatChatSeat, parseJsonAnswer, planParseRepairs, sanitizeLlmGroups, scheduleUnderFuse, CONSOLIDATION_DRIVER_PLANS_DIR, CONSOLIDATION_DRIVER_RUNS_FILE, CONSOLIDATION_RUN_STOP_REASONS, CONSOLIDATION_WRITE_REFUSED_CODE, archiveDistillerPlan, readConsolidationDriverRun, runMemoryConsolidationDriver, isInstructionEntry, 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, readV2HeaderHints, LINEAGE_FILE, CHALLENGES_FILE, CHALLENGED_HISTORY_FILE, CHALLENGE_LEDGER_MAX_EVENTS, rebuildStrictControlPlaneLedger, 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, MEMORY_EXPOSURE_BANNER, MEMORY_EXPOSURE_HANDLE_TAG, memoryExposureIndexRow, 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, erasureSelectHash, computeMemoryBundleHash, SCOPE_SEGMENT_MAX_ENCODED, PROJECT_MARKER_PATH, encodeScopeSegment, decodeScopeSegment, parseScopeKey, formatUserScope, formatOrgScope, formatProjScope, formatUserProjScope, isPersonalScope, isOrgScopeKey, assertScopeContractPlacement, formatProjectMarker, parseProjectMarker, resolveProjectId, PROJECT_ID_REGEX, migrateScope, materializeEntriesToFiles, harvestFilesToPatches, projectionsToWriteBack, screenInboundEntries, REMOTE_HARVEST_PER_FILE_BYTES, REMOTE_MASS_DELETION_FUSE_RATIO, deriveProjectMemoryDir, deriveProjectControlDir, recordProjectIdHint, lookupProjectIdHint, PROJECT_ID_HINTS_FILE, reconcileMemoryEntries, nextSyncBaseline, mergeRecallHits, syncMemoryScope, } from "./core/memory-engine/index.js";
203
204
  export { STORE_FORM_REFUSAL_CODES, TARGET_OUTSIDE_STORE, SCOPE_HOME_NOT_DIRECTORY, SCOPE_HOME_FORMS } from "./core/memory-engine/layout.js";
204
205
  export { reanchorMemoryStoreRoot } from "./core/memory-engine/layout.js";
205
206
  export { SHARED_MEMORY_READ_CAP_BYTES, SHARED_MEMORY_LIST_PAGE_SIZE, SharedMemoryStoreError, } from "./core/shared-memory/types.js";
@@ -8,7 +8,7 @@ export type { CompactionPreparation, SummarizationClampDryRun } from "../engine/
8
8
  export type { InvokedSkillRetention } from "../engine/compaction/utils.js";
9
9
  export type { AgentCoreRuntimeDeps } from "../engine/loop/runtime-deps.js";
10
10
  export type { AgentMessage, AgentTool, AgentToolResult, AgentToolUpdateCallback, ThinkingLevel, ToolExecutionMode, ToolInputValidationContext, ToolInputVerdict, } from "../engine/loop/types.js";
11
- export type { AgentHarnessEvent, CompactionSettings, ExecutionEnv, ExecutionErrorCode, FileError, FileKind, FileErrorCode, FileInfo, Result, WriteExpectation, WriteReceipt, SymlinkChain, Session, SessionMetadata, SessionRepo, SessionStorage, SessionTreeEntry, Skill, } from "../engine/harness/types.js";
11
+ export type { AgentHarnessEvent, CompactionSettings, ExecutionEnv, ExecutionErrorCode, FileError, FileKind, FileErrorCode, FileInfo, Result, WriteExpectation, WriteReceipt, SymlinkChain, BoundFileObject, Session, SessionMetadata, SessionRepo, SessionStorage, SessionTreeEntry, Skill, } from "../engine/harness/types.js";
12
12
  export type { ExecutionEnvExecOptions, ExecResult } from "../engine/harness/types.js";
13
13
  export type { SessionWriteOptions, CompactionEntry } from "../engine/harness/types.js";
14
14
  export type { ActiveWorktreeSession, WorkspaceState } from "../engine/harness/types.js";
@@ -4,5 +4,5 @@
4
4
  * design/118 ①②: the layer is now first-party (`src/engine/llm/`, naturalized out of the vendored
5
5
  * llm-core); the facade stays so consumers never notice which side a symbol lives on.
6
6
  */
7
- export { createAssistantMessageEventStream, ensureToolTurnInvariants, MODEL_OUTPUT_INVALID_CAUSES, snapshotActorAssertion, stampStreamDrops, streamDropsOf, stripEngineMetadata, TOOL_TURN_INCOMPLETE_CAUSES, TOOL_TURN_REPAIR_DROPS } from "../engine/llm/index.js";
8
- export type { ActorAssertion, AnthropicMessagesCompat, OpenAICompletionsCompat, OpenAIResponsesCompat, AssistantMessage, AssistantMessageDiagnostic, AssistantMessageEvent, CompleteSimpleFn, Context, DocumentContent, ImageContent, Message, Model, ModelOutputInvalid, ModelOutputInvalidCause, OutputLimit, ResilienceOptions, RouteAdjudication, RouteCredential, RouteCredentialSource, RoutePairingConfig, RoutePairingPosture, RouteRefusalCode, RouteRefusalDetail, SimpleStreamOptions, StallTimeouts, StopReason, StreamFn, TextContent, ThinkingContent, Tool, ToolCall, ToolResultMessage, StreamDrop, StreamDropCause, ToolTurnIncompleteCause, ToolTurnRepair, Usage, UserMessage, } from "../engine/llm/index.js";
7
+ export { createAssistantMessageEventStream, DATA_LABEL_UNSAFE, ensureToolTurnInvariants, isTextBlock, MODEL_OUTPUT_INVALID_CAUSES, quoteDataLabel, renderContentBlock, renderUserAttachmentView, snapshotActorAssertion, stampStreamDrops, streamDropsOf, stripEngineMetadata, TOOL_TURN_INCOMPLETE_CAUSES, TOOL_TURN_REPAIR_DROPS, userAttachmentOf } from "../engine/llm/index.js";
8
+ export type { ActorAssertion, UserAttachmentKind, UserAttachmentObservation, UserAttachmentOutcome, UserAttachmentSupply, UserMessageAttachment, AnthropicMessagesCompat, OpenAICompletionsCompat, OpenAIResponsesCompat, AssistantMessage, AssistantMessageDiagnostic, AssistantMessageEvent, CompleteSimpleFn, Context, DocumentContent, ImageContent, Message, Model, ModelOutputInvalid, ModelOutputInvalidCause, OutputLimit, ResilienceOptions, RouteAdjudication, RouteCredential, RouteCredentialSource, RoutePairingConfig, RoutePairingPosture, RouteRefusalCode, RouteRefusalDetail, SimpleStreamOptions, StallTimeouts, StopReason, StreamFn, TextContent, ThinkingContent, Tool, ToolCall, ToolResultMessage, StreamDrop, StreamDropCause, ToolTurnIncompleteCause, ToolTurnRepair, Usage, UserMessage, } from "../engine/llm/index.js";
@@ -1 +1 @@
1
- export { createAssistantMessageEventStream, ensureToolTurnInvariants, MODEL_OUTPUT_INVALID_CAUSES, snapshotActorAssertion, stampStreamDrops, streamDropsOf, stripEngineMetadata, TOOL_TURN_INCOMPLETE_CAUSES, TOOL_TURN_REPAIR_DROPS } from "../engine/llm/index.js";
1
+ export { createAssistantMessageEventStream, DATA_LABEL_UNSAFE, ensureToolTurnInvariants, isTextBlock, MODEL_OUTPUT_INVALID_CAUSES, quoteDataLabel, renderContentBlock, renderUserAttachmentView, snapshotActorAssertion, stampStreamDrops, streamDropsOf, stripEngineMetadata, TOOL_TURN_INCOMPLETE_CAUSES, TOOL_TURN_REPAIR_DROPS, userAttachmentOf } from "../engine/llm/index.js";