@sema-agent/core 7.61.0 → 7.62.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.
- package/CHANGELOG.md +312 -0
- package/dist/agents/cascade.d.ts +11 -3
- package/dist/agents/cascade.js +1 -1
- package/dist/agents/peer-held-queue.d.ts +27 -4
- package/dist/agents/peer-held-queue.js +81 -36
- package/dist/agents/peer-session-drain.js +13 -3
- package/dist/agents/subagent.d.ts +6 -1
- package/dist/agents/subagent.js +66 -12
- package/dist/agents/suspend-guard.d.ts +38 -16
- package/dist/agents/suspend-guard.js +9 -4
- package/dist/agents/verify.js +4 -3
- package/dist/core/checkpoint-features.d.ts +722 -0
- package/dist/core/checkpoint-features.js +98 -0
- package/dist/core/checkpoint-requirements.d.ts +9 -2
- package/dist/core/checkpoint-requirements.js +9 -4
- package/dist/core/checkpoint-row-verdict.d.ts +99 -0
- package/dist/core/checkpoint-row-verdict.js +225 -0
- package/dist/core/checkpoint-store.d.ts +55 -745
- package/dist/core/checkpoint-store.js +39 -141
- package/dist/core/engine-notice.d.ts +19 -3
- package/dist/core/engine-notice.js +9 -2
- package/dist/core/gate-fold.js +2 -2
- package/dist/core/governance-codes.d.ts +3 -1
- package/dist/core/governance-codes.js +3 -0
- package/dist/core/hooks.d.ts +13 -0
- package/dist/core/human-input-projection.d.ts +1 -0
- package/dist/core/human-input-projection.js +3 -0
- package/dist/core/image-admission.d.ts +1 -1
- package/dist/core/locked-config.d.ts +2 -2
- package/dist/core/mcp-host-seat.js +6 -1
- package/dist/core/memory-engine/consolidation-driver.d.ts +1 -1
- package/dist/core/memory-vector.d.ts +1 -1
- package/dist/core/memory.d.ts +10 -10
- package/dist/core/mode-policy.js +1 -1
- package/dist/core/mods/classic-events.d.ts +9 -1
- package/dist/core/mods/dollar.d.ts +32 -1
- package/dist/core/mods/dollar.js +13 -1
- package/dist/core/mods/kernel/events.d.ts +11 -3
- package/dist/core/mods/kernel/events.js +13 -10
- package/dist/core/mods/lifecycle-stations.d.ts +36 -4
- package/dist/core/mods/lifecycle-stations.js +44 -9
- package/dist/core/mods/session-append.d.ts +4 -1
- package/dist/core/mods/session-append.js +7 -0
- package/dist/core/mods/session-receive.js +12 -15
- package/dist/core/mods/stations.d.ts +51 -6
- package/dist/core/mods/stations.js +124 -0
- package/dist/core/own-property-receipt.d.ts +7 -0
- package/dist/core/own-property-receipt.js +3 -0
- package/dist/core/read-root-candidate.js +1 -1
- package/dist/core/resume-startup-cause.d.ts +5 -4
- package/dist/core/runner/compact-session.js +5 -2
- package/dist/core/runner/contracts.d.ts +18 -8
- package/dist/core/runner/delegation-owner.d.ts +43 -0
- package/dist/core/runner/delegation-owner.js +59 -0
- package/dist/core/runner/lineage-reroot-view.d.ts +56 -0
- package/dist/core/runner/lineage-reroot-view.js +108 -0
- package/dist/core/runner/permission-rule-lanes.d.ts +2 -1
- package/dist/core/runner/permission-rule-lanes.js +2 -2
- package/dist/core/runner/person-path-rows.d.ts +15 -0
- package/dist/core/runner/person-path-rows.js +26 -3
- package/dist/core/runner/prepare-acquire-reconcile.d.ts +4 -1
- package/dist/core/runner/prepare-acquire-reconcile.js +7 -2
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +1 -0
- package/dist/core/runner/prepare-caps-and-workflow.js +1 -1
- package/dist/core/runner/prepare-config-doors.d.ts +6 -6
- package/dist/core/runner/prepare-config-doors.js +3 -4
- package/dist/core/runner/prepare-hands-readface.d.ts +1 -1
- package/dist/core/runner/prepare-hands-readface.js +28 -7
- package/dist/core/runner/prepare-inherited-gate.d.ts +2 -0
- package/dist/core/runner/prepare-inherited-gate.js +7 -3
- package/dist/core/runner/prepare-task.js +10 -7
- package/dist/core/runner/resume-admission.d.ts +3 -3
- package/dist/core/runner/resume-admission.js +6 -3
- package/dist/core/runner/resume-apply.d.ts +4 -0
- package/dist/core/runner/resume-apply.js +11 -4
- package/dist/core/runner/resume-checkpoint-screen.d.ts +9 -0
- package/dist/core/runner/resume-checkpoint-screen.js +4 -84
- package/dist/core/runner/run-git-lane.d.ts +2 -0
- package/dist/core/runner/run-git-lane.js +4 -1
- package/dist/core/runner/run-harness-handlers.d.ts +2 -0
- package/dist/core/runner/run-harness-handlers.js +3 -2
- package/dist/core/runner/run-leg.js +24 -7
- package/dist/core/runner/run-settle-and-teardown.js +3 -2
- package/dist/core/runner/run-stop-and-final-verify.js +2 -1
- package/dist/core/runner/run-turn-boundary.js +7 -4
- package/dist/core/runner/runtask.js +6 -6
- package/dist/core/runner/steering-preview.d.ts +9 -0
- package/dist/core/runner/steering-preview.js +5 -0
- package/dist/core/runner/stream-steer-verb.js +8 -0
- package/dist/core/runner/tool-face-overlay.js +2 -0
- package/dist/core/runner/turn-attachments.d.ts +5 -0
- package/dist/core/runner/turn-attachments.js +1 -1
- package/dist/core/runner-deps.d.ts +2 -2
- package/dist/core/secret-env.d.ts +8 -5
- package/dist/core/secret-env.js +37 -18
- package/dist/core/session-store.d.ts +1 -1
- package/dist/core/session-store.js +5 -1
- package/dist/core/session.d.ts +14 -4
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +6 -0
- package/dist/core/store-contracts/checkpoint-store-contract.js +68 -0
- package/dist/core/store-contracts/session-store-contract.js +22 -8
- package/dist/core/task-event.d.ts +7 -1
- package/dist/core/task-notification.js +2 -1
- package/dist/core/task-registry-agent.d.ts +27 -7
- package/dist/core/task-registry-agent.js +12 -5
- package/dist/core/task-registry-shared.d.ts +7 -0
- package/dist/core/task-registry-workflow.js +4 -3
- package/dist/core/task-registry.d.ts +13 -2
- package/dist/core/task-registry.js +11 -4
- package/dist/core/task-result.d.ts +5 -5
- package/dist/core/task-spec.d.ts +1 -1
- package/dist/core/terminal-cause.d.ts +6 -6
- package/dist/core/tool-face.d.ts +6 -2
- package/dist/core/tool-face.js +1 -1
- package/dist/core/tool-policy.d.ts +2 -1
- package/dist/core/tool-roster.d.ts +4 -4
- package/dist/core/tool-spec.d.ts +4 -0
- package/dist/core/types.d.ts +1 -1
- package/dist/core/types.js +1 -1
- package/dist/engine/execution-env/node-execution-env.d.ts +3 -0
- package/dist/engine/execution-env/node-execution-env.js +12 -5
- package/dist/engine/harness/types.d.ts +11 -0
- package/dist/engine/session/parent-chain-guard.d.ts +3 -3
- package/dist/engine/session/parent-chain-guard.js +1 -1
- package/dist/engine/session/path-to-root.d.ts +18 -3
- package/dist/engine/session/path-to-root.js +15 -1
- package/dist/engine/session/repo-utils.d.ts +12 -1
- package/dist/engine/session/repo-utils.js +41 -0
- package/dist/engine/session/session.js +1 -1
- package/dist/engine/session/storage-base.d.ts +20 -0
- package/dist/engine/session/storage-base.js +28 -9
- package/dist/index.d.ts +9 -8
- package/dist/index.js +4 -4
- package/dist/internal/harness.d.ts +4 -3
- package/dist/internal/harness.js +3 -2
- package/dist/orchestration/run-workflow-tool.d.ts +3 -0
- package/dist/orchestration/run-workflow-tool.js +27 -11
- package/dist/orchestration/workflow-governance.d.ts +1 -1
- package/dist/orchestration/workflow.d.ts +3 -0
- package/dist/orchestration/workflow.js +2 -7
- package/dist/stores/file/checkpoint-store.d.ts +2 -0
- package/dist/stores/file/checkpoint-store.js +7 -6
- package/dist/stores/file/fs-atomic.d.ts +0 -22
- package/dist/stores/file/fs-atomic.js +0 -17
- package/dist/stores/file/index.d.ts +2 -9
- package/dist/stores/file/index.js +2 -4
- package/dist/stores/file/session-store.d.ts +13 -7
- package/dist/stores/file/session-store.js +40 -17
- package/dist/tools/fs/bash-program-position.d.ts +3 -2
- package/dist/tools/fs/bash-program-position.js +7 -7
- package/dist/tools/fs/removal-targets.js +2 -2
- package/dist/tools/fs/shell-read-argv.d.ts +4 -2
- package/dist/tools/fs/shell-read-argv.js +14 -3
- package/dist/tools/fs/shell-read-bindings.d.ts +18 -2
- package/dist/tools/fs/shell-read-bindings.js +148 -68
- package/dist/tools/fs/shell-read-check.js +20 -4
- package/dist/tools/fs/shell-read-establish.js +22 -8
- package/dist/tools/fs/shell-read-functions.js +2 -2
- package/dist/tools/fs/shell-read-object-path.d.ts +59 -0
- package/dist/tools/fs/shell-read-object-path.js +119 -0
- package/dist/tools/fs/shell-read-plan.d.ts +8 -0
- package/dist/tools/fs/shell-read-plan.js +47 -30
- package/dist/tools/fs/shell-read-start.d.ts +66 -13
- package/dist/tools/fs/shell-read-start.js +89 -17
- package/dist/tools/fs/shell-read-workdir.d.ts +29 -8
- package/dist/tools/fs/shell-read-workdir.js +31 -8
- package/package.json +2 -2
- package/test/export-surface.snapshot.json +21 -33
- package/wire-changes/core-stores-sql@7.62.0.json +30 -0
- package/wire-changes/core@7.62.0.json +2181 -0
- package/wire-changes/mods-kernel@7.62.0.json +42 -0
- package/wire-changes/primitives@7.62.0.json +30 -0
- package/dist/core/consolidate-scope.d.ts +0 -93
- package/dist/core/consolidate-scope.js +0 -98
- package/dist/core/runner/memory-consolidation.d.ts +0 -109
- package/dist/core/runner/memory-consolidation.js +0 -251
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { SessionError, type ReplayLoss } from "../harness/types.js";
|
|
2
|
+
export type { ReplayLoss };
|
|
1
3
|
/** The fork point a store copies up to: `{}` is the whole log, `{ entryId, position: "at" }` the path from the root down to that entry. It is the answer
|
|
2
4
|
* `settledForkOptions` gives, and the question `selectForkRows` takes. */
|
|
3
5
|
export interface ForkPoint {
|
|
@@ -10,10 +12,23 @@ export interface ParentLinks<T> {
|
|
|
10
12
|
idOf(row: T): string;
|
|
11
13
|
parentOf(row: T): string | null | undefined;
|
|
12
14
|
}
|
|
15
|
+
/** The one sentence of a {@link ReplayLoss}, for every refusal and notice that states it. */
|
|
16
|
+
export declare function replayLossText(loss: ReplayLoss): string;
|
|
17
|
+
/**
|
|
18
|
+
* The refusal of a walk that met a parent the log does not hold: `childId` names `missingParentId` as its parent. The stored log does not hold
|
|
19
|
+
* together, so it is `corrupt_session`; it says where it broke, and `replayLoss` — what the replay that loaded the log dropped, when it dropped
|
|
20
|
+
* any — is the evidence that the missing parent may be one of the records the replay could not read.
|
|
21
|
+
*/
|
|
22
|
+
export declare class LineageBreak extends SessionError {
|
|
23
|
+
readonly missingParentId: string;
|
|
24
|
+
readonly childId: string;
|
|
25
|
+
readonly replayLoss?: ReplayLoss | undefined;
|
|
26
|
+
constructor(missingParentId: string, childId: string, replayLoss?: ReplayLoss | undefined);
|
|
27
|
+
}
|
|
13
28
|
/**
|
|
14
29
|
* The one walk up a log's parent chain: the rows from the root down to `start`, root first. The chain ends at a row with no parent, or at `floorId`
|
|
15
|
-
* (a bounded window's root — its parent is not required to exist). A parent the log does not hold is
|
|
16
|
-
* returns to a row it already stood on is refused by the shared guard
|
|
30
|
+
* (a bounded window's root — its parent is not required to exist). A parent the log does not hold is a {@link LineageBreak} naming it, a chain that
|
|
31
|
+
* returns to a row it already stood on is refused by the shared guard — both `corrupt_session`; neither is followed.
|
|
17
32
|
*/
|
|
18
33
|
export declare function pathToRoot<T>(start: T, links: ParentLinks<T>, floorId?: string | null): T[];
|
|
19
34
|
/** How a log row is read by `selectForkRows`: its entry id and its parent's (`null` = a root). */
|
|
@@ -28,7 +43,7 @@ export interface ForkRowShape<R> {
|
|
|
28
43
|
* branches stay behind) and the leaf is that entry. The rows keep their order.
|
|
29
44
|
*
|
|
30
45
|
* Refusals are the engine's, word for word: a fork point the log does not hold is `invalid_fork_target`, a parent missing part-way up the path (an empty
|
|
31
|
-
* parent id included) or a chain that returns to a row it stood on is `
|
|
46
|
+
* parent id included) or a chain that returns to a row it stood on is `corrupt_session` (the sentence `getPathToRoot` gives), and a fork point that
|
|
32
47
|
* names an entry with a `position` other than `at` is refused `invalid_fork_target` — rows are copied only for the point the judge answers. A point with
|
|
33
48
|
* no entry id is the whole-log form whatever else it carries, as `getEntriesToFork` reads it.
|
|
34
49
|
*/
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import { SessionError } from "../harness/types.js";
|
|
2
2
|
import { ParentChainGuard } from "./parent-chain-guard.js";
|
|
3
|
+
export function replayLossText(loss) {
|
|
4
|
+
return `${loss.dropped} of ${loss.total} records skipped as corrupt`;
|
|
5
|
+
}
|
|
6
|
+
export class LineageBreak extends SessionError {
|
|
7
|
+
missingParentId;
|
|
8
|
+
childId;
|
|
9
|
+
replayLoss;
|
|
10
|
+
constructor(missingParentId, childId, replayLoss) {
|
|
11
|
+
super("corrupt_session", `Entry ${missingParentId} not found — ${childId} names it as its parent and the log does not hold it${replayLoss !== undefined ? ` (${replayLossText(replayLoss)})` : ""}`);
|
|
12
|
+
this.missingParentId = missingParentId;
|
|
13
|
+
this.childId = childId;
|
|
14
|
+
this.replayLoss = replayLoss;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
3
17
|
export function pathToRoot(start, links, floorId) {
|
|
4
18
|
const path = [];
|
|
5
19
|
const chain = new ParentChainGuard();
|
|
@@ -15,7 +29,7 @@ export function pathToRoot(start, links, floorId) {
|
|
|
15
29
|
break;
|
|
16
30
|
const parent = parentId === "" ? undefined : links.read(parentId);
|
|
17
31
|
if (parent === undefined) {
|
|
18
|
-
throw new
|
|
32
|
+
throw new LineageBreak(parentId, id);
|
|
19
33
|
}
|
|
20
34
|
current = parent;
|
|
21
35
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SessionError, type SessionHead, type SessionLogMark, type SessionMetadata, type SessionRowExpectation, type SessionStorage, type SessionTreeEntry } from "../harness/types.js";
|
|
1
|
+
import { SessionError, type SessionHead, type SessionLogMark, type SessionMetadata, type SessionPlacementRecord, type SessionRowExpectation, type SessionStorage, type SessionTreeEntry } from "../harness/types.js";
|
|
2
2
|
import type { Session } from "../harness/types.js";
|
|
3
3
|
export declare function createSessionId(): string;
|
|
4
4
|
/** The {@link SessionMetadata.incarnation} cell for a write laying a row's metadata down — the bundled repos' ONE mint point.
|
|
@@ -52,6 +52,17 @@ export declare function importRowCells(sessionId: string, owner: unknown, existi
|
|
|
52
52
|
* there but is neither (a blank string included) cannot be read as anyone's, and reading it as anonymous would admit every
|
|
53
53
|
* principal — the row is refused as `corrupt_session` instead (a read fault, never an answer). */
|
|
54
54
|
export declare function readOwnerCell(raw: unknown, sessionId: string): string | null;
|
|
55
|
+
/** The one decoding of a stored {@link SessionMetadata.placement} cell read back by a backend (header line, SQL column): `undefined` is no
|
|
56
|
+
* placement; an object whose `kind` is a placement kind, whose `placedAt` is a finite number and whose `scope`, `handle`, `rootSessionId`
|
|
57
|
+
* and `parentSessionId` are each a string when there is the tuple, answered as stored (a tuple missing a join half is a legal tuple,
|
|
58
|
+
* read by consumers as incomplete; a member this reader does not know is an additive one an older reader tolerates). Anything else —
|
|
59
|
+
* no object, `null` (a backend whose absent cell reads `null` maps it to `undefined` first), a kind outside the set, a member of the
|
|
60
|
+
* wrong form — is neither a placement nor none: the row is refused `corrupt_session`, naming the cell and never the value. */
|
|
61
|
+
export declare function readPlacementCell(raw: unknown, sessionId: string): SessionPlacementRecord | undefined;
|
|
62
|
+
/** The placement cell a write that lays a row down records: `given` (`undefined` is none), its `placedAt` stamped with `now` when it names
|
|
63
|
+
* none, judged by the very judgment {@link readPlacementCell} reads back with — so no row is written that a reader would refuse. A tuple
|
|
64
|
+
* that fails it is refused before anything is written, `config.invalid_argument`, naming the cell and never the value. */
|
|
65
|
+
export declare function placementCellToWrite(given: unknown, sessionId: string, now: number): SessionPlacementRecord | undefined;
|
|
55
66
|
/** A fork lands on a row OTHER than its source: onto its own id it would mint a new occupant over the source's transcript and erase the lineage that carries the source's records. */
|
|
56
67
|
export declare function assertForkTarget(sourceId: string, targetId: string | undefined): void;
|
|
57
68
|
/** A fork row's cells, minted from the SOURCE row as it stands at fork time — the same row the fork copies its history from: the lineage
|
|
@@ -2,6 +2,7 @@ import { SessionError, } from "../harness/types.js";
|
|
|
2
2
|
import { StoredSession } from "./session.js";
|
|
3
3
|
import { uuidv7 } from "./uuid.js";
|
|
4
4
|
import { principalNameFault, principalNameOf } from "../../core/principal-name.js";
|
|
5
|
+
import { receiptRefusal } from "../../core/own-property-receipt.js";
|
|
5
6
|
import { randomUUID } from "node:crypto";
|
|
6
7
|
export function createSessionId() {
|
|
7
8
|
return uuidv7();
|
|
@@ -107,6 +108,46 @@ export function readOwnerCell(raw, sessionId) {
|
|
|
107
108
|
return name;
|
|
108
109
|
throw new SessionError("corrupt_session", `session ${sessionId}'s owner cell holds ${notAnOwnerShape(raw)} — neither an owner nor anonymous; refusing to read the row`);
|
|
109
110
|
}
|
|
111
|
+
const PLACEMENT_KINDS = ["subagent"];
|
|
112
|
+
const PLACEMENT_STRING_MEMBERS = ["scope", "parentSessionId", "rootSessionId", "handle"];
|
|
113
|
+
function isPlacementKind(raw) {
|
|
114
|
+
return PLACEMENT_KINDS.some((kind) => kind === raw);
|
|
115
|
+
}
|
|
116
|
+
function placementFaultSentence(sessionId, fault) {
|
|
117
|
+
const { cell, held, expected } = fault;
|
|
118
|
+
const shape = held === null ? "null" : Array.isArray(held) ? "an array" : held === "" ? "an empty string" : `a ${typeof held}`;
|
|
119
|
+
return `session ${sessionId}'s ${cell} ${held === undefined ? "is not there" : `holds ${shape}`} — ${expected}`;
|
|
120
|
+
}
|
|
121
|
+
function judgePlacementCell(raw) {
|
|
122
|
+
if (raw === undefined)
|
|
123
|
+
return { placement: undefined };
|
|
124
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw))
|
|
125
|
+
return { fault: { cell: "placement cell", held: raw, expected: "a placement is a tuple (an object) or not there at all" } };
|
|
126
|
+
const cell = { ...raw };
|
|
127
|
+
const { kind, placedAt } = cell;
|
|
128
|
+
if (!isPlacementKind(kind))
|
|
129
|
+
return { fault: { cell: "placement.kind", held: kind, expected: `a placement names one of its kinds (${PLACEMENT_KINDS.join(", ")})` } };
|
|
130
|
+
for (const member of PLACEMENT_STRING_MEMBERS) {
|
|
131
|
+
if (cell[member] !== undefined && typeof cell[member] !== "string")
|
|
132
|
+
return { fault: { cell: `placement.${member}`, held: cell[member], expected: "a string when there" } };
|
|
133
|
+
}
|
|
134
|
+
if (typeof placedAt !== "number" || !Number.isFinite(placedAt))
|
|
135
|
+
return { fault: { cell: "placement.placedAt", held: placedAt, expected: "a finite number (epoch ms)" } };
|
|
136
|
+
return { placement: { ...cell, kind, placedAt } };
|
|
137
|
+
}
|
|
138
|
+
export function readPlacementCell(raw, sessionId) {
|
|
139
|
+
const judged = judgePlacementCell(raw);
|
|
140
|
+
if ("fault" in judged)
|
|
141
|
+
throw new SessionError("corrupt_session", `${placementFaultSentence(sessionId, judged.fault)}; refusing to read the row`);
|
|
142
|
+
return judged.placement;
|
|
143
|
+
}
|
|
144
|
+
export function placementCellToWrite(given, sessionId, now) {
|
|
145
|
+
const tuple = typeof given === "object" && given !== null && !Array.isArray(given);
|
|
146
|
+
const judged = judgePlacementCell(tuple ? { ...given, placedAt: given["placedAt"] ?? now } : given);
|
|
147
|
+
if ("fault" in judged)
|
|
148
|
+
throw receiptRefusal(`${placementFaultSentence(sessionId, judged.fault)}; refused before anything was written`);
|
|
149
|
+
return judged.placement;
|
|
150
|
+
}
|
|
110
151
|
export function assertForkTarget(sourceId, targetId) {
|
|
111
152
|
if (targetId === sourceId)
|
|
112
153
|
throw new SessionError("invalid_fork_target", `cannot fork session ${sourceId} onto its own id — fork into a new id`);
|
|
@@ -81,7 +81,7 @@ export function buildSessionContext(pathEntries, opts) {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
if (!foundFirstKept) {
|
|
84
|
-
throw new SessionError("
|
|
84
|
+
throw new SessionError("corrupt_session", `Compaction ${compaction.id} firstKeptEntryId (${compaction.firstKeptEntryId}) not found before the compaction entry — session may be corrupt or need migration`);
|
|
85
85
|
}
|
|
86
86
|
for (let i = compactionIdx + 1; i < pathEntries.length; i++) {
|
|
87
87
|
appendMessage(pathEntries[i]);
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { type LeafEntry, type SessionLogMark, type SessionMetadata, type SessionStorage, type SessionTreeEntry, type SessionWriteOptions } from "../harness/types.js";
|
|
2
|
+
import { type ParentLinks, type ReplayLoss } from "./path-to-root.js";
|
|
3
|
+
/** How a session log's entries link to their parents — one reading for every walk over a storage's entries: an empty parent id reads as "no
|
|
4
|
+
* parent" here, as it always has (#2244 tracks reading it as a refusal). */
|
|
5
|
+
export declare function entryParentLinks(byId: {
|
|
6
|
+
get(id: string): SessionTreeEntry | undefined;
|
|
7
|
+
}): ParentLinks<SessionTreeEntry>;
|
|
2
8
|
/** Return the effective branch leaf after applying a session tree entry. */
|
|
3
9
|
export declare function leafIdAfterEntry(entry: SessionTreeEntry): string | null;
|
|
4
10
|
/** A log's {@link SessionLogMark}: its length and its last entry's id — the one reading of the mark, for the reader that marks a log it
|
|
@@ -14,11 +20,25 @@ export declare abstract class BaseSessionStorage<TMetadata extends SessionMetada
|
|
|
14
20
|
private readonly labelsById;
|
|
15
21
|
private leafId;
|
|
16
22
|
private readonly floorId;
|
|
23
|
+
private readonly replayLoss;
|
|
24
|
+
/**
|
|
25
|
+
* The storage of one loaded log. Its leaf (`leafId`, the leaf after the log's last entry unless the backend states its head) and its floor
|
|
26
|
+
* (`opts.floorEntryId`) must name entries the log holds: a load that does not is a stored log that does not hold together, refused
|
|
27
|
+
* `corrupt_session`. `opts.replayLoss` = what the replay that read the log dropped (absent = it dropped nothing): the refusals of this storage
|
|
28
|
+
* state it, and a walk that breaks at a parent the log does not hold carries it ({@link LineageBreak}).
|
|
29
|
+
*/
|
|
17
30
|
protected constructor(metadata: TMetadata, entries: SessionTreeEntry[], leafId?: string | null, opts?: {
|
|
18
31
|
floorEntryId?: string | null;
|
|
32
|
+
replayLoss?: ReplayLoss;
|
|
19
33
|
});
|
|
34
|
+
/** ` (N of M records skipped as corrupt)` when the replay that read this log dropped records, else empty. */
|
|
35
|
+
private lostText;
|
|
36
|
+
/** The log's leaf must name an entry the log holds — at load, and after a leaf entry a write appended (the same stored fact either way). */
|
|
37
|
+
private assertLeafHeld;
|
|
20
38
|
/** The bounded-window root this storage was woken with, or null for a full-tree load (F3). */
|
|
21
39
|
getFloorId(): string | null;
|
|
40
|
+
/** What the replay that read this log dropped (`undefined` = it dropped nothing): the account a run that continues the session gives the person. */
|
|
41
|
+
getReplayLoss(): ReplayLoss | undefined;
|
|
22
42
|
getMetadata(): Promise<TMetadata>;
|
|
23
43
|
getLeafId(): Promise<string | null>;
|
|
24
44
|
/** The log's mark ({@link sessionLogMarkOf}) as it stands at this instant, read synchronously: for a repo judging a row and writing it in
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { SessionError, } from "../harness/types.js";
|
|
2
|
-
import { pathToRoot } from "./path-to-root.js";
|
|
2
|
+
import { LineageBreak, pathToRoot, replayLossText } from "./path-to-root.js";
|
|
3
3
|
import { uuidv7 } from "./uuid.js";
|
|
4
|
+
export function entryParentLinks(byId) {
|
|
5
|
+
return { read: (id) => byId.get(id), idOf: (entry) => entry.id, parentOf: (entry) => entry.parentId || null };
|
|
6
|
+
}
|
|
4
7
|
function updateLabelCache(labelsById, entry) {
|
|
5
8
|
if (entry.type !== "label") {
|
|
6
9
|
return;
|
|
@@ -49,6 +52,7 @@ export class BaseSessionStorage {
|
|
|
49
52
|
labelsById;
|
|
50
53
|
leafId;
|
|
51
54
|
floorId;
|
|
55
|
+
replayLoss;
|
|
52
56
|
constructor(metadata, entries, leafId = resolveLeafId(entries), opts) {
|
|
53
57
|
this.metadata = metadata;
|
|
54
58
|
this.entries = entries;
|
|
@@ -56,23 +60,31 @@ export class BaseSessionStorage {
|
|
|
56
60
|
this.labelsById = buildLabelsById(entries);
|
|
57
61
|
this.leafId = leafId;
|
|
58
62
|
this.floorId = opts?.floorEntryId ?? null;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
63
|
+
this.replayLoss = opts?.replayLoss !== undefined && opts.replayLoss.dropped > 0 ? opts.replayLoss : undefined;
|
|
64
|
+
this.assertLeafHeld();
|
|
62
65
|
if (this.floorId !== null && !this.byId.has(this.floorId)) {
|
|
63
|
-
throw new SessionError("
|
|
66
|
+
throw new SessionError("corrupt_session", `Floor entry ${this.floorId} not loaded — the bounded window names a floor the loaded log does not hold${this.lostText()}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
lostText() {
|
|
70
|
+
return this.replayLoss !== undefined ? ` (${replayLossText(this.replayLoss)})` : "";
|
|
71
|
+
}
|
|
72
|
+
assertLeafHeld() {
|
|
73
|
+
if (this.leafId !== null && !this.byId.has(this.leafId)) {
|
|
74
|
+
throw new SessionError("corrupt_session", `Entry ${this.leafId} not found — the log's leaf names an entry the log does not hold${this.lostText()}`);
|
|
64
75
|
}
|
|
65
76
|
}
|
|
66
77
|
getFloorId() {
|
|
67
78
|
return this.floorId;
|
|
68
79
|
}
|
|
80
|
+
getReplayLoss() {
|
|
81
|
+
return this.replayLoss;
|
|
82
|
+
}
|
|
69
83
|
async getMetadata() {
|
|
70
84
|
return this.metadata;
|
|
71
85
|
}
|
|
72
86
|
async getLeafId() {
|
|
73
|
-
|
|
74
|
-
throw new SessionError("invalid_session", `Entry ${this.leafId} not found`);
|
|
75
|
-
}
|
|
87
|
+
this.assertLeafHeld();
|
|
76
88
|
return this.leafId;
|
|
77
89
|
}
|
|
78
90
|
logMarkNow() {
|
|
@@ -121,7 +133,14 @@ export class BaseSessionStorage {
|
|
|
121
133
|
if (!leaf) {
|
|
122
134
|
throw new SessionError("not_found", `Entry ${leafId} not found`);
|
|
123
135
|
}
|
|
124
|
-
|
|
136
|
+
try {
|
|
137
|
+
return pathToRoot(leaf, entryParentLinks(this.byId), this.floorId);
|
|
138
|
+
}
|
|
139
|
+
catch (err) {
|
|
140
|
+
if (err instanceof LineageBreak && this.replayLoss !== undefined)
|
|
141
|
+
throw new LineageBreak(err.missingParentId, err.childId, this.replayLoss);
|
|
142
|
+
throw err;
|
|
143
|
+
}
|
|
125
144
|
}
|
|
126
145
|
async getEntries() {
|
|
127
146
|
return [...this.entries];
|
package/dist/index.d.ts
CHANGED
|
@@ -72,6 +72,7 @@ export { askUnresolvableNotice, type AskUnresolvableFacts } from "./core/ask-unr
|
|
|
72
72
|
export { ASK_UNRESOLVABLE_CAUSES } from "./core/ask-unresolvable-notice.js";
|
|
73
73
|
export { APPROVAL_REMEDY_KINDS, type ApprovalRemedy, type ApprovalRemedyKind } from "./core/ask-origin.js";
|
|
74
74
|
export { USER_INPUT_UNDRAINED_CAUSES, type UserInputUndrainedCause, USER_INPUT_UNDRAINED_FAMILIES } from "./core/engine-notice.js";
|
|
75
|
+
export { setDefaultEngineNoticeSeat } from "./core/engine-notice.js";
|
|
75
76
|
export { STEER_REPLAY_FACETS, type SteerReplayFacet } from "./core/steer-replay.js";
|
|
76
77
|
export { TOOL_TURN_INCOMPLETE_CAUSES, type ToolTurnIncompleteCause } from "./internal/llm.js";
|
|
77
78
|
export { MODEL_OUTPUT_INVALID_CAUSES, type ModelOutputInvalidCause, type ModelOutputInvalid, type OutputLimit } from "./internal/llm.js";
|
|
@@ -134,11 +135,12 @@ export { deploymentFaceClampNotice, resolveContainmentFace, type ContainmentFace
|
|
|
134
135
|
export { WRITE_PROTECTED_DEFAULT_TABLE, resolveWriteProtectedTable, compileWriteProtection, type WriteProtectedEntry, type WriteProtectedRow, type WriteProtectedKind, type WriteProtectedHit, type WriteProtectionMatcher, type WriteProtectionVerdict, type WriteProtectionViewAbsence, type WriteProtectionJudgeContext, type WriteProtectionCompileOptions, type WriteProtectionCheck, WRITE_PROTECTION_TARGET_VIEWS, type WriteProtectionTargetView, type WriteProtectionMount, } from "./core/write-protect.js";
|
|
135
136
|
export { InMemoryToolResultStore, OFFLOAD_TOOL_NAME, DEFAULT_TOOL_RESULT_THRESHOLD_CHARS, assertSafeToolResultRef, buildToolResultRef, toolResultContentSegment, MAX_MINTED_TOOL_RESULT_REF_CHARS, type ToolResultProvenance, assertToolResultProvenanceMatch, normalizeToolResultProvenance, toolResultProvenanceOf, ToolResultRefConflictError, TOOL_RESULT_REF_CONFLICT_CODE, type ToolResultStore, type ToolResultSlice, type ToolResultDeletionReport, type ToolResultSessionListing, type ToolResultListedEntry, } from "./core/tool-result-store.js";
|
|
136
137
|
export { InMemoryCheckpointStore, CheckpointError, mintCheckpointId, mintCheckpointToken, checkpointVersionOf, CURRENT_CHECKPOINT_VERSION, MAX_SUPPORTED_CHECKPOINT_VERSION, ORG_ADMISSION_CHECKPOINT_VERSION, F012_CHECKPOINT_VERSION, REAL_APPROVAL_CHECKPOINT_VERSION, RESOURCE_CHECKPOINT_VERSION, TOKEN_CHECKPOINT_VERSION, debitLedger, remainingBudgetMicroUsd, remainingTokens, winnerFromOutcome, validatePendingSteer, readPendingSteerQueue, appendPendingSteer, judgeParkedSteerRepeat, // #2705 — the queue's one identity judgment (append and the wake entrance read it)
|
|
137
|
-
MAX_PENDING_STEER_CHARS, MAX_PENDING_STEER_ENTRIES, PENDING_STEER_QUEUE_BYTE_BUDGET_BYTES, PENDING_STEER_FROZEN_FIELDS, ACTOR_ASSERTION_FROZEN_FIELDS, MAX_ACTOR_FIELD_CHARS, MAX_STEER_INPUT_ID_CHARS, type ActorAssertion, type PendingSteerEntry, type PendingSteerInput, riskSeverity, buildRiskDescriptor, summarizeCheckpoint, type RiskDescriptor, type ProbeCause, type ProbeCauseOperands, type CheckpointStore, type CheckpointSummary, type Checkpoint, type CheckpointToken, type CheckpointGate, type CheckpointState, type SerializedCheckpointState, type CheckpointFaultMode, type PendingAction, type ResumeOutcome, type ResolvedOutcome, type ReopenReason, type ResolveExpectation, type TerminalClaimIntent, type TerminalClaimOutcome, type SafetyAxis, type RealApprovalGateBit, type ResourceLedger, type ResourceLimitReason, type PlatformLimitReason, type CheckpointRow, realApprovalOrgFact, resolveCheckpointStore, checkpointStoreIncomplete, } from "./core/checkpoint-store.js";
|
|
138
|
+
MAX_PENDING_STEER_CHARS, MAX_PENDING_STEER_ENTRIES, PENDING_STEER_QUEUE_BYTE_BUDGET_BYTES, PENDING_STEER_FROZEN_FIELDS, ACTOR_ASSERTION_FROZEN_FIELDS, MAX_ACTOR_FIELD_CHARS, MAX_STEER_INPUT_ID_CHARS, type ActorAssertion, type PendingSteerEntry, type PendingSteerInput, riskSeverity, buildRiskDescriptor, summarizeCheckpoint, type CheckpointRowVerdict, type RiskDescriptor, type ProbeCause, type ProbeCauseOperands, type CheckpointStore, type CheckpointSummary, type Checkpoint, type CheckpointToken, type CheckpointGate, type CheckpointState, type SerializedCheckpointState, type CheckpointFaultMode, type PendingAction, type ResumeOutcome, type ResolvedOutcome, type ReopenReason, type ResolveExpectation, type TerminalClaimIntent, type TerminalClaimOutcome, type SafetyAxis, type RealApprovalGateBit, type ResourceLedger, type ResourceLimitReason, type PlatformLimitReason, type CheckpointRow, realApprovalOrgFact, resolveCheckpointStore, checkpointStoreIncomplete, } from "./core/checkpoint-store.js";
|
|
138
139
|
export { REOPEN_REASONS, RESUME_STARTUP_CAUSES, resumeStartupCauseOf, reopenReasonOf, type ResumeStartupCause } from "./core/resume-startup-cause.js";
|
|
139
140
|
export { EXECUTION_OUTCOME_RECORD_WORDS, EXECUTION_RECORD_LEAVES_ROW_UNRECORDED, type ExecutionOutcomeRecordWord, type ExecutionRecordRowFacts, type ExecutionVerdict, ExecutionOutcomeConflictError, checkpointExecutionRecorded, executionRecordDisposition, sameExecutionRecord, executionVerdict, } from "./core/checkpoint-execution-record.js";
|
|
140
141
|
export { PAUSE_REGISTRY, type GateKind, type PendingKind, type ResumeGate, isGateKind, resumeGateMatches, type CheckpointPause, type CheckpointFields, pauseOf, checkpointFrom, facetOf } from "./core/pause-registry.js";
|
|
141
142
|
export { REQUIREMENT_WORDS, type RequirementWord, checkpointRequirementsFor } from "./core/checkpoint-requirements.js";
|
|
143
|
+
export { judgeCheckpointRow } from "./core/checkpoint-row-verdict.js";
|
|
142
144
|
export { InMemoryUsageWindowStore, GLOBAL_USAGE_KEY, EMPTY_USAGE_WINDOW_RECORD, chargeUsageRecord, readUsageRecord, usageRetryAfterMs, resolveUsageWindows, type UsageWindow, type UsageWindowStore, type UsageWindowReading, type UsageWindowRecord, type UsageSlot, type UsageBucketRow, } from "./core/usage-window-store.js";
|
|
143
145
|
export { FileUsageWindowStore, type FileUsageWindowStoreOptions } from "./stores/file/usage-window-store.js";
|
|
144
146
|
export { ENV_LIFETIME_SUSPEND_MARGIN_MS, USAGE_WINDOW_REAP_MARGIN_MS } from "./core/runner/prepare-task.js";
|
|
@@ -161,7 +163,7 @@ export type { FileHistoryStore, FileHistoryResult, FileHistoryTrackResult, FileH
|
|
|
161
163
|
export type { InMemoryFileHistoryStoreOptions } from "./core/file-history-store.js";
|
|
162
164
|
export { DEFAULT_FILE_HISTORY_BOUNDARY_KEEP, resolveFileHistoryRetention, fileHistoryBoundariesToKeep } from "./core/file-history-retention.js";
|
|
163
165
|
export type { FileHistoryRetentionPolicy } from "./core/file-history-retention.js";
|
|
164
|
-
export { FileStorageBackend, FileSessionRepo, FileCheckpointStore, CHECKPOINT_LEDGER_EVENT_KINDS, readCheckpointLedger, FileMemoryStore, FileToolResultStore, FileSessionPolicyStore, FileFileHistoryStore, FileWorkflowJournalStore, MAX_JOURNAL_RESULT_BYTES, oversizeJournalResult, resolveDataRoot, sanitizeScope, sanitizePathComponent,
|
|
166
|
+
export { FileStorageBackend, FileSessionRepo, FileCheckpointStore, CHECKPOINT_LEDGER_EVENT_KINDS, readCheckpointLedger, FileMemoryStore, FileToolResultStore, FileSessionPolicyStore, FileFileHistoryStore, FileWorkflowJournalStore, MAX_JOURNAL_RESULT_BYTES, oversizeJournalResult, resolveDataRoot, sanitizeScope, sanitizePathComponent, atomicWriteFile, writeThenLink, ensureDir, readJsonlRecords, AppendLog, FileStoreLockError, type FileStoreLockErrorCode, processFingerprint, isProcessLive, type ProcessFingerprint, type FileStorageBackendOptions, type FileStorageCorruptReadInfo, type FileFileHistoryStoreOptions, type FileSessionRepoOptions, type FileCheckpointStoreOptions, type CheckpointLedgerEventKind, type CheckpointLedgerReading, type ReadCheckpointLedgerOptions, } from "./stores/file/index.js";
|
|
165
167
|
export { CacheBreakDetector, type CacheBreakFinding, type ToolFingerprintInput } from "./core/cache-break-detector.js";
|
|
166
168
|
export { maybeCompact, type MaybeCompactOptions, type CompactionPassStart, type CompactionWindowSafetyInfo, type CompactionRestoreAsk } from "./core/auto-compaction.js";
|
|
167
169
|
export type { MintedAttachmentFrame } from "./core/user-attachment.js";
|
|
@@ -290,17 +292,18 @@ export { FileDurableRulePartitionProvider, ORG_STATE_FILE } from "./stores/file/
|
|
|
290
292
|
export { adoptFilePermissionRuleStore, type AdoptFileRuleStoreResult } from "./stores/file/permission-rule-adopt.js";
|
|
291
293
|
export { AdoptionError, assertAdoptionBootGate, readRootAdoptionFile, writeRootAdoptionFile, ROOT_ADOPTION_FILE, type AdoptionErrorCode, type AdoptionReport, type AdoptionReceipt, type AdoptionLegReport, type AffectedDeploymentConfig, type RootAdoptionFile, } from "./stores/file/adoption/marker.js";
|
|
292
294
|
export { adoptLocalDataRoot, ackAdoptionConfig, witnessAdoptionConfig, listAdoptionQuarantine, readAdoptionStatus, type AdoptionStatus, type AdoptLocalDataRootOptions, type AdoptLocalDataRootResult, type AdoptionCarriageLeg, type AdoptionCarriageLegContext, type AdoptionConfigWitnessReceipt, } from "./stores/file/adoption/adopt.js";
|
|
293
|
-
export { formatHookFeedback, runToolGate, createHookEnvCapabilities, type PersistedRuleHit, type PersistedRuleHitRule, type PersistedRuleUnreadable, type PersistedRuleCoverage, type PersistedRuleAnswer, normalizePersistedRuleHit, type HookInvocationIdentity, type ClassicEventBase, type PreToolUseEvent, type PostToolUseEvent, type PostToolUseFailureEvent, type PostToolBatchEvent, type UserPromptSubmitEvent, type SubagentStartEvent, type StopEvent, type StopFailureEvent, type PreCompactEvent, type PostCompactEvent, type StopHookResult, type HookEnvCapabilities, type HookToolOutput, type PreToolUseResult, type PostToolUseResult, type UserPromptSubmitResult, type SubagentStartResult, type HookToolFailure, type PostToolUseFailureResult, type PostToolBatchCall, type PostToolBatchResult, type PreCompactContext, type PreCompactResult, type PostCompactContext, type PermissionDeniedPayload, } from "./core/hooks.js";
|
|
295
|
+
export { formatHookFeedback, runToolGate, createHookEnvCapabilities, type PersistedRuleHit, type PersistedRuleHitRule, type PersistedRuleUnreadable, type PersistedRuleCoverage, type PersistedRuleAnswer, normalizePersistedRuleHit, type HookInvocationIdentity, type ClassicEventBase, type PreToolUseEvent, type PostToolUseEvent, type PostToolUseFailureEvent, type PostToolBatchEvent, type UserPromptSubmitEvent, type SubagentStartEvent, type StopEvent, type StopFailureEvent, type SessionStartEvent, type SessionEndEvent, type PreCompactEvent, type PostCompactEvent, type StopHookResult, type HookEnvCapabilities, type HookToolOutput, type PreToolUseResult, type PostToolUseResult, type UserPromptSubmitResult, type SubagentStartResult, type HookToolFailure, type PostToolUseFailureResult, type PostToolBatchCall, type PostToolBatchResult, type PreCompactContext, type PreCompactResult, type PostCompactContext, type PermissionDeniedPayload, } from "./core/hooks.js";
|
|
294
296
|
export type { ClassicEventMap, ClassicEventName, ObservedAnswer, EngineModRegistration } from "./core/mods/classic-events.js";
|
|
295
297
|
export { KERNEL_CONTRACT_VERSION, MOD_TIERS, MOD_SEATS, MOD_EVENT_SIDES, MOD_EVENT_TABLE, MODS_INVALID_CODE, MODS_REGISTRATION_REFUSED_CODE, type ModTier, type ModRegistrationTier, type ModSeat, type ModEventSide, type ModEventName, type ModEventRow, type ModStation, type ModRegistration, type ModUses, type On, type ModHandler, type ModHandlerOptions, type ModNext, type ModOrigin, type ModTraceEntry, type ModCaughtError, type ModDollarBase, type ModEventPayload, type ModMatcher, type ModAdmissionRecord, } from "./core/mods/kernel/index.js";
|
|
296
|
-
export type { AgentSpawnAnswer, EngineDollar, ModelCompleteBlock, SessionAppendAnswer, SessionCompactAnswer, SessionSendAnswer, ToolCallAnswer } from "./core/mods/dollar.js";
|
|
298
|
+
export type { AgentSpawnAnswer, EngineDollar, ModelCompleteBlock, SessionAppendAnswer, SessionCompactAnswer, SessionSendAnswer, SessionUsage, SessionVersion, ToolCallAnswer } from "./core/mods/dollar.js";
|
|
299
|
+
export type { ContextOccupancy } from "./core/mods/lifecycle-stations.js";
|
|
297
300
|
export { admitModChain } from "./core/mods/stations.js";
|
|
298
301
|
export { SESSION_APPEND_DOORS, SESSION_APPEND_ORIGIN_KINDS, type SessionAppendDoor, type SessionAppendOrigin } from "./core/mods/session-append.js";
|
|
299
302
|
export { SESSION_RECEIVE_ORIGIN_KINDS, type SessionReceiveOrigin } from "./core/mods/session-receive.js";
|
|
300
303
|
export { SESSION_SEND_ORIGIN_KINDS, type SessionSendOrigin } from "./core/mods/session-send.js";
|
|
301
304
|
export { loadModPackage, type ModPackageHost, type ModPackageRegistration } from "./core/mods/package.js";
|
|
302
305
|
export { CREDENTIAL_REF_KINDS, CREDENTIAL_REF_TRUST, CREDENTIAL_REF_TEXT_MAX, CREDENTIAL_REF_MAP_MAX, CREDENTIAL_REF_PROBLEM_REASONS, readCredentialRef, type CredentialRef, type CredentialRefKind, type CredentialRefRequestAdmission, type CredentialRefProblem, type CredentialRefProblemReason, type CredentialRefReading, } from "@sema-agent/primitives";
|
|
303
|
-
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
|
|
306
|
+
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 MemoryVectorMode, type ScoredMemory, type MemoryNoteHeader, type MemoryNoteRecord, type MemoryNoteType, type StructuredNoteInput, MEMORY_PROJECT_KEY_ABSENT_REASONS, type MemoryProjectKeyAbsentReason, type MemoryProjectKey, } from "./core/memory.js";
|
|
304
307
|
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 ErasureCarrierAnswer, type ErasureCarrierClass, type ErasureCountAnswer, 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, memorySyncStoreOf, carriesCredential, type MemorySyncTransport, type MemorySyncRequestBody, type MemorySyncResponseBody, type MemorySyncClientConflict, type SyncMemoryScopeOptions, type MemorySyncClientResult, memorySyncReportOf, memoryTravelGapOf, type MemorySyncLayerReport, type MemorySyncRoundReport, } from "./core/memory-engine/index.js";
|
|
305
308
|
export { createConsolidationWriteJudge, deliverWriteRefusal, type ConsolidationWriteJudgeInput } from "./core/runner/memory-consolidation-write-judge.js";
|
|
306
309
|
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";
|
|
@@ -313,8 +316,6 @@ export { isSharedMemoryDocumentPath, isSharedMemoryStoreId } from "./core/shared
|
|
|
313
316
|
export { sharedMemoryStoreContract, type SharedMemoryFixture, type SharedMemoryStoreContractHooks, } from "./core/shared-memory/contract.js";
|
|
314
317
|
export { termSet, jaccardDistance, cosineDistance } from "./core/memory-vector.js";
|
|
315
318
|
export { encodeSurfacedKey, buildManifestText, validateSelectedIds, composeSelectiveBody, formatMemoryAge, resolveLinkedIds, RECALL_CAVEAT, DEFAULT_MAX_SELECTED, DEFAULT_MAX_LINKED, type MemorySelector, type MemorySelectRequest, type SelectiveRecallOptions, type SelectiveRecallResult, type LayeredRecallOptions, type LayeredRecallResult, } from "./core/memory-recall.js";
|
|
316
|
-
export { runMemoryConsolidation, CONSOLIDATION_SYSTEM_PROMPT, DEFAULT_CONSOLIDATION_BAND, DEFAULT_CONSOLIDATION_SEARCH_LIMIT, DEFAULT_CONSOLIDATION_MAX_NOTES, normalizeForExactMatch, type ConsolidationParams, type ConsolidationStats, type ConsolidationNote, type ConsolidationLLM, } from "./core/runner/memory-consolidation.js";
|
|
317
|
-
export { consolidateScope, advanceCursorAfterInline, type ConsolidateScopeDeps, type ConsolidateScopeOptions, } from "./core/consolidate-scope.js";
|
|
318
319
|
export { resolveMemoryConsolidationDriver, autoRunOnRecommendationEffective, // the ONE arming reading (`memory.auto_consolidation.arming_has_one_resolver`) — the seat's absence is not "off"
|
|
319
320
|
type MemoryConsolidationDriverDeps, } from "./core/runner/memory-consolidation-driver.js";
|
|
320
321
|
export { teardownLegBudget } from "./core/runner/teardown-bounded.js";
|
|
@@ -425,7 +426,7 @@ export { principalInboundLayers } from "./agents/cross-session-judge.js";
|
|
|
425
426
|
export { PRINCIPAL_INBOX_UNMINTED_CAUSE } from "./agents/peer-session-drain.js";
|
|
426
427
|
export { renderCrossSessionMessageFrame, renderCrossSessionNoticeLine } from "./core/task-notification.js";
|
|
427
428
|
export { PEER_HELD_QUEUE_CAP, PEER_IDLE_SUBSCRIPTION_TTL_MS, PEER_IDLE_SUBSCRIBER_TABLE_CAP, PEER_IDLE_OUTSTANDING_CAP, PEER_IDLE_PRIORS_KEPT, PEER_IDLE_FIRE_DEBOUNCE_MS, PEER_IDLE_HELD_BACKOFF_MS, PEER_IDLE_LABEL_MAX, CROSS_SESSION_DIALOG_EXPIRY_VALUES, CROSS_SESSION_DIALOG_EXPIRY_DEFAULT, resolveCrossSessionDialogExpiry, PEER_HELD_REVIEW_CAUSES, PEER_DELIVERY_RECEIPT_STATES, isPeerDeliveryReceiptState, PEER_DROP_REASONS, peerRecipientSuffix, renderCrossSessionDeliveryNotice, describePeerDropReasons, renderCrossSessionDroppedNotice, PEER_IDLE_NOTICE_KINDS, isPeerIdleNoticeKind, PEER_IDLE_UNAVAILABLE_CAUSES, peerIdleNoticeLabel, formatPeerNoticeClock, renderCrossSessionIdleNotice, describePeerIdleSubscription, type CrossSessionDialogExpiry, type ResolvedCrossSessionDialogExpiry, type PeerDeliveryReceiptState, type PeerDropReason, type PeerIdleNoticeKind, type PeerIdleNoticeFields, } from "./agents/peer-notices.js";
|
|
428
|
-
export { createPeerHeldQueue, peerHeldQueueFor, peerHeldQueueIfAny, peerHeldQueueKey, realPeerClock, type PeerInboundHoldCause, type PeerHeldEntry, type PeerHeldSettlement, type PeerHeldSettleReason, type PeerHeldSettleOutcome, type PeerHoldOutcome, type PeerCardDecision, type PeerClock, type PeerHeldQueueSink, type PeerHeldQueueConfig, type PeerHeldQueue, } from "./agents/peer-held-queue.js";
|
|
429
|
+
export { createPeerHeldQueue, peerHeldQueueFor, peerHeldQueueIfAny, peerHeldQueueKey, listPeerHeldQueues, realPeerClock, type PeerHeldQueueSnapshot, type PeerInboundHoldCause, type PeerHeldEntry, type PeerHeldSettlement, type PeerHeldSettleReason, type PeerHeldSettleOutcome, type PeerHoldOutcome, type PeerCardDecision, type PeerClock, type PeerHeldQueueSink, type PeerHeldQueueConfig, type PeerHeldQueue, } from "./agents/peer-held-queue.js";
|
|
429
430
|
export { createPeerIdleTarget, createPeerIdleRequester, peerIdleMachineFor, peerIdleMachineIfAny, peerIdleMachineKey, type PeerIdleSubscriber, type PeerIdleTargetNotice, type PeerIdleTargetSink, type PeerIdleSubscribeOutcome, type PeerIdleTarget, type PeerIdleOutstanding, type PeerIdleRequesterSink, type PeerIdleRequester, type PeerIdleMachine, } from "./agents/peer-idle.js";
|
|
430
431
|
export { routePeerDeliveryReceipt, routePeerDroppedReceipt, routePeerIdleNotice, type PeerNoticeRoute } from "./agents/peer-notice-route.js";
|
|
431
432
|
export { type PeerAdmissionStage } from "./agents/peer-admission.js";
|
package/dist/index.js
CHANGED
|
@@ -57,6 +57,7 @@ export { askUnresolvableNotice } from "./core/ask-unresolvable-notice.js";
|
|
|
57
57
|
export { ASK_UNRESOLVABLE_CAUSES } from "./core/ask-unresolvable-notice.js";
|
|
58
58
|
export { APPROVAL_REMEDY_KINDS } from "./core/ask-origin.js";
|
|
59
59
|
export { USER_INPUT_UNDRAINED_CAUSES, USER_INPUT_UNDRAINED_FAMILIES } from "./core/engine-notice.js";
|
|
60
|
+
export { setDefaultEngineNoticeSeat } from "./core/engine-notice.js";
|
|
60
61
|
export { STEER_REPLAY_FACETS } from "./core/steer-replay.js";
|
|
61
62
|
export { TOOL_TURN_INCOMPLETE_CAUSES } from "./internal/llm.js";
|
|
62
63
|
export { MODEL_OUTPUT_INVALID_CAUSES } from "./internal/llm.js";
|
|
@@ -113,6 +114,7 @@ export { REOPEN_REASONS, RESUME_STARTUP_CAUSES, resumeStartupCauseOf, reopenReas
|
|
|
113
114
|
export { EXECUTION_OUTCOME_RECORD_WORDS, EXECUTION_RECORD_LEAVES_ROW_UNRECORDED, ExecutionOutcomeConflictError, checkpointExecutionRecorded, executionRecordDisposition, sameExecutionRecord, executionVerdict, } from "./core/checkpoint-execution-record.js";
|
|
114
115
|
export { PAUSE_REGISTRY, isGateKind, resumeGateMatches, pauseOf, checkpointFrom, facetOf } from "./core/pause-registry.js";
|
|
115
116
|
export { REQUIREMENT_WORDS, checkpointRequirementsFor } from "./core/checkpoint-requirements.js";
|
|
117
|
+
export { judgeCheckpointRow } from "./core/checkpoint-row-verdict.js";
|
|
116
118
|
export { InMemoryUsageWindowStore, GLOBAL_USAGE_KEY, EMPTY_USAGE_WINDOW_RECORD, chargeUsageRecord, readUsageRecord, usageRetryAfterMs, resolveUsageWindows, } from "./core/usage-window-store.js";
|
|
117
119
|
export { FileUsageWindowStore } from "./stores/file/usage-window-store.js";
|
|
118
120
|
export { ENV_LIFETIME_SUSPEND_MARGIN_MS, USAGE_WINDOW_REAP_MARGIN_MS } from "./core/runner/prepare-task.js";
|
|
@@ -127,7 +129,7 @@ export { trackKeyOf as fileHistoryTrackKeyOf, resolveTrackKey as fileHistoryReso
|
|
|
127
129
|
export { describeTrackKey as fileHistoryDescribeTrackKey, fileHistoryExportDigest, validateFileHistoryExport } from "./core/file-history-store.js";
|
|
128
130
|
export { fileHistoryBlobExchangeOf } from "./core/file-history-store.js";
|
|
129
131
|
export { DEFAULT_FILE_HISTORY_BOUNDARY_KEEP, resolveFileHistoryRetention, fileHistoryBoundariesToKeep } from "./core/file-history-retention.js";
|
|
130
|
-
export { FileStorageBackend, FileSessionRepo, FileCheckpointStore, CHECKPOINT_LEDGER_EVENT_KINDS, readCheckpointLedger, FileMemoryStore, FileToolResultStore, FileSessionPolicyStore, FileFileHistoryStore, FileWorkflowJournalStore, MAX_JOURNAL_RESULT_BYTES, oversizeJournalResult, resolveDataRoot, sanitizeScope, sanitizePathComponent,
|
|
132
|
+
export { FileStorageBackend, FileSessionRepo, FileCheckpointStore, CHECKPOINT_LEDGER_EVENT_KINDS, readCheckpointLedger, FileMemoryStore, FileToolResultStore, FileSessionPolicyStore, FileFileHistoryStore, FileWorkflowJournalStore, MAX_JOURNAL_RESULT_BYTES, oversizeJournalResult, resolveDataRoot, sanitizeScope, sanitizePathComponent, atomicWriteFile, writeThenLink, ensureDir, readJsonlRecords, AppendLog, FileStoreLockError, processFingerprint, isProcessLive, } from "./stores/file/index.js";
|
|
131
133
|
export { CacheBreakDetector } from "./core/cache-break-detector.js";
|
|
132
134
|
export { maybeCompact } from "./core/auto-compaction.js";
|
|
133
135
|
export { brainToRuntime } from "./core/runtime.js";
|
|
@@ -242,8 +244,6 @@ export { isSharedMemoryDocumentPath, isSharedMemoryStoreId } from "./core/shared
|
|
|
242
244
|
export { sharedMemoryStoreContract, } from "./core/shared-memory/contract.js";
|
|
243
245
|
export { termSet, jaccardDistance, cosineDistance } from "./core/memory-vector.js";
|
|
244
246
|
export { encodeSurfacedKey, buildManifestText, validateSelectedIds, composeSelectiveBody, formatMemoryAge, resolveLinkedIds, RECALL_CAVEAT, DEFAULT_MAX_SELECTED, DEFAULT_MAX_LINKED, } from "./core/memory-recall.js";
|
|
245
|
-
export { runMemoryConsolidation, CONSOLIDATION_SYSTEM_PROMPT, DEFAULT_CONSOLIDATION_BAND, DEFAULT_CONSOLIDATION_SEARCH_LIMIT, DEFAULT_CONSOLIDATION_MAX_NOTES, normalizeForExactMatch, } from "./core/runner/memory-consolidation.js";
|
|
246
|
-
export { consolidateScope, advanceCursorAfterInline, } from "./core/consolidate-scope.js";
|
|
247
247
|
export { resolveMemoryConsolidationDriver, autoRunOnRecommendationEffective, } from "./core/runner/memory-consolidation-driver.js";
|
|
248
248
|
export { teardownLegBudget } from "./core/runner/teardown-bounded.js";
|
|
249
249
|
export { DEFAULT_COMPACTION_INSTRUCTIONS } from "./core/auto-compaction.js";
|
|
@@ -345,7 +345,7 @@ export { principalInboundLayers } from "./agents/cross-session-judge.js";
|
|
|
345
345
|
export { PRINCIPAL_INBOX_UNMINTED_CAUSE } from "./agents/peer-session-drain.js";
|
|
346
346
|
export { renderCrossSessionMessageFrame, renderCrossSessionNoticeLine } from "./core/task-notification.js";
|
|
347
347
|
export { PEER_HELD_QUEUE_CAP, PEER_IDLE_SUBSCRIPTION_TTL_MS, PEER_IDLE_SUBSCRIBER_TABLE_CAP, PEER_IDLE_OUTSTANDING_CAP, PEER_IDLE_PRIORS_KEPT, PEER_IDLE_FIRE_DEBOUNCE_MS, PEER_IDLE_HELD_BACKOFF_MS, PEER_IDLE_LABEL_MAX, CROSS_SESSION_DIALOG_EXPIRY_VALUES, CROSS_SESSION_DIALOG_EXPIRY_DEFAULT, resolveCrossSessionDialogExpiry, PEER_HELD_REVIEW_CAUSES, PEER_DELIVERY_RECEIPT_STATES, isPeerDeliveryReceiptState, PEER_DROP_REASONS, peerRecipientSuffix, renderCrossSessionDeliveryNotice, describePeerDropReasons, renderCrossSessionDroppedNotice, PEER_IDLE_NOTICE_KINDS, isPeerIdleNoticeKind, PEER_IDLE_UNAVAILABLE_CAUSES, peerIdleNoticeLabel, formatPeerNoticeClock, renderCrossSessionIdleNotice, describePeerIdleSubscription, } from "./agents/peer-notices.js";
|
|
348
|
-
export { createPeerHeldQueue, peerHeldQueueFor, peerHeldQueueIfAny, peerHeldQueueKey, realPeerClock, } from "./agents/peer-held-queue.js";
|
|
348
|
+
export { createPeerHeldQueue, peerHeldQueueFor, peerHeldQueueIfAny, peerHeldQueueKey, listPeerHeldQueues, realPeerClock, } from "./agents/peer-held-queue.js";
|
|
349
349
|
export { createPeerIdleTarget, createPeerIdleRequester, peerIdleMachineFor, peerIdleMachineIfAny, peerIdleMachineKey, } from "./agents/peer-idle.js";
|
|
350
350
|
export { routePeerDeliveryReceipt, routePeerDroppedReceipt, routePeerIdleNotice } from "./agents/peer-notice-route.js";
|
|
351
351
|
export {} from "./agents/peer-admission.js";
|
|
@@ -17,14 +17,15 @@ export { DEFAULT_CHARS_PER_TOKEN, DEFAULT_CLAMP_TOLERANCE, DEFAULT_COMPACTION_SE
|
|
|
17
17
|
export { SKILL_RETENTION_PER_SKILL_MAX_CHARS, SKILL_RETENTION_TOTAL_MAX_CHARS, SKILL_RETENTION_TRUNCATION_MARKER, formatFileOperations, formatPersistedOutputRefs, readCompactionActiveTools, readRetainedInvokedSkills, renderInvokedSkillsRetention, } from "../engine/compaction/utils.js";
|
|
18
18
|
export { NodeExecutionEnv } from "../engine/execution-env/node-execution-env.js";
|
|
19
19
|
export { StoredSession, buildSessionContext } from "../engine/session/session.js";
|
|
20
|
-
export { assertForkTarget, compareOccupants, forkRowCells, frozenRow, getEntriesToFork, importRowCells, incarnationCell, ownerCell, readIncarnationCell, readOwnerCell, rowExpectationMissed, sessionRowMatches } from "../engine/session/repo-utils.js";
|
|
20
|
+
export { assertForkTarget, compareOccupants, forkRowCells, frozenRow, getEntriesToFork, importRowCells, incarnationCell, ownerCell, placementCellToWrite, readIncarnationCell, readOwnerCell, readPlacementCell, rowExpectationMissed, sessionRowMatches } from "../engine/session/repo-utils.js";
|
|
21
21
|
export { validateEntriesForImport, StreamingImportValidator } from "../engine/session/import-validate.js";
|
|
22
|
-
export { BaseSessionStorage, leafIdAfterEntry, resolveLeafId, sessionLogMarkOf } from "../engine/session/storage-base.js";
|
|
22
|
+
export { BaseSessionStorage, entryParentLinks, leafIdAfterEntry, resolveLeafId, sessionLogMarkOf } from "../engine/session/storage-base.js";
|
|
23
23
|
export { InMemorySessionStorage } from "../engine/session/memory-storage.js";
|
|
24
24
|
export { InMemorySessionRepo } from "../engine/session/memory-repo.js";
|
|
25
25
|
export { uuidv7 } from "../engine/session/uuid.js";
|
|
26
26
|
export { ParentChainGuard } from "../engine/session/parent-chain-guard.js";
|
|
27
|
-
export type { ForkPoint } from "../engine/session/path-to-root.js";
|
|
27
|
+
export type { ForkPoint, ReplayLoss } from "../engine/session/path-to-root.js";
|
|
28
|
+
export { LineageBreak, pathToRoot, replayLossText } from "../engine/session/path-to-root.js";
|
|
28
29
|
export { findUnansweredToolBatch, readToolCallArguments } from "../engine/loop/agent-loop.js";
|
|
29
30
|
export { SessionError } from "../engine/harness/types.js";
|
|
30
31
|
export type { AnnouncedAdvisorState, AnnouncedListingSnapshot, AnnouncedListingSnapshotInput, AnnouncedMcpFailure } from "../engine/harness/types.js";
|
package/dist/internal/harness.js
CHANGED
|
@@ -5,13 +5,14 @@ export { DEFAULT_CHARS_PER_TOKEN, DEFAULT_CLAMP_TOLERANCE, DEFAULT_COMPACTION_SE
|
|
|
5
5
|
export { SKILL_RETENTION_PER_SKILL_MAX_CHARS, SKILL_RETENTION_TOTAL_MAX_CHARS, SKILL_RETENTION_TRUNCATION_MARKER, formatFileOperations, formatPersistedOutputRefs, readCompactionActiveTools, readRetainedInvokedSkills, renderInvokedSkillsRetention, } from "../engine/compaction/utils.js";
|
|
6
6
|
export { NodeExecutionEnv } from "../engine/execution-env/node-execution-env.js";
|
|
7
7
|
export { StoredSession, buildSessionContext } from "../engine/session/session.js";
|
|
8
|
-
export { assertForkTarget, compareOccupants, forkRowCells, frozenRow, getEntriesToFork, importRowCells, incarnationCell, ownerCell, readIncarnationCell, readOwnerCell, rowExpectationMissed, sessionRowMatches } from "../engine/session/repo-utils.js";
|
|
8
|
+
export { assertForkTarget, compareOccupants, forkRowCells, frozenRow, getEntriesToFork, importRowCells, incarnationCell, ownerCell, placementCellToWrite, readIncarnationCell, readOwnerCell, readPlacementCell, rowExpectationMissed, sessionRowMatches } from "../engine/session/repo-utils.js";
|
|
9
9
|
export { validateEntriesForImport, StreamingImportValidator } from "../engine/session/import-validate.js";
|
|
10
|
-
export { BaseSessionStorage, leafIdAfterEntry, resolveLeafId, sessionLogMarkOf } from "../engine/session/storage-base.js";
|
|
10
|
+
export { BaseSessionStorage, entryParentLinks, leafIdAfterEntry, resolveLeafId, sessionLogMarkOf } from "../engine/session/storage-base.js";
|
|
11
11
|
export { InMemorySessionStorage } from "../engine/session/memory-storage.js";
|
|
12
12
|
export { InMemorySessionRepo } from "../engine/session/memory-repo.js";
|
|
13
13
|
export { uuidv7 } from "../engine/session/uuid.js";
|
|
14
14
|
export { ParentChainGuard } from "../engine/session/parent-chain-guard.js";
|
|
15
|
+
export { LineageBreak, pathToRoot, replayLossText } from "../engine/session/path-to-root.js";
|
|
15
16
|
export { findUnansweredToolBatch, readToolCallArguments } from "../engine/loop/agent-loop.js";
|
|
16
17
|
export { SessionError } from "../engine/harness/types.js";
|
|
17
18
|
export { normalizeGitAnnouncement } from "../engine/harness/types.js";
|
|
@@ -184,6 +184,9 @@ export interface RunWorkflowToolDeps {
|
|
|
184
184
|
/** The host run tree's cross-boundary token (`RunInternals.crossBoundaryTree`), riding deps for the same auto-mounted-ctx reason as
|
|
185
185
|
* `rootSessionId` above; handed to the workflow run so every workflow-spawned agent joins the host tree's state. */
|
|
186
186
|
crossBoundaryTree?: import("../core/cross-boundary-taint.js").CrossBoundaryTreeToken;
|
|
187
|
+
/** The host run tree's owner seat (`RunInternals.delegationOwner`), riding deps for the same auto-mounted-ctx reason; handed to the
|
|
188
|
+
* workflow run so every workflow-spawned agent (and the children it delegates) reads the host tree's owner. */
|
|
189
|
+
delegationOwner?: import("../core/runner/delegation-owner.js").DelegationOwnerSeat;
|
|
187
190
|
/** Process-local unified task registry. When present, RunWorkflow returns `task_id === runId` with a `w*` id. */
|
|
188
191
|
taskRegistry?: TaskRegistry;
|
|
189
192
|
/** design/115 P2 core slice: run-local task-notification sink for SDK event + live model XML injection.
|
|
@@ -31,7 +31,7 @@ import { parseWorkflowMeta, splitWorkflowMeta, workflowScriptReadsClockOrRandom
|
|
|
31
31
|
import { mergeWorkflowArgs, normalizeStringArg } from "./workflow-script-store.js";
|
|
32
32
|
import { workflowSizeGuidelineSection } from "./workflow-size-guideline.js";
|
|
33
33
|
import { mountRuleFace, toolFace } from "../core/tool-catalog-entries.js";
|
|
34
|
-
import { thrownText } from "../core/thrown-value.js";
|
|
34
|
+
import { readMember, thrownText } from "../core/thrown-value.js";
|
|
35
35
|
export const RUN_WORKFLOW_TOOL_NAME = "Workflow";
|
|
36
36
|
export const WORKFLOW_NO_COMPLETION_CHANNEL = "a workflow run is not available here — no completion would come back from one on this mount (no notification channel and no deployment notifier is wired), and a workflow has no synchronous form. Do the work directly instead.";
|
|
37
37
|
function stripCodeFences(s) {
|
|
@@ -119,10 +119,11 @@ const SCRIPT_ERROR_CODES = new Set([
|
|
|
119
119
|
"workflow.budget_exceeded",
|
|
120
120
|
]);
|
|
121
121
|
function failureSummary(err, runId) {
|
|
122
|
-
const
|
|
123
|
-
const code = typeof
|
|
122
|
+
const codeWord = readMember(err, "code");
|
|
123
|
+
const code = typeof codeWord === "string" ? codeWord : undefined;
|
|
124
124
|
if (code === WORKFLOW_AGENT_PARKED_ERROR_CODE) {
|
|
125
|
-
const
|
|
125
|
+
const parkedWords = readMember(err, "message");
|
|
126
|
+
const msg = typeof parkedWords === "string" ? egressText("same-principal", parkedWords) : "";
|
|
126
127
|
return (`workflow parked (${code}): ${msg.length > 200 ? `${msg.slice(0, 200)}…` : msg} — it did not fail and is not finished` +
|
|
127
128
|
(runId ? `; the diagnostics below name its record (the parked agent's row reads status "parked")` : "") +
|
|
128
129
|
`; do not re-issue the same call — once the approval is decided, the deployment resumes this run${runId ? ` (resumeFromRunId: "${runId}")` : ""} and the script continues from the parked call`);
|
|
@@ -130,8 +131,9 @@ function failureSummary(err, runId) {
|
|
|
130
131
|
const guide = runId
|
|
131
132
|
? `; which agents failed is in the diagnostics below; after fixing, re-invoke with resumeFromRunId: "${runId}" (completed agents replay from the journal)`
|
|
132
133
|
: "";
|
|
133
|
-
|
|
134
|
-
|
|
134
|
+
const scriptWords = code && SCRIPT_ERROR_CODES.has(code) ? readMember(err, "message") : undefined;
|
|
135
|
+
if (code && typeof scriptWords === "string") {
|
|
136
|
+
const msg = egressText("same-principal", scriptWords);
|
|
135
137
|
return `workflow failed (${code}): ${msg.length > 200 ? `${msg.slice(0, 200)}…` : msg}${guide}`;
|
|
136
138
|
}
|
|
137
139
|
return `${code && code.startsWith("workflow.") ? `workflow failed (${code})` : "workflow failed"}${guide}`;
|
|
@@ -517,6 +519,7 @@ async function mountRunWorkflowTool(d) {
|
|
|
517
519
|
...((ctx.placementRoot ?? d.placementRoot) !== undefined ? { placementRoot: ctx.placementRoot ?? d.placementRoot } : {}),
|
|
518
520
|
...((ctx.placementTarget ?? d.placementTarget) !== undefined ? { placementTarget: ctx.placementTarget ?? d.placementTarget } : {}),
|
|
519
521
|
...((ctx.crossBoundaryTreeForChildren ?? d.crossBoundaryTree) !== undefined ? { crossBoundaryTree: ctx.crossBoundaryTreeForChildren ?? d.crossBoundaryTree } : {}),
|
|
522
|
+
...((ctx.delegationOwner ?? d.delegationOwner) !== undefined ? { delegationOwner: ctx.delegationOwner ?? d.delegationOwner } : {}),
|
|
520
523
|
...(workflowTaskId !== undefined ? { runId: workflowTaskId } : {}),
|
|
521
524
|
journalStore: d.journalStore,
|
|
522
525
|
...(resumeFromRunId !== undefined ? { resumeFromRunId } : {}),
|
|
@@ -642,16 +645,29 @@ async function mountRunWorkflowTool(d) {
|
|
|
642
645
|
diagnostics: workflowDiagnostics(runId, d.journalStore?.locator?.(runId, res.run.scope), res.run.resume?.journalEntries === 0, await recordOf(res.run).catch(() => "This run's record could not be read.")),
|
|
643
646
|
completionId: res.run.completionId,
|
|
644
647
|
}), async (err) => {
|
|
645
|
-
|
|
646
|
-
|
|
648
|
+
let parts = {
|
|
649
|
+
summary: failureSummary(undefined, runId),
|
|
650
|
+
diagnostics: workflowDiagnostics(runId, undefined, undefined, "This run's record could not be read."),
|
|
651
|
+
};
|
|
652
|
+
try {
|
|
653
|
+
const failedRun = settledRunOf(handle.done);
|
|
654
|
+
const record = (failedRun !== undefined ? await recordOf(failedRun).catch(() => undefined) : undefined) ?? "This run's record could not be read.";
|
|
655
|
+
const summary = failureSummary(err, runId);
|
|
656
|
+
const settleId = failedRun?.completionId;
|
|
657
|
+
parts = {
|
|
658
|
+
summary,
|
|
659
|
+
diagnostics: workflowDiagnostics(runId, undefined, undefined, record),
|
|
660
|
+
...(settleId !== undefined ? { completionId: settleId } : {}),
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
catch {
|
|
664
|
+
}
|
|
647
665
|
fire({
|
|
648
666
|
task_id: runId,
|
|
649
667
|
task_type: "workflow",
|
|
650
668
|
...(ctx.toolCallId !== undefined ? { toolUseId: ctx.toolCallId } : {}),
|
|
651
669
|
status: "failed",
|
|
652
|
-
|
|
653
|
-
diagnostics: workflowDiagnostics(runId, undefined, undefined, record),
|
|
654
|
-
...(failedRun?.completionId !== undefined ? { completionId: failedRun.completionId } : {}),
|
|
670
|
+
...parts,
|
|
655
671
|
});
|
|
656
672
|
})
|
|
657
673
|
.catch(() => { });
|
|
@@ -92,7 +92,7 @@ export interface WorkflowAgentSpec extends ScriptClampSeats {
|
|
|
92
92
|
* restricting value, an add-only row through the row's script and entry laws. A row marked inherited-only (its
|
|
93
93
|
* restricting value switches off an operator-side record) is outside this set and is stripped like any other key.
|
|
94
94
|
*/
|
|
95
|
-
export declare const WHITELIST_KEYS: readonly ("thinking" | "
|
|
95
|
+
export declare const WHITELIST_KEYS: readonly ("thinking" | "systemPrompt" | "objective" | "images" | "limits" | ScriptSeat | "modelName")[];
|
|
96
96
|
/**
|
|
97
97
|
* #505 ② — ACCEPTED ALIAS SPELLINGS on the spec: `alias → the {@link WHITELIST_KEYS} member it means`.
|
|
98
98
|
*
|
|
@@ -355,6 +355,9 @@ export interface RunWorkflowOptions {
|
|
|
355
355
|
/** The host run tree's cross-boundary token (`RunInternals.crossBoundaryTree`, threaded by the run-workflow tool): every
|
|
356
356
|
* workflow-spawned agent joins the tree it names, so a bit a workflow agent sets is read by the host and its siblings. */
|
|
357
357
|
crossBoundaryTree?: import("../core/cross-boundary-taint.js").CrossBoundaryTreeToken;
|
|
358
|
+
/** The host run tree's owner seat (`RunInternals.delegationOwner`, threaded by the run-workflow tool): every workflow-spawned agent
|
|
359
|
+
* holds it, so a child it delegates records the host tree's owner. */
|
|
360
|
+
delegationOwner?: import("../core/runner/delegation-owner.js").DelegationOwnerSeat;
|
|
358
361
|
/** design/149 — the PROCESS-level child observer (same seam as
|
|
359
362
|
* {@link import("../core/types.js").RunnerDeps.onBackgroundChildEvent}). When set, every workflow
|
|
360
363
|
* agent emits spawn/tick/terminal {@link import("../core/types.js").BackgroundChildEvent} frames with a
|