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.
Files changed (132) hide show
  1. package/dist/api/api-prefix.d.ts +13 -0
  2. package/dist/api/api-prefix.d.ts.map +1 -0
  3. package/dist/api/api-prefix.js +13 -0
  4. package/dist/api/api-prefix.js.map +1 -0
  5. package/dist/api/audit.d.ts +57 -0
  6. package/dist/api/audit.d.ts.map +1 -0
  7. package/dist/api/audit.js +115 -0
  8. package/dist/api/audit.js.map +1 -0
  9. package/dist/api/auth.d.ts +192 -0
  10. package/dist/api/auth.d.ts.map +1 -0
  11. package/dist/api/auth.js +515 -0
  12. package/dist/api/auth.js.map +1 -0
  13. package/dist/api/evidence.d.ts +11 -0
  14. package/dist/api/evidence.d.ts.map +1 -1
  15. package/dist/api/evidence.js +8 -3
  16. package/dist/api/evidence.js.map +1 -1
  17. package/dist/api/gate-cache.d.ts +8 -0
  18. package/dist/api/gate-cache.d.ts.map +1 -1
  19. package/dist/api/gate-cache.js +10 -0
  20. package/dist/api/gate-cache.js.map +1 -1
  21. package/dist/api/open-path.d.ts +18 -0
  22. package/dist/api/open-path.d.ts.map +1 -0
  23. package/dist/api/open-path.js +79 -0
  24. package/dist/api/open-path.js.map +1 -0
  25. package/dist/api/routes.d.ts +113 -1
  26. package/dist/api/routes.d.ts.map +1 -1
  27. package/dist/api/routes.js +516 -27
  28. package/dist/api/routes.js.map +1 -1
  29. package/dist/api/seat-health.d.ts +55 -0
  30. package/dist/api/seat-health.d.ts.map +1 -0
  31. package/dist/api/seat-health.js +273 -0
  32. package/dist/api/seat-health.js.map +1 -0
  33. package/dist/api/seat-signin.d.ts +27 -0
  34. package/dist/api/seat-signin.d.ts.map +1 -0
  35. package/dist/api/seat-signin.js +143 -0
  36. package/dist/api/seat-signin.js.map +1 -0
  37. package/dist/api/server.d.ts +111 -3
  38. package/dist/api/server.d.ts.map +1 -1
  39. package/dist/api/server.js +236 -11
  40. package/dist/api/server.js.map +1 -1
  41. package/dist/api/unit-output.d.ts +62 -0
  42. package/dist/api/unit-output.d.ts.map +1 -0
  43. package/dist/api/unit-output.js +108 -0
  44. package/dist/api/unit-output.js.map +1 -0
  45. package/dist/cli/index.js +97 -3
  46. package/dist/cli/index.js.map +1 -1
  47. package/dist/cli/mcp.d.ts +14 -0
  48. package/dist/cli/mcp.d.ts.map +1 -0
  49. package/dist/cli/mcp.js +119 -0
  50. package/dist/cli/mcp.js.map +1 -0
  51. package/dist/core/adapter.d.ts +106 -1
  52. package/dist/core/adapter.d.ts.map +1 -1
  53. package/dist/core/adapter.js +293 -12
  54. package/dist/core/adapter.js.map +1 -1
  55. package/dist/core/bridge-path.d.ts +17 -6
  56. package/dist/core/bridge-path.d.ts.map +1 -1
  57. package/dist/core/bridge-path.js +17 -6
  58. package/dist/core/bridge-path.js.map +1 -1
  59. package/dist/core/types.d.ts +23 -352
  60. package/dist/core/types.d.ts.map +1 -1
  61. package/dist/core/types.js +11 -4
  62. package/dist/core/types.js.map +1 -1
  63. package/dist/interactive/bridge-pool.d.ts +71 -0
  64. package/dist/interactive/bridge-pool.d.ts.map +1 -0
  65. package/dist/interactive/bridge-pool.js +187 -0
  66. package/dist/interactive/bridge-pool.js.map +1 -0
  67. package/dist/interactive/bridge-root.d.ts +36 -0
  68. package/dist/interactive/bridge-root.d.ts.map +1 -0
  69. package/dist/interactive/bridge-root.js +48 -0
  70. package/dist/interactive/bridge-root.js.map +1 -0
  71. package/dist/interactive/draft-events.d.ts +144 -0
  72. package/dist/interactive/draft-events.d.ts.map +1 -0
  73. package/dist/interactive/draft-events.js +490 -0
  74. package/dist/interactive/draft-events.js.map +1 -0
  75. package/dist/interactive/edit-events.d.ts +172 -0
  76. package/dist/interactive/edit-events.d.ts.map +1 -0
  77. package/dist/interactive/edit-events.js +530 -0
  78. package/dist/interactive/edit-events.js.map +1 -0
  79. package/dist/interactive/ledger.d.ts +39 -0
  80. package/dist/interactive/ledger.d.ts.map +1 -0
  81. package/dist/interactive/ledger.js +93 -0
  82. package/dist/interactive/ledger.js.map +1 -0
  83. package/dist/interactive/proxy-routes.d.ts +39 -0
  84. package/dist/interactive/proxy-routes.d.ts.map +1 -0
  85. package/dist/interactive/proxy-routes.js +189 -0
  86. package/dist/interactive/proxy-routes.js.map +1 -0
  87. package/dist/interactive/ws-relay.d.ts +85 -0
  88. package/dist/interactive/ws-relay.d.ts.map +1 -0
  89. package/dist/interactive/ws-relay.js +191 -0
  90. package/dist/interactive/ws-relay.js.map +1 -0
  91. package/dist/projects/activity.d.ts +29 -0
  92. package/dist/projects/activity.d.ts.map +1 -0
  93. package/dist/projects/activity.js +172 -0
  94. package/dist/projects/activity.js.map +1 -0
  95. package/dist/projects/charter.d.ts +28 -0
  96. package/dist/projects/charter.d.ts.map +1 -0
  97. package/dist/projects/charter.js +53 -0
  98. package/dist/projects/charter.js.map +1 -0
  99. package/dist/projects/events.d.ts +55 -0
  100. package/dist/projects/events.d.ts.map +1 -0
  101. package/dist/projects/events.js +141 -0
  102. package/dist/projects/events.js.map +1 -0
  103. package/dist/projects/membership-index.d.ts +25 -0
  104. package/dist/projects/membership-index.d.ts.map +1 -0
  105. package/dist/projects/membership-index.js +46 -0
  106. package/dist/projects/membership-index.js.map +1 -0
  107. package/dist/projects/routes.d.ts +90 -0
  108. package/dist/projects/routes.d.ts.map +1 -0
  109. package/dist/projects/routes.js +388 -0
  110. package/dist/projects/routes.js.map +1 -0
  111. package/dist/projects/settings.d.ts +32 -0
  112. package/dist/projects/settings.d.ts.map +1 -0
  113. package/dist/projects/settings.js +64 -0
  114. package/dist/projects/settings.js.map +1 -0
  115. package/dist/qe/acceptance.d.ts +137 -0
  116. package/dist/qe/acceptance.d.ts.map +1 -0
  117. package/dist/qe/acceptance.js +249 -0
  118. package/dist/qe/acceptance.js.map +1 -0
  119. package/dist/qe/gate-events.d.ts +111 -0
  120. package/dist/qe/gate-events.d.ts.map +1 -0
  121. package/dist/qe/gate-events.js +168 -0
  122. package/dist/qe/gate-events.js.map +1 -0
  123. package/dist/qe/ledger.d.ts +100 -0
  124. package/dist/qe/ledger.d.ts.map +1 -0
  125. package/dist/qe/ledger.js +154 -0
  126. package/dist/qe/ledger.js.map +1 -0
  127. package/dist/studio/assets/index-CCwXa1cn.js +428 -0
  128. package/dist/studio/assets/index-HWxo0h41.css +32 -0
  129. package/dist/studio/index.html +2 -2
  130. package/package.json +10 -4
  131. package/dist/studio/assets/index-Ci_R6ARr.js +0 -423
  132. package/dist/studio/assets/index-Dio_c1Q3.css +0 -32
@@ -2,114 +2,24 @@
2
2
  * Boundary types for the wicked-core-ts JSON surface.
3
3
  *
4
4
  * core-ts returns every complex result as a JSON string, which the adapter
5
- * `JSON.parse`s. These interfaces mirror the serde representation of
6
- * wicked-core's domain types (wicked-core/src/domain.rs, repo.rs, scope.rs) so
7
- * the daemon never falls back to `any` at the core boundary. They are permissive
8
- * about forward-additive fields — a newer core that adds fields still parses.
5
+ * `JSON.parse`s. The WIRE-SHAPE types — everything that flows on through the
6
+ * daemon's `/api/v1` + `/ws` surface (SessionView, CoreEvent, governance and
7
+ * workflow shapes, …) — live in the shared contract package
8
+ * `wicked-crew-api-types` and are re-exported here verbatim, so the route
9
+ * layer and the studio SPA compile against the SAME definitions and the two
10
+ * can no longer drift (task #84; `tests/wire-contract.test.ts` is the guard).
11
+ *
12
+ * What remains in THIS file is engine-internal: inputs the adapter maps onto
13
+ * the native addon (`LaunchRunInput`), shapes that never leave the daemon
14
+ * (`RepoOnboardRef`), and runtime constants (`DEFAULT_SETTINGS`) — a types-only
15
+ * contract package cannot carry values.
9
16
  *
10
17
  * ONLY `core/adapter.ts` imports from the native addon itself; the rest of the
11
18
  * daemon speaks these daemon-owned shapes, which is what quarantines the
12
19
  * FINALIZING core-ts `subscribe` seam to a single file (DES-STUDIO-001 §5.2).
13
20
  */
14
- /** Run-level lifecycle status (`SessionStatus`, snake_case serde token). */
15
- export type SessionStatus = 'planning' | 'distributing' | 'executing' | 'awaiting_human' | 'completed' | 'cancelled' | 'failed';
16
- /** Per-unit lifecycle status (`UnitStatus`). */
17
- export type UnitStatus = 'pending' | 'distributed' | 'done' | 'rejected';
18
- /** The methodology stage badge on a unit (`StageKind`). */
19
- export type StageKind = 'recon' | 'build' | 'review' | 'test';
20
- /** Collection-scope mode (`EntityMode`). */
21
- export type EntityMode = 'shared' | 'isolated';
22
- /** Human-confirm gate policy. serde: `None`→"none", `All`→"all", `Before(n)`→{ before: n }. */
23
- export type HumanConfirm = 'none' | 'all' | {
24
- before: number;
25
- };
26
- /** Why a CLI was assigned to a unit (`RoutingInfo`, internally tagged on `method`). */
27
- export type RoutingInfo =
28
- /**
29
- * `seated` is the seats CONVENED — the denominator `returned` must be read against.
30
- * Unknown on a run recorded by an engine older than the quorum fix; unknown means exactly that,
31
- * never "equal to `returned`" (FINDING-026 D).
32
- *
33
- * `number | null` AND optional because unknown arrives in both shapes: the engine serializes the
34
- * artifact's `Option<u32>` as an explicit `null`, and a payload predating the field has no key.
35
- * Test it with `== null` so both are covered.
36
- */
37
- {
38
- method: 'council';
39
- winner: string;
40
- agreement_pct: number;
41
- returned: number;
42
- seated?: number | null;
43
- dissent: number;
44
- } | {
45
- method: 'degraded';
46
- reason: string;
47
- } | {
48
- method: 'evaluator_distinct';
49
- winner: string;
50
- was: string;
51
- } | {
52
- method: 'tool';
53
- };
54
- /** A run (`AgentSession`). */
55
- export interface AgentSession {
56
- id: string;
57
- workflow_id: string;
58
- problem: string;
59
- entity_mode: EntityMode;
60
- collection_scope: string | null;
61
- clis: string[];
62
- status: SessionStatus;
63
- human_confirm: HumanConfirm;
64
- unit_ix: number;
65
- attempt: number;
66
- workdir: string | null;
67
- repo_ref: string | null;
68
- }
69
- /** An ordered unit of work within a run (`WorkUnit`). */
70
- export interface WorkUnit {
71
- id: string;
72
- session_id: string;
73
- ord: number;
74
- description: string;
75
- stage: StageKind;
76
- assigned_cli: string | null;
77
- assigned_invocation: string | null;
78
- council_task_ref: string | null;
79
- routing: RoutingInfo | null;
80
- denial_reason: string | null;
81
- phase_ref: string | null;
82
- conformance_ref: string | null;
83
- phase_status: string | null;
84
- collection_scope: string | null;
85
- status: UnitStatus;
86
- skill_ref?: string | null;
87
- /** The command this unit runs directly (Tool-executor phases). `null`/absent for Agent units. */
88
- tool_cmd?: string[] | null;
89
- }
90
- /** A run plus its ordered units — the read a UI builds its project list from (`SessionView`). */
91
- export interface SessionView {
92
- session: AgentSession;
93
- units: WorkUnit[];
94
- }
95
- /** A registered git repository (`RepoEntry`). */
96
- export interface RepoEntry {
97
- id: string;
98
- name: string;
99
- root_path: string;
100
- default_branch: string;
101
- registered_at: number;
102
- /** Remote git URL the repo was cloned from (undefined for locally-registered repos). */
103
- git_url?: string;
104
- /**
105
- * ABSOLUTE path of this repo's code graph, resolved by the engine (wicked-core#170).
106
- *
107
- * Optional in the TYPE, mandatory in practice: an addon predating the field omits it, and
108
- * `codeGraphDb()` in `repoPaths.ts` is where that turns into a loud error. Never join this path
109
- * yourself — six independent spellings is what FINDING-069 was.
110
- */
111
- code_graph_db?: string;
112
- }
21
+ export type * from 'wicked-crew-api-types';
22
+ import type { SystemSettings } from 'wicked-crew-api-types';
113
23
  /** The run id of the onboarding run started when a repo was registered. */
114
24
  export interface RepoOnboardRef {
115
25
  repoId: string;
@@ -131,259 +41,20 @@ export interface LaunchRunInput {
131
41
  repoRef?: string;
132
42
  /** Workflow def id to drive (e.g. `domain-extraction`). Omit ⇒ free-text planning. */
133
43
  workflow?: string;
134
- }
135
- /**
136
- * A CoreEvent frame as delivered by the live stream — a tagged-JSON object
137
- * discriminated on `type` (wicked-core-ts `event_to_json`). Known optional
138
- * fields are declared for the frames the daemon inspects; the index signature
139
- * keeps the shape additive-safe so new variants pass through untouched.
140
- */
141
- export interface CoreEvent {
142
- type: string;
143
- session?: string;
144
- ord?: number;
145
- prompt?: string;
146
- chunk?: string;
147
- allow?: boolean;
148
- cli?: string;
149
- description?: string;
150
- problem?: string;
151
- message?: string;
152
- /** `elicitationCreated`: the id minted by the actor for this elicitation round. */
153
- elicitationId?: string;
154
- /** `elicitationCreated`: an ordered set of valid responses; `null` / absent = free-text. */
155
- options?: string[] | null;
156
- /** PTY terminal frames (`terminalOpened`/`terminalOutput`/`terminalExited`): the terminal id. */
157
- id?: string;
158
44
  /**
159
- * A monotonic counter — but of WHAT depends on where the event came from, and the two never
160
- * appear together, so there is exactly one right reading per event:
161
- *
162
- * - **live `/ws` frame** — `terminalOutput` only, and it counts within that one terminal
163
- * (`actor.rs` `TerminalState::next_seq`). Two terminals both start at 0; comparing their `seq`
164
- * values means nothing.
165
- * - **entry from `runEvents`** — the durable log's own envelope counter, process-wide and stamped
166
- * at emit (`event_log.rs` `SEQ`), which is what `read_run` sorts on. It totals-orders a run,
167
- * which `ts` alone cannot: a burst from one actor turn shares a millisecond.
168
- *
169
- * They cannot collide, because `terminalOutput` is classed high-volume and is **never written to
170
- * the log** — so no payload ever carries both meanings. What that does forbid is merging the two
171
- * sources and sorting the result on this field: a live per-terminal 3 is not comparable to a
172
- * replayed envelope 4700. Sort a replay by `seq`; order live frames by arrival, per terminal id.
45
+ * Project to file this run into (DES-PROJECT-001 §2.2). The engine attaches the `crew.run`
46
+ * membership atomically with the launch record; unknown/archived ⇒ the launch fails with no
47
+ * session persisted. Omit ⇒ unfiled (the synthesized `default` project).
173
48
  */
174
- seq?: number;
175
- /** Capture time, epoch millis. Present ONLY on entries replayed from the durable event log
176
- * (`runEvents`); live `/ws` frames are not stamped, because for those the arrival IS the time. */
177
- ts?: number;
178
- /** `terminalOutput`: raw PTY bytes, base64-encoded (decode → send to the owning socket). */
179
- bytesB64?: string;
180
- /** `terminalOpened`: the working directory the PTY was opened in. */
181
- cwd?: string;
182
- /** `unitDispatched`/`cliUsage`: 0-based dispatch attempt (`>0` = a re-dispatch / rework). */
183
- attempt?: number;
184
- /** `cliUsage`: prompt/input tokens for the unit run. */
185
- inputTokens?: number;
186
- /** `cliUsage`: completion/output tokens for the unit run. */
187
- outputTokens?: number;
188
- /** `cliUsage`: dollar cost when the CLI reports it (claude) or a price table resolves it; else `null`. */
189
- costUsd?: number | null;
190
- /** `dataUsed`: the data files the unit's CLI touched. */
191
- files?: string[];
192
- /** `gateEvaluated`: the gated criterion — `null` when the phase was UNGATED. */
193
- criterion?: string | null;
194
- /** `gateEvaluated`: `true` iff a pinned validator gated this unit. */
195
- hasDeterministicFloor?: boolean;
196
- /** `gateEvaluated`: whether the deterministic (layer-1) floor passed. */
197
- deterministicPass?: boolean;
198
- /** `gateEvaluated`: the agent (layer-2) judge's verdict when one ran, else `null`. */
199
- agentVerdict?: string | null;
200
- /** `gateEvaluated`: the agent judge's reasoning when one ran, else `null`. */
201
- agentReasoning?: string | null;
202
- /** `gateEvaluated`: the evaluator≠creator second-pass result — `null` when it did not run. */
203
- evaluatorPass?: boolean | null;
49
+ projectId?: string;
204
50
  /**
205
- * `gateEvaluated`: policy ids the second pass applied. EMPTY alongside `evaluatorPass: true`
206
- * means nothing applied, so the pass is a vacuous default-allow rather than an enforced
207
- * approval (FINDING-025). The layer-3 analogue of `hasDeterministicFloor`.
51
+ * ADDITIONAL absolute write roots for the run's deliverables (wicked-core#259 / crew#263) —
52
+ * e.g. the interactive-draft inbox the workflow contract names as the output destination.
53
+ * The engine validates each root at launch (absolute, never the engine config/pin tree) and
54
+ * widens the governed units' filesystem boundary by exactly these roots; an invalid root
55
+ * fails the launch with no session persisted. Omit for runs that deliver inside their workdir.
208
56
  */
209
- evaluatorPolicies?: string[];
210
- /** `gateEvaluated`: the WINNING denial's reason when `combined === false`, else `null`. */
211
- denialReason?: string | null;
212
- /** `gateEvaluated`: the final deny-dominant decision over all layers. */
213
- combined?: boolean;
214
- [k: string]: unknown;
215
- }
216
- /**
217
- * A frame read back from core's DURABLE per-run event log (`Core::runEvents`):
218
- * the same tagged object the live stream carries, plus the two fields the log
219
- * adds when it records one.
220
- *
221
- * Same shape as the live frame on purpose — one mapping in core
222
- * (`CoreEvent::to_json`) serializes both, so an event named here is the event
223
- * named live, and a bundle assembled after a run cannot describe it in different
224
- * words than the operator watched it happen in. (FINDING-014)
225
- */
226
- export interface RecordedEvent extends CoreEvent {
227
- /** Capture time, epoch millis — when core emitted the frame, not when it was read. */
228
- ts: number;
229
- /**
230
- * Monotonic ordering across THIS RUN's whole event trail, so frames sharing a `ts` are still
231
- * ordered.
232
- *
233
- * Not the same `seq` as `CoreEvent`'s, which counts chunks within one terminal's output. This one
234
- * is required and spans every frame of the run; that one is optional and scoped to a stream. The
235
- * name is inherited from the wire and narrowed here rather than renamed, because the wire is what
236
- * `runEvents` returns.
237
- */
238
- seq: number;
239
- }
240
- /**
241
- * A registered governance policy (`wicked-governance::Policy`).
242
- * Serialized via serde snake_case — `effect` values are `deny` | `allow_with_conditions` | `allow`;
243
- * `severity` values are `high` | `medium` | `low`.
244
- */
245
- export interface GovernancePolicy {
246
- id: string;
247
- kind: string;
248
- applies_to: string[];
249
- effect: 'deny' | 'allow_with_conditions' | 'allow';
250
- trigger: {
251
- contains?: string;
252
- };
253
- obligations: string[];
254
- criteria: string;
255
- severity: 'high' | 'medium' | 'low';
256
- rule: string;
257
- /**
258
- * Withdrawn from enforcement (FINDING-038). A retired policy is still listed — its node survives
259
- * so past decisions citing it stay explicable — but it can no longer decide a gate. Absent on
260
- * policies written before the field existed, which read as active.
261
- */
262
- retired?: boolean;
263
- }
264
- /**
265
- * A prescriptive conformance rule (`wicked-governance::ConformanceRule`).
266
- * `rule_type` is `pattern` | `policy`; `severity` is `info` | `warn` | `error` | `critical`.
267
- */
268
- export interface ConformanceRule {
269
- id: string;
270
- rule_type: 'pattern' | 'policy';
271
- statement: string;
272
- severity: 'info' | 'warn' | 'error' | 'critical';
273
- confidence: number;
274
- targets: {
275
- language?: string;
276
- layer?: string;
277
- framework?: string;
278
- };
279
- symbol_ref?: string;
280
- compliance?: {
281
- framework: string;
282
- control_id: string;
283
- };
284
- provenance: {
285
- source: string;
286
- ref?: string;
287
- source_kinds: string[];
288
- };
289
- /** Withdrawn from recall. Same contract as {@link GovernancePolicy.retired}. */
290
- retired?: boolean;
291
- }
292
- /**
293
- * A recorded conformance claim / evaluation result (`wicked-apps-core::ConformanceClaim`).
294
- * `decision` values are `allow` | `deny` | `allow_with_conditions` (serde snake_case).
295
- */
296
- export interface GovernanceClaim {
297
- claim_id: string;
298
- scope: string;
299
- phase: string;
300
- policy_ids: string[];
301
- decision: 'allow' | 'deny' | 'allow_with_conditions';
302
- obligations: string[];
303
- evaluated_context_ref: string;
304
- criteria: string;
305
- evaluator_identity: string;
306
- /** Unix-seconds timestamp. */
307
- evaluated_at: number;
308
- }
309
- /** Per-app breakdown within a `CoverageReport`. */
310
- export interface CoveragePerApp {
311
- app: string;
312
- behavior_bearing: number;
313
- resolved: number;
314
- risk_flagged: number;
315
- unaccounted: number;
316
- coverage: number;
317
- }
318
- /** A behavior-bearing graph node without a coverage annotation (a coverage hole). */
319
- export interface UnaccountedNode {
320
- symbol_id: string;
321
- name?: string;
322
- kind?: string;
323
- file?: string;
324
- app?: string;
325
- }
326
- /** Front-half coverage gate report (`wicked-governance::CoverageReport`). Null on empty store. */
327
- export interface CoverageReport {
328
- total: number;
329
- behavior_bearing: number;
330
- resolved: number;
331
- risk_flagged: number;
332
- unaccounted: number;
333
- coverage: number;
334
- resolved_rate: number;
335
- mean_confidence: number;
336
- resolve_threshold: number;
337
- per_app: CoveragePerApp[];
338
- unaccounted_nodes: UnaccountedNode[];
339
- }
340
- /** Gate position in the value→strategy→execution ladder. */
341
- export type GateType = 'value' | 'strategy' | 'execution';
342
- /** Human-confirm spec for a phase gate. */
343
- export type GateSpec = 'auto' | {
344
- human_confirm: {
345
- unconditional: boolean;
346
- };
347
- } | {
348
- human_confirm_if: 'verdict_not_pass';
349
- };
350
- /** Evaluator≠creator role. */
351
- export type PhaseRole = 'neutral' | 'creator' | 'evaluator';
352
- /** Methodology stage for a phase. */
353
- export type StageKindPhase = 'recon' | 'build' | 'review' | 'test';
354
- /** One ordered phase of a workflow — pure data. */
355
- export type PhaseExecutor = {
356
- type: 'agent';
357
- } | {
358
- type: 'tool';
359
- cmd: string[];
360
- };
361
- export interface PhaseDef {
362
- /** Omitted = agent execution (engine default). Tool phases bypass the council and run cmd directly. */
363
- executor?: PhaseExecutor;
364
- id: string;
365
- kind: StageKindPhase;
366
- gate_type: GateType | null;
367
- gate: GateSpec;
368
- executes_code: boolean;
369
- verified_evidence: boolean;
370
- required_deliverables: string[];
371
- depends_on: string[];
372
- role: PhaseRole;
373
- skill_ref: string | null;
374
- allowed_skills: string[];
375
- validator_pin: string | null;
376
- }
377
- /** A workflow — id + ordered phases. */
378
- export interface WorkflowDef {
379
- id: string;
380
- phases: PhaseDef[];
381
- /** True for built-in system workflows that have dedicated entry points — hidden from the work-mode selector. */
382
- is_system?: boolean;
383
- }
384
- export interface SystemSettings {
385
- /** Max nodes returned by wicked-estate graph-view (default 150). */
386
- graphNodeLimit: number;
57
+ extraWriteRoots?: string[];
387
58
  }
388
59
  export declare const DEFAULT_SETTINGS: SystemSettings;
389
60
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,4EAA4E;AAC5E,MAAM,MAAM,aAAa,GACrB,UAAU,GACV,cAAc,GACd,WAAW,GACX,gBAAgB,GAChB,WAAW,GACX,WAAW,GACX,QAAQ,CAAC;AAEb,gDAAgD;AAChD,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,aAAa,GAAG,MAAM,GAAG,UAAU,CAAC;AAEzE,2DAA2D;AAC3D,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE9D,4CAA4C;AAC5C,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE/C,+FAA+F;AAC/F,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,KAA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IAChB,qBAAqB;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sFAAsF;IACtF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED,eAAO,MAAM,gBAAgB,EAAE,cAE9B,CAAC"}
@@ -2,10 +2,17 @@
2
2
  * Boundary types for the wicked-core-ts JSON surface.
3
3
  *
4
4
  * core-ts returns every complex result as a JSON string, which the adapter
5
- * `JSON.parse`s. These interfaces mirror the serde representation of
6
- * wicked-core's domain types (wicked-core/src/domain.rs, repo.rs, scope.rs) so
7
- * the daemon never falls back to `any` at the core boundary. They are permissive
8
- * about forward-additive fields — a newer core that adds fields still parses.
5
+ * `JSON.parse`s. The WIRE-SHAPE types — everything that flows on through the
6
+ * daemon's `/api/v1` + `/ws` surface (SessionView, CoreEvent, governance and
7
+ * workflow shapes, …) — live in the shared contract package
8
+ * `wicked-crew-api-types` and are re-exported here verbatim, so the route
9
+ * layer and the studio SPA compile against the SAME definitions and the two
10
+ * can no longer drift (task #84; `tests/wire-contract.test.ts` is the guard).
11
+ *
12
+ * What remains in THIS file is engine-internal: inputs the adapter maps onto
13
+ * the native addon (`LaunchRunInput`), shapes that never leave the daemon
14
+ * (`RepoOnboardRef`), and runtime constants (`DEFAULT_SETTINGS`) — a types-only
15
+ * contract package cannot carry values.
9
16
  *
10
17
  * ONLY `core/adapter.ts` imports from the native addon itself; the rest of the
11
18
  * daemon speaks these daemon-owned shapes, which is what quarantines the
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAqYH,MAAM,CAAC,MAAM,gBAAgB,GAAmB;IAC9C,cAAc,EAAE,GAAG;CACpB,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AA4CH,MAAM,CAAC,MAAM,gBAAgB,GAAmB;IAC9C,cAAc,EAAE,GAAG;CACpB,CAAC"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * The wicked-interactive bridge pool — discovery, health, reuse-or-start (DES-MERGE-001 §5.3/§5.6).
3
+ *
4
+ * A bridge is a local `wicked-interactive serve` process that records itself in
5
+ * `<root>/.wi-serve.json` = `{ port, host, pid, startedAt, version }` (ADR-0022). Its port is
6
+ * DYNAMIC — the first free port above its base — which is precisely why crew, a server process
7
+ * that can read that lockfile, proxies it instead of the browser dialling a port literal.
8
+ *
9
+ * LOCAL-ONLY BY DESIGN. Every mechanism here (a pid, a file in a directory, spawning a child)
10
+ * is single-host. That is the slice-1 posture, not an oversight: when the execution seam goes
11
+ * remote, this module is the seam that gets a remote implementation, and the proxy above it
12
+ * does not change.
13
+ *
14
+ * Pooling is keyed by the RESOLVED root (see `bridge-root.ts`), so two projects that share the
15
+ * default root share one bridge and one port; projects bound to different roots get their own.
16
+ *
17
+ * Health follows ADR-0025's hardened reuse check, and the ORDER matters: a recorded pid that is
18
+ * alive but slow (cold first hit, busy materializing) must be REUSED, not duplicated — so a
19
+ * live pid earns three 1.5 s attempts before the bridge is declared dead. Identity is checked
20
+ * too: `/api/health` must report THIS root, or a recycled port belonging to some other service
21
+ * would be proxied as if it were ours.
22
+ */
23
+ import { type ChildProcess } from 'node:child_process';
24
+ export declare const LOCK_NAME = ".wi-serve.json";
25
+ /** ADR-0025: 1.5 s × 3 while the pid lives. */
26
+ export declare const HEALTH_TIMEOUT_MS = 1500;
27
+ export declare const HEALTH_ATTEMPTS = 3;
28
+ /** A cold `npx wicked-interactive serve` may have to resolve and fetch the package first. */
29
+ export declare const START_TIMEOUT_MS = 60000;
30
+ /** A bridge that answered `/api/health` for its root. */
31
+ export interface LiveBridge {
32
+ host: string;
33
+ port: number;
34
+ pid: number;
35
+ }
36
+ /** The 503 the proxy renders as `{"code":"bridge_unavailable","hint":...}` (§5.6). */
37
+ export declare class BridgeUnavailableError extends Error {
38
+ /** An ACTIONABLE command an operator can actually run — never a bare "try again". */
39
+ readonly hint: string;
40
+ constructor(message: string, hint: string);
41
+ }
42
+ /** Injectable IO — the integration suite substitutes a fake bridge for the real `npx` spawn. */
43
+ export interface BridgePoolIo {
44
+ spawn?: (root: string) => ChildProcess;
45
+ startTimeoutMs?: number;
46
+ healthTimeoutMs?: number;
47
+ log?: (msg: string) => void;
48
+ }
49
+ /** `<root>/.wi-serve.json`, or null when absent/unparseable/incomplete. */
50
+ export declare function readLock(root: string): LiveBridge | null;
51
+ /** Signal 0 probes existence without delivering: EPERM means alive-but-not-ours. */
52
+ export declare function pidAlive(pid: number): boolean;
53
+ export declare class InteractiveBridgePool {
54
+ private readonly io;
55
+ /** Last bridge known good per root — the fast path that keeps the proxy off `fetch` per request. */
56
+ private readonly live;
57
+ /** In-flight resolutions per root, so a burst of first requests starts ONE bridge, not N. */
58
+ private readonly inflight;
59
+ constructor(io?: BridgePoolIo);
60
+ /** Reuse-or-start, idempotent per root. Throws `BridgeUnavailableError` when start is impossible. */
61
+ ensure(root: string): Promise<LiveBridge>;
62
+ /** Drop the cached bridge for a root — called when a proxied connection is refused. */
63
+ invalidate(root: string): void;
64
+ /** Live bridges, for tests and future operator introspection. */
65
+ keys(): string[];
66
+ private resolveOrStart;
67
+ /** The lockfile points at a bridge that is alive, answering, and serving THIS root. */
68
+ private healthy;
69
+ private start;
70
+ }
71
+ //# sourceMappingURL=bridge-pool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bridge-pool.d.ts","sourceRoot":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