@treeseed/dsh-chapters 0.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/LICENSE +14 -0
- package/README.md +644 -0
- package/cordis.patch.yml +88 -0
- package/docs/architecture.md +460 -0
- package/docs/contract.md +375 -0
- package/docs/development.md +437 -0
- package/docs/host-compaction-seam.md +117 -0
- package/docs/knowledge-repo.md +730 -0
- package/docs/provider.md +98 -0
- package/docs/verify.md +200 -0
- package/lib/archive.d.ts +88 -0
- package/lib/archive.js +114 -0
- package/lib/archive.js.map +1 -0
- package/lib/arrival.d.ts +23 -0
- package/lib/arrival.js +86 -0
- package/lib/arrival.js.map +1 -0
- package/lib/artifact-query.d.ts +53 -0
- package/lib/artifact-query.js +130 -0
- package/lib/artifact-query.js.map +1 -0
- package/lib/client.js +234 -0
- package/lib/client.js.map +1 -0
- package/lib/commands.d.ts +28 -0
- package/lib/commands.js +305 -0
- package/lib/commands.js.map +1 -0
- package/lib/compose.d.ts +30 -0
- package/lib/compose.js +131 -0
- package/lib/compose.js.map +1 -0
- package/lib/continue-core.d.ts +153 -0
- package/lib/continue-core.js +252 -0
- package/lib/continue-core.js.map +1 -0
- package/lib/engine-core.d.ts +219 -0
- package/lib/engine-core.js +405 -0
- package/lib/engine-core.js.map +1 -0
- package/lib/engine.d.ts +211 -0
- package/lib/engine.js +571 -0
- package/lib/engine.js.map +1 -0
- package/lib/enrich-queue.d.ts +66 -0
- package/lib/enrich-queue.js +100 -0
- package/lib/enrich-queue.js.map +1 -0
- package/lib/enrich-store.d.ts +31 -0
- package/lib/enrich-store.js +103 -0
- package/lib/enrich-store.js.map +1 -0
- package/lib/enrich-wire.d.ts +73 -0
- package/lib/enrich-wire.js +209 -0
- package/lib/enrich-wire.js.map +1 -0
- package/lib/enrich.d.ts +73 -0
- package/lib/enrich.js +150 -0
- package/lib/enrich.js.map +1 -0
- package/lib/gitops.d.ts +107 -0
- package/lib/gitops.js +539 -0
- package/lib/gitops.js.map +1 -0
- package/lib/index.d.ts +81 -0
- package/lib/index.js +305 -0
- package/lib/index.js.map +1 -0
- package/lib/indexing.d.ts +85 -0
- package/lib/indexing.js +212 -0
- package/lib/indexing.js.map +1 -0
- package/lib/injections.d.ts +66 -0
- package/lib/injections.js +83 -0
- package/lib/injections.js.map +1 -0
- package/lib/notice.d.ts +60 -0
- package/lib/notice.js +84 -0
- package/lib/notice.js.map +1 -0
- package/lib/provider.d.ts +44 -0
- package/lib/provider.js +66 -0
- package/lib/provider.js.map +1 -0
- package/lib/redact.d.ts +24 -0
- package/lib/redact.js +85 -0
- package/lib/redact.js.map +1 -0
- package/lib/registry.d.ts +120 -0
- package/lib/registry.js +130 -0
- package/lib/registry.js.map +1 -0
- package/lib/render.d.ts +40 -0
- package/lib/render.js +280 -0
- package/lib/render.js.map +1 -0
- package/lib/repo.d.ts +78 -0
- package/lib/repo.js +184 -0
- package/lib/repo.js.map +1 -0
- package/lib/rules-commands.d.ts +24 -0
- package/lib/rules-commands.js +138 -0
- package/lib/rules-commands.js.map +1 -0
- package/lib/rules.d.ts +90 -0
- package/lib/rules.js +185 -0
- package/lib/rules.js.map +1 -0
- package/lib/search.d.ts +48 -0
- package/lib/search.js +152 -0
- package/lib/search.js.map +1 -0
- package/lib/signature.d.ts +28 -0
- package/lib/signature.js +149 -0
- package/lib/signature.js.map +1 -0
- package/lib/store.d.ts +130 -0
- package/lib/store.js +235 -0
- package/lib/store.js.map +1 -0
- package/lib/sync.d.ts +183 -0
- package/lib/sync.js +719 -0
- package/lib/sync.js.map +1 -0
- package/lib/tools.d.ts +84 -0
- package/lib/tools.js +581 -0
- package/lib/tools.js.map +1 -0
- package/lib/treedx/client.d.ts +57 -0
- package/lib/treedx/client.js +82 -0
- package/lib/treedx/client.js.map +1 -0
- package/lib/treedx/provider.d.ts +39 -0
- package/lib/treedx/provider.js +479 -0
- package/lib/treedx/provider.js.map +1 -0
- package/lib/treedx/state.d.ts +27 -0
- package/lib/treedx/state.js +65 -0
- package/lib/treedx/state.js.map +1 -0
- package/lib/types.d.ts +100 -0
- package/lib/types.js +19 -0
- package/lib/types.js.map +1 -0
- package/lib/vocabulary.d.ts +41 -0
- package/lib/vocabulary.js +118 -0
- package/lib/vocabulary.js.map +1 -0
- package/package.json +132 -0
- package/presets/chapters/agent.cordis.yml +272 -0
- package/presets/chapters/preset.yml +3 -0
- package/presets/probe-roots/agent.cordis.yml +11 -0
- package/presets/probe-roots/preset.yml +3 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../src/search.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,gBAAgB,EAAmB,MAAM,eAAe,CAAA;AACjE,SAAS,SAAS,CAAC,IAAY;IAC7B,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IACjC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;AACjD,CAAC;AAED,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAsB/C,MAAM,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;AAE/B,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAY,EAAE,CAC1C,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,I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,cAAc,CAAC,IAAI,CAAC,CAAA;QACjC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,GAAG,IAAI,GAAG,SAAS;YAAE,MAAK;QACtD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAChB,IAAI,IAAI,IAAI,CAAA;IACd,CAAC;IACD,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC;QACvC,KAAK,EAAE,OAAO,CAAC,MAAM;QACrB,KAAK,EAAE,KAAK,CAAC,MAAM;QACnB,MAAM,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC,EAAE;QAChF,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;KACvB,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { SessionEventLike } from './types.ts';
|
|
2
|
+
export interface CollectionSignature {
|
|
3
|
+
/** The collection's event seqs, ascending (user messages through turn/end). */
|
|
4
|
+
seqs: number[];
|
|
5
|
+
/** File paths mentioned in tool-call arguments — the strongest topic signal. */
|
|
6
|
+
paths: string[];
|
|
7
|
+
/** Command argv prefixes (shell tools) and non-shell tool names. */
|
|
8
|
+
commands: string[];
|
|
9
|
+
/** Stopword-filtered keyword top-N across the turn's text. */
|
|
10
|
+
terms: string[];
|
|
11
|
+
/** Estimated tokens of the collection's text (chars/4 — the project's one estimator). */
|
|
12
|
+
size: number;
|
|
13
|
+
/** Always `deterministic` today; P2 enrichment adds model-authored fields elsewhere. */
|
|
14
|
+
by: 'deterministic';
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The events of the turn that just ended: from (exclusive) the previous
|
|
18
|
+
* `turn/end` (or the log start) through this `turn/end` inclusive.
|
|
19
|
+
*/
|
|
20
|
+
export declare function turnSpanOf(events: readonly SessionEventLike[], endSeq: number): SessionEventLike[];
|
|
21
|
+
/** Extract the deterministic signature for one completed turn's events. */
|
|
22
|
+
export declare function extractSignature(events: readonly SessionEventLike[], topTerms?: number): CollectionSignature;
|
|
23
|
+
/**
|
|
24
|
+
* Chapter topics for the index: the chapter's own signature — the strongest
|
|
25
|
+
* paths first (same file ≈ same task), then top terms. Capped; this is the
|
|
26
|
+
* deterministic floor the P2 enrichment pass may later relabel.
|
|
27
|
+
*/
|
|
28
|
+
export declare function chapterTopics(events: readonly SessionEventLike[], lo: number, hi: number, cap?: number): string[];
|
package/lib/signature.js
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-turn deterministic signatures (knowledge-repo.md §4.1).
|
|
3
|
+
*
|
|
4
|
+
* Extracted at `turn/end`, synchronously, with no model: file paths, command
|
|
5
|
+
* argv, and a stopword-filtered keyword top-N — the "loud signatures" coding
|
|
6
|
+
* sessions leave behind. The composition step (src/compose.ts) merges
|
|
7
|
+
* consecutive collections by signature overlap; the async model enrichment
|
|
8
|
+
* (P2) may later relabel, never replace, what this produces at archive time.
|
|
9
|
+
*
|
|
10
|
+
* Pure module: SessionEventLike in, `CollectionSignature` out. The engine
|
|
11
|
+
* listener (src/engine.ts) is the only thing that calls this per session.
|
|
12
|
+
*/
|
|
13
|
+
import { estimateTokens } from "./render.js";
|
|
14
|
+
import { isHumanAuthored } from "./injections.js";
|
|
15
|
+
/** Stoplist: English function words + code scaffolding that carries no topic. */
|
|
16
|
+
const STOP = new Set([
|
|
17
|
+
'the', 'a', 'an', 'and', 'or', 'of', 'to', 'in', 'on', 'for', 'with', 'is', 'are', 'was', 'were', 'be', 'been', 'being',
|
|
18
|
+
'it', 'its', 'this', 'that', 'these', 'those', 'i', 'we', 'you', 'he', 'she', 'they', 'him', 'her', 'them', 'his', 'their', 'our', 'your', 'my', 'me', 'us',
|
|
19
|
+
'as', 'at', 'by', 'do', 'does', 'did', 'done', 'will', 'would', 'can', 'could', 'should', 'shall', 'may', 'might', 'must',
|
|
20
|
+
'just', 'also', 'then', 'than', 'so', 'if', 'else', 'not', 'no', 'yes', 'but', 'all', 'any', 'each', 'more', 'most', 'some', 'such', 'only', 'own', 'same', 'too', 'very',
|
|
21
|
+
'about', 'into', 'over', 'under', 'again', 'further', 'once', 'here', 'there', 'when', 'where', 'why', 'how', 'what', 'which', 'who', 'whom',
|
|
22
|
+
'get', 'got', 'let', 'make', 'made', 'use', 'used', 'using', 'run', 'ran', 'need', 'needs', 'want', 'wants', 'look', 'looked', 'see', 'saw', 'take', 'took', 'give', 'gave',
|
|
23
|
+
'const', 'let', 'var', 'function', 'return', 'import', 'from', 'export', 'async', 'await', 'new', 'class', 'type', 'interface', 'extends', 'implements',
|
|
24
|
+
'true', 'false', 'null', 'undefined', 'void', 'number', 'string', 'boolean', 'any', 'never', 'unknown', 'this', 'self', 'that', 'then', 'else', 'elif', 'while', 'for', 'do', 'try', 'catch', 'finally', 'throw', 'raise', 'def', 'fn', 'pub', 'use', 'match', 'end', 'begin',
|
|
25
|
+
'file', 'line', 'code', 'test', 'tests', 'error', 'warning', 'info', 'note', 'fix', 'add', 'added', 'remove', 'removed', 'update', 'updated', 'change', 'changed', 'create', 'created', 'delete', 'deleted', 'set', 'get', 'list', 'show', 'print', 'echo', 'cd', 'ls', 'cp', 'mv', 'rm', 'cat', 'git', 'npm', 'npx', 'node', 'python', 'bash', 'sh', 'cd', 'mkdir', 'touch', 'grep', 'sed', 'awk',
|
|
26
|
+
]);
|
|
27
|
+
const PATH_TOKEN = /((?:[A-Za-z0-9_.\-]+\/)+[A-Za-z0-9_.\-]+|\.{1,2}\/[A-Za-z0-9_.\-\/]+|[A-Za-z0-9_\-]+\.(?:ts|tsx|js|jsx|py|md|json|ya?ml|toml|sh|go|rs|c|cc|cpp|h|java|css|html|lock|txt|env|cfg|ini))/g;
|
|
28
|
+
const SHELL_TOOLS = new Set(['bash', 'shell', 'exec', 'run_command', 'execute', 'command', 'run']);
|
|
29
|
+
/**
|
|
30
|
+
* The events of the turn that just ended: from (exclusive) the previous
|
|
31
|
+
* `turn/end` (or the log start) through this `turn/end` inclusive.
|
|
32
|
+
*/
|
|
33
|
+
export function turnSpanOf(events, endSeq) {
|
|
34
|
+
const idx = events.findIndex((e) => e.type === 'turn/end' && e.seq === endSeq);
|
|
35
|
+
if (idx === -1)
|
|
36
|
+
return [];
|
|
37
|
+
let start = 0;
|
|
38
|
+
for (let i = idx - 1; i >= 0; i -= 1) {
|
|
39
|
+
if (events[i].type === 'turn/end') {
|
|
40
|
+
start = events[i].seq + 1;
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return events.filter((e) => e.seq >= start && e.seq <= endSeq);
|
|
45
|
+
}
|
|
46
|
+
const textBlocks = (data) => {
|
|
47
|
+
const message = (data.message ?? data);
|
|
48
|
+
const content = Array.isArray(message.content) ? message.content : [];
|
|
49
|
+
return content.filter((b) => b.type === 'text').map((b) => b.text ?? '').join('\n');
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Is this user/message authored by the human? The one predicate lives in
|
|
53
|
+
* src/injections.ts (shared with the renderer so the two layers can never
|
|
54
|
+
* drift on what counts as conversation); r28 measured the poison of the
|
|
55
|
+
* injections — AGENTS instructions (`kind: 'agent-instructions'`), the
|
|
56
|
+
* runtime-context snapshot (`kind: 'plugin'`), the skill catalog — every
|
|
57
|
+
* turn's signature gained `AGENTS.md`, `docs/contract.md`, ... drowning the
|
|
58
|
+
* real topic signal. Only `kind: 'user'` (or unlabelled, for seeded
|
|
59
|
+
* fixtures) counts.
|
|
60
|
+
*/
|
|
61
|
+
const isHumanMessage = isHumanAuthored;
|
|
62
|
+
/** Repo-relative normalization: a token mentioning a known code dir is cut at
|
|
63
|
+
* its LAST such dir, so '/home/u/p/src/sync.ts' and 'src/sync.ts' are one path. */
|
|
64
|
+
const normalizePath = (t) => {
|
|
65
|
+
const m = /(?:^|\/)(src|lib|tests?|docs?|scripts?|spikes?|presets?|examples?|dev|vendor|app|packages)\/(.+)$/.exec(t);
|
|
66
|
+
return m !== null ? `${m[1]}/${m[2]}` : t;
|
|
67
|
+
};
|
|
68
|
+
/** Path tokens must LOOK like files/dirs: an extension, or a known root dir
|
|
69
|
+
* prefix, or explicit relative/absolute form — not prose phrases like
|
|
70
|
+
* "compaction/fork" or "topics/summaries/rule" (r28 noise). */
|
|
71
|
+
const EXT = /\.(?:tsx?|jsx?|py|md|mdx|json|ya?ml|toml|sh|go|rs|c|cc|cpp|h|hpp|java|css|html|lock|txt|env|cfg|ini|csv|png|jpe?g|gif|svg|ipynb|yml)$/i;
|
|
72
|
+
const ROOT_DIR = /^(?:src|lib|tests?|docs?|scripts?|spikes?|presets?|examples?|dev|vendor|app|packages|node_modules|\.dsh[a-z-]*|spike)\//;
|
|
73
|
+
const isRealPath = (t) => EXT.test(t) || ROOT_DIR.test(t) || /^(?:\.\/|\.\.\/|~\/|\/)/.test(t);
|
|
74
|
+
/** Extract the deterministic signature for one completed turn's events. */
|
|
75
|
+
export function extractSignature(events, topTerms = 8) {
|
|
76
|
+
const seqs = events.map((e) => e.seq).sort((a, b) => a - b);
|
|
77
|
+
const paths = [];
|
|
78
|
+
const commands = [];
|
|
79
|
+
const push = (arr, v) => { if (v !== '' && !arr.includes(v))
|
|
80
|
+
arr.push(v); };
|
|
81
|
+
let size = 0;
|
|
82
|
+
const termCounts = new Map();
|
|
83
|
+
for (const ev of events) {
|
|
84
|
+
const data = (ev.data ?? {});
|
|
85
|
+
if (ev.type === 'user/message' || ev.type === 'assistant/message') {
|
|
86
|
+
const text = textBlocks(data);
|
|
87
|
+
size += estimateTokens(text);
|
|
88
|
+
const human = ev.type === 'assistant/message' || isHumanMessage(data);
|
|
89
|
+
if (human) {
|
|
90
|
+
// Paths mentioned in PROSE are task signal too ("fix src/auth/x.ts").
|
|
91
|
+
for (const m of text.matchAll(PATH_TOKEN)) {
|
|
92
|
+
const norm = normalizePath(m[1]);
|
|
93
|
+
if (isRealPath(norm))
|
|
94
|
+
push(paths, norm);
|
|
95
|
+
}
|
|
96
|
+
for (const tok of text.toLowerCase().split(/[^a-z0-9_]+/)) {
|
|
97
|
+
if (tok.length < 3 || tok.length > 28 || STOP.has(tok) || /^\d+$/.test(tok))
|
|
98
|
+
continue;
|
|
99
|
+
termCounts.set(tok, (termCounts.get(tok) ?? 0) + 1);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
else if (ev.type === 'tool/call') {
|
|
104
|
+
const name = String(data.name ?? '');
|
|
105
|
+
const args = typeof data.arguments === 'string' ? data.arguments : JSON.stringify(data.arguments ?? {});
|
|
106
|
+
size += estimateTokens(args);
|
|
107
|
+
for (const m of args.matchAll(PATH_TOKEN)) {
|
|
108
|
+
const norm = normalizePath(m[1]);
|
|
109
|
+
if (isRealPath(norm))
|
|
110
|
+
push(paths, norm);
|
|
111
|
+
}
|
|
112
|
+
if (SHELL_TOOLS.has(name.toLowerCase())) {
|
|
113
|
+
// argv prefix: first three non-flag tokens of the command string.
|
|
114
|
+
// NON-shell tools contribute nothing to `commands` (r28: tool NAMES
|
|
115
|
+
// like read/grep appear in every turn — constant overlap that drowns
|
|
116
|
+
// the real signal; their target files are already in `paths`).
|
|
117
|
+
const argv = args.replace(/^["'\s]+|["'\s]+$/g, '').split(/\s+/).filter((t) => !t.startsWith('-')).slice(0, 3);
|
|
118
|
+
if (argv.length > 0)
|
|
119
|
+
push(commands, argv.join(' '));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const terms = [...termCounts.entries()]
|
|
124
|
+
.sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]))
|
|
125
|
+
.slice(0, topTerms)
|
|
126
|
+
.map(([t]) => t);
|
|
127
|
+
return { seqs, paths, commands, terms, size, by: 'deterministic' };
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Chapter topics for the index: the chapter's own signature — the strongest
|
|
131
|
+
* paths first (same file ≈ same task), then top terms. Capped; this is the
|
|
132
|
+
* deterministic floor the P2 enrichment pass may later relabel.
|
|
133
|
+
*/
|
|
134
|
+
export function chapterTopics(events, lo, hi, cap = 8) {
|
|
135
|
+
const span = events.filter((e) => e.seq >= lo && e.seq <= hi);
|
|
136
|
+
const sig = extractSignature(span);
|
|
137
|
+
const out = [];
|
|
138
|
+
for (const p of sig.paths.slice(0, 3))
|
|
139
|
+
if (!out.includes(p))
|
|
140
|
+
out.push(p);
|
|
141
|
+
for (const t of sig.terms) {
|
|
142
|
+
if (out.length >= cap)
|
|
143
|
+
break;
|
|
144
|
+
if (!out.includes(t))
|
|
145
|
+
out.push(t);
|
|
146
|
+
}
|
|
147
|
+
return out.slice(0, cap);
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=signature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signature.js","sourceRoot":"","sources":["../src/signature.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAkBjD,iFAAiF;AACjF,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC;IACnB,KAAK,EAAC,GAAG,EAAC,IAAI,EAAC,KAAK,EAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,KAAK,EAAC,MAAM,EAAC,IAAI,EAAC,KAAK,EAAC,KAAK,EAAC,MAAM,EAAC,IAAI,EAAC,MAAM,EAAC,OAAO;IACtG,IAAI,EAAC,KAAK,EAAC,MAAM,EAAC,MAAM,EAAC,OAAO,EAAC,OAAO,EAAC,GAAG,EAAC,IAAI,EAAC,KAAK,EAAC,IAAI,EAAC,KAAK,EAAC,MAAM,EAAC,KAAK,EAAC,KAAK,EAAC,MAAM,EAAC,KAAK,EAAC,OAAO,EAAC,KAAK,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
|
+
import type { ArchiveFs, ChapterRecord, NumberAllocator } from './archive.ts';
|
|
2
|
+
import { type SessionState } from './registry.ts';
|
|
3
|
+
/** Parse (and backfill defaults for) one raw registry record — the seam
|
|
4
|
+
* migrations and tests use; the domain open path uses the same schema. */
|
|
5
|
+
export declare const parseSessionState: (raw: unknown) => SessionState;
|
|
6
|
+
/** Parse (and default-fill) one stored project row — the migration seam tests
|
|
7
|
+
* and any future provider-kind backfill use; same shape as parseSessionState. */
|
|
8
|
+
export declare const parseProjectRecord: (raw: unknown) => ProjectRecordShape;
|
|
9
|
+
type ProjectRecordShape = {
|
|
10
|
+
projectKey: string;
|
|
11
|
+
slug: string;
|
|
12
|
+
remote: string;
|
|
13
|
+
harnessId: string;
|
|
14
|
+
linkedAt: string;
|
|
15
|
+
cwd: string;
|
|
16
|
+
kind: 'git' | 'treedx';
|
|
17
|
+
repoId?: string | undefined;
|
|
18
|
+
};
|
|
19
|
+
/** Durable declaration of the dsh_chapters registry domain. */ export declare const chapterDomainSpec: {
|
|
20
|
+
name: string;
|
|
21
|
+
version: number;
|
|
22
|
+
compatibleVersions: number[];
|
|
23
|
+
tables: {
|
|
24
|
+
sessions: import("@deepseek-ai/dsh-storage-domain").DomainTableSpec<string, SessionState>;
|
|
25
|
+
projects: import("@deepseek-ai/dsh-storage-domain").DomainTableSpec<string, import("./sync.ts").ProjectRecord>;
|
|
26
|
+
settings: import("@deepseek-ai/dsh-storage-domain").DomainTableSpec<string, {
|
|
27
|
+
value: string;
|
|
28
|
+
}>;
|
|
29
|
+
rules: import("@deepseek-ai/dsh-storage-domain").DomainTableSpec<string, import("./rules.ts").RuleRecord>;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
/** Minimal structural type of `ctx.storageDomain.open(spec)` we rely on. */
|
|
33
|
+
export interface DomainLike {
|
|
34
|
+
table(name: 'sessions'): {
|
|
35
|
+
get(key: string): SessionState | undefined;
|
|
36
|
+
put(key: string, value: SessionState): Promise<void>;
|
|
37
|
+
entries(): IterableIterator<[string, SessionState]>;
|
|
38
|
+
readonly size: number;
|
|
39
|
+
};
|
|
40
|
+
table(name: 'projects'): {
|
|
41
|
+
get(key: string): import('./sync.ts').ProjectRecord | undefined;
|
|
42
|
+
put(key: string, value: import('./sync.ts').ProjectRecord): Promise<void>;
|
|
43
|
+
entries(): IterableIterator<[string, import('./sync.ts').ProjectRecord]>;
|
|
44
|
+
readonly size: number;
|
|
45
|
+
};
|
|
46
|
+
table(name: 'settings'): {
|
|
47
|
+
get(key: string): {
|
|
48
|
+
value: string;
|
|
49
|
+
} | undefined;
|
|
50
|
+
put(key: string, value: {
|
|
51
|
+
value: string;
|
|
52
|
+
}): Promise<void>;
|
|
53
|
+
entries(): IterableIterator<[string, {
|
|
54
|
+
value: string;
|
|
55
|
+
}]>;
|
|
56
|
+
readonly size: number;
|
|
57
|
+
};
|
|
58
|
+
table(name: 'rules'): {
|
|
59
|
+
get(key: string): import('./rules.ts').RuleRecord | undefined;
|
|
60
|
+
put(key: string, value: import('./rules.ts').RuleRecord): Promise<void>;
|
|
61
|
+
entries(): IterableIterator<[string, import('./rules.ts').RuleRecord]>;
|
|
62
|
+
readonly size: number;
|
|
63
|
+
};
|
|
64
|
+
close(): Promise<void>;
|
|
65
|
+
}
|
|
66
|
+
/** Read-modify-write seam over one domain. */
|
|
67
|
+
export type ProjectRecord = import('./sync.ts').ProjectRecord;
|
|
68
|
+
export interface RegistryStore {
|
|
69
|
+
get(sessionId: string): Promise<SessionState>;
|
|
70
|
+
put(sessionId: string, state: SessionState): Promise<void>;
|
|
71
|
+
/** Knowledge projects linked for this workspace (record §8). Live view. */
|
|
72
|
+
projects(): IterableIterator<[string, ProjectRecord]>;
|
|
73
|
+
/** All session states in the domain (for collection publishing, §5). */
|
|
74
|
+
sessions(): IterableIterator<[string, SessionState]>;
|
|
75
|
+
/** Durable kv (P2: enrichment model override). */
|
|
76
|
+
getSetting(key: string): string | undefined;
|
|
77
|
+
putSetting(key: string, value: string): Promise<void>;
|
|
78
|
+
/** P3 §7.1 rule records (status is NOT here — per-machine curation facts, §15). */
|
|
79
|
+
rules(): IterableIterator<[string, import('./rules.ts').RuleRecord]>;
|
|
80
|
+
getRule(id: string): import('./rules.ts').RuleRecord | undefined;
|
|
81
|
+
putRule(id: string, value: import('./rules.ts').RuleRecord): Promise<void>;
|
|
82
|
+
}
|
|
83
|
+
export declare function makeDomainStore(domain: DomainLike): RegistryStore;
|
|
84
|
+
/**
|
|
85
|
+
* The NumberAllocator archive.ts asks for, bound to one author session.
|
|
86
|
+
* Reserve-before-write per docs/architecture.md § Atomicity; retries reuse
|
|
87
|
+
* numbers through registry.reserve's attempt-keyed idempotence.
|
|
88
|
+
*/
|
|
89
|
+
export declare function makeAllocator(store: RegistryStore, sessionId: string): NumberAllocator;
|
|
90
|
+
/** The commit-point write: verified chapter records into the session state. */
|
|
91
|
+
export declare function commitChapters(store: RegistryStore, sessionId: string, records: readonly ChapterRecord[]): Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* One domain, one opener: `DomainFacility.open` throws `already-open` for a
|
|
94
|
+
* reserved name and never releases the reservation except via `Domain.close()`
|
|
95
|
+
* (r27b proved the multi-opener lottery: plugin-apply, the realm engine, and
|
|
96
|
+
* any probe all targeting dsh_chapters — whoever raced first won and everyone
|
|
97
|
+
* else's compaction failed). Acquire = try open; on already-open, adopt the
|
|
98
|
+
* live handle via `facility.get` and claim NO close ownership.
|
|
99
|
+
*/
|
|
100
|
+
export interface ChapterStoreHandle {
|
|
101
|
+
store: RegistryStore;
|
|
102
|
+
/** the live domain handle: read-only table scans for acquirers that do not own it. */
|
|
103
|
+
domain: DomainLike;
|
|
104
|
+
/**
|
|
105
|
+
* True only for the acquire that actually opened the domain. Recorded for
|
|
106
|
+
* observability; the CLOSER is the facility's own unmount disposer
|
|
107
|
+
* (closeAll), never an opener-registered effect — a fiber-scoped close
|
|
108
|
+
* effect fires when that fiber disposes, mid-run (r35).
|
|
109
|
+
*/
|
|
110
|
+
owner: boolean;
|
|
111
|
+
}
|
|
112
|
+
export declare function acquireChapterStore(storageDomain: {
|
|
113
|
+
open: (spec: unknown) => Promise<DomainLike>;
|
|
114
|
+
get?: (name: string) => DomainLike | undefined;
|
|
115
|
+
}): Promise<ChapterStoreHandle>;
|
|
116
|
+
/**
|
|
117
|
+
* ArchiveFs over node:fs, anchored at one base dir (the session workspace).
|
|
118
|
+
* Plugins are trusted same-process code — the sandbox governs TOOLS, not
|
|
119
|
+
* this path — so node:fs is legitimate here; `ctx.fs` stays untouched.
|
|
120
|
+
* `read` maps ENOENT to undefined; anything else propagates: a permission
|
|
121
|
+
* error must not look like a missing file.
|
|
122
|
+
*/
|
|
123
|
+
export declare function makeArchiveFs(baseDir: string): ArchiveFs;
|
|
124
|
+
/**
|
|
125
|
+
* "Add <store-root>/ to .gitignore on first write and say so" — silently
|
|
126
|
+
* polluting a user's tree is its own small bug (docs/architecture.md §
|
|
127
|
+
* Storage). Returns a human line for the tool result's warnings.
|
|
128
|
+
*/
|
|
129
|
+
export declare function ensureStoreGitignore(fs: ArchiveFs, storeRoot: string): Promise<string>;
|
|
130
|
+
export {};
|
package/lib/store.js
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The storage-domain adapter: zod schemas, the durable spec, and the ports
|
|
3
|
+
* that connect the pure registry (registry.ts) and pure archive writer
|
|
4
|
+
* (archive.ts) to host persistence and the filesystem. This is glue next to
|
|
5
|
+
* `src/index.ts` — thin by policy; every decision lives in the pure layer.
|
|
6
|
+
*
|
|
7
|
+
* Keying: one record per SESSION id (`sessions` table), because chapters are
|
|
8
|
+
* keyed by creating session, not a linear chain id — siblings branching from
|
|
9
|
+
* one ancestor cannot collide, and the flat TOC is built by walking links
|
|
10
|
+
* (registry.ancestorPath), never by a directory scan.
|
|
11
|
+
*
|
|
12
|
+
* Concurrency, honestly: read-modify-write per key. Same-session archive
|
|
13
|
+
* flows are serialized by their own reserve-before-write ordering, and a
|
|
14
|
+
* session has exactly one write handle (the kernel refuses a second, measured
|
|
15
|
+
* r3). Cross-process same-key writes are last-writer-wins on the JSON
|
|
16
|
+
* backend — acceptable for MVP, worth revisiting before multi-host chains.
|
|
17
|
+
*/
|
|
18
|
+
import { z } from 'zod';
|
|
19
|
+
import { ruleRecordSchema } from "./rules.js";
|
|
20
|
+
import { defineDomain, domainTable } from '@deepseek-ai/dsh-storage-domain';
|
|
21
|
+
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
22
|
+
import { dirname } from 'node:path';
|
|
23
|
+
import { appendChapters, freshSession, reserve } from "./registry.js";
|
|
24
|
+
// ---------------------------------------------------------------- schemas + spec
|
|
25
|
+
const chapterRecordSchema = z.object({
|
|
26
|
+
number: z.number().int().positive(),
|
|
27
|
+
path: z.string().min(1),
|
|
28
|
+
title: z.string(),
|
|
29
|
+
summary: z.string(),
|
|
30
|
+
startSeq: z.number().int().nonnegative(),
|
|
31
|
+
endSeq: z.number().int().nonnegative(),
|
|
32
|
+
topics: z.array(z.string()).default([]),
|
|
33
|
+
messages: z.number().int().nonnegative().optional(),
|
|
34
|
+
shadowedSeqs: z.array(z.number().int().nonnegative()).optional(),
|
|
35
|
+
sha256: z.string().min(16),
|
|
36
|
+
/** P2 §2.4 provenance chains, newest-first per field (absent = everything
|
|
37
|
+
* still deterministic; enrichment only ever grows these). */
|
|
38
|
+
generated: z.record(z.string(), z.array(z.object({
|
|
39
|
+
by: z.string(), model: z.string().optional(), at: z.string().optional(),
|
|
40
|
+
}))).optional(),
|
|
41
|
+
estimatedTokens: z.number().int().nonnegative(),
|
|
42
|
+
artifacts: z.array(z.object({
|
|
43
|
+
path: z.string().min(1),
|
|
44
|
+
sha256: z.string().min(16),
|
|
45
|
+
bytes: z.number().int().nonnegative(),
|
|
46
|
+
})),
|
|
47
|
+
});
|
|
48
|
+
const collectionSchema = z.object({
|
|
49
|
+
seqs: z.array(z.number().int().nonnegative()).min(1),
|
|
50
|
+
paths: z.array(z.string()),
|
|
51
|
+
commands: z.array(z.string()),
|
|
52
|
+
terms: z.array(z.string()),
|
|
53
|
+
size: z.number().int().nonnegative(),
|
|
54
|
+
by: z.literal('deterministic'),
|
|
55
|
+
});
|
|
56
|
+
const sessionStateSchema = z.object({
|
|
57
|
+
parentSession: z.string().nullable(),
|
|
58
|
+
rootSession: z.string().min(1),
|
|
59
|
+
nextChapterNumber: z.number().int().positive(),
|
|
60
|
+
chapters: z.array(chapterRecordSchema),
|
|
61
|
+
reservations: z.record(z.string(), z.array(z.number().int().positive())).default({}),
|
|
62
|
+
plans: z.record(z.string(), z.object({
|
|
63
|
+
number: z.number().int().positive(),
|
|
64
|
+
path: z.string().min(1),
|
|
65
|
+
title: z.string(),
|
|
66
|
+
summary: z.string(),
|
|
67
|
+
chapters: z.array(z.object({
|
|
68
|
+
number: z.number().int().positive(),
|
|
69
|
+
path: z.string().min(1),
|
|
70
|
+
title: z.string(),
|
|
71
|
+
summary: z.string(),
|
|
72
|
+
startSeq: z.number().int().nonnegative(),
|
|
73
|
+
endSeq: z.number().int().nonnegative(),
|
|
74
|
+
})).optional(),
|
|
75
|
+
})).default({}),
|
|
76
|
+
finalized: z.record(z.string(), z.array(z.number().int().positive())).default({}),
|
|
77
|
+
collections: z.array(collectionSchema).default([]),
|
|
78
|
+
});
|
|
79
|
+
/** Parse (and backfill defaults for) one raw registry record — the seam
|
|
80
|
+
* migrations and tests use; the domain open path uses the same schema. */
|
|
81
|
+
export const parseSessionState = (raw) => sessionStateSchema.parse(raw);
|
|
82
|
+
const projectRecordSchema = z.object({
|
|
83
|
+
projectKey: z.string().min(1),
|
|
84
|
+
slug: z.string(),
|
|
85
|
+
remote: z.string().min(1),
|
|
86
|
+
harnessId: z.string().min(1),
|
|
87
|
+
linkedAt: z.string(),
|
|
88
|
+
cwd: z.string(),
|
|
89
|
+
/** Transport kind (§15 amendment); absent on stored rows = 'git'. */
|
|
90
|
+
kind: z.enum(['git', 'treedx']).default('git'),
|
|
91
|
+
/** TreeDX: server-assigned repository id, resolved at link time. */
|
|
92
|
+
repoId: z.string().optional(),
|
|
93
|
+
});
|
|
94
|
+
/** Parse (and default-fill) one stored project row — the migration seam tests
|
|
95
|
+
* and any future provider-kind backfill use; same shape as parseSessionState. */
|
|
96
|
+
export const parseProjectRecord = (raw) => projectRecordSchema.parse(raw);
|
|
97
|
+
/** Durable declaration of the dsh_chapters registry domain. */ export const chapterDomainSpec = defineDomain({
|
|
98
|
+
name: 'dsh_chapters',
|
|
99
|
+
// v1: + settings table (enrichment model overrides, P2). Existing v0 media
|
|
100
|
+
// load under compatibleVersions; absent tables materialize empty.
|
|
101
|
+
// v2: + rules table (P3 §7.1 records; status rides per-machine curation facts,
|
|
102
|
+
// never this table).
|
|
103
|
+
// v3: + projects.kind / projects.repoId (§15 amendment: transport is
|
|
104
|
+
// pluggable). Stored v2 rows parse with kind defaulting to 'git' — old data
|
|
105
|
+
// keeps working with zero migration, and the git path is untouched.
|
|
106
|
+
version: 3,
|
|
107
|
+
compatibleVersions: [0, 1, 2],
|
|
108
|
+
tables: {
|
|
109
|
+
sessions: domainTable(sessionStateSchema),
|
|
110
|
+
projects: domainTable(projectRecordSchema),
|
|
111
|
+
settings: domainTable(z.object({ value: z.string() })),
|
|
112
|
+
rules: domainTable(ruleRecordSchema),
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
export function makeDomainStore(domain) {
|
|
116
|
+
const table = domain.table('sessions');
|
|
117
|
+
const projects = domain.table('projects');
|
|
118
|
+
const settings = domain.table('settings');
|
|
119
|
+
const rules = domain.table('rules');
|
|
120
|
+
return {
|
|
121
|
+
async get(sessionId) {
|
|
122
|
+
const raw = table.get(sessionId);
|
|
123
|
+
return raw ?? freshSession(sessionId);
|
|
124
|
+
},
|
|
125
|
+
async put(sessionId, state) {
|
|
126
|
+
await table.put(sessionId, state);
|
|
127
|
+
},
|
|
128
|
+
projects() {
|
|
129
|
+
return projects.entries();
|
|
130
|
+
},
|
|
131
|
+
sessions() {
|
|
132
|
+
return table.entries();
|
|
133
|
+
},
|
|
134
|
+
getSetting(key) {
|
|
135
|
+
return settings.get(key)?.value;
|
|
136
|
+
},
|
|
137
|
+
async putSetting(key, value) {
|
|
138
|
+
await settings.put(key, { value });
|
|
139
|
+
},
|
|
140
|
+
rules() {
|
|
141
|
+
return rules.entries();
|
|
142
|
+
},
|
|
143
|
+
getRule(id) {
|
|
144
|
+
return rules.get(id);
|
|
145
|
+
},
|
|
146
|
+
async putRule(id, value) {
|
|
147
|
+
await rules.put(id, value);
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* The NumberAllocator archive.ts asks for, bound to one author session.
|
|
153
|
+
* Reserve-before-write per docs/architecture.md § Atomicity; retries reuse
|
|
154
|
+
* numbers through registry.reserve's attempt-keyed idempotence.
|
|
155
|
+
*/
|
|
156
|
+
export function makeAllocator(store, sessionId) {
|
|
157
|
+
return {
|
|
158
|
+
async reserve(attemptId, count) {
|
|
159
|
+
const state = await store.get(sessionId);
|
|
160
|
+
const next = reserve(state, attemptId, count);
|
|
161
|
+
await store.put(sessionId, next.state);
|
|
162
|
+
return next.numbers;
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
/** The commit-point write: verified chapter records into the session state. */
|
|
167
|
+
export async function commitChapters(store, sessionId, records) {
|
|
168
|
+
const state = await store.get(sessionId);
|
|
169
|
+
const next = appendChapters(state, records);
|
|
170
|
+
if (next !== state)
|
|
171
|
+
await store.put(sessionId, next);
|
|
172
|
+
}
|
|
173
|
+
export async function acquireChapterStore(storageDomain) {
|
|
174
|
+
try {
|
|
175
|
+
const domain = await storageDomain.open(chapterDomainSpec);
|
|
176
|
+
return { store: makeDomainStore(domain), domain, owner: true };
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
if (!/already[- ]open/i.test(String(error?.message ?? error)))
|
|
180
|
+
throw error;
|
|
181
|
+
const existing = storageDomain.get?.(chapterDomainSpec.name);
|
|
182
|
+
if (existing === undefined)
|
|
183
|
+
throw error;
|
|
184
|
+
return { store: makeDomainStore(existing), domain: existing, owner: false };
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
// ---------------------------------------------------------------- filesystem port
|
|
188
|
+
const join = (...parts) => parts.filter(Boolean).join('/').replace(/\/{2,}/g, '/');
|
|
189
|
+
/**
|
|
190
|
+
* ArchiveFs over node:fs, anchored at one base dir (the session workspace).
|
|
191
|
+
* Plugins are trusted same-process code — the sandbox governs TOOLS, not
|
|
192
|
+
* this path — so node:fs is legitimate here; `ctx.fs` stays untouched.
|
|
193
|
+
* `read` maps ENOENT to undefined; anything else propagates: a permission
|
|
194
|
+
* error must not look like a missing file.
|
|
195
|
+
*/
|
|
196
|
+
export function makeArchiveFs(baseDir) {
|
|
197
|
+
const abs = (p) => join(baseDir, p);
|
|
198
|
+
return {
|
|
199
|
+
async write(p, content) {
|
|
200
|
+
const target = abs(p);
|
|
201
|
+
await mkdir(dirname(target), { recursive: true });
|
|
202
|
+
await writeFile(target, content, 'utf8');
|
|
203
|
+
},
|
|
204
|
+
async read(p) {
|
|
205
|
+
try {
|
|
206
|
+
return await readFile(abs(p), 'utf8');
|
|
207
|
+
}
|
|
208
|
+
catch (error) {
|
|
209
|
+
if (error.code === 'ENOENT')
|
|
210
|
+
return undefined;
|
|
211
|
+
throw error;
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
async exists(p) {
|
|
215
|
+
return (await this.read(p)) !== undefined;
|
|
216
|
+
},
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* "Add <store-root>/ to .gitignore on first write and say so" — silently
|
|
221
|
+
* polluting a user's tree is its own small bug (docs/architecture.md §
|
|
222
|
+
* Storage). Returns a human line for the tool result's warnings.
|
|
223
|
+
*/
|
|
224
|
+
export async function ensureStoreGitignore(fs, storeRoot) {
|
|
225
|
+
const current = await fs.read('.gitignore');
|
|
226
|
+
const entry = `${storeRoot.replace(/\/+$/, '')}/`;
|
|
227
|
+
if (current !== undefined && current.split('\n').some((line) => line.trim() === entry)) {
|
|
228
|
+
return `${entry} already in .gitignore`;
|
|
229
|
+
}
|
|
230
|
+
const updated = (current ?? '') + (current !== undefined && !current.endsWith('\n') ? '\n' : '') +
|
|
231
|
+
`\n# dsh-chapters archive (verbatim chapter store; see README)\n${entry}\n`;
|
|
232
|
+
await fs.write('.gitignore', updated);
|
|
233
|
+
return `added ${entry} to .gitignore — say so: the plugin wrote into the repo root`;
|
|
234
|
+
}
|
|
235
|
+
//# sourceMappingURL=store.js.map
|
package/lib/store.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,OAAO,EAAqB,MAAM,eAAe,CAAA;AAExF,kFAAkF;AAElF,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACnC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,C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