wicked-crew 0.7.31 → 0.7.33
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/README.md +2 -1
- package/dist/api/chat-turns.d.ts +87 -0
- package/dist/api/chat-turns.d.ts.map +1 -0
- package/dist/api/chat-turns.js +147 -0
- package/dist/api/chat-turns.js.map +1 -0
- package/dist/api/roster-standing.d.ts +42 -0
- package/dist/api/roster-standing.d.ts.map +1 -0
- package/dist/api/roster-standing.js +54 -0
- package/dist/api/roster-standing.js.map +1 -0
- package/dist/api/routes.d.ts +54 -3
- package/dist/api/routes.d.ts.map +1 -1
- package/dist/api/routes.js +58 -38
- package/dist/api/routes.js.map +1 -1
- package/dist/api/server.d.ts.map +1 -1
- package/dist/api/server.js +45 -1
- package/dist/api/server.js.map +1 -1
- package/dist/api/testing.d.ts +4 -4
- package/dist/cli/index.js +6 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/core/adapter.d.ts +24 -0
- package/dist/core/adapter.d.ts.map +1 -1
- package/dist/core/adapter.js +40 -2
- package/dist/core/adapter.js.map +1 -1
- package/dist/core/types.d.ts +9 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/interactive/bridge-pool.d.ts +2 -2
- package/dist/interactive/bridge-pool.d.ts.map +1 -1
- package/dist/interactive/bridge-pool.js +19 -4
- package/dist/interactive/bridge-pool.js.map +1 -1
- package/dist/interactive/bus-subscriber-errors.d.ts +61 -0
- package/dist/interactive/bus-subscriber-errors.d.ts.map +1 -0
- package/dist/interactive/bus-subscriber-errors.js +85 -0
- package/dist/interactive/bus-subscriber-errors.js.map +1 -0
- package/dist/interactive/chat-events.d.ts +16 -0
- package/dist/interactive/chat-events.d.ts.map +1 -1
- package/dist/interactive/chat-events.js +59 -10
- package/dist/interactive/chat-events.js.map +1 -1
- package/dist/interactive/demo-events.d.ts +66 -0
- package/dist/interactive/demo-events.d.ts.map +1 -1
- package/dist/interactive/demo-events.js +154 -10
- package/dist/interactive/demo-events.js.map +1 -1
- package/dist/interactive/doc-delete-routes.js +2 -2
- package/dist/interactive/doc-delete-routes.js.map +1 -1
- package/dist/interactive/draft-events.d.ts +13 -0
- package/dist/interactive/draft-events.d.ts.map +1 -1
- package/dist/interactive/draft-events.js +34 -9
- package/dist/interactive/draft-events.js.map +1 -1
- package/dist/interactive/draft-skill.d.ts +68 -0
- package/dist/interactive/draft-skill.d.ts.map +1 -0
- package/dist/interactive/draft-skill.js +127 -0
- package/dist/interactive/draft-skill.js.map +1 -0
- package/dist/interactive/edit-events.d.ts +13 -0
- package/dist/interactive/edit-events.d.ts.map +1 -1
- package/dist/interactive/edit-events.js +35 -9
- package/dist/interactive/edit-events.js.map +1 -1
- package/dist/interactive/proxy-routes.d.ts +36 -0
- package/dist/interactive/proxy-routes.d.ts.map +1 -1
- package/dist/interactive/proxy-routes.js +90 -3
- package/dist/interactive/proxy-routes.js.map +1 -1
- package/dist/interactive/ws-relay.d.ts +2 -0
- package/dist/interactive/ws-relay.d.ts.map +1 -1
- package/dist/interactive/ws-relay.js +7 -3
- package/dist/interactive/ws-relay.js.map +1 -1
- package/dist/projects/activity.d.ts +17 -3
- package/dist/projects/activity.d.ts.map +1 -1
- package/dist/projects/activity.js +34 -13
- package/dist/projects/activity.js.map +1 -1
- package/dist/projects/events.d.ts +2 -0
- package/dist/projects/events.d.ts.map +1 -1
- package/dist/projects/events.js +7 -3
- package/dist/projects/events.js.map +1 -1
- package/dist/qe/acceptance.d.ts +72 -3
- package/dist/qe/acceptance.d.ts.map +1 -1
- package/dist/qe/acceptance.js +137 -17
- package/dist/qe/acceptance.js.map +1 -1
- package/dist/qe/gate-events.d.ts +2 -0
- package/dist/qe/gate-events.d.ts.map +1 -1
- package/dist/qe/gate-events.js +7 -3
- package/dist/qe/gate-events.js.map +1 -1
- package/dist/qe/ledger.d.ts +128 -28
- package/dist/qe/ledger.d.ts.map +1 -1
- package/dist/qe/ledger.js +272 -42
- package/dist/qe/ledger.js.map +1 -1
- package/dist/skills/runtime.d.ts +7 -0
- package/dist/skills/runtime.d.ts.map +1 -1
- package/dist/skills/runtime.js +17 -0
- package/dist/skills/runtime.js.map +1 -1
- package/dist/studio/assets/{index-Clm0MXDF.js → index-DhojBZ1T.js} +91 -91
- package/dist/studio/index.html +1 -1
- package/dist/studio/testid-inventory.json +51 -3
- package/endpoint-manifest.json +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -39,7 +39,8 @@ engine cannot store dead-letter to
|
|
|
39
39
|
`WICKED_APPS_EMIT_DEADLETTER` is honoured), are counted on
|
|
40
40
|
`GET /api/v1/diagnostics` → `governance` (a `governance.deadletter` finding), and are drained back
|
|
41
41
|
with `wicked-crew governance replay <outbox>`. The interactive document bridge is spawned on demand
|
|
42
|
-
as `npx wicked-interactive@^0.9.
|
|
42
|
+
as `npx wicked-interactive@^0.9.2` (0.9.2: recorder browser preflight + provisioning, typed `RecorderError`
|
|
43
|
+
frames); `WICKED_INTERACTIVE_SPEC` overrides the range (semver range
|
|
43
44
|
only, validated; invalid values are named on the boot line and ignored, a floor below crew's need
|
|
44
45
|
is warned about).
|
|
45
46
|
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-chat TURN tracking for `POST /chats/:id/messages` (F-RECON-017).
|
|
3
|
+
*
|
|
4
|
+
* The engine queues a message sent to a seat that is still answering the previous one — silently:
|
|
5
|
+
* `chatSend` answers the seats it accepted, the worker receives the text the instant the previous
|
|
6
|
+
* turn's final block lands, and the reply frames (`chatDelta` / `chatReply`) carry chat + seat but
|
|
7
|
+
* NO message correlation. The recon saw exactly that: Q3 sent 58 s into Q2's turn got a 202, and
|
|
8
|
+
* Q2's reply then rendered under Q3's bubble. Neither the daemon nor the skin could tell.
|
|
9
|
+
*
|
|
10
|
+
* This index is the daemon's own record of which seats are mid-turn in which chat:
|
|
11
|
+
*
|
|
12
|
+
* - `begin` opens a turn for the seats a send actually reached (the engine's answer) and mints a
|
|
13
|
+
* `turnId` the 202 returns;
|
|
14
|
+
* - `inFlight` is the refusal predicate the route consults FIRST: a send that targets a seat still
|
|
15
|
+
* mid-turn is refused (409 `turn_in_flight`, naming the turn and the busy seats) — targeting
|
|
16
|
+
* only idle seats passes, so a stalled seat (opencode 0 bytes for 300 s) never blocks a
|
|
17
|
+
* follow-up to the one that answered;
|
|
18
|
+
* - `observe` folds the engine's frames: a seat's `chatReply` (ok or not) or `chatSessionFailed`
|
|
19
|
+
* ends its part of the turn, `chatClosed` drops the chat's turns;
|
|
20
|
+
* - `decorate` stamps `turn_id` onto the chat frames of a seat mid-turn, so a skin can file a
|
|
21
|
+
* delta/reply under the message it answers instead of the newest bubble.
|
|
22
|
+
*
|
|
23
|
+
* A turn whose frames were lost (an engine restart, a seat reaped without a frame) must never wedge
|
|
24
|
+
* the chat: a turn older than `staleAfterMs` (default 15 min — three engine turn budgets) is treated
|
|
25
|
+
* as ended by every read, and reported in the 409's `stale` reason when it is what let a send pass.
|
|
26
|
+
*/
|
|
27
|
+
import type { CoreEvent } from '../core/types.js';
|
|
28
|
+
/** One live turn: the message a set of seats is answering. */
|
|
29
|
+
export interface ChatTurn {
|
|
30
|
+
turnId: string;
|
|
31
|
+
chatId: string;
|
|
32
|
+
/** Every seat the send reached (the engine's `chatSend` answer). */
|
|
33
|
+
seats: string[];
|
|
34
|
+
/** The seats that have not ended their part yet. */
|
|
35
|
+
pending: string[];
|
|
36
|
+
/** Epoch ms of the accepted send. */
|
|
37
|
+
startedAt: number;
|
|
38
|
+
/** A bounded excerpt of the message, for the 409 body and diagnostics. */
|
|
39
|
+
excerpt: string;
|
|
40
|
+
}
|
|
41
|
+
/** What a refused send is told (the 409 body's `turn`). */
|
|
42
|
+
export interface ChatTurnInFlight {
|
|
43
|
+
turnId: string;
|
|
44
|
+
chatId: string;
|
|
45
|
+
seats: string[];
|
|
46
|
+
/** The targeted seats still answering — the reason for the refusal. */
|
|
47
|
+
busy: string[];
|
|
48
|
+
startedAt: number;
|
|
49
|
+
ageMs: number;
|
|
50
|
+
excerpt: string;
|
|
51
|
+
}
|
|
52
|
+
export declare const CHAT_TURN_EXCERPT_CHARS = 120;
|
|
53
|
+
/** Three engine turn budgets (300 s each): a turn this old with no closing frame is lost, not live. */
|
|
54
|
+
export declare const CHAT_TURN_STALE_AFTER_MS: number;
|
|
55
|
+
export declare class ChatTurnIndex {
|
|
56
|
+
/** chatId → live turns (a seat is in at most one — `inFlight` refuses the second). */
|
|
57
|
+
private readonly turns;
|
|
58
|
+
private readonly now;
|
|
59
|
+
private readonly staleAfterMs;
|
|
60
|
+
constructor(opts?: {
|
|
61
|
+
now?: () => number;
|
|
62
|
+
staleAfterMs?: number;
|
|
63
|
+
});
|
|
64
|
+
/** Drop turns whose frames were lost (see the module doc); returns the survivors. */
|
|
65
|
+
private live;
|
|
66
|
+
/**
|
|
67
|
+
* The turn that makes a send to `targets` (every seat of the chat when omitted) refusable: one
|
|
68
|
+
* whose pending seats intersect the targets. `null` when every targeted seat is idle.
|
|
69
|
+
*/
|
|
70
|
+
inFlight(chatId: string, targets?: readonly string[]): ChatTurnInFlight | null;
|
|
71
|
+
/** Open a turn for the seats a send reached. An empty seat list opens nothing (nothing to wait for). */
|
|
72
|
+
begin(chatId: string, seats: readonly string[], text: string): ChatTurn | null;
|
|
73
|
+
/** The live turn a seat of a chat is answering, if any. */
|
|
74
|
+
turnOf(chatId: string, cliKey: string): ChatTurn | undefined;
|
|
75
|
+
/** Every live turn of a chat (diagnostics / tests). */
|
|
76
|
+
turnsOf(chatId: string): ChatTurn[];
|
|
77
|
+
/** Fold one engine frame. Safe on every event type; non-chat frames are ignored. */
|
|
78
|
+
observe(event: CoreEvent): void;
|
|
79
|
+
/**
|
|
80
|
+
* The frame with `turn_id` stamped when it is a seat's progress on a live turn; the frame itself
|
|
81
|
+
* otherwise. Call BEFORE `observe` — the closing `chatReply` is the one most worth correlating.
|
|
82
|
+
*/
|
|
83
|
+
decorate(event: CoreEvent): CoreEvent;
|
|
84
|
+
/** The chat is gone (a `DELETE` or an engine reclaim) — nothing left to wait for. */
|
|
85
|
+
closed(chatId: string): void;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=chat-turns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-turns.d.ts","sourceRoot":"","sources":["../../src/api/chat-turns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,8DAA8D;AAC9D,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,oDAAoD;IACpD,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,0EAA0E;IAC1E,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,2DAA2D;AAC3D,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,uEAAuE;IACvE,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAC3C,uGAAuG;AACvG,eAAO,MAAM,wBAAwB,QAAc,CAAC;AAYpD,qBAAa,aAAa;IACxB,sFAAsF;IACtF,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiC;IACvD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IACnC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;gBAE1B,IAAI,GAAE;QAAE,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAO;IAKpE,qFAAqF;IACrF,OAAO,CAAC,IAAI;IAUZ;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,gBAAgB,GAAG,IAAI;IAiB9E,wGAAwG;IACxG,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI;IAiB9E,2DAA2D;IAC3D,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS;IAI5D,uDAAuD;IACvD,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,EAAE;IAInC,oFAAoF;IACpF,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAgB/B;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS;IASrC,qFAAqF;IACrF,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAG7B"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-chat TURN tracking for `POST /chats/:id/messages` (F-RECON-017).
|
|
3
|
+
*
|
|
4
|
+
* The engine queues a message sent to a seat that is still answering the previous one — silently:
|
|
5
|
+
* `chatSend` answers the seats it accepted, the worker receives the text the instant the previous
|
|
6
|
+
* turn's final block lands, and the reply frames (`chatDelta` / `chatReply`) carry chat + seat but
|
|
7
|
+
* NO message correlation. The recon saw exactly that: Q3 sent 58 s into Q2's turn got a 202, and
|
|
8
|
+
* Q2's reply then rendered under Q3's bubble. Neither the daemon nor the skin could tell.
|
|
9
|
+
*
|
|
10
|
+
* This index is the daemon's own record of which seats are mid-turn in which chat:
|
|
11
|
+
*
|
|
12
|
+
* - `begin` opens a turn for the seats a send actually reached (the engine's answer) and mints a
|
|
13
|
+
* `turnId` the 202 returns;
|
|
14
|
+
* - `inFlight` is the refusal predicate the route consults FIRST: a send that targets a seat still
|
|
15
|
+
* mid-turn is refused (409 `turn_in_flight`, naming the turn and the busy seats) — targeting
|
|
16
|
+
* only idle seats passes, so a stalled seat (opencode 0 bytes for 300 s) never blocks a
|
|
17
|
+
* follow-up to the one that answered;
|
|
18
|
+
* - `observe` folds the engine's frames: a seat's `chatReply` (ok or not) or `chatSessionFailed`
|
|
19
|
+
* ends its part of the turn, `chatClosed` drops the chat's turns;
|
|
20
|
+
* - `decorate` stamps `turn_id` onto the chat frames of a seat mid-turn, so a skin can file a
|
|
21
|
+
* delta/reply under the message it answers instead of the newest bubble.
|
|
22
|
+
*
|
|
23
|
+
* A turn whose frames were lost (an engine restart, a seat reaped without a frame) must never wedge
|
|
24
|
+
* the chat: a turn older than `staleAfterMs` (default 15 min — three engine turn budgets) is treated
|
|
25
|
+
* as ended by every read, and reported in the 409's `stale` reason when it is what let a send pass.
|
|
26
|
+
*/
|
|
27
|
+
import { randomUUID } from 'node:crypto';
|
|
28
|
+
export const CHAT_TURN_EXCERPT_CHARS = 120;
|
|
29
|
+
/** Three engine turn budgets (300 s each): a turn this old with no closing frame is lost, not live. */
|
|
30
|
+
export const CHAT_TURN_STALE_AFTER_MS = 15 * 60_000;
|
|
31
|
+
/** The frame kinds that carry a seat's progress on a turn (`chat` + `cliKey` fields). */
|
|
32
|
+
const SEAT_PROGRESS_FRAMES = new Set(['chatDelta', 'chatReply', 'chatSessionFailed']);
|
|
33
|
+
/** The frame kinds that END a seat's part of its turn. */
|
|
34
|
+
const SEAT_DONE_FRAMES = new Set(['chatReply', 'chatSessionFailed']);
|
|
35
|
+
function excerptOf(text) {
|
|
36
|
+
const one = text.replace(/\s+/g, ' ').trim();
|
|
37
|
+
return one.length > CHAT_TURN_EXCERPT_CHARS ? `${one.slice(0, CHAT_TURN_EXCERPT_CHARS)}…` : one;
|
|
38
|
+
}
|
|
39
|
+
export class ChatTurnIndex {
|
|
40
|
+
/** chatId → live turns (a seat is in at most one — `inFlight` refuses the second). */
|
|
41
|
+
turns = new Map();
|
|
42
|
+
now;
|
|
43
|
+
staleAfterMs;
|
|
44
|
+
constructor(opts = {}) {
|
|
45
|
+
this.now = opts.now ?? Date.now;
|
|
46
|
+
this.staleAfterMs = opts.staleAfterMs ?? CHAT_TURN_STALE_AFTER_MS;
|
|
47
|
+
}
|
|
48
|
+
/** Drop turns whose frames were lost (see the module doc); returns the survivors. */
|
|
49
|
+
live(chatId) {
|
|
50
|
+
const list = this.turns.get(chatId);
|
|
51
|
+
if (list === undefined)
|
|
52
|
+
return [];
|
|
53
|
+
const now = this.now();
|
|
54
|
+
const kept = list.filter((t) => t.pending.length > 0 && now - t.startedAt < this.staleAfterMs);
|
|
55
|
+
if (kept.length === 0)
|
|
56
|
+
this.turns.delete(chatId);
|
|
57
|
+
else if (kept.length !== list.length)
|
|
58
|
+
this.turns.set(chatId, kept);
|
|
59
|
+
return kept;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The turn that makes a send to `targets` (every seat of the chat when omitted) refusable: one
|
|
63
|
+
* whose pending seats intersect the targets. `null` when every targeted seat is idle.
|
|
64
|
+
*/
|
|
65
|
+
inFlight(chatId, targets) {
|
|
66
|
+
for (const turn of this.live(chatId)) {
|
|
67
|
+
const busy = targets === undefined ? [...turn.pending] : turn.pending.filter((s) => targets.includes(s));
|
|
68
|
+
if (busy.length === 0)
|
|
69
|
+
continue;
|
|
70
|
+
return {
|
|
71
|
+
turnId: turn.turnId,
|
|
72
|
+
chatId,
|
|
73
|
+
seats: [...turn.seats],
|
|
74
|
+
busy,
|
|
75
|
+
startedAt: turn.startedAt,
|
|
76
|
+
ageMs: Math.max(0, this.now() - turn.startedAt),
|
|
77
|
+
excerpt: turn.excerpt,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
/** Open a turn for the seats a send reached. An empty seat list opens nothing (nothing to wait for). */
|
|
83
|
+
begin(chatId, seats, text) {
|
|
84
|
+
const unique = [...new Set(seats)];
|
|
85
|
+
if (unique.length === 0)
|
|
86
|
+
return null;
|
|
87
|
+
const turn = {
|
|
88
|
+
turnId: randomUUID(),
|
|
89
|
+
chatId,
|
|
90
|
+
seats: unique,
|
|
91
|
+
pending: [...unique],
|
|
92
|
+
startedAt: this.now(),
|
|
93
|
+
excerpt: excerptOf(text),
|
|
94
|
+
};
|
|
95
|
+
const list = this.live(chatId);
|
|
96
|
+
list.push(turn);
|
|
97
|
+
this.turns.set(chatId, list);
|
|
98
|
+
return turn;
|
|
99
|
+
}
|
|
100
|
+
/** The live turn a seat of a chat is answering, if any. */
|
|
101
|
+
turnOf(chatId, cliKey) {
|
|
102
|
+
return this.live(chatId).find((t) => t.pending.includes(cliKey));
|
|
103
|
+
}
|
|
104
|
+
/** Every live turn of a chat (diagnostics / tests). */
|
|
105
|
+
turnsOf(chatId) {
|
|
106
|
+
return this.live(chatId).map((t) => ({ ...t, seats: [...t.seats], pending: [...t.pending] }));
|
|
107
|
+
}
|
|
108
|
+
/** Fold one engine frame. Safe on every event type; non-chat frames are ignored. */
|
|
109
|
+
observe(event) {
|
|
110
|
+
const chatId = typeof event.chat === 'string' ? event.chat : undefined;
|
|
111
|
+
if (chatId === undefined)
|
|
112
|
+
return;
|
|
113
|
+
if (event.type === 'chatClosed') {
|
|
114
|
+
this.turns.delete(chatId);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (!SEAT_DONE_FRAMES.has(event.type))
|
|
118
|
+
return;
|
|
119
|
+
const cliKey = typeof event.cliKey === 'string' ? event.cliKey : undefined;
|
|
120
|
+
if (cliKey === undefined)
|
|
121
|
+
return;
|
|
122
|
+
const turn = this.turnOf(chatId, cliKey);
|
|
123
|
+
if (turn === undefined)
|
|
124
|
+
return;
|
|
125
|
+
turn.pending = turn.pending.filter((s) => s !== cliKey);
|
|
126
|
+
this.live(chatId); // prunes the turn once its last seat ended
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The frame with `turn_id` stamped when it is a seat's progress on a live turn; the frame itself
|
|
130
|
+
* otherwise. Call BEFORE `observe` — the closing `chatReply` is the one most worth correlating.
|
|
131
|
+
*/
|
|
132
|
+
decorate(event) {
|
|
133
|
+
if (!SEAT_PROGRESS_FRAMES.has(event.type))
|
|
134
|
+
return event;
|
|
135
|
+
const chatId = typeof event.chat === 'string' ? event.chat : undefined;
|
|
136
|
+
const cliKey = typeof event.cliKey === 'string' ? event.cliKey : undefined;
|
|
137
|
+
if (chatId === undefined || cliKey === undefined)
|
|
138
|
+
return event;
|
|
139
|
+
const turn = this.turnOf(chatId, cliKey);
|
|
140
|
+
return turn === undefined ? event : { ...event, turn_id: turn.turnId };
|
|
141
|
+
}
|
|
142
|
+
/** The chat is gone (a `DELETE` or an engine reclaim) — nothing left to wait for. */
|
|
143
|
+
closed(chatId) {
|
|
144
|
+
this.turns.delete(chatId);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=chat-turns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-turns.js","sourceRoot":"","sources":["../../src/api/chat-turns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA6BzC,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAC3C,uGAAuG;AACvG,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,GAAG,MAAM,CAAC;AAEpD,yFAAyF;AACzF,MAAM,oBAAoB,GAAwB,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,WAAW,EAAE,mBAAmB,CAAC,CAAC,CAAC;AAC3G,0DAA0D;AAC1D,MAAM,gBAAgB,GAAwB,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,mBAAmB,CAAC,C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C,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;CACF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ONE roster accessor every launch path shares: the registry roster decorated with crew's
|
|
3
|
+
* STANDING (F-2R2-009) — runtime `health`, `signed_in`, `auth`, `council_eligible` + its reason,
|
|
4
|
+
* the council bench — so `engineRosterJson` (core/engine-roster.ts) can bench a seat the daemon
|
|
5
|
+
* already knows is unusable before the engine convenes it.
|
|
6
|
+
*
|
|
7
|
+
* F-RECON-002 / F-RECON-003: this used to be a closure inside `registerRoutes`, so ONLY the routes
|
|
8
|
+
* (`POST /runs`, `/testing/*`, campaigns, steering) launched with standing. The interactive seams
|
|
9
|
+
* (draft/edit/chat/demo subscribers), the adapter's onboarding launch (`seatsForWorkflow`) and
|
|
10
|
+
* `wicked-crew start` handed the engine `CoreAdapter.roster()` RAW — every interactive council
|
|
11
|
+
* convened codex/pi/copilot although the roster reported them `signed_out` (9–19 councilSeatFailed,
|
|
12
|
+
* 57–112 s of dead ballots per run), and one council ELECTED signed-out pi, which then failed its
|
|
13
|
+
* unit and fell over to claude. The factory below is what all of those now call; `createServer`
|
|
14
|
+
* builds exactly one over its `SeatHealthTracker` and hands the same function everywhere.
|
|
15
|
+
*
|
|
16
|
+
* Standing is read at CALL time (the tracker's live state, the LIVE `WICKED_WORKER_HOME`), never
|
|
17
|
+
* captured — a seat signed in from the System page is eligible on the very next launch.
|
|
18
|
+
*/
|
|
19
|
+
import type { RosterSeat } from '../core/types.js';
|
|
20
|
+
import type { SeatHealthTracker } from './seat-health.js';
|
|
21
|
+
/** The accessor: the registry roster WITH crew's standing, freshly read on every call. */
|
|
22
|
+
export type RosterWithStanding = () => RosterSeat[];
|
|
23
|
+
export interface RosterStandingDeps {
|
|
24
|
+
/** The daemon's per-seat runtime health + council evidence (councilSeatFailed, auth refusals). */
|
|
25
|
+
seatHealth: SeatHealthTracker;
|
|
26
|
+
/** Seat sign-in presence probe — injectable so tests never read the developer's dotfiles.
|
|
27
|
+
* Defaults to the file/env heuristic in seat-signin.ts. */
|
|
28
|
+
signedIn?: (seatKey: string, workerConfigRoot?: string) => boolean | null;
|
|
29
|
+
/** The registry roster (default: the engine's production roster via `CoreAdapter.roster()`).
|
|
30
|
+
* Injectable so a test decorates its own seats without the native addon. */
|
|
31
|
+
registry?: () => unknown[];
|
|
32
|
+
/** Where `WICKED_WORKER_HOME` is read from at call time (default `process.env`). */
|
|
33
|
+
env?: NodeJS.ProcessEnv;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Build the accessor. Each seat's registry fields ride through verbatim — the spread is
|
|
37
|
+
* deliberately NOT a field whitelist, which is what lets the engine's `login_invocation` pass
|
|
38
|
+
* untouched — and gains `health`, `signed_in`, and the standing readings (`auth`, `free_tier*`,
|
|
39
|
+
* `council_eligible`, `council_ineligible_reason`, `council_bench`, `auth_source/evidence`).
|
|
40
|
+
*/
|
|
41
|
+
export declare function rosterWithStandingFactory(deps: RosterStandingDeps): RosterWithStanding;
|
|
42
|
+
//# sourceMappingURL=roster-standing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roster-standing.d.ts","sourceRoot":"","sources":["../../src/api/roster-standing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAI1D,0FAA0F;AAC1F,MAAM,MAAM,kBAAkB,GAAG,MAAM,UAAU,EAAE,CAAC;AAEpD,MAAM,WAAW,kBAAkB;IACjC,kGAAkG;IAClG,UAAU,EAAE,iBAAiB,CAAC;IAC9B;gEAC4D;IAC5D,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI,CAAC;IAC1E;iFAC6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,OAAO,EAAE,CAAC;IAC3B,oFAAoF;IACpF,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,kBAAkB,GAAG,kBAAkB,CA8BtF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ONE roster accessor every launch path shares: the registry roster decorated with crew's
|
|
3
|
+
* STANDING (F-2R2-009) — runtime `health`, `signed_in`, `auth`, `council_eligible` + its reason,
|
|
4
|
+
* the council bench — so `engineRosterJson` (core/engine-roster.ts) can bench a seat the daemon
|
|
5
|
+
* already knows is unusable before the engine convenes it.
|
|
6
|
+
*
|
|
7
|
+
* F-RECON-002 / F-RECON-003: this used to be a closure inside `registerRoutes`, so ONLY the routes
|
|
8
|
+
* (`POST /runs`, `/testing/*`, campaigns, steering) launched with standing. The interactive seams
|
|
9
|
+
* (draft/edit/chat/demo subscribers), the adapter's onboarding launch (`seatsForWorkflow`) and
|
|
10
|
+
* `wicked-crew start` handed the engine `CoreAdapter.roster()` RAW — every interactive council
|
|
11
|
+
* convened codex/pi/copilot although the roster reported them `signed_out` (9–19 councilSeatFailed,
|
|
12
|
+
* 57–112 s of dead ballots per run), and one council ELECTED signed-out pi, which then failed its
|
|
13
|
+
* unit and fell over to claude. The factory below is what all of those now call; `createServer`
|
|
14
|
+
* builds exactly one over its `SeatHealthTracker` and hands the same function everywhere.
|
|
15
|
+
*
|
|
16
|
+
* Standing is read at CALL time (the tracker's live state, the LIVE `WICKED_WORKER_HOME`), never
|
|
17
|
+
* captured — a seat signed in from the System page is eligible on the very next launch.
|
|
18
|
+
*/
|
|
19
|
+
import { CoreAdapter } from '../core/adapter.js';
|
|
20
|
+
import { signedInHeuristic } from './seat-signin.js';
|
|
21
|
+
import { seatStanding } from './seat-standing.js';
|
|
22
|
+
/**
|
|
23
|
+
* Build the accessor. Each seat's registry fields ride through verbatim — the spread is
|
|
24
|
+
* deliberately NOT a field whitelist, which is what lets the engine's `login_invocation` pass
|
|
25
|
+
* untouched — and gains `health`, `signed_in`, and the standing readings (`auth`, `free_tier*`,
|
|
26
|
+
* `council_eligible`, `council_ineligible_reason`, `council_bench`, `auth_source/evidence`).
|
|
27
|
+
*/
|
|
28
|
+
export function rosterWithStandingFactory(deps) {
|
|
29
|
+
const { seatHealth } = deps;
|
|
30
|
+
const signedIn = deps.signedIn ?? signedInHeuristic;
|
|
31
|
+
const registry = deps.registry ?? (() => CoreAdapter.roster());
|
|
32
|
+
const env = deps.env ?? process.env;
|
|
33
|
+
return () => {
|
|
34
|
+
const workerRoot = env['WICKED_WORKER_HOME'];
|
|
35
|
+
return registry().map((seat) => {
|
|
36
|
+
const key = String(seat.key);
|
|
37
|
+
const health = seatHealth.healthFor(key);
|
|
38
|
+
const signed = signedIn(key, workerRoot === '' ? undefined : workerRoot);
|
|
39
|
+
return {
|
|
40
|
+
...seat,
|
|
41
|
+
health,
|
|
42
|
+
signed_in: signed,
|
|
43
|
+
// The bench is THIS daemon's council evidence (councilSeatFailed, bounded window) — the
|
|
44
|
+
// prediction learns from what the engine actually did with the seat (#533 review, F-1).
|
|
45
|
+
...seatStanding(seat, signed, health, seatHealth.councilBenchFor(key),
|
|
46
|
+
// F-A45-006: the seat's OWN "no credential" report (a ballot's "No API key found", a
|
|
47
|
+
// worker's 401, an auth ACP fallback) overrides the file probe — `auth` flips, not only
|
|
48
|
+
// `council_eligible`, and the evidence rides on the wire.
|
|
49
|
+
seatHealth.authFailureFor(key)),
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=roster-standing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roster-standing.js","sourceRoot":"","sources":["../../src/api/roster-standing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GA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AC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/api/routes.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ import type { ElicitationCache } from './elicitation-cache.js';
|
|
|
7
7
|
import { QeGateCache } from '../qe/gate-events.js';
|
|
8
8
|
import type { ConformanceRule, SteeringType } from '../core/types.js';
|
|
9
9
|
import { SeatHealthTracker } from './seat-health.js';
|
|
10
|
+
import { type RosterWithStanding } from './roster-standing.js';
|
|
11
|
+
import { ChatTurnIndex } from './chat-turns.js';
|
|
10
12
|
import { ChatScopeIndex } from './chat-scope.js';
|
|
11
13
|
import { DocRunIndex } from '../interactive/doc-run-index.js';
|
|
12
14
|
import { TestSetIndex } from '../qe/test-sets.js';
|
|
@@ -82,7 +84,7 @@ export declare function policyProposalToRule(proposalId: string, kindType: strin
|
|
|
82
84
|
* schema does not accept — so `.strict()` is what turns that trip into a 400 instead of an
|
|
83
85
|
* unworkflowed run reported as `201`.
|
|
84
86
|
*/
|
|
85
|
-
export declare const LaunchSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
87
|
+
export declare const LaunchSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
86
88
|
problem: z.ZodString;
|
|
87
89
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
88
90
|
clisJson: z.ZodOptional<z.ZodString>;
|
|
@@ -101,6 +103,12 @@ export declare const LaunchSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
101
103
|
* defaults to `"pr"` (flippable via the `deliverDefault` setting), everything else to
|
|
102
104
|
* `"none"` — see the resolution below. */
|
|
103
105
|
deliver: z.ZodOptional<z.ZodEnum<["pr", "none"]>>;
|
|
106
|
+
/** F-E2E-030 — who confirms the deliver phase. `'human'` (the default when omitted): the engine
|
|
107
|
+
* pauses before the composed `deliver` Tool unit pushes and opens the PR, whatever
|
|
108
|
+
* `humanConfirm` says. `'auto'`: the caller's EXPLICIT opt-out — the push and PR follow verify
|
|
109
|
+
* unattended, under the daemon's active gh account; a UI sending it must name the posture
|
|
110
|
+
* "auto-deliver" to its operator. Additive; an older daemon's schema rejects it with a 400. */
|
|
111
|
+
deliverGate: z.ZodOptional<z.ZodEnum<["human", "auto"]>>;
|
|
104
112
|
/** DES-UX-001 §8.3 (CREW-UX-3) — the run this launch retries. Must name an EXISTING run id
|
|
105
113
|
* (the route checks the store and 400s with a named error otherwise); persisted via the
|
|
106
114
|
* `run.launched` audit entry + retry index and echoed as `AgentSession.retry_of`. */
|
|
@@ -128,6 +136,7 @@ export declare const LaunchSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
128
136
|
retryOf?: string | undefined;
|
|
129
137
|
entityMode?: "shared" | "isolated" | undefined;
|
|
130
138
|
humanConfirm?: string | undefined;
|
|
139
|
+
deliverGate?: "human" | "auto" | undefined;
|
|
131
140
|
}, {
|
|
132
141
|
problem: string;
|
|
133
142
|
workflow?: string | undefined;
|
|
@@ -141,6 +150,7 @@ export declare const LaunchSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
141
150
|
retryOf?: string | undefined;
|
|
142
151
|
entityMode?: "shared" | "isolated" | undefined;
|
|
143
152
|
humanConfirm?: string | undefined;
|
|
153
|
+
deliverGate?: "human" | "auto" | undefined;
|
|
144
154
|
}>, {
|
|
145
155
|
problem: string;
|
|
146
156
|
workflow?: string | undefined;
|
|
@@ -154,6 +164,7 @@ export declare const LaunchSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
154
164
|
retryOf?: string | undefined;
|
|
155
165
|
entityMode?: "shared" | "isolated" | undefined;
|
|
156
166
|
humanConfirm?: string | undefined;
|
|
167
|
+
deliverGate?: "human" | "auto" | undefined;
|
|
157
168
|
}, {
|
|
158
169
|
problem: string;
|
|
159
170
|
workflow?: string | undefined;
|
|
@@ -167,6 +178,7 @@ export declare const LaunchSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
167
178
|
retryOf?: string | undefined;
|
|
168
179
|
entityMode?: "shared" | "isolated" | undefined;
|
|
169
180
|
humanConfirm?: string | undefined;
|
|
181
|
+
deliverGate?: "human" | "auto" | undefined;
|
|
170
182
|
}>, {
|
|
171
183
|
problem: string;
|
|
172
184
|
workflow?: string | undefined;
|
|
@@ -180,6 +192,7 @@ export declare const LaunchSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
180
192
|
retryOf?: string | undefined;
|
|
181
193
|
entityMode?: "shared" | "isolated" | undefined;
|
|
182
194
|
humanConfirm?: string | undefined;
|
|
195
|
+
deliverGate?: "human" | "auto" | undefined;
|
|
183
196
|
}, {
|
|
184
197
|
problem: string;
|
|
185
198
|
workflow?: string | undefined;
|
|
@@ -193,6 +206,35 @@ export declare const LaunchSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
193
206
|
retryOf?: string | undefined;
|
|
194
207
|
entityMode?: "shared" | "isolated" | undefined;
|
|
195
208
|
humanConfirm?: string | undefined;
|
|
209
|
+
deliverGate?: "human" | "auto" | undefined;
|
|
210
|
+
}>, {
|
|
211
|
+
problem: string;
|
|
212
|
+
workflow?: string | undefined;
|
|
213
|
+
deliver?: "pr" | "none" | undefined;
|
|
214
|
+
projectId?: string | undefined;
|
|
215
|
+
repoRef?: string | undefined;
|
|
216
|
+
campaignId?: string | undefined;
|
|
217
|
+
groupLabel?: string | undefined;
|
|
218
|
+
clisJson?: string | undefined;
|
|
219
|
+
sessionId?: string | undefined;
|
|
220
|
+
retryOf?: string | undefined;
|
|
221
|
+
entityMode?: "shared" | "isolated" | undefined;
|
|
222
|
+
humanConfirm?: string | undefined;
|
|
223
|
+
deliverGate?: "human" | "auto" | undefined;
|
|
224
|
+
}, {
|
|
225
|
+
problem: string;
|
|
226
|
+
workflow?: string | undefined;
|
|
227
|
+
deliver?: "pr" | "none" | undefined;
|
|
228
|
+
projectId?: string | undefined;
|
|
229
|
+
repoRef?: string | undefined;
|
|
230
|
+
campaignId?: string | undefined;
|
|
231
|
+
groupLabel?: string | undefined;
|
|
232
|
+
clisJson?: string | undefined;
|
|
233
|
+
sessionId?: string | undefined;
|
|
234
|
+
retryOf?: string | undefined;
|
|
235
|
+
entityMode?: "shared" | "isolated" | undefined;
|
|
236
|
+
humanConfirm?: string | undefined;
|
|
237
|
+
deliverGate?: "human" | "auto" | undefined;
|
|
196
238
|
}>;
|
|
197
239
|
export declare const GateSchema: z.ZodObject<{
|
|
198
240
|
approve: z.ZodBoolean;
|
|
@@ -285,6 +327,10 @@ export interface RuntimeDeps {
|
|
|
285
327
|
* `chatClosed` frames (so a reclaimed chat's scratch root goes with it); a directly-driven
|
|
286
328
|
* route set gets a fresh one. */
|
|
287
329
|
chatScopes?: ChatScopeIndex;
|
|
330
|
+
/** Per-chat turn index (F-RECON-017) — `createServer` feeds one from the CoreEvent fold so
|
|
331
|
+
* `POST /chats/:id/messages` refuses a send to a seat still mid-turn; a directly-driven route
|
|
332
|
+
* set gets a fresh one (tests fold frames into it themselves). */
|
|
333
|
+
chatTurns?: ChatTurnIndex;
|
|
288
334
|
/** Run→delivered-PR index (CREW-UX-8, crew#321) — `createServer` hydrates one from the audit
|
|
289
335
|
* trail so a restarted daemon still echoes `delivery`; a directly-driven route set gets a
|
|
290
336
|
* fresh one. */
|
|
@@ -326,6 +372,11 @@ export interface RuntimeDeps {
|
|
|
326
372
|
/** Seat sign-in presence probe (seat sign-in) — injectable so route tests never read the
|
|
327
373
|
* developer's real dotfiles. Defaults to the file/env heuristic in seat-signin.ts. */
|
|
328
374
|
signedIn?: (seatKey: string, workerConfigRoot?: string) => boolean | null;
|
|
375
|
+
/** The roster WITH crew's standing (`api/roster-standing.ts`) — `createServer` injects its single
|
|
376
|
+
* instance so the routes, the interactive seams and the adapter's own launches all bench the
|
|
377
|
+
* same seats (F-RECON-002/003); a directly-driven route set builds one over `seatHealth` +
|
|
378
|
+
* `signedIn` above. */
|
|
379
|
+
rosterWithStanding?: RosterWithStanding;
|
|
329
380
|
/** The `/ws` fan-out, for the few routes that say something to a thread themselves (a refused
|
|
330
381
|
* chat seat, F-2R2-007). Absent (unit tests, library use) = nothing is broadcast. */
|
|
331
382
|
broadcast?: (frame: CoreEvent) => void;
|
|
@@ -392,16 +443,16 @@ export declare const ChatOpenSchema: z.ZodObject<{
|
|
|
392
443
|
projectId: z.ZodOptional<z.ZodString>;
|
|
393
444
|
}, "strict", z.ZodTypeAny, {
|
|
394
445
|
projectId?: string | undefined;
|
|
446
|
+
chatId?: string | undefined;
|
|
395
447
|
clis?: string[] | undefined;
|
|
396
448
|
repoRef?: string | undefined;
|
|
397
449
|
repoRefs?: string[] | undefined;
|
|
398
|
-
chatId?: string | undefined;
|
|
399
450
|
}, {
|
|
400
451
|
projectId?: string | undefined;
|
|
452
|
+
chatId?: string | undefined;
|
|
401
453
|
clis?: string[] | undefined;
|
|
402
454
|
repoRef?: string | undefined;
|
|
403
455
|
repoRefs?: string[] | undefined;
|
|
404
|
-
chatId?: string | undefined;
|
|
405
456
|
}>;
|
|
406
457
|
export declare function registerRoutes(app: FastifyInstance, adapter: CoreAdapter, gateCache: GateCache, elicitationCache: ElicitationCache, qeGateEvents?: QeGateCache, projects?: ProjectRoutesDeps, security?: SecurityDeps, runtime?: RuntimeDeps): void;
|
|
407
458
|
//# 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,EAAgB,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,OAAO,EAAmD,WAAW,EAA4E,MAAM,oBAAoB,CAAC;AAE5K,OAAO,KAAK,EACV,aAAa,EACb,SAAS,EAET,WAAW,EAEZ,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAiB,KAAK,SAAS,EAAE,M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