wicked-crew 0.16.9 → 0.16.10
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/dist/api/auth.d.ts.map +1 -1
- package/dist/api/auth.js +13 -2
- package/dist/api/auth.js.map +1 -1
- package/dist/api/routes.d.ts.map +1 -1
- package/dist/api/routes.js +23 -2
- package/dist/api/routes.js.map +1 -1
- package/dist/api/server.d.ts.map +1 -1
- package/dist/api/server.js +42 -0
- package/dist/api/server.js.map +1 -1
- package/dist/interactive/chat-events.d.ts +7 -0
- package/dist/interactive/chat-events.d.ts.map +1 -1
- package/dist/interactive/chat-events.js +19 -1
- package/dist/interactive/chat-events.js.map +1 -1
- package/dist/interactive/doc-delete-routes.d.ts.map +1 -1
- package/dist/interactive/doc-delete-routes.js +5 -0
- package/dist/interactive/doc-delete-routes.js.map +1 -1
- package/dist/interactive/edit-events.d.ts.map +1 -1
- package/dist/interactive/edit-events.js +12 -1
- package/dist/interactive/edit-events.js.map +1 -1
- package/dist/interactive/proxy-routes.d.ts +7 -0
- package/dist/interactive/proxy-routes.d.ts.map +1 -1
- package/dist/interactive/proxy-routes.js +45 -2
- package/dist/interactive/proxy-routes.js.map +1 -1
- package/dist/interactive/review-events.d.ts +2 -0
- package/dist/interactive/review-events.d.ts.map +1 -1
- package/dist/interactive/review-events.js +7 -0
- package/dist/interactive/review-events.js.map +1 -1
- package/dist/interactive/theme-events.d.ts +2 -0
- package/dist/interactive/theme-events.d.ts.map +1 -1
- package/dist/interactive/theme-events.js +7 -0
- package/dist/interactive/theme-events.js.map +1 -1
- package/dist/working-doc/bridge-backend.d.ts +11 -0
- package/dist/working-doc/bridge-backend.d.ts.map +1 -0
- package/dist/working-doc/bridge-backend.js +140 -0
- package/dist/working-doc/bridge-backend.js.map +1 -0
- package/dist/working-doc/routes.d.ts +21 -0
- package/dist/working-doc/routes.d.ts.map +1 -0
- package/dist/working-doc/routes.js +85 -0
- package/dist/working-doc/routes.js.map +1 -0
- package/dist/working-doc/sections.d.ts +36 -0
- package/dist/working-doc/sections.d.ts.map +1 -0
- package/dist/working-doc/sections.js +85 -0
- package/dist/working-doc/sections.js.map +1 -0
- package/dist/working-doc/service.d.ts +183 -0
- package/dist/working-doc/service.d.ts.map +1 -0
- package/dist/working-doc/service.js +366 -0
- package/dist/working-doc/service.js.map +1 -0
- package/dist/working-doc/store.d.ts +105 -0
- package/dist/working-doc/store.d.ts.map +1 -0
- package/dist/working-doc/store.js +71 -0
- package/dist/working-doc/store.js.map +1 -0
- package/endpoint-manifest.json +38 -1
- package/package.json +1 -1
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE WORKING DOCUMENT AND STEERING FROM IT (program DES-POWER-MODE §8.3, §9; spike 3).
|
|
3
|
+
*
|
|
4
|
+
* - Each run may have ONE working document: a wicked-interactive document (kind `phase-report`) in the run's
|
|
5
|
+
* project, bound by crew (`store.ts`). Versions are interactive's: write-once, parent-linked, each batch with
|
|
6
|
+
* its `author`. A section is rewritten with one deterministic `content-edit`: no model, never a governed run.
|
|
7
|
+
* - Attribution is crew's to decide. A person's edit (`author: 'operator'`) is accepted only from a HUMAN actor and
|
|
8
|
+
* is recorded as theirs, with the plugin that hosted it named as the surface. A plugin's own generated lines
|
|
9
|
+
* (`author: 'plugin'`) are recorded as `plugin:<id>@<version>` and may touch only the plugin's own section.
|
|
10
|
+
* Nothing a plugin writes is ever recorded as a person's, and a plugin's lines never steer.
|
|
11
|
+
* - STEERING. A person's version becomes ONE note for the run, sent through the operator's existing back-channel
|
|
12
|
+
* (`injectWorkerMessage`, the `POST /runs/:id/inject` path): queued by the engine, it rides the next step's
|
|
13
|
+
* prompt as an operator context block, and `workerMessageInjected` says which step picked it up.
|
|
14
|
+
* Goal, Approach and Next go to the next step once; Constraints and steering is a STANDING steer, re-sent before
|
|
15
|
+
* every later step until a later edit replaces it. Decisions and Open questions are recorded, not sent.
|
|
16
|
+
* - DOCUMENT TEXT HAS NO POWER OVER GATES. This module calls `injectWorkerMessage` and nothing else on the engine:
|
|
17
|
+
* no gate answer, no plan edit, no intent amendment, no rigor change. A note says in its first line that it
|
|
18
|
+
* adds to the step's brief and changes no gate, check or review. (Tested: `tests/working-doc.test.ts`.)
|
|
19
|
+
*/
|
|
20
|
+
import { randomUUID } from 'node:crypto';
|
|
21
|
+
import { PLUGIN_SECTIONS, SECTION_LABELS, SECTION_MAX_CHARS, SECTION_STEER, anchorOf, changedSections, encodeSectionText, initialHtml, isSectionId, sectionsOf, } from './sections.js';
|
|
22
|
+
const PLUGIN_ID = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u;
|
|
23
|
+
const PLUGIN_VERSION = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u;
|
|
24
|
+
/** A doc name interactive accepts (lowercase, digits, hyphens; ≤ 64): one per run. */
|
|
25
|
+
export function workingDocName(runId) {
|
|
26
|
+
const slug = runId.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+/, '').slice(0, 40).replace(/-+$/, '');
|
|
27
|
+
return `working-${slug === '' ? 'run' : slug}`;
|
|
28
|
+
}
|
|
29
|
+
/** The marker a note ends with, by which `workerMessageInjected` is matched back to its steer. */
|
|
30
|
+
export function steerMarker(runId, steerId) {
|
|
31
|
+
return `[working-doc ${runId.slice(0, 8)}:${steerId}]`;
|
|
32
|
+
}
|
|
33
|
+
/** The one note a person's version becomes: the sections that steer once, and the standing constraint, together. */
|
|
34
|
+
export function steerNote(version, by, standing, texts, marker) {
|
|
35
|
+
const head = standing
|
|
36
|
+
? `Operator steering from the job's working document (version ${version}, by ${by}). Its Constraints and steering is standing: follow it in this step and every later one until it is replaced. It replaces any standing constraint from an earlier version.`
|
|
37
|
+
: `Operator steering from the job's working document (version ${version}, by ${by}).`;
|
|
38
|
+
const lines = texts.map((t) => `- ${SECTION_LABELS[t.id]}: ${t.text.trim() === '' ? '(cleared)' : t.text.trim()}`);
|
|
39
|
+
return [head, NO_GATE_LINE, ...lines, marker].join('\n');
|
|
40
|
+
}
|
|
41
|
+
/** The standing constraint alone, re-sent before every later step. */
|
|
42
|
+
export function standingNote(version, by, text, marker) {
|
|
43
|
+
return [
|
|
44
|
+
`Standing operator constraint from the job's working document (version ${version}, by ${by}). Follow it in this step and every later one until it is replaced. If you also see a standing constraint from a later version, that one applies instead.`,
|
|
45
|
+
NO_GATE_LINE,
|
|
46
|
+
`- ${SECTION_LABELS.constraints}: ${text.trim()}`,
|
|
47
|
+
marker,
|
|
48
|
+
].join('\n');
|
|
49
|
+
}
|
|
50
|
+
/** Every note's second line. */
|
|
51
|
+
export const NO_GATE_LINE = 'It adds to your brief. It does not answer, skip or change any gate, check, review or QE step.';
|
|
52
|
+
function blankSections() {
|
|
53
|
+
return { goal: '', approach: '', decisions: '', constraints: '', questions: '', next: '' };
|
|
54
|
+
}
|
|
55
|
+
/** A write whose outcome is not known (no version in time, or a version that is not this batch's). */
|
|
56
|
+
export class UndeterminedWriteError extends Error {
|
|
57
|
+
constructor(message) { super(message); this.name = 'UndeterminedWriteError'; }
|
|
58
|
+
}
|
|
59
|
+
export class WorkingDocService {
|
|
60
|
+
d;
|
|
61
|
+
now;
|
|
62
|
+
/** The newest dispatch of each run (unit and attempt): the step a note injected now is picked up by. */
|
|
63
|
+
lastDispatch = new Map();
|
|
64
|
+
/** A standing constraint with a copy queued and not yet picked up. */
|
|
65
|
+
queued = new Map();
|
|
66
|
+
/** One write per run at a time (a second waits its turn); steering renewals take the same turn. */
|
|
67
|
+
locks = new Map();
|
|
68
|
+
/** A standing steer is re-queued once per dispatch that picked it up (a live worker hears it once, not in a loop). */
|
|
69
|
+
renewedFor = new Map();
|
|
70
|
+
constructor(d) {
|
|
71
|
+
this.d = d;
|
|
72
|
+
this.now = d.now ?? Date.now;
|
|
73
|
+
}
|
|
74
|
+
exclusive(runId, f) {
|
|
75
|
+
const prev = this.locks.get(runId) ?? Promise.resolve();
|
|
76
|
+
const next = prev.then(f, f);
|
|
77
|
+
this.locks.set(runId, next.catch(() => undefined));
|
|
78
|
+
return next;
|
|
79
|
+
}
|
|
80
|
+
async view(runId) {
|
|
81
|
+
// An edit whose outcome was unknown is settled on every read, not only by the next edit.
|
|
82
|
+
if (this.d.store.get(runId)?.pending != null)
|
|
83
|
+
await this.exclusive(runId, () => this.reconcile(runId));
|
|
84
|
+
const rec = this.d.store.get(runId);
|
|
85
|
+
const base = { runId, labels: { ...SECTION_LABELS }, trail: rec?.trail ?? [], steers: rec?.steers ?? [] };
|
|
86
|
+
if (rec === undefined)
|
|
87
|
+
return { ...base, doc: null, sections: null };
|
|
88
|
+
const head = await this.d.backend.read(rec.projectId, rec.docId);
|
|
89
|
+
if (head === null)
|
|
90
|
+
return { ...base, doc: null, sections: null };
|
|
91
|
+
return { ...base, doc: { projectId: rec.projectId, docId: rec.docId, head: head.head }, sections: { ...blankSections(), ...sectionsOf(head.html) } };
|
|
92
|
+
}
|
|
93
|
+
/** The run's working document, created on first ask (its Goal seeded from the run's intent, by crew). */
|
|
94
|
+
ensure(runId) {
|
|
95
|
+
return this.exclusive(runId, async () => {
|
|
96
|
+
if (this.d.store.get(runId) !== undefined)
|
|
97
|
+
return this.view(runId);
|
|
98
|
+
const run = await this.d.run(runId);
|
|
99
|
+
if (run === null)
|
|
100
|
+
return null;
|
|
101
|
+
const docId = workingDocName(runId);
|
|
102
|
+
const html = initialHtml(run.title, { goal: run.problem.replace(/\r\n?/g, '\n').trim().slice(0, 1_500) });
|
|
103
|
+
const { head } = await this.d.backend.create(run.projectId, docId, runId, html);
|
|
104
|
+
const rec = {
|
|
105
|
+
runId, projectId: run.projectId, docId, createdAt: this.now(),
|
|
106
|
+
trail: [{ version: head, parent: null, author: { kind: 'system', id: 'crew' }, surface: null, sections: ['goal'], at: this.now(), steerId: null }],
|
|
107
|
+
steers: [],
|
|
108
|
+
};
|
|
109
|
+
this.d.store.put(rec);
|
|
110
|
+
this.d.changed?.(runId, head);
|
|
111
|
+
return this.view(runId);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* One version from the block. `actor` is the HTTP caller: only a person may write as the operator.
|
|
116
|
+
*/
|
|
117
|
+
propose(runId, input, actor) {
|
|
118
|
+
return this.exclusive(runId, () => this.proposeNow(runId, input, actor));
|
|
119
|
+
}
|
|
120
|
+
async proposeNow(runId, input, actor) {
|
|
121
|
+
const rec = this.d.store.get(runId);
|
|
122
|
+
if (rec === undefined)
|
|
123
|
+
return { ok: false, code: 404, error: 'this job has no working document yet' };
|
|
124
|
+
if (!Number.isInteger(input.base))
|
|
125
|
+
return { ok: false, code: 400, error: 'base must be the version the edit was made on' };
|
|
126
|
+
const plugin = input.plugin;
|
|
127
|
+
if (plugin !== undefined && (!PLUGIN_ID.test(plugin.id) || !PLUGIN_VERSION.test(plugin.version))) {
|
|
128
|
+
return { ok: false, code: 400, error: 'plugin must be {id, version}' };
|
|
129
|
+
}
|
|
130
|
+
let author;
|
|
131
|
+
if (input.author === 'operator') {
|
|
132
|
+
// A person's words are a person's only: a worker, system or plugin caller never writes as the operator.
|
|
133
|
+
if (actor.kind !== 'human')
|
|
134
|
+
return { ok: false, code: 403, error: 'only a person can edit the working document as the operator' };
|
|
135
|
+
author = { kind: 'human', id: actor.id };
|
|
136
|
+
}
|
|
137
|
+
else if (input.author === 'plugin') {
|
|
138
|
+
if (plugin === undefined)
|
|
139
|
+
return { ok: false, code: 400, error: 'a plugin-written version names its plugin' };
|
|
140
|
+
const pluginActor = `plugin:${plugin.id}@${plugin.version}`;
|
|
141
|
+
// A plugin's lines come from the plugin itself (its own actor) or from the person's studio hosting it; a worker or
|
|
142
|
+
// system caller never writes as any plugin.
|
|
143
|
+
if (!(actor.kind === 'human' || (actor.kind === 'plugin' && actor.id === pluginActor))) {
|
|
144
|
+
return { ok: false, code: 403, error: 'only the plugin itself, or the studio hosting it, writes a plugin’s lines' };
|
|
145
|
+
}
|
|
146
|
+
author = { kind: 'plugin', id: pluginActor };
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
return { ok: false, code: 400, error: "author is 'operator' or 'plugin'" };
|
|
150
|
+
}
|
|
151
|
+
const wanted = {};
|
|
152
|
+
for (const [k, v] of Object.entries(input.sections ?? {})) {
|
|
153
|
+
if (!isSectionId(k))
|
|
154
|
+
return { ok: false, code: 400, error: `unknown section ${JSON.stringify(k)}` };
|
|
155
|
+
if (typeof v !== 'string' || v.length > SECTION_MAX_CHARS)
|
|
156
|
+
return { ok: false, code: 400, error: `section ${k} is text of at most ${SECTION_MAX_CHARS} characters` };
|
|
157
|
+
if (author.kind === 'plugin' && !PLUGIN_SECTIONS.has(k)) {
|
|
158
|
+
return { ok: false, code: 403, error: `a plugin writes only its own section (${[...PLUGIN_SECTIONS].join(', ')}), not ${k}` };
|
|
159
|
+
}
|
|
160
|
+
wanted[k] = v.replace(/\r\n?/g, '\n');
|
|
161
|
+
}
|
|
162
|
+
await this.reconcile(runId);
|
|
163
|
+
const head = await this.d.backend.read(rec.projectId, rec.docId);
|
|
164
|
+
if (head === null)
|
|
165
|
+
return { ok: false, code: 404, error: 'the working document is gone' };
|
|
166
|
+
if (head.head !== input.base)
|
|
167
|
+
return { ok: false, code: 409, error: 'the working document changed since', head: head.head };
|
|
168
|
+
if (this.d.store.get(runId)?.pending != null)
|
|
169
|
+
return { ok: false, code: 409, error: 'an earlier edit may still land; read the document again', head: head.head };
|
|
170
|
+
const before = sectionsOf(head.html);
|
|
171
|
+
const changed = changedSections(before, wanted);
|
|
172
|
+
if (changed.length === 0)
|
|
173
|
+
return { ok: true, version: null, unchanged: true, steer: null, view: await this.view(runId) };
|
|
174
|
+
const surface = plugin !== undefined ? `plugin:${plugin.id}@${plugin.version}` : null;
|
|
175
|
+
const values = {};
|
|
176
|
+
for (const id of changed)
|
|
177
|
+
values[id] = wanted[id] ?? '';
|
|
178
|
+
let written;
|
|
179
|
+
try {
|
|
180
|
+
written = await this.d.backend.edit(rec.projectId, rec.docId, {
|
|
181
|
+
expectHead: input.base,
|
|
182
|
+
// interactive's item selector is the bare anchor id (its own `[data-wid=…]` lookup).
|
|
183
|
+
items: changed.map((id) => ({ selector: anchorOf(id), value: encodeSectionText(values[id] ?? '') })),
|
|
184
|
+
// interactive records the batch's author; crew's trail records the full attribution and the surface.
|
|
185
|
+
author: author.kind === 'human' ? `${author.id}${surface !== null ? ` via ${surface}` : ''}` : author.id,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
catch (err) {
|
|
189
|
+
if (err instanceof UndeterminedWriteError) {
|
|
190
|
+
// Not known whether it landed: remembered, so a later read attributes it if it does — never to the next caller —
|
|
191
|
+
// and looked at again on its own shortly, so its steer is not left waiting for someone to read.
|
|
192
|
+
this.d.store.update(runId, (r) => { r.pending = { expectHead: input.base, author, surface, values, at: this.now(), actor: { id: actor.id, kind: actor.kind } }; });
|
|
193
|
+
for (const ms of [30_000, 75_000]) {
|
|
194
|
+
const t = setTimeout(() => { void this.exclusive(runId, () => this.reconcile(runId)).catch(() => undefined); }, ms);
|
|
195
|
+
t.unref?.();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
throw err;
|
|
199
|
+
}
|
|
200
|
+
if ('headMoved' in written)
|
|
201
|
+
return { ok: false, code: 409, error: 'the working document changed since', head: written.head };
|
|
202
|
+
const steer = await this.record(runId, written.version, written.parent, author, surface, changed, values, actor);
|
|
203
|
+
return { ok: true, version: written.version, unchanged: false, steer, view: await this.view(runId) };
|
|
204
|
+
}
|
|
205
|
+
/** A version that landed: its trail entry, its steer (a person's only), its audit line and the change frame. */
|
|
206
|
+
async record(runId, version, parent, author, surface, changed, values, actor) {
|
|
207
|
+
const steer = author.kind === 'human' ? await this.steer(runId, version, changed, values, author.id) : null;
|
|
208
|
+
const entry = { version, parent, author, surface, sections: changed, at: this.now(), steerId: steer?.id ?? null };
|
|
209
|
+
this.d.store.update(runId, (r) => { r.trail.push(entry); });
|
|
210
|
+
this.d.audit?.('run.steered.doc', actor, runId, {
|
|
211
|
+
version, sections: changed, author: author.kind === 'human' ? 'operator' : author.id,
|
|
212
|
+
...(surface !== null ? { surface } : {}),
|
|
213
|
+
...(steer !== null ? { steer: steer.id, kind: steer.kind, steered: steer.sections, sent: steer.error === null } : {}),
|
|
214
|
+
});
|
|
215
|
+
this.d.changed?.(runId, version);
|
|
216
|
+
return steer;
|
|
217
|
+
}
|
|
218
|
+
/** An edit whose outcome was unknown: once the head moved past it, the version is checked against what it wrote and
|
|
219
|
+
* recorded as its author's if (and only if) it is that write. */
|
|
220
|
+
async reconcile(runId) {
|
|
221
|
+
const rec = this.d.store.get(runId);
|
|
222
|
+
const p = rec?.pending;
|
|
223
|
+
if (rec === undefined || p == null)
|
|
224
|
+
return;
|
|
225
|
+
const v = p.expectHead + 1;
|
|
226
|
+
const html = await this.d.backend.readVersion(rec.projectId, rec.docId, v);
|
|
227
|
+
if (html === null) {
|
|
228
|
+
const head = await this.d.backend.read(rec.projectId, rec.docId);
|
|
229
|
+
// Still nothing after it: the batch is gone (interactive refused it). Only a wait of a minute settles that.
|
|
230
|
+
if (head !== null && head.head === p.expectHead && this.now() - p.at > 60_000)
|
|
231
|
+
this.d.store.update(runId, (r) => { r.pending = null; });
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
const got = sectionsOf(html);
|
|
235
|
+
const ids = Object.keys(p.values);
|
|
236
|
+
this.d.store.update(runId, (r) => { r.pending = null; });
|
|
237
|
+
if (ids.every((id) => got[id] === p.values[id]))
|
|
238
|
+
await this.record(runId, v, p.expectHead, p.author, p.surface, ids, p.values, p.actor);
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* A person's version → ONE steering note for the run (§9): Goal, Approach and Next for the next step, and Constraints
|
|
242
|
+
* and steering as a standing constraint (an emptied Constraints is said once, as cleared). The record is stored
|
|
243
|
+
* BEFORE the engine is asked, so a pickup reported at once is never lost.
|
|
244
|
+
*/
|
|
245
|
+
async steer(runId, version, changed, values, by) {
|
|
246
|
+
const steered = changed.filter((id) => SECTION_STEER[id] !== 'record');
|
|
247
|
+
if (steered.length === 0)
|
|
248
|
+
return null;
|
|
249
|
+
const constraints = values.constraints;
|
|
250
|
+
const standing = steered.includes('constraints') && constraints !== undefined && constraints.trim() !== '';
|
|
251
|
+
const who = by === 'local' ? 'the operator' : by;
|
|
252
|
+
const id = randomUUID().slice(0, 8);
|
|
253
|
+
const marker = steerMarker(runId, id);
|
|
254
|
+
const s = {
|
|
255
|
+
id, version, sections: steered, kind: standing ? 'standing' : 'next',
|
|
256
|
+
note: steerNote(version, who, standing, steered.map((x) => ({ id: x, text: values[x] ?? '' })), marker),
|
|
257
|
+
...(standing ? { standingNote: standingNote(version, who, constraints ?? '', marker), supersededBy: null, renewals: 0 } : {}),
|
|
258
|
+
at: this.now(), by, queuedAt: null, pickedUp: null, error: null,
|
|
259
|
+
};
|
|
260
|
+
const run = await this.d.run(runId);
|
|
261
|
+
if (run === null || run.terminal)
|
|
262
|
+
s.error = 'the job has ended, so there is no next step to steer';
|
|
263
|
+
this.d.store.update(runId, (r) => {
|
|
264
|
+
// Any edit of Constraints (a new one, or emptied) replaces the standing one before it.
|
|
265
|
+
if (steered.includes('constraints'))
|
|
266
|
+
for (const old of r.steers)
|
|
267
|
+
if (old.kind === 'standing' && old.supersededBy == null)
|
|
268
|
+
old.supersededBy = id;
|
|
269
|
+
r.steers.push(s);
|
|
270
|
+
});
|
|
271
|
+
if (s.error !== null)
|
|
272
|
+
return s;
|
|
273
|
+
try {
|
|
274
|
+
await this.d.engine.injectWorkerMessage(runId, s.note, 'all');
|
|
275
|
+
this.d.store.update(runId, (r) => { const x = r.steers.find((y) => y.id === id); if (x !== undefined)
|
|
276
|
+
x.queuedAt = this.now(); });
|
|
277
|
+
}
|
|
278
|
+
catch (err) {
|
|
279
|
+
this.d.store.update(runId, (r) => { const x = r.steers.find((y) => y.id === id); if (x !== undefined)
|
|
280
|
+
x.error = err instanceof Error ? err.message : String(err); });
|
|
281
|
+
}
|
|
282
|
+
return this.d.store.get(runId)?.steers.find((y) => y.id === id) ?? s;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* The daemon's CoreEvent tap.
|
|
286
|
+
*
|
|
287
|
+
* - `unitDispatched` / `unitExecuting` (every run, also before its document exists): the dispatch a note injected now
|
|
288
|
+
* is picked up by, as `ord` + `attempt` (a retry of the same unit is another dispatch).
|
|
289
|
+
* - `workerMessageInjected`: the step whose prompt carried a note (recorded at once, its name read after).
|
|
290
|
+
* - A STANDING constraint is kept one copy ahead: when a dispatch picks a copy up, the next copy is queued at once
|
|
291
|
+
* (once per dispatch), so the next dispatch finds it waiting — never raced against `unitDone`. A live worker that
|
|
292
|
+
* takes the copy in the same dispatch leaves none waiting; then the step's `unitDone` queues it. Every copy says it
|
|
293
|
+
* replaces any earlier standing constraint, so a copy already queued when a person replaces it is overruled by the
|
|
294
|
+
* newer one (the engine has no way to withdraw a queued note).
|
|
295
|
+
*/
|
|
296
|
+
onEvent(e) {
|
|
297
|
+
const ev = e;
|
|
298
|
+
const runId = typeof ev['session'] === 'string' ? ev['session'] : null;
|
|
299
|
+
if (runId === null)
|
|
300
|
+
return;
|
|
301
|
+
if ((e.type === 'unitDispatched' || e.type === 'unitExecuting') && typeof ev['ord'] === 'number') {
|
|
302
|
+
const attempt = typeof ev['attempt'] === 'number' ? ev['attempt'] : (this.lastDispatch.get(runId)?.ord === ev['ord'] ? this.lastDispatch.get(runId)?.attempt ?? 0 : 0);
|
|
303
|
+
this.lastDispatch.set(runId, { ord: ev['ord'], attempt });
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
const rec = this.d.store.get(runId);
|
|
307
|
+
if (rec === undefined)
|
|
308
|
+
return;
|
|
309
|
+
if (e.type === 'unitDone' || e.type === 'unitDenied') {
|
|
310
|
+
for (const s of rec.steers) {
|
|
311
|
+
if (s.kind === 'standing' && s.supersededBy == null && s.error === null && s.pickedUp !== null && this.queued.get(s.id) !== true)
|
|
312
|
+
this.renew(runId, s.id, null);
|
|
313
|
+
}
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
if (e.type !== 'workerMessageInjected' || typeof ev['message'] !== 'string')
|
|
317
|
+
return;
|
|
318
|
+
const message = ev['message'];
|
|
319
|
+
const steer = rec.steers.find((s) => message.includes(steerMarker(runId, s.id)));
|
|
320
|
+
if (steer === undefined)
|
|
321
|
+
return;
|
|
322
|
+
const at = this.lastDispatch.get(runId) ?? null;
|
|
323
|
+
const ord = at?.ord ?? null;
|
|
324
|
+
this.queued.set(steer.id, false);
|
|
325
|
+
if (steer.pickedUp === null) {
|
|
326
|
+
this.d.store.update(runId, (r) => { const s = r.steers.find((x) => x.id === steer.id); if (s !== undefined && s.pickedUp === null)
|
|
327
|
+
s.pickedUp = { ord, step: null, at: this.now() }; });
|
|
328
|
+
this.d.changed?.(runId, null);
|
|
329
|
+
// The step's name, once the run's view is read.
|
|
330
|
+
void this.d.run(runId).then((run) => {
|
|
331
|
+
this.d.store.update(runId, (r) => { const s = r.steers.find((x) => x.id === steer.id); if (s?.pickedUp != null && s.pickedUp.step === null && ord !== null)
|
|
332
|
+
s.pickedUp.step = run?.stepOf(ord) ?? null; });
|
|
333
|
+
this.d.changed?.(runId, null);
|
|
334
|
+
}).catch((err) => this.d.log?.(`[working-doc] pickup of ${steer.id} on ${runId}: ${String(err)}`));
|
|
335
|
+
}
|
|
336
|
+
if (steer.kind !== 'standing' || steer.standingNote == null)
|
|
337
|
+
return;
|
|
338
|
+
const dispatch = at === null ? null : `${at.ord}:${at.attempt}`;
|
|
339
|
+
if (this.renewedFor.has(steer.id) && this.renewedFor.get(steer.id) === dispatch)
|
|
340
|
+
return;
|
|
341
|
+
this.renewedFor.set(steer.id, dispatch);
|
|
342
|
+
this.renew(runId, steer.id, dispatch);
|
|
343
|
+
}
|
|
344
|
+
/** Queue one copy of a standing constraint, inside the run's turn, if it is still the one in force. */
|
|
345
|
+
renew(runId, steerId, dispatch) {
|
|
346
|
+
this.queued.set(steerId, true);
|
|
347
|
+
void this.exclusive(runId, async () => {
|
|
348
|
+
const current = this.d.store.get(runId)?.steers.find((x) => x.id === steerId);
|
|
349
|
+
if (current === undefined || current.supersededBy != null || current.error !== null || current.standingNote == null) {
|
|
350
|
+
this.queued.set(steerId, false);
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
const run = await this.d.run(runId);
|
|
354
|
+
if (run === null || run.terminal || this.d.store.get(runId)?.steers.find((x) => x.id === steerId)?.supersededBy != null) {
|
|
355
|
+
this.queued.set(steerId, false);
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
await this.d.engine.injectWorkerMessage(runId, current.standingNote, 'all');
|
|
359
|
+
this.d.store.update(runId, (r) => { const x = r.steers.find((y) => y.id === steerId); if (x !== undefined)
|
|
360
|
+
x.renewals = (x.renewals ?? 0) + 1; });
|
|
361
|
+
this.d.changed?.(runId, null);
|
|
362
|
+
void dispatch;
|
|
363
|
+
}).catch((err) => { this.queued.set(steerId, false); this.d.log?.(`[working-doc] standing steer ${steerId} on ${runId}: ${String(err)}`); });
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/working-doc/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EACL,eAAe,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAE,QAAQ,EAAE,eAAe,EAAE,iBAAiB,EAAE,WAAW,EAAE,WAAW,EACzI,UAAU,GACX,MAAM,eAAe,CAAC;AAkEvB,MAAM,SAAS,GAAG,6BAA6B,CAAC;AAChD,MAAM,cAAc,GAAG,sCAAsC,CAAC;AAE9D,sFAAsF;AACtF,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC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I,IAAI,EAAE,CAAC;gBAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;gBAAC,OAAO;YAAC,CAAC;YACrK,MAAM,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;YAC5E,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,SAAS;gBAAE,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAClJ,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YAC9B,KAAK,QAAQ,CAAC;QAChB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,gCAAgC,OAAO,OAAO,KAAK,KAAK,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACxJ,CAAC;CACF"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The working document's binding and trail (program DES-POWER-MODE §8.3, §9; spike 3).
|
|
3
|
+
*
|
|
4
|
+
* ONE file, `<state home>/daemon-working-docs.json`, under the `daemon-` prefix the state-home fence already
|
|
5
|
+
* classifies (as `daemon-editors.json`). Per run: the wicked-interactive document it is bound to (project + doc
|
|
6
|
+
* name), the trail of versions crew wrote (who, through which surface, which sections, when) and the steering
|
|
7
|
+
* notes made from them (what was sent, when it was queued and which step picked it up).
|
|
8
|
+
*
|
|
9
|
+
* The versions themselves are interactive's (write-once, parent-linked, `author` in each batch). This file holds
|
|
10
|
+
* only what interactive cannot know: the run, the attribution crew decided, and the steering.
|
|
11
|
+
*/
|
|
12
|
+
import type { SectionId, SteerKind } from './sections.js';
|
|
13
|
+
export declare const WORKING_DOCS_FILENAME = "daemon-working-docs.json";
|
|
14
|
+
/** The sidecar crew writes into the document's own directory: it is what makes every seam read the doc as kind
|
|
15
|
+
* `phase-report` (`interactive/chat-events.ts readDocHead`), whatever interactive's manifest says. */
|
|
16
|
+
export declare const WORKING_DOC_SIDECAR = "crew-working-doc.json";
|
|
17
|
+
export declare const WORKING_DOC_KIND = "phase-report";
|
|
18
|
+
/** Who a version is by. A person's edit is `human` (the operator), a plugin's own generated lines `plugin`, the
|
|
19
|
+
* document crew seeds `system`. */
|
|
20
|
+
export type DocAuthor = {
|
|
21
|
+
kind: 'human';
|
|
22
|
+
id: string;
|
|
23
|
+
} | {
|
|
24
|
+
kind: 'plugin';
|
|
25
|
+
id: string;
|
|
26
|
+
} | {
|
|
27
|
+
kind: 'system';
|
|
28
|
+
id: 'crew';
|
|
29
|
+
};
|
|
30
|
+
export interface TrailEntry {
|
|
31
|
+
version: number;
|
|
32
|
+
parent: number | null;
|
|
33
|
+
author: DocAuthor;
|
|
34
|
+
/** The surface the edit was made in (`plugin:wicked-phase-report@0.13.1`), when a plugin hosted it. */
|
|
35
|
+
surface: string | null;
|
|
36
|
+
sections: SectionId[];
|
|
37
|
+
at: number;
|
|
38
|
+
/** The steering note this version made, if any. */
|
|
39
|
+
steerId: string | null;
|
|
40
|
+
}
|
|
41
|
+
export interface SteerRecord {
|
|
42
|
+
id: string;
|
|
43
|
+
version: number;
|
|
44
|
+
sections: SectionId[];
|
|
45
|
+
kind: Exclude<SteerKind, 'record'>;
|
|
46
|
+
/** Exactly what was sent to the run. */
|
|
47
|
+
note: string;
|
|
48
|
+
at: number;
|
|
49
|
+
by: string;
|
|
50
|
+
/** Set once the engine accepted it (queued for the next step, or written into a live worker). */
|
|
51
|
+
queuedAt: number | null;
|
|
52
|
+
/** The step whose prompt carried it (`workerMessageInjected`). */
|
|
53
|
+
pickedUp: {
|
|
54
|
+
ord: number | null;
|
|
55
|
+
step: string | null;
|
|
56
|
+
at: number;
|
|
57
|
+
} | null;
|
|
58
|
+
/** Why it was not sent (the run had ended; the engine refused). */
|
|
59
|
+
error: string | null;
|
|
60
|
+
/** A standing steer: the constraint alone, re-sent before every later step. */
|
|
61
|
+
standingNote?: string;
|
|
62
|
+
/** A standing steer: superseded by a later edit of the same section, it is no longer re-sent. */
|
|
63
|
+
supersededBy?: string | null;
|
|
64
|
+
/** A standing steer: how many later steps it was re-sent to. */
|
|
65
|
+
renewals?: number;
|
|
66
|
+
}
|
|
67
|
+
export interface WorkingDocRecord {
|
|
68
|
+
runId: string;
|
|
69
|
+
projectId: string;
|
|
70
|
+
docId: string;
|
|
71
|
+
createdAt: number;
|
|
72
|
+
trail: TrailEntry[];
|
|
73
|
+
steers: SteerRecord[];
|
|
74
|
+
/** An edit whose outcome was not known (no version in time): attributed once the head shows it, never to another. */
|
|
75
|
+
pending?: {
|
|
76
|
+
expectHead: number;
|
|
77
|
+
author: DocAuthor;
|
|
78
|
+
surface: string | null;
|
|
79
|
+
values: Partial<Record<SectionId, string>>;
|
|
80
|
+
at: number;
|
|
81
|
+
actor: {
|
|
82
|
+
id: string;
|
|
83
|
+
kind: string;
|
|
84
|
+
};
|
|
85
|
+
} | null;
|
|
86
|
+
}
|
|
87
|
+
export declare class WorkingDocStore {
|
|
88
|
+
private readonly path;
|
|
89
|
+
private data;
|
|
90
|
+
constructor(opts?: {
|
|
91
|
+
stateHome?: string;
|
|
92
|
+
log?: (m: string) => void;
|
|
93
|
+
});
|
|
94
|
+
get(runId: string): WorkingDocRecord | undefined;
|
|
95
|
+
all(): WorkingDocRecord[];
|
|
96
|
+
put(rec: WorkingDocRecord): void;
|
|
97
|
+
/** Mutate one run's record and persist. */
|
|
98
|
+
update(runId: string, f: (rec: WorkingDocRecord) => void): WorkingDocRecord | undefined;
|
|
99
|
+
private save;
|
|
100
|
+
}
|
|
101
|
+
/** Mark a doc directory as a run's working document (kind `phase-report`). */
|
|
102
|
+
export declare function writeSidecar(docDir: string, runId: string): void;
|
|
103
|
+
/** Whether a doc directory is a run's working document. */
|
|
104
|
+
export declare function isWorkingDocDir(docDir: string): boolean;
|
|
105
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/working-doc/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1D,eAAO,MAAM,qBAAqB,6BAA6B,CAAC;AAChE;uGACuG;AACvG,eAAO,MAAM,mBAAmB,0BAA0B,CAAC;AAC3D,eAAO,MAAM,gBAAgB,iBAAiB,CAAC;AAE/C;oCACoC;AACpC,MAAM,MAAM,SAAS,GACjB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAC7B;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnC,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,SAAS,CAAC;IAClB,uGAAuG;IACvG,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,SAAS,EAAE,CAAC;IACtB,EAAE,EAA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AM,CAAC,CAAC,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,GAAG,IAAI,CAAC;CACjL;AAID,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,IAAI,CAAY;gBAEZ,IAAI,GAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;KAAO;IAgBxE,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS;IAEhD,GAAG,IAAI,gBAAgB,EAAE;IAEzB,GAAG,CAAC,GAAG,EAAE,gBAAgB,GAAG,IAAI;IAKhC,2CAA2C;IAC3C,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,IAAI,GAAG,gBAAgB,GAAG,SAAS;IAQvF,OAAO,CAAC,IAAI;CAOb;AAED,8EAA8E;AAC9E,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAGhE;AAED,2DAA2D;AAC3D,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEvD"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The working document's binding and trail (program DES-POWER-MODE §8.3, §9; spike 3).
|
|
3
|
+
*
|
|
4
|
+
* ONE file, `<state home>/daemon-working-docs.json`, under the `daemon-` prefix the state-home fence already
|
|
5
|
+
* classifies (as `daemon-editors.json`). Per run: the wicked-interactive document it is bound to (project + doc
|
|
6
|
+
* name), the trail of versions crew wrote (who, through which surface, which sections, when) and the steering
|
|
7
|
+
* notes made from them (what was sent, when it was queued and which step picked it up).
|
|
8
|
+
*
|
|
9
|
+
* The versions themselves are interactive's (write-once, parent-linked, `author` in each batch). This file holds
|
|
10
|
+
* only what interactive cannot know: the run, the attribution crew decided, and the steering.
|
|
11
|
+
*/
|
|
12
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
13
|
+
import { join } from 'node:path';
|
|
14
|
+
import { crewStateHome } from '../projects/state-home.js';
|
|
15
|
+
export const WORKING_DOCS_FILENAME = 'daemon-working-docs.json';
|
|
16
|
+
/** The sidecar crew writes into the document's own directory: it is what makes every seam read the doc as kind
|
|
17
|
+
* `phase-report` (`interactive/chat-events.ts readDocHead`), whatever interactive's manifest says. */
|
|
18
|
+
export const WORKING_DOC_SIDECAR = 'crew-working-doc.json';
|
|
19
|
+
export const WORKING_DOC_KIND = 'phase-report';
|
|
20
|
+
export class WorkingDocStore {
|
|
21
|
+
path;
|
|
22
|
+
data;
|
|
23
|
+
constructor(opts = {}) {
|
|
24
|
+
const home = opts.stateHome ?? crewStateHome();
|
|
25
|
+
this.path = join(home, WORKING_DOCS_FILENAME);
|
|
26
|
+
this.data = { version: 1, runs: {} };
|
|
27
|
+
if (existsSync(this.path)) {
|
|
28
|
+
try {
|
|
29
|
+
const raw = JSON.parse(readFileSync(this.path, 'utf8'));
|
|
30
|
+
if (raw !== null && typeof raw === 'object' && raw.runs !== undefined && typeof raw.runs === 'object') {
|
|
31
|
+
this.data = { version: 1, runs: raw.runs };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
opts.log?.(`[working-doc] ${this.path} is unreadable (${String(err)}); starting empty`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
get(runId) { return this.data.runs[runId]; }
|
|
40
|
+
all() { return Object.values(this.data.runs); }
|
|
41
|
+
put(rec) {
|
|
42
|
+
this.data.runs[rec.runId] = rec;
|
|
43
|
+
this.save();
|
|
44
|
+
}
|
|
45
|
+
/** Mutate one run's record and persist. */
|
|
46
|
+
update(runId, f) {
|
|
47
|
+
const rec = this.data.runs[runId];
|
|
48
|
+
if (rec === undefined)
|
|
49
|
+
return undefined;
|
|
50
|
+
f(rec);
|
|
51
|
+
this.save();
|
|
52
|
+
return rec;
|
|
53
|
+
}
|
|
54
|
+
save() {
|
|
55
|
+
const dir = join(this.path, '..');
|
|
56
|
+
mkdirSync(dir, { recursive: true });
|
|
57
|
+
const tmp = `${this.path}.tmp`;
|
|
58
|
+
writeFileSync(tmp, `${JSON.stringify(this.data, null, 2)}\n`, 'utf8');
|
|
59
|
+
renameSync(tmp, this.path);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/** Mark a doc directory as a run's working document (kind `phase-report`). */
|
|
63
|
+
export function writeSidecar(docDir, runId) {
|
|
64
|
+
mkdirSync(docDir, { recursive: true });
|
|
65
|
+
writeFileSync(join(docDir, WORKING_DOC_SIDECAR), `${JSON.stringify({ kind: WORKING_DOC_KIND, runId }, null, 2)}\n`, 'utf8');
|
|
66
|
+
}
|
|
67
|
+
/** Whether a doc directory is a run's working document. */
|
|
68
|
+
export function isWorkingDocDir(docDir) {
|
|
69
|
+
return existsSync(join(docDir, WORKING_DOC_SIDECAR));
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/working-doc/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACzF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG1D,MAAM,CAAC,MAAM,qBAAqB,GAAG,0BAA0B,CAAC;AAChE;uGACuG;AACvG,MAAM,CAAC,MAAM,mBAAmB,GAAG,uBAA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