dsh-plugin-dev-kb 1.0.9 → 1.1.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 +10 -0
- package/README.en.md +6 -6
- package/README.md +6 -6
- package/kb/INDEX.md +4 -2
- package/kb/README.md +4 -4
- package/kb/extra/AGENTS.md +1 -1
- package/kb/extra/cookbook/adding-a-remote-api.md +197 -0
- package/kb/extra/cookbook/adding-a-remote-api.zh.md +197 -0
- package/kb/extra/deepseek-llm-api-wire-extensions.md +18 -14
- package/kb/extra/deepseek-llm-api-wire-extensions.zh.md +18 -14
- package/kb/extra/event-producer-consumer.md +44 -43
- package/kb/extra/event-producer-consumer.zh.md +47 -46
- package/kb/extra/i18n/style-samples.md +2 -2
- package/kb/extra/module-graph.md +444 -991
- package/kb/extra/module-graph.zh.md +446 -993
- package/kb/extra/subsystems/agent-team.md +4 -3
- package/kb/extra/subsystems/agent-team.zh.md +4 -3
- package/kb/extra/subsystems/attachment.md +157 -4
- package/kb/extra/subsystems/attachment.zh.md +157 -4
- package/kb/extra/subsystems/feedback.md +2 -2
- package/kb/extra/subsystems/feedback.zh.md +2 -2
- package/kb/extra/testing.md +6 -2
- package/kb/extra/testing.zh.md +6 -2
- package/kb/extra/web-styling.md +4 -0
- package/kb/extra/web-styling.zh.md +4 -0
- package/kb/meta/search-index.json +135 -111
- package/kb/meta/site-pages.txt +184 -182
- package/kb/meta/source.json +5 -5
- package/kb/meta/topics.md +4 -4
- package/kb/site/develop/cordis-tutorial/07-into-the-harness.md +3 -2
- package/kb/site/develop/practice/llm-adapter.md +4 -3
- package/kb/site/en/develop/cordis-tutorial/07-into-the-harness.md +3 -2
- package/kb/site/en/develop/practice/llm-adapter.md +4 -3
- package/kb/site/en/guide/network-proxy.md +87 -0
- package/kb/site/en/guide/providers.md +70 -17
- package/kb/site/en/guide/schedule.md +2 -0
- package/kb/site/en/reference/agent-lifecycle.md +5 -3
- package/kb/site/en/reference/api-gateway.md +2 -2
- package/kb/site/en/reference/capability-seams.md +14 -7
- package/kb/site/en/reference/config-catalog.md +157 -230
- package/kb/site/en/reference/cookbook/adding-a-package.md +1 -2
- package/kb/site/en/reference/cookbook/adding-a-settings-card.md +10 -8
- package/kb/site/en/reference/cookbook/extension-cookbook.md +15 -12
- package/kb/site/en/reference/index.md +11 -4
- package/kb/site/en/reference/persistence-catalog.md +91 -70
- package/kb/site/en/reference/subsystems/code-runtime.md +7 -3
- package/kb/site/en/reference/subsystems/commands.md +25 -16
- package/kb/site/en/reference/subsystems/compaction.md +9 -9
- package/kb/site/en/reference/subsystems/conversation.md +11 -4
- package/kb/site/en/reference/subsystems/core.md +96 -15
- package/kb/site/en/reference/subsystems/credentials.md +5 -4
- package/kb/site/en/reference/subsystems/goal.md +1 -1
- package/kb/site/en/reference/subsystems/index.md +1 -1
- package/kb/site/en/reference/subsystems/llm-streaming.md +24 -3
- package/kb/site/en/reference/subsystems/permission-presets.md +5 -5
- package/kb/site/en/reference/subsystems/persistence.md +185 -194
- package/kb/site/en/reference/subsystems/plan.md +3 -3
- package/kb/site/en/reference/subsystems/sandbox.md +2 -0
- package/kb/site/en/reference/subsystems/schedule.md +9 -3
- package/kb/site/en/reference/subsystems/session-projection.md +50 -24
- package/kb/site/en/reference/subsystems/session-query.md +19 -13
- package/kb/site/en/reference/subsystems/session-reference.md +25 -1
- package/kb/site/en/reference/subsystems/session-telemetry.md +6 -5
- package/kb/site/en/reference/subsystems/session-title.md +6 -6
- package/kb/site/en/reference/subsystems/session.md +156 -73
- package/kb/site/en/reference/subsystems/settings.md +30 -12
- package/kb/site/en/reference/subsystems/skills.md +1 -1
- package/kb/site/en/reference/subsystems/slots.md +1 -0
- package/kb/site/en/reference/subsystems/storage.md +28 -5
- package/kb/site/en/reference/subsystems/subagent.md +43 -97
- package/kb/site/en/reference/subsystems/system-prompt.md +16 -3
- package/kb/site/en/reference/subsystems/token-meter.md +2 -2
- package/kb/site/en/reference/subsystems/typert.md +18 -18
- package/kb/site/en/reference/subsystems/web-client.md +1 -1
- package/kb/site/en/reference/subsystems/workspace.md +8 -8
- package/kb/site/en/reference/tool-catalog.md +10 -64
- package/kb/site/guide/network-proxy.md +87 -0
- package/kb/site/guide/providers.md +70 -17
- package/kb/site/guide/schedule.md +2 -0
- package/kb/site/reference/agent-lifecycle.md +5 -3
- package/kb/site/reference/api-gateway.md +2 -2
- package/kb/site/reference/capability-seams.md +14 -7
- package/kb/site/reference/config-catalog.md +156 -229
- package/kb/site/reference/cookbook/adding-a-package.md +1 -2
- package/kb/site/reference/cookbook/adding-a-settings-card.md +10 -8
- package/kb/site/reference/cookbook/extension-cookbook.md +15 -12
- package/kb/site/reference/index.md +11 -4
- package/kb/site/reference/persistence-catalog.md +91 -70
- package/kb/site/reference/subsystems/code-runtime.md +7 -3
- package/kb/site/reference/subsystems/commands.md +25 -16
- package/kb/site/reference/subsystems/compaction.md +9 -9
- package/kb/site/reference/subsystems/conversation.md +11 -4
- package/kb/site/reference/subsystems/core.md +96 -15
- package/kb/site/reference/subsystems/credentials.md +5 -4
- package/kb/site/reference/subsystems/goal.md +1 -1
- package/kb/site/reference/subsystems/index.md +1 -1
- package/kb/site/reference/subsystems/llm-streaming.md +24 -3
- package/kb/site/reference/subsystems/permission-presets.md +5 -5
- package/kb/site/reference/subsystems/persistence.md +184 -193
- package/kb/site/reference/subsystems/plan.md +3 -3
- package/kb/site/reference/subsystems/schedule.md +9 -3
- package/kb/site/reference/subsystems/session-projection.md +50 -24
- package/kb/site/reference/subsystems/session-query.md +19 -13
- package/kb/site/reference/subsystems/session-reference.md +25 -1
- package/kb/site/reference/subsystems/session-telemetry.md +6 -5
- package/kb/site/reference/subsystems/session-title.md +6 -6
- package/kb/site/reference/subsystems/session.md +156 -73
- package/kb/site/reference/subsystems/settings.md +30 -12
- package/kb/site/reference/subsystems/skills.md +1 -1
- package/kb/site/reference/subsystems/slots.md +1 -0
- package/kb/site/reference/subsystems/storage.md +28 -5
- package/kb/site/reference/subsystems/subagent.md +43 -97
- package/kb/site/reference/subsystems/system-prompt.md +16 -3
- package/kb/site/reference/subsystems/token-meter.md +2 -2
- package/kb/site/reference/subsystems/typert.md +18 -18
- package/kb/site/reference/subsystems/web-client.md +1 -1
- package/kb/site/reference/subsystems/workspace.md +8 -8
- package/kb/site/reference/tool-catalog.md +9 -63
- package/package.json +2 -2
- package/skills/dsh-plugin-dev-kb.md +4 -4
|
@@ -5,31 +5,114 @@ outline: [2,3]
|
|
|
5
5
|
|
|
6
6
|
# Session Persistence
|
|
7
7
|
|
|
8
|
-
The **durability seam** for the event log. [session.md](./session.md) describes the in-memory `Session` — the append-only `SessionEvent` log that is the source of truth. This page describes how that log is made durable: the abstract `SessionPersistence` service, its
|
|
8
|
+
The **durability seam** for the event log. [session.md](./session.md) describes the in-memory `Session` — the append-only `SessionEvent` log that is the source of truth. This page describes how that log is made durable: the abstract `SessionPersistence` service, its provider model and shipped JSONL backend, the flush checkpoint, crash recovery, and the metadata header that travels alongside the log. The event vocabulary the log carries is enumerated, member by member, in the generated [persistence log event catalog](../persistence-catalog.md).
|
|
9
9
|
|
|
10
|
-
The seam is a [capability seam](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/architecture/2026-06-13-capability-seams.md): one abstract service ([dsh-session-persistence](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/session/session-persistence), `ctx.sessionPersistence`)
|
|
10
|
+
The seam is a [capability seam](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/architecture/2026-06-13-capability-seams.md): one abstract service ([dsh-session-persistence](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/session/session-persistence), `ctx.sessionPersistence`) exposing `create`/`open`/`stat`/`list` over the existing `SessionEvent` — **no parallel persisted event type** — where `create` and `open` return a per-session `SessionHandle` (`read`/`append`/`flush`/`close`) that carries all log access and single-writer ownership. The repository ships [dsh-session-persistence-jsonl](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/session/session-persistence-jsonl) as its provider; out-of-tree providers may implement the same service contract. See the [handle-based persistence Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/architecture/2026-08-27-handle-based-session-persistence.md) and the [session-persistence Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/architecture/2026-06-14-session-persistence.md).
|
|
11
|
+
|
|
12
|
+
## `SessionHandle` — one open channel onto a stored session
|
|
13
|
+
|
|
14
|
+
Every log read and write flows through a handle, never through id-addressed service methods: the handle is the single door the cross-process write lease guards. One handle type serves both accesses — a mutation on a `read` handle is a runtime `SessionReadOnlyError` rather than a typed split — and in-process single-writer ownership makes a second `open(id, 'write')` reject with `SessionAlreadyOwnedError` while an owner is active.
|
|
15
|
+
|
|
16
|
+
```ts type-equiv
|
|
17
|
+
/**
|
|
18
|
+
* One open channel onto a stored session. A handle is single-owner state, not
|
|
19
|
+
* a shared service: `read` never backtracks below what this handle already
|
|
20
|
+
* observed, a `write` handle reads its own successful appends, and `close()`
|
|
21
|
+
* is the one teardown (idempotent, uncancellable; `Symbol.asyncDispose`
|
|
22
|
+
* delegates to it). Every operation on a closed handle rejects with
|
|
23
|
+
* `SessionHandleClosedError`.
|
|
24
|
+
*
|
|
25
|
+
* Freshness across handles: once an `append` or `flush` resolves on a write
|
|
26
|
+
* handle, every read STARTED afterwards on the same backend instance — on any
|
|
27
|
+
* handle, or through `stat`/`list` — observes at least that prefix.
|
|
28
|
+
* Reads concurrent with a mutation carry no ordering promise beyond the valid
|
|
29
|
+
* contiguous prefix.
|
|
30
|
+
*/
|
|
31
|
+
interface SessionHandle extends AsyncDisposable {
|
|
32
|
+
/** The stored session this handle addresses. */
|
|
33
|
+
readonly id: SessionId
|
|
34
|
+
/** The immutable stored header, fixed at `create`/`open`. */
|
|
35
|
+
readonly header: SessionHeader
|
|
36
|
+
/**
|
|
37
|
+
* Exact fork-inherited prefix length stored with the log; `0` when
|
|
38
|
+
* `header.isSeeded` is false. Storage metadata paired with the header for
|
|
39
|
+
* every body read, never part of the replayable event log.
|
|
40
|
+
*/
|
|
41
|
+
readonly inheritedEventCount: SessionLogOffset
|
|
42
|
+
/** Whether this handle may mutate the log. */
|
|
43
|
+
readonly access: SessionAccess
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Read a slice of the valid contiguous logical log. The slice is a legal log
|
|
47
|
+
* prefix segment: a torn physical tail is never returned, and repeated reads
|
|
48
|
+
* on this handle never observe an older state than a prior read.
|
|
49
|
+
* @param offset - first logical event seq to include; defaults to `0`.
|
|
50
|
+
* @param length - maximum number of events to return; defaults to the rest
|
|
51
|
+
* of the log. An offset at or past the end returns an empty list.
|
|
52
|
+
* @param options - optional cancellation.
|
|
53
|
+
* @returns the events with `seq >= offset`, at most `length` of them.
|
|
54
|
+
*/
|
|
55
|
+
read(offset?: number, length?: number, options?: SessionHandleReadOptions): Promise<readonly SessionEvent[]>
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Append a contiguous batch continuing the current logical end. The first
|
|
59
|
+
* event's `seq` MUST equal the stored next-seq; committed events are never
|
|
60
|
+
* rewritten. Persistence is best-effort: on resolution the batch is
|
|
61
|
+
* accepted, ordered, and visible to reads on this backend instance, but
|
|
62
|
+
* only a resolved {@link flush} promises it survives a crash — a backend
|
|
63
|
+
* may buffer or batch physical writes behind append. Rejects with
|
|
64
|
+
* `SessionReadOnlyError` on a read handle and `SessionOwnershipLostError`
|
|
65
|
+
* when write ownership is gone.
|
|
66
|
+
* @param events - the contiguous batch, in seq order.
|
|
67
|
+
* @param options - optional cancellation observed before the write starts.
|
|
68
|
+
*/
|
|
69
|
+
append(events: readonly SessionEvent[], options?: SessionHandleAppendOptions): Promise<void>
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The durability barrier — the one operation that promises storage: on
|
|
73
|
+
* resolution every acknowledged append is durable and the session is
|
|
74
|
+
* materialized for other processes; an empty created session becomes
|
|
75
|
+
* durably listable here. Callers that must survive a crash flush; a backend
|
|
76
|
+
* whose `append` already persists on resolution treats this as
|
|
77
|
+
* materialize-if-needed. Rejects with `SessionReadOnlyError` on a read
|
|
78
|
+
* handle.
|
|
79
|
+
* @param options - optional cancellation observed before the barrier starts.
|
|
80
|
+
*/
|
|
81
|
+
flush(options?: SessionHandleFlushOptions): Promise<void>
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Release the handle: a read handle frees local resources; a write handle
|
|
85
|
+
* completes pending durability and releases write ownership. Idempotent,
|
|
86
|
+
* asynchronous, and deliberately not cancellable.
|
|
87
|
+
*/
|
|
88
|
+
close(): Promise<void>
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
A created session is observable in this process from the moment `create` resolves, while a backend may defer physical materialization (a pure optimization) until the first `append` or `flush`; other processes see only materialized sessions, and a session that never materialized before a crash never existed.
|
|
11
93
|
|
|
12
94
|
## The flush checkpoint
|
|
13
95
|
|
|
14
|
-
`session/event` is a *synchronous* notification;
|
|
96
|
+
`session/event` is a *synchronous* notification; the mounted backend routes it by session id into the active write handle's bounded write-behind window without blocking the producer (the backend installs these listeners once, because persistence already enforces one active write handle per id). The first pending event starts a fixed internal batching window, and later events join without resetting its deadline. Expiry starts one durable `append` through the session's write handle; events admitted during that write receive their own deadline and form a follow-up batch. `session/flush` cancels the wait and drains through quiescence, so the loop still uses it as the ordering and error-observation checkpoint before claiming the next ordinary turn. A rejected background write retains its events in order, pauses the automatic path, and is reported through the logger; the next explicit flush retries and rejects loudly to its caller. `session/disposed` performs the same final drain and closes the handle, and `close()` itself drains the routed buffer through the still-open storage, so backend teardown's close sweep loses nothing. The window bounds only intentional batching wait, not event-loop scheduling or backend durability latency ([decision](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/architecture/2026-08-08-bounded-session-persistence-write-batching.md)).
|
|
15
97
|
|
|
16
98
|
## Crash recovery preserves an interrupted turn
|
|
17
99
|
|
|
18
|
-
A
|
|
100
|
+
A log crashed mid-turn ends with an open `turn/start` and no `turn/end`. Persistence does **not** truncate or repair it — a single turn can be huge in a long-horizon task (many steps, large tool output), and those events were durably appended before the crash. It returns the physically valid contiguous log; only the incomplete fragment of a torn physical tail, belonging to an append that never resolved, is discarded — complete records recovered from it (the JSONL backend partially decodes a torn Zstandard frame) are durably rewritten by the write path before the handle's first new append. Repair is the reader's job: resume (agent-loop) reads the stored log through its write handle, computes `interruptedTurnClosers` — missing tool errors, any open `step/end`, and a synthetic `turn/end { reason: { kind: 'interrupted' } }` — and appends them through the same handle as an ordinary batch before publishing the Session. `interrupted` is the one `TurnEndReason` no loop emits (see [session.md](./session.md#why-a-turn-ended-turnendreasonmap)).
|
|
19
101
|
|
|
20
|
-
Repair
|
|
102
|
+
Repair therefore writes only under write ownership: a live session's write handle is held by its lifecycle owner, so a concurrent `open(id, 'write')` rejects with `SessionAlreadyOwnedError` instead of racing repair against a live turn. Read-only observers (session-query) balance an interrupted cold log with the same closers in memory only, writing nothing back.
|
|
21
103
|
|
|
22
|
-
`
|
|
104
|
+
Read-only observation is `open(id, 'read')`: the handle serves validated contiguous prefix slices, never a torn tail, and repeated reads on one handle never observe an older state than a prior read. There is no persistence-side prepared-Session cache: session-query owns its cold-read cache, keying one balanced cold Session per id on the `stat().revision` change token and re-reading only when the token changes. The [handle-based persistence Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/architecture/2026-08-27-handle-based-session-persistence.md) owns this lifecycle; the [Session preparation decision](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/architecture/2026-08-05-session-preparation.md) records the publication-boundary `SessionPreparation` that remains.
|
|
23
105
|
|
|
24
|
-
## `SessionLocation` —
|
|
106
|
+
## `SessionLocation` — refusal-diagnostics artifact target
|
|
25
107
|
|
|
26
|
-
`
|
|
108
|
+
`SessionLocation` is not a consumer-facing query: log access goes through a session handle's `read`. It survives only as refusal diagnostics, letting a `SessionFormatUnsupportedError` name the raw log a build refused to interpret. JSONL supplies the absolute transcript path inside its project/session directory; a backend without one artifact per session supplies nothing.
|
|
27
109
|
|
|
28
110
|
```ts type-equiv
|
|
29
111
|
/**
|
|
30
|
-
* A backend-resolved, per-session local artifact location.
|
|
31
|
-
*
|
|
32
|
-
*
|
|
112
|
+
* A backend-resolved, per-session local artifact location. Carried only by
|
|
113
|
+
* refusal diagnostics ({@link SessionFormatUnsupportedError}) so a user can
|
|
114
|
+
* find the raw log a build refused to interpret; it is not a consumer-facing
|
|
115
|
+
* query — log access goes through a session handle's `read`.
|
|
33
116
|
*/
|
|
34
117
|
interface SessionLocation {
|
|
35
118
|
/** Backend-specific artifact kind, for example `jsonl`. */
|
|
@@ -43,7 +126,7 @@ interface SessionLocation {
|
|
|
43
126
|
|
|
44
127
|
## `SessionHeader` — metadata beside the log
|
|
45
128
|
|
|
46
|
-
Per-session metadata travels **separately** from the event log: format version, cwd,
|
|
129
|
+
Per-session metadata travels **separately** from the event log: the header carries format version, cwd, and the `isSeeded` lineage bit, while body-bearing storage values carry the exact inherited cut beside it. Neither belongs to `SessionEventMap` or reaches `deriveMessages()`. The logical header is attached through `session.header`; the Session exposes its cut as `inheritedEventCount`.
|
|
47
130
|
|
|
48
131
|
Source: [`packages/core/session/src/types.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/core/session/src/types.ts)
|
|
49
132
|
|
|
@@ -53,11 +136,10 @@ Source: [`packages/core/session/src/types.ts`](https://github.com/deepseek-ai/de
|
|
|
53
136
|
*/
|
|
54
137
|
interface SessionHeader {
|
|
55
138
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* (no migration — see the constant).
|
|
139
|
+
* Current logical format version, stamped from {@link SESSION_FORMAT_VERSION}.
|
|
140
|
+
* Historical physical headers are translated before entering this interface.
|
|
59
141
|
*/
|
|
60
|
-
readonly version:
|
|
142
|
+
readonly version: typeof SESSION_FORMAT_VERSION
|
|
61
143
|
/** The session's id (mirrors the {@link Session}'s id). */
|
|
62
144
|
readonly id: SessionId
|
|
63
145
|
/** Non-negative safe-integer Unix epoch milliseconds when the session was created. */
|
|
@@ -67,10 +149,10 @@ interface SessionHeader {
|
|
|
67
149
|
/** The session this one was forked from (seed lineage), if any. */
|
|
68
150
|
readonly parentSession?: SessionId
|
|
69
151
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
152
|
+
* Whether this Session contains a fork-inherited event prefix. The exact prefix
|
|
153
|
+
* length is Session state rather than ordinary header metadata.
|
|
72
154
|
*/
|
|
73
|
-
readonly
|
|
155
|
+
readonly isSeeded: boolean
|
|
74
156
|
/**
|
|
75
157
|
* Coarse product classification for a session created as a subagent child.
|
|
76
158
|
* This is presentation metadata, not proof that the child is continuable.
|
|
@@ -94,11 +176,11 @@ interface SessionHeader {
|
|
|
94
176
|
|
|
95
177
|
## Format refusal — logs a build cannot faithfully read
|
|
96
178
|
|
|
97
|
-
A backend refuses a log it cannot faithfully interpret with `SessionFormatUnsupportedError`, distinct from `SessionPersistenceCorruptionError` because nothing is damaged.
|
|
179
|
+
A backend refuses a log it cannot faithfully interpret with `SessionFormatUnsupportedError`, distinct from `SessionPersistenceCorruptionError` because nothing is damaged. `stat` and `list` classify the highest canonical generation and translate a supported historical header without reading or mutating its body. `open` runs the build-static adjacent migration chain under per-id serialization before returning a handle, leaves every source path, byte, and inode unchanged, and exclusively publishes only the final current generation. A future highest generation refuses even when an older readable generation remains. Current v2 restoration retains installed extensions and unknown events carrying `ignorable: true`; historical v0/v1 migration refuses an unknown type even when marked ignorable. The message appends the selected raw log path when the backend keeps one artifact per session. The JSONL backend migrates released v0 or v1 to current v2 and refuses a future version before interpreting its version-specific fields or event rows. An out-of-tree backend must enforce equivalent current-only handle values and direction-aware refusals at its physical-format entry. The [released-format migration decision](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/architecture/2026-08-31-released-session-format-migrations.md) owns the chain and immutable-publication rules.
|
|
98
180
|
|
|
99
181
|
## `CreateSessionOptions` — seeding and metadata
|
|
100
182
|
|
|
101
|
-
Creating a `Session` through the store takes a `seed` (initial replay or fork history) and `meta` (the storage-level fields the store folds into a `SessionHeader`). The store fills in `version`/`id` and defaults `createdAt`; the caller may supply the validated absolute `cwd`,
|
|
183
|
+
Creating a `Session` through the store takes a `seed` (initial replay or fork history), an optional exact `inheritedEventCount`, and `meta` (the storage-level fields the store folds into a `SessionHeader`). The store fills in `version`/`id` and defaults `createdAt`; the caller may supply the validated absolute `cwd`, `parentSession` lineage, `isSeeded` lineage bit, optional coarse `origin`, `delegationDepth`, `agentPreset`, and an existing `createdAt`. A seeded creation requires an explicit seed equal to its inherited prefix and an exact cut; the constructor appends the child-owned tagged end-seed marker at that cut before setup adds child-owned events. `origin: 'subagent'` lets product navigation hide duplicate child rows; it does not prove that a descriptor is valid or that the child can resume.
|
|
102
184
|
|
|
103
185
|
```ts type-equiv
|
|
104
186
|
/**
|
|
@@ -110,14 +192,20 @@ interface CreateSessionOptions {
|
|
|
110
192
|
/** Initial replay or fork history supplied at construction. */
|
|
111
193
|
readonly seed?: readonly SessionEvent[]
|
|
112
194
|
/**
|
|
113
|
-
*
|
|
114
|
-
*
|
|
195
|
+
* Exact fork-inherited prefix length when `meta.isSeeded` is true. In v2 the
|
|
196
|
+
* constructor seed is exactly this inherited prefix; the constructor
|
|
197
|
+
* appends the child-owned tagged marker at the cut.
|
|
198
|
+
*/
|
|
199
|
+
readonly inheritedEventCount?: SessionLogOffset
|
|
200
|
+
/**
|
|
201
|
+
* Storage metadata read once before publication. `isSeeded` marks fork
|
|
202
|
+
* lineage; supplying replay history alone does not make it inherited.
|
|
115
203
|
*/
|
|
116
204
|
readonly meta?: {
|
|
117
205
|
readonly cwd?: string
|
|
118
206
|
readonly parentSession?: SessionId
|
|
119
207
|
readonly createdAt?: number
|
|
120
|
-
readonly
|
|
208
|
+
readonly isSeeded?: boolean
|
|
121
209
|
readonly origin?: 'subagent'
|
|
122
210
|
readonly delegationDepth?: number
|
|
123
211
|
readonly agentPreset?: string
|
|
@@ -125,27 +213,11 @@ interface CreateSessionOptions {
|
|
|
125
213
|
}
|
|
126
214
|
```
|
|
127
215
|
|
|
128
|
-
Replay/fork is therefore `ctx.
|
|
129
|
-
|
|
130
|
-
## `SessionRawArtifact` — verbatim stored artifact text
|
|
131
|
-
|
|
132
|
-
A backend's own artifact text for one session, byte-identical to what it durably wrote (decoded from its physical encoding). `readRaw` returns it without reconstructing from parsed events, so backend-specific serialization (chunk packing, key order, line breaks) survives. Consumers first test `supportsRawArtifacts`: `false` means the backend does not provide this capability (for example SQLite), while `readRaw(...) === undefined` means a supported backend has no materialized artifact for that session.
|
|
133
|
-
|
|
134
|
-
```ts type-equiv
|
|
135
|
-
/** A backend's own raw artifact text for one session, verbatim. */
|
|
136
|
-
interface SessionRawArtifact {
|
|
137
|
-
/** The session header parsed from the artifact's own first line. */
|
|
138
|
-
readonly meta: SessionHeader
|
|
139
|
-
/** The artifact's base filename on disk, without any physical encoding suffix. */
|
|
140
|
-
readonly filename: string
|
|
141
|
-
/** The artifact's full text content, decoded from the backend's physical encoding. */
|
|
142
|
-
readonly content: string
|
|
143
|
-
}
|
|
144
|
-
```
|
|
216
|
+
Replay/fork is therefore `ctx.agents.create({ sessionId, seed, meta })` — a fork additionally supplies `inheritedEventCount` with `meta.isSeeded: true`, and only agent-loop-published sessions persist, and the loop stores the seed through the new session's write handle before publication; resuming a *persisted* session into a live agent is `ctx.agents.resume({ resumeSessionId })`.
|
|
145
217
|
|
|
146
218
|
## Preparation and restoration ownership
|
|
147
219
|
|
|
148
|
-
`SessionStore.prepare()` accepts ordinary creation options or fresh persistence graphs transferred through `RestoredSessionOptions`. The restoration branch validates and freezes the transferred header and events in place, so callers must retain no mutable aliases. `SessionPreparation` then owns the exact unpublished Session until publication or rollback; disposal is synchronous and idempotent.
|
|
220
|
+
`SessionStore.prepare()` accepts ordinary creation options or fresh persistence graphs transferred through `RestoredSessionOptions`. The restoration branch validates and freezes the transferred header and events in place, so callers must retain no mutable aliases. `SessionPreparation` then owns the exact unpublished Session until publication or rollback; disposal is synchronous and idempotent. agent-loop's resume builds these graphs by reading the stored log through the session's write handle and appending any needed `interruptedTurnClosers` before preparation.
|
|
149
221
|
|
|
150
222
|
```ts type-equiv
|
|
151
223
|
/**
|
|
@@ -157,6 +229,8 @@ interface RestoredSessionOptions {
|
|
|
157
229
|
readonly seed: SessionEvent[]
|
|
158
230
|
/** Fresh detached storage metadata to validate and freeze in place. */
|
|
159
231
|
readonly meta: SessionHeader
|
|
232
|
+
/** Exact number of fork-inherited leading events decoded from storage. */
|
|
233
|
+
readonly inheritedEventCount: SessionLogOffset
|
|
160
234
|
/** Select the persistence ownership-transfer path. */
|
|
161
235
|
readonly seedSource: 'persistence'
|
|
162
236
|
}
|
|
@@ -199,19 +273,9 @@ declare class SessionPreparation implements Disposable {
|
|
|
199
273
|
}
|
|
200
274
|
```
|
|
201
275
|
|
|
202
|
-
```ts type-equiv
|
|
203
|
-
/** Immutable logical session prepared from persistence or a live owner. */
|
|
204
|
-
interface SessionInspection {
|
|
205
|
-
/** Validated immutable session metadata. */
|
|
206
|
-
readonly meta: SessionHeader
|
|
207
|
-
/** Validated contiguous logical event log. */
|
|
208
|
-
readonly events: readonly SessionEvent[]
|
|
209
|
-
}
|
|
210
|
-
```
|
|
211
|
-
|
|
212
276
|
## Lightweight source revisions
|
|
213
277
|
|
|
214
|
-
Consumers of derived
|
|
278
|
+
Consumers of derived read models compare a cheap opaque revision before loading a full event log. The revision is a per-backend-instance change token from `stat`/`list`: equal revisions may be treated as an unchanged log; unequal revisions promise nothing, and write-ownership churn never changes one. session-query keys its cold-read cache on it; the token plays no part in open, read, or resume.
|
|
215
279
|
|
|
216
280
|
```ts type-equiv
|
|
217
281
|
/**
|
|
@@ -222,21 +286,29 @@ type SessionPersistenceRevision = Branded<'SessionPersistenceRevision'>
|
|
|
222
286
|
```
|
|
223
287
|
|
|
224
288
|
```ts type-equiv
|
|
225
|
-
/**
|
|
289
|
+
/**
|
|
290
|
+
* Lightweight stored-session observation returned by {@link SessionPersistence.stat}
|
|
291
|
+
* and {@link SessionPersistence.list} without reading the full event log.
|
|
292
|
+
*/
|
|
226
293
|
interface SessionPersistenceSnapshot {
|
|
227
|
-
/** Detached metadata for one
|
|
228
|
-
header: SessionHeader
|
|
229
|
-
/** Opaque
|
|
230
|
-
revision: SessionPersistenceRevision
|
|
294
|
+
/** Detached metadata for one stored session. */
|
|
295
|
+
readonly header: SessionHeader
|
|
296
|
+
/** Opaque change token; see {@link SessionPersistence.stat}. */
|
|
297
|
+
readonly revision: SessionPersistenceRevision
|
|
298
|
+
/** Logical event count, when the backend can provide it cheaply from metadata; otherwise absent. */
|
|
299
|
+
readonly eventCount?: number
|
|
300
|
+
/** Physical artifact byte size, when the backend can provide it cheaply (JSONL); otherwise absent. */
|
|
301
|
+
readonly sizeBytes?: number
|
|
231
302
|
}
|
|
232
303
|
```
|
|
233
304
|
|
|
234
|
-
|
|
305
|
+
The optional `eventCount`/`sizeBytes` fields remain cheap backend observations for consumers that explicitly need them. Session listing does not use either field to open cold logs: it reads headers plus identity-checked projection-cache hints only, so a cache or Session-format upgrade never turns startup into a body scan.
|
|
235
306
|
|
|
236
|
-
|
|
307
|
+
## The backend
|
|
237
308
|
|
|
238
|
-
|
|
239
|
-
|
|
309
|
+
The shipped provider implements the abstract `SessionPersistence` contract (`create`/`open`/`stat`/`list`, with per-session `SessionHandle`s carrying `read`/`append`/`flush`/`close` and optional cancellation throughout) and passes the shared persistence contract suite:
|
|
310
|
+
|
|
311
|
+
- **[dsh-session-persistence-jsonl](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/session/session-persistence-jsonl)** — an append-only logical JSONL log per session, stored as checksummed concatenated Zstandard frames by default or raw lines by configuration, with crash-safe atomic materialization, per-batch `fsync` appends, and torn-tail truncation before the first new append. `stat`/`list` carry `sizeBytes` and a best-effort `fs.stat`-derived revision.
|
|
240
312
|
|
|
241
313
|
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
|
|
242
314
|
|
|
@@ -250,158 +322,77 @@ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnp
|
|
|
250
322
|
|
|
251
323
|
### `ctx.sessionPersistence` — `SessionPersistence` (abstract seam)
|
|
252
324
|
|
|
253
|
-
Durable append-only session storage
|
|
254
|
-
|
|
255
|
-
```ts cordis-catalog
|
|
256
|
-
/**
|
|
257
|
-
* Resolve this backend's independent local artifact for a session without
|
|
258
|
-
* reading, creating, flushing, or otherwise materializing it. Backends such
|
|
259
|
-
* as SQLite that do not own one artifact per session return `undefined`.
|
|
260
|
-
* @param meta - the immutable session header whose artifact is requested.
|
|
261
|
-
* @returns the backend-specific absolute location, when one exists.
|
|
262
|
-
*/
|
|
263
|
-
abstract locate(meta: SessionHeader): SessionLocation | undefined
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Read a session's backend-owned artifact text verbatim — the exact durable
|
|
267
|
-
* bytes the backend wrote (decoded from its physical encoding, e.g. a
|
|
268
|
-
* decompressed JSONL). The returned `content` is the raw text, not a
|
|
269
|
-
* reconstruction from parsed events, so it preserves backend-specific
|
|
270
|
-
* serialization (chunk packing, key order, line breaks). Callers first test
|
|
271
|
-
* {@link supportsRawArtifacts}; `undefined` then means only that the requested
|
|
272
|
-
* session has no materialized artifact.
|
|
273
|
-
* @param _id - the persisted session to read (unused by the default: no
|
|
274
|
-
* per-session artifact).
|
|
275
|
-
* @param signal - optional cancellation for backend read work.
|
|
276
|
-
* @returns the raw artifact plus its parsed header, or `undefined` when the
|
|
277
|
-
* session is absent.
|
|
278
|
-
* @throws when this backend does not expose per-session raw artifacts.
|
|
279
|
-
*/
|
|
280
|
-
readRaw(_id: SessionId, signal?: AbortSignal): Promise<SessionRawArtifact | undefined>
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Register a new session's metadata. A backend MAY defer the physical write
|
|
284
|
-
* until the first {@link append} (lazy materialization), in which case a
|
|
285
|
-
* created-but-never-appended session is absent from {@link list}
|
|
286
|
-
* — abandoned sessions leave nothing behind.
|
|
287
|
-
* @param meta - the immutable header (id, version, cwd, lineage) to record.
|
|
288
|
-
*/
|
|
289
|
-
abstract create(meta: SessionHeader): Promise<void>
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* Ensure a live session has a durable header even when it has no events.
|
|
293
|
-
* Ordinary sessions remain lazily materialized; lifecycle frontends call
|
|
294
|
-
* this only when an empty session itself is a durable resumable resource.
|
|
295
|
-
* @param _session - exact live session whose registered header is materialized.
|
|
296
|
-
*/
|
|
297
|
-
ensureMaterialized(_session: Session): Promise<void>
|
|
325
|
+
Durable append-only session storage addressed through per-session handles.
|
|
298
326
|
|
|
299
|
-
|
|
300
|
-
* Durably persist a batch of events. Honors the append-only and contiguous-
|
|
301
|
-
* seq contracts: the first event's `seq` MUST equal the stored next-seq
|
|
302
|
-
* (after `load` has durably closed any interrupted turn). Rejects non-JSON-
|
|
303
|
-
* serializable `event.data` with an error naming the offending event type.
|
|
304
|
-
* @param id - the session the batch belongs to.
|
|
305
|
-
* @param events - the contiguous batch to persist, in seq order.
|
|
306
|
-
*/
|
|
307
|
-
abstract append(id: SessionId, events: readonly SessionEvent[]): Promise<void>
|
|
327
|
+
Storage semantics shared by every backend: events are contiguous from seq 0 and never rewritten; a torn physical tail is never returned to a reader and is truncated by the write path before its first append; reads validate current-format records only and refuse unknown vocabulary fail-closed. `append` persists best-effort; `flush` — per handle or service-wide — is the durability barrier.
|
|
308
328
|
|
|
309
|
-
|
|
310
|
-
* Prepare the exact unpublished Session used by resume. Implementations may
|
|
311
|
-
* reuse object graphs retained by an earlier {@link inspect} after confirming
|
|
312
|
-
* their durable revision is still current; disposal releases an unpublished
|
|
313
|
-
* reservation. Revision retries require the durable log to remain unchanged
|
|
314
|
-
* for one read/check round trip; continuous external writers may delay completion.
|
|
315
|
-
* @param id - persisted session to prepare.
|
|
316
|
-
* @param signal - optional cancellation for preparation work.
|
|
317
|
-
* @returns one owned unpublished Session preparation.
|
|
318
|
-
*/
|
|
319
|
-
async prepare(id: SessionId, signal?: AbortSignal): Promise<SessionPreparation>
|
|
329
|
+
Visibility: a created session is observable through `stat`/`list`/`open` in this process from the moment `create` resolves, even while a backend defers physical materialization (a pure optimization); other processes see the session only once it materializes, and a session that never materialized before a crash never existed. `SessionHandle.flush` forces materialization.
|
|
320
330
|
|
|
321
|
-
|
|
322
|
-
* Load an immutable balanced logical view and commit any required cold
|
|
323
|
-
* recovery. A complete interrupted final turn is preserved and durably
|
|
324
|
-
* closed with missing tool errors plus any open step and turn boundaries;
|
|
325
|
-
* only a torn final record is discarded. Unknown versions and corruption in
|
|
326
|
-
* the committed prefix reject. Implementations MUST NOT crash-repair an
|
|
327
|
-
* identity still bound to a live Session: a balanced live log may return as a
|
|
328
|
-
* durable snapshot, while an open live turn rejects. Returned values may be
|
|
329
|
-
* shared with immutable live or prepared state and must not be mutated.
|
|
330
|
-
* Revision-based implementations may wait for one stable read/check round trip.
|
|
331
|
-
* @param id - the persisted session to reload.
|
|
332
|
-
* @returns the header and a log ending on a balanced `turn/end`.
|
|
333
|
-
*/
|
|
334
|
-
abstract load(id: SessionId): Promise<SessionInspection>
|
|
331
|
+
Freshness: once an `append` or `flush` resolves, reads started afterwards on this backend instance observe at least that prefix.
|
|
335
332
|
|
|
333
|
+
```ts cordis-catalog
|
|
336
334
|
/**
|
|
337
|
-
*
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
*
|
|
342
|
-
* implementations retain the exact cold unpublished Session for bounded
|
|
343
|
-
* reuse by a later {@link prepare}. A stale ready source is reloaded; a source
|
|
344
|
-
* already committing or reserved for resume remains exclusive, and inspection
|
|
345
|
-
* may borrow its immutable view. Callers borrow only the immutable header and
|
|
346
|
-
* log. Continuous external writers may delay revision convergence.
|
|
347
|
-
* @param id - the persisted session to inspect.
|
|
348
|
-
* @param signal - optional cancellation for queued and backend read work.
|
|
349
|
-
* @returns the validated header and current logical event log.
|
|
335
|
+
* Create a new stored session and take its write ownership.
|
|
336
|
+
* @param header - the immutable header (id, version, cwd, lineage) to store.
|
|
337
|
+
* @param options - optional cancellation.
|
|
338
|
+
* @returns a `write` handle owned by the caller; close it to release ownership.
|
|
339
|
+
* @throws {SessionAlreadyExistsError} when the id already exists.
|
|
350
340
|
*/
|
|
351
|
-
abstract
|
|
341
|
+
abstract create(header: SessionHeader, options?: SessionPersistenceCreateOptions): Promise<SessionHandle>
|
|
352
342
|
|
|
353
343
|
/**
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
* @param
|
|
360
|
-
* @
|
|
344
|
+
* Open an existing stored session.
|
|
345
|
+
*
|
|
346
|
+
* `read` never takes ownership and works while another handle (or process)
|
|
347
|
+
* holds write ownership. `write` atomically claims single-writer ownership;
|
|
348
|
+
* an existing active owner rejects.
|
|
349
|
+
* @param id - the stored session to open.
|
|
350
|
+
* @param access - `read` or `write`.
|
|
351
|
+
* @param options - optional cancellation.
|
|
352
|
+
* @returns the open handle.
|
|
353
|
+
* @throws {SessionPersistenceNotFoundError} when the session does not exist.
|
|
354
|
+
* @throws {SessionAlreadyOwnedError} for `write` when ownership is taken.
|
|
361
355
|
*/
|
|
362
|
-
abstract
|
|
356
|
+
abstract open(id: SessionId, access: SessionAccess, options?: SessionPersistenceOpenOptions): Promise<SessionHandle>
|
|
363
357
|
|
|
364
358
|
/**
|
|
365
|
-
*
|
|
366
|
-
*
|
|
367
|
-
*
|
|
368
|
-
*
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
*
|
|
373
|
-
*
|
|
374
|
-
* (SQLite) read only the suffix; sequential media (JSONL, both encodings)
|
|
375
|
-
* still parse the whole artifact and skip forward — the primitive bounds
|
|
376
|
-
* what is RETURNED and refolded, not every backend's physical read.
|
|
377
|
-
* @param id - the persisted session to read.
|
|
378
|
-
* @param fromSeq - first event seq to include; a non-negative safe integer.
|
|
379
|
-
* @param signal - optional cancellation for queued and backend read work.
|
|
380
|
-
* @returns the header and the stored events with `seq >= fromSeq`.
|
|
359
|
+
* Flush every active write handle owned by this service instance in one
|
|
360
|
+
* durability barrier: each handle's routed live events drain durably and
|
|
361
|
+
* its session materializes, exactly as that handle's own
|
|
362
|
+
* `SessionHandle.flush` would. Read handles buffer nothing and are
|
|
363
|
+
* untouched. A handle closed concurrently counts as flushed — close itself
|
|
364
|
+
* drains durably.
|
|
365
|
+
* @returns resolution once every write handle active at the call has flushed.
|
|
366
|
+
* @throws {AggregateError} naming each session whose flush failed; the
|
|
367
|
+
* remaining handles still flush.
|
|
381
368
|
*/
|
|
382
|
-
abstract
|
|
369
|
+
abstract flush(): Promise<void>
|
|
383
370
|
|
|
384
371
|
/**
|
|
385
|
-
*
|
|
386
|
-
*
|
|
387
|
-
*
|
|
372
|
+
* Observe one stored session without reading its event log or taking
|
|
373
|
+
* ownership.
|
|
374
|
+
*
|
|
375
|
+
* The snapshot's `revision` is an opaque change token comparable only
|
|
376
|
+
* against revisions from the same service instance and session id: equal
|
|
377
|
+
* revisions may be treated as an unchanged log; unequal revisions promise
|
|
378
|
+
* nothing. Write-ownership churn does not change a revision. It exists for
|
|
379
|
+
* derived read-model caches keyed off `stat`/`list`; it plays no part in
|
|
380
|
+
* open, read, or resume.
|
|
381
|
+
* @param id - the stored session to observe.
|
|
382
|
+
* @param options - optional cancellation.
|
|
383
|
+
* @returns the snapshot, or `undefined` when the session does not exist.
|
|
388
384
|
*/
|
|
389
|
-
abstract
|
|
385
|
+
abstract stat(id: SessionId, options?: SessionPersistenceStatOptions): Promise<SessionPersistenceSnapshot | undefined>
|
|
390
386
|
|
|
391
387
|
/**
|
|
392
|
-
* List
|
|
393
|
-
*
|
|
394
|
-
*
|
|
395
|
-
* successful mutating {@link load} repair changes the next listed revision.
|
|
396
|
-
* Revisions also distinguish independently backed stores so backend-local
|
|
397
|
-
* counters cannot compare equal across different persistence sources.
|
|
398
|
-
* @param signal - optional cancellation for backend snapshot-listing work.
|
|
399
|
-
* @returns one header and opaque revision per materialized session without loading full logs.
|
|
388
|
+
* List every stored session visible to this process, in no promised order.
|
|
389
|
+
* @param options - optional cancellation.
|
|
390
|
+
* @returns one snapshot per stored session.
|
|
400
391
|
*/
|
|
401
|
-
abstract
|
|
392
|
+
abstract list(options?: SessionPersistenceListOptions): Promise<readonly SessionPersistenceSnapshot[]>
|
|
402
393
|
```
|
|
403
394
|
|
|
404
|
-
Types: [
|
|
395
|
+
Types: [SessionId](./core.md)
|
|
405
396
|
|
|
406
397
|
Source: [`packages/session/session-persistence/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/session/session-persistence/src/index.ts)
|
|
407
398
|
<!-- END GENERATED cordis-surface -->
|
|
@@ -11,7 +11,7 @@ Source: [`packages/plan/plan-mode/src/index.ts`](https://github.com/deepseek-ai/
|
|
|
11
11
|
|
|
12
12
|
## Logged state and recovery
|
|
13
13
|
|
|
14
|
-
`plan/mode` (`{ active: boolean }`) is a log-only, whole-value-replace [session event](./session.md): durable and replayable, never in the model transcript. `
|
|
14
|
+
`plan/mode` (`{ active: boolean }`) is a log-only, whole-value-replace [session event](./session.md): durable and replayable, never in the model transcript. The optionally registered `plan` unit folds committed mode, command settlement, and the mode recorded at the latest request header. `ctx.planMode` reads that state through `stateOf()`; the first dependent access fails if the registry, `plan` key, or `turnBoundary` key is absent. Clients receive only `{ active, pending }`; resume, fork, and compaction recover both from the log. The complete event declaration is in the [persistence log event catalog](../persistence-catalog.md).
|
|
15
15
|
|
|
16
16
|
## Pending selections and the pre-step append
|
|
17
17
|
|
|
@@ -29,7 +29,7 @@ interface PlanModeConfig {
|
|
|
29
29
|
}
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
A missing, blank, or non-string `section` and any unknown key fail at plugin load rather than being ignored. While plan mode is active, the exact `section` text renders as the `plan:policy` [system-prompt section](./system-prompt.md) at
|
|
32
|
+
A missing, blank, or non-string `section` and any unknown key fail at plugin load rather than being ignored. While plan mode is active, the exact `section` text renders as the `plan:policy` [system-prompt section](./system-prompt.md) at order 50; inactive plan mode contributes no text.
|
|
33
33
|
|
|
34
34
|
## The exit tool and the `/plan` command
|
|
35
35
|
|
|
@@ -53,7 +53,7 @@ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnp
|
|
|
53
53
|
|
|
54
54
|
### `ctx.planMode` — `PlanModeController`
|
|
55
55
|
|
|
56
|
-
`ctx.planMode`: owns logged plan state, applies and narrates selected state at step start, the `plan:policy` section, the `/plan` command, and the stable exit tool.
|
|
56
|
+
`ctx.planMode`: owns logged plan state, applies and narrates selected state at step start, the `plan:policy` section, the `/plan` command, and the stable exit tool. Client carriers expose the projection's cropped `{ active, pending }` view.
|
|
57
57
|
|
|
58
58
|
```ts cordis-catalog
|
|
59
59
|
/**
|
|
@@ -96,6 +96,8 @@ interface SandboxPolicy extends SandboxExecutionPolicy {
|
|
|
96
96
|
}
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
+
<a id="wrapped-argv-and-classification-dialects"></a>
|
|
100
|
+
|
|
99
101
|
## Wrapped argv and classification dialects
|
|
100
102
|
|
|
101
103
|
`RunnerFailureRule` combines evidence that a runner failed before executing the command. A consumer requires a nonzero exit, the optional allowed-exit-code gate, and a case-insensitive fatal signature within one remaining stderr line. Case-insensitive exact full-line informational exclusions are removed first, so a benign runner notice cannot prove failure by itself. The matched line remains available as error detail; classification does not rewrite stderr.
|