wicked-crew 0.7.46 → 0.7.48
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/capture.d.ts +2 -2
- package/dist/api/chat-citations.d.ts +10 -1
- package/dist/api/chat-citations.d.ts.map +1 -1
- package/dist/api/chat-citations.js +28 -0
- package/dist/api/chat-citations.js.map +1 -1
- package/dist/api/chat-scope.d.ts +4 -2
- package/dist/api/chat-scope.d.ts.map +1 -1
- package/dist/api/chat-scope.js +35 -3
- package/dist/api/chat-scope.js.map +1 -1
- package/dist/api/chat-transcripts.d.ts +23 -1
- package/dist/api/chat-transcripts.d.ts.map +1 -1
- package/dist/api/chat-transcripts.js +61 -6
- package/dist/api/chat-transcripts.js.map +1 -1
- package/dist/api/delivery-index.d.ts +21 -0
- package/dist/api/delivery-index.d.ts.map +1 -1
- package/dist/api/delivery-index.js +36 -0
- package/dist/api/delivery-index.js.map +1 -1
- package/dist/api/elicitation-cache.d.ts +12 -0
- package/dist/api/elicitation-cache.d.ts.map +1 -1
- package/dist/api/elicitation-cache.js +17 -1
- package/dist/api/elicitation-cache.js.map +1 -1
- package/dist/api/eval-sample.d.ts +12 -12
- package/dist/api/governance-steering.d.ts.map +1 -1
- package/dist/api/governance-steering.js +1 -0
- package/dist/api/governance-steering.js.map +1 -1
- package/dist/api/mcp.d.ts +4 -4
- package/dist/api/policy-landing.d.ts +55 -0
- package/dist/api/policy-landing.d.ts.map +1 -0
- package/dist/api/policy-landing.js +174 -0
- package/dist/api/policy-landing.js.map +1 -0
- package/dist/api/recording.d.ts +228 -0
- package/dist/api/recording.d.ts.map +1 -0
- package/dist/api/recording.js +1140 -0
- package/dist/api/recording.js.map +1 -0
- package/dist/api/routes.d.ts +42 -39
- package/dist/api/routes.d.ts.map +1 -1
- package/dist/api/routes.js +362 -107
- package/dist/api/routes.js.map +1 -1
- package/dist/api/run-timing-index.d.ts +17 -0
- package/dist/api/run-timing-index.d.ts.map +1 -1
- package/dist/api/run-timing-index.js +43 -1
- package/dist/api/run-timing-index.js.map +1 -1
- package/dist/api/server.d.ts +27 -0
- package/dist/api/server.d.ts.map +1 -1
- package/dist/api/server.js +168 -4
- package/dist/api/server.js.map +1 -1
- package/dist/api/testing.d.ts +4 -4
- package/dist/api/testing.d.ts.map +1 -1
- package/dist/api/testing.js +3 -0
- package/dist/api/testing.js.map +1 -1
- package/dist/api/watch-routes.d.ts +30 -0
- package/dist/api/watch-routes.d.ts.map +1 -0
- package/dist/api/watch-routes.js +104 -0
- package/dist/api/watch-routes.js.map +1 -0
- package/dist/campaigns/routes.d.ts +2 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +20 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/core/adapter.d.ts +52 -1
- package/dist/core/adapter.d.ts.map +1 -1
- package/dist/core/adapter.js +193 -5
- package/dist/core/adapter.js.map +1 -1
- package/dist/core/run-identity.js +1 -1
- package/dist/core/run-identity.js.map +1 -1
- package/dist/core/walkthrough-root.d.ts +21 -0
- package/dist/core/walkthrough-root.d.ts.map +1 -0
- package/dist/core/walkthrough-root.js +66 -0
- package/dist/core/walkthrough-root.js.map +1 -0
- package/dist/decisions/chat-recorder.d.ts +129 -0
- package/dist/decisions/chat-recorder.d.ts.map +1 -0
- package/dist/decisions/chat-recorder.js +367 -0
- package/dist/decisions/chat-recorder.js.map +1 -0
- package/dist/decisions/consider.d.ts +102 -0
- package/dist/decisions/consider.d.ts.map +1 -0
- package/dist/decisions/consider.js +207 -0
- package/dist/decisions/consider.js.map +1 -0
- package/dist/decisions/derive.d.ts +79 -0
- package/dist/decisions/derive.d.ts.map +1 -0
- package/dist/decisions/derive.js +282 -0
- package/dist/decisions/derive.js.map +1 -0
- package/dist/decisions/events.d.ts +25 -0
- package/dist/decisions/events.d.ts.map +1 -0
- package/dist/decisions/events.js +24 -0
- package/dist/decisions/events.js.map +1 -0
- package/dist/decisions/ingest.d.ts +51 -0
- package/dist/decisions/ingest.d.ts.map +1 -0
- package/dist/decisions/ingest.js +100 -0
- package/dist/decisions/ingest.js.map +1 -0
- package/dist/decisions/land.d.ts +100 -0
- package/dist/decisions/land.d.ts.map +1 -0
- package/dist/decisions/land.js +466 -0
- package/dist/decisions/land.js.map +1 -0
- package/dist/decisions/ledger.d.ts +60 -0
- package/dist/decisions/ledger.d.ts.map +1 -0
- package/dist/decisions/ledger.js +246 -0
- package/dist/decisions/ledger.js.map +1 -0
- package/dist/decisions/routes.d.ts +10 -0
- package/dist/decisions/routes.d.ts.map +1 -0
- package/dist/decisions/routes.js +141 -0
- package/dist/decisions/routes.js.map +1 -0
- package/dist/decisions/rules-text.d.ts +21 -0
- package/dist/decisions/rules-text.d.ts.map +1 -0
- package/dist/decisions/rules-text.js +50 -0
- package/dist/decisions/rules-text.js.map +1 -0
- package/dist/decisions/types.d.ts +120 -0
- package/dist/decisions/types.d.ts.map +1 -0
- package/dist/decisions/types.js +19 -0
- package/dist/decisions/types.js.map +1 -0
- package/dist/editors/csp.d.ts +31 -0
- package/dist/editors/csp.d.ts.map +1 -0
- package/dist/editors/csp.js +46 -0
- package/dist/editors/csp.js.map +1 -0
- package/dist/editors/pack-install.d.ts +28 -0
- package/dist/editors/pack-install.d.ts.map +1 -0
- package/dist/editors/pack-install.js +153 -0
- package/dist/editors/pack-install.js.map +1 -0
- package/dist/editors/registry.d.ts +142 -0
- package/dist/editors/registry.d.ts.map +1 -0
- package/dist/editors/registry.js +255 -0
- package/dist/editors/registry.js.map +1 -0
- package/dist/editors/routes.d.ts +46 -0
- package/dist/editors/routes.d.ts.map +1 -0
- package/dist/editors/routes.js +166 -0
- package/dist/editors/routes.js.map +1 -0
- package/dist/interactive/bridge-pool.d.ts +7 -2
- package/dist/interactive/bridge-pool.d.ts.map +1 -1
- package/dist/interactive/bridge-pool.js +6 -1
- package/dist/interactive/bridge-pool.js.map +1 -1
- package/dist/interactive/draft-events.d.ts.map +1 -1
- package/dist/interactive/draft-events.js +1 -0
- package/dist/interactive/draft-events.js.map +1 -1
- package/dist/interactive/theme-events.d.ts +119 -0
- package/dist/interactive/theme-events.d.ts.map +1 -0
- package/dist/interactive/theme-events.js +606 -0
- package/dist/interactive/theme-events.js.map +1 -0
- package/dist/projects/events.d.ts.map +1 -1
- package/dist/projects/events.js +2 -1
- package/dist/projects/events.js.map +1 -1
- package/dist/projects/routes.d.ts +2 -2
- package/dist/projects/state-home-preflight.d.ts.map +1 -1
- package/dist/projects/state-home-preflight.js +3 -0
- package/dist/projects/state-home-preflight.js.map +1 -1
- package/dist/projects/state-home-registry.d.ts.map +1 -1
- package/dist/projects/state-home-registry.js +2 -0
- package/dist/projects/state-home-registry.js.map +1 -1
- package/dist/projects/state-home.d.ts +6 -0
- package/dist/projects/state-home.d.ts.map +1 -1
- package/dist/projects/state-home.js +28 -1
- package/dist/projects/state-home.js.map +1 -1
- package/dist/qe/acceptance.d.ts +45 -4
- package/dist/qe/acceptance.d.ts.map +1 -1
- package/dist/qe/acceptance.js +93 -4
- package/dist/qe/acceptance.js.map +1 -1
- package/dist/qe/ledger.d.ts +20 -0
- package/dist/qe/ledger.d.ts.map +1 -1
- package/dist/qe/ledger.js +34 -0
- package/dist/qe/ledger.js.map +1 -1
- package/dist/qe/walkthrough-acceptance.d.ts +82 -0
- package/dist/qe/walkthrough-acceptance.d.ts.map +1 -0
- package/dist/qe/walkthrough-acceptance.js +248 -0
- package/dist/qe/walkthrough-acceptance.js.map +1 -0
- package/dist/skills/base-skill.d.ts.map +1 -1
- package/dist/skills/base-skill.js +3 -2
- package/dist/skills/base-skill.js.map +1 -1
- package/dist/skills/plugin-source.d.ts +19 -1
- package/dist/skills/plugin-source.d.ts.map +1 -1
- package/dist/skills/plugin-source.js +31 -2
- package/dist/skills/plugin-source.js.map +1 -1
- package/dist/skills/runtime.d.ts +11 -2
- package/dist/skills/runtime.d.ts.map +1 -1
- package/dist/skills/runtime.js +29 -1
- package/dist/skills/runtime.js.map +1 -1
- package/dist/skills/store.d.ts +14 -1
- package/dist/skills/store.d.ts.map +1 -1
- package/dist/skills/store.js +19 -5
- package/dist/skills/store.js.map +1 -1
- package/dist/standing-orders/routes.d.ts +22 -22
- package/dist/standing-orders/store.d.ts +10 -10
- package/dist/watch/checks/check-failed.d.ts +24 -0
- package/dist/watch/checks/check-failed.d.ts.map +1 -0
- package/dist/watch/checks/check-failed.js +56 -0
- package/dist/watch/checks/check-failed.js.map +1 -0
- package/dist/watch/checks/claim-vs-evidence.d.ts +30 -0
- package/dist/watch/checks/claim-vs-evidence.d.ts.map +1 -0
- package/dist/watch/checks/claim-vs-evidence.js +152 -0
- package/dist/watch/checks/claim-vs-evidence.js.map +1 -0
- package/dist/watch/checks/deliver-audit.d.ts +19 -0
- package/dist/watch/checks/deliver-audit.d.ts.map +1 -0
- package/dist/watch/checks/deliver-audit.js +129 -0
- package/dist/watch/checks/deliver-audit.js.map +1 -0
- package/dist/watch/checks/index.d.ts +8 -0
- package/dist/watch/checks/index.d.ts.map +1 -0
- package/dist/watch/checks/index.js +24 -0
- package/dist/watch/checks/index.js.map +1 -0
- package/dist/watch/checks/lag.d.ts +24 -0
- package/dist/watch/checks/lag.d.ts.map +1 -0
- package/dist/watch/checks/lag.js +55 -0
- package/dist/watch/checks/lag.js.map +1 -0
- package/dist/watch/checks/quiet-after-claim.d.ts +17 -0
- package/dist/watch/checks/quiet-after-claim.d.ts.map +1 -0
- package/dist/watch/checks/quiet-after-claim.js +89 -0
- package/dist/watch/checks/quiet-after-claim.js.map +1 -0
- package/dist/watch/checks/ungated.d.ts +12 -0
- package/dist/watch/checks/ungated.d.ts.map +1 -0
- package/dist/watch/checks/ungated.js +64 -0
- package/dist/watch/checks/ungated.js.map +1 -0
- package/dist/watch/checks/warned-rule.d.ts +26 -0
- package/dist/watch/checks/warned-rule.d.ts.map +1 -0
- package/dist/watch/checks/warned-rule.js +126 -0
- package/dist/watch/checks/warned-rule.js.map +1 -0
- package/dist/watch/emit.d.ts +122 -0
- package/dist/watch/emit.d.ts.map +1 -0
- package/dist/watch/emit.js +443 -0
- package/dist/watch/emit.js.map +1 -0
- package/dist/watch/events.d.ts +21 -0
- package/dist/watch/events.d.ts.map +1 -0
- package/dist/watch/events.js +21 -0
- package/dist/watch/events.js.map +1 -0
- package/dist/watch/keys.d.ts +15 -0
- package/dist/watch/keys.d.ts.map +1 -0
- package/dist/watch/keys.js +23 -0
- package/dist/watch/keys.js.map +1 -0
- package/dist/watch/lanes.d.ts +41 -0
- package/dist/watch/lanes.d.ts.map +1 -0
- package/dist/watch/lanes.js +73 -0
- package/dist/watch/lanes.js.map +1 -0
- package/dist/watch/loader.d.ts +47 -0
- package/dist/watch/loader.d.ts.map +1 -0
- package/dist/watch/loader.js +178 -0
- package/dist/watch/loader.js.map +1 -0
- package/dist/watch/registry.d.ts +166 -0
- package/dist/watch/registry.d.ts.map +1 -0
- package/dist/watch/registry.js +589 -0
- package/dist/watch/registry.js.map +1 -0
- package/dist/watch/ring.d.ts +32 -0
- package/dist/watch/ring.d.ts.map +1 -0
- package/dist/watch/ring.js +90 -0
- package/dist/watch/ring.js.map +1 -0
- package/dist/watch/router.d.ts +25 -0
- package/dist/watch/router.d.ts.map +1 -0
- package/dist/watch/router.js +87 -0
- package/dist/watch/router.js.map +1 -0
- package/dist/watch/sources.d.ts +42 -0
- package/dist/watch/sources.d.ts.map +1 -0
- package/dist/watch/sources.js +104 -0
- package/dist/watch/sources.js.map +1 -0
- package/dist/watch/types.d.ts +129 -0
- package/dist/watch/types.d.ts.map +1 -0
- package/dist/watch/types.js +6 -0
- package/dist/watch/types.js.map +1 -0
- package/endpoint-manifest.json +272 -1
- package/package.json +3 -2
- package/watch/entries/claim-vs-evidence.json +13 -0
- package/watch/entries/deliver-audit.json +17 -0
- package/watch/entries/quiet-after-claim.json +16 -0
- package/watch/entries/registry-check-failed.json +12 -0
- package/watch/entries/registry-lagging.json +12 -0
- package/watch/entries/risky-call.json +12 -0
- package/watch/entries/ungated.json +13 -0
- package/dist/api/demo.d.ts +0 -90
- package/dist/api/demo.d.ts.map +0 -1
- package/dist/api/demo.js +0 -492
- package/dist/api/demo.js.map +0 -1
|
@@ -28,6 +28,15 @@ export declare class RunTimingIndex {
|
|
|
28
28
|
private readonly runToChatSeatCount;
|
|
29
29
|
/** runId → whether the promoted chat was graph-grounded (`AgentSession.chat_grounded`; crew#641/#642). */
|
|
30
30
|
private readonly runToChatGrounded;
|
|
31
|
+
/**
|
|
32
|
+
* runId → the chat it was launched from (`AgentSession.chat_id`; C1, api-types 0.71.0), for EVERY
|
|
33
|
+
* run, terminal ones included. crew#619's `runToChat` in `server.ts` is the transcript-retention
|
|
34
|
+
* hold and releases a run at its terminal frame; this is the permanent read-side index, fed by
|
|
35
|
+
* the same `run.launched` entries.
|
|
36
|
+
*/
|
|
37
|
+
private readonly runToChatId;
|
|
38
|
+
/** crew#762: the RESOLVED delivery decision the launch recorded (`detail.deliver`). */
|
|
39
|
+
private readonly runToLaunchDeliver;
|
|
31
40
|
/**
|
|
32
41
|
* Consume pre-read `run.launched` entries — the seam that lets `createServer` feed this index
|
|
33
42
|
* from the ONE `readAll({ action: 'run.launched' })` it already runs for `RetryIndex` +
|
|
@@ -60,6 +69,14 @@ export declare class RunTimingIndex {
|
|
|
60
69
|
launchActorFor(runId: string): string | undefined;
|
|
61
70
|
/** Record the warm seat count and grounding state at chat-promotion time (crew#641/#642). */
|
|
62
71
|
setChatPromotion(runId: string, seatCount: number, grounded: boolean): void;
|
|
72
|
+
/** Record the chat a run was launched from (C1). */
|
|
73
|
+
setChatId(runId: string, chatId: string): void;
|
|
74
|
+
/** Record the launch's resolved delivery decision (crew#762). */
|
|
75
|
+
setLaunchDeliver(runId: string, deliver: 'pr' | 'none'): void;
|
|
76
|
+
/** What the launch decided about delivery (`'pr'` / `'none'`), or `undefined` when there is no launch record. */
|
|
77
|
+
launchDeliverFor(runId: string): 'pr' | 'none' | undefined;
|
|
78
|
+
/** The chat the run was launched from, or `undefined` (ABSENT when it was not launched from one). */
|
|
79
|
+
chatIdFor(runId: string): string | undefined;
|
|
63
80
|
/** The warm seat count at chat-promotion, or `undefined` (ABSENT when not a chat-promoted run). */
|
|
64
81
|
chatSeatCountFor(runId: string): number | undefined;
|
|
65
82
|
/** Whether the chat was graph-grounded at launch, or `undefined` (ABSENT when not chat-promoted). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-timing-index.d.ts","sourceRoot":"","sources":["../../src/api/run-timing-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAW1D,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA6B;IAC5D,oGAAoG;IACpG,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA6B;IAC1D,iEAAiE;IACjE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA+C;IAC5E,2EAA2E;IAC3E,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA6B;IAC9D,sGAAsG;IACtG,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA6B;IAChE,0GAA0G;IAC1G,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA8B;
|
|
1
|
+
{"version":3,"file":"run-timing-index.d.ts","sourceRoot":"","sources":["../../src/api/run-timing-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAW1D,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA6B;IAC5D,oGAAoG;IACpG,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA6B;IAC1D,iEAAiE;IACjE,OAAO,CAAC,QAAQ,C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AAS,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAI9C,iEAAiE;IACjE,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI;IAI7D,iHAAiH;IACjH,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS;IAI1D,qGAAqG;IACrG,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAI5C,mGAAmG;IACnG,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAInD,qGAAqG;IACrG,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAInD;;;;;;;;OAQG;IACH,uBAAuB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,IAAI;IAOpD;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI;IAKpD;;iCAE6B;IAC7B,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CAG9C;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,QAAQ,EACf,cAAc,EAAE,cAAc,GAAG,SAAS,EAC1C,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,MAAM,CAuBR"}
|
|
@@ -34,6 +34,15 @@ export class RunTimingIndex {
|
|
|
34
34
|
runToChatSeatCount = new Map();
|
|
35
35
|
/** runId → whether the promoted chat was graph-grounded (`AgentSession.chat_grounded`; crew#641/#642). */
|
|
36
36
|
runToChatGrounded = new Map();
|
|
37
|
+
/**
|
|
38
|
+
* runId → the chat it was launched from (`AgentSession.chat_id`; C1, api-types 0.71.0), for EVERY
|
|
39
|
+
* run, terminal ones included. crew#619's `runToChat` in `server.ts` is the transcript-retention
|
|
40
|
+
* hold and releases a run at its terminal frame; this is the permanent read-side index, fed by
|
|
41
|
+
* the same `run.launched` entries.
|
|
42
|
+
*/
|
|
43
|
+
runToChatId = new Map();
|
|
44
|
+
/** crew#762: the RESOLVED delivery decision the launch recorded (`detail.deliver`). */
|
|
45
|
+
runToLaunchDeliver = new Map();
|
|
37
46
|
/**
|
|
38
47
|
* Consume pre-read `run.launched` entries — the seam that lets `createServer` feed this index
|
|
39
48
|
* from the ONE `readAll({ action: 'run.launched' })` it already runs for `RetryIndex` +
|
|
@@ -61,6 +70,13 @@ export class RunTimingIndex {
|
|
|
61
70
|
const cg = detail?.['chatGrounded'];
|
|
62
71
|
if (typeof cg === 'boolean')
|
|
63
72
|
this.runToChatGrounded.set(runId, cg);
|
|
73
|
+
// C1: the chat↔run link crew#619 already makes durable, read back for every run.
|
|
74
|
+
const chatId = detail?.['chatId'];
|
|
75
|
+
if (typeof chatId === 'string' && chatId.length > 0)
|
|
76
|
+
this.runToChatId.set(runId, chatId);
|
|
77
|
+
const deliver = detail?.['deliver'];
|
|
78
|
+
if (deliver === 'pr' || deliver === 'none')
|
|
79
|
+
this.runToLaunchDeliver.set(runId, deliver);
|
|
64
80
|
}
|
|
65
81
|
}
|
|
66
82
|
/**
|
|
@@ -75,7 +91,7 @@ export class RunTimingIndex {
|
|
|
75
91
|
this.hydrateFromLaunchEntries(await audit.readAll({ action: 'run.launched' }));
|
|
76
92
|
}
|
|
77
93
|
catch (err) {
|
|
78
|
-
log?.(`[runs] run-timing-index hydrate failed (prior runs read as undated until restart): ${err instanceof Error ? err.message : String(err)}`);
|
|
94
|
+
log?.(`[runs] run-timing-index hydrate failed (prior runs read as undated and lose their chat_id link until restart): ${err instanceof Error ? err.message : String(err)}`);
|
|
79
95
|
}
|
|
80
96
|
}
|
|
81
97
|
/**
|
|
@@ -111,6 +127,22 @@ export class RunTimingIndex {
|
|
|
111
127
|
this.runToChatSeatCount.set(runId, seatCount);
|
|
112
128
|
this.runToChatGrounded.set(runId, grounded);
|
|
113
129
|
}
|
|
130
|
+
/** Record the chat a run was launched from (C1). */
|
|
131
|
+
setChatId(runId, chatId) {
|
|
132
|
+
this.runToChatId.set(runId, chatId);
|
|
133
|
+
}
|
|
134
|
+
/** Record the launch's resolved delivery decision (crew#762). */
|
|
135
|
+
setLaunchDeliver(runId, deliver) {
|
|
136
|
+
this.runToLaunchDeliver.set(runId, deliver);
|
|
137
|
+
}
|
|
138
|
+
/** What the launch decided about delivery (`'pr'` / `'none'`), or `undefined` when there is no launch record. */
|
|
139
|
+
launchDeliverFor(runId) {
|
|
140
|
+
return this.runToLaunchDeliver.get(runId);
|
|
141
|
+
}
|
|
142
|
+
/** The chat the run was launched from, or `undefined` (ABSENT when it was not launched from one). */
|
|
143
|
+
chatIdFor(runId) {
|
|
144
|
+
return this.runToChatId.get(runId);
|
|
145
|
+
}
|
|
114
146
|
/** The warm seat count at chat-promotion, or `undefined` (ABSENT when not a chat-promoted run). */
|
|
115
147
|
chatSeatCountFor(runId) {
|
|
116
148
|
return this.runToChatSeatCount.get(runId);
|
|
@@ -174,6 +206,16 @@ export function recordRunLaunched(audit, runTimingIndex, actor, runId, detail) {
|
|
|
174
206
|
if (typeof la === 'string' && la.length > 0 && runTimingIndex !== undefined) {
|
|
175
207
|
runTimingIndex.setLaunchActor(runId, la);
|
|
176
208
|
}
|
|
209
|
+
// C1: the chat link, live — the same field a restart rehydrates from this entry.
|
|
210
|
+
const chatId = detail['chatId'];
|
|
211
|
+
if (typeof chatId === 'string' && chatId.length > 0 && runTimingIndex !== undefined) {
|
|
212
|
+
runTimingIndex.setChatId(runId, chatId);
|
|
213
|
+
}
|
|
214
|
+
// crew#762: the launch's delivery decision, live — the same field a restart rehydrates.
|
|
215
|
+
const deliver = detail['deliver'];
|
|
216
|
+
if ((deliver === 'pr' || deliver === 'none') && runTimingIndex !== undefined) {
|
|
217
|
+
runTimingIndex.setLaunchDeliver(runId, deliver);
|
|
218
|
+
}
|
|
177
219
|
return ts;
|
|
178
220
|
}
|
|
179
221
|
//# sourceMappingURL=run-timing-index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-timing-index.js","sourceRoot":"","sources":["../../src/api/run-timing-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH;;;;GAIG;AACH,SAAS,SAAS,CAAC,MAAc;IAC/B,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,OAAO,cAAc;IACR,cAAc,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC5D,oGAAoG;IACnF,YAAY,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC1D,iEAAiE;IAChD,YAAY,GAAG,IAAI,GAAG,EAAoC,CAAC;IAC5E,2EAA2E;IAC1D,gBAAgB,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC9D,sGAAsG;IACrF,kBAAkB,GAAG,IAAI,GAAG,EAAkB,CAAC;IAChE,0GAA0G;IACzF,iBAAiB,GAAG,IAAI,GAAG,EAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"run-timing-index.js","sourceRoot":"","sources":["../../src/api/run-timing-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH;;;;GAIG;AACH,SAAS,SAAS,CAAC,MAAc;IAC/B,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,OAAO,cAAc;IACR,cAAc,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC5D,oGAAoG;IACnF,YAAY,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC1D,iEAAiE;IAChD,YAAY,GAAG,IAAI,GAAG,EAAoC,CAAC;IAC5E,2EAA2E;IAC1D,gBAAgB,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC9D,sGAAsG;IACrF,kBAAkB,GAA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,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
package/dist/api/server.d.ts
CHANGED
|
@@ -78,6 +78,21 @@ export interface CreateServerOptions {
|
|
|
78
78
|
* FIFO per doc. When absent (the default), the topic goes unanswered — the pre-CREW-UX-5
|
|
79
79
|
* state.
|
|
80
80
|
*/
|
|
81
|
+
/**
|
|
82
|
+
* Opt-in governed theme learning (DES-artifact-editor-plugins §7.6, EP-C4): a durable subscriber
|
|
83
|
+
* answers `wicked.interactive.theme.learned` with one `interactive-theme` run that reads the
|
|
84
|
+
* grabbed render in place and writes design tokens; crew validates shape, grammar and contrast
|
|
85
|
+
* and writes them THROUGH interactive (`PUT /d/:doc/api/theme/learned {tokens, apply:true}`).
|
|
86
|
+
* Shares the edit seam's ledger and handoff root. When absent, a grab learns nothing.
|
|
87
|
+
*/
|
|
88
|
+
interactiveThemeEvents?: {
|
|
89
|
+
enabled: boolean;
|
|
90
|
+
dbPath?: string;
|
|
91
|
+
pollIntervalMs?: number;
|
|
92
|
+
heartbeatMs?: number;
|
|
93
|
+
clisJson?: string;
|
|
94
|
+
resolveDocsRoot?: (projectId: string | undefined) => string;
|
|
95
|
+
};
|
|
81
96
|
interactiveChatEvents?: {
|
|
82
97
|
enabled: boolean;
|
|
83
98
|
/** The bus db; omit for the one the adapter handed its engine (`busDbPath`, core/bus.ts). */
|
|
@@ -136,6 +151,18 @@ export interface CreateServerOptions {
|
|
|
136
151
|
/** Poll cadence, ms (tests shorten it). */
|
|
137
152
|
pollIntervalMs?: number;
|
|
138
153
|
};
|
|
154
|
+
/**
|
|
155
|
+
* The watch registry (DES-TRIGGER-REGISTRY-001, TR-W5a): advisory key-point checks over the
|
|
156
|
+
* daemon fan-in, relayed as `watchEvent` frames. Arms only where the engine holds a bus;
|
|
157
|
+
* `disabled: true` turns it off (health then says watching is not configured).
|
|
158
|
+
*/
|
|
159
|
+
watch?: {
|
|
160
|
+
disabled?: boolean;
|
|
161
|
+
entriesDir?: string;
|
|
162
|
+
pollIntervalMs?: number;
|
|
163
|
+
flushMs?: number;
|
|
164
|
+
tickMs?: number;
|
|
165
|
+
};
|
|
139
166
|
interactiveWsRelay?: {
|
|
140
167
|
disabled?: boolean;
|
|
141
168
|
/** The bus db; omit for the one the adapter handed its engine (`busDbPath`, core/bus.ts). */
|
package/dist/api/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/api/server.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/api/server.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAe9B,OAAO,EAAkC,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAQ7E,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,aAAa,EACnB,MAAM,qBAAqB,CAAC;AA0C7B,OAAO,EAC2B,WAAW,EAAE,MAAM,oBAAoB,CAAC;AA8B1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAM/D,OAAO,EAAkB,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAkBzE;;;;;;GAMG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,MAAM,WAAW,mBAAmB;IAClC,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;OAMG;IACH,sBAAsB,CAAC,EAAE;QACvB,OAAO,EAAE,OAAO,CAAC;QACjB,6FAA6F;QAC7F,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,2CAA2C;QAC3C,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,uDAAuD;QACvD,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,+FAA+F;QAC/F,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,gGAAgG;QAChG,QAAQ,CAAC,EAAE,MA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,OAAO,CAAC,CAAC,CAqgDrC;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,mGAAmG;AACnG,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAG/D;AAED,wBAAsB,WAAW,CAC/B,OAAO,EAAE,WAAW,EACpB,IAAI,SAAO,EACX,IAAI,SAAc,EAClB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,aAAa,CAAC,CAYxB"}
|
package/dist/api/server.js
CHANGED
|
@@ -4,6 +4,8 @@ import fastifyStatic from '@fastify/static';
|
|
|
4
4
|
import { existsSync } from 'node:fs';
|
|
5
5
|
import { join, resolve as resolvePath } from 'node:path';
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
|
+
import { DecisionLedger } from '../decisions/ledger.js';
|
|
8
|
+
import { requestOrigin, shellCsp } from '../editors/csp.js';
|
|
7
9
|
import { registerRoutes } from './routes.js';
|
|
8
10
|
import { ErrorRing, teeStreamWithErrorRing } from './diagnostics.js';
|
|
9
11
|
import { GateCache } from './gate-cache.js';
|
|
@@ -25,6 +27,8 @@ import { registerClient, broadcast } from '../events/bus.js';
|
|
|
25
27
|
import { TerminalHub, registerTerminalWs } from '../events/terminals.js';
|
|
26
28
|
import { INTERACTIVE_DRAFT_WORKFLOW_DEF, startInteractiveDraftSubscriber } from '../interactive/draft-events.js';
|
|
27
29
|
import { INTERACTIVE_EDIT_WORKFLOW_DEF, startInteractiveEditSubscriber } from '../interactive/edit-events.js';
|
|
30
|
+
import { putLearnedThemeViaBridge, startInteractiveThemeSubscriber } from '../interactive/theme-events.js';
|
|
31
|
+
import { InteractiveBridgePool, boundOrigin } from '../interactive/bridge-pool.js';
|
|
28
32
|
import { INTERACTIVE_CHAT_WORKFLOW_DEF, startInteractiveChatSubscriber } from '../interactive/chat-events.js';
|
|
29
33
|
import { PhaseSkillArming, RunSkillGapIndex } from '../skills/phase-skill-gaps.js';
|
|
30
34
|
import { resolveProjectInteractiveRoot } from '../interactive/bridge-root.js';
|
|
@@ -63,6 +67,9 @@ import { resumeRunningCampaigns } from '../campaign/boot-resume.js';
|
|
|
63
67
|
import { StandingOrderStore } from '../standing-orders/store.js';
|
|
64
68
|
import { StandingOrderEvaluator } from '../standing-orders/evaluator.js';
|
|
65
69
|
import { registerStandingOrderRoutes } from '../standing-orders/routes.js';
|
|
70
|
+
import { WatchRegistry } from '../watch/registry.js';
|
|
71
|
+
import { registerWatchRoutes } from './watch-routes.js';
|
|
72
|
+
import { callEstateTool } from '../core/estate-mcp-client.js';
|
|
66
73
|
import { seatParser } from '../standing-orders/parse.js';
|
|
67
74
|
import { registerGateHistoryRoute, runBand, runPreset, runProject } from '../standing-orders/history.js';
|
|
68
75
|
import { busRows, openPlanGateRisk } from '../team/routes.js';
|
|
@@ -117,6 +124,14 @@ export async function createServer(adapter, options) {
|
|
|
117
124
|
// Standing orders (behaviour 10): armed once the routes (and so THE gate decision path) exist;
|
|
118
125
|
// the event relays above it read it late-bound.
|
|
119
126
|
let standingOrderEvaluator = null;
|
|
127
|
+
// The watch registry (TR-W5a): built after the relays below; the fan-in and the watchdog tee
|
|
128
|
+
// read it late-bound, exactly as they read the standing-orders evaluator.
|
|
129
|
+
let watchRegistry = null;
|
|
130
|
+
// DC-S4b: the studio chat recorder, handed back by `registerRoutes` below (it needs the service built there).
|
|
131
|
+
let chatDecisionRecorder = null;
|
|
132
|
+
// DC-S7: considered · set aside · cited — the rule reads behind the citation verifier, the unit hook
|
|
133
|
+
// and the chat open/send paths (built by `registerRoutes`).
|
|
134
|
+
let considerations = null;
|
|
120
135
|
const elicitationCache = new ElicitationCache();
|
|
121
136
|
const terminals = new TerminalHub();
|
|
122
137
|
// Per-seat runtime health (crew#274): folded from the single CoreEvent subscription below,
|
|
@@ -283,7 +298,7 @@ export async function createServer(adapter, options) {
|
|
|
283
298
|
}
|
|
284
299
|
}
|
|
285
300
|
catch (err) {
|
|
286
|
-
app.log.warn(`[runs] launch-index hydrate failed (prior runs read as not-a-retry / ungrouped / undated until restart): ${err instanceof Error ? err.message : String(err)}`);
|
|
301
|
+
app.log.warn(`[runs] launch-index hydrate failed (prior runs read as not-a-retry / ungrouped / undated, without their chat_id link, until restart): ${err instanceof Error ? err.message : String(err)}`);
|
|
287
302
|
}
|
|
288
303
|
// wicked-studio#284: the watchdog's own frames, rebuilt from the trail this daemon (or a previous
|
|
289
304
|
// one) wrote — so a run page reloaded after the run ended, or after a restart, still shows the
|
|
@@ -454,6 +469,7 @@ export async function createServer(adapter, options) {
|
|
|
454
469
|
// is still preferred over its file once armed; the seams themselves arm further down.
|
|
455
470
|
let draftSub = null;
|
|
456
471
|
let editSub = null;
|
|
472
|
+
let themeSub = null;
|
|
457
473
|
let chatSub = null;
|
|
458
474
|
/** The crew-side half of deleting an interactive doc (crew#338): drop the doc's replay-dedup
|
|
459
475
|
* rows from all four handoff ledgers — the draft leg keys by DOCUMENT ID ("one first draft
|
|
@@ -554,6 +570,59 @@ export async function createServer(adapter, options) {
|
|
|
554
570
|
await teamRelay.stop();
|
|
555
571
|
});
|
|
556
572
|
}
|
|
573
|
+
// The watch registry (DES-TRIGGER-REGISTRY-001, TR-W5a). Advisory by construction: it is handed
|
|
574
|
+
// no gate, reassign or policy dependency (tests/watch-no-authority.test.ts). It arms in the
|
|
575
|
+
// background (the boot replay re-reads each live run's events); until then, and without a bus,
|
|
576
|
+
// `GET /watch/health` says why it is not watching.
|
|
577
|
+
if (options?.watch?.disabled !== true) {
|
|
578
|
+
const registry = new WatchRegistry({
|
|
579
|
+
dbPath: engineBusDb,
|
|
580
|
+
...(options?.watch?.entriesDir !== undefined ? { entriesDir: options.watch.entriesDir } : {}),
|
|
581
|
+
settings: async () => (await adapter.getSettings()).watch,
|
|
582
|
+
projectOf: (runId) => membershipIndex.projectOf(runId),
|
|
583
|
+
liveRuns: async () => (await adapter.sessionsDetail())
|
|
584
|
+
.filter((v) => !['completed', 'cancelled', 'failed'].includes(v.session.status))
|
|
585
|
+
.map((v) => v.session.id),
|
|
586
|
+
runEvents: (runId) => adapter.runEvents(runId),
|
|
587
|
+
// TR-W6 `warned_rule`: the fired rule ids are classified against the daemon's own steering
|
|
588
|
+
// store (effect: warn), read on a cadence by the registry — never per frame.
|
|
589
|
+
rules: () => adapter.listConformanceRules(),
|
|
590
|
+
broadcast: (frame) => broadcast(frame),
|
|
591
|
+
auditEmitFailed: (detail) => {
|
|
592
|
+
audit.record('watch.emit.failed', { id: 'watch-registry', kind: 'system', trust: 'admin' }, { detail });
|
|
593
|
+
},
|
|
594
|
+
// A proposal row goes to the existing review queue, never self-applied (§4.11). The check
|
|
595
|
+
// names the queue item in `facts.proposal` ({kind_type, payload, facets?}).
|
|
596
|
+
submitProposal: async (finding) => {
|
|
597
|
+
const proposal = finding.facts['proposal'];
|
|
598
|
+
if (typeof proposal?.kind_type !== 'string' || typeof proposal.payload !== 'object' || proposal.payload === null) {
|
|
599
|
+
throw new Error('a proposal row must carry facts.proposal {kind_type, payload}');
|
|
600
|
+
}
|
|
601
|
+
await callEstateTool('proposal.submit', {
|
|
602
|
+
kind_type: proposal.kind_type,
|
|
603
|
+
payload: { ...proposal.payload, source: `watch:${finding.watch_id}` },
|
|
604
|
+
facets: typeof proposal.facets === 'object' && proposal.facets !== null ? proposal.facets : {},
|
|
605
|
+
});
|
|
606
|
+
},
|
|
607
|
+
log: (m) => app.log.warn(m),
|
|
608
|
+
...(options?.watch?.pollIntervalMs !== undefined ? { pollIntervalMs: options.watch.pollIntervalMs } : {}),
|
|
609
|
+
...(options?.watch?.flushMs !== undefined ? { flushMs: options.watch.flushMs } : {}),
|
|
610
|
+
...(options?.watch?.tickMs !== undefined ? { tickMs: options.watch.tickMs } : {}),
|
|
611
|
+
});
|
|
612
|
+
watchRegistry = registry;
|
|
613
|
+
const arming = registry
|
|
614
|
+
.arm()
|
|
615
|
+
.then(() => {
|
|
616
|
+
if (registry.armed)
|
|
617
|
+
app.log.info('watch registry armed (watch rows → watchEvent)');
|
|
618
|
+
})
|
|
619
|
+
.catch((err) => app.log.warn(`[watch] arm failed: ${String(err)}`));
|
|
620
|
+
app.addHook('onClose', async () => {
|
|
621
|
+
await arming;
|
|
622
|
+
await registry.stop();
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
registerWatchRoutes(app, { registry: () => watchRegistry, audit });
|
|
557
626
|
/** The post-commit half of a project-FILED launch, shared with the launch route (§2.2/§4):
|
|
558
627
|
* the engine already attached the crew.run membership atomically with the launch — here we
|
|
559
628
|
* tag future /ws frames and announce the attach on the project bus. */
|
|
@@ -690,6 +759,40 @@ export async function createServer(adapter, options) {
|
|
|
690
759
|
});
|
|
691
760
|
}
|
|
692
761
|
}
|
|
762
|
+
// ONE interactive bridge pool per daemon (two pools over one docs root would race each other
|
|
763
|
+
// into starting duplicate bridges): built here so the theme seam below and the proxy routes
|
|
764
|
+
// share it. The origin is read LAZILY off the bound server (#298); the bus dir is the daemon's.
|
|
765
|
+
const interactiveBridges = new InteractiveBridgePool({
|
|
766
|
+
log: (m) => app.log.warn(m),
|
|
767
|
+
debug: (m) => app.log.debug(m),
|
|
768
|
+
studioOrigin: () => boundOrigin(app.server.address()),
|
|
769
|
+
busDataDir: options?.interactiveBridge?.busDataDir ?? null,
|
|
770
|
+
});
|
|
771
|
+
// EP-C4: theme learning. Shares the edit seam's ledger instance (one file, one writer) and its
|
|
772
|
+
// handoff root; writes the validated tokens through the doc's bridge.
|
|
773
|
+
if (options?.interactiveThemeEvents?.enabled === true && !refuseStubSeam('interactive-theme')) {
|
|
774
|
+
const o = options.interactiveThemeEvents;
|
|
775
|
+
const resolveDocsRoot = o.resolveDocsRoot ?? interactiveDocsRoot;
|
|
776
|
+
themeSub = await startInteractiveThemeSubscriber(adapter, {
|
|
777
|
+
...busOf(o.dbPath),
|
|
778
|
+
...(o.pollIntervalMs !== undefined ? { pollIntervalMs: o.pollIntervalMs } : {}),
|
|
779
|
+
...(o.heartbeatMs !== undefined ? { heartbeatMs: o.heartbeatMs } : {}),
|
|
780
|
+
...(o.clisJson !== undefined ? { clisJson: o.clisJson } : {}),
|
|
781
|
+
...(editSub !== null ? { ledger: editSub.ledger } : {}),
|
|
782
|
+
roster: rosterWithStanding,
|
|
783
|
+
putLearnedTheme: putLearnedThemeViaBridge(interactiveBridges, resolveDocsRoot),
|
|
784
|
+
onRunFiled: fileRun,
|
|
785
|
+
log: (m) => app.log.warn(m),
|
|
786
|
+
logError: (m) => app.log.error(m),
|
|
787
|
+
});
|
|
788
|
+
if (themeSub !== null) {
|
|
789
|
+
const sub = themeSub;
|
|
790
|
+
app.log.info('interactive-theme subscription armed (filter wicked.interactive.theme.learned)');
|
|
791
|
+
app.addHook('onClose', async () => {
|
|
792
|
+
await sub.stop();
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
}
|
|
693
796
|
// Arm the opt-in interactive CHAT answering seam (CREW-UX-5 — the iteration ask). Same
|
|
694
797
|
// posture again: failure to arm is LOUD but non-fatal. Armed AFTER the sibling seams so the
|
|
695
798
|
// per-doc serialization contract (no draft/edit/chat run races another on one doc) can
|
|
@@ -816,6 +919,8 @@ export async function createServer(adapter, options) {
|
|
|
816
919
|
detail,
|
|
817
920
|
});
|
|
818
921
|
stallFrameIndex.record(frame, ts);
|
|
922
|
+
// The watch registry's watchdog source (§4.6): an O(1) push, never awaited.
|
|
923
|
+
watchRegistry?.offerWatchdog(frame);
|
|
819
924
|
},
|
|
820
925
|
// The engine's own turn ceiling fired (`stepStatus: "timed_out"`, perf#4) — audit it as
|
|
821
926
|
// what it is, distinct from an operator cancel. Never sent by older engines; the ambiguous
|
|
@@ -873,8 +978,9 @@ export async function createServer(adapter, options) {
|
|
|
873
978
|
return;
|
|
874
979
|
const scope = chatScopes.get(chatId);
|
|
875
980
|
// No scope (a chat this daemon did not open, or `kind: 'none'`/`system`) ⇒ nothing to verify
|
|
876
|
-
// AGAINST. Saying "unverified" then would blame the seat for the daemon's missing roots.
|
|
877
|
-
|
|
981
|
+
// AGAINST. Saying "unverified" then would blame the seat for the daemon's missing roots. A
|
|
982
|
+
// `[rule:<id>]` citation (DC-S7) needs no root, so a root-less chat still gets those marked.
|
|
983
|
+
if (scope === undefined || (scope.repos.length === 0 && !text.includes('[rule:')))
|
|
878
984
|
return;
|
|
879
985
|
const roots = scope.repos.map((r) => ({ absRoot: resolvePath(r.rootPath), name: r.name }));
|
|
880
986
|
const turnId = typeof f['turn_id'] === 'string' ? f['turn_id'] : undefined;
|
|
@@ -882,7 +988,9 @@ export async function createServer(adapter, options) {
|
|
|
882
988
|
// looked up by that — the run-keyed lookup on the relay above answers `undefined` for chats.
|
|
883
989
|
const project = projectId ?? membershipIndex.projectOf(chatId);
|
|
884
990
|
try {
|
|
885
|
-
|
|
991
|
+
// DC-S7: the in-force rule ids for the chat's project (null = not readable → rule citations stay unchecked).
|
|
992
|
+
const ruleIds = considerations !== null ? await considerations.inForceIds(project ?? null) : null;
|
|
993
|
+
const result = await verifyCitations(text, roots, citationDeps, { ...citationLimits, ruleIds });
|
|
886
994
|
const out = citationsFrame({
|
|
887
995
|
chat: chatId,
|
|
888
996
|
cliKey,
|
|
@@ -934,6 +1042,13 @@ export async function createServer(adapter, options) {
|
|
|
934
1042
|
seatHealth.ingest(event);
|
|
935
1043
|
if (event.type === 'chatClosed' && typeof event.chat === 'string') {
|
|
936
1044
|
chatScopes.closed(event.chat);
|
|
1045
|
+
// DC-S4b: whatever the chat's open turns gathered is recorded now — into the ledger and onto
|
|
1046
|
+
// /ws. The transcript's `decisions` record follows the transcript's OWN retention (D-13): a
|
|
1047
|
+
// non-retained chat's file is dropped below before this settles, and `recordDecisions` never
|
|
1048
|
+
// recreates a gone file; a chat retained for its promoted run keeps the file and gets the
|
|
1049
|
+
// record. Nothing a reader could still open is missing it (codex r1, answered).
|
|
1050
|
+
void chatDecisionRecorder?.closed(event.chat);
|
|
1051
|
+
considerations?.chatClosed(event.chat);
|
|
937
1052
|
// crew#619: retain the transcript when a promoted run is still live — the chat may be
|
|
938
1053
|
// idle-TTL'd before the run finishes, and Continue-in-Build needs the transcript.
|
|
939
1054
|
const retaining = chatRetained.get(event.chat);
|
|
@@ -950,6 +1065,25 @@ export async function createServer(adapter, options) {
|
|
|
950
1065
|
// broadcast (/ws → studio render/promote). `observe`'s own rewrite pass is then a no-op.
|
|
951
1066
|
const rewritten = chatTranscripts.rewriteEvent(stamped);
|
|
952
1067
|
chatTranscripts.observe(rewritten);
|
|
1068
|
+
// DC-S4b: the seat's `wicked-decisions` block was cut out of the reply above; the recorder takes
|
|
1069
|
+
// it (once) and, when every seat of the turn has answered, records the operator's words — off
|
|
1070
|
+
// the hot path, never awaited here. A `chatSessionFailed` ends a seat's part with no reply.
|
|
1071
|
+
if (rewritten.type === 'chatReply' || rewritten.type === 'chatSessionFailed') {
|
|
1072
|
+
const f = rewritten;
|
|
1073
|
+
const chat = typeof f['chat'] === 'string' ? f['chat'] : undefined;
|
|
1074
|
+
const cliKey = typeof f['cliKey'] === 'string' ? f['cliKey'] : undefined;
|
|
1075
|
+
if (chat !== undefined && cliKey !== undefined) {
|
|
1076
|
+
const block = rewritten.type === 'chatReply' ? chatTranscripts.takeDecisionsBlock(chat, cliKey) : null;
|
|
1077
|
+
void chatDecisionRecorder?.onReply({
|
|
1078
|
+
chat,
|
|
1079
|
+
cliKey,
|
|
1080
|
+
...(typeof f['turn_id'] === 'string' ? { turnId: f['turn_id'] } : {}),
|
|
1081
|
+
ok: f['ok'] === true,
|
|
1082
|
+
block,
|
|
1083
|
+
kind: rewritten.type === 'chatReply' ? 'reply' : 'failed',
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
953
1087
|
chatTurns.observe(event);
|
|
954
1088
|
// Only feed the watchdog when its sweep is (or will be) armed: sweeping is what
|
|
955
1089
|
// prunes its per-run maps, so ingesting while disabled grows without bound
|
|
@@ -970,6 +1104,16 @@ export async function createServer(adapter, options) {
|
|
|
970
1104
|
// Standing orders (behaviour 10): a gate that opened may be one an order answers, holds or
|
|
971
1105
|
// reports — after the gate cache folded it, so the order's decision carries the right ord.
|
|
972
1106
|
void standingOrderEvaluator?.onEvent(event);
|
|
1107
|
+
// The watch registry (TR-W5a, G3): synchronous, O(1), never awaited, never throws.
|
|
1108
|
+
watchRegistry?.offer(event);
|
|
1109
|
+
// DC-S7: a unit attempt's output landed — what its rules were, and which it cited (one fact per
|
|
1110
|
+
// (run, ord, attempt); the read itself answers GET …/considered). Off the hot path.
|
|
1111
|
+
if (event.type === 'unitOutputCaptured' && session !== undefined) {
|
|
1112
|
+
const ev = event;
|
|
1113
|
+
const ord = typeof ev.ord === 'number' ? ev.ord : typeof ev.unitOrd === 'number' ? ev.unitOrd : undefined;
|
|
1114
|
+
if (ord !== undefined)
|
|
1115
|
+
void considerations?.onUnitCaptured(session, ord, typeof ev.attempt === 'number' ? ev.attempt : 0);
|
|
1116
|
+
}
|
|
973
1117
|
// The delivered-PR record (CREW-UX-8, crew#321): resolved once per run at its terminal
|
|
974
1118
|
// frame, best-effort, off the hot path — see `resolveRunDelivery` above for why BOTH
|
|
975
1119
|
// terminal frames trigger it and why a failed deliver is a no-op. THEN the delivery-
|
|
@@ -1245,6 +1389,8 @@ export async function createServer(adapter, options) {
|
|
|
1245
1389
|
evalStore,
|
|
1246
1390
|
// F-043/F-046: the bridge's bus dir and the create-time grounding store reach the proxy.
|
|
1247
1391
|
interactiveBridgeBusDataDir: options?.interactiveBridge?.busDataDir ?? null,
|
|
1392
|
+
// EP-C4: the one pool, shared with the theme seam above.
|
|
1393
|
+
interactiveBridges,
|
|
1248
1394
|
docGrounding,
|
|
1249
1395
|
...(skillsRuntime !== undefined ? { skills: skillsRuntime } : {}),
|
|
1250
1396
|
// DES-MCP-TOOLS-001 S2: the registry over `<state home>/mcp` (created on the first save).
|
|
@@ -1261,7 +1407,21 @@ export async function createServer(adapter, options) {
|
|
|
1261
1407
|
broadcast: (frame) => broadcast(frame),
|
|
1262
1408
|
// crew#619: retain a chat's transcript for the lifetime of its promoted run.
|
|
1263
1409
|
linkChatRun,
|
|
1410
|
+
// TR-W5a: the `watch.*` settings guard validates against the registry's entries.
|
|
1411
|
+
watchRegistry: () => watchRegistry,
|
|
1412
|
+
// DC-S4a: the decision ledger under the state home (registered `decisions`, fenced from
|
|
1413
|
+
// workers by core); facts ride the project bus (ids only). WICKED_DECISIONS picks the mode.
|
|
1414
|
+
decisionLedger: new DecisionLedger(),
|
|
1415
|
+
decisionsEmit: projectBus !== null ? (type, payload, key) => projectBus.emit(type, payload, key) : null,
|
|
1264
1416
|
});
|
|
1417
|
+
// DC-S4a §6: records whose landing a restart interrupted are re-driven, idempotently (the review
|
|
1418
|
+
// proposal is keyed by the decision id). Off the boot path; a failure is a logged outcome.
|
|
1419
|
+
chatDecisionRecorder = registered.chatRecorder;
|
|
1420
|
+
considerations = registered.considerations;
|
|
1421
|
+
if (registered.decisions !== null) {
|
|
1422
|
+
const decisionsService = registered.decisions;
|
|
1423
|
+
decisionsService.track(decisionsService.redrive());
|
|
1424
|
+
}
|
|
1265
1425
|
// Standing orders (Studio OS behaviour 10): the store, the evaluator over THE gate decision path
|
|
1266
1426
|
// (`registered.decideGate`), and the routes. See src/standing-orders/.
|
|
1267
1427
|
// The durable record is the audit trail (store.ts): fold it once, here.
|
|
@@ -1352,6 +1512,9 @@ export async function createServer(adapter, options) {
|
|
|
1352
1512
|
if (p.endsWith('/index.html')) {
|
|
1353
1513
|
// HTML must revalidate so a redeploy's new asset hashes are picked up.
|
|
1354
1514
|
reply.header('Cache-Control', 'no-cache');
|
|
1515
|
+
// EP-C1 (§8.2): the shell says what any frame in it may point at — crew's editors route,
|
|
1516
|
+
// crew's interactive proxy, blob: and data:. A self-navigating plugin can reach nothing else.
|
|
1517
|
+
reply.header('Content-Security-Policy', shellCsp(requestOrigin(reply.request)));
|
|
1355
1518
|
}
|
|
1356
1519
|
else if (p.includes('/assets/')) {
|
|
1357
1520
|
// Content-addressed (hashed) assets are immutable.
|
|
@@ -1367,6 +1530,7 @@ export async function createServer(adapter, options) {
|
|
|
1367
1530
|
!req.url.startsWith('/api/') &&
|
|
1368
1531
|
!req.url.startsWith('/ws')) {
|
|
1369
1532
|
reply.header('Cache-Control', 'no-cache');
|
|
1533
|
+
reply.header('Content-Security-Policy', shellCsp(requestOrigin(req)));
|
|
1370
1534
|
// `root` is dist/studio, so the shell is at 'index.html' (not
|
|
1371
1535
|
// 'studio/index.html'): sendFile resolves relative to root.
|
|
1372
1536
|
return reply.type('text/html').sendFile('index.html');
|