@sema-agent/core 7.64.0 → 7.65.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 (103) hide show
  1. package/CHANGELOG.md +317 -0
  2. package/dist/agents/peer-held-queue.js +1 -1
  3. package/dist/agents/peer-idle.js +1 -1
  4. package/dist/agents/peer-session-drain.js +3 -3
  5. package/dist/agents/subagent.js +5 -2
  6. package/dist/core/auto-promote.d.ts +3 -2
  7. package/dist/core/background-agent-store.d.ts +7 -0
  8. package/dist/core/checkpoint-store.d.ts +2 -3
  9. package/dist/core/context-settings.d.ts +1 -2
  10. package/dist/core/context-settings.js +1 -1
  11. package/dist/core/engine-attestation.d.ts +2 -2
  12. package/dist/core/engine-notice.d.ts +13 -1
  13. package/dist/core/engine-notice.js +3 -1
  14. package/dist/core/file-history-store.d.ts +2 -2
  15. package/dist/core/file-history-store.js +0 -4
  16. package/dist/core/gate-fold.js +3 -1
  17. package/dist/core/governance-codes.d.ts +6 -4
  18. package/dist/core/governance-codes.js +4 -3
  19. package/dist/core/leg-identity.d.ts +18 -2
  20. package/dist/core/leg-identity.js +5 -7
  21. package/dist/core/mailbox-store.d.ts +1 -1
  22. package/dist/core/memory-engine/consolidation.d.ts +10 -4
  23. package/dist/core/memory-engine/consolidation.js +11 -1
  24. package/dist/core/memory-engine/control-objects.d.ts +36 -3
  25. package/dist/core/memory-engine/control-objects.js +134 -12
  26. package/dist/core/memory-engine/control-plane-adoption.d.ts +5 -2
  27. package/dist/core/memory-engine/control-plane-adoption.js +5 -3
  28. package/dist/core/memory-engine/delegation-settlement.d.ts +59 -42
  29. package/dist/core/memory-engine/delegation-settlement.js +175 -202
  30. package/dist/core/memory-engine/dual-root.d.ts +3 -2
  31. package/dist/core/memory-engine/dual-root.js +5 -1
  32. package/dist/core/memory-engine/engine.d.ts +16 -10
  33. package/dist/core/memory-engine/engine.js +138 -145
  34. package/dist/core/memory-engine/file-backend.d.ts +17 -11
  35. package/dist/core/memory-engine/file-backend.js +53 -103
  36. package/dist/core/memory-engine/layout.d.ts +129 -49
  37. package/dist/core/memory-engine/layout.js +202 -82
  38. package/dist/core/memory-engine/memory-age.d.ts +12 -0
  39. package/dist/core/memory-engine/memory-age.js +17 -0
  40. package/dist/core/memory-engine/memory-backend-contract.js +5 -4
  41. package/dist/core/memory-engine/memory-deployment.d.ts +1 -1
  42. package/dist/core/memory-engine/origin-clearance.js +1 -5
  43. package/dist/core/memory-engine/tools.d.ts +2 -2
  44. package/dist/core/memory-engine/tools.js +7 -7
  45. package/dist/core/memory-engine/types.d.ts +16 -10
  46. package/dist/core/memory-vector.d.ts +6 -14
  47. package/dist/core/memory.d.ts +0 -462
  48. package/dist/core/memory.js +0 -333
  49. package/dist/core/permission-rule-consent.d.ts +49 -18
  50. package/dist/core/permission-rule-consent.js +59 -38
  51. package/dist/core/permission-rule-store.d.ts +24 -14
  52. package/dist/core/retention.d.ts +2 -7
  53. package/dist/core/retention.js +0 -1
  54. package/dist/core/runner/classifier-ladder.d.ts +3 -1
  55. package/dist/core/runner/classifier-ladder.js +2 -2
  56. package/dist/core/runner/contracts.d.ts +9 -9
  57. package/dist/core/runner/delegation-owner.d.ts +0 -8
  58. package/dist/core/runner/delegation-owner.js +1 -3
  59. package/dist/core/runner/prepare-gate-stations.d.ts +8 -5
  60. package/dist/core/runner/prepare-gate-stations.js +13 -5
  61. package/dist/core/runner/prepare-memory-engine-session.js +1 -1
  62. package/dist/core/runner/prepare-memory.js +9 -9
  63. package/dist/core/runner/prepare-policy-chain.js +11 -3
  64. package/dist/core/runner/prepare-task.d.ts +5 -1
  65. package/dist/core/runner/prepare-task.js +3 -3
  66. package/dist/core/runner/run-notification-lane.js +1 -1
  67. package/dist/core/runner/sub-agent-deny-lists.d.ts +19 -0
  68. package/dist/core/runner/sub-agent-deny-lists.js +25 -0
  69. package/dist/core/secret-env.d.ts +2 -2
  70. package/dist/core/secret-env.js +6 -20
  71. package/dist/core/session-store.d.ts +6 -6
  72. package/dist/core/session-store.js +3 -3
  73. package/dist/core/store-contracts/background-agent-store-contract.js +13 -0
  74. package/dist/core/task-notification.d.ts +35 -8
  75. package/dist/core/task-notification.js +31 -13
  76. package/dist/core/task-registry-agent.js +1 -0
  77. package/dist/core/task-registry-shared.d.ts +4 -0
  78. package/dist/core/tool-errors.d.ts +3 -3
  79. package/dist/core/tool-spec.d.ts +7 -7
  80. package/dist/core/write-protect.d.ts +16 -0
  81. package/dist/core/write-protect.js +10 -0
  82. package/dist/engine/session/repo-utils.d.ts +14 -4
  83. package/dist/engine/session/repo-utils.js +5 -4
  84. package/dist/index.d.ts +6 -6
  85. package/dist/index.js +6 -6
  86. package/dist/prompts/default.d.ts +1 -2
  87. package/dist/scenarios/full-body.d.ts +1 -1
  88. package/dist/stores/file/adoption/adopt.d.ts +1 -1
  89. package/dist/stores/file/index.d.ts +1 -15
  90. package/dist/stores/file/index.js +1 -15
  91. package/dist/stores/file/permission-rule-store.d.ts +12 -1
  92. package/dist/stores/file/permission-rule-store.js +31 -4
  93. package/dist/stores/file/session-store.js +1 -1
  94. package/package.json +2 -2
  95. package/test/export-surface.snapshot.json +9 -73
  96. package/wire-changes/core-stores-sql@7.65.0.json +30 -0
  97. package/wire-changes/core@7.65.0.json +1650 -0
  98. package/wire-changes/mods-kernel@7.65.0.json +30 -0
  99. package/wire-changes/primitives@7.65.0.json +337 -0
  100. package/dist/core/memory-recall.d.ts +0 -208
  101. package/dist/core/memory-recall.js +0 -136
  102. package/dist/stores/file/memory-store.d.ts +0 -124
  103. package/dist/stores/file/memory-store.js +0 -353
@@ -118,8 +118,9 @@ export declare function mergeHarvestReports(a: HarvestReport, b: HarvestReport):
118
118
  * otherwise, and carries `historyUnknown` when either store that resolved it could not judge its history;
119
119
  * - `evidenceCapability` is `"journal"` only when both are; `custodyState` is the worse of the two
120
120
  * (`damaged` ≻ `capability-absent` ≻ `complete`);
121
- * - each carrier class adds `removed` / `remaining`, and is `unverified` when either store's answer is (or is
122
- * missing); `quarantineUnattributed` / `derivedEntries` add their counts the same way; `replay` is
121
+ * - each carrier class adds `removed` / `remaining` (and `unreadable` when both stores answer it), and is
122
+ * `unverified` when either store's answer is (or is missing); `quarantineUnattributed` / `derivedEntries` add their
123
+ * counts the same way; `replay` is
123
124
  * `"converges"` only when both are; `propagation` stays `"local-store-only"` (every store merged is local).
124
125
  */
125
126
  export declare function mergeErasureAttestations(a: MemoryErasureAttestation, b: MemoryErasureAttestation): MemoryErasureAttestation;
@@ -161,7 +161,11 @@ export function mergeErasureAttestations(a, b) {
161
161
  notFound.set(row.id, unknown ? { id: row.id, historyUnknown: true } : { id: row.id });
162
162
  }
163
163
  const answered = (x) => typeof x === "object" && x !== null && typeof x.removed === "number" && typeof x.remaining === "number";
164
- const carrier = (x, y) => (answered(x) && answered(y) ? { removed: x.removed + y.removed, remaining: x.remaining + y.remaining } : { unverified: true });
164
+ const unreadable = (x, y) => {
165
+ const [p, q] = [Reflect.get(x, "unreadable"), Reflect.get(y, "unreadable")];
166
+ return typeof p === "number" && typeof q === "number" ? { unreadable: p + q } : {};
167
+ };
168
+ const carrier = (x, y) => (answered(x) && answered(y) ? { removed: x.removed + y.removed, remaining: x.remaining + y.remaining, ...unreadable(x, y) } : { unverified: true });
165
169
  const counted = (x) => typeof x === "object" && x !== null && typeof x.count === "number";
166
170
  const count = (x, y) => (counted(x) && counted(y) ? { count: x.count + y.count } : { unverified: true });
167
171
  const custodyRank = { complete: 0, "capability-absent": 1, damaged: 2 };
@@ -1084,9 +1084,9 @@ export declare class MemoryEngine {
1084
1084
  * ignore it exactly as before.
1085
1085
  */
1086
1086
  markSessionPolluted(sessionId: string, reason: string, cause?: import("./types.js").MemoryOriginCause): Promise<SessionPollutionMarkOutcome>;
1087
- /** The session's pollution record (in-process mark first, then the durable marker) — undefined =
1088
- * clean. Reads are side-effect-free. */
1089
- sessionPollution(sessionId: string): SessionPollutionRecord | undefined;
1087
+ /** The session's pollution record (in-process mark first, then the durable marker kept by the
1088
+ * governance store) — undefined = clean. Reads are side-effect-free. */
1089
+ sessionPollution(sessionId: string): Promise<SessionPollutionRecord | undefined>;
1090
1090
  /** design/383 §2.1b — the record carrier (defaults to the file trio over this control dir). */
1091
1091
  private readonly captureRecords;
1092
1092
  /** In-process half of the one-way record: a session opted out in THIS process reads opted-out here
@@ -1271,8 +1271,8 @@ export declare class MemoryEngine {
1271
1271
  * (conflicts reported, replay converges), and the attestation carries
1272
1272
  * `evidenceCapability: "none"` + `custodyState: "capability-absent"` throughout — a silent
1273
1273
  * downgrade is the forbidden shape. The read faces show this lane no carrier beyond the deleted
1274
- * entries, so every store carrier class answers `unverified` (and `replay: "unsupported"`): the
1275
- * degraded lane never answers `complete`. Applied deletes close their lineage rows (the same
1274
+ * entries, so every store carrier class but `quarantineCopy` (its copies deleted by id, {@link eraseQuarantineCopies})
1275
+ * answers `unverified` (and `replay: "unsupported"`): the degraded lane never answers `complete`. Applied deletes close their lineage rows (the same
1276
1276
  * space hygiene the organic tombstone path takes).
1277
1277
  *
1278
1278
  * Authorization: `input.expectedScopes` (the import's seat; contract on its JSDoc). A grant-bearing
@@ -1479,8 +1479,9 @@ export declare class MemoryEngine {
1479
1479
  resolveSettlement(settleId: string, to: "clean" | "external", requestId: string): Promise<void>;
1480
1480
  /** §4.2③ — the hold valve: `"release"` commits the held entry at the next harvest WITH a
1481
1481
  * `"static"`-cause marker (a valve release is not a cleanliness proof); `"discard"` disposes it
1482
- * to quarantine. Audited (requestId required). */
1483
- resolveHold(holdId: string, action: "release" | "discard", requestId: string): void;
1482
+ * to quarantine. Audited (requestId required). Answers a Promise: the verdict is written to the hold ledger through
1483
+ * the governance store; a refused call (`memory.hold_resolve_*`) rejects it. */
1484
+ resolveHold(holdId: string, action: "release" | "discard", requestId: string): Promise<void>;
1484
1485
  /** §3.6 — the session-account valve: close a dangling foreign row WITHOUT adjudication (the
1485
1486
  * residue arm keeps firing until the next full-domain harvest closes normally — a valve close
1486
1487
  * must not launder the window it covers). It also ends the session's leg (no live writer of its
@@ -1488,9 +1489,10 @@ export declare class MemoryEngine {
1488
1489
  resolveSessionAccount(sessionId: string, requestId: string): Promise<void>;
1489
1490
  /** Read face: every delegation settlement row with its folded effective status (host audit). */
1490
1491
  readDelegationSettlements(): Promise<EffectiveSettlement[]>;
1491
- /** Read face: every instruction-hold row (host audit; custody bytes are addressable through
1492
- * `captureName`/`disposition.quarantineName` under the control plane). */
1493
- readInstructionHolds(): HoldRow[];
1492
+ /** Read face: every instruction-hold row (host audit; custody bytes are addressable as the governance store's
1493
+ * `hold` object `captureName`, and a disposed hold's as its `quarantine` object `disposition.quarantineName`). Answers
1494
+ * a Promise: the ledger is read through the governance store. */
1495
+ readInstructionHolds(): Promise<HoldRow[]>;
1494
1496
  /** Read face: the dangling foreign session-account rows a given session would classify residue
1495
1497
  * against (host audit for the §3.6 valve). */
1496
1498
  readDanglingSessionAccounts(selfSessionId: string): Promise<Awaited<ReturnType<typeof foreignDanglingSessionAccounts>>>;
@@ -1954,6 +1956,10 @@ export declare class MemoryEngine {
1954
1956
  /** {@link refuseOutsideStore} as a value, for a site whose failure lane is a report row rather than a
1955
1957
  * throw: the refusal's text, or `undefined` when the act may proceed. */
1956
1958
  private storeActRefusedText;
1959
+ /** Contain the suspect file at `path` (its already-read `content`): keep its copy among the governance store's
1960
+ * `quarantine` objects, then — the anchor read again after that await, at the act — take it off the plane
1961
+ * ({@link clearContainedPath}). A refused act leaves the path untouched and says why in `detail`. */
1962
+ private containSuspect;
1957
1963
  /** The memory dir against its anchor ({@link anchorStoreRoot}), read every time: at every mount and at the head
1958
1964
  * of every face acting on the memory dir itself; answers the anchored root. With a `handle`, its mount root
1959
1965
  * must be the anchored one too (a handle mounted before a re-anchor names a tree the store no longer has). */