wicked-crew-api-types 0.1.0 → 0.3.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 +73 -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`). */
|
package/package.json
CHANGED