wicked-crew 0.5.0 → 0.7.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/dist/api/audit.d.ts +70 -0
- package/dist/api/audit.d.ts.map +1 -0
- package/dist/api/audit.js +131 -0
- package/dist/api/audit.js.map +1 -0
- package/dist/api/auth.d.ts +192 -0
- package/dist/api/auth.d.ts.map +1 -0
- package/dist/api/auth.js +515 -0
- package/dist/api/auth.js.map +1 -0
- package/dist/api/gate-cache.d.ts +8 -0
- package/dist/api/gate-cache.d.ts.map +1 -1
- package/dist/api/gate-cache.js +10 -0
- package/dist/api/gate-cache.js.map +1 -1
- package/dist/api/guidance-index.d.ts +39 -0
- package/dist/api/guidance-index.d.ts.map +1 -0
- package/dist/api/guidance-index.js +67 -0
- package/dist/api/guidance-index.js.map +1 -0
- package/dist/api/open-path.d.ts +34 -0
- package/dist/api/open-path.d.ts.map +1 -0
- package/dist/api/open-path.js +101 -0
- package/dist/api/open-path.js.map +1 -0
- package/dist/api/retry-index.d.ts +30 -0
- package/dist/api/retry-index.d.ts.map +1 -0
- package/dist/api/retry-index.js +45 -0
- package/dist/api/retry-index.js.map +1 -0
- package/dist/api/routes.d.ts +164 -1
- package/dist/api/routes.d.ts.map +1 -1
- package/dist/api/routes.js +769 -21
- package/dist/api/routes.js.map +1 -1
- package/dist/api/run-files.d.ts +63 -0
- package/dist/api/run-files.d.ts.map +1 -0
- package/dist/api/run-files.js +271 -0
- package/dist/api/run-files.js.map +1 -0
- package/dist/api/seat-health.d.ts +55 -0
- package/dist/api/seat-health.d.ts.map +1 -0
- package/dist/api/seat-health.js +273 -0
- package/dist/api/seat-health.js.map +1 -0
- package/dist/api/seat-signin.d.ts +27 -0
- package/dist/api/seat-signin.d.ts.map +1 -0
- package/dist/api/seat-signin.js +143 -0
- package/dist/api/seat-signin.js.map +1 -0
- package/dist/api/server.d.ts +190 -3
- package/dist/api/server.d.ts.map +1 -1
- package/dist/api/server.js +365 -11
- package/dist/api/server.js.map +1 -1
- package/dist/api/stall-watchdog.d.ts +62 -0
- package/dist/api/stall-watchdog.d.ts.map +1 -0
- package/dist/api/stall-watchdog.js +138 -0
- package/dist/api/stall-watchdog.js.map +1 -0
- package/dist/cli/index.js +171 -12
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/mcp.d.ts +14 -0
- package/dist/cli/mcp.d.ts.map +1 -0
- package/dist/cli/mcp.js +119 -0
- package/dist/cli/mcp.js.map +1 -0
- package/dist/core/adapter.d.ts +87 -10
- package/dist/core/adapter.d.ts.map +1 -1
- package/dist/core/adapter.js +347 -28
- package/dist/core/adapter.js.map +1 -1
- package/dist/core/bridge-reaper.d.ts +134 -0
- package/dist/core/bridge-reaper.d.ts.map +1 -0
- package/dist/core/bridge-reaper.js +286 -0
- package/dist/core/bridge-reaper.js.map +1 -0
- package/dist/core/deliver.d.ts +118 -0
- package/dist/core/deliver.d.ts.map +1 -0
- package/dist/core/deliver.js +241 -0
- package/dist/core/deliver.js.map +1 -0
- package/dist/core/deliverable-floor.d.ts +103 -0
- package/dist/core/deliverable-floor.d.ts.map +1 -0
- package/dist/core/deliverable-floor.js +173 -0
- package/dist/core/deliverable-floor.js.map +1 -0
- package/dist/core/exec.d.ts +2 -0
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js.map +1 -1
- package/dist/core/types.d.ts +92 -352
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +14 -4
- package/dist/core/types.js.map +1 -1
- package/dist/interactive/bridge-pool.d.ts +99 -0
- package/dist/interactive/bridge-pool.d.ts.map +1 -0
- package/dist/interactive/bridge-pool.js +244 -0
- package/dist/interactive/bridge-pool.js.map +1 -0
- package/dist/interactive/bridge-root.d.ts +36 -0
- package/dist/interactive/bridge-root.d.ts.map +1 -0
- package/dist/interactive/bridge-root.js +48 -0
- package/dist/interactive/bridge-root.js.map +1 -0
- package/dist/interactive/chat-events.d.ts +207 -0
- package/dist/interactive/chat-events.d.ts.map +1 -0
- package/dist/interactive/chat-events.js +769 -0
- package/dist/interactive/chat-events.js.map +1 -0
- package/dist/interactive/demo-events.d.ts +283 -0
- package/dist/interactive/demo-events.d.ts.map +1 -0
- package/dist/interactive/demo-events.js +889 -0
- package/dist/interactive/demo-events.js.map +1 -0
- package/dist/interactive/draft-events.d.ts +224 -0
- package/dist/interactive/draft-events.d.ts.map +1 -0
- package/dist/interactive/draft-events.js +793 -0
- package/dist/interactive/draft-events.js.map +1 -0
- package/dist/interactive/edit-events.d.ts +194 -0
- package/dist/interactive/edit-events.d.ts.map +1 -0
- package/dist/interactive/edit-events.js +601 -0
- package/dist/interactive/edit-events.js.map +1 -0
- package/dist/interactive/ledger.d.ts +39 -0
- package/dist/interactive/ledger.d.ts.map +1 -0
- package/dist/interactive/ledger.js +93 -0
- package/dist/interactive/ledger.js.map +1 -0
- package/dist/interactive/proxy-routes.d.ts +39 -0
- package/dist/interactive/proxy-routes.d.ts.map +1 -0
- package/dist/interactive/proxy-routes.js +189 -0
- package/dist/interactive/proxy-routes.js.map +1 -0
- package/dist/interactive/repo-snapshot.d.ts +100 -0
- package/dist/interactive/repo-snapshot.d.ts.map +1 -0
- package/dist/interactive/repo-snapshot.js +289 -0
- package/dist/interactive/repo-snapshot.js.map +1 -0
- package/dist/interactive/ws-relay.d.ts +85 -0
- package/dist/interactive/ws-relay.d.ts.map +1 -0
- package/dist/interactive/ws-relay.js +191 -0
- package/dist/interactive/ws-relay.js.map +1 -0
- package/dist/projects/activity.d.ts +29 -0
- package/dist/projects/activity.d.ts.map +1 -0
- package/dist/projects/activity.js +172 -0
- package/dist/projects/activity.js.map +1 -0
- package/dist/projects/charter.d.ts +28 -0
- package/dist/projects/charter.d.ts.map +1 -0
- package/dist/projects/charter.js +53 -0
- package/dist/projects/charter.js.map +1 -0
- package/dist/projects/events.d.ts +55 -0
- package/dist/projects/events.d.ts.map +1 -0
- package/dist/projects/events.js +141 -0
- package/dist/projects/events.js.map +1 -0
- package/dist/projects/graph-paths.d.ts +92 -0
- package/dist/projects/graph-paths.d.ts.map +1 -0
- package/dist/projects/graph-paths.js +130 -0
- package/dist/projects/graph-paths.js.map +1 -0
- package/dist/projects/graph.d.ts +179 -0
- package/dist/projects/graph.d.ts.map +1 -0
- package/dist/projects/graph.js +775 -0
- package/dist/projects/graph.js.map +1 -0
- package/dist/projects/membership-index.d.ts +25 -0
- package/dist/projects/membership-index.d.ts.map +1 -0
- package/dist/projects/membership-index.js +46 -0
- package/dist/projects/membership-index.js.map +1 -0
- package/dist/projects/routes.d.ts +97 -0
- package/dist/projects/routes.d.ts.map +1 -0
- package/dist/projects/routes.js +510 -0
- package/dist/projects/routes.js.map +1 -0
- package/dist/projects/settings.d.ts +32 -0
- package/dist/projects/settings.d.ts.map +1 -0
- package/dist/projects/settings.js +64 -0
- package/dist/projects/settings.js.map +1 -0
- package/dist/qe/acceptance.d.ts +137 -0
- package/dist/qe/acceptance.d.ts.map +1 -0
- package/dist/qe/acceptance.js +249 -0
- package/dist/qe/acceptance.js.map +1 -0
- package/dist/qe/gate-events.d.ts +111 -0
- package/dist/qe/gate-events.d.ts.map +1 -0
- package/dist/qe/gate-events.js +168 -0
- package/dist/qe/gate-events.js.map +1 -0
- package/dist/qe/ledger.d.ts +100 -0
- package/dist/qe/ledger.d.ts.map +1 -0
- package/dist/qe/ledger.js +154 -0
- package/dist/qe/ledger.js.map +1 -0
- package/dist/studio/assets/index-8p8uwCxG.js +530 -0
- package/dist/studio/assets/index-D6S9zUtO.css +32 -0
- package/dist/studio/index.html +5 -3
- package/package.json +10 -4
- package/dist/studio/assets/index-DaaUU8Ep.css +0 -32
- package/dist/studio/assets/index-Fu5DRC00.js +0 -423
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The run→operator-guidance index (DES-UX-002 §7.2, CREW-UX-7).
|
|
3
|
+
*
|
|
4
|
+
* NAMING NOTE: DES-UX-002 §7.2 labels this slice CREW-UX-4, but that id was already spent on an
|
|
5
|
+
* unrelated merged slice (crew#308) — this implementation is CREW-UX-7; the doc's §7.2 spec is
|
|
6
|
+
* what it implements.
|
|
7
|
+
*
|
|
8
|
+
* A durable pre-gate annotation: ONE operator guidance note per run, upserted via
|
|
9
|
+
* `PUT /runs/:id/guidance` and echoed as `AgentSession.guidance` on the run DTOs. The engine's
|
|
10
|
+
* run record carries no such field (wicked-core-ts 0.6.x), so — exactly like retry lineage
|
|
11
|
+
* (CREW-UX-3) and the actor trail (task #88) — the durable record is the audit trail: every
|
|
12
|
+
* write lands as a `guidance.set` entry whose `detail.text` is the full note (empty string =
|
|
13
|
+
* cleared), and this map is the read-side latency layer that lets the run DTOs echo it without
|
|
14
|
+
* a trail scan per request.
|
|
15
|
+
*
|
|
16
|
+
* Mirrors `RetryIndex`'s posture: hydrated once at server start (best-effort — a missing or
|
|
17
|
+
* unreadable trail leaves guidance blank, the pre-CREW-UX-7 behavior, not an error) and updated
|
|
18
|
+
* at the same post-commit point that writes the audit entry, so the map can only lag by a
|
|
19
|
+
* failed hydrate, never diverge silently.
|
|
20
|
+
*/
|
|
21
|
+
export class GuidanceIndex {
|
|
22
|
+
runToGuidance = new Map();
|
|
23
|
+
/**
|
|
24
|
+
* Load guidance from EVERY `guidance.set` entry in the trail — exhaustively, not capped
|
|
25
|
+
* (BRIEF-UX-002 C5, same defect as `RetryIndex.hydrate`: a durable note must not vanish
|
|
26
|
+
* because 1000+ newer writes landed on top of it). The trail answers newest first, so the
|
|
27
|
+
* FIRST entry seen per run is the current note — later (older) entries for the same run
|
|
28
|
+
* are superseded writes and are skipped, which is also what keeps a cleared note (newest
|
|
29
|
+
* entry has `text: ''`) from being resurrected by an older non-empty one. Still best-effort,
|
|
30
|
+
* like `RetryIndex.hydrate`; cost is one full-file scan at boot.
|
|
31
|
+
*/
|
|
32
|
+
async hydrate(audit, log) {
|
|
33
|
+
try {
|
|
34
|
+
const superseded = new Set();
|
|
35
|
+
for (const entry of await audit.readAll({ action: 'guidance.set' })) {
|
|
36
|
+
if (typeof entry.runId !== 'string')
|
|
37
|
+
continue;
|
|
38
|
+
if (superseded.has(entry.runId))
|
|
39
|
+
continue;
|
|
40
|
+
// The NEWEST entry for a run decides — even when its text is malformed. Marking the
|
|
41
|
+
// run seen BEFORE the text check keeps a corrupt newest write from resurrecting an
|
|
42
|
+
// older superseded note (Copilot, #312): unknowable current note = no note.
|
|
43
|
+
superseded.add(entry.runId);
|
|
44
|
+
const text = entry.detail?.['text'];
|
|
45
|
+
if (typeof text !== 'string')
|
|
46
|
+
continue;
|
|
47
|
+
if (text !== '')
|
|
48
|
+
this.runToGuidance.set(entry.runId, text);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
log?.(`[runs] guidance-index hydrate failed (prior runs read as no-guidance until restart): ${err instanceof Error ? err.message : String(err)}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** Upsert the note; the empty string CLEARS it (the DTO field goes back to absent). */
|
|
56
|
+
set(runId, text) {
|
|
57
|
+
if (text === '')
|
|
58
|
+
this.runToGuidance.delete(runId);
|
|
59
|
+
else
|
|
60
|
+
this.runToGuidance.set(runId, text);
|
|
61
|
+
}
|
|
62
|
+
/** The note for this run, or `undefined` (the DTO spells that as an ABSENT field). */
|
|
63
|
+
guidanceFor(runId) {
|
|
64
|
+
return this.runToGuidance.get(runId);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=guidance-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guidance-index.js","sourceRoot":"","sources":["../../src/api/guidance-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,MAAM,OAAO,aAAa;IACP,aAAa,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE3D;;;;;;;;OAQG;IACH,KAAK,CAAC,OAAO,CAAC,KAAe,EAAE,GAA2B;QACxD,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,I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/**
|
|
2
|
+
* Is `target` inside `root` (or `root` itself), after normalization? Traversal-safe: the check is
|
|
3
|
+
* on the RESOLVED relative path's first segment, so `/root/../evil` never passes, and a sibling
|
|
4
|
+
* whose name merely starts with dots (`/a/..hidden`) is not wrongly excluded.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isInsideRoot(root: string, target: string): boolean;
|
|
7
|
+
/** The session fields the root set is derived from — structural on purpose, so this stays a leaf
|
|
8
|
+
* module (routes.ts hands it the wire-shape `SessionView.session`; tests hand it a literal). */
|
|
9
|
+
export interface RootSourceSession {
|
|
10
|
+
workdir?: string | null;
|
|
11
|
+
extra_write_roots?: string[] | null;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The ONE root set a caller-supplied path is contained against (DES-FEEDBACK-002 CREW-1):
|
|
15
|
+
* the run's workdir + its `extra_write_roots` (when a run is in play) + every registered repo
|
|
16
|
+
* root. Extracted from the `POST /open` handler so `/open`, `GET /runs/:id/files`, and
|
|
17
|
+
* `GET /runs/:id/diff` cannot drift — three copies of a containment root set is how one of
|
|
18
|
+
* them quietly widens.
|
|
19
|
+
*/
|
|
20
|
+
export declare function allowedRootsFor(session: RootSourceSession | undefined, repos: ReadonlyArray<{
|
|
21
|
+
root_path: string;
|
|
22
|
+
}>): string[];
|
|
23
|
+
/** The platform's opener invocation. Exported for tests; args are always a real argv array. */
|
|
24
|
+
export declare function platformOpenCommand(target: string): {
|
|
25
|
+
cmd: string;
|
|
26
|
+
args: string[];
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Spawn the platform opener, detached, and resolve on SPAWN success (the OS accepted the process —
|
|
30
|
+
* what the opener then does with the path is the desktop environment's business). Rejects when the
|
|
31
|
+
* opener binary itself cannot be spawned, which the route reports as 502.
|
|
32
|
+
*/
|
|
33
|
+
export declare function openWithSystemDefault(target: string): Promise<void>;
|
|
34
|
+
//# sourceMappingURL=open-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-path.d.ts","sourceRoot":"","sources":["../../src/api/open-path.ts"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CA2BlE;AAED;iGACiG;AACjG,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,iBAAiB,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;CACrC;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,iBAAiB,GAAG,SAAS,EACtC,KAAK,EAAE,aAAa,CAAC;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,GAC1C,MAAM,EAAE,CAWV;AAED,+FAA+F;AAC/F,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAWnF;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAUnE"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// POST /open (crew#273): open a file/folder with the OS default application, daemon-side.
|
|
2
|
+
//
|
|
3
|
+
// The studio is a browser SPA and cannot spawn a process, so the open MUST happen here — which is
|
|
4
|
+
// exactly why the path is validated against known roots first (the run's workdir / extra write
|
|
5
|
+
// roots, registered repo roots) and the opener is spawned with the path as a single argv element,
|
|
6
|
+
// never through a shell string. There is no injection surface: `open`/`xdg-open`/`cmd /c start`
|
|
7
|
+
// receive the path verbatim as one argument.
|
|
8
|
+
import { spawn } from 'node:child_process';
|
|
9
|
+
import { realpathSync } from 'node:fs';
|
|
10
|
+
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
11
|
+
/**
|
|
12
|
+
* Is `target` inside `root` (or `root` itself), after normalization? Traversal-safe: the check is
|
|
13
|
+
* on the RESOLVED relative path's first segment, so `/root/../evil` never passes, and a sibling
|
|
14
|
+
* whose name merely starts with dots (`/a/..hidden`) is not wrongly excluded.
|
|
15
|
+
*/
|
|
16
|
+
export function isInsideRoot(root, target) {
|
|
17
|
+
// Symlink-safe (Copilot, PR#279): containment is judged on REAL paths, or a
|
|
18
|
+
// `<root>/symlink-to-outside` opens a file the validation never looked at. A missing
|
|
19
|
+
// leaf resolves through its deepest EXISTING ancestor (never a bare lexical fallback:
|
|
20
|
+
// on macOS the tmpdir itself sits under the /var → /private/var symlink, and a lexical
|
|
21
|
+
// fallback on one side of the comparison would break containment for real children).
|
|
22
|
+
// Only ENOENT falls to the ancestor walk; any OTHER filesystem error (EACCES, ELOOP, …)
|
|
23
|
+
// fails CLOSED — an unresolvable-but-existing path must not be judged lexically (Copilot).
|
|
24
|
+
const real = (p) => {
|
|
25
|
+
const abs = resolve(p);
|
|
26
|
+
try {
|
|
27
|
+
return realpathSync(abs);
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
if (err.code !== 'ENOENT')
|
|
31
|
+
return null;
|
|
32
|
+
const parent = dirname(abs);
|
|
33
|
+
if (parent === abs)
|
|
34
|
+
return abs;
|
|
35
|
+
const rp = real(parent);
|
|
36
|
+
return rp === null ? null : join(rp, basename(abs));
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const realRoot = real(root);
|
|
40
|
+
const realTarget = real(target);
|
|
41
|
+
if (realRoot === null || realTarget === null)
|
|
42
|
+
return false;
|
|
43
|
+
const rel = relative(realRoot, realTarget);
|
|
44
|
+
if (rel === '')
|
|
45
|
+
return true; // the root itself
|
|
46
|
+
if (isAbsolute(rel))
|
|
47
|
+
return false; // different drive/tree entirely (win32)
|
|
48
|
+
return rel.split(sep)[0] !== '..';
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The ONE root set a caller-supplied path is contained against (DES-FEEDBACK-002 CREW-1):
|
|
52
|
+
* the run's workdir + its `extra_write_roots` (when a run is in play) + every registered repo
|
|
53
|
+
* root. Extracted from the `POST /open` handler so `/open`, `GET /runs/:id/files`, and
|
|
54
|
+
* `GET /runs/:id/diff` cannot drift — three copies of a containment root set is how one of
|
|
55
|
+
* them quietly widens.
|
|
56
|
+
*/
|
|
57
|
+
export function allowedRootsFor(session, repos) {
|
|
58
|
+
const roots = [];
|
|
59
|
+
if (session !== undefined) {
|
|
60
|
+
const workdir = session.workdir;
|
|
61
|
+
if (typeof workdir === 'string' && workdir.length > 0)
|
|
62
|
+
roots.push(workdir);
|
|
63
|
+
for (const r of session.extra_write_roots ?? []) {
|
|
64
|
+
if (typeof r === 'string' && r.length > 0)
|
|
65
|
+
roots.push(r);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
for (const repo of repos)
|
|
69
|
+
roots.push(repo.root_path);
|
|
70
|
+
return roots;
|
|
71
|
+
}
|
|
72
|
+
/** The platform's opener invocation. Exported for tests; args are always a real argv array. */
|
|
73
|
+
export function platformOpenCommand(target) {
|
|
74
|
+
switch (process.platform) {
|
|
75
|
+
case 'darwin':
|
|
76
|
+
return { cmd: 'open', args: [target] };
|
|
77
|
+
case 'win32':
|
|
78
|
+
// `start` is a cmd builtin; the empty string is start's window-title slot so the path is
|
|
79
|
+
// never mistaken for a title. Still an argv array — no shell string is ever composed.
|
|
80
|
+
return { cmd: 'cmd', args: ['/c', 'start', '', target] };
|
|
81
|
+
default:
|
|
82
|
+
return { cmd: 'xdg-open', args: [target] };
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Spawn the platform opener, detached, and resolve on SPAWN success (the OS accepted the process —
|
|
87
|
+
* what the opener then does with the path is the desktop environment's business). Rejects when the
|
|
88
|
+
* opener binary itself cannot be spawned, which the route reports as 502.
|
|
89
|
+
*/
|
|
90
|
+
export function openWithSystemDefault(target) {
|
|
91
|
+
const { cmd, args } = platformOpenCommand(target);
|
|
92
|
+
return new Promise((resolvePromise, rejectPromise) => {
|
|
93
|
+
const child = spawn(cmd, args, { detached: true, stdio: 'ignore' });
|
|
94
|
+
child.once('error', rejectPromise);
|
|
95
|
+
child.once('spawn', () => {
|
|
96
|
+
child.unref();
|
|
97
|
+
resolvePromise();
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=open-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-path.js","sourceRoot":"","sources":["../../src/api/open-path.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,EAAE;AACF,kGAAkG;AAClG,+FAA+F;AAC/F,kGAAkG;AAClG,gGAAgG;AAChG,6CAA6C;AAE7C,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAExF;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,MAAc;IACvD,4EAA4E;IAC5E,qFAAqF;IACrF,sFAAsF;IACtF,uFAAuF;IACvF,qFAAqF;IACrF,wFAAwF;IACxF,2FAA2F;IAC3F,MAAM,IAAI,GAAG,CAAC,CAAS,EAAiB,EAAE;QACxC,MAAM,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACvB,IAAI,CAAC;YACH,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAK,GAA6B,CAAC,IAAI,KAAK,QAAQ;gBAAE,OAAO,IAAI,CAAC;YAClE,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;YAC5B,IAAI,MAAM,KAAK,GAAG;gBAAE,OAAO,GAAG,CAAC;Y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|
+
/**
|
|
2
|
+
* The run→retry-lineage index (DES-UX-001 §8.3, CREW-UX-3).
|
|
3
|
+
*
|
|
4
|
+
* The engine's `LaunchOptions` carries no lineage field (checked, wicked-core-ts 0.6.x), so —
|
|
5
|
+
* exactly like the actor trail (task #88) — WHICH run a launch retries is knowledge only the
|
|
6
|
+
* daemon's HTTP layer ever holds. The durable record is the `run.launched` audit entry whose
|
|
7
|
+
* `detail.retryOf` the launch route writes; this map is the read-side latency layer that lets
|
|
8
|
+
* `GET /runs` / `GET /runs/:id` echo `AgentSession.retry_of` without a trail scan per request.
|
|
9
|
+
*
|
|
10
|
+
* Mirrors `MembershipIndex`'s posture: hydrated once at server start (from the audit trail,
|
|
11
|
+
* best-effort — a missing/unreadable trail leaves lineage blank for PRIOR runs, which is the
|
|
12
|
+
* pre-CREW-UX-3 behavior, not an error) and updated at the same post-commit point that writes
|
|
13
|
+
* the audit entry, so the map can only lag by a failed hydrate, never diverge silently.
|
|
14
|
+
*/
|
|
15
|
+
import type { AuditLog } from './audit.js';
|
|
16
|
+
export declare class RetryIndex {
|
|
17
|
+
private readonly runToRetryOf;
|
|
18
|
+
/**
|
|
19
|
+
* Load lineage from EVERY `run.launched` entry in the trail — exhaustively, not capped
|
|
20
|
+
* (BRIEF-UX-002 C5: a lineage fact 2,678 launches deep must survive a restart; the newest-1000
|
|
21
|
+
* cap silently dropped it and the chronicle rendered the chain as peer episodes). Still
|
|
22
|
+
* best-effort: a missing/unreadable trail leaves lineage blank, the pre-CREW-UX-3 answer.
|
|
23
|
+
* Cost: one full-file scan at boot — `read` already parses the whole file anyway.
|
|
24
|
+
*/
|
|
25
|
+
hydrate(audit: AuditLog, log?: (msg: string) => void): Promise<void>;
|
|
26
|
+
set(runId: string, retryOf: string): void;
|
|
27
|
+
/** The run id this run retries, or `undefined` (the DTO spells that as an ABSENT field). */
|
|
28
|
+
retryOfFor(runId: string): string | undefined;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=retry-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry-index.d.ts","sourceRoot":"","sources":["../../src/api/retry-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA6B;IAE1D;;;;;;OAMG;IACG,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB1E,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAIzC,4FAA4F;IAC5F,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CAG9C"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The run→retry-lineage index (DES-UX-001 §8.3, CREW-UX-3).
|
|
3
|
+
*
|
|
4
|
+
* The engine's `LaunchOptions` carries no lineage field (checked, wicked-core-ts 0.6.x), so —
|
|
5
|
+
* exactly like the actor trail (task #88) — WHICH run a launch retries is knowledge only the
|
|
6
|
+
* daemon's HTTP layer ever holds. The durable record is the `run.launched` audit entry whose
|
|
7
|
+
* `detail.retryOf` the launch route writes; this map is the read-side latency layer that lets
|
|
8
|
+
* `GET /runs` / `GET /runs/:id` echo `AgentSession.retry_of` without a trail scan per request.
|
|
9
|
+
*
|
|
10
|
+
* Mirrors `MembershipIndex`'s posture: hydrated once at server start (from the audit trail,
|
|
11
|
+
* best-effort — a missing/unreadable trail leaves lineage blank for PRIOR runs, which is the
|
|
12
|
+
* pre-CREW-UX-3 behavior, not an error) and updated at the same post-commit point that writes
|
|
13
|
+
* the audit entry, so the map can only lag by a failed hydrate, never diverge silently.
|
|
14
|
+
*/
|
|
15
|
+
export class RetryIndex {
|
|
16
|
+
runToRetryOf = new Map();
|
|
17
|
+
/**
|
|
18
|
+
* Load lineage from EVERY `run.launched` entry in the trail — exhaustively, not capped
|
|
19
|
+
* (BRIEF-UX-002 C5: a lineage fact 2,678 launches deep must survive a restart; the newest-1000
|
|
20
|
+
* cap silently dropped it and the chronicle rendered the chain as peer episodes). Still
|
|
21
|
+
* best-effort: a missing/unreadable trail leaves lineage blank, the pre-CREW-UX-3 answer.
|
|
22
|
+
* Cost: one full-file scan at boot — `read` already parses the whole file anyway.
|
|
23
|
+
*/
|
|
24
|
+
async hydrate(audit, log) {
|
|
25
|
+
try {
|
|
26
|
+
for (const entry of await audit.readAll({ action: 'run.launched' })) {
|
|
27
|
+
const retryOf = entry.detail?.['retryOf'];
|
|
28
|
+
if (typeof entry.runId === 'string' && typeof retryOf === 'string') {
|
|
29
|
+
this.runToRetryOf.set(entry.runId, retryOf);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
log?.(`[runs] retry-index hydrate failed (prior runs read as not-a-retry until restart): ${err instanceof Error ? err.message : String(err)}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
set(runId, retryOf) {
|
|
38
|
+
this.runToRetryOf.set(runId, retryOf);
|
|
39
|
+
}
|
|
40
|
+
/** The run id this run retries, or `undefined` (the DTO spells that as an ABSENT field). */
|
|
41
|
+
retryOfFor(runId) {
|
|
42
|
+
return this.runToRetryOf.get(runId);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=retry-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry-index.js","sourceRoot":"","sources":["../../src/api/retry-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,MAAM,OAAO,UAAU;IACJ,YAAY,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE1D;;;;;;OAMG;IACH,KAAK,CAAC,OAAO,CAAC,KAAe,EAAE,GAA2B;QACxD,IAAI,CAAC;YACH,KAAK,MAAM,KAAK,IAAI,MAAM,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,EAAE,CAAC;gBACpE,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC;gBAC1C,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;oBACnE,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;gBAC9C,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,GAAG,EAAE,CACH,qFACE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CACjD,EAAE,CACH,CAAC;QACJ,CAAC;IACH,CAAC;IAED,GAAG,CAAC,KAAa,EAAE,OAAe;QAChC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;IAED,4FAA4F;IAC5F,UAAU,CAAC,KAAa;QACtB,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;CACF"}
|
package/dist/api/routes.d.ts
CHANGED
|
@@ -1,11 +1,174 @@
|
|
|
1
1
|
import type { FastifyInstance } from 'fastify';
|
|
2
|
+
import { z } from 'zod';
|
|
2
3
|
import { CoreAdapter } from '../core/adapter.js';
|
|
3
4
|
import type { GateCache } from './gate-cache.js';
|
|
4
5
|
import type { ElicitationCache } from './elicitation-cache.js';
|
|
6
|
+
import { QeGateCache } from '../qe/gate-events.js';
|
|
7
|
+
import { SeatHealthTracker } from './seat-health.js';
|
|
8
|
+
import { type ProjectRoutesDeps } from '../projects/routes.js';
|
|
9
|
+
import { InteractiveBridgePool } from '../interactive/bridge-pool.js';
|
|
10
|
+
import { AuditLog } from './audit.js';
|
|
11
|
+
import { RetryIndex } from './retry-index.js';
|
|
12
|
+
import { GuidanceIndex } from './guidance-index.js';
|
|
13
|
+
import { type AuthMode } from './auth.js';
|
|
5
14
|
export { API_PREFIX } from './api-prefix.js';
|
|
15
|
+
/**
|
|
16
|
+
* The launch body. Every field but `problem` is optional, which is what made stripping dangerous:
|
|
17
|
+
* omitting one is a legitimate request that gets an engine default, so a MISSPELLED one was
|
|
18
|
+
* indistinguishable from an omitted one and the run went ahead on a configuration the caller never
|
|
19
|
+
* asked for (FINDING-031).
|
|
20
|
+
*
|
|
21
|
+
* The names differ from core's on purpose and this is the trap worth knowing about: core's
|
|
22
|
+
* `LaunchSpec` takes `clis` (an array) and `workflow`, this takes `clisJson` (a JSON *string*) and
|
|
23
|
+
* `workflow`, and the `/ws` `sessionStarted` frame reports the chosen workflow as `workflowId`. A
|
|
24
|
+
* caller who reads the event stream to learn the field names arrives at `workflowId`, which this
|
|
25
|
+
* schema does not accept — so `.strict()` is what turns that trip into a 400 instead of an
|
|
26
|
+
* unworkflowed run reported as `201`.
|
|
27
|
+
*/
|
|
28
|
+
export declare const LaunchSchema: z.ZodEffects<z.ZodObject<{
|
|
29
|
+
problem: z.ZodString;
|
|
30
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
31
|
+
clisJson: z.ZodOptional<z.ZodString>;
|
|
32
|
+
entityMode: z.ZodOptional<z.ZodEnum<["shared", "isolated"]>>;
|
|
33
|
+
humanConfirm: z.ZodOptional<z.ZodString>;
|
|
34
|
+
repoRef: z.ZodOptional<z.ZodString>;
|
|
35
|
+
workflow: z.ZodOptional<z.ZodString>;
|
|
36
|
+
/** DES-PROJECT-001 §2.2 — file the run into a project; membership attaches atomically with
|
|
37
|
+
* the launch record. Unknown/archived ⇒ the launch fails (never a silent unfiled run). */
|
|
38
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
39
|
+
/** crew#293 — `"pr"` appends the hardened deliver Tool phase (push run branch + `gh pr create`)
|
|
40
|
+
* to a PER-RUN copy of the selected workflow. Requires `workflow` (enforced by the refine
|
|
41
|
+
* below, so the 400 happens at parse time, not after the adapter is consulted). */
|
|
42
|
+
deliver: z.ZodOptional<z.ZodLiteral<"pr">>;
|
|
43
|
+
/** DES-UX-001 §8.3 (CREW-UX-3) — the run this launch retries. Must name an EXISTING run id
|
|
44
|
+
* (the route checks the store and 400s with a named error otherwise); persisted via the
|
|
45
|
+
* `run.launched` audit entry + retry index and echoed as `AgentSession.retry_of`. */
|
|
46
|
+
retryOf: z.ZodOptional<z.ZodString>;
|
|
47
|
+
}, "strict", z.ZodTypeAny, {
|
|
48
|
+
problem: string;
|
|
49
|
+
retryOf?: string | undefined;
|
|
50
|
+
deliver?: "pr" | undefined;
|
|
51
|
+
projectId?: string | undefined;
|
|
52
|
+
sessionId?: string | undefined;
|
|
53
|
+
clisJson?: string | undefined;
|
|
54
|
+
entityMode?: "shared" | "isolated" | undefined;
|
|
55
|
+
humanConfirm?: string | undefined;
|
|
56
|
+
repoRef?: string | undefined;
|
|
57
|
+
workflow?: string | undefined;
|
|
58
|
+
}, {
|
|
59
|
+
problem: string;
|
|
60
|
+
retryOf?: string | undefined;
|
|
61
|
+
deliver?: "pr" | undefined;
|
|
62
|
+
projectId?: string | undefined;
|
|
63
|
+
sessionId?: string | undefined;
|
|
64
|
+
clisJson?: string | undefined;
|
|
65
|
+
entityMode?: "shared" | "isolated" | undefined;
|
|
66
|
+
humanConfirm?: string | undefined;
|
|
67
|
+
repoRef?: string | undefined;
|
|
68
|
+
workflow?: string | undefined;
|
|
69
|
+
}>, {
|
|
70
|
+
problem: string;
|
|
71
|
+
retryOf?: string | undefined;
|
|
72
|
+
deliver?: "pr" | undefined;
|
|
73
|
+
projectId?: string | undefined;
|
|
74
|
+
sessionId?: string | undefined;
|
|
75
|
+
clisJson?: string | undefined;
|
|
76
|
+
entityMode?: "shared" | "isolated" | undefined;
|
|
77
|
+
humanConfirm?: string | undefined;
|
|
78
|
+
repoRef?: string | undefined;
|
|
79
|
+
workflow?: string | undefined;
|
|
80
|
+
}, {
|
|
81
|
+
problem: string;
|
|
82
|
+
retryOf?: string | undefined;
|
|
83
|
+
deliver?: "pr" | undefined;
|
|
84
|
+
projectId?: string | undefined;
|
|
85
|
+
sessionId?: string | undefined;
|
|
86
|
+
clisJson?: string | undefined;
|
|
87
|
+
entityMode?: "shared" | "isolated" | undefined;
|
|
88
|
+
humanConfirm?: string | undefined;
|
|
89
|
+
repoRef?: string | undefined;
|
|
90
|
+
workflow?: string | undefined;
|
|
91
|
+
}>;
|
|
92
|
+
export declare const GateSchema: z.ZodObject<{
|
|
93
|
+
approve: z.ZodBoolean;
|
|
94
|
+
amend: z.ZodOptional<z.ZodString>;
|
|
95
|
+
}, "strict", z.ZodTypeAny, {
|
|
96
|
+
approve: boolean;
|
|
97
|
+
amend?: string | undefined;
|
|
98
|
+
}, {
|
|
99
|
+
approve: boolean;
|
|
100
|
+
amend?: string | undefined;
|
|
101
|
+
}>;
|
|
102
|
+
/** `PUT /runs/:id/guidance` (DES-UX-002 §7.2, CREW-UX-7) — the durable pre-gate note body.
|
|
103
|
+
* The empty string is a legal body: it CLEARS the note. The byte cap is checked in the route
|
|
104
|
+
* (not zod's char-counting `max`) so the 400 names the actual limit. */
|
|
105
|
+
export declare const GuidanceSchema: z.ZodObject<{
|
|
106
|
+
text: z.ZodString;
|
|
107
|
+
}, "strict", z.ZodTypeAny, {
|
|
108
|
+
text: string;
|
|
109
|
+
}, {
|
|
110
|
+
text: string;
|
|
111
|
+
}>;
|
|
112
|
+
export declare const OpenTerminalSchema: z.ZodObject<{
|
|
113
|
+
cwd: z.ZodString;
|
|
114
|
+
cmd: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
115
|
+
cols: z.ZodNumber;
|
|
116
|
+
rows: z.ZodNumber;
|
|
117
|
+
governed: z.ZodOptional<z.ZodBoolean>;
|
|
118
|
+
}, "strict", z.ZodTypeAny, {
|
|
119
|
+
cwd: string;
|
|
120
|
+
cols: number;
|
|
121
|
+
rows: number;
|
|
122
|
+
cmd?: string[] | undefined;
|
|
123
|
+
governed?: boolean | undefined;
|
|
124
|
+
}, {
|
|
125
|
+
cwd: string;
|
|
126
|
+
cols: number;
|
|
127
|
+
rows: number;
|
|
128
|
+
cmd?: string[] | undefined;
|
|
129
|
+
governed?: boolean | undefined;
|
|
130
|
+
}>;
|
|
131
|
+
/** `POST /open` (crew#273) — the studio Files tab's "open with the OS default app" body. */
|
|
132
|
+
export declare const OpenPathSchema: z.ZodObject<{
|
|
133
|
+
path: z.ZodString;
|
|
134
|
+
runId: z.ZodOptional<z.ZodString>;
|
|
135
|
+
}, "strict", z.ZodTypeAny, {
|
|
136
|
+
path: string;
|
|
137
|
+
runId?: string | undefined;
|
|
138
|
+
}, {
|
|
139
|
+
path: string;
|
|
140
|
+
runId?: string | undefined;
|
|
141
|
+
}>;
|
|
142
|
+
/** The actor/audit deps (task #88) — threaded from `createServer`. */
|
|
143
|
+
export interface SecurityDeps {
|
|
144
|
+
audit: AuditLog;
|
|
145
|
+
authMode: AuthMode;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Daemon-runtime deps the routes read but `createServer` owns: the seat-health fold (crew#274,
|
|
149
|
+
* fed by the daemon's single CoreEvent subscription) and the OS opener for `/open` (crew#273,
|
|
150
|
+
* injectable so tests never actually open anything).
|
|
151
|
+
*/
|
|
152
|
+
export interface RuntimeDeps {
|
|
153
|
+
seatHealth?: SeatHealthTracker;
|
|
154
|
+
/** Run→retry-lineage index (CREW-UX-3) — `createServer` hydrates one from the audit trail so
|
|
155
|
+
* a restarted daemon still echoes `retry_of`; a directly-driven route set gets a fresh one. */
|
|
156
|
+
retryIndex?: RetryIndex;
|
|
157
|
+
/** Run→operator-guidance index (CREW-UX-7) — `createServer` hydrates one from the audit trail
|
|
158
|
+
* so a restarted daemon still echoes `guidance`; a directly-driven route set gets a fresh one. */
|
|
159
|
+
guidanceIndex?: GuidanceIndex;
|
|
160
|
+
openWithOs?: (target: string) => Promise<void>;
|
|
161
|
+
/** Seat sign-in presence probe (seat sign-in) — injectable so route tests never read the
|
|
162
|
+
* developer's real dotfiles. Defaults to the file/env heuristic in seat-signin.ts. */
|
|
163
|
+
signedIn?: (seatKey: string, workerConfigRoot?: string) => boolean | null;
|
|
164
|
+
/** The wicked-interactive bridge pool behind `/projects/:id/interactive/*` (DES-MERGE-001
|
|
165
|
+
* slice 1). Injectable so the integration suite proxies to a FAKE bridge instead of
|
|
166
|
+
* spawning a real `npx wicked-interactive serve`. */
|
|
167
|
+
interactiveBridges?: InteractiveBridgePool;
|
|
168
|
+
}
|
|
6
169
|
/**
|
|
7
170
|
* The daemon REST surface. Every endpoint is a thin wrapper over one adapter /
|
|
8
171
|
* core-ts call (DES-STUDIO-001 §2). `session`/`phase` nouns are now `run`/`unit`.
|
|
9
172
|
*/
|
|
10
|
-
export declare function registerRoutes(app: FastifyInstance, adapter: CoreAdapter, gateCache: GateCache, elicitationCache: ElicitationCache): void;
|
|
173
|
+
export declare function registerRoutes(app: FastifyInstance, adapter: CoreAdapter, gateCache: GateCache, elicitationCache: ElicitationCache, qeGateEvents?: QeGateCache, projects?: ProjectRoutesDeps, security?: SecurityDeps, runtime?: RuntimeDeps): void;
|
|
11
174
|
//# sourceMappingURL=routes.d.ts.map
|
package/dist/api/routes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/api/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/api/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,OAAO,EAAwB,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