wicked-crew-api-types 0.1.0 → 0.4.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/index.d.ts +110 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -26,6 +26,69 @@
|
|
|
26
26
|
* the daemon's produced types stop satisfying this contract.
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
|
+
// ── Identity / actor contract (task #88, locked decision #6) ───────────────────
|
|
30
|
+
|
|
31
|
+
/** What kind of principal an actor is: a person (OAuth/OIDC or local operator), a workload, or an internal process. */
|
|
32
|
+
export type ActorKind = 'human' | 'agent' | 'system';
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The minimal trust ladder: `admin` > `operator` > `observer`.
|
|
36
|
+
*
|
|
37
|
+
* - `observer` — read-only: every GET, and the `/ws` event stream.
|
|
38
|
+
* - `operator` — does the work: launch/steer/cancel runs, answer gates and
|
|
39
|
+
* elicitations, open chats and terminals, register repos and workflows.
|
|
40
|
+
* - `admin` — governs the system: governance writes (policies/rules),
|
|
41
|
+
* settings writes, and project archive/restore.
|
|
42
|
+
*
|
|
43
|
+
* Deliberately minimal and enumerated here rather than per-route: unknown
|
|
44
|
+
* mutating routes default to `operator`, reads to `observer` (docs/auth.md).
|
|
45
|
+
*/
|
|
46
|
+
export type TrustLevel = 'observer' | 'operator' | 'admin';
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The ONE actor shape every authenticated (or implicitly local) request carries
|
|
50
|
+
* — replacing free-text actor strings, which any caller could spoof. In local
|
|
51
|
+
* no-auth mode every request acts as `{id:"local", kind:"human", trust:"admin"}`
|
|
52
|
+
* (full trust), so downstream consumers never branch on "was there auth".
|
|
53
|
+
*/
|
|
54
|
+
export interface Actor {
|
|
55
|
+
/** Stable principal id (token-file `actor.id`, or an OIDC subject once that seam lands). */
|
|
56
|
+
id: string;
|
|
57
|
+
kind: ActorKind;
|
|
58
|
+
trust: TrustLevel;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** `GET /whoami` — the actor this request authenticated as, and the daemon's auth mode. */
|
|
62
|
+
export interface WhoAmI {
|
|
63
|
+
actor: Actor;
|
|
64
|
+
/** `required` (team/hosted: bearer token mandatory) | `off` (local loopback default). */
|
|
65
|
+
authMode: 'required' | 'off';
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* One line of the daemon's append-only audit trail (`GET /audit`): who did what,
|
|
70
|
+
* to which run, when. Written crew-side because the engine's `LaunchOptions`
|
|
71
|
+
* carries no actor field — this is the system of record for "who approved that
|
|
72
|
+
* gate" / "who launched that run".
|
|
73
|
+
*/
|
|
74
|
+
export interface AuditEntry {
|
|
75
|
+
/** Unix millis. */
|
|
76
|
+
ts: number;
|
|
77
|
+
/** Dotted verb, e.g. `run.launched`, `gate.decided`, `governance.policy.upserted`. */
|
|
78
|
+
action: string;
|
|
79
|
+
actor: Actor;
|
|
80
|
+
/** The run the action addressed, when it addressed one. */
|
|
81
|
+
runId?: string;
|
|
82
|
+
/** Action-specific fields (`approve`, `amend`, ids, …). */
|
|
83
|
+
detail?: Record<string, unknown>;
|
|
84
|
+
[k: string]: unknown;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** `GET /audit` — newest first, filterable by `?runId=` / `?action=` / `?limit=`. */
|
|
88
|
+
export interface AuditPage {
|
|
89
|
+
entries: AuditEntry[];
|
|
90
|
+
}
|
|
91
|
+
|
|
29
92
|
/** Run-level lifecycle status (`SessionStatus`, snake_case serde token). */
|
|
30
93
|
export type SessionStatus =
|
|
31
94
|
| 'planning'
|
|
@@ -88,6 +151,16 @@ export interface AgentSession {
|
|
|
88
151
|
attempt: number;
|
|
89
152
|
workdir: string | null;
|
|
90
153
|
repo_ref: string | null;
|
|
154
|
+
/** Launcher-declared extra write roots for the run's deliverables (wicked-core#259). */
|
|
155
|
+
extra_write_roots: string[];
|
|
156
|
+
/**
|
|
157
|
+
* When the operator ARCHIVED this run (crew#265) — a write-off, not a delete: the run stays
|
|
158
|
+
* fully readable but default run listings exclude it. Unix millis; `null` = live. Guard with
|
|
159
|
+
* `== null` (the live API sends `null`, never omits the key).
|
|
160
|
+
*/
|
|
161
|
+
archived_at: number | null;
|
|
162
|
+
/** Optional operator note recorded at archival. */
|
|
163
|
+
archive_note: string | null;
|
|
91
164
|
}
|
|
92
165
|
|
|
93
166
|
/** An ordered unit of work within a run (`WorkUnit`). */
|
|
@@ -148,6 +221,26 @@ export interface OnboardRef {
|
|
|
148
221
|
runId: string | null;
|
|
149
222
|
}
|
|
150
223
|
|
|
224
|
+
/**
|
|
225
|
+
* Runtime health of one council seat (crew#274).
|
|
226
|
+
*
|
|
227
|
+
* Derived by the daemon from the live CoreEvent stream — NEVER from config. The roster is
|
|
228
|
+
* declarative: every configured CLI stays listed and enabled in `clis.toml`; quota/auth/runtime
|
|
229
|
+
* errors are runtime state the platform detects and displays as `inactive` + the error excerpt.
|
|
230
|
+
* Recovery is automatic: a captured-ok unit output for the seat, or an exit-0 `version_probe`
|
|
231
|
+
* from the daemon's low-frequency recovery probe, flips the seat back to `active` and clears
|
|
232
|
+
* the message — no operator hand-edit involved.
|
|
233
|
+
*/
|
|
234
|
+
export interface SeatHealth {
|
|
235
|
+
status: 'active' | 'inactive';
|
|
236
|
+
/** Bounded excerpt of the last seat-level error; present while `inactive`. */
|
|
237
|
+
message?: string;
|
|
238
|
+
/** When the seat entered its current status (ISO-8601). */
|
|
239
|
+
since: string;
|
|
240
|
+
/** When the last seat-level error was observed (ISO-8601), if any was. */
|
|
241
|
+
lastErrorAt?: string;
|
|
242
|
+
}
|
|
243
|
+
|
|
151
244
|
/**
|
|
152
245
|
* A council seat (`AgenticCli`) as returned by `GET /roster`. Only the fields
|
|
153
246
|
* the launch form uses are named; the index signature keeps the (large) rest of
|
|
@@ -159,9 +252,26 @@ export interface RosterSeat {
|
|
|
159
252
|
binary: string;
|
|
160
253
|
enabled_for_council: boolean;
|
|
161
254
|
category?: string;
|
|
255
|
+
/**
|
|
256
|
+
* Runtime health (crew#274). Additive: absent on a daemon predating the field, and safe to
|
|
257
|
+
* round-trip into `clisJson` (the engine's `AgenticCli` deserializer ignores unknown fields).
|
|
258
|
+
* Absent-or-default reads as `active` with no message.
|
|
259
|
+
*/
|
|
260
|
+
health?: SeatHealth;
|
|
162
261
|
[k: string]: unknown;
|
|
163
262
|
}
|
|
164
263
|
|
|
264
|
+
/** Body for `POST /open` — open a file/folder with the OS default application (crew#273). */
|
|
265
|
+
export interface OpenPathBody {
|
|
266
|
+
/**
|
|
267
|
+
* ABSOLUTE path to open. Validated daemon-side: it must resolve inside the run's workdir /
|
|
268
|
+
* extra write roots (when `runId` is given) or a registered repo root — never an arbitrary path.
|
|
269
|
+
*/
|
|
270
|
+
path: string;
|
|
271
|
+
/** Widen validation to this run's workdir + extra write roots. Unknown id ⇒ 404. */
|
|
272
|
+
runId?: string;
|
|
273
|
+
}
|
|
274
|
+
|
|
165
275
|
/** The daemon's cached open-gate record (`GET /runs/:id/gate`, DES-STUDIO-001 §3.3). */
|
|
166
276
|
export interface GateInfo {
|
|
167
277
|
runId: string;
|
package/package.json
CHANGED