wicked-crew 0.4.0 → 0.6.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/api-prefix.d.ts +13 -0
- package/dist/api/api-prefix.d.ts.map +1 -0
- package/dist/api/api-prefix.js +13 -0
- package/dist/api/api-prefix.js.map +1 -0
- package/dist/api/audit.d.ts +57 -0
- package/dist/api/audit.d.ts.map +1 -0
- package/dist/api/audit.js +115 -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/evidence.d.ts +11 -0
- package/dist/api/evidence.d.ts.map +1 -1
- package/dist/api/evidence.js +8 -3
- package/dist/api/evidence.js.map +1 -1
- 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/open-path.d.ts +18 -0
- package/dist/api/open-path.d.ts.map +1 -0
- package/dist/api/open-path.js +79 -0
- package/dist/api/open-path.js.map +1 -0
- package/dist/api/routes.d.ts +113 -1
- package/dist/api/routes.d.ts.map +1 -1
- package/dist/api/routes.js +516 -27
- package/dist/api/routes.js.map +1 -1
- 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 +111 -3
- package/dist/api/server.d.ts.map +1 -1
- package/dist/api/server.js +236 -11
- package/dist/api/server.js.map +1 -1
- package/dist/api/unit-output.d.ts +62 -0
- package/dist/api/unit-output.d.ts.map +1 -0
- package/dist/api/unit-output.js +108 -0
- package/dist/api/unit-output.js.map +1 -0
- package/dist/cli/index.js +97 -3
- 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 +106 -1
- package/dist/core/adapter.d.ts.map +1 -1
- package/dist/core/adapter.js +293 -12
- package/dist/core/adapter.js.map +1 -1
- package/dist/core/bridge-path.d.ts +17 -6
- package/dist/core/bridge-path.d.ts.map +1 -1
- package/dist/core/bridge-path.js +17 -6
- package/dist/core/bridge-path.js.map +1 -1
- package/dist/core/types.d.ts +23 -352
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +11 -4
- package/dist/core/types.js.map +1 -1
- package/dist/interactive/bridge-pool.d.ts +71 -0
- package/dist/interactive/bridge-pool.d.ts.map +1 -0
- package/dist/interactive/bridge-pool.js +187 -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/draft-events.d.ts +144 -0
- package/dist/interactive/draft-events.d.ts.map +1 -0
- package/dist/interactive/draft-events.js +490 -0
- package/dist/interactive/draft-events.js.map +1 -0
- package/dist/interactive/edit-events.d.ts +172 -0
- package/dist/interactive/edit-events.d.ts.map +1 -0
- package/dist/interactive/edit-events.js +530 -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/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/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 +90 -0
- package/dist/projects/routes.d.ts.map +1 -0
- package/dist/projects/routes.js +388 -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-CCwXa1cn.js +428 -0
- package/dist/studio/assets/index-HWxo0h41.css +32 -0
- package/dist/studio/index.html +2 -2
- package/package.json +10 -4
- package/dist/studio/assets/index-Ci_R6ARr.js +0 -423
- package/dist/studio/assets/index-Dio_c1Q3.css +0 -32
|
@@ -0,0 +1,490 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opt-in governed answering of wicked-interactive's first-draft generation (task #86 spike,
|
|
3
|
+
* Phase 7c first leg).
|
|
4
|
+
*
|
|
5
|
+
* wicked-interactive's service is model-free: when a doc is created with `kind: "source"` it
|
|
6
|
+
* seeds a placeholder v0 and emits `wicked.interactive.doc.created`, expecting *something with
|
|
7
|
+
* intelligence* to answer with `wicked.interactive.draft.completed` carrying the first draft
|
|
8
|
+
* (the service then instruments `data-wid` anchors, themes it, and lands `_v1.html`). Today
|
|
9
|
+
* that answerer is an ad-hoc `assist` agent session. This module makes a crew-governed run the
|
|
10
|
+
* answerer instead — same bus vocabulary, zero interactive-service changes beyond the additive
|
|
11
|
+
* producer row (`wi-crew`) in interactive's events.js ownership table.
|
|
12
|
+
*
|
|
13
|
+
* Shape mirrors `qe/gate-events.ts` (crew's existing bus seam, Phase 6a): OPT-IN, dynamic
|
|
14
|
+
* wicked-bus import, graceful degradation when the bus is absent, durable cursor with
|
|
15
|
+
* `cursor_init: 'latest'` under a dedicated plugin name.
|
|
16
|
+
*
|
|
17
|
+
* Behavioral invariants honored (recon-verified against interactive):
|
|
18
|
+
* - Heartbeat: the canvas shows a working veil and the browser fires ~20s
|
|
19
|
+
* `status.requested` heartbeats; a silent answerer reads as a frozen UI. We narrate
|
|
20
|
+
* `wicked.interactive.status.posted` on every phase transition AND on a ≤15s timer.
|
|
21
|
+
* - Idempotency: the durable cursor redelivers under at-least-once semantics, and a replayed
|
|
22
|
+
* `doc.created` must not produce a duplicate `_v2.html`. A durable per-doc ledger
|
|
23
|
+
* (JSON file, atomic rename) gates the launch, and the final `draft.completed` emit carries
|
|
24
|
+
* a deterministic idempotency key (`crew:interactive.draft:<doc>:v1`) so even a double
|
|
25
|
+
* emit dedupes at the bus (WB-002).
|
|
26
|
+
* - INV-2 (`data-wid`): first drafts are whole documents with no pre-existing anchors — the
|
|
27
|
+
* service instruments fresh ones — so the worker contract explicitly forbids inventing
|
|
28
|
+
* `data-wid` attributes rather than requiring preservation. The feedback→edit leg (fragment
|
|
29
|
+
* preservation at scale) is the structural seam next door: edit-events.ts.
|
|
30
|
+
*/
|
|
31
|
+
import { mkdirSync, existsSync, statSync } from 'node:fs';
|
|
32
|
+
import { join } from 'node:path';
|
|
33
|
+
import { homedir } from 'node:os';
|
|
34
|
+
import { randomUUID } from 'node:crypto';
|
|
35
|
+
import { InteractiveHandoffLedger } from './ledger.js';
|
|
36
|
+
// ── Vocabulary constants (interactive's, verbatim — src/service/events.js is the truth) ──────
|
|
37
|
+
export const INTERACTIVE_DOMAIN = 'wicked-interactive';
|
|
38
|
+
export const DOC_CREATED = 'wicked.interactive.doc.created';
|
|
39
|
+
export const DRAFT_COMPLETED = 'wicked.interactive.draft.completed';
|
|
40
|
+
export const STATUS_POSTED = 'wicked.interactive.status.posted';
|
|
41
|
+
/** Exact-type filter with a domain guard — no wildcard, one event type is the whole trigger. */
|
|
42
|
+
export const INTERACTIVE_BUS_FILTER = `${DOC_CREATED}@${INTERACTIVE_DOMAIN}`;
|
|
43
|
+
/** Dedicated durable-cursor identity — NOT the qe subscriber's `wicked-crew`, so the two
|
|
44
|
+
* seams advance independent cursors and stopping one never strands the other. */
|
|
45
|
+
export const INTERACTIVE_BUS_PLUGIN = 'wicked-crew-interactive-draft';
|
|
46
|
+
/** The producer identity stamped on every event crew's interactive seams emit (this module and
|
|
47
|
+
* edit-events.ts). Must appear in interactive's events.js ownership table for DRAFT_COMPLETED,
|
|
48
|
+
* EDIT_COMPLETED, and STATUS_POSTED — the additive vocabulary rows that are the only
|
|
49
|
+
* interactive changes Phase 7c is allowed. */
|
|
50
|
+
export const INTERACTIVE_PRODUCER = 'wi-crew';
|
|
51
|
+
/** Interactive's doc-name grammar (server.js DOC_NAME) — re-checked before any launch so a
|
|
52
|
+
* malformed document_id can't name a ledger key or a draft file path. Shared with the
|
|
53
|
+
* structural-edit seam (edit-events.ts), which guards the same identity. */
|
|
54
|
+
export const DOC_NAME = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
55
|
+
// ── The workflow (workflows-as-data) ─────────────────────────────────────────────────────────
|
|
56
|
+
export const INTERACTIVE_DRAFT_WORKFLOW = 'interactive-draft';
|
|
57
|
+
/**
|
|
58
|
+
* The governed workflow that produces a first draft. Two agent phases — outline (recon) then
|
|
59
|
+
* draft (build, creator role) — so the run narrates a real phase transition and the drafting
|
|
60
|
+
* worker builds on a planned structure instead of one-shotting the whole document.
|
|
61
|
+
*
|
|
62
|
+
* The phase `instructions` adapt the draft-production contract from interactive's assist skill
|
|
63
|
+
* (Step 5): honor the brief/sources/style, ground content in what the brief supports, produce a
|
|
64
|
+
* complete self-contained HTML document, and NEVER mint `data-wid` attributes (the service
|
|
65
|
+
* instruments fresh anchors itself). They are SINGLE-LINE by contract: the engine folds
|
|
66
|
+
* instructions onto the unit description with a single-line separator, and the PTY seat runner
|
|
67
|
+
* refuses any prompt carrying an embedded newline (wicked-core FINDING-011).
|
|
68
|
+
*
|
|
69
|
+
* All gates are `auto` with `validator_pin: null` — no human gate, no deterministic floor —
|
|
70
|
+
* because the acceptance gate for a draft is the INTERACTIVE side (the service's INV-2
|
|
71
|
+
* instrument+theme pipeline and the user's own eyes on the canvas). Registered via
|
|
72
|
+
* `adapter.registerWorkflow()` at arm time (validate-before-persist, hot-registered into the
|
|
73
|
+
* engine), not added to BUILTIN_WORKFLOWS: this def is crew-only data owned by this seam, not a
|
|
74
|
+
* mirror of a wicked-core drop-in.
|
|
75
|
+
*/
|
|
76
|
+
export const INTERACTIVE_DRAFT_WORKFLOW_DEF = {
|
|
77
|
+
id: INTERACTIVE_DRAFT_WORKFLOW,
|
|
78
|
+
is_system: true,
|
|
79
|
+
phases: [
|
|
80
|
+
{
|
|
81
|
+
id: 'outline',
|
|
82
|
+
kind: 'recon',
|
|
83
|
+
instructions: 'Plan the document, do not write it yet: read the brief (and any source files/folders named in the task, expanding ~), then produce a concise outline — the sections in order, the key points each section carries, and the tone/format guidance the draft phase must honor for the requested style (web = rich scrollable page; ppt = fixed landscape slides; brochure = landscape print pages; doc = minimal content-first prose). Never invent facts, numbers, or claims the brief and sources do not support; where material is thin, plan honest placeholder copy that says what belongs there. Output the outline as plain text. Do NOT write HTML and do NOT create any files in this phase.',
|
|
84
|
+
gate_type: 'value',
|
|
85
|
+
gate: 'auto',
|
|
86
|
+
executes_code: false,
|
|
87
|
+
verified_evidence: false,
|
|
88
|
+
required_deliverables: [],
|
|
89
|
+
depends_on: [],
|
|
90
|
+
role: 'neutral',
|
|
91
|
+
skill_ref: null,
|
|
92
|
+
allowed_skills: [],
|
|
93
|
+
validator_pin: null,
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: 'draft',
|
|
97
|
+
kind: 'build',
|
|
98
|
+
instructions: 'Using the outline from the prior phase, write the COMPLETE first-draft HTML document and SAVE it to the absolute output file named in the task (create parent directories if needed, overwrite if present) — the file on disk is the deliverable, so write it before you finish and end your reply with the absolute path you wrote. Contract: a full self-contained HTML document (inline CSS, no external network resources, no build step); honor the requested style/format and the brief; keep every fact grounded in the brief/sources — never fabricate figures; do NOT add data-wid attributes anywhere (the wicked-interactive service instruments its own anchors); keep the markup semantic and well-formed (balanced tags) so the instrumentation pass lands cleanly.',
|
|
99
|
+
gate_type: 'execution',
|
|
100
|
+
gate: 'auto',
|
|
101
|
+
executes_code: false,
|
|
102
|
+
verified_evidence: false,
|
|
103
|
+
required_deliverables: [],
|
|
104
|
+
depends_on: ['outline'],
|
|
105
|
+
role: 'creator',
|
|
106
|
+
skill_ref: null,
|
|
107
|
+
allowed_skills: [],
|
|
108
|
+
validator_pin: null,
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Parse a bus frame into a {@link SourceDocCreated}, or `null` when it is not an actionable
|
|
114
|
+
* `doc.created` (wrong type, non-`source` kind, missing/malformed document_id). `kind: "demo"`
|
|
115
|
+
* and plain html docs are the assist loop's business, not this seam's.
|
|
116
|
+
*/
|
|
117
|
+
export function parseSourceDocCreated(eventType, payload) {
|
|
118
|
+
if (eventType !== DOC_CREATED)
|
|
119
|
+
return null;
|
|
120
|
+
if (typeof payload !== 'object' || payload === null)
|
|
121
|
+
return null;
|
|
122
|
+
const p = payload;
|
|
123
|
+
if (p['kind'] !== 'source')
|
|
124
|
+
return null;
|
|
125
|
+
const documentId = typeof p['document_id'] === 'string' ? p['document_id'] : '';
|
|
126
|
+
if (!DOC_NAME.test(documentId))
|
|
127
|
+
return null;
|
|
128
|
+
const brief = typeof p['brief'] === 'string' ? p['brief'] : '';
|
|
129
|
+
const sourcePaths = Array.isArray(p['source_paths'])
|
|
130
|
+
? p['source_paths'].filter((s) => typeof s === 'string' && s.length > 0)
|
|
131
|
+
: [];
|
|
132
|
+
const style = typeof p['style'] === 'string' && p['style'].length > 0 ? p['style'] : 'web';
|
|
133
|
+
const projectId = typeof p['project_id'] === 'string' && p['project_id'].length > 0 ? p['project_id'] : undefined;
|
|
134
|
+
// Only project-bound docs route through crew; unbound docs are the assist skill's solo business.
|
|
135
|
+
if (projectId === undefined)
|
|
136
|
+
return null;
|
|
137
|
+
return { documentId, brief, sourcePaths, style, projectId };
|
|
138
|
+
}
|
|
139
|
+
/** Collapse whitespace/newlines to single spaces and cap length — the intent must stay a
|
|
140
|
+
* single line (the PTY seat runner refuses embedded newlines) and a pasted-novel brief must
|
|
141
|
+
* not balloon the worker prompt. Shared with the structural-edit seam. */
|
|
142
|
+
export function oneLine(text, cap) {
|
|
143
|
+
const flat = text.replace(/\s+/g, ' ').trim();
|
|
144
|
+
return flat.length > cap ? `${flat.slice(0, cap)}…` : flat;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* The run's problem statement (the engine scopes it per phase and folds each phase's
|
|
148
|
+
* instructions on top). Carries everything doc-specific: identity, brief, sources, style, and
|
|
149
|
+
* the absolute path the finished HTML must land at.
|
|
150
|
+
*/
|
|
151
|
+
export function draftProblem(doc, outPath) {
|
|
152
|
+
const sources = doc.sourcePaths.length > 0
|
|
153
|
+
? `Source materials to read: ${doc.sourcePaths.join(', ')}.`
|
|
154
|
+
: 'There are no source files — the brief alone is the spec.';
|
|
155
|
+
const brief = doc.brief.length > 0 ? oneLine(doc.brief, 2000) : '(no brief provided)';
|
|
156
|
+
return (`Produce the first draft of the wicked-interactive document "${doc.documentId}" ` +
|
|
157
|
+
`(requested style: ${doc.style}). The user's brief: ${brief} ${sources} ` +
|
|
158
|
+
`The finished draft MUST be written to exactly this absolute file path: ${outPath}`);
|
|
159
|
+
}
|
|
160
|
+
/** Deterministic bus idempotency key for the one draft this seam may land per document. */
|
|
161
|
+
export function draftIdempotencyKey(documentId) {
|
|
162
|
+
return `crew:interactive.draft:${documentId}:v1`;
|
|
163
|
+
}
|
|
164
|
+
// ── Durable per-doc ledger (replay-dedup across redelivery AND daemon restarts) ──────────────
|
|
165
|
+
//
|
|
166
|
+
// The ledger implementation now lives in ledger.ts (shared with the structural-edit seam);
|
|
167
|
+
// this leg keys it by DOCUMENT ID — one first draft per document lifetime. Re-exported here so
|
|
168
|
+
// the seam's public surface stays one module.
|
|
169
|
+
export { InteractiveHandoffLedger } from './ledger.js';
|
|
170
|
+
function defaultStateDir() {
|
|
171
|
+
return join(homedir(), '.wicked-crew');
|
|
172
|
+
}
|
|
173
|
+
/** The production council roster, resolved lazily through the adapter's own class so this module
|
|
174
|
+
* never imports the native addon at runtime (unit tests pass `clisJson` and a fake adapter). */
|
|
175
|
+
function rosterOf(adapter) {
|
|
176
|
+
return adapter.constructor.roster();
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Arm the seam: register the `interactive-draft` workflow, open a durable
|
|
180
|
+
* `wicked.interactive.doc.created` subscription, and answer each `kind: "source"` creation
|
|
181
|
+
* with a governed run that ends in `wicked.interactive.draft.completed`.
|
|
182
|
+
*
|
|
183
|
+
* Graceful degradation mirrors `startQeGateSubscriber`: a missing wicked-bus package or an
|
|
184
|
+
* unopenable db LOGS and returns `null` — the daemon must still boot on a machine whose bus is
|
|
185
|
+
* broken; interactive's assist loop remains the (always-available) fallback answerer.
|
|
186
|
+
*/
|
|
187
|
+
export async function startInteractiveDraftSubscriber(adapter, opts = {}) {
|
|
188
|
+
const log = opts.log ?? ((m) => console.error(m));
|
|
189
|
+
let bus;
|
|
190
|
+
try {
|
|
191
|
+
bus = await import('wicked-bus');
|
|
192
|
+
}
|
|
193
|
+
catch (err) {
|
|
194
|
+
log(`[interactive-draft] wicked-bus is not importable — governed drafting disabled: ${err instanceof Error ? err.message : String(err)}`);
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
let db;
|
|
198
|
+
let config;
|
|
199
|
+
try {
|
|
200
|
+
config = bus.loadConfig(opts.dbPath !== undefined ? { db_path: opts.dbPath } : {});
|
|
201
|
+
db = bus.openDb(opts.dbPath !== undefined ? { db_path: opts.dbPath } : {});
|
|
202
|
+
}
|
|
203
|
+
catch (err) {
|
|
204
|
+
log(`[interactive-draft] could not open the bus db${opts.dbPath !== undefined ? ` at ${opts.dbPath}` : ''} — governed drafting disabled: ${err instanceof Error ? err.message : String(err)}`);
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
// The workflow rides the normal registration path — core validates the def BEFORE it is
|
|
208
|
+
// persisted/hot-registered (FINDING-002 ordering), so a drifted def fails the arm loudly
|
|
209
|
+
// instead of failing the first launch obscurely.
|
|
210
|
+
try {
|
|
211
|
+
await adapter.registerWorkflow(INTERACTIVE_DRAFT_WORKFLOW_DEF);
|
|
212
|
+
}
|
|
213
|
+
catch (err) {
|
|
214
|
+
log(`[interactive-draft] could not register the '${INTERACTIVE_DRAFT_WORKFLOW}' workflow — ` +
|
|
215
|
+
`governed drafting disabled: ${err instanceof Error ? err.message : String(err)}`);
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
const ledger = new InteractiveHandoffLedger(opts.ledgerPath ?? join(defaultStateDir(), 'interactive-draft-ledger.json'));
|
|
219
|
+
const draftDir = opts.draftDir ?? join(defaultStateDir(), 'interactive-drafts');
|
|
220
|
+
const heartbeatMs = opts.heartbeatMs ?? 15_000;
|
|
221
|
+
const phaseCount = INTERACTIVE_DRAFT_WORKFLOW_DEF.phases.length;
|
|
222
|
+
const inFlight = new Map(); // runId → live state
|
|
223
|
+
/** Emit onto interactive's vocabulary as the `wi-crew` producer. Never throws into the
|
|
224
|
+
* caller: narration/announce failures are logged — a lost status line must not kill the
|
|
225
|
+
* subscription, and a duplicate draft emit (WB-002) is the idempotency key WORKING. */
|
|
226
|
+
function emitInteractive(type, payload, idempotencyKey) {
|
|
227
|
+
try {
|
|
228
|
+
bus.emit(db, config, {
|
|
229
|
+
event_type: type,
|
|
230
|
+
domain: INTERACTIVE_DOMAIN,
|
|
231
|
+
subdomain: type === DRAFT_COMPLETED ? 'generation' : 'status',
|
|
232
|
+
payload: { ts: new Date().toISOString(), ...payload },
|
|
233
|
+
producer_id: INTERACTIVE_PRODUCER,
|
|
234
|
+
...(idempotencyKey !== undefined ? { idempotency_key: idempotencyKey } : {}),
|
|
235
|
+
});
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
catch (err) {
|
|
239
|
+
const code = err.error;
|
|
240
|
+
if (code === 'WB-002') {
|
|
241
|
+
// Duplicate idempotency key — the emit already happened (redelivery race). Success.
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
log(`[interactive-draft] emit ${type} failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
function narrate(flight, message) {
|
|
249
|
+
flight.narration = message;
|
|
250
|
+
emitInteractive(STATUS_POSTED, {
|
|
251
|
+
document_id: flight.documentId,
|
|
252
|
+
state: 'working',
|
|
253
|
+
message,
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
function endFlight(runId) {
|
|
257
|
+
const flight = inFlight.get(runId);
|
|
258
|
+
if (flight) {
|
|
259
|
+
clearInterval(flight.heartbeat);
|
|
260
|
+
inFlight.delete(runId);
|
|
261
|
+
}
|
|
262
|
+
return flight;
|
|
263
|
+
}
|
|
264
|
+
/** Terminal-event fold: turn the governed run's own events into interactive narration, and
|
|
265
|
+
* close the loop with `draft.completed` when the run lands. */
|
|
266
|
+
const offCoreEvents = adapter.onEvent((event) => {
|
|
267
|
+
const runId = typeof event.session === 'string' ? event.session : undefined;
|
|
268
|
+
if (runId === undefined)
|
|
269
|
+
return;
|
|
270
|
+
const flight = inFlight.get(runId);
|
|
271
|
+
if (flight === undefined)
|
|
272
|
+
return;
|
|
273
|
+
// Narration ladder (#user-feedback 2026-08-14): the heartbeat repeats the LATEST line, and
|
|
274
|
+
// the interactive transcript dedups consecutive repeats — so the more the line ADVANCES with
|
|
275
|
+
// the run's real events, the more the thread reads as progress instead of a stuck echo.
|
|
276
|
+
const phaseName = (ord) => INTERACTIVE_DRAFT_WORKFLOW_DEF.phases[ord - 1]?.id ?? `phase ${ord}`;
|
|
277
|
+
if (event.type === 'councilConvened') {
|
|
278
|
+
const ord = typeof event.ord === 'number' ? event.ord : 0;
|
|
279
|
+
const seats = Array.isArray(event.clis) ? event.clis.length : 0;
|
|
280
|
+
// "0-seat council" reads like a bug — generic phrasing whenever clis is missing or empty
|
|
281
|
+
// (Copilot, #269).
|
|
282
|
+
const council = seats > 0 ? `a ${seats}-seat council` : 'a council';
|
|
283
|
+
narrate(flight, `Convening ${council} to pick who ${ord >= phaseCount ? 'writes the draft' : 'plans the outline'}…`);
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
if (event.type === 'unitDistributed') {
|
|
287
|
+
const ord = typeof event.ord === 'number' ? event.ord : 0;
|
|
288
|
+
const who = typeof event.cli === 'string' ? event.cli : 'a worker';
|
|
289
|
+
const pct = typeof event.agreement_pct === 'number' ? ` (${event.agreement_pct}% agreement)` : '';
|
|
290
|
+
narrate(flight, `Council picked ${who} for ${phaseName(ord)}${pct}…`);
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
if (event.type === 'unitDispatched') {
|
|
294
|
+
const ord = typeof event.ord === 'number' ? event.ord : 0;
|
|
295
|
+
const phase = phaseName(ord);
|
|
296
|
+
narrate(flight, ord >= phaseCount
|
|
297
|
+
? `Crew phase ${ord}/${phaseCount}: writing the draft (${phase})…`
|
|
298
|
+
: `Crew phase ${ord}/${phaseCount}: ${phase} — planning the document…`);
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
if (event.type === 'toolInvoked') {
|
|
302
|
+
const tools = Array.isArray(event.tools) ? [...new Set(event.tools)].join(', ') : '';
|
|
303
|
+
if (tools)
|
|
304
|
+
narrate(flight, `Worker is using ${tools} on your document…`);
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
if (event.type === 'unitOutputCaptured') {
|
|
308
|
+
const ord = typeof event.ord === 'number' ? event.ord : 0;
|
|
309
|
+
narrate(flight, `${phaseName(ord)} finished — the governance gate is reviewing it…`);
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
if (event.type === 'gateDecided' && event.allow === true) {
|
|
313
|
+
const ord = typeof event.ord === 'number' ? event.ord : 0;
|
|
314
|
+
narrate(flight, ord >= phaseCount
|
|
315
|
+
? 'Gate approved the draft — landing it now…'
|
|
316
|
+
: `Gate approved ${phaseName(ord)} — moving on…`);
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
if (event.type === 'acpFallback') {
|
|
320
|
+
const who = typeof event.cliKey === 'string' ? event.cliKey : 'the worker';
|
|
321
|
+
narrate(flight, `${who}'s live session dropped — continuing in single-shot mode…`);
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
if (event.type === 'sessionCompleted') {
|
|
325
|
+
endFlight(runId);
|
|
326
|
+
finalize(flight, runId);
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
if (event.type === 'sessionFailed' || event.type === 'runCancelled') {
|
|
330
|
+
endFlight(runId);
|
|
331
|
+
ledger.recordFailure(flight.documentId);
|
|
332
|
+
emitInteractive(STATUS_POSTED, {
|
|
333
|
+
document_id: flight.documentId,
|
|
334
|
+
state: 'error',
|
|
335
|
+
message: `The crew run answering this document ${event.type === 'runCancelled' ? 'was cancelled' : 'failed'} ` +
|
|
336
|
+
`(run ${runId}). Inspect it via the crew API (GET /api/v1/runs/${runId}); the assist loop can still take over.`,
|
|
337
|
+
});
|
|
338
|
+
log(`[interactive-draft] run ${runId} for doc ${flight.documentId} ended: ${event.type}`);
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
function finalize(flight, runId) {
|
|
342
|
+
const { documentId, outPath } = flight;
|
|
343
|
+
let ok = false;
|
|
344
|
+
try {
|
|
345
|
+
ok = existsSync(outPath) && statSync(outPath).size > 0;
|
|
346
|
+
}
|
|
347
|
+
catch {
|
|
348
|
+
ok = false;
|
|
349
|
+
}
|
|
350
|
+
if (!ok) {
|
|
351
|
+
ledger.recordFailure(documentId);
|
|
352
|
+
emitInteractive(STATUS_POSTED, {
|
|
353
|
+
document_id: documentId,
|
|
354
|
+
state: 'error',
|
|
355
|
+
message: `The crew run completed but produced no draft file at ${outPath} (run ${runId}).`,
|
|
356
|
+
});
|
|
357
|
+
log(`[interactive-draft] run ${runId} completed but ${outPath} is missing/empty`);
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
// ADR-0019 D5: announce by path — the service reads the file itself, so a large draft
|
|
361
|
+
// never rides the bus payload. The deterministic key makes a re-announce a WB-002 no-op.
|
|
362
|
+
const emitted = emitInteractive(DRAFT_COMPLETED, { document_id: documentId, html_path: outPath }, draftIdempotencyKey(documentId));
|
|
363
|
+
if (!emitted) {
|
|
364
|
+
// The bus refused the announce (non-WB-002): the draft exists on disk but never reached
|
|
365
|
+
// the service. Fail HONEST — leaving the ledger row launched-but-never-closed would
|
|
366
|
+
// silently eat every replay of this doc (the launch gate is `ledger.has`).
|
|
367
|
+
ledger.recordFailure(documentId);
|
|
368
|
+
emitInteractive(STATUS_POSTED, {
|
|
369
|
+
document_id: documentId,
|
|
370
|
+
state: 'error',
|
|
371
|
+
message: `Crew finished the draft but could not announce it on the bus (run ${runId}); ` +
|
|
372
|
+
`the draft file is at ${outPath}. Inspect the crew daemon log.`,
|
|
373
|
+
});
|
|
374
|
+
log(`[interactive-draft] draft.completed emit FAILED for doc ${documentId} (run ${runId}) — recorded as failure`);
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
ledger.recordEmitted(documentId);
|
|
378
|
+
emitInteractive(STATUS_POSTED, {
|
|
379
|
+
document_id: documentId,
|
|
380
|
+
state: 'complete',
|
|
381
|
+
message: 'First draft is in — landing it on the canvas now. Click any block to refine it.',
|
|
382
|
+
});
|
|
383
|
+
log(`[interactive-draft] draft.completed emitted for doc ${documentId} (run ${runId})`);
|
|
384
|
+
}
|
|
385
|
+
async function handleDocCreated(event) {
|
|
386
|
+
const doc = parseSourceDocCreated(event.event_type, event.payload);
|
|
387
|
+
if (doc === null)
|
|
388
|
+
return;
|
|
389
|
+
// Replay-dedup: the ledger is the durable gate (redelivery after crash/restart), the
|
|
390
|
+
// in-flight scan the live one (redelivery inside a single process lifetime).
|
|
391
|
+
if (ledger.has(doc.documentId)) {
|
|
392
|
+
log(`[interactive-draft] doc ${doc.documentId} already answered (run ${ledger.get(doc.documentId)?.runId}) — replay ignored`);
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
for (const f of inFlight.values()) {
|
|
396
|
+
if (f.documentId === doc.documentId)
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
mkdirSync(draftDir, { recursive: true });
|
|
400
|
+
const outPath = join(draftDir, `${doc.documentId}-v1.html`);
|
|
401
|
+
const runId = randomUUID();
|
|
402
|
+
emitInteractive(STATUS_POSTED, {
|
|
403
|
+
document_id: doc.documentId,
|
|
404
|
+
state: 'processing',
|
|
405
|
+
message: 'A governed crew picked up your brief — planning the draft…',
|
|
406
|
+
});
|
|
407
|
+
try {
|
|
408
|
+
await adapter.launchRun({
|
|
409
|
+
problem: draftProblem(doc, outPath),
|
|
410
|
+
sessionId: runId,
|
|
411
|
+
clisJson: opts.clisJson ?? JSON.stringify(rosterOf(adapter)),
|
|
412
|
+
workflow: INTERACTIVE_DRAFT_WORKFLOW,
|
|
413
|
+
// A project-bound doc's governed draft is FILED (P7 gate DEFECT-1): the engine attaches
|
|
414
|
+
// the crew.run membership atomically with the launch, so the run shows up in the
|
|
415
|
+
// project's activity feed instead of floating unattributed.
|
|
416
|
+
projectId: doc.projectId,
|
|
417
|
+
// The task text names `outPath` (inside draftDir) as the deliverable, which sits OUTSIDE
|
|
418
|
+
// the unit's sandbox — on the wrapped-CLI path the boundary denied that exact write and
|
|
419
|
+
// failed the run AFTER the draft was produced (crew#263, run eed69dfa). Declare the inbox
|
|
420
|
+
// so the engine widens the boundary by exactly this root (validated launch-side,
|
|
421
|
+
// wicked-core#259).
|
|
422
|
+
extraWriteRoots: [draftDir],
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
catch (err) {
|
|
426
|
+
// The 'processing' status is already on the thread — close it out honestly so the
|
|
427
|
+
// canvas never sits in an in-between state on a launch that went nowhere.
|
|
428
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
429
|
+
emitInteractive(STATUS_POSTED, {
|
|
430
|
+
document_id: doc.documentId,
|
|
431
|
+
state: 'error',
|
|
432
|
+
message: `Crew could not start a run for this document: ${reason}. The assist loop can still take over.`,
|
|
433
|
+
});
|
|
434
|
+
// DELIBERATELY no ledger write: only an answered doc earns a row, so an operator can
|
|
435
|
+
// replay the dead-lettered doc.created after fixing the daemon and get a real retry.
|
|
436
|
+
// Re-throw so the bus (maxRetries 0) dead-letters the frame — visible, replayable,
|
|
437
|
+
// and incapable of hot-looping.
|
|
438
|
+
throw err;
|
|
439
|
+
}
|
|
440
|
+
// Record AFTER the launch resolved: a failed launch leaves no ledger row, so a replayed
|
|
441
|
+
// delivery retries. The crash window between launch and this write is the reason the
|
|
442
|
+
// draft emit ALSO carries a deterministic idempotency key.
|
|
443
|
+
ledger.recordLaunch(doc.documentId, runId);
|
|
444
|
+
opts.onRunFiled?.(runId, doc.projectId);
|
|
445
|
+
const flight = {
|
|
446
|
+
documentId: doc.documentId,
|
|
447
|
+
outPath,
|
|
448
|
+
narration: 'Crew run launched — working on your draft…',
|
|
449
|
+
heartbeat: setInterval(() => {
|
|
450
|
+
// Repeat the last real narration so the ~20s status.requested window is always fed,
|
|
451
|
+
// even mid-phase when the engine is quiet.
|
|
452
|
+
emitInteractive(STATUS_POSTED, {
|
|
453
|
+
document_id: flight.documentId,
|
|
454
|
+
state: 'working',
|
|
455
|
+
message: flight.narration,
|
|
456
|
+
});
|
|
457
|
+
}, heartbeatMs),
|
|
458
|
+
// Do not keep the daemon alive for narration alone.
|
|
459
|
+
};
|
|
460
|
+
flight.heartbeat.unref?.();
|
|
461
|
+
inFlight.set(runId, flight);
|
|
462
|
+
log(`[interactive-draft] doc ${doc.documentId} → governed run ${runId} (draft → ${outPath})`);
|
|
463
|
+
}
|
|
464
|
+
const sub = bus.subscribe({
|
|
465
|
+
db,
|
|
466
|
+
plugin: INTERACTIVE_BUS_PLUGIN,
|
|
467
|
+
filter: INTERACTIVE_BUS_FILTER,
|
|
468
|
+
// Live triggers only: replaying a bus backlog would answer docs whose drafts the assist
|
|
469
|
+
// loop long since produced. History reconciliation belongs to the state plane, not here.
|
|
470
|
+
cursor_init: 'latest',
|
|
471
|
+
pollIntervalMs: opts.pollIntervalMs ?? 2000,
|
|
472
|
+
// Our own ledger + idempotency key are the dedupe; a bus-level retry of a failed launch
|
|
473
|
+
// would double-launch precisely because the ledger row is only written on success.
|
|
474
|
+
maxRetries: 0,
|
|
475
|
+
handler: (event) => handleDocCreated(event),
|
|
476
|
+
onError: (err, event) => {
|
|
477
|
+
log(`[interactive-draft] handler error on event ${String(event?.event_id ?? '?')}: ${err.message}`);
|
|
478
|
+
},
|
|
479
|
+
});
|
|
480
|
+
return {
|
|
481
|
+
ledger,
|
|
482
|
+
stop: async () => {
|
|
483
|
+
offCoreEvents();
|
|
484
|
+
for (const runId of [...inFlight.keys()])
|
|
485
|
+
endFlight(runId);
|
|
486
|
+
await sub.stop();
|
|
487
|
+
},
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
//# sourceMappingURL=draft-events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draft-events.js","sourceRoot":"","sources":["../../src/interactive/draft-events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAIvD,gGAAgG;AAEhG,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AACvD,MAAM,CAAC,MAAM,WAAW,GAAG,gCAAgC,CAAC;AAC5D,MAAM,CAAC,MAAM,eAAe,GAAG,oCAAoC,CAAC;AACpE,MAAM,CAAC,MAAM,aAAa,GAAG,kCAAkC,CAAC;AAEhE,gGAAgG;AAChG,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,WAAW,IAAI,kBAAkB,EAAE,CAAC;AAE7E;kFACkF;AAClF,MAAM,CAAC,MAAM,sBAAsB,GAAG,+BAA+B,CAAC;AAEtE;;;+CAG+C;AAC/C,MAAM,CAAC,MAAM,oBAAoB,GAAG,SAAS,CAAC;AAE9C;;6EAE6E;AAC7E,MAAM,CAAC,MAAM,QAAQ,GAAG,2BAA2B,CAAC;AAEpD,gGAAgG;AAEhG,MAAM,CAAC,MAAM,0BAA0B,GAAG,mBAAmB,CAAC;AAE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