@dsh-cc/progress-rebuild 0.0.0-stage → 0.9.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/lib/state.js ADDED
@@ -0,0 +1,234 @@
1
+ /**
2
+ * M1 progress-state projection (design
3
+ * docs/plans/2026-10-09-structured-progress-and-post-compact-rebuild.md §3.2):
4
+ * one registered Session projection unit whose `apply` fold consumes EVERY
5
+ * committed session event, self-filtering per arm (goal / todos / verified /
6
+ * lastUser). Registered under the host-only key `progress-rebuild` (§3.1).
7
+ *
8
+ * The fold NEVER THROWS — the projection registry's `drive` has no try/catch
9
+ * (upstream session-projection/src/index.ts:681-684), so every parse is caught
10
+ * and every arm is individually contained: a throw inside an arm leaves that
11
+ * arm unchanged. State is plain JSON (arrays, no Map/Set) so the persisted
12
+ * projection cache can restore it.
13
+ *
14
+ * @module
15
+ */
16
+ import { z } from 'zod';
17
+ import { applyGoalProjection } from '@deepseek-ai/dsh-goal';
18
+ /** Verified-receipt ring capacity. */
19
+ export const VERIFIED_RING_CAP = 20;
20
+ /** Recent-calls index capacity (also the receipt dedupe set). */
21
+ export const CALL_INDEX_CAP = 512;
22
+ /**
23
+ * Fixed exit/interrupt marker vocabulary rendered by the bash tool
24
+ * (upstream tool-bash/src/render.ts): marker ABSENCE in the result tail is
25
+ * the success signal. Note the exit marker appears only for NON-ZERO exits,
26
+ * so a clean exit-0 result carries no marker at all.
27
+ */
28
+ export const FAILURE_MARKERS = [
29
+ '[exit code: ',
30
+ '[killed by signal: ',
31
+ '[timed out after ',
32
+ '[stopped: ',
33
+ '[still running after ',
34
+ '[sandbox: file access denied under ',
35
+ '[sandbox: the sandbox runner itself failed under ',
36
+ ];
37
+ /** Number of trailing lines of the rendered result scanned for markers. */
38
+ const TAIL_LINES = 10;
39
+ /** commandHead bound (§3.2). */
40
+ const COMMAND_HEAD_CHARS = 200;
41
+ /**
42
+ * Conservative command eligibility scan (§3.2 verified row): reject compound
43
+ * commands and substitution so a receipt can only attest one simple command.
44
+ * Any `;`, `||`, `&&`, `|`, newline, `$(…)`, backtick, or `&` (mid-command or
45
+ * trailing — `&&` is already covered) rejects, as does `run_in_background: true`.
46
+ * Quoted separators false-reject — accepted, conservatism is deliberate.
47
+ */
48
+ function commandIsEligible(command) {
49
+ return !/;|\|\||&&|\||\n|\$\(|`|&/.test(command);
50
+ }
51
+ /** Result text tail: last TAIL_LINES lines across all text blocks. */
52
+ function resultTailLines(message) {
53
+ const lines = [];
54
+ for (const block of message.content) {
55
+ if (typeof block === 'object' && block !== null && block.type === 'text') {
56
+ const text = block.text;
57
+ if (typeof text === 'string')
58
+ lines.push(...text.split('\n'));
59
+ }
60
+ }
61
+ return lines.slice(-TAIL_LINES);
62
+ }
63
+ /** True when the tail carries a marker line (→ NOT a receipt). */
64
+ function tailHasMarker(message) {
65
+ return resultTailLines(message).some((line) => FAILURE_MARKERS.some((marker) => line.includes(marker)));
66
+ }
67
+ /**
68
+ * Read a `tool/call` event through the recorded-call face (defensive — the
69
+ * declared payload is trusted to a point, never to a throw).
70
+ */
71
+ function asCallRecord(callId, event) {
72
+ const data = event.data;
73
+ if (typeof data.name !== 'string' || typeof data.arguments !== 'string') {
74
+ return { callId, name: '', commandHead: '', eligible: false };
75
+ }
76
+ let parsed;
77
+ try {
78
+ parsed = JSON.parse(data.arguments);
79
+ }
80
+ catch {
81
+ return { callId, name: data.name, commandHead: '', eligible: false }; // unparseable → not eligible, no throw
82
+ }
83
+ if (typeof parsed.command !== 'string') {
84
+ return { callId, name: data.name, commandHead: '', eligible: false };
85
+ }
86
+ const eligible = parsed.run_in_background !== true && commandIsEligible(parsed.command);
87
+ return { callId, name: data.name, commandHead: parsed.command.slice(0, COMMAND_HEAD_CHARS), eligible };
88
+ }
89
+ /**
90
+ * Read a `tool/result` event's message through the defensive face (keyed by
91
+ * `message.source.callId`, isError flag, rendered text blocks).
92
+ */
93
+ function asResultFace(event) {
94
+ const message = event.data.message;
95
+ const callId = message?.source?.callId;
96
+ if (typeof callId !== 'string' || !Array.isArray(message?.content))
97
+ return undefined;
98
+ return { callId, isError: message?.isError === true, content: message?.content ?? [] };
99
+ }
100
+ /** Run one arm; on any throw leave that arm unchanged (round-9 no-throw rule). */
101
+ function safely(arm, transition) {
102
+ try {
103
+ return transition();
104
+ }
105
+ catch {
106
+ return arm;
107
+ }
108
+ }
109
+ /**
110
+ * The fold: previous state + one committed event → next state. Returns the
111
+ * SAME reference when the event touches nothing (the registry's zero-work
112
+ * contract). Consumes every session event; each arm self-filters.
113
+ */
114
+ export function applyProgressRebuild(state, event) {
115
+ let next = state;
116
+ // Goal arm: the harness's canonical throw-free fold, fed EVERY event (it
117
+ // self-filters goal/change and goal-sourced user/message round events).
118
+ next = safely(next, () => {
119
+ const goal = applyGoalProjection(next.goal, event);
120
+ return goal === next.goal ? next : { ...next, goal };
121
+ });
122
+ // Todos arm: latest whole `todo/write` snapshot verbatim.
123
+ next = safely(next, () => {
124
+ // `todo/write` is declared in the SessionEventMap by @dsh-cc/tool-todo's
125
+ // augmentation, which this package does not import — compare loosely.
126
+ if (String(event.type) !== 'todo/write')
127
+ return next;
128
+ const todos = event.data.todos;
129
+ if (!Array.isArray(todos))
130
+ return next;
131
+ return { ...next, todos: todos };
132
+ });
133
+ // Verified arm: `tool/call` records eligibility; `tool/result` becomes a
134
+ // receipt iff the recorded call was an eligible bash command, the result is
135
+ // not isError, and the result tail carries no failure marker. Reads
136
+ // `tool/result` ONLY (the future `completion-gate/receipt` source is a D1
137
+ // forward hook — deliberately not implemented, structured to slot in here).
138
+ next = safely(next, () => {
139
+ if (event.type === 'tool/call') {
140
+ const data = event.data;
141
+ if (typeof data.callId !== 'string')
142
+ return next;
143
+ const existing = next.callIndex.find((call) => call.callId === data.callId);
144
+ if (existing !== undefined)
145
+ return next; // FIRST occurrence kept (dedupe set)
146
+ const record = asCallRecord(data.callId, event);
147
+ const callIndex = next.callIndex.length >= CALL_INDEX_CAP
148
+ ? [...next.callIndex.slice(1), record]
149
+ : [...next.callIndex, record];
150
+ return { ...next, callIndex };
151
+ }
152
+ if (event.type !== 'tool/result')
153
+ return next;
154
+ const result = asResultFace(event);
155
+ if (result === undefined)
156
+ return next;
157
+ const call = next.callIndex.find((entry) => entry.callId === result.callId);
158
+ if (call === undefined || call.name !== 'bash' || !call.eligible)
159
+ return next;
160
+ if (result.isError)
161
+ return next;
162
+ if (tailHasMarker(result))
163
+ return next;
164
+ if (next.verified.some((receipt) => receipt.callId === result.callId))
165
+ return next;
166
+ const receipt = { ts: event.time, callId: result.callId, commandHead: call.commandHead };
167
+ const verified = next.verified.length >= VERIFIED_RING_CAP
168
+ ? [...next.verified.slice(1), receipt]
169
+ : [...next.verified, receipt];
170
+ return { ...next, verified };
171
+ });
172
+ // lastUser arm: genuine user messages only — `source` undefined OR
173
+ // `kind === 'user'`, with at least one non-empty text block. By
174
+ // construction this excludes compact-checkpoint and every injected kind.
175
+ next = safely(next, () => {
176
+ if (event.type !== 'user/message')
177
+ return next;
178
+ const message = event.data;
179
+ const kind = message.source?.kind;
180
+ if (kind !== undefined && kind !== 'user')
181
+ return next;
182
+ const firstText = (Array.isArray(message.content) ? message.content : []).find((block) => typeof block === 'object' && block !== null && block.type === 'text'
183
+ && typeof block.text === 'string'
184
+ && block.text.length > 0);
185
+ if (firstText === undefined)
186
+ return next;
187
+ return {
188
+ ...next,
189
+ lastUser: {
190
+ ts: event.time,
191
+ seq: String(event.seq),
192
+ text: firstText.text.slice(0, COMMAND_HEAD_CHARS),
193
+ },
194
+ };
195
+ });
196
+ return next;
197
+ }
198
+ const receiptSchema = z.object({ ts: z.number(), callId: z.string(), commandHead: z.string() });
199
+ const callRecordSchema = z.object({
200
+ callId: z.string(),
201
+ name: z.string(),
202
+ commandHead: z.string(),
203
+ eligible: z.boolean(),
204
+ });
205
+ /** Validates persisted state before it seeds a fold (plain-JSON shape). */
206
+ export const progressRebuildStateSchema = z.object({
207
+ goal: z.object({
208
+ current: z.unknown(),
209
+ seenGoalIds: z.array(z.unknown()),
210
+ failure: z.union([z.string(), z.null()]),
211
+ }),
212
+ todos: z.array(z.object({ content: z.string(), status: z.string() })).nullable(),
213
+ verified: z.array(receiptSchema).max(VERIFIED_RING_CAP),
214
+ callIndex: z.array(callRecordSchema).max(CALL_INDEX_CAP),
215
+ lastUser: z.object({ ts: z.number(), seq: z.string(), text: z.string() }).nullable(),
216
+ });
217
+ /**
218
+ * The registered projection unit (§3.1): host-only key `progress-rebuild`,
219
+ * no wire face, stateVersion 1.
220
+ */
221
+ export const progressRebuildProjection = {
222
+ key: 'progress-rebuild',
223
+ stateSchema: progressRebuildStateSchema,
224
+ init: (_header, _inheritedEventCount) => ({
225
+ goal: { current: null, seenGoalIds: [], failure: null },
226
+ todos: null,
227
+ verified: [],
228
+ callIndex: [],
229
+ lastUser: null,
230
+ }),
231
+ apply: applyProgressRebuild,
232
+ stateVersion: 1,
233
+ };
234
+ //# sourceMappingURL=state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.js","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,mBAAmB,EAA4B,MAAM,uBAAuB,CAAA;AA4CrF,sCAAsC;AACtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAA;AACnC,iEAAiE;AACjE,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAA;AAEjC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,cAAc;IACd,qBAAqB;IACrB,mBAAmB;IACnB,YAAY;IACZ,uBAAuB;IACvB,qCAAqC;IACrC,mDAAmD;CAC3C,CAAA;AAEV,2EAA2E;AAC3E,MAAM,UAAU,GAAG,EAAE,CAAA;AAErB,gCAAgC;AAChC,MAAM,kBAAkB,GAAG,GAAG,CAAA;AAE9B;;;;;;GAMG;AACH,SAAS,iBAAiB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EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE;IAChF,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,iBAAiB,CAAC;IACvD,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC;IACxD,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE;CACrF,CAA6C,CAAA;AAE9C;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAGlC;IACF,GAAG,EAAE,kBAAkB;IACvB,WAAW,EAAE,0BAA0B;IACvC,IAAI,EAAE,CAAC,OAAsB,EAAE,oBAAsC,EAAwB,EAAE,CAAC,CAAC;QAC/F,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QACvD,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,EAAE;QACb,QAAQ,EAAE,IAAI;KACf,CAAC;IACF,KAAK,EAAE,oBAAoB;IAC3B,YAAY,EAAE,CAAC;CAChB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,57 @@
1
1
  {
2
2
  "name": "@dsh-cc/progress-rebuild",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "description": "Structured progress state + post-compact context rebuild: derives a typed per-session progress brief from session events (goal fold, todo snapshot, verified bash receipts, last user message) and re-injects it after a successful compaction/end; default off",
4
+ "version": "0.9.0",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/dsh-cc/dsh-cc.git",
8
+ "directory": "packages/context/progress-rebuild"
9
+ },
10
+ "type": "module",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./lib/index.d.ts",
14
+ "default": "./lib/index.js"
15
+ },
16
+ "./src/*": "./src/*",
17
+ "./package.json": "./package.json"
18
+ },
19
+ "files": [
20
+ "lib"
21
+ ],
22
+ "license": "Apache-2.0",
23
+ "peerDependencies": {
24
+ "@deepseek-ai/cordis": ">=0.2.0-rc.2",
25
+ "@deepseek-ai/schemastery": "^3.18.1"
26
+ },
27
+ "dependencies": {
28
+ "zod": "4.4.3",
29
+ "@dsh-cc/settings-ns": "^0.9.0"
30
+ },
31
+ "devDependencies": {
32
+ "@deepseek-ai/cordis": "link:../../../../deepseek-harness/vendor/cordis",
33
+ "@deepseek-ai/dsh-agent": "link:../../../../deepseek-harness/packages/core/agent",
34
+ "@deepseek-ai/dsh-agent-loop": "link:../../../../deepseek-harness/packages/core/agent-loop",
35
+ "@deepseek-ai/dsh-agent-loop-testkit": "link:../../../../deepseek-harness/packages/test-support/agent-loop-testkit",
36
+ "@deepseek-ai/dsh-compaction": "link:../../../../deepseek-harness/packages/compaction/compaction",
37
+ "@deepseek-ai/dsh-goal": "link:../../../../deepseek-harness/packages/goal/goal",
38
+ "@deepseek-ai/dsh-llm": "link:../../../../deepseek-harness/packages/llm/llm",
39
+ "@deepseek-ai/dsh-session": "link:../../../../deepseek-harness/packages/core/session",
40
+ "@deepseek-ai/dsh-session-persistence-jsonl": "link:../../../../deepseek-harness/packages/session/session-persistence-jsonl",
41
+ "@deepseek-ai/dsh-session-projection": "link:../../../../deepseek-harness/packages/session/session-projection",
42
+ "@deepseek-ai/dsh-subprocess-local": "link:../../../../deepseek-harness/packages/subprocess/subprocess-local",
43
+ "@deepseek-ai/dsh-token-meter": "link:../../../../deepseek-harness/packages/llm/token-meter",
44
+ "@deepseek-ai/schemastery": "link:../../../../deepseek-harness/vendor/schemastery",
45
+ "vitest": "^4.1.8",
46
+ "@dsh-cc/agent-loop-mock": "^0.1.0",
47
+ "@dsh-cc/settings-provider": "^0.9.0",
48
+ "@dsh-cc/tools": "^0.9.0",
49
+ "@dsh-cc/settings-ns": "^0.9.0"
50
+ },
51
+ "publishConfig": {
52
+ "access": "public"
53
+ },
54
+ "scripts": {
55
+ "test": "vitest run"
56
+ }
6
57
  }