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
package/dist/core/types.d.ts
CHANGED
|
@@ -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.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
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
|
-
|
|
15
|
-
|
|
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
|
-
*
|
|
160
|
-
*
|
|
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
|
-
|
|
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
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
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
|
-
|
|
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
|
package/dist/core/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mBAAmB,uBAAuB,CAAC;AAE3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,2EAA2E;AAC3E,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,8FAA8F;AAC9F,MAAM,WAAW,cAAc;IAC7B,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;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"}
|
package/dist/core/types.js
CHANGED
|
@@ -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.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
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
|
package/dist/core/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA
|
|
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":"","sources":["../../src/interactive/bridge-pool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAI3E,eAAO,MAAM,SAAS,mBAAmB,CAAC;AAC1C,+CAA+C;AAC/C,eAAO,MAAM,iBAAiB,OAAO,CAAC;AACtC,eAAO,MAAM,eAAe,IAAI,CAAC;AACjC,6FAA6F;AAC7F,eAAO,MAAM,gBAAgB,QAAS,CAAC;AAEvC,yDAAyD;AACzD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,sFAAsF;AACtF,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,qFAAqF;IACrF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBACV,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAK1C;AAOD,gGAAgG;AAChG,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,YAAY,CAAC;IACvC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B;AAED,2EAA2E;AAC3E,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAQxD;AAED,oFAAoF;AACpF,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAQ7C;AAkBD,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAe;IAClC,oGAAoG;IACpG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAiC;IACtD,6FAA6F;IAC7F,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA0C;gBAEvD,EAAE,GAAE,YAAiB;IAIjC,qGAAqG;IAC/F,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAc/C,uFAAuF;IACvF,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI9B,iEAAiE;IACjE,IAAI,IAAI,MAAM,EAAE;YAIF,cAAc;IAW5B,uFAAuF;YACzE,OAAO;YAeP,KAAK;CAsCpB"}
|