wicked-crew-api-types 0.29.0 → 0.31.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 +273 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -802,7 +802,51 @@ export interface DataUsedEvent {
|
|
|
802
802
|
files: string[];
|
|
803
803
|
}
|
|
804
804
|
|
|
805
|
-
/**
|
|
805
|
+
/**
|
|
806
|
+
* The layer that denied a unit — a stable token (wicked-core `UnitDenial.source`):
|
|
807
|
+
* - `governance` — the unit's own gate; `input_governance` — the tool-call hook / boundary;
|
|
808
|
+
* - `pinned_validator` — the deterministic re-verify; `agent_validator` — the LLM judge;
|
|
809
|
+
* `evaluator` — the evaluator≠creator second pass;
|
|
810
|
+
* - `worker_failure` — the CLI process failed; `substance` — no reviewable substance;
|
|
811
|
+
* `deliverables` — declared deliverables missing; `elicitation` — ACP elicitation ended;
|
|
812
|
+
* - `worktree_guard` — a def-driven, agent-executed `executes_code: false` phase changed the
|
|
813
|
+
* worktree it was reviewing (wicked-core F-036, see {@link EvaluatorMutatedWorktreeEvent}) — or
|
|
814
|
+
* the guard could not re-verify it (no baseline persisted at dispatch, comparison unverifiable),
|
|
815
|
+
* which denies fail-closed WITHOUT that event; `reason` names the cause;
|
|
816
|
+
* - `repo_checks` — the repository's own checks failed in the worktree (wicked-core F-039, see
|
|
817
|
+
* {@link RepoChecksEvaluatedEvent}).
|
|
818
|
+
* Open-ended (`string & {}`) so a newer engine's source parses in an older studio.
|
|
819
|
+
*/
|
|
820
|
+
export type UnitDenialSource =
|
|
821
|
+
| 'governance'
|
|
822
|
+
| 'input_governance'
|
|
823
|
+
| 'pinned_validator'
|
|
824
|
+
| 'agent_validator'
|
|
825
|
+
| 'evaluator'
|
|
826
|
+
| 'worker_failure'
|
|
827
|
+
| 'substance'
|
|
828
|
+
| 'deliverables'
|
|
829
|
+
| 'elicitation'
|
|
830
|
+
| 'worktree_guard'
|
|
831
|
+
| 'repo_checks'
|
|
832
|
+
| (string & {});
|
|
833
|
+
|
|
834
|
+
/** The MACHINE-READABLE twin of `gateEvaluated.denialReason` (wicked-core `UnitDenial`, camelCase on
|
|
835
|
+
* the wire): which layer denied, the prose reason, and — when the layer recorded them — the
|
|
836
|
+
* conformance claim id, the firing rule ids, the refused tool and the unit-phase token. `null`
|
|
837
|
+
* fields are the engine's `Option::None`, never absent. */
|
|
838
|
+
export interface UnitDenial {
|
|
839
|
+
source: UnitDenialSource;
|
|
840
|
+
reason: string;
|
|
841
|
+
claimId: string | null;
|
|
842
|
+
ruleIds: string[];
|
|
843
|
+
deniedTool: string | null;
|
|
844
|
+
phase: string | null;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
/** §3 B1 — the gate's decision depth, emitted alongside `gateDecided`. `denial` is the structured
|
|
848
|
+
* twin of `denialReason`: `null` when the gate approved, else the winning layer (deny-dominates) —
|
|
849
|
+
* `worktree_guard` and `repo_checks` are the two wicked-core F-036/F-039 layers. */
|
|
806
850
|
export interface GateEvaluatedEvent {
|
|
807
851
|
type: 'gateEvaluated';
|
|
808
852
|
session: string;
|
|
@@ -813,7 +857,10 @@ export interface GateEvaluatedEvent {
|
|
|
813
857
|
agentVerdict: string | null;
|
|
814
858
|
agentReasoning: string | null;
|
|
815
859
|
evaluatorPass: boolean | null;
|
|
860
|
+
/** Policy ids the evaluator≠creator pass applied (empty = vacuous default-allow, FINDING-025). */
|
|
861
|
+
evaluatorPolicies: string[];
|
|
816
862
|
denialReason: string | null;
|
|
863
|
+
denial: UnitDenial | null;
|
|
817
864
|
combined: boolean;
|
|
818
865
|
}
|
|
819
866
|
|
|
@@ -979,6 +1026,109 @@ export interface GovernanceUnenforcedEvent {
|
|
|
979
1026
|
reason: string;
|
|
980
1027
|
}
|
|
981
1028
|
|
|
1029
|
+
/** One path an `executes_code: false` phase changed, with git's one-letter status
|
|
1030
|
+
* (`A`dded, `M`odified, `D`eleted, `T`ype-changed). */
|
|
1031
|
+
export interface WorktreeChangedPath {
|
|
1032
|
+
status: string;
|
|
1033
|
+
path: string;
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
/** wicked-core F-036 — an `executes_code: false` phase (an evaluator, a recon rung, a review) CHANGED
|
|
1037
|
+
* the worktree it was working in. Scope: the guard governs a DEF-DRIVEN, AGENT-executed
|
|
1038
|
+
* `executes_code: false` phase (`WorkUnit.worktree_guarded`, derived at plan time); Tool phases —
|
|
1039
|
+
* crew's `deliver-pr` included — and prose-planned runs are not guarded. The engine snapshots the
|
|
1040
|
+
* tree at dispatch and takes the FINAL snapshot after everything the phase owned has run (seat
|
|
1041
|
+
* quiesced — its process group killed, a persistent session closed — judge rendered, repo checks
|
|
1042
|
+
* done), for EVERY seat and carrier regardless of governance adapter. `changed` is EVERY path that
|
|
1043
|
+
* differs, and every one DENIES the unit (its `gateEvaluated.denial.source` is `worktree_guard`):
|
|
1044
|
+
* there are NO exemptions — not documentation, not a declared `required_deliverables` entry, not
|
|
1045
|
+
* tool state (a phase whose deliverable must live in the tree is a code phase; the engine's own
|
|
1046
|
+
* `tmp/` scratch is excluded from the snapshot by construction). `headMoved`: the run branch was
|
|
1047
|
+
* committed/amended/reset. The event is emitted exactly when a MUTATION denies the unit (`changed`
|
|
1048
|
+
* non-empty and/or `headMoved`), so an operator always sees what an evaluator wrote. A
|
|
1049
|
+
* `worktree_guard` denial can also come from the guard's fail-closed paths — no baseline persisted
|
|
1050
|
+
* at dispatch, or the comparison unverifiable — and those carry NO `evaluatorMutatedWorktree`
|
|
1051
|
+
* event: the gate's `denial.reason` names the cause. Evaluator ≠ creator is no longer a promise the
|
|
1052
|
+
* seat keeps; it is a check.
|
|
1053
|
+
*
|
|
1054
|
+
* `type` alias on purpose, not `interface`: only anonymous object types satisfy `CoreEvent`'s index
|
|
1055
|
+
* signature, which is what lets the frame flow through CoreEvent-typed broadcast seams. */
|
|
1056
|
+
export type EvaluatorMutatedWorktreeEvent = {
|
|
1057
|
+
type: 'evaluatorMutatedWorktree';
|
|
1058
|
+
session: string;
|
|
1059
|
+
ord: number;
|
|
1060
|
+
attempt: number;
|
|
1061
|
+
/** The seat that ran the unit (`assigned_cli`; `''` when unassigned). */
|
|
1062
|
+
cli: string;
|
|
1063
|
+
/** The workflow phase id (`verify`, `adversarial-review`, …). */
|
|
1064
|
+
phase: string;
|
|
1065
|
+
beforeTree: string;
|
|
1066
|
+
afterTree: string;
|
|
1067
|
+
headMoved: boolean;
|
|
1068
|
+
changed: WorktreeChangedPath[];
|
|
1069
|
+
};
|
|
1070
|
+
|
|
1071
|
+
/** One repository check the engine ran in the run's worktree (wicked-core F-039). */
|
|
1072
|
+
export interface RepoCheckRun {
|
|
1073
|
+
/** `install` | `typecheck` | `lint` | `test` | `cargo-test`. */
|
|
1074
|
+
name: string;
|
|
1075
|
+
argv: string[];
|
|
1076
|
+
/** Provenance an operator can verify: `package.json scripts.test`, `Cargo.toml`, … */
|
|
1077
|
+
source: string;
|
|
1078
|
+
/** The process exit code; `null` when it produced none (timed out / could not spawn). */
|
|
1079
|
+
exitCode: number | null;
|
|
1080
|
+
timedOut: boolean;
|
|
1081
|
+
/** The OS error when the command could not be started (binary not on PATH, …); `null` otherwise
|
|
1082
|
+
* — the key is always present on the wire. */
|
|
1083
|
+
spawnError: string | null;
|
|
1084
|
+
durationMs: number;
|
|
1085
|
+
/** The last 4 KiB of each stream — the evidence, verbatim. */
|
|
1086
|
+
stdoutTail: string;
|
|
1087
|
+
stderrTail: string;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
/** wicked-core F-039 — the engine ran the repository's OWN checks in the worktree for the def's
|
|
1091
|
+
* code-verifying unit (`verified_evidence` with an `executes_code` creator upstream: `bug/verify`,
|
|
1092
|
+
* `feature/test`, `migration/verify`) and folded them into the gate as a deterministic floor. Fires
|
|
1093
|
+
* once per fold, just before `gateEvaluated` (whose `hasDeterministicFloor`/`criterion` include this
|
|
1094
|
+
* floor). `checks` is what actually ran, in order (`package.json` `typecheck`/`lint`/`test` via the
|
|
1095
|
+
* lockfile's package manager, an `install` first when `node_modules/` is absent; `Cargo.toml` →
|
|
1096
|
+
* `cargo test`); `skipped` names detected checks not run because an earlier one failed. `passed:
|
|
1097
|
+
* false` ⇒ the unit is denied (`denial.source` is `repo_checks`).
|
|
1098
|
+
*
|
|
1099
|
+
* The checks are repo-controlled code and run ONLY inside an OS write boundary (macOS
|
|
1100
|
+
* `sandbox-exec` / Linux `bwrap`: writes confined to the worktree, the curated secret directories
|
|
1101
|
+
* unreadable, network open for installs) with an isolated `HOME`, `npm_config_cache`, `CARGO_HOME`,
|
|
1102
|
+
* `CARGO_TARGET_DIR` and `XDG_*` under `<worktree>/tmp/wicked-checks/`, and with a MINIMAL
|
|
1103
|
+
* environment — the daemon's env is cleared and only `PATH`, locale (`LANG`/`LC_*`), `TERM`,
|
|
1104
|
+
* `USER`/`LOGNAME`, `RUSTUP_HOME`, the Windows shell essentials and those isolation overrides
|
|
1105
|
+
* (`CI=1` included) reach a check: no token, API key or `WICKED_*` variable does; installs are always
|
|
1106
|
+
* `--ignore-scripts` (`--no-package-lock` when the repo ships no lockfile). When NO boundary can be
|
|
1107
|
+
* armed (no sandbox tool on the host — Windows) the checks do NOT run and the floor FAILS
|
|
1108
|
+
* (`passed: false`, `checks: []`, the reason on the unit record) — repo-controlled scripts never
|
|
1109
|
+
* run unsandboxed. Detection is fail-closed the same way: a `package.json` that cannot be read or
|
|
1110
|
+
* parsed, or a symlinked manifest/lockfile/`node_modules` (every probe `lstat`s, opens `O_NOFOLLOW`
|
|
1111
|
+
* and `fstat`s the opened descriptor before reading — links are never followed), FAILS the floor.
|
|
1112
|
+
* Only a repo with NO DETECTABLE check is the disclosed vacuous pass (`checks: []`, `passed:
|
|
1113
|
+
* true`): no manifest at all, or a readable `package.json` with no string `typecheck`/`lint`/`test`
|
|
1114
|
+
* script and no `Cargo.toml`. A manifest that cannot be read or trusted still FAILS.
|
|
1115
|
+
* "Done" for a verify phase is now the exit code the engine observed, not the seat's account of
|
|
1116
|
+
* having run the suite. `type` alias on purpose — see {@link EvaluatorMutatedWorktreeEvent}. */
|
|
1117
|
+
export type RepoChecksEvaluatedEvent = {
|
|
1118
|
+
type: 'repoChecksEvaluated';
|
|
1119
|
+
session: string;
|
|
1120
|
+
ord: number;
|
|
1121
|
+
attempt: number;
|
|
1122
|
+
passed: boolean;
|
|
1123
|
+
criterion: string;
|
|
1124
|
+
checks: RepoCheckRun[];
|
|
1125
|
+
skipped: string[];
|
|
1126
|
+
};
|
|
1127
|
+
|
|
1128
|
+
/** The gate-evidence events (wicked-core F-036/F-039) as a discriminated union for consumers that
|
|
1129
|
+
* narrow on `type`; they also flow through the permissive {@link CoreEvent}. */
|
|
1130
|
+
export type GateEvidenceEvent = EvaluatorMutatedWorktreeEvent | RepoChecksEvaluatedEvent;
|
|
1131
|
+
|
|
982
1132
|
// ── P2 decisions-full observability events (wicked-core EVT-001/012/013) ────
|
|
983
1133
|
|
|
984
1134
|
/** P2 — a structured workflow def was selected; fires once per session, after SessionStarted and before
|
|
@@ -2710,6 +2860,128 @@ export interface InteractiveDocDeleteResponse {
|
|
|
2710
2860
|
ledger: InteractiveDocDeleteLedgerReport;
|
|
2711
2861
|
}
|
|
2712
2862
|
|
|
2863
|
+
/** One hand-pinned demo step on a `kind: "demo"` create (api-types 0.30.0): the wizard's ordered
|
|
2864
|
+
* steps the governed run authors the spec from (ADR-0018: the agent authors, the service records). */
|
|
2865
|
+
export interface InteractiveDemoStepDraft {
|
|
2866
|
+
index: number;
|
|
2867
|
+
subject: string;
|
|
2868
|
+
action: string;
|
|
2869
|
+
}
|
|
2870
|
+
|
|
2871
|
+
/**
|
|
2872
|
+
* The body of `POST /projects/:projectId/interactive/api/docs` as crew's proxy understands it
|
|
2873
|
+
* (acceptance finding F-046; api-types 0.30.0 — the studio types its create from THIS declaration,
|
|
2874
|
+
* no local mirror). The bridge's own fields (`name`, `kind`, `html`, `brief`, `source_paths`,
|
|
2875
|
+
* `url`, `demo_steps`, `style`, `project`, `source_message_id`) are relayed as-is — this type
|
|
2876
|
+
* documents the two things CREW adds at the proxy before forwarding:
|
|
2877
|
+
*
|
|
2878
|
+
* - `repo_ref` / `repo_refs` — the repository (or repositories) this document is ABOUT, each a
|
|
2879
|
+
* registered repo id, its registry name, or its root directory's basename. Crew validates them
|
|
2880
|
+
* against the project's `crew.repo` members BEFORE the bridge sees the request (a miss is the
|
|
2881
|
+
* 400 {@link InteractiveDocCreateRefusal}, nothing created), strips them from the forwarded
|
|
2882
|
+
* body, and remembers the binding so the governed draft/demo run is grounded on THOSE repos
|
|
2883
|
+
* (offline snapshot + the project graph) — never on the project's first member. Unfiled
|
|
2884
|
+
* (`default` mount) documents cannot name a repository.
|
|
2885
|
+
* - `style` — passed through when given; when ABSENT crew infers it from the brief's format
|
|
2886
|
+
* words (print-ready / A4 / brochure → `brochure`; slides / deck → `ppt`; memo / whitepaper →
|
|
2887
|
+
* `doc`) so the bridge's own print instructions apply to a print brief. No format words → the
|
|
2888
|
+
* bridge's `web` default.
|
|
2889
|
+
*/
|
|
2890
|
+
export interface InteractiveDocCreateRequest {
|
|
2891
|
+
/** The doc name; the bridge slugifies it (409 when taken or retired). */
|
|
2892
|
+
name?: string;
|
|
2893
|
+
/** Omitted = a plain html doc (`html` required); `source` = generated from brief/sources; `demo` = a recording. */
|
|
2894
|
+
kind?: 'source' | 'demo';
|
|
2895
|
+
/** A plain html doc's content (or a `source` doc's seed). */
|
|
2896
|
+
html?: string;
|
|
2897
|
+
brief?: string;
|
|
2898
|
+
source_paths?: string[];
|
|
2899
|
+
/** `kind: "demo"` — the live app URL to record against. */
|
|
2900
|
+
url?: string;
|
|
2901
|
+
/** `kind: "demo"` — hand-pinned steps; omitted = the run authors them from the brief. */
|
|
2902
|
+
demo_steps?: InteractiveDemoStepDraft[];
|
|
2903
|
+
style?: 'web' | 'ppt' | 'brochure' | 'doc';
|
|
2904
|
+
/** Crew project binding (DES-PROJECT-001 §2.3): registration is the authority. */
|
|
2905
|
+
project?: string;
|
|
2906
|
+
/** The thread message this generation came from (§7.6). */
|
|
2907
|
+
source_message_id?: string;
|
|
2908
|
+
/** ONE subject repository: a repo id, its name, or its root basename. */
|
|
2909
|
+
repo_ref?: string;
|
|
2910
|
+
/** SEVERAL subject repositories (at most 8); the union with `repo_ref`, de-duplicated. */
|
|
2911
|
+
repo_refs?: string[];
|
|
2912
|
+
}
|
|
2913
|
+
|
|
2914
|
+
/**
|
|
2915
|
+
* The bridge's answer to a successful `POST /projects/:projectId/interactive/api/docs`, relayed
|
|
2916
|
+
* verbatim by crew's proxy (api-types 0.30.0): interactive's `{ name, head, … }` — `generating`
|
|
2917
|
+
* for a `kind: "source"` doc whose first draft a governed run now produces, `learning` for a demo,
|
|
2918
|
+
* `project_id` echoed for a project-bound doc.
|
|
2919
|
+
*/
|
|
2920
|
+
export interface InteractiveDocCreateResult {
|
|
2921
|
+
name: string;
|
|
2922
|
+
head: number;
|
|
2923
|
+
kind?: 'doc' | 'demo';
|
|
2924
|
+
generating?: boolean;
|
|
2925
|
+
learning?: boolean;
|
|
2926
|
+
project_id?: string;
|
|
2927
|
+
}
|
|
2928
|
+
|
|
2929
|
+
/**
|
|
2930
|
+
* Crew's 400 on `POST /projects/:projectId/interactive/api/docs` when the request names a
|
|
2931
|
+
* repository the document cannot be grounded on (F-046; api-types 0.30.0). Nothing was created
|
|
2932
|
+
* on the bridge.
|
|
2933
|
+
*/
|
|
2934
|
+
export interface InteractiveDocCreateRefusal {
|
|
2935
|
+
/** Human-readable, names the fix (attach the repo, pick one of `available`, name it by id, …). */
|
|
2936
|
+
error: string;
|
|
2937
|
+
/**
|
|
2938
|
+
* `repo_not_in_project` — a ref matched no member repo; `unfiled_doc_repo` — a repo named on the
|
|
2939
|
+
* Unfiled mount; `invalid_repo_ref` — junk spelling / shape / over the cap; `ambiguous_repo_ref`
|
|
2940
|
+
* — a name or basename shared by several member repos (name it by id); `project_mismatch` — the
|
|
2941
|
+
* body's `project` is not the route's project (or is present on the Unfiled mount). The proxy
|
|
2942
|
+
* canonicalizes an OMITTED `project` from the route.
|
|
2943
|
+
*/
|
|
2944
|
+
code: 'repo_not_in_project' | 'unfiled_doc_repo' | 'invalid_repo_ref' | 'ambiguous_repo_ref' | 'project_mismatch';
|
|
2945
|
+
/** The refs the request named, as spelled (best-effort stringified when malformed). */
|
|
2946
|
+
requested: string[];
|
|
2947
|
+
/** The subset of `requested` that matched no member repo (`repo_not_in_project` only). */
|
|
2948
|
+
missing?: string[];
|
|
2949
|
+
/** `ambiguous_repo_ref`: each ambiguous ref with the member repos it names. */
|
|
2950
|
+
ambiguous?: Array<{ ref: string; candidates: Array<{ id: string; name: string }> }>;
|
|
2951
|
+
/** The project's `crew.repo` members the request could have named. */
|
|
2952
|
+
available?: Array<{ id: string; name: string }>;
|
|
2953
|
+
}
|
|
2954
|
+
|
|
2955
|
+
/**
|
|
2956
|
+
* The 502 the create earns when the bridge dropped the connection AFTER the request had reached it
|
|
2957
|
+
* (api-types 0.30.0): the document may already exist, so the proxy never replays the POST — list the
|
|
2958
|
+
* project's documents before creating again.
|
|
2959
|
+
*/
|
|
2960
|
+
export interface InteractiveDocCreateUndetermined {
|
|
2961
|
+
code: 'create_undetermined';
|
|
2962
|
+
error: string;
|
|
2963
|
+
}
|
|
2964
|
+
|
|
2965
|
+
/**
|
|
2966
|
+
* The payload of `wicked.interactive.status.posted` as crew's own seams emit it (`producer_id:
|
|
2967
|
+
* "wi-crew"`, relayed on `/ws` inside an `interactiveEvent` frame; api-types 0.30.0). Acceptance finding F-045: every
|
|
2968
|
+
* seam emit — status narration, the terminal error/complete lines, and the closing
|
|
2969
|
+
* `draft.completed` / `edit.completed` / `demo.requested` — now carries `project_id` for a
|
|
2970
|
+
* project-bound document (omitted for an Unfiled one), exactly like the bridge's own emits, so a
|
|
2971
|
+
* skin can file the frame under the right thread. A skin should ALSO match frames by
|
|
2972
|
+
* `document_id` alone when the doc is open under exactly one mount (belt and braces).
|
|
2973
|
+
*/
|
|
2974
|
+
export interface InteractiveStatusPosted {
|
|
2975
|
+
ts: string;
|
|
2976
|
+
document_id: string;
|
|
2977
|
+
/** Present for a project-bound document. */
|
|
2978
|
+
project_id?: string;
|
|
2979
|
+
state: 'processing' | 'working' | 'asking' | 'complete' | 'error';
|
|
2980
|
+
message?: string;
|
|
2981
|
+
/** The edit seam stamps the handoff version it is answering. */
|
|
2982
|
+
version?: number;
|
|
2983
|
+
}
|
|
2984
|
+
|
|
2713
2985
|
/**
|
|
2714
2986
|
* One row of `GET /projects/:projectId/interactive/api/docs` (crew#472) — the bridge's own
|
|
2715
2987
|
* `GET /api/docs` row (interactive's `listDocs` shape, relayed field-for-field) stamped with the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wicked-crew-api-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.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",
|