@treeseed/dsh-chapters 0.1.24 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/cordis.patch.yml +49 -1
- package/docs/architecture.md +1 -496
- package/docs/backlog.md +234 -4
- package/docs/contract.md +127 -1
- package/docs/development.md +248 -12
- package/docs/host-compaction-seam.md +108 -0
- package/docs/knowledge-repo.md +532 -16
- package/docs/project-state.md +323 -0
- package/docs/verify.md +266 -0
- package/lib/archive.d.ts +49 -1
- package/lib/archive.js +56 -2
- package/lib/archive.js.map +1 -1
- package/lib/arrival.js +24 -10
- package/lib/arrival.js.map +1 -1
- package/lib/attach.d.ts +46 -0
- package/lib/attach.js +120 -0
- package/lib/attach.js.map +1 -0
- package/lib/auto-save.d.ts +74 -0
- package/lib/auto-save.js +175 -26
- package/lib/auto-save.js.map +1 -1
- package/lib/client.js +413 -11
- package/lib/client.js.map +1 -1
- package/lib/commands.d.ts +8 -1
- package/lib/commands.js +135 -7
- package/lib/commands.js.map +1 -1
- package/lib/compose.js +25 -6
- package/lib/compose.js.map +1 -1
- package/lib/continue-core.d.ts +24 -1
- package/lib/continue-core.js +41 -9
- package/lib/continue-core.js.map +1 -1
- package/lib/diag.d.ts +55 -0
- package/lib/diag.js +186 -0
- package/lib/diag.js.map +1 -0
- package/lib/engine-core.d.ts +53 -1
- package/lib/engine-core.js +64 -7
- package/lib/engine-core.js.map +1 -1
- package/lib/engine.d.ts +99 -0
- package/lib/engine.js +488 -36
- package/lib/engine.js.map +1 -1
- package/lib/enrich-queue.js +28 -2
- package/lib/enrich-queue.js.map +1 -1
- package/lib/enrich-wire.d.ts +92 -2
- package/lib/enrich-wire.js +135 -17
- package/lib/enrich-wire.js.map +1 -1
- package/lib/enrich.d.ts +27 -2
- package/lib/enrich.js +114 -18
- package/lib/enrich.js.map +1 -1
- package/lib/index.d.ts +52 -0
- package/lib/index.js +182 -2
- package/lib/index.js.map +1 -1
- package/lib/indexing.d.ts +7 -0
- package/lib/indexing.js.map +1 -1
- package/lib/injections.d.ts +1 -0
- package/lib/injections.js +38 -0
- package/lib/injections.js.map +1 -1
- package/lib/last-resort.d.ts +24 -0
- package/lib/last-resort.js +27 -0
- package/lib/last-resort.js.map +1 -0
- package/lib/prompt.d.ts +130 -0
- package/lib/prompt.js +255 -0
- package/lib/prompt.js.map +1 -0
- package/lib/registry.d.ts +39 -1
- package/lib/registry.js +76 -9
- package/lib/registry.js.map +1 -1
- package/lib/render.d.ts +31 -3
- package/lib/render.js +75 -3
- package/lib/render.js.map +1 -1
- package/lib/repair-run.d.ts +49 -0
- package/lib/repair-run.js +423 -0
- package/lib/repair-run.js.map +1 -0
- package/lib/repair.d.ts +200 -0
- package/lib/repair.js +354 -0
- package/lib/repair.js.map +1 -0
- package/lib/rules-commands.d.ts +22 -0
- package/lib/rules-commands.js +177 -20
- package/lib/rules-commands.js.map +1 -1
- package/lib/rules.d.ts +184 -7
- package/lib/rules.js +312 -27
- package/lib/rules.js.map +1 -1
- package/lib/save-core.d.ts +31 -1
- package/lib/save-core.js +153 -17
- package/lib/save-core.js.map +1 -1
- package/lib/session-rules.d.ts +222 -0
- package/lib/session-rules.js +454 -0
- package/lib/session-rules.js.map +1 -0
- package/lib/store.d.ts +22 -1
- package/lib/store.js +94 -17
- package/lib/store.js.map +1 -1
- package/lib/sync.js +13 -1
- package/lib/sync.js.map +1 -1
- package/lib/tools.d.ts +14 -0
- package/lib/tools.js +321 -32
- package/lib/tools.js.map +1 -1
- package/lib/types.d.ts +12 -1
- package/lib/types.js.map +1 -1
- package/lib/version.d.ts +9 -0
- package/lib/version.js +10 -0
- package/lib/version.js.map +1 -0
- package/lib/warnings.d.ts +10 -0
- package/lib/warnings.js +18 -0
- package/lib/warnings.js.map +1 -0
- package/package.json +9 -3
package/lib/attach.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attaching a created child to the workspace — the loud version (#54).
|
|
3
|
+
*
|
|
4
|
+
* One step, five ways it can fail, and only one of them silent. AGENTS records that
|
|
5
|
+
* `workspaceRegistry.createCanonical(cwd)` → `attachSession(id)` is precisely what makes a
|
|
6
|
+
* programmatic session APPEAR in the UI ("an unattached session was the whole explanation
|
|
7
|
+
* for round 6's 'not listed'"), yet the door called it through two optional chains inside a
|
|
8
|
+
* `catch` that only warned the profile logger. On host 0.2.0-rc.2 the result is a child that
|
|
9
|
+
* is created, durable, present in `session_projcache` — and absent from the sidebar after a
|
|
10
|
+
* reload, while the door reports success. Silence in a required step is the bug; this module
|
|
11
|
+
* is the fix.
|
|
12
|
+
*
|
|
13
|
+
* The rule it encodes: **verify the user-visible fact, not the absence of a throw.** A
|
|
14
|
+
* successful `attachSession()` proves the method exists, not that the session is listed —
|
|
15
|
+
* so the check is "does this child appear in `sessionQuery.listSessions()`", polled briefly
|
|
16
|
+
* because the workspace catches up asynchronously.
|
|
17
|
+
*/
|
|
18
|
+
export interface AttachPorts {
|
|
19
|
+
/** the host's `workspaceRegistry` service, as far as it was resolved */
|
|
20
|
+
workspaceRegistry: unknown;
|
|
21
|
+
/** the host's `sessionQuery` service; absent ⇒ listing cannot be verified, said out loud */
|
|
22
|
+
sessionQuery: unknown;
|
|
23
|
+
/** the host's `sessionController` service; its `list()` is the surface the BROWSER reads.
|
|
24
|
+
* Absent ⇒ the gateway half of the verification is UNVERIFIED, said out loud. */
|
|
25
|
+
sessionController?: unknown;
|
|
26
|
+
/** the diagnostics seam (`src/diag.ts`): sink + logger, never throws */
|
|
27
|
+
diagnostic(where: string, message: string, error?: unknown): void;
|
|
28
|
+
childId: string;
|
|
29
|
+
cwd: string;
|
|
30
|
+
/** test seams; production uses the defaults */
|
|
31
|
+
pollIntervalMs?: number;
|
|
32
|
+
pollBudgetMs?: number;
|
|
33
|
+
}
|
|
34
|
+
export interface AttachOutcome {
|
|
35
|
+
/** the workspace actually took the session */
|
|
36
|
+
attached: boolean;
|
|
37
|
+
/** it appears in the session list. `undefined` = UNVERIFIABLE, which is NOT `true`. */
|
|
38
|
+
listed: boolean | undefined;
|
|
39
|
+
/** it appears in the GATEWAY list the browser renders and opens from. `undefined` = unverified.
|
|
40
|
+
* Written as `| undefined` deliberately: this repo compiles with
|
|
41
|
+
* `exactOptionalPropertyTypes`, where `?: boolean` forbids assigning undefined. */
|
|
42
|
+
gatewayListed?: boolean | undefined;
|
|
43
|
+
/** user-visible words for anything short of attached+listed — these reach the door result */
|
|
44
|
+
warnings: string[];
|
|
45
|
+
}
|
|
46
|
+
export declare function attachCreatedChild(ports: AttachPorts): Promise<AttachOutcome>;
|
package/lib/attach.js
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attaching a created child to the workspace — the loud version (#54).
|
|
3
|
+
*
|
|
4
|
+
* One step, five ways it can fail, and only one of them silent. AGENTS records that
|
|
5
|
+
* `workspaceRegistry.createCanonical(cwd)` → `attachSession(id)` is precisely what makes a
|
|
6
|
+
* programmatic session APPEAR in the UI ("an unattached session was the whole explanation
|
|
7
|
+
* for round 6's 'not listed'"), yet the door called it through two optional chains inside a
|
|
8
|
+
* `catch` that only warned the profile logger. On host 0.2.0-rc.2 the result is a child that
|
|
9
|
+
* is created, durable, present in `session_projcache` — and absent from the sidebar after a
|
|
10
|
+
* reload, while the door reports success. Silence in a required step is the bug; this module
|
|
11
|
+
* is the fix.
|
|
12
|
+
*
|
|
13
|
+
* The rule it encodes: **verify the user-visible fact, not the absence of a throw.** A
|
|
14
|
+
* successful `attachSession()` proves the method exists, not that the session is listed —
|
|
15
|
+
* so the check is "does this child appear in `sessionQuery.listSessions()`", polled briefly
|
|
16
|
+
* because the workspace catches up asynchronously.
|
|
17
|
+
*/
|
|
18
|
+
const shape = (v) => {
|
|
19
|
+
if (v === null)
|
|
20
|
+
return 'null';
|
|
21
|
+
if (v === undefined)
|
|
22
|
+
return 'undefined';
|
|
23
|
+
if (typeof v !== 'object')
|
|
24
|
+
return typeof v;
|
|
25
|
+
const keys = Object.keys(v).slice(0, 6);
|
|
26
|
+
return `${Array.isArray(v) ? 'array' : 'object'}{${keys.join(',')}}`;
|
|
27
|
+
};
|
|
28
|
+
export async function attachCreatedChild(ports) {
|
|
29
|
+
const warnings = [];
|
|
30
|
+
const registry = ports.workspaceRegistry;
|
|
31
|
+
if (typeof registry?.createCanonical !== 'function') {
|
|
32
|
+
const reason = `child ${ports.childId} could NOT be attached to the workspace: no "workspaceRegistry" service (or it exposes no createCanonical) — it may never appear in the sidebar`;
|
|
33
|
+
ports.diagnostic('attach:workspaceRegistry', reason, `resolved=${shape(ports.workspaceRegistry)}`);
|
|
34
|
+
return { attached: false, listed: undefined, warnings: [reason] };
|
|
35
|
+
}
|
|
36
|
+
let workspace;
|
|
37
|
+
try {
|
|
38
|
+
workspace = await registry.createCanonical(ports.cwd);
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
const reason = `child ${ports.childId} could NOT be attached: createCanonical("${ports.cwd}") failed: ${String(error?.message ?? error)}`;
|
|
42
|
+
ports.diagnostic('attach:createCanonical', reason, error);
|
|
43
|
+
return { attached: false, listed: undefined, warnings: [reason] };
|
|
44
|
+
}
|
|
45
|
+
if (typeof workspace?.attachSession !== 'function') {
|
|
46
|
+
// THE 0.2.x hypothesis: the host reshaped this return. Before this module the optional
|
|
47
|
+
// chain made it a no-op with no word said; now it is a named, diagnosable mismatch.
|
|
48
|
+
const reason = `child ${ports.childId} could NOT be attached: createCanonical returned no "attachSession" method (got ${shape(workspace)}) — the host workspace API changed shape; the child is durable but may not appear in the sidebar`;
|
|
49
|
+
ports.diagnostic('attach:attachSession', reason, `workspace=${shape(workspace)}`);
|
|
50
|
+
return { attached: false, listed: undefined, warnings: [reason] };
|
|
51
|
+
}
|
|
52
|
+
try {
|
|
53
|
+
await workspace.attachSession(ports.childId);
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
const reason = `child ${ports.childId} attach was refused: ${String(error?.message ?? error)}`;
|
|
57
|
+
ports.diagnostic('attach:attachSession', reason, error);
|
|
58
|
+
return { attached: false, listed: undefined, warnings: [reason] };
|
|
59
|
+
}
|
|
60
|
+
// Attached. Now the part the throw can't tell us: is it actually LISTED?
|
|
61
|
+
const sq = ports.sessionQuery;
|
|
62
|
+
if (typeof sq?.listSessions !== 'function') {
|
|
63
|
+
return {
|
|
64
|
+
attached: true,
|
|
65
|
+
listed: undefined,
|
|
66
|
+
warnings: [`child ${ports.childId} attached, but its listing is UNVERIFIED — no sessionQuery service to ask`],
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
const intervalMs = ports.pollIntervalMs ?? 150;
|
|
70
|
+
const budgetMs = ports.pollBudgetMs ?? 1500;
|
|
71
|
+
const deadline = Date.now() + budgetMs;
|
|
72
|
+
for (;;) {
|
|
73
|
+
let ids = [];
|
|
74
|
+
try {
|
|
75
|
+
ids = (await sq.listSessions() ?? []).map((r) => r?.header?.id ?? '');
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
// a failed LOOKUP is not a failed session — say which one happened
|
|
79
|
+
const reason = `child ${ports.childId} attached, but its listing could not be verified: sessionQuery.listSessions failed: ${String(error?.message ?? error)}`;
|
|
80
|
+
ports.diagnostic('attach:verify', reason, error);
|
|
81
|
+
return { attached: true, listed: undefined, warnings: [reason] };
|
|
82
|
+
}
|
|
83
|
+
if (ids.includes(ports.childId)) {
|
|
84
|
+
// Listed by PERSISTENCE is not the same claim as listed to the BROWSER. The gateway's
|
|
85
|
+
// `sessionController.list()` is the surface the client renders and can `open()` against,
|
|
86
|
+
// and on 0.2.0-rc.2 a plugin-created child was present in one and absent from the other
|
|
87
|
+
// (measured: the door's roster note said `MISSING, 1 sessions` while `listSessions`
|
|
88
|
+
// listed it) — so a single boolean would have called that a success.
|
|
89
|
+
const sc = ports.sessionController;
|
|
90
|
+
if (typeof sc?.list !== 'function') {
|
|
91
|
+
// Silence here is what cost a round of the 0.2.x hunt: "no warning" got read as "the
|
|
92
|
+
// gateway lists it". An unverified surface is a STATE and must be delivered as one.
|
|
93
|
+
const reason = `child ${ports.childId} is listed in the durable session corpus, but its presence in the gateway (browser) session list could not be verified — no "sessionController" service to ask`;
|
|
94
|
+
ports.diagnostic('attach:gatewayList', reason, `resolved=${shape(ports.sessionController)}`);
|
|
95
|
+
return { attached: true, listed: true, gatewayListed: undefined, warnings: [reason] };
|
|
96
|
+
}
|
|
97
|
+
let gids = [];
|
|
98
|
+
try {
|
|
99
|
+
gids = (await sc.list() ?? []).map((r) => r?.sessionId ?? r?.header?.id ?? '');
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
const reason = `child ${ports.childId} is listed, but the gateway session list could not be verified: ${String(error?.message ?? error)}`;
|
|
103
|
+
ports.diagnostic('attach:gatewayList', reason, error);
|
|
104
|
+
return { attached: true, listed: true, gatewayListed: undefined, warnings: [reason] };
|
|
105
|
+
}
|
|
106
|
+
if (gids.includes(ports.childId))
|
|
107
|
+
return { attached: true, listed: true, gatewayListed: true, warnings: [] };
|
|
108
|
+
const reason = `child ${ports.childId} is in the durable session list but NOT in the gateway's session list (sessionController.list returned ${String(gids.length)} sessions) — the browser cannot show or open it, so the door will not be able to switch`;
|
|
109
|
+
ports.diagnostic('attach:gatewayList', reason, `gateway=${gids.slice(0, 4).join(',')}`);
|
|
110
|
+
return { attached: true, listed: true, gatewayListed: false, warnings: [reason] };
|
|
111
|
+
}
|
|
112
|
+
if (Date.now() + intervalMs > deadline) {
|
|
113
|
+
const reason = `child ${ports.childId} was attached but does not appear in the session list within ${String(budgetMs)}ms (${String(ids.length)} sessions listed) — the archive is durable; the sidebar may not show it`;
|
|
114
|
+
ports.diagnostic('attach:verify', reason, `listed=${ids.slice(0, 4).join(',')}`);
|
|
115
|
+
return { attached: true, listed: false, warnings: [reason] };
|
|
116
|
+
}
|
|
117
|
+
await new Promise((r) => setTimeout(r, intervalMs));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
//# sour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ChildView) => Promise<{
|
|
32
32
|
archived: number;
|
|
33
33
|
skipped: string | null;
|
|
34
|
+
warnings: string[];
|
|
34
35
|
}>;
|
|
35
36
|
warn: (message: string) => void;
|
|
36
37
|
/** Observability seam: what each settlement decided. Outcome vocabulary pinned by tests. */
|
|
@@ -68,4 +69,77 @@ export interface AutoSaveWiring extends SaveSessionConfig {
|
|
|
68
69
|
* for the idle/afterPush ladders exactly like a `/chapters-save` that skipped
|
|
69
70
|
* the manual nudge. A test pins that nothing here calls runNow.
|
|
70
71
|
*/
|
|
72
|
+
/**
|
|
73
|
+
* The ONE payload-bearing durable read (docs/contract.md § Durable reads, issue #58).
|
|
74
|
+
*
|
|
75
|
+
* Door 5 needs it because a continuable child is disposed before `subagent/end`; the repair door
|
|
76
|
+
* (`/chapters-repair`, #60) needs the same thing because re-deriving a chapter is worthless if the read
|
|
77
|
+
* returns metadata rows. Two copies of "read the log" is how 12 children were archived as empty shells
|
|
78
|
+
* and the seam still looked alive: `listEvents` succeeds, returns 10 correctly-typed
|
|
79
|
+
* `SessionEventRecord`s, and none of them has `data`. So this function is exported and pinned by a
|
|
80
|
+
* source-shape row that fails if a door starts reading the log by hand again.
|
|
81
|
+
*/
|
|
82
|
+
export declare function readDurableSession(get: (name: string) => unknown, sessionId: string, onError?: (message: string) => void): Promise<AutoSaveChildView | undefined>;
|
|
83
|
+
/**
|
|
84
|
+
* The seventh archive moment (#61, Amendment A): **a rooted child that has never archived.**
|
|
85
|
+
*
|
|
86
|
+
* Door 5 is keyed on `origin: 'subagent'`. A `ch-*` continuation child is NOT a subagent — its header
|
|
87
|
+
* says `origin: user` with a `parentSession` — so no moment was watching it at all. The field case was
|
|
88
|
+
* `ch-dc3be3ab`: 2,363 events, 414 tool calls, 2 completed turns, `chapters: []`, `reservations: {}`.
|
|
89
|
+
* Not a failed archive: one never attempted. Its knowledge sits in the log and is invisible to every
|
|
90
|
+
* search on the machine, which is precisely what this plugin exists to prevent.
|
|
91
|
+
*
|
|
92
|
+
* This is the PURE gate — the listener below only does I/O, so the decision is testable (and reviewable)
|
|
93
|
+
* without a host.
|
|
94
|
+
*/
|
|
95
|
+
export declare function shouldForceChildArchive(input: {
|
|
96
|
+
header: {
|
|
97
|
+
origin?: string;
|
|
98
|
+
agentPreset?: string;
|
|
99
|
+
parentSession?: string;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Lineage, from ANY of its three real sources — measured 2026-10-22, because the first version of
|
|
103
|
+
* this gate asked the KERNEL HEADER and silently missed the field case: `ch-dc3be3ab` carries
|
|
104
|
+
* `parentSession: NONE, origin: undefined`. Lineage lives in (a) the registry row, which
|
|
105
|
+
* `chapters_continue` writes via `linkChild` at continue-core.ts:520, (b) the header, when the host
|
|
106
|
+
* sets one, and (c) the id itself — `ch-${newId()}` is minted by continue-core.ts:501, so the prefix
|
|
107
|
+
* is OUR OWN durable claim that this session is a continuation child. A row that never archived can
|
|
108
|
+
* still carry the link, and a session with no row at all still carries the prefix.
|
|
109
|
+
*/
|
|
110
|
+
lineageParent?: string | null | undefined;
|
|
111
|
+
chapterCount: number;
|
|
112
|
+
lastArchivedSeq: number;
|
|
113
|
+
anchor: number;
|
|
114
|
+
completedTurnsAboveWatermark: number;
|
|
115
|
+
minTurns: number;
|
|
116
|
+
enabled: boolean;
|
|
117
|
+
}): {
|
|
118
|
+
fire: boolean;
|
|
119
|
+
reason: string;
|
|
120
|
+
};
|
|
121
|
+
export interface ChildArchiveCtx {
|
|
122
|
+
logger?: {
|
|
123
|
+
warn?: (m: string) => void;
|
|
124
|
+
info?: (m: string) => void;
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
export interface ChildArchiveDeps {
|
|
128
|
+
ctx: ChildArchiveCtx;
|
|
129
|
+
/** A getter, not a value: the realm's store opens asynchronously and once (#61). */
|
|
130
|
+
store: () => Promise<RegistryStore>;
|
|
131
|
+
wiring: AutoSaveWiring;
|
|
132
|
+
/** config `childAutoArchive`, default true — the operator can close this door. */
|
|
133
|
+
enabled: boolean;
|
|
134
|
+
/** config `childAutoArchiveMinTurns`, default 4 — the lag that re-arms it after the first save. */
|
|
135
|
+
minTurns: number;
|
|
136
|
+
onArchived?: (id: string, records: number) => void;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* The listener. Save-only — creates NO session and compacts NO surface, so the "no
|
|
140
|
+
* continuation-creating actions mid-step" rule is not engaged (the same reasoning that let door 5
|
|
141
|
+
* exist). Fires only on `turn/end`, reads the LIVE session's own payload-bearing events, and is
|
|
142
|
+
* watermark-idempotent: a re-run finds `nothing-new` and writes nothing.
|
|
143
|
+
*/
|
|
144
|
+
export declare function makeChildArchiveListener(deps: ChildArchiveDeps): (session: unknown, event: unknown) => void;
|
|
71
145
|
export declare function wireSubagentAutoSave(ctx: AutoSaveCtx, store: RegistryStore, wiring: AutoSaveWiring): (info: SubagentEndInfoLike) => void;
|
package/lib/auto-save.js
CHANGED
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
* non-archive is either a quiet, expected skip (wrong preset, no completed turn)
|
|
26
26
|
* or a LOUD warn (unreadable, save failed).
|
|
27
27
|
*/
|
|
28
|
-
import {
|
|
28
|
+
import { diagnosticWarn } from "./diag.js";
|
|
29
|
+
import { formatWarnings } from "./warnings.js";
|
|
29
30
|
import { saveSession } from "./save-core.js";
|
|
30
31
|
import { lineageOf } from "./types.js";
|
|
31
32
|
const hasCompletedTurn = (events) => events.some((e) => e.type === 'turn/end');
|
|
@@ -91,6 +92,12 @@ export function makeSubagentEndListener(deps) {
|
|
|
91
92
|
}
|
|
92
93
|
try {
|
|
93
94
|
const out = await deps.save(view);
|
|
95
|
+
// #58: 'payloadless' is an anomaly, not an expected skip — the child settled with a
|
|
96
|
+
// read that carried no bytes, so its knowledge is NOT archived. Loud, by the same
|
|
97
|
+
// containment rule as 'unreadable'. 'nothing-new'/'no-completed-turn' stay quiet.
|
|
98
|
+
if (out.skipped === 'payloadless') {
|
|
99
|
+
deps.warn(`subagent auto-save: ${id} settled with an archive that rendered nothing — NOT archived (a payload-less read, not a short conversation): ${out.warnings.join('; ')}`);
|
|
100
|
+
}
|
|
94
101
|
deps.onSettled?.(id, out.skipped === null ? `saved${suffix}` : `skipped:${out.skipped}${suffix}`);
|
|
95
102
|
}
|
|
96
103
|
catch (error) {
|
|
@@ -120,17 +127,146 @@ export function makeSubagentEndListener(deps) {
|
|
|
120
127
|
* for the idle/afterPush ladders exactly like a `/chapters-save` that skipped
|
|
121
128
|
* the manual nudge. A test pins that nothing here calls runNow.
|
|
122
129
|
*/
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
130
|
+
/**
|
|
131
|
+
* The ONE payload-bearing durable read (docs/contract.md § Durable reads, issue #58).
|
|
132
|
+
*
|
|
133
|
+
* Door 5 needs it because a continuable child is disposed before `subagent/end`; the repair door
|
|
134
|
+
* (`/chapters-repair`, #60) needs the same thing because re-deriving a chapter is worthless if the read
|
|
135
|
+
* returns metadata rows. Two copies of "read the log" is how 12 children were archived as empty shells
|
|
136
|
+
* and the seam still looked alive: `listEvents` succeeds, returns 10 correctly-typed
|
|
137
|
+
* `SessionEventRecord`s, and none of them has `data`. So this function is exported and pinned by a
|
|
138
|
+
* source-shape row that fails if a door starts reading the log by hand again.
|
|
139
|
+
*/
|
|
140
|
+
export async function readDurableSession(get, sessionId, onError) {
|
|
141
|
+
const sq = get('sessionQuery');
|
|
142
|
+
if (sq?.readSession === undefined)
|
|
143
|
+
return undefined;
|
|
144
|
+
// #101, measured live: the kernel can REFUSE a session (`stored session "ch-…" is corrupt: …`) even
|
|
145
|
+
// though the bytes decode fine offline, because it validates against its own format rules. Left
|
|
146
|
+
// uncaught, that one refusal propagated out of a per-session loop and cancelled an audit of 49
|
|
147
|
+
// rows — one poison item stopping the rest, the same rule the finalize queue already obeys. So the
|
|
148
|
+
// read is contained here, in the one helper both planes share, and the caller is handed the reason:
|
|
149
|
+
// skipping must be reported, never silent (#61a).
|
|
150
|
+
let read;
|
|
151
|
+
try {
|
|
152
|
+
read = await sq.readSession(sessionId);
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
onError?.(String(error?.message ?? error).slice(0, 200));
|
|
156
|
+
return undefined;
|
|
157
|
+
}
|
|
158
|
+
const events = read?.events;
|
|
159
|
+
if (!Array.isArray(events) || events.length === 0)
|
|
160
|
+
return undefined;
|
|
161
|
+
// The header rides the same observation as the bytes being archived — origin/agentPreset/cwd are
|
|
162
|
+
// never inferred from a second scan (and never from the events, which is the r28 lesson).
|
|
163
|
+
return { events, header: read.session ?? {} };
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* The seventh archive moment (#61, Amendment A): **a rooted child that has never archived.**
|
|
167
|
+
*
|
|
168
|
+
* Door 5 is keyed on `origin: 'subagent'`. A `ch-*` continuation child is NOT a subagent — its header
|
|
169
|
+
* says `origin: user` with a `parentSession` — so no moment was watching it at all. The field case was
|
|
170
|
+
* `ch-dc3be3ab`: 2,363 events, 414 tool calls, 2 completed turns, `chapters: []`, `reservations: {}`.
|
|
171
|
+
* Not a failed archive: one never attempted. Its knowledge sits in the log and is invisible to every
|
|
172
|
+
* search on the machine, which is precisely what this plugin exists to prevent.
|
|
173
|
+
*
|
|
174
|
+
* This is the PURE gate — the listener below only does I/O, so the decision is testable (and reviewable)
|
|
175
|
+
* without a host.
|
|
176
|
+
*/
|
|
177
|
+
export function shouldForceChildArchive(input) {
|
|
178
|
+
if (!input.enabled)
|
|
179
|
+
return { fire: false, reason: 'childAutoArchive is off in config' };
|
|
180
|
+
if (input.header.agentPreset !== 'chapters')
|
|
181
|
+
return { fire: false, reason: 'not a chapters-preset session' };
|
|
182
|
+
// door 5 owns delegation; two doors on one child would double-write the same span
|
|
183
|
+
if (input.header.origin === 'subagent')
|
|
184
|
+
return { fire: false, reason: 'owned by subagent settlement (door 5)' };
|
|
185
|
+
// Only a ROOTED child: a session with no parent anywhere is the user's own session, whose doors are
|
|
186
|
+
// 1–3 (a human, a button, pressure) and which this plugin must not archive behind their back.
|
|
187
|
+
const parent = input.header.parentSession ?? input.lineageParent ?? '';
|
|
188
|
+
if (parent === undefined || parent === '') {
|
|
189
|
+
return { fire: false, reason: 'no lineage (header, registry row, or ch- id) — a root session, doors 1–3 own it' };
|
|
190
|
+
}
|
|
191
|
+
if (input.anchor <= 0)
|
|
192
|
+
return { fire: false, reason: 'no completed turn yet' };
|
|
193
|
+
if (input.chapterCount === 0) {
|
|
194
|
+
return { fire: true, reason: 'never archived — the hole #61 measured (2,363 events, chapters: [])' };
|
|
195
|
+
}
|
|
196
|
+
if (input.completedTurnsAboveWatermark < input.minTurns) {
|
|
197
|
+
return { fire: false, reason: `${input.completedTurnsAboveWatermark} unarchived turn(s) < childAutoArchiveMinTurns=${input.minTurns}` };
|
|
198
|
+
}
|
|
199
|
+
return { fire: true, reason: `${input.completedTurnsAboveWatermark} completed turns past the watermark (seq ${input.lastArchivedSeq})` };
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* The listener. Save-only — creates NO session and compacts NO surface, so the "no
|
|
203
|
+
* continuation-creating actions mid-step" rule is not engaged (the same reasoning that let door 5
|
|
204
|
+
* exist). Fires only on `turn/end`, reads the LIVE session's own payload-bearing events, and is
|
|
205
|
+
* watermark-idempotent: a re-run finds `nothing-new` and writes nothing.
|
|
206
|
+
*/
|
|
207
|
+
export function makeChildArchiveListener(deps) {
|
|
208
|
+
const chains = new Map();
|
|
209
|
+
const section = (id, job) => {
|
|
210
|
+
const prev = chains.get(id) ?? Promise.resolve();
|
|
211
|
+
const next = prev.then(job, job);
|
|
212
|
+
chains.set(id, next.then(() => undefined, () => undefined));
|
|
213
|
+
};
|
|
214
|
+
return (session, event) => {
|
|
128
215
|
try {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
216
|
+
if (event?.type !== 'turn/end')
|
|
217
|
+
return;
|
|
218
|
+
const s = session;
|
|
219
|
+
const id = s?.id;
|
|
220
|
+
const header = s?.header;
|
|
221
|
+
const cwd = header?.cwd;
|
|
222
|
+
if (id === undefined || header === undefined || cwd === undefined || typeof s?.snapshotEvents !== 'function')
|
|
223
|
+
return;
|
|
224
|
+
const events = [...(s.snapshotEvents())];
|
|
225
|
+
const anchor = [...events].reverse().find((e) => e.type === 'turn/end')?.seq ?? -1;
|
|
226
|
+
section(id, async () => {
|
|
227
|
+
// resolved ONCE per section: calling the getter twice would reopen the domain store inside a
|
|
228
|
+
// live turn boundary.
|
|
229
|
+
const store = await deps.store();
|
|
230
|
+
const state0 = await store.get(id);
|
|
231
|
+
const lastArchived = state0.chapters.reduce((m, c) => Math.max(m, c.endSeq), -1);
|
|
232
|
+
const completed = events.filter((e) => e.type === 'turn/end' && e.seq > lastArchived && e.seq <= anchor).length;
|
|
233
|
+
const gate = shouldForceChildArchive({
|
|
234
|
+
header,
|
|
235
|
+
lineageParent: state0.parentSession ?? (id.startsWith('ch-') ? 'continuation-id' : undefined),
|
|
236
|
+
chapterCount: state0.chapters.filter((c) => c.status !== 'superseded').length,
|
|
237
|
+
lastArchivedSeq: lastArchived,
|
|
238
|
+
anchor,
|
|
239
|
+
completedTurnsAboveWatermark: completed,
|
|
240
|
+
minTurns: deps.minTurns,
|
|
241
|
+
enabled: deps.enabled,
|
|
242
|
+
});
|
|
243
|
+
if (!gate.fire)
|
|
244
|
+
return;
|
|
245
|
+
const out = await saveSession({
|
|
246
|
+
events, sessionId: id, cwd, store, config: deps.wiring,
|
|
247
|
+
subagentOf: lineageOf(header),
|
|
248
|
+
});
|
|
249
|
+
if (out.records.length > 0) {
|
|
250
|
+
deps.ctx.logger?.info?.(`dsh-chapters: forced child archive ${id} (${out.records.length} chapter(s), seqs ${out.fromSeq}..${out.anchor}) — ${gate.reason}`);
|
|
251
|
+
// enrichment QUEUED, never run inline: this fires inside a live turn boundary.
|
|
252
|
+
deps.wiring.scheduler?.schedule(cwd, 'archive:save');
|
|
253
|
+
deps.onArchived?.(id, out.records.length);
|
|
254
|
+
}
|
|
255
|
+
else if (out.skipped !== 'nothing-new') {
|
|
256
|
+
// loud, per #61: a door that decided to archive and then did not must say why.
|
|
257
|
+
diagnosticWarn(deps.ctx.logger, 'child-archive', `${id} forced archive produced nothing (${out.skipped ?? 'unknown'}); ${formatWarnings(out.warnings, 3)}`);
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
catch (error) {
|
|
262
|
+
diagnosticWarn(deps.ctx.logger, 'child-archive', `listener failed: ${String(error?.message ?? error)}`);
|
|
132
263
|
}
|
|
133
|
-
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
export function wireSubagentAutoSave(ctx, store, wiring) {
|
|
267
|
+
const warn = (message) => {
|
|
268
|
+
// #54: the shared seam (logger warn + sink), not a second copy of the same three lines.
|
|
269
|
+
diagnosticWarn(ctx.logger, 'auto-save', message);
|
|
134
270
|
};
|
|
135
271
|
const liveChild = (sessionId) => {
|
|
136
272
|
const agents = ctx.get?.('agents');
|
|
@@ -140,19 +276,20 @@ export function wireSubagentAutoSave(ctx, store, wiring) {
|
|
|
140
276
|
return undefined;
|
|
141
277
|
return { events: [...session.snapshotEvents()], header: (session.header ?? {}) };
|
|
142
278
|
};
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
279
|
+
/**
|
|
280
|
+
* The durable arm — and for a **continuable** child the ONLY arm, because the host disposes the
|
|
281
|
+
* handle before it emits `subagent/end` (`host-subagent-seam.test.ts` F4). It must return
|
|
282
|
+
* payload-bearing events, so it reads `sessionQuery.readSession` (cloned header +
|
|
283
|
+
* `snapshotSessionEvent` events, one call) and **not** `listEvents`, whose `SessionEventRecord`
|
|
284
|
+
* rows carry `seq`/`type`/`time`/`surface` and no `data` — the shape that archived 12 children
|
|
285
|
+
* as empty shells (#58; `docs/contract.md` § Durable reads).
|
|
286
|
+
*/
|
|
287
|
+
const durableChild = (sessionId) => readDurableSession((name) => { try {
|
|
288
|
+
return ctx.get?.(name);
|
|
289
|
+
}
|
|
290
|
+
catch {
|
|
291
|
+
return undefined;
|
|
292
|
+
} }, sessionId);
|
|
156
293
|
const save = async (child) => {
|
|
157
294
|
const cwd = child.header.cwd;
|
|
158
295
|
if (cwd === undefined || cwd === '')
|
|
@@ -165,10 +302,22 @@ export function wireSubagentAutoSave(ctx, store, wiring) {
|
|
|
165
302
|
config: wiring,
|
|
166
303
|
subagentOf: lineageOf(child.header),
|
|
167
304
|
});
|
|
168
|
-
|
|
169
|
-
|
|
305
|
+
// Lineage: the child stays its OWN root, and that is deliberate (#47 decision, re-checked
|
|
306
|
+
// under #58). Two candidate reasons to `linkChild` it to the parent were tested and both fail:
|
|
307
|
+
// a subagent is never an ANCESTOR of anything the parent walks, so `buildIndex` would still
|
|
308
|
+
// omit it from the parent's TOC; and `rootSession` is the STORE DIRECTORY (`archive.ts:110`,
|
|
309
|
+
// `engine-core.ts:310`), so linking would silently re-home every child chapter into the
|
|
310
|
+
// parent's tree. Cross-session reachability is search's job — `buildLocalCorpus` walks every
|
|
311
|
+
// tree under the store root — and rule ancestry already reads the kernel header's parentSession
|
|
312
|
+
// (`session-rules.ruleAncestorSet`), which the frontmatter records from the same source.
|
|
313
|
+
if (out.skipped === null && out.records.length > 0 && cwd !== '') {
|
|
314
|
+
wiring.scheduler?.schedule(cwd, 'archive:autoSave');
|
|
170
315
|
}
|
|
171
|
-
|
|
316
|
+
// #58: `writeArchive` already says "N event(s) rendered no output"; dropping that array was
|
|
317
|
+
// why an entire door of empty archives ran for days with a clean log. Surface every warning.
|
|
318
|
+
for (const w of out.warnings)
|
|
319
|
+
warn(`subagent auto-save: ${child.header.id ?? '?'}: ${w}`);
|
|
320
|
+
return { archived: out.records.length, skipped: out.skipped, warnings: out.warnings };
|
|
172
321
|
};
|
|
173
322
|
return makeSubagentEndListener({
|
|
174
323
|
pres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