wicked-crew-api-types 0.30.0 → 0.32.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 +348 -4
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -341,8 +341,31 @@ export interface RepoEntry {
|
|
|
341
341
|
* Optional in the TYPE, mandatory in practice: an addon predating the field omits it, and
|
|
342
342
|
* `codeGraphDb()` in the daemon's `repoPaths.ts` is where that turns into a loud error. Never
|
|
343
343
|
* join this path yourself — six independent spellings is what FINDING-069 was.
|
|
344
|
+
*
|
|
345
|
+
* Since wicked-core#406 the path is `<daemon state home>/repo-graphs/<key>/estate.db` — never
|
|
346
|
+
* inside `root_path`; a checkout's in-tree `.codegraph/` is reported in `findings`, not adopted.
|
|
344
347
|
*/
|
|
345
348
|
code_graph_db?: string;
|
|
349
|
+
/**
|
|
350
|
+
* Diagnostics about the checkout the engine wants shown on the repo card (wicked-core#406) —
|
|
351
|
+
* derived by the engine on every read like `code_graph_db`, never authoritative in the record.
|
|
352
|
+
* An empty array for a clean checkout; optional in the TYPE only because an addon predating the
|
|
353
|
+
* field omits it. Today's codes: `in_tree_code_graph_ignored` (the checkout carries a
|
|
354
|
+
* `.codegraph/` an older engine indexed in-tree — ignored; `path` names the directory and
|
|
355
|
+
* `message` says how to clear it) and `code_graph_root_unresolvable` (no repo-graph root
|
|
356
|
+
* resolves for this daemon, so `code_graph_db` is empty).
|
|
357
|
+
*/
|
|
358
|
+
findings?: RepoFinding[];
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/** One engine diagnostic on a registered repo (`RepoEntry.findings[]`; wicked-core#406). */
|
|
362
|
+
export interface RepoFinding {
|
|
363
|
+
/** Stable machine code (`snake_case`) a consumer switches on. */
|
|
364
|
+
code: string;
|
|
365
|
+
/** Operator-facing explanation: what was found, why it is ignored, how to clear it. */
|
|
366
|
+
message: string;
|
|
367
|
+
/** The filesystem path the finding is about, or `null` when it has none. */
|
|
368
|
+
path: string | null;
|
|
346
369
|
}
|
|
347
370
|
|
|
348
371
|
/** The run id of the onboarding run launched when a repo was registered (`GET /repos/:id/onboard`). */
|
|
@@ -802,7 +825,51 @@ export interface DataUsedEvent {
|
|
|
802
825
|
files: string[];
|
|
803
826
|
}
|
|
804
827
|
|
|
805
|
-
/**
|
|
828
|
+
/**
|
|
829
|
+
* The layer that denied a unit — a stable token (wicked-core `UnitDenial.source`):
|
|
830
|
+
* - `governance` — the unit's own gate; `input_governance` — the tool-call hook / boundary;
|
|
831
|
+
* - `pinned_validator` — the deterministic re-verify; `agent_validator` — the LLM judge;
|
|
832
|
+
* `evaluator` — the evaluator≠creator second pass;
|
|
833
|
+
* - `worker_failure` — the CLI process failed; `substance` — no reviewable substance;
|
|
834
|
+
* `deliverables` — declared deliverables missing; `elicitation` — ACP elicitation ended;
|
|
835
|
+
* - `worktree_guard` — a def-driven, agent-executed `executes_code: false` phase changed the
|
|
836
|
+
* worktree it was reviewing (wicked-core F-036, see {@link EvaluatorMutatedWorktreeEvent}) — or
|
|
837
|
+
* the guard could not re-verify it (no baseline persisted at dispatch, comparison unverifiable),
|
|
838
|
+
* which denies fail-closed WITHOUT that event; `reason` names the cause;
|
|
839
|
+
* - `repo_checks` — the repository's own checks failed in the worktree (wicked-core F-039, see
|
|
840
|
+
* {@link RepoChecksEvaluatedEvent}).
|
|
841
|
+
* Open-ended (`string & {}`) so a newer engine's source parses in an older studio.
|
|
842
|
+
*/
|
|
843
|
+
export type UnitDenialSource =
|
|
844
|
+
| 'governance'
|
|
845
|
+
| 'input_governance'
|
|
846
|
+
| 'pinned_validator'
|
|
847
|
+
| 'agent_validator'
|
|
848
|
+
| 'evaluator'
|
|
849
|
+
| 'worker_failure'
|
|
850
|
+
| 'substance'
|
|
851
|
+
| 'deliverables'
|
|
852
|
+
| 'elicitation'
|
|
853
|
+
| 'worktree_guard'
|
|
854
|
+
| 'repo_checks'
|
|
855
|
+
| (string & {});
|
|
856
|
+
|
|
857
|
+
/** The MACHINE-READABLE twin of `gateEvaluated.denialReason` (wicked-core `UnitDenial`, camelCase on
|
|
858
|
+
* the wire): which layer denied, the prose reason, and — when the layer recorded them — the
|
|
859
|
+
* conformance claim id, the firing rule ids, the refused tool and the unit-phase token. `null`
|
|
860
|
+
* fields are the engine's `Option::None`, never absent. */
|
|
861
|
+
export interface UnitDenial {
|
|
862
|
+
source: UnitDenialSource;
|
|
863
|
+
reason: string;
|
|
864
|
+
claimId: string | null;
|
|
865
|
+
ruleIds: string[];
|
|
866
|
+
deniedTool: string | null;
|
|
867
|
+
phase: string | null;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
/** §3 B1 — the gate's decision depth, emitted alongside `gateDecided`. `denial` is the structured
|
|
871
|
+
* twin of `denialReason`: `null` when the gate approved, else the winning layer (deny-dominates) —
|
|
872
|
+
* `worktree_guard` and `repo_checks` are the two wicked-core F-036/F-039 layers. */
|
|
806
873
|
export interface GateEvaluatedEvent {
|
|
807
874
|
type: 'gateEvaluated';
|
|
808
875
|
session: string;
|
|
@@ -813,7 +880,10 @@ export interface GateEvaluatedEvent {
|
|
|
813
880
|
agentVerdict: string | null;
|
|
814
881
|
agentReasoning: string | null;
|
|
815
882
|
evaluatorPass: boolean | null;
|
|
883
|
+
/** Policy ids the evaluator≠creator pass applied (empty = vacuous default-allow, FINDING-025). */
|
|
884
|
+
evaluatorPolicies: string[];
|
|
816
885
|
denialReason: string | null;
|
|
886
|
+
denial: UnitDenial | null;
|
|
817
887
|
combined: boolean;
|
|
818
888
|
}
|
|
819
889
|
|
|
@@ -979,6 +1049,109 @@ export interface GovernanceUnenforcedEvent {
|
|
|
979
1049
|
reason: string;
|
|
980
1050
|
}
|
|
981
1051
|
|
|
1052
|
+
/** One path an `executes_code: false` phase changed, with git's one-letter status
|
|
1053
|
+
* (`A`dded, `M`odified, `D`eleted, `T`ype-changed). */
|
|
1054
|
+
export interface WorktreeChangedPath {
|
|
1055
|
+
status: string;
|
|
1056
|
+
path: string;
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
/** wicked-core F-036 — an `executes_code: false` phase (an evaluator, a recon rung, a review) CHANGED
|
|
1060
|
+
* the worktree it was working in. Scope: the guard governs a DEF-DRIVEN, AGENT-executed
|
|
1061
|
+
* `executes_code: false` phase (`WorkUnit.worktree_guarded`, derived at plan time); Tool phases —
|
|
1062
|
+
* crew's `deliver-pr` included — and prose-planned runs are not guarded. The engine snapshots the
|
|
1063
|
+
* tree at dispatch and takes the FINAL snapshot after everything the phase owned has run (seat
|
|
1064
|
+
* quiesced — its process group killed, a persistent session closed — judge rendered, repo checks
|
|
1065
|
+
* done), for EVERY seat and carrier regardless of governance adapter. `changed` is EVERY path that
|
|
1066
|
+
* differs, and every one DENIES the unit (its `gateEvaluated.denial.source` is `worktree_guard`):
|
|
1067
|
+
* there are NO exemptions — not documentation, not a declared `required_deliverables` entry, not
|
|
1068
|
+
* tool state (a phase whose deliverable must live in the tree is a code phase; the engine's own
|
|
1069
|
+
* `tmp/` scratch is excluded from the snapshot by construction). `headMoved`: the run branch was
|
|
1070
|
+
* committed/amended/reset. The event is emitted exactly when a MUTATION denies the unit (`changed`
|
|
1071
|
+
* non-empty and/or `headMoved`), so an operator always sees what an evaluator wrote. A
|
|
1072
|
+
* `worktree_guard` denial can also come from the guard's fail-closed paths — no baseline persisted
|
|
1073
|
+
* at dispatch, or the comparison unverifiable — and those carry NO `evaluatorMutatedWorktree`
|
|
1074
|
+
* event: the gate's `denial.reason` names the cause. Evaluator ≠ creator is no longer a promise the
|
|
1075
|
+
* seat keeps; it is a check.
|
|
1076
|
+
*
|
|
1077
|
+
* `type` alias on purpose, not `interface`: only anonymous object types satisfy `CoreEvent`'s index
|
|
1078
|
+
* signature, which is what lets the frame flow through CoreEvent-typed broadcast seams. */
|
|
1079
|
+
export type EvaluatorMutatedWorktreeEvent = {
|
|
1080
|
+
type: 'evaluatorMutatedWorktree';
|
|
1081
|
+
session: string;
|
|
1082
|
+
ord: number;
|
|
1083
|
+
attempt: number;
|
|
1084
|
+
/** The seat that ran the unit (`assigned_cli`; `''` when unassigned). */
|
|
1085
|
+
cli: string;
|
|
1086
|
+
/** The workflow phase id (`verify`, `adversarial-review`, …). */
|
|
1087
|
+
phase: string;
|
|
1088
|
+
beforeTree: string;
|
|
1089
|
+
afterTree: string;
|
|
1090
|
+
headMoved: boolean;
|
|
1091
|
+
changed: WorktreeChangedPath[];
|
|
1092
|
+
};
|
|
1093
|
+
|
|
1094
|
+
/** One repository check the engine ran in the run's worktree (wicked-core F-039). */
|
|
1095
|
+
export interface RepoCheckRun {
|
|
1096
|
+
/** `install` | `typecheck` | `lint` | `test` | `cargo-test`. */
|
|
1097
|
+
name: string;
|
|
1098
|
+
argv: string[];
|
|
1099
|
+
/** Provenance an operator can verify: `package.json scripts.test`, `Cargo.toml`, … */
|
|
1100
|
+
source: string;
|
|
1101
|
+
/** The process exit code; `null` when it produced none (timed out / could not spawn). */
|
|
1102
|
+
exitCode: number | null;
|
|
1103
|
+
timedOut: boolean;
|
|
1104
|
+
/** The OS error when the command could not be started (binary not on PATH, …); `null` otherwise
|
|
1105
|
+
* — the key is always present on the wire. */
|
|
1106
|
+
spawnError: string | null;
|
|
1107
|
+
durationMs: number;
|
|
1108
|
+
/** The last 4 KiB of each stream — the evidence, verbatim. */
|
|
1109
|
+
stdoutTail: string;
|
|
1110
|
+
stderrTail: string;
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
/** wicked-core F-039 — the engine ran the repository's OWN checks in the worktree for the def's
|
|
1114
|
+
* code-verifying unit (`verified_evidence` with an `executes_code` creator upstream: `bug/verify`,
|
|
1115
|
+
* `feature/test`, `migration/verify`) and folded them into the gate as a deterministic floor. Fires
|
|
1116
|
+
* once per fold, just before `gateEvaluated` (whose `hasDeterministicFloor`/`criterion` include this
|
|
1117
|
+
* floor). `checks` is what actually ran, in order (`package.json` `typecheck`/`lint`/`test` via the
|
|
1118
|
+
* lockfile's package manager, an `install` first when `node_modules/` is absent; `Cargo.toml` →
|
|
1119
|
+
* `cargo test`); `skipped` names detected checks not run because an earlier one failed. `passed:
|
|
1120
|
+
* false` ⇒ the unit is denied (`denial.source` is `repo_checks`).
|
|
1121
|
+
*
|
|
1122
|
+
* The checks are repo-controlled code and run ONLY inside an OS write boundary (macOS
|
|
1123
|
+
* `sandbox-exec` / Linux `bwrap`: writes confined to the worktree, the curated secret directories
|
|
1124
|
+
* unreadable, network open for installs) with an isolated `HOME`, `npm_config_cache`, `CARGO_HOME`,
|
|
1125
|
+
* `CARGO_TARGET_DIR` and `XDG_*` under `<worktree>/tmp/wicked-checks/`, and with a MINIMAL
|
|
1126
|
+
* environment — the daemon's env is cleared and only `PATH`, locale (`LANG`/`LC_*`), `TERM`,
|
|
1127
|
+
* `USER`/`LOGNAME`, `RUSTUP_HOME`, the Windows shell essentials and those isolation overrides
|
|
1128
|
+
* (`CI=1` included) reach a check: no token, API key or `WICKED_*` variable does; installs are always
|
|
1129
|
+
* `--ignore-scripts` (`--no-package-lock` when the repo ships no lockfile). When NO boundary can be
|
|
1130
|
+
* armed (no sandbox tool on the host — Windows) the checks do NOT run and the floor FAILS
|
|
1131
|
+
* (`passed: false`, `checks: []`, the reason on the unit record) — repo-controlled scripts never
|
|
1132
|
+
* run unsandboxed. Detection is fail-closed the same way: a `package.json` that cannot be read or
|
|
1133
|
+
* parsed, or a symlinked manifest/lockfile/`node_modules` (every probe `lstat`s, opens `O_NOFOLLOW`
|
|
1134
|
+
* and `fstat`s the opened descriptor before reading — links are never followed), FAILS the floor.
|
|
1135
|
+
* Only a repo with NO DETECTABLE check is the disclosed vacuous pass (`checks: []`, `passed:
|
|
1136
|
+
* true`): no manifest at all, or a readable `package.json` with no string `typecheck`/`lint`/`test`
|
|
1137
|
+
* script and no `Cargo.toml`. A manifest that cannot be read or trusted still FAILS.
|
|
1138
|
+
* "Done" for a verify phase is now the exit code the engine observed, not the seat's account of
|
|
1139
|
+
* having run the suite. `type` alias on purpose — see {@link EvaluatorMutatedWorktreeEvent}. */
|
|
1140
|
+
export type RepoChecksEvaluatedEvent = {
|
|
1141
|
+
type: 'repoChecksEvaluated';
|
|
1142
|
+
session: string;
|
|
1143
|
+
ord: number;
|
|
1144
|
+
attempt: number;
|
|
1145
|
+
passed: boolean;
|
|
1146
|
+
criterion: string;
|
|
1147
|
+
checks: RepoCheckRun[];
|
|
1148
|
+
skipped: string[];
|
|
1149
|
+
};
|
|
1150
|
+
|
|
1151
|
+
/** The gate-evidence events (wicked-core F-036/F-039) as a discriminated union for consumers that
|
|
1152
|
+
* narrow on `type`; they also flow through the permissive {@link CoreEvent}. */
|
|
1153
|
+
export type GateEvidenceEvent = EvaluatorMutatedWorktreeEvent | RepoChecksEvaluatedEvent;
|
|
1154
|
+
|
|
982
1155
|
// ── P2 decisions-full observability events (wicked-core EVT-001/012/013) ────
|
|
983
1156
|
|
|
984
1157
|
/** P2 — a structured workflow def was selected; fires once per session, after SessionStarted and before
|
|
@@ -2920,15 +3093,107 @@ export interface ProjectPrompts {
|
|
|
2920
3093
|
prompts: InteractionRequest[];
|
|
2921
3094
|
}
|
|
2922
3095
|
|
|
2923
|
-
/**
|
|
3096
|
+
/**
|
|
3097
|
+
* `POST /chats` body (gains `projectId` with DES-PROJECT-001; `repoRefs` and the SCOPE semantics
|
|
3098
|
+
* with crew#502).
|
|
3099
|
+
*
|
|
3100
|
+
* A chat is SCOPED (crew#502, F-067): its seats run in a private scratch root — never a repo and
|
|
3101
|
+
* never the daemon's working directory — with the scoped repositories as read roots and, where a
|
|
3102
|
+
* graph can be bound, a READ-ONLY wicked-estate MCP over it (the grounding governed runs get). The
|
|
3103
|
+
* scope is: the explicit `repoRefs` (plus the legacy single `repoRef`, merged in) when given, else
|
|
3104
|
+
* ALL of `projectId`'s registered `crew.repo` members, else nothing (the seats see only their
|
|
3105
|
+
* scratch root). The resolved scope comes back as {@link ChatOpenResponse.scope}.
|
|
3106
|
+
*/
|
|
2924
3107
|
export interface ChatOpenBody {
|
|
2925
3108
|
chatId?: string;
|
|
2926
3109
|
clis?: string[];
|
|
3110
|
+
/** One repo in scope — the legacy spelling; merged into `repoRefs`. */
|
|
2927
3111
|
repoRef?: string;
|
|
2928
|
-
/**
|
|
3112
|
+
/** The repos in scope, by registry id or name (1–32). With `projectId` the PROJECT graph grounds
|
|
3113
|
+
* them; without it a single repo's own graph does, and several repos get no graph. */
|
|
3114
|
+
repoRefs?: string[];
|
|
3115
|
+
/** File the chat into a project (`crew.chat` membership, attached on open) — and, when no
|
|
3116
|
+
* `repoRefs` are given, scope it to every registered `crew.repo` member of that project. */
|
|
2929
3117
|
projectId?: string;
|
|
2930
3118
|
}
|
|
2931
3119
|
|
|
3120
|
+
/** How a chat's scope was chosen (crew#502). */
|
|
3121
|
+
export type ChatScopeKind = 'project' | 'repos' | 'none';
|
|
3122
|
+
|
|
3123
|
+
/** One repository a chat's seats may read. */
|
|
3124
|
+
export interface ChatScopeRepo {
|
|
3125
|
+
id: string;
|
|
3126
|
+
name: string;
|
|
3127
|
+
/** The registered root path — the read root the seats are pointed at. */
|
|
3128
|
+
rootPath: string;
|
|
3129
|
+
}
|
|
3130
|
+
|
|
3131
|
+
/**
|
|
3132
|
+
* What a chat's seats can see — decided at `POST /chats`, stated to the seats in their scratch
|
|
3133
|
+
* root's `AGENTS.md` / `CLAUDE.md`, and returned to the caller so the UI can show it. Additive:
|
|
3134
|
+
* older skins ignore it.
|
|
3135
|
+
*/
|
|
3136
|
+
export interface ChatScope {
|
|
3137
|
+
kind: ChatScopeKind;
|
|
3138
|
+
/** The project the chat is filed into, when any. */
|
|
3139
|
+
projectId?: string;
|
|
3140
|
+
/** The repositories in scope (read-only). Empty for `kind: 'none'`. */
|
|
3141
|
+
repos: ChatScopeRepo[];
|
|
3142
|
+
/** The seats' working directory: the chat's private scratch root under the OS temp dir. */
|
|
3143
|
+
cwd: string;
|
|
3144
|
+
/** Whether a READ-ONLY estate MCP over a code graph is attached, and why / why not. `repoLabel`
|
|
3145
|
+
* is the estate label the project graph indexes the (single) scoped repo under, when the
|
|
3146
|
+
* binding was repo-bound — informational; the engine binds by graph path. */
|
|
3147
|
+
graph: { bound: boolean; reason: string; repoLabel?: string };
|
|
3148
|
+
/** `crew.repo` members of the project whose registry record is gone — named, not readable. */
|
|
3149
|
+
dangling: string[];
|
|
3150
|
+
}
|
|
3151
|
+
|
|
3152
|
+
/** One seat's warm-up outcome on `POST /chats`. */
|
|
3153
|
+
export interface ChatSeatOutcome {
|
|
3154
|
+
cliKey: string;
|
|
3155
|
+
ok: boolean;
|
|
3156
|
+
error?: string;
|
|
3157
|
+
}
|
|
3158
|
+
|
|
3159
|
+
/** `POST /chats` → 201. */
|
|
3160
|
+
export interface ChatOpenResponse {
|
|
3161
|
+
chatId: string;
|
|
3162
|
+
seats: ChatSeatOutcome[];
|
|
3163
|
+
/** The resolved scope (crew#502). */
|
|
3164
|
+
scope: ChatScope;
|
|
3165
|
+
/** Present when the chat opened but its `crew.chat` filing into `projectId` failed. */
|
|
3166
|
+
projectAttachError?: string;
|
|
3167
|
+
}
|
|
3168
|
+
|
|
3169
|
+
/** One live chat on `GET /chats` (FINDING-027 gap 4; scope fields with crew#502). */
|
|
3170
|
+
export interface ChatSummary {
|
|
3171
|
+
chatId: string;
|
|
3172
|
+
/** The seats currently warm, sorted. */
|
|
3173
|
+
seats: string[];
|
|
3174
|
+
/** Seconds since the chat's last open/ensure/turn; `null` when it has no activity stamp. */
|
|
3175
|
+
idleSecs: number | null;
|
|
3176
|
+
/** The seats' working directory as the engine recorded it; absent on an engine predating scope. */
|
|
3177
|
+
cwd?: string | null;
|
|
3178
|
+
/** The estate graph the seats' read-only estate MCP is bound to; `null` ⇒ none. */
|
|
3179
|
+
codeGraphDb?: string | null;
|
|
3180
|
+
/** The repository roots in scope. */
|
|
3181
|
+
readRoots?: string[];
|
|
3182
|
+
}
|
|
3183
|
+
|
|
3184
|
+
/** `GET /chats` → 200. */
|
|
3185
|
+
export interface ChatListResponse {
|
|
3186
|
+
chats: ChatSummary[];
|
|
3187
|
+
}
|
|
3188
|
+
|
|
3189
|
+
/** `GET /chats/:id` → 200. */
|
|
3190
|
+
export interface ChatDetailResponse {
|
|
3191
|
+
chatId: string;
|
|
3192
|
+
seats: string[];
|
|
3193
|
+
/** The scope recorded at open; `null` for a chat this daemon did not open (or after a restart). */
|
|
3194
|
+
scope: ChatScope | null;
|
|
3195
|
+
}
|
|
3196
|
+
|
|
2932
3197
|
// ── Project code graph (DES-PROJECT-001; the co-located multi-repo graph) ──────
|
|
2933
3198
|
//
|
|
2934
3199
|
// A project's `crew.repo` members indexed into ONE wicked-estate database, each under a stable
|
|
@@ -3488,13 +3753,92 @@ export interface AcpDiagnostics {
|
|
|
3488
3753
|
export interface DiagnosticsResponse {
|
|
3489
3754
|
components: DiagnosticsComponents;
|
|
3490
3755
|
daemon: DiagnosticsDaemon;
|
|
3491
|
-
/** `core.db` + sidecars + the events dir (as a total), sorted by name
|
|
3756
|
+
/** `core.db` + sidecars + the events dir (as a total), sorted by name, followed by one entry per
|
|
3757
|
+
* repo code graph under the state home (`repo-graphs/<key>/estate.db`, key-sorted;
|
|
3758
|
+
* wicked-core#406). */
|
|
3492
3759
|
stores: DiagnosticsStoreFile[];
|
|
3493
3760
|
/** Bounded tail of the daemon's own error-level log lines, newest first. */
|
|
3494
3761
|
recentErrors: DiagnosticsRecentError[];
|
|
3495
3762
|
acp: AcpDiagnostics;
|
|
3496
3763
|
/** The skills seam's last outcome (api-types 0.28.0) — see `DiagnosticsSkills`. */
|
|
3497
3764
|
skills: DiagnosticsSkills;
|
|
3765
|
+
/** Whether the engine's governance evidence is LANDING (api-types 0.31.0, crew#495) — see `DiagnosticsGovernance`. */
|
|
3766
|
+
governance: DiagnosticsGovernance;
|
|
3767
|
+
}
|
|
3768
|
+
|
|
3769
|
+
// ── Diagnostics — governance store + dead letters (api-types 0.31.0, crew#495 / F-022) ─────────
|
|
3770
|
+
//
|
|
3771
|
+
// The engine's emit seam writes every cross-product `wicked.*` event — conformance claims and
|
|
3772
|
+
// decisions, phase transitions, the steering-rule lifecycle — onto the shared estate store named
|
|
3773
|
+
// by `WICKED_ESTATE_DB`, or, when it cannot, spools the event to an NDJSON dead-letter outbox
|
|
3774
|
+
// (`WICKED_APPS_EMIT_DEADLETTER`). `serve` now resolves that store (`--governance-db` /
|
|
3775
|
+
// `WICKED_CREW_GOVERNANCE_DB` › an inherited `WICKED_ESTATE_DB` › `<core db>.governance/
|
|
3776
|
+
// governance.db`) and keeps the outbox under the state home (`<core db>.governance/
|
|
3777
|
+
// emit-outbox.ndjson`), never under HOME; this block is the read-only account of both.
|
|
3778
|
+
|
|
3779
|
+
/** Which rule chose the store: the flag, crew's env override, the engine's own inherited
|
|
3780
|
+
* `WICKED_ESTATE_DB`, or the default sidecar of the core db. */
|
|
3781
|
+
export type DiagnosticsGovernanceStoreSource = 'flag' | 'env-crew' | 'env-estate' | 'core-db-sidecar';
|
|
3782
|
+
|
|
3783
|
+
/** The store the engine's emit seam writes governance events to. */
|
|
3784
|
+
export interface DiagnosticsGovernanceStore {
|
|
3785
|
+
/** The store as exported to the engine — an absolute SQLite path, or `:memory:`. The emit seam is SQLite-only,
|
|
3786
|
+
* so a URL spec (`postgres://…`) is refused at boot and never appears here. */
|
|
3787
|
+
path: string;
|
|
3788
|
+
source: DiagnosticsGovernanceStoreSource;
|
|
3789
|
+
}
|
|
3790
|
+
|
|
3791
|
+
/** EVENT records on the governance store. Counted through the engine binding; an engine without
|
|
3792
|
+
* it answers `null` for both — never a fabricated 0. */
|
|
3793
|
+
export interface DiagnosticsGovernanceRecords {
|
|
3794
|
+
/** Event records on the store right now (short-TTL), or `null` when the engine cannot count. */
|
|
3795
|
+
total: number | null;
|
|
3796
|
+
/** Records landed since this daemon's API came up (`total − baseline`; the baseline is taken when the routes
|
|
3797
|
+
* register, after the engine has booted, so its boot-time emits are in the baseline), or `null` when either
|
|
3798
|
+
* side is unknown. */
|
|
3799
|
+
sinceBoot: number | null;
|
|
3800
|
+
}
|
|
3801
|
+
|
|
3802
|
+
/** The dead-letter outbox, folded (streamed, size-capped). */
|
|
3803
|
+
export interface DiagnosticsGovernanceDeadletters {
|
|
3804
|
+
/** The outbox this daemon exports to the engine; `null` when no store was resolved (library boot). */
|
|
3805
|
+
path: string | null;
|
|
3806
|
+
/** Entries in the outbox — 0 is the good answer. A floor when `truncated`. */
|
|
3807
|
+
count: number;
|
|
3808
|
+
/** Entries per event type (`wicked.crew.governance.conformance_recorded`, …); overflow folds into `other`. */
|
|
3809
|
+
byType: Record<string, number>;
|
|
3810
|
+
/** Entries per reason bucket — the engine's reason text before its first `:` (`no shared store (WICKED_ESTATE_DB unset)`,
|
|
3811
|
+
* `open shared store failed`, `store write failed`). */
|
|
3812
|
+
byReason: Record<string, number>;
|
|
3813
|
+
/** Entries carrying the engine's `ts` (epoch ms; written by wicked-core builds that stamp spooled records). */
|
|
3814
|
+
timestamped: number;
|
|
3815
|
+
/** Entries without a timestamp (a pre-stamp engine, or an unparseable line) — counted, never given an invented time. */
|
|
3816
|
+
untimestamped: number;
|
|
3817
|
+
/** Epoch ms of the oldest / newest timestamped entry, or `null` when none carries one. */
|
|
3818
|
+
oldestTs: number | null;
|
|
3819
|
+
newestTs: number | null;
|
|
3820
|
+
/** `true` when the fold stopped at its byte cap — `count` is then a floor. */
|
|
3821
|
+
truncated: boolean;
|
|
3822
|
+
/** The pre-fix outbox under HOME (`~/.something-wicked/wicked-apps/emit-outbox.ndjson`) when it exists and is
|
|
3823
|
+
* non-empty — events earlier daemons on this host spooled there; `null` otherwise. Reported, never written. */
|
|
3824
|
+
legacyOutbox: { path: string; bytes: number } | null;
|
|
3825
|
+
}
|
|
3826
|
+
|
|
3827
|
+
/** One governance finding. `governance.store` (error) = no store resolved, every emit dead-letters;
|
|
3828
|
+
* `governance.deadletter` (error) = the outbox holds entries; `governance.legacy-outbox` (warning) =
|
|
3829
|
+
* the pre-fix HOME outbox exists. Every message names the replay command. */
|
|
3830
|
+
export interface DiagnosticsGovernanceFinding {
|
|
3831
|
+
kind: 'governance.store' | 'governance.deadletter' | 'governance.legacy-outbox';
|
|
3832
|
+
severity: 'warning' | 'error';
|
|
3833
|
+
message: string;
|
|
3834
|
+
}
|
|
3835
|
+
|
|
3836
|
+
/** `GET /diagnostics` → `governance` (api-types 0.31.0). */
|
|
3837
|
+
export interface DiagnosticsGovernance {
|
|
3838
|
+
store: DiagnosticsGovernanceStore | null;
|
|
3839
|
+
records: DiagnosticsGovernanceRecords;
|
|
3840
|
+
deadletters: DiagnosticsGovernanceDeadletters;
|
|
3841
|
+
findings: DiagnosticsGovernanceFinding[];
|
|
3498
3842
|
}
|
|
3499
3843
|
|
|
3500
3844
|
/** The skills seam's state as `GET /diagnostics` reports it (skills keystone, api-types 0.28.0). */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wicked-crew-api-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"description": "The wire contract of the wicked-crew daemon's /api/v1 REST surface and /ws CoreEvent frames \u2014 types only, zero runtime",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./index.d.ts",
|