@sema-agent/core 5.46.0 → 5.48.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 (78) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/dist/agents/agent-transcript-tool.d.ts +4 -0
  3. package/dist/agents/agent-transcript-tool.js +10 -3
  4. package/dist/agents/send-message-tool.d.ts +43 -1
  5. package/dist/agents/send-message-tool.js +50 -11
  6. package/dist/agents/subagent.d.ts +18 -0
  7. package/dist/agents/subagent.js +231 -4
  8. package/dist/config/defaults.d.ts +20 -0
  9. package/dist/config/defaults.js +5 -0
  10. package/dist/core/background-agent-store.d.ts +1 -0
  11. package/dist/core/background-agent-store.js +13 -0
  12. package/dist/core/governance-codes.d.ts +13 -0
  13. package/dist/core/governance-codes.js +33 -0
  14. package/dist/core/mcp.d.ts +6 -1
  15. package/dist/core/mcp.js +34 -7
  16. package/dist/core/memory-engine/delegation-settlement.d.ts +318 -0
  17. package/dist/core/memory-engine/delegation-settlement.js +661 -0
  18. package/dist/core/memory-engine/engine.d.ts +159 -1
  19. package/dist/core/memory-engine/engine.js +699 -15
  20. package/dist/core/memory-engine/file-backend.d.ts +1 -0
  21. package/dist/core/memory-engine/file-backend.js +3 -1
  22. package/dist/core/memory-engine/frontmatter.d.ts +46 -19
  23. package/dist/core/memory-engine/frontmatter.js +91 -77
  24. package/dist/core/memory-engine/index.d.ts +4 -3
  25. package/dist/core/memory-engine/index.js +3 -2
  26. package/dist/core/memory-engine/layout.d.ts +14 -0
  27. package/dist/core/memory-engine/layout.js +2 -2
  28. package/dist/core/memory-engine/memory-backend-contract.js +43 -0
  29. package/dist/core/memory-engine/origin-clearance.d.ts +66 -0
  30. package/dist/core/memory-engine/origin-clearance.js +84 -0
  31. package/dist/core/memory-engine/provenance-wording.d.ts +50 -0
  32. package/dist/core/memory-engine/provenance-wording.js +15 -0
  33. package/dist/core/memory-engine/tools.d.ts +61 -7
  34. package/dist/core/memory-engine/tools.js +34 -9
  35. package/dist/core/memory-engine/types.d.ts +70 -2
  36. package/dist/core/reminder-disclosure.d.ts +90 -0
  37. package/dist/core/reminder-disclosure.js +64 -0
  38. package/dist/core/runner/prepare-acquire-reconcile.d.ts +6 -0
  39. package/dist/core/runner/prepare-acquire-reconcile.js +1 -1
  40. package/dist/core/runner/prepare-hands-readface.d.ts +4 -0
  41. package/dist/core/runner/prepare-hands-readface.js +1 -0
  42. package/dist/core/runner/prepare-memory.js +50 -15
  43. package/dist/core/runner/prepare-task.d.ts +39 -0
  44. package/dist/core/runner/prepare-task.js +128 -40
  45. package/dist/core/runner/runtask.js +3 -1
  46. package/dist/core/session-reconcile.js +3 -2
  47. package/dist/core/session-store.d.ts +59 -1
  48. package/dist/core/session-store.js +82 -14
  49. package/dist/core/session.d.ts +83 -1
  50. package/dist/core/task-registry-agent.d.ts +28 -0
  51. package/dist/core/task-registry-agent.js +63 -2
  52. package/dist/core/task-registry.d.ts +21 -0
  53. package/dist/core/task-registry.js +4 -1
  54. package/dist/core/types.d.ts +98 -3
  55. package/dist/core/types.js +3 -0
  56. package/dist/core/untrusted-text.d.ts +63 -0
  57. package/dist/core/untrusted-text.js +48 -0
  58. package/dist/core/wiring-manifest.d.ts +35 -0
  59. package/dist/core/wiring-manifest.js +21 -1
  60. package/dist/engine/harness/types.d.ts +36 -1
  61. package/dist/index.d.ts +7 -5
  62. package/dist/index.js +6 -4
  63. package/dist/internal/harness-types.d.ts +1 -0
  64. package/dist/stores/file/index.d.ts +19 -3
  65. package/dist/stores/file/index.js +24 -1
  66. package/dist/stores/file/session-store.d.ts +18 -4
  67. package/dist/stores/file/session-store.js +73 -12
  68. package/dist/tools/fs/fs-pdf.d.ts +12 -1
  69. package/dist/tools/fs/fs-pdf.js +17 -3
  70. package/dist/tools/fs/fs-read.d.ts +2 -1
  71. package/dist/tools/fs/fs-read.js +33 -5
  72. package/dist/tools/fs/fs-shared.d.ts +6 -2
  73. package/dist/tools/fs/index.d.ts +7 -0
  74. package/dist/tools/fs/index.js +1 -1
  75. package/dist/tools/task-list.d.ts +5 -1
  76. package/dist/tools/web.js +21 -2
  77. package/package.json +3 -2
  78. package/test/export-surface.snapshot.json +24 -2
@@ -643,6 +643,27 @@ export interface ToolExecuteContext {
643
643
  * Undefined when the tool runs outside a Runner task.
644
644
  */
645
645
  reminderMark?: string;
646
+ /**
647
+ * design/319 (B ticket) — the RUNNING task's reminder-disclosure trigger counters
648
+ * ({@link import("./reminder-disclosure.js").ReminderDisclosureCounts}), Runner-filled on the same
649
+ * trusted seat as {@link reminderMark}. Caller-mounted verbatim outlets that run the
650
+ * detect-and-disclose pipeline (the web tools' exact-mark defuse arm) bump their `<outlet>.<form>`
651
+ * keys here; the Runner folds the non-zero result into
652
+ * `TaskResult.stats.mechanisms.reminderDisclosures`. Mutable by design (a counter seat), but only
653
+ * ever additive — never a decision input. Undefined outside a Runner task.
654
+ */
655
+ reminderDisclosureCounts?: import("./reminder-disclosure.js").ReminderDisclosureCounts;
656
+ /**
657
+ * Subagent transcript persistence — the RESOLVED delegation entry caps for this run
658
+ * ({@link RunnerDeps.delegationEntryCaps} after prepare's loud validation; both members always
659
+ * present). Runner-filled trusted seat, never a model argument — the Agent tool's background lane
660
+ * reads it at its registration point. Undefined outside a Runner task (the lane then applies the
661
+ * exported defaults itself, so a directly-driven tool is bounded too).
662
+ */
663
+ delegationEntryCaps?: {
664
+ maxConcurrent: number;
665
+ maxCumulativePerSession: number;
666
+ };
646
667
  /**
647
668
  * Report usage spent in a nested run this tool spawned (e.g. a sub-agent). The Runner accumulates
648
669
  * it into the parent task's `TaskResult.stats.nested`, so delegated cost — the multi-agent "~15×"
@@ -868,6 +889,20 @@ export interface ToolExecuteContext {
868
889
  * {@link inheritedGateForChildren}: never a model/tool argument, never a TaskSpec field.
869
890
  */
870
891
  delegationProvenanceForChildren?: () => import("./memory-engine/delegation-provenance.js").DelegationContentSafety | undefined;
892
+ /**
893
+ * design/336 §3.3 — the delegation-settlement account's coordinates (the WRITE plane's memory
894
+ * control dir + this session's id), Runner-filled when the run mounts a memory session under
895
+ * `memoryProvenance: "carry"`. A delegation tool's BACKGROUND lane writes its launch write-ahead
896
+ * (pending row BEFORE registration and invoke) and its terminal settle through these — as pure
897
+ * data, because the terminal observation can run after this task leg returned and must rebuild
898
+ * its write handle from the coordinates alone. Undefined ⇒ no settlement account (memory-less
899
+ * run, or `"off"`): the background lane launches without rows, the pre-336 accepted-cost shape.
900
+ * Same trust posture as {@link delegationProvenanceForChildren}: never a model/tool argument.
901
+ */
902
+ delegationSettlement?: () => {
903
+ controlDir: string;
904
+ sessionId: string;
905
+ } | undefined;
871
906
  /**
872
907
  * RB-201 FO-3 (form-one audit, CC 220 `Ipd`/`ein` parity) — the auto-mode classifier decider ARMED
873
908
  * for THIS task (`RuntimeCaps.autoMode === true` AND `RunnerDeps.autoMode` both present; the same
@@ -3281,6 +3316,15 @@ export interface TaskResult {
3281
3316
  reps: number;
3282
3317
  segment: string;
3283
3318
  }>;
3319
+ /** design/319 (B ticket, G9② observation seat) — reminder-disclosure trigger counts for the
3320
+ * leg, keyed `<outlet>.<form>`: outlets `read` / `notebook` / `pdf` / `mcp` / `webFetch` /
3321
+ * `webSearch`; forms `bare` (bare-form trailer appended), `marked` (marked-form trailer —
3322
+ * never throttled), `bare_throttled` (a bare trailer suppressed by the 60s per-key window),
3323
+ * `defused` (an MCP/web segment's exact-mark bytes were rewritten — the lane's one sanctioned
3324
+ * byte change, always paired with a `marked` disclosure). Present only when ≥1 key is
3325
+ * non-zero. This is the D-4/D-6 re-ruling data (defuse/trailer widening to Read/Bash/Grep):
3326
+ * a reading, never a gate. */
3327
+ reminderDisclosures?: Record<string, number>;
3284
3328
  };
3285
3329
  /**
3286
3330
  * design/91 — **human-review burden** (design/89 §2.4 C2 axis). The wall-clock time a task spent waiting
@@ -4751,9 +4795,24 @@ export interface EngineNotice {
4751
4795
  * HARVEST that withheld at least one entry file (a checkpoint harvest and the terminal harvest
4752
4796
  * are distinct facts), never minted for a clean session; `detail: { count, moved, escalated,
4753
4797
  * reason?, sessionId? }` (`reason` absent ⇔ the pollution marker could not be re-read at report
4754
- * time — the withheld count stays true either way). Registered gap: the derived index (`MEMORY.md`) is
4755
- * contained on a path that mints no rejection row, so an index-ONLY containment produces no
4756
- * notice and is disclosed by the harvest report's warnings alone.
4798
+ * time — the withheld count stays true either way). The formerly registered index-only gap is
4799
+ * CLOSED under `memoryProvenance: "carry"` (design/336 §6.3, #331): the mint condition reads
4800
+ * `HarvestReport.containment`, so a containment whose only act was the derived-index rollback
4801
+ * announces with `count: 0` and `detail.indexRolledBack: true`; under `"off"` the pre-336
4802
+ * count>0 condition (and its silence on index-only containment) is kept byte-level.
4803
+ * - `"memory.hold_opened"` / `"memory.hold_released"` / `"memory.hold_disposed"` (design/336
4804
+ * §4/§6.3) — the instruction-hold lifecycle, derived from the same structured
4805
+ * `HarvestReport.containment` signal (hold seats are only ever filled under
4806
+ * `memoryProvenance: "carry"`): a PENDING session's instruction-form entry files were captured
4807
+ * off the model-visible plane (`hold_opened`, `detail: { count, paths, sessionId? }` — paths
4808
+ * neutralized/length-bounded); previously held entries re-walked the full gate set and
4809
+ * committed after their writer session settled clean or a host valve released them
4810
+ * (`hold_released`); held entries moved to control-plane quarantine (`hold_disposed`,
4811
+ * `detail.disposed: [{ path, terminal }]` with the closed terminal set
4812
+ * dirty/expired/conflict/capture_lost/discarded — an `expired` terminal is explicitly a
4813
+ * TIMEOUT, not a conviction, and the message names `resolveHold` as the recovery valve). At
4814
+ * most one notice per family per harvest report; wording is factual, never threat-flavored
4815
+ * (the design/336 §13-2 model-psyche guardrail).
4757
4816
  * - `"memory.delegation_static_mark_waived"` (design/324, #324 ruling ①) — the deployment set
4758
4817
  * {@link RunnerDeps.memoryDelegationEvidence} to `"attested-only"` and a delegation call whose
4759
4818
  * STATIC tool-face verdict would have marked this session's memory polluted (attestation
@@ -4771,6 +4830,14 @@ export interface EngineNotice {
4771
4830
  * mark would have carried, neutralized/length-bounded (tool and agent-type names are
4772
4831
  * host/model-controlled inputs).
4773
4832
  *
4833
+ * - `"delegation.transcript_integrity"` (subagent transcript persistence) — a durable agent row
4834
+ * with a BOUND transcript sessionId met a session store that attests `not_found` for it: the
4835
+ * deployment's declared transcript durability is being contradicted by reality. Announced at
4836
+ * most once per (handle, process) from the continuation read faces (SendMessage preflight /
4837
+ * AgentTranscript's durable leg); the per-call honest refusals are unchanged, and the declared
4838
+ * tier is NOT auto-downgraded (declaration-制 — observation reports, it never re-adjudicates);
4839
+ * `detail: { handle }`.
4840
+ *
4774
4841
  * Deliberately NOT a notice family: brain retry/reconnect liveness (a rate limit, a 5xx, a
4775
4842
  * transient network failure being retried). Those are per-attempt liveness frames with their own
4776
4843
  * frequency semantics and ride the wire `status` channel ({@link BrainStatus}), whose sink the
@@ -4781,6 +4848,12 @@ export interface EngineNotice {
4781
4848
  message: string;
4782
4849
  /** Machine-readable facts of the notice (knob names, arriving values, values in force). */
4783
4850
  detail?: Record<string, unknown>;
4851
+ /** The owning session, when the notice HAS one — the wire-routing attribution key (a
4852
+ * session-scoped notice can be projected onto that session's event stream; a session-less code
4853
+ * structurally cannot). Mint sites do not set this: {@link deliverEngineNotice} — the ONE
4854
+ * delivery throat — lifts a string `detail.sessionId` here, so the typed key and the detail
4855
+ * carriage can never disagree. Optional and absent for process/config-scoped codes. */
4856
+ sessionId?: string;
4784
4857
  }
4785
4858
  /** Test seam (mirrors `__resetBashTimeoutAnnouncements`): never called by production code. */
4786
4859
  export declare function __resetMalformedNoticeSeatAnnouncement(): void;
@@ -5270,6 +5343,28 @@ export interface RunnerDeps {
5270
5343
  * Same single-instance pairing discipline as `backgroundAgentStore` (RB-37): a deployment that
5271
5344
  * composes its own tools must thread the SAME instance everywhere. */
5272
5345
  mailboxStore?: import("./mailbox-store.js").MailboxStore;
5346
+ /**
5347
+ * Subagent transcript persistence — the delegation ENTRY caps (CC parity values: 20 concurrent /
5348
+ * 200 cumulative per session tree; defaults exported as `DELEGATION_MAX_CONCURRENT_DEFAULT` /
5349
+ * `DELEGATION_MAX_PER_SESSION_DEFAULT`). Key = `(scope, rootSessionId)`, full depth (grandchildren
5350
+ * share the tree's pool). `maxConcurrent` bounds running/pending a* handles in this process's
5351
+ * registry (parked does not burn a slot — a suspension is not concurrency; a revival claim counts
5352
+ * like a spawn); `maxCumulativePerSession` bounds the RETAINED-WINDOW cumulative count (registry-
5353
+ * retained + store-retained rows — a reaped row returns its quota; deliberately NOT CC's lifetime-
5354
+ * monotonic session counter, which would require a persistent counting surface this economic bound
5355
+ * does not justify — registered divergence). Refusals are coded (`delegation.concurrency_cap` /
5356
+ * `delegation.session_cap`) with the current value and this knob's name in the text.
5357
+ *
5358
+ * BAD VALUES REFUSE LOUDLY at prepare (`config.delegation_entry_caps`, the #123 posture): a
5359
+ * non-positive/non-integer/NaN member, or a resolved pair where `maxConcurrent` exceeds
5360
+ * `maxCumulativePerSession` (you cannot run more at once than you may ever create) — never a
5361
+ * silent fold to the defaults. Per-replica bound (multi-replica deployments are each honestly
5362
+ * bounded; row-level CAS owns correctness, this cap owns economics).
5363
+ */
5364
+ delegationEntryCaps?: {
5365
+ maxConcurrent?: number;
5366
+ maxCumulativePerSession?: number;
5367
+ };
5273
5368
  /** design/176 — deployment tuning for the always-on peer-message admission gate (SendMessage entry
5274
5369
  * judgment: rate/dedup/hop-chain/queue bounds). Per-field range-validated against the upstream
5275
5370
  * table with out-of-range values falling back to that field's default; there is NO off switch —
@@ -24,6 +24,9 @@ export function __resetMalformedNoticeSeatAnnouncement() {
24
24
  malformedNoticeSeatAnnounced = false;
25
25
  }
26
26
  export function deliverEngineNotice(onNotice, notice) {
27
+ if (notice.sessionId === undefined && typeof notice.detail?.["sessionId"] === "string") {
28
+ notice = { ...notice, sessionId: notice.detail["sessionId"] };
29
+ }
27
30
  if (typeof onNotice === "function") {
28
31
  try {
29
32
  const r = onNotice(notice);
@@ -16,6 +16,69 @@
16
16
  * own (instructions and data share one channel). The real boundary is decorrelation + reading the objective
17
17
  * artifact (the diff / working tree) rather than the worker's self-report (design/53 §3, design/54 §3).
18
18
  */
19
+ /** design/319 (B ticket) — what one reminder-shaped scan of an external projection found. */
20
+ export interface ReminderShapedScan {
21
+ /** ≥1 reminder-shaped tag (open or close; attribute/case/whitespace tolerant) is present. */
22
+ hit: boolean;
23
+ /** Some reminder-shaped TAG's own bytes contain the session's exact mark value — the strongest
24
+ * verdict (a full scan decides this, never the first match: a bare decoy ahead of a marked
25
+ * forgery must still be judged marked). `false` whenever `mark` is `undefined`. */
26
+ hadCurrentMark: boolean;
27
+ }
28
+ /**
29
+ * design/319 (B ticket) — the ONE detection predicate for reminder-shaped text in EXTERNAL data
30
+ * (the Read/notebook/PDF/MCP disclosure trailers and the MCP/web exact-mark defuse all judge with
31
+ * THIS scan). It reads the same {@link SYSTEM_REMINDER} regex the neutralizer rewrites with, so
32
+ * "what gets defused on contained lanes" and "what gets disclosed on verbatim lanes" can never
33
+ * drift apart — do not hand-copy the tag pattern anywhere else (same single-source discipline as
34
+ * {@link defuseFenceMarkers}). Attribute-tolerant / case-insensitive / tag-internal whitespace
35
+ * tolerant by construction; a tag the regex does not recognize is NOT a hit (the residual gap
36
+ * between this grammar and what a model might read as authority is an accepted, documented
37
+ * residual — same class as the Unicode-lookalike note on {@link defuseFenceMarkers}).
38
+ *
39
+ * The scan is read-only over the FINALIZED projection (post concatenation/truncation, pre any
40
+ * trusted tail) — callers must scan BEFORE any byte-changing transform (design/319 §3e four-step
41
+ * order): a defused/neutralized projection no longer carries the exact mark, so scanning after
42
+ * would misreport a marked forgery as the bare form (the lying-disclosure shape).
43
+ */
44
+ export declare function scanReminderShaped(text: string, mark: string | undefined): ReminderShapedScan;
45
+ /**
46
+ * design/319 §3b (B ticket) — EXACT-MARK defuse for the MCP-success/web outlets: insert a ZWSP
47
+ * inside every occurrence of the session's exact mark value so the bytes no longer spell the
48
+ * current mark. This is the ONE sanctioned byte change on those lanes (their zero-byte-change
49
+ * invariant's single exception): a server/page legitimately producing the 22-char session mark has
50
+ * definitionally zero probability — the value lives only in this session's prompt and checkpoint —
51
+ * so an occurrence is either a forgery or a leak echo, and defusing it turns a silent authority
52
+ * forgery into a visible mismatch (the accepted failure direction; a legitimate round-trip echo of
53
+ * a leaked mark defuses too, and the next hop then fails loudly instead of re-arming the forgery).
54
+ * NEVER applied on Read/Bash/Grep (the strong quote-back lanes stay verbatim — ruled, observation
55
+ * seat only). Idempotent: the rewritten text no longer contains the exact mark (ZWSP is not a
56
+ * base64url character, so the insertion can also never synthesize a new occurrence).
57
+ */
58
+ export declare function defuseExactMark(text: string, mark: string): string;
59
+ /**
60
+ * design/319 §3b — the SEGMENT form of {@link defuseExactMark} (adversarial round: a server can
61
+ * split the mark across adjacent MCP text blocks; the block seam is invisible in the model-facing
62
+ * concatenation, so a per-segment defuse would be a bypass). Judged over the JOINED projection and
63
+ * the ZWSP insertion mapped back into the owning segment, so the post-defuse concatenation NEVER
64
+ * contains the exact mark — including occurrences that straddle one or more seams (one ZWSP inside
65
+ * the occurrence's span breaks it wherever the split fell). Returns the same array (`changed:
66
+ * false`) when the joined projection has no occurrence; otherwise fresh segment strings whose
67
+ * concatenation equals the single-string form's output byte for byte (it IS the single-string
68
+ * form's implementation).
69
+ *
70
+ * OVERLAP-AWARE (adversarial round 2): a BORDERED mark (first character = last character — ~1/64
71
+ * random mints) admits overlapping occurrences (`mark + mark.slice(1)` carries two, one starting on
72
+ * the other's final character), so enumeration advances ONE character per match, never by the mark
73
+ * length — a skip-by-length walk defused the first and left the second exact while the trailer
74
+ * claimed neutralization. Every enumerated occurrence gets a ZWSP inside its own span; ZWSP is not
75
+ * a base64url character, so insertions can never synthesize a new occurrence and the result is
76
+ * idempotent (no exact mark survives ⇒ a second pass is byte-identical).
77
+ */
78
+ export declare function defuseExactMarkInSegments(segments: readonly string[], mark: string): {
79
+ segments: string[];
80
+ changed: boolean;
81
+ };
19
82
  /**
20
83
  * Neutralize structural break-out sequences in UNTRUSTED text so it can't escape its framing into
21
84
  * model-facing instructions. Always neutralizes `<system-reminder>` / `</system-reminder>` (the codebase's
@@ -12,6 +12,54 @@ function breakoutRe(extraTags) {
12
12
  }
13
13
  return re;
14
14
  }
15
+ export function scanReminderShaped(text, mark) {
16
+ let hit = false;
17
+ let hadCurrentMark = false;
18
+ for (const m of text.matchAll(SYSTEM_REMINDER)) {
19
+ hit = true;
20
+ if (mark !== undefined && m[0].includes(mark)) {
21
+ hadCurrentMark = true;
22
+ break;
23
+ }
24
+ if (mark === undefined)
25
+ break;
26
+ }
27
+ return { hit, hadCurrentMark };
28
+ }
29
+ export function defuseExactMark(text, mark) {
30
+ return defuseExactMarkInSegments([text], mark).segments[0];
31
+ }
32
+ export function defuseExactMarkInSegments(segments, mark) {
33
+ const joined = segments.join("");
34
+ if (mark.length === 0 || !joined.includes(mark))
35
+ return { segments: [...segments], changed: false };
36
+ const positions = [];
37
+ for (let at = joined.indexOf(mark); at !== -1; at = joined.indexOf(mark, at + 1))
38
+ positions.push(at + 1);
39
+ const out = [];
40
+ let start = 0;
41
+ let pi = 0;
42
+ for (const seg of segments) {
43
+ const end = start + seg.length;
44
+ if (pi >= positions.length || positions[pi] > end) {
45
+ out.push(seg);
46
+ }
47
+ else {
48
+ const parts = [];
49
+ let prev = 0;
50
+ while (pi < positions.length && positions[pi] > start && positions[pi] <= end) {
51
+ const local = positions[pi] - start;
52
+ parts.push(seg.slice(prev, local), ZWSP);
53
+ prev = local;
54
+ pi++;
55
+ }
56
+ parts.push(seg.slice(prev));
57
+ out.push(parts.join(""));
58
+ }
59
+ start = end;
60
+ }
61
+ return { segments: out, changed: true };
62
+ }
15
63
  export function sanitizeUntrustedText(text, extraTags = []) {
16
64
  return text.replace(breakoutRe(extraTags), (m) => m.replace("<", "<" + ZWSP));
17
65
  }
@@ -126,9 +126,18 @@ export interface WiringManifest {
126
126
  session: {
127
127
  store: ManifestDurability;
128
128
  };
129
+ /** `subagentTranscripts` — subagent transcript persistence: the deployment-level delegation-
130
+ * transcript durability TIER, a pure declaration read ({@link resolveSubagentTranscriptTier}):
131
+ * `none` = no agent-row store (pre-151 in-memory lifecycle); `rows` = rows + terminal snapshots
132
+ * survive a restart, transcripts follow the session store's fate; `full` = the C18 promise —
133
+ * a completed/failed/killed(non-user) subagent minted through the deps-visible assembly is
134
+ * continuable across a process restart. A statement about the DEPS-VISIBLE assembly only: a
135
+ * caller-mounted Agent tool over its own runner is outside this manifest's sight (per-read
136
+ * honest degrade + the integrity notice own that case, never a fabricated tier). */
129
137
  fleet: {
130
138
  backgroundAgentStore: boolean;
131
139
  hostChildEventSink: boolean;
140
+ subagentTranscripts: SubagentTranscriptTier;
132
141
  };
133
142
  /** design/179 — the persisted allow-rule seam. The ONE loosening seam in the assembly, so its presence
134
143
  * is a fact an operator has to be able to read off the manifest rather than infer. `false` on a
@@ -201,6 +210,11 @@ export interface WiringFacts {
201
210
  checkpointDurability?: StoreDurability;
202
211
  sessionDurability: StoreDurability;
203
212
  backgroundAgentStoreWired: boolean;
213
+ /** Subagent transcript persistence — the declared delegation-transcript tier (see
214
+ * {@link WiringManifest.fleet}). Optional for external `deriveWiringManifest` callers: absent
215
+ * derives fail-closed from `backgroundAgentStoreWired` alone (`rows`/`none` — under-promise,
216
+ * never `full`); the engine's own halves always pass the resolved value. */
217
+ subagentTranscriptTier?: SubagentTranscriptTier;
204
218
  /** design/179 — a persisted allow-rule store provider is wired. */
205
219
  permissionRuleStoreWired: boolean;
206
220
  /** design/182 §9 — the deployment declared that it drives cloud sync for that store. */
@@ -227,6 +241,27 @@ export type StaticWiringSpec = Pick<TaskSpec, "onAsk" | "onQuestion" | "checkpoi
227
241
  export declare function resolveDeclaredDurability(store: {
228
242
  readonly durability?: StoreDurability;
229
243
  } | undefined, storeName: string): StoreDurability;
244
+ /** Subagent transcript persistence — the deployment-level delegation-transcript durability tier
245
+ * (see {@link WiringManifest.fleet}). */
246
+ export type SubagentTranscriptTier = "none" | "rows" | "full";
247
+ /**
248
+ * Subagent transcript persistence — the ONE deployment-level tier derivation (pure declaration
249
+ * read, no probing, no class-name sniffing — the wiring-manifest posture): `none` without an
250
+ * agent-row store; with one, `full` iff the session store DECLARES its subagent placement
251
+ * partition durable, else `rows`. A junk placement declaration is refused loudly
252
+ * (`config.store_durability_invalid` — the resolveDeclaredDurability rule: an unparseable
253
+ * declaration silently folded to either arm would make the manifest lie in whichever direction the
254
+ * fold picked). This is the DEPLOYMENT-level judgment only; the per-handle "did this row's
255
+ * transcript actually land" question belongs to `durableAgentRowProbe` (the S1b release-flip gate)
256
+ * — two different questions, deliberately two named faces (do not merge them back into one).
257
+ */
258
+ export declare function resolveSubagentTranscriptTier(agentStoreWired: boolean, sessionStore: {
259
+ readonly placements?: {
260
+ subagent?: {
261
+ durability: StoreDurability;
262
+ };
263
+ };
264
+ } | undefined): SubagentTranscriptTier;
230
265
  /**
231
266
  * The ONE `ask.effective` derivation (design/173 codex 5) — shared by the effective manifest AND
232
267
  * the posture door (`config.interaction_posture`), so "what does the door require" and "what does
@@ -14,6 +14,21 @@ export function resolveDeclaredDurability(store, storeName) {
14
14
  throw e;
15
15
  }
16
16
  const manifestDurabilityOf = (d) => (d === "durable" ? "declared_durable" : "process_local");
17
+ export function resolveSubagentTranscriptTier(agentStoreWired, sessionStore) {
18
+ if (!agentStoreWired)
19
+ return "none";
20
+ const declared = sessionStore?.placements?.subagent?.durability;
21
+ if (declared === undefined)
22
+ return "rows";
23
+ if (declared === "durable")
24
+ return "full";
25
+ if (declared === "process-local")
26
+ return "rows";
27
+ const e = new Error(`sessionStore.placements.subagent.durability declares ${JSON.stringify(declared)} — not a recognized ` +
28
+ `StoreDurability ("durable" | "process-local"). Fix the declaration; an unparseable durability cannot be folded to either arm.`);
29
+ e.code = "config.store_durability_invalid";
30
+ throw e;
31
+ }
17
32
  export function deriveAskEffective(form, parkEffective) {
18
33
  switch (form) {
19
34
  case "callback":
@@ -85,7 +100,11 @@ export function deriveWiringManifest(facts) {
85
100
  elicit: { seamWired: facts.elicitSeamWired, serversOptedIn: facts.elicitServersOptedIn },
86
101
  parkLane,
87
102
  session: { store: manifestDurabilityOf(facts.sessionDurability) },
88
- fleet: { backgroundAgentStore: facts.backgroundAgentStoreWired, hostChildEventSink: facts.hostChildEventSinkWired },
103
+ fleet: {
104
+ backgroundAgentStore: facts.backgroundAgentStoreWired,
105
+ hostChildEventSink: facts.hostChildEventSinkWired,
106
+ subagentTranscripts: facts.subagentTranscriptTier ?? (facts.backgroundAgentStoreWired ? "rows" : "none"),
107
+ },
89
108
  permissionRules: {
90
109
  storeWired: facts.permissionRuleStoreWired,
91
110
  syncWired: facts.permissionRuleSyncWired,
@@ -182,6 +201,7 @@ export function describeStaticWiring(deps, spec = {}) {
182
201
  ...(capable ? { checkpointDurability: resolveDeclaredDurability(checkpointStore, "checkpointStore") } : {}),
183
202
  sessionDurability: resolveDeclaredDurability(deps.sessionStore, "sessionStore"),
184
203
  backgroundAgentStoreWired: deps.backgroundAgentStore !== undefined,
204
+ subagentTranscriptTier: resolveSubagentTranscriptTier(deps.backgroundAgentStore !== undefined, deps.sessionStore),
185
205
  permissionRuleStoreWired: deps.permissionRuleStore !== undefined,
186
206
  permissionRuleSyncWired: deps.permissionRuleSyncWired === true,
187
207
  permissionRuleOrgGoverned: deps.permissionRuleOrg !== undefined,
@@ -157,7 +157,7 @@ export declare class CompactionError extends Error {
157
157
  code: CompactionErrorCode;
158
158
  constructor(code: CompactionErrorCode, message: string, cause?: Error);
159
159
  }
160
- export type SessionErrorCode = "not_found" | "invalid_session" | "invalid_entry" | "invalid_fork_target" | "storage" | "conflict" | "unknown";
160
+ export type SessionErrorCode = "not_found" | "invalid_session" | "invalid_entry" | "invalid_fork_target" | "storage" | "conflict" | "placement_refused" | "unknown";
161
161
  /** Error thrown by session storage, repositories, and session tree operations. */
162
162
  export declare class SessionError extends Error {
163
163
  /** Session subsystem error code. */
@@ -170,6 +170,30 @@ export declare class AgentHarnessError extends Error {
170
170
  code: AgentHarnessErrorCode;
171
171
  constructor(code: AgentHarnessErrorCode, message: string, cause?: Error);
172
172
  }
173
+ /**
174
+ * The PERSISTED placement tuple of a session created into a placement partition (subagent
175
+ * transcript persistence — the durable half of the delegation continuation contract). Written ONCE
176
+ * at creation (first-write immutable: a later acquire never rewrites it) and carried on
177
+ * {@link SessionMetadata.placement}. The FULL tuple is persisted, not just a tag: `scope`+`handle`
178
+ * are the row-store join key the retention orchestration needs after a restart (a bare label could
179
+ * not tell "no row" from "a row in another tenant"), and `placedAt` anchors the age-based GC arm.
180
+ * A tuple missing either join half is treated by consumers as INCOMPLETE (fail-closed: never
181
+ * age-reaped, reported as such by placed listings).
182
+ */
183
+ export interface SessionPlacementRecord {
184
+ /** The one placement kind this contract defines today. */
185
+ kind: "subagent";
186
+ /** Tenant scope of the owning durable agent row (row-store join key half 1). */
187
+ scope?: string;
188
+ /** The spawning host session (partition/retrieval metadata — authorization stays on the row predicate). */
189
+ parentSessionId?: string;
190
+ /** The delegation tree's root host session (fixed point; enumeration anchor). */
191
+ rootSessionId?: string;
192
+ /** The durable agent row key (`a…` handle; row-store join key half 2). */
193
+ handle?: string;
194
+ /** Epoch ms the placement was created (stamped by the store at creation). */
195
+ placedAt: number;
196
+ }
173
197
  /** Metadata for one filesystem object in a {@link FileSystem}. */
174
198
  export interface FileInfo {
175
199
  /** Basename of {@link path}. */
@@ -644,6 +668,10 @@ export interface SessionMetadata {
644
668
  * fork lineage (e.g. reap forks whose parent is gone/expired). Absent on a non-forked session and on
645
669
  * forked sessions persisted before this field shipped. */
646
670
  forkedFrom?: string;
671
+ /** Subagent transcript persistence — the placement tuple this session was CREATED into (see
672
+ * {@link SessionPlacementRecord}). Absent on every ordinary (host-lane) session; a repo that does
673
+ * not understand placement never surfaces it (additive, old readers tolerate). */
674
+ placement?: SessionPlacementRecord;
647
675
  }
648
676
  export interface JsonlSessionMetadata extends SessionMetadata {
649
677
  cwd: string;
@@ -796,6 +824,13 @@ export interface Session<TMetadata extends SessionMetadata = SessionMetadata> {
796
824
  }
797
825
  export interface SessionCreateOptions {
798
826
  id?: string;
827
+ /** Subagent transcript persistence — create this session INTO a placement partition. The repo
828
+ * stamps `placedAt` and persists the tuple on its meta record (first-write immutable). A repo
829
+ * that does not understand placement IGNORES this key (legal degrade — the session is then an
830
+ * ordinary one; the store-level `placements` declaration is what promises understanding). */
831
+ placement?: Omit<SessionPlacementRecord, "placedAt"> & {
832
+ placedAt?: number;
833
+ };
799
834
  }
800
835
  export interface SessionForkOptions {
801
836
  entryId?: string;
package/dist/index.d.ts CHANGED
@@ -61,9 +61,10 @@ export { BUILTIN_COMPLIANCE_DENIES, COMPLIANCE_CAPABILITIES, WEB_FETCH_TOOL_NAME
61
61
  export { admitMemoryScopes, foldAdmissionFreeze, type OwnOrgAdmissionVerdict, type MemoryAdmissionInput, type MemoryAdmissionOutcome, type MemoryAdmissionVerdict, type MemoryScopeAdmission, type MemoryScopeOrigin, type MemoryScopeRequest, } from "./core/memory-admission.js";
62
62
  export { assertRetentionCapability, type ManagedRetentionCapability, type RetentionDeclaration, type RetentionDeclaring, type RetentionPolicy, type RetentionReceipt, } from "./core/retention.js";
63
63
  export { GOVERNANCE_CODES, governanceRetryClass, type GovernanceCode, type GovernanceRetryClass } from "./core/governance-codes.js";
64
+ export { NOTICE_AUDIENCE, noticeAudienceOf } from "./core/governance-codes.js";
64
65
  export { TtlSessionStore, type TtlSessionStoreOptions, type EvictPolicy } from "./core/session-store.js";
65
66
  export { reconcileInterruptedSession, findOrphanToolCalls, type OrphanToolCall, type ReconcileReport, } from "./core/session-reconcile.js";
66
- export { StoredSession, InMemorySessionRepo, InMemorySessionStorage, BaseSessionStorage, leafIdAfterEntry, validateEntriesForImport, StreamingImportValidator, boundedTail, SessionError, isSessionConflict, hasSessionFork, uuidv7, type Session, type SessionStore, type AcquiredSession, type SessionStoreSummary, type SessionStorage, type SessionRepo, type SessionMetadata, type SessionTreeEntry, type SessionWriteOptions, } from "./core/session.js";
67
+ export { StoredSession, InMemorySessionRepo, InMemorySessionStorage, BaseSessionStorage, leafIdAfterEntry, validateEntriesForImport, StreamingImportValidator, boundedTail, SessionError, isSessionConflict, hasSessionFork, uuidv7, type Session, type SessionStore, type AcquiredSession, type SessionStoreSummary, type SessionStorage, type SessionRepo, type SessionMetadata, type SessionTreeEntry, type SessionWriteOptions, type SessionPlacement, type SessionPlacementRecord, type PlacedSessionRow, } from "./core/session.js";
67
68
  export { warmResume } from "./core/warm-resume.js";
68
69
  export { StubExecutionEnv } from "./core/stub-env.js";
69
70
  export { NodeExecutionEnv, FileError, ExecutionError } from "./internal/harness.js";
@@ -110,7 +111,7 @@ export { createFsWriteGatePolicy, type FsWriteGatePolicyOptions } from "./core/f
110
111
  export { RETIRED_TOOL_NAMES } from "./core/tool-name-aliases.js";
111
112
  export { DEFAULT_SUBAGENT_TOOL_NAME } from "./agents/subagent.js";
112
113
  export { renderTaskNotificationXml, taskNotificationDedupKey, isDelegatedAgentTerminal, SystemInjectionQueue, type TaskNotificationPayload, type TaskNotificationStatus, type ExternalNotificationInput, type SystemInjection, type SystemInjectionPriority, } from "./core/task-notification.js";
113
- export { describeStaticWiring, deriveWiringManifest, deriveAskEffective, resolveDeclaredDurability, resolveAskSeamForm, resolveQuestionSeam, countElicitOptIns, type WiringManifest, type WiringFacts, type WiringLegKind, type AskSeamForm, type AskEffective, type QuestionChannelState, type SeamProvenance, type ParkLaneReason, type ManifestDurability, type StaticWiringDeps, type StaticWiringSpec, } from "./core/wiring-manifest.js";
114
+ export { describeStaticWiring, deriveWiringManifest, deriveAskEffective, resolveDeclaredDurability, resolveSubagentTranscriptTier, type SubagentTranscriptTier, resolveAskSeamForm, resolveQuestionSeam, countElicitOptIns, type WiringManifest, type WiringFacts, type WiringLegKind, type AskSeamForm, type AskEffective, type QuestionChannelState, type SeamProvenance, type ParkLaneReason, type ManifestDurability, type StaticWiringDeps, type StaticWiringSpec, } from "./core/wiring-manifest.js";
114
115
  export { probeParkRoundTrip, durableParkGapOf, durableParkGapFor, PARK_SELFCHECK_SCOPE_PREFIX, type ParkSelfCheckResult, type ParkProbeFinding, type ParkProbeFindingCode, } from "./core/park-selfcheck.js";
115
116
  export { type StoreDurability } from "./core/checkpoint-store.js";
116
117
  export { type StoreFidelity } from "./core/checkpoint-store.js";
@@ -167,7 +168,7 @@ export { AdoptionError, assertAdoptionBootGate, readRootAdoptionFile, writeRootA
167
168
  export { adoptLocalDataRoot, ackAdoptionConfig, witnessAdoptionConfig, listAdoptionQuarantine, readAdoptionStatus, type AdoptionStatus, type AdoptLocalDataRootOptions, type AdoptLocalDataRootResult, type AdoptionCarriageLeg, type AdoptionCarriageLegContext, type AdoptionConfigWitnessReceipt, } from "./stores/file/adoption/adopt.js";
168
169
  export { formatHookFeedback, runToolGate, createHookEnvCapabilities, createPreToolUseConstraintPolicy, type PersistedRuleHit, type PersistedRuleUnreadable, 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, type PermissionDeniedSource, } from "./core/hooks.js";
169
170
  export { InMemoryMemoryStore, composeMemoryBlock, composeLayeredMemoryBlock, normalizeMemorySpec, type NormalizedMemorySpec, type MemorySpecInput, supportsConsolidation, supportsPeriodicConsolidation, firstSentence, expandLexicalTerms, lexicalSearchMatch, type Embedder, classifyPromotable, enforcePromotableWriteGate, guardedMemoryStore, MemoryGateError, detectSecret, enforceSecretWriteGate, enforceStructuredNoteSecretGate, type UtilityGate, type MemoryStore, type MemoryVectorMode, type ScoredMemory, type MemoryNoteHeader, type MemoryNoteRecord, type MemoryNoteType, type StructuredNoteInput, } from "./core/memory.js";
170
- export { MemoryEngine, FileMemoryEngineBackend, memoryBackendContract, assertMemoryBackendSearchEquivalence, type MemoryBackendContractHooks, buildMemoryInstruction, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, deriveRepoControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, MEMORY_ORIGIN_CAUSES, committedOriginOf, originEquals, isInstructionEntry, type MemoryEntryOrigin, type MemoryOriginCause, MEMORY_INSTRUCTION_TEMPLATE, MEMORY_RECALL_DISCIPLINE, MEMORY_PREFERENCE_DISCIPLINE, MEMORY_READONLY_NOTICE, 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_ENGINE_TOOL_NAMES, type MemorySearchDetails, type MemorySearchHit, type MemoryGetDetails, 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 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, 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";
171
+ export { MemoryEngine, FileMemoryEngineBackend, memoryBackendContract, assertMemoryBackendSearchEquivalence, type MemoryBackendContractHooks, buildMemoryInstruction, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, deriveRepoControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, MEMORY_ORIGIN_CAUSES, committedOriginOf, originEquals, ambiguousOriginRepresentation, isInstructionEntry, type MemoryEntryOrigin, type MemoryOriginCause, MEMORY_INSTRUCTION_TEMPLATE, MEMORY_RECALL_DISCIPLINE, MEMORY_PREFERENCE_DISCIPLINE, MEMORY_READONLY_NOTICE, 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_ENGINE_TOOL_NAMES, type MemorySearchDetails, type MemorySearchHit, type CleanMemorySearchHit, type ExposedMemorySearchHit, MEMORY_EXPOSURE_BANNER, MEMORY_EXPOSURE_HANDLE_TAG, memoryExposureIndexRow, type MemoryGetDetails, 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 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, 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";
171
172
  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";
172
173
  export { sharedMemoryStoreContract, type SharedMemoryFixture, type SharedMemoryStoreContractHooks, } from "./core/shared-memory/contract.js";
173
174
  export { termSet, jaccardDistance, cosineDistance } from "./core/memory-vector.js";
@@ -233,10 +234,11 @@ export { summarizeRedactions } from "./core/untrusted-egress.js";
233
234
  export { MemoryRosterStore, FileRosterStore, type RosterStore, type RosterEntry, type RosterAccess, type RosterGcOptions } from "./agents/roster-store.js";
234
235
  export { CONFIG_CATALOG_VERSION, describeConfigCatalog, resolveEffectiveConfig, type ConfigKnob, type ConfigOverrideDeclaration, type ConfigProvenance, type EffectiveConfigField, } from "./config/catalog.js";
235
236
  export { normalizeAgentName } from "./core/task-registry.js";
237
+ export { DELEGATION_MAX_CONCURRENT_DEFAULT, DELEGATION_MAX_PER_SESSION_DEFAULT, ORPHAN_ADOPT_WINDOW_MS_DEFAULT, ORPHAN_ADOPT_MAX_DEFAULT, SUBAGENT_TRANSCRIPT_RETENTION_DAYS_DEFAULT, } from "./config/defaults.js";
236
238
  export { COORDINATOR_ROLE_PROMPT, TEAMMATE_COMMUNICATION_ADDENDUM, TEAMMATE_TASK_LIST_ADDENDUM } from "./prompts/coordinator.js";
237
- export { createSubagentTool, FORK_SUBAGENT_TYPE, GENERAL_PURPOSE_SUBAGENT_TYPE, agentWhenToUseText, FORK_DIRECTIVE_FRAME, SUBAGENT_SYSTEM_NOTE, type SubagentToolOptions, type SubagentSpawnContext, type SubagentSteerHandle, type SubagentStep, type SubagentEditedFile, } from "./agents/subagent.js";
239
+ export { createSubagentTool, FORK_SUBAGENT_TYPE, GENERAL_PURPOSE_SUBAGENT_TYPE, agentWhenToUseText, FORK_DIRECTIVE_FRAME, SUBAGENT_SYSTEM_NOTE, type SubagentToolOptions, resolveDelegationEntryCaps, type ResolvedDelegationEntryCaps, type SubagentSpawnContext, type SubagentSteerHandle, type SubagentStep, type SubagentEditedFile, } from "./agents/subagent.js";
238
240
  export { getSessionRetainLedger, releaseSessionRetainLedger, } from "./agents/retain-ledger.js";
239
- export { createSendMessageTool, SEND_MESSAGE_TOOL_NAME, type SendMessageToolOptions } from "./agents/send-message-tool.js";
241
+ export { createSendMessageTool, createAgentContinuationVerb, SEND_MESSAGE_TOOL_NAME, type SendMessageToolOptions, type AgentContinuationReceipt } from "./agents/send-message-tool.js";
240
242
  export { createPeerAdmission, peerAdmissionFor, judgePeerAdmission, resolvePeerAdmissionConfig, PEER_ADMISSION_DEFAULTS, PEER_HOP_CHAIN_WINDOW, PEER_MESSAGE_NOTICE, createPeerSelfRef, createPeerInboundChainRef, peerAxisToken, appendHopToken, type PeerAdmission, type PeerAdmissionConfig, type PeerAdmissionOptions, type PeerAdmissionRequest, type PeerAdmissionVerdict, type PeerAdmissionRefusal, type PeerRefusalCode, type PeerAxisTag, type PeerIdentity, type PeerSelfRef, type PeerInboundChainRef, } from "./agents/peer-admission.js";
241
243
  export { createAgentTranscriptTool, AGENT_TRANSCRIPT_TOOL_NAME, type AgentTranscriptToolOptions, } from "./agents/agent-transcript-tool.js";
242
244
  export { defineAgent } from "./agents/agent-definition.js";
package/dist/index.js CHANGED
@@ -49,6 +49,7 @@ export { BUILTIN_COMPLIANCE_DENIES, COMPLIANCE_CAPABILITIES, WEB_FETCH_TOOL_NAME
49
49
  export { admitMemoryScopes, foldAdmissionFreeze, } from "./core/memory-admission.js";
50
50
  export { assertRetentionCapability, } from "./core/retention.js";
51
51
  export { GOVERNANCE_CODES, governanceRetryClass } from "./core/governance-codes.js";
52
+ export { NOTICE_AUDIENCE, noticeAudienceOf } from "./core/governance-codes.js";
52
53
  export { TtlSessionStore } from "./core/session-store.js";
53
54
  export { reconcileInterruptedSession, findOrphanToolCalls, } from "./core/session-reconcile.js";
54
55
  export { StoredSession, InMemorySessionRepo, InMemorySessionStorage, BaseSessionStorage, leafIdAfterEntry, validateEntriesForImport, StreamingImportValidator, boundedTail, SessionError, isSessionConflict, hasSessionFork, uuidv7, } from "./core/session.js";
@@ -89,7 +90,7 @@ export { createFsWriteGatePolicy } from "./core/fs-write-gate-policy.js";
89
90
  export { RETIRED_TOOL_NAMES } from "./core/tool-name-aliases.js";
90
91
  export { DEFAULT_SUBAGENT_TOOL_NAME } from "./agents/subagent.js";
91
92
  export { renderTaskNotificationXml, taskNotificationDedupKey, isDelegatedAgentTerminal, SystemInjectionQueue, } from "./core/task-notification.js";
92
- export { describeStaticWiring, deriveWiringManifest, deriveAskEffective, resolveDeclaredDurability, resolveAskSeamForm, resolveQuestionSeam, countElicitOptIns, } from "./core/wiring-manifest.js";
93
+ export { describeStaticWiring, deriveWiringManifest, deriveAskEffective, resolveDeclaredDurability, resolveSubagentTranscriptTier, resolveAskSeamForm, resolveQuestionSeam, countElicitOptIns, } from "./core/wiring-manifest.js";
93
94
  export { probeParkRoundTrip, durableParkGapOf, durableParkGapFor, PARK_SELFCHECK_SCOPE_PREFIX, } from "./core/park-selfcheck.js";
94
95
  export {} from "./core/checkpoint-store.js";
95
96
  export {} from "./core/checkpoint-store.js";
@@ -129,7 +130,7 @@ export { AdoptionError, assertAdoptionBootGate, readRootAdoptionFile, writeRootA
129
130
  export { adoptLocalDataRoot, ackAdoptionConfig, witnessAdoptionConfig, listAdoptionQuarantine, readAdoptionStatus, } from "./stores/file/adoption/adopt.js";
130
131
  export { formatHookFeedback, runToolGate, createHookEnvCapabilities, createPreToolUseConstraintPolicy, normalizePersistedRuleHit, } from "./core/hooks.js";
131
132
  export { InMemoryMemoryStore, composeMemoryBlock, composeLayeredMemoryBlock, normalizeMemorySpec, supportsConsolidation, supportsPeriodicConsolidation, firstSentence, expandLexicalTerms, lexicalSearchMatch, classifyPromotable, enforcePromotableWriteGate, guardedMemoryStore, MemoryGateError, detectSecret, enforceSecretWriteGate, enforceStructuredNoteSecretGate, } from "./core/memory.js";
132
- export { MemoryEngine, FileMemoryEngineBackend, memoryBackendContract, assertMemoryBackendSearchEquivalence, buildMemoryInstruction, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, deriveRepoControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, MEMORY_ORIGIN_CAUSES, committedOriginOf, originEquals, isInstructionEntry, MEMORY_INSTRUCTION_TEMPLATE, MEMORY_RECALL_DISCIPLINE, MEMORY_PREFERENCE_DISCIPLINE, MEMORY_READONLY_NOTICE, 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_ENGINE_TOOL_NAMES, 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, 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";
133
+ export { MemoryEngine, FileMemoryEngineBackend, memoryBackendContract, assertMemoryBackendSearchEquivalence, buildMemoryInstruction, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, deriveRepoControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, MEMORY_ORIGIN_CAUSES, committedOriginOf, originEquals, ambiguousOriginRepresentation, isInstructionEntry, MEMORY_INSTRUCTION_TEMPLATE, MEMORY_RECALL_DISCIPLINE, MEMORY_PREFERENCE_DISCIPLINE, MEMORY_READONLY_NOTICE, 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_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, 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";
133
134
  export { SHARED_MEMORY_READ_CAP_BYTES, SHARED_MEMORY_LIST_PAGE_SIZE, SharedMemoryStoreError, } from "./core/shared-memory/types.js";
134
135
  export { sharedMemoryStoreContract, } from "./core/shared-memory/contract.js";
135
136
  export { termSet, jaccardDistance, cosineDistance } from "./core/memory-vector.js";
@@ -192,10 +193,11 @@ export { summarizeRedactions } from "./core/untrusted-egress.js";
192
193
  export { MemoryRosterStore, FileRosterStore } from "./agents/roster-store.js";
193
194
  export { CONFIG_CATALOG_VERSION, describeConfigCatalog, resolveEffectiveConfig, } from "./config/catalog.js";
194
195
  export { normalizeAgentName } from "./core/task-registry.js";
196
+ export { DELEGATION_MAX_CONCURRENT_DEFAULT, DELEGATION_MAX_PER_SESSION_DEFAULT, ORPHAN_ADOPT_WINDOW_MS_DEFAULT, ORPHAN_ADOPT_MAX_DEFAULT, SUBAGENT_TRANSCRIPT_RETENTION_DAYS_DEFAULT, } from "./config/defaults.js";
195
197
  export { COORDINATOR_ROLE_PROMPT, TEAMMATE_COMMUNICATION_ADDENDUM, TEAMMATE_TASK_LIST_ADDENDUM } from "./prompts/coordinator.js";
196
- export { createSubagentTool, FORK_SUBAGENT_TYPE, GENERAL_PURPOSE_SUBAGENT_TYPE, agentWhenToUseText, FORK_DIRECTIVE_FRAME, SUBAGENT_SYSTEM_NOTE, } from "./agents/subagent.js";
198
+ export { createSubagentTool, FORK_SUBAGENT_TYPE, GENERAL_PURPOSE_SUBAGENT_TYPE, agentWhenToUseText, FORK_DIRECTIVE_FRAME, SUBAGENT_SYSTEM_NOTE, resolveDelegationEntryCaps, } from "./agents/subagent.js";
197
199
  export { getSessionRetainLedger, releaseSessionRetainLedger, } from "./agents/retain-ledger.js";
198
- export { createSendMessageTool, SEND_MESSAGE_TOOL_NAME } from "./agents/send-message-tool.js";
200
+ export { createSendMessageTool, createAgentContinuationVerb, SEND_MESSAGE_TOOL_NAME } from "./agents/send-message-tool.js";
199
201
  export { createPeerAdmission, peerAdmissionFor, judgePeerAdmission, resolvePeerAdmissionConfig, PEER_ADMISSION_DEFAULTS, PEER_HOP_CHAIN_WINDOW, PEER_MESSAGE_NOTICE, createPeerSelfRef, createPeerInboundChainRef, peerAxisToken, appendHopToken, } from "./agents/peer-admission.js";
200
202
  export { createAgentTranscriptTool, AGENT_TRANSCRIPT_TOOL_NAME, } from "./agents/agent-transcript-tool.js";
201
203
  export { defineAgent } from "./agents/agent-definition.js";
@@ -14,3 +14,4 @@ export type { SessionWriteOptions, CompactionEntry } from "../engine/harness/typ
14
14
  export type { ActiveWorktreeSession, WorkspaceState } from "../engine/harness/types.js";
15
15
  export type { GitAnnouncementKind, GitAnnouncementState } from "../engine/harness/types.js";
16
16
  export type { SessionForkOptions } from "../engine/harness/types.js";
17
+ export type { SessionPlacementRecord, SessionCreateOptions } from "../engine/harness/types.js";