wicked-crew 0.7.2 → 0.7.4

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.
@@ -0,0 +1,117 @@
1
+ /**
2
+ * The `/api/v1/testing/*` surface (crew-testing) — the wire behind the studio's Testing page:
3
+ * RUN the governance evals (does the steering corpus actually catch the behaviors it claims
4
+ * to?) and IMPORT a named eval corpus for later runs.
5
+ *
6
+ * Thin by design, like `governance-steering.ts`: validation is zod (strict, unknown keys named —
7
+ * the FINDING-031 doctrine); the evals themselves are the ENGINE's (`governanceEvals` pushes
8
+ * every sample through the same decide path enforcement runs, over a read-only connection to
9
+ * the steering store — the daemon computes no verdict of its own), and the report is the
10
+ * engine's serde output passed through VERBATIM (snake_case field names — the pinned crew/studio
11
+ * wire contract; the steering wave shipped a drift because each side guessed, so neither side
12
+ * reshapes it). Corpus import writes through the engine's knowledge seam under the
13
+ * `evals:<name>` scope — the daemon never opens a store itself.
14
+ *
15
+ * Error posture mirrors the steering surface: a build whose engine addon predates the evals
16
+ * bindings answers 501 (`GovernanceEvalsUnsupportedError` — "upgrade the engine"; wicked-core-ts
17
+ * 0.7.5 carries them, 0.7.4 does not), never 400 ("fix your request") — and never a crash: this
18
+ * daemon must serve both routes honestly against the released 0.7.4 addon.
19
+ */
20
+ import type { FastifyInstance, FastifyRequest } from 'fastify';
21
+ import { z } from 'zod';
22
+ import { type CoreAdapter } from '../core/adapter.js';
23
+ import type { Actor } from '../core/types.js';
24
+ import type { AuditLog } from './audit.js';
25
+ export declare const RunGovernanceEvalsSchema: z.ZodObject<{
26
+ type: z.ZodOptional<z.ZodEnum<["architecture", "development", "security", "testing", "operations", "compliance", "design-ux"]>>;
27
+ corpus: z.ZodOptional<z.ZodString>;
28
+ }, "strict", z.ZodTypeAny, {
29
+ type?: "architecture" | "development" | "security" | "testing" | "operations" | "compliance" | "design-ux" | undefined;
30
+ corpus?: string | undefined;
31
+ }, {
32
+ type?: "architecture" | "development" | "security" | "testing" | "operations" | "compliance" | "design-ux" | undefined;
33
+ corpus?: string | undefined;
34
+ }>;
35
+ export declare const ImportEvalCorpusSchema: z.ZodObject<{
36
+ name: z.ZodString;
37
+ samples: z.ZodArray<z.ZodObject<{
38
+ id: z.ZodString;
39
+ description: z.ZodString;
40
+ kind: z.ZodEnum<["good", "bad"]>;
41
+ steering_type: z.ZodString;
42
+ signals: z.ZodObject<{
43
+ phase: z.ZodOptional<z.ZodString>;
44
+ tool: z.ZodOptional<z.ZodString>;
45
+ files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
46
+ content: z.ZodOptional<z.ZodString>;
47
+ }, "strict", z.ZodTypeAny, {
48
+ content?: string | undefined;
49
+ tool?: string | undefined;
50
+ phase?: string | undefined;
51
+ files?: string[] | undefined;
52
+ }, {
53
+ content?: string | undefined;
54
+ tool?: string | undefined;
55
+ phase?: string | undefined;
56
+ files?: string[] | undefined;
57
+ }>;
58
+ }, "strict", z.ZodTypeAny, {
59
+ id: string;
60
+ kind: "good" | "bad";
61
+ description: string;
62
+ steering_type: string;
63
+ signals: {
64
+ content?: string | undefined;
65
+ tool?: string | undefined;
66
+ phase?: string | undefined;
67
+ files?: string[] | undefined;
68
+ };
69
+ }, {
70
+ id: string;
71
+ kind: "good" | "bad";
72
+ description: string;
73
+ steering_type: string;
74
+ signals: {
75
+ content?: string | undefined;
76
+ tool?: string | undefined;
77
+ phase?: string | undefined;
78
+ files?: string[] | undefined;
79
+ };
80
+ }>, "many">;
81
+ }, "strict", z.ZodTypeAny, {
82
+ name: string;
83
+ samples: {
84
+ id: string;
85
+ kind: "good" | "bad";
86
+ description: string;
87
+ steering_type: string;
88
+ signals: {
89
+ content?: string | undefined;
90
+ tool?: string | undefined;
91
+ phase?: string | undefined;
92
+ files?: string[] | undefined;
93
+ };
94
+ }[];
95
+ }, {
96
+ name: string;
97
+ samples: {
98
+ id: string;
99
+ kind: "good" | "bad";
100
+ description: string;
101
+ steering_type: string;
102
+ signals: {
103
+ content?: string | undefined;
104
+ tool?: string | undefined;
105
+ phase?: string | undefined;
106
+ files?: string[] | undefined;
107
+ };
108
+ }[];
109
+ }>;
110
+ export interface TestingRoutesDeps {
111
+ audit: AuditLog;
112
+ actorOf: (req: FastifyRequest & {
113
+ actor?: Actor;
114
+ }) => Actor;
115
+ }
116
+ export declare function registerTestingRoutes(app: FastifyInstance, adapter: CoreAdapter, deps: TestingRoutesDeps): void;
117
+ //# sourceMappingURL=testing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../src/api/testing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAmC,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACvF,OAAO,KAAK,EAAE,KAAK,EAAwB,MAAM,kBAAkB,CAAC;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAiD3C,eAAO,MAAM,wBAAwB;;;;;;;;;EAK1B,CAAC;AAEZ,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKxB,CAAC;AAEZ,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,QAAQ,CAAC;IAChB,OAAO,EAAE,CAAC,GAAG,EAAE,cAAc,GAAG;QAAE,KAAK,CAAC,EAAE,KAAK,CAAA;KAAE,KAAK,KAAK,CAAC;CAC7D;AAED,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,eAAe,EACpB,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,iBAAiB,GACtB,IAAI,CAyFN"}
@@ -0,0 +1,152 @@
1
+ /**
2
+ * The `/api/v1/testing/*` surface (crew-testing) — the wire behind the studio's Testing page:
3
+ * RUN the governance evals (does the steering corpus actually catch the behaviors it claims
4
+ * to?) and IMPORT a named eval corpus for later runs.
5
+ *
6
+ * Thin by design, like `governance-steering.ts`: validation is zod (strict, unknown keys named —
7
+ * the FINDING-031 doctrine); the evals themselves are the ENGINE's (`governanceEvals` pushes
8
+ * every sample through the same decide path enforcement runs, over a read-only connection to
9
+ * the steering store — the daemon computes no verdict of its own), and the report is the
10
+ * engine's serde output passed through VERBATIM (snake_case field names — the pinned crew/studio
11
+ * wire contract; the steering wave shipped a drift because each side guessed, so neither side
12
+ * reshapes it). Corpus import writes through the engine's knowledge seam under the
13
+ * `evals:<name>` scope — the daemon never opens a store itself.
14
+ *
15
+ * Error posture mirrors the steering surface: a build whose engine addon predates the evals
16
+ * bindings answers 501 (`GovernanceEvalsUnsupportedError` — "upgrade the engine"; wicked-core-ts
17
+ * 0.7.5 carries them, 0.7.4 does not), never 400 ("fix your request") — and never a crash: this
18
+ * daemon must serve both routes honestly against the released 0.7.4 addon.
19
+ */
20
+ import { z } from 'zod';
21
+ import { GovernanceEvalsUnsupportedError } from '../core/adapter.js';
22
+ import { API_PREFIX } from './api-prefix.js';
23
+ import { STEERING_TYPE_VALUES } from './governance-steering.js';
24
+ const V = API_PREFIX;
25
+ function message(err) {
26
+ return err instanceof Error ? err.message : String(err);
27
+ }
28
+ /** Same unknown-key-naming 400 body builder as api/routes.ts (restated because that module does
29
+ * not export it and importing routes.ts here would be a cycle through registerRoutes). */
30
+ function invalidBody(err, what) {
31
+ const unknown = err.issues.flatMap((i) => (i.code === 'unrecognized_keys' ? i.keys : []));
32
+ const error = unknown.length > 0
33
+ ? `${what}: unknown field${unknown.length > 1 ? 's' : ''} ${unknown
34
+ .map((k) => `\`${k}\``)
35
+ .join(', ')} — this endpoint does not accept ${unknown.length > 1 ? 'them' : 'it'}, and ignoring ${unknown.length > 1 ? 'them' : 'it'} would run a different request than you sent`
36
+ : what;
37
+ return { error, details: err.issues };
38
+ }
39
+ // The sample shape is the PINNED wire contract (snake_case, the engine's serde spelling) —
40
+ // `steering_type` stays an open string on purpose: the engine validates it against ITS
41
+ // vocabulary, so engine-side validation stays the one spelling of what a type is (the steering
42
+ // import doctrine). The run body's `type` IS closed here, because it selects from the same
43
+ // 7-value facet the steering routes already export — one spelling, shared.
44
+ const EvalSignalsSchema = z
45
+ .object({
46
+ phase: z.string().optional(),
47
+ tool: z.string().optional(),
48
+ files: z.array(z.string()).optional(),
49
+ content: z.string().optional(),
50
+ })
51
+ .strict();
52
+ const EvalSampleSchema = z
53
+ .object({
54
+ id: z.string().min(1),
55
+ description: z.string().min(1),
56
+ kind: z.enum(['good', 'bad']),
57
+ steering_type: z.string().min(1),
58
+ signals: EvalSignalsSchema,
59
+ })
60
+ .strict();
61
+ export const RunGovernanceEvalsSchema = z
62
+ .object({
63
+ type: z.enum(STEERING_TYPE_VALUES).optional(),
64
+ corpus: z.string().min(1).optional(),
65
+ })
66
+ .strict();
67
+ export const ImportEvalCorpusSchema = z
68
+ .object({
69
+ name: z.string().min(1),
70
+ samples: z.array(EvalSampleSchema).min(1),
71
+ })
72
+ .strict();
73
+ export function registerTestingRoutes(app, adapter, deps) {
74
+ const { audit, actorOf } = deps;
75
+ // ── Run the governance evals (the Testing page's Run action) ─────────────────
76
+ // Both fields optional — `{}` (or no body at all) means "the built-in default corpus, every
77
+ // steering type". The 200 body is the engine's serde report passed through verbatim
78
+ // (snake_case; `degraded` is `null`, kept in-band, when the run was full-fidelity).
79
+ app.post(`${V}/testing/evals/run`, {
80
+ config: {
81
+ manifest: {
82
+ requestType: 'RunGovernanceEvalsBody',
83
+ responseType: 'GovernanceEvalReport',
84
+ // 501: the installed engine addon predates the evals bindings (wicked-core-ts < 0.7.5)
85
+ // — upgrade the engine, the request was already correct.
86
+ statusCodes: [200, 400, 500, 501],
87
+ },
88
+ },
89
+ }, async (req, reply) => {
90
+ // `?? {}`: a bodyless POST is a legal spelling of the all-defaults run.
91
+ const parsed = RunGovernanceEvalsSchema.safeParse(req.body ?? {});
92
+ if (!parsed.success) {
93
+ return reply.code(400).send(invalidBody(parsed.error, 'Invalid evals run body'));
94
+ }
95
+ try {
96
+ // Passed through verbatim — no reshaping on our side of the seam: the report IS the
97
+ // pinned contract, snake_case and all (`summary.false_positives`, `nearest_rules`).
98
+ // (Spread-rebuilt args: exactOptionalPropertyTypes — an absent key, never `undefined`.)
99
+ return await adapter.runGovernanceEvals({
100
+ ...(parsed.data.type !== undefined ? { type: parsed.data.type } : {}),
101
+ ...(parsed.data.corpus !== undefined ? { corpus: parsed.data.corpus } : {}),
102
+ });
103
+ }
104
+ catch (err) {
105
+ if (err instanceof GovernanceEvalsUnsupportedError) {
106
+ return reply.code(501).send({ error: err.message });
107
+ }
108
+ // An engine/store failure is OURS, not the caller's — the body already parsed, so
109
+ // nothing here maps to 400.
110
+ return reply.code(500).send({ error: message(err) });
111
+ }
112
+ });
113
+ // ── Import a named eval corpus (the Testing page's Import action) ────────────
114
+ // Samples land in the knowledge store under the `evals:<name>` scope — the string a later
115
+ // evals run names as `corpus`. Audited (a write), unlike the run above (compute over the
116
+ // existing stores — the wiki-scoreboard read posture).
117
+ app.post(`${V}/testing/corpora/import`, {
118
+ config: {
119
+ manifest: {
120
+ requestType: 'ImportEvalCorpusBody',
121
+ responseType: 'ImportEvalCorpusResponse',
122
+ // 501: same presence gate as the run route — the two bindings ship together, and
123
+ // importing a corpus no engine on this host can run would be a trap, not a feature.
124
+ statusCodes: [200, 400, 500, 501],
125
+ },
126
+ },
127
+ }, async (req, reply) => {
128
+ const parsed = ImportEvalCorpusSchema.safeParse(req.body);
129
+ if (!parsed.success) {
130
+ return reply.code(400).send(invalidBody(parsed.error, 'Invalid corpus import body'));
131
+ }
132
+ try {
133
+ const result = await adapter.importGovernanceCorpus(parsed.data.name, parsed.data.samples);
134
+ audit.record('testing.corpus.imported', actorOf(req), {
135
+ detail: {
136
+ name: parsed.data.name,
137
+ samples: parsed.data.samples.length,
138
+ scope: result.scope,
139
+ embedded: result.embedded,
140
+ },
141
+ });
142
+ return result;
143
+ }
144
+ catch (err) {
145
+ if (err instanceof GovernanceEvalsUnsupportedError) {
146
+ return reply.code(501).send({ error: err.message });
147
+ }
148
+ return reply.code(500).send({ error: message(err) });
149
+ }
150
+ });
151
+ }
152
+ //# sourceMappingURL=testing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testing.js","sourceRoot":"","sources":["../../src/api/testing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,+BAA+B,EAAoB,MAAM,oBAAoB,CAAC;AAGvF,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,MAAM,CAAC,GAAG,UAAU,CAAC;AAErB,SAAS,OAAO,CAAC,GAAY;IAC3B,OAAO,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC1D,CAAC;AAED;2FAC2F;AAC3F,SAAS,WAAW,CAAC,GAAe,EAAE,IAAY;IAChD,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1F,MAAM,KAAK,GACT,OAAO,CAAC,MAAM,GAAG,CAAC;QAChB,CAAC,CAAC,GAAG,IAAI,kBAAkB,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,OAAO;aAC9D,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK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RepoEntry, RepoOnboardRef, SessionView, RecordedEvent, GovernancePolicy, ConformanceRule, GovernanceScoreboard, GovernanceClaim, CoverageReport, GraphKind, WorkflowDef, CrewSystemSettings, Project, ProjectMember, InteractionRequest, Campaign, CampaignDef } from './types.js';
1
+ import type { CoreEvent, LaunchRunInput, RepoEntry, RepoOnboardRef, SessionView, RecordedEvent, GovernancePolicy, ConformanceRule, GovernanceScoreboard, GovernanceClaim, SteeringImportEntry, SteeringImportResult, GovernanceEvalReport, GovernanceEvalSample, ImportEvalCorpusResponse, CoverageReport, GraphKind, WorkflowDef, CrewSystemSettings, Project, ProjectMember, InteractionRequest, Campaign, CampaignDef } from './types.js';
2
2
  /** Where the daemon persists system settings. Exported so tests write fixtures to the ONE
3
3
  * spelling of this path (the tests/ tree is audited against spelling core paths itself). */
4
4
  export declare function settingsFilePath(): string;
@@ -63,6 +63,26 @@ export declare class CampaignsUnsupportedError extends Error {
63
63
  * never 400 ("fix your request"). Gated on METHOD PRESENCE, the campaigns doctrine — true on
64
64
  * whatever release actually carries the binding.
65
65
  */
66
+ /**
67
+ * The unified steering-rule model (STEERING program) is not available in this deployment —
68
+ * wicked-core-ts predates the `steeringImport` binding (ships in ≥ 0.7.5, alongside the model
69
+ * merge). Typed for the same reason as `ChatUnsupportedError`: the routes answer 501 ("upgrade
70
+ * the engine") on this, never 400 ("fix your request") — and never the WORSE failure of passing
71
+ * a steering-field write through to an engine that would silently drop the fields.
72
+ */
73
+ export declare class SteeringUnsupportedError extends Error {
74
+ constructor(what: string);
75
+ }
76
+ /**
77
+ * The installed engine addon predates the governance-evals surface (crew-testing; the
78
+ * `governanceEvals` + `governanceCorpusImport` bindings ship with wicked-core-ts 0.7.5, which is
79
+ * unreleased at the time this seam lands). Typed for the same reason as `SteeringUnsupportedError`:
80
+ * the testing routes answer 501 ("upgrade the engine") on this, never 400 ("fix your request") —
81
+ * and they must not crash a daemon running against the released 0.7.4 addon.
82
+ */
83
+ export declare class GovernanceEvalsUnsupportedError extends Error {
84
+ constructor(what: string);
85
+ }
66
86
  export declare class GovernanceScoreboardUnsupportedError extends Error {
67
87
  constructor(what: string);
68
88
  }
@@ -120,6 +140,14 @@ export declare class CoreAdapter {
120
140
  private closed;
121
141
  /** Built-in workflow ids whose overlay JSON has been written this process lifetime. */
122
142
  private readonly _builtinOverlayWritten;
143
+ /**
144
+ * The estate db the Core actor was spawned over (`CoreAdapterOptions.dbPath` — the `--db`
145
+ * flag / `~/.wicked-crew/core.db` default). Kept because some engine bindings take the db
146
+ * path as an ARG rather than reading the actor's own handle (`governanceEvals` runs its evals
147
+ * over a read-only connection to this same store); crew resolves it here, the one place the
148
+ * path is already known, so no route grows a second spelling of where the store lives.
149
+ */
150
+ readonly dbPath: string;
123
151
  /** `true` when this adapter armed the event-driven exec seam (for readiness/reporting). */
124
152
  readonly engineExec: boolean;
125
153
  /** The bus db the exec seam runs over when armed (else `undefined`). */
@@ -368,6 +396,66 @@ export declare class CoreAdapter {
368
396
  * runbook they already ran.
369
397
  */
370
398
  countRuleSets(): Promise<number | null>;
399
+ /**
400
+ * Whether the installed engine addon carries the unified steering-rule model (core-ts ≥ 0.7.5).
401
+ *
402
+ * The sentinel is the `steeringImport` binding, which ships WITH the model merge — see the
403
+ * `GovernanceMethods` comment. Consulted by the routes before: filtering rules by
404
+ * `?type=` (rows on an old engine carry no `steering_type`, so an empty answer would
405
+ * impersonate "no rules of that type"); accepting a rule write that carries steering fields
406
+ * (an old engine would silently drop them — the extraWriteRoots doctrine); and folding the
407
+ * legacy policy write surface (410 only once the unified store exists to point at).
408
+ */
409
+ steeringSupported(): boolean;
410
+ /**
411
+ * Batch-import steering rules (frontmattered markdown docs and/or ready rule JSON) through the
412
+ * engine's ingest normalize/validate path — the SAME path `rules ingest --dir` runs, on the
413
+ * single-writer actor (the daemon must never open the store for writes itself). Fail-closed
414
+ * PER ENTRY: one bad entry rejects alone with its reason in that entry's result row, the rest
415
+ * still land. `defaultType` is the page's inferred steering type, applied to entries that
416
+ * omit one.
417
+ *
418
+ * Presence-gated (the campaigns doctrine): throws {@link SteeringUnsupportedError} on an addon
419
+ * that predates the binding, which the route maps to 501 ("upgrade the engine").
420
+ */
421
+ importSteeringRules(entries: SteeringImportEntry[], defaultType?: string): Promise<SteeringImportResult[]>;
422
+ /**
423
+ * Whether the installed engine addon carries the governance-evals surface (core-ts ≥ 0.7.5,
424
+ * unreleased at the time this seam lands). The sentinel is the `governanceEvals` binding —
425
+ * for the WHOLE evals seam, corpus import included: the two bindings ship together, and a
426
+ * daemon running against the released 0.7.4 addon must answer 501 on both routes, never crash.
427
+ */
428
+ governanceEvalsSupported(): boolean;
429
+ /**
430
+ * Run the governance evals: every sample of the corpus (`corpus` = an `evals:<name>` estate
431
+ * scope minted by {@link importGovernanceCorpus}; omitted = the engine's built-in default
432
+ * corpus) is pushed through the decide path and compared to what its `kind` says SHOULD have
433
+ * happened. Resolves the engine's serde report — snake_case field names, passed to the wire
434
+ * verbatim (the pinned crew/studio contract).
435
+ *
436
+ * `dbPath` rides the args because the eval run opens its own read-only connection to the
437
+ * steering store — the SAME store this adapter's actor writes (`this.dbPath`, the one spelling
438
+ * of where it lives). `knowledgeDb` is deliberately omitted: crew configures no separate
439
+ * knowledge db (the knowledge store is the engine's single-writer sidecar, derived from its
440
+ * own config exactly as the steering ingest path derives it).
441
+ *
442
+ * Presence-gated (the campaigns doctrine): throws {@link GovernanceEvalsUnsupportedError} on
443
+ * an addon that predates the binding, which the route maps to 501 ("upgrade the engine").
444
+ */
445
+ runGovernanceEvals(args: {
446
+ type?: string;
447
+ corpus?: string;
448
+ }): Promise<GovernanceEvalReport>;
449
+ /**
450
+ * Import a named eval corpus into the knowledge store under the `evals:<name>` scope (the
451
+ * string a later {@link runGovernanceEvals} names as `corpus`). `knowledgeDb` is omitted for
452
+ * the same reason as in {@link runGovernanceEvals} — the engine derives its own sidecar.
453
+ *
454
+ * Gated on the `governanceEvals` sentinel as well as the binding itself: the two ship
455
+ * together, and importing a corpus no engine on this host can ever run would be a trap, not
456
+ * a feature (the steering author-route doctrine).
457
+ */
458
+ importGovernanceCorpus(name: string, samples: GovernanceEvalSample[]): Promise<ImportEvalCorpusResponse>;
371
459
  private readonly userWorkflows;
372
460
  /** Whether {@link hydrateFromOverlay} has run this process lifetime. */
373
461
  private overlayHydrated;
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/core/adapter.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,SAAS,EACT,cAAc,EACd,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,SAAS,EACT,WAAW,EACX,kBAAkB,EAClB,OAAO,EACP,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,WAAW,EACZ,MAAM,YAAY,CAAC;AAgDpB;6FAC6F;AAC7F,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAYD;;;;;;;kGAOkG;AAClG,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,GAC9B,WAAW,EAAE,CAwBf;AA0QD,eAAO,MAAM,iBAAiB,EAAE,WAAW,EAuI1C,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,OAAO,EAAE,MAAM;CAI5B;AAED;;;;GAIG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,IAAI,EAAE,MAAM;CAIzB;AAED;;;;;;GAMG;AACH,qBAAa,2BAA4B,SAAQ,KAAK;gBACxC,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;;;GAOG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;gBACtC,IAAI,EAAE,MAAM;CAOzB;AAED;;;;;;GAMG;AACH,qBAAa,oCAAqC,SAAQ,KAAK;gBACjD,IAAI,EAAE,MAAM;CAOzB;AAKD,iFAAiF;AACjF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CAAC;IAIzD,mFAAmF;IACnF,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIvE,0FAA0F;IAC1F,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAMpC,WAAW,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAwD1C,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC;IASrF;;;OAGG;IACH,KAAK,IAAI,IAAI;CAMd"}
@@ -311,6 +311,26 @@ export const BUILTIN_WORKFLOWS = [
311
311
  { id: 'store', kind: 'build', gate_type: 'value', gate: 'auto', executes_code: false, verified_evidence: false, required_deliverables: [], depends_on: ['gather'], role: 'creator', skill_ref: null, allowed_skills: [], validator_pin: null },
312
312
  ],
313
313
  },
314
+ {
315
+ // "Add with chat" for the Steering surface (STEERING program) — the dedicated entry point
316
+ // behind POST /governance/steering/author. TH-12 propose-as-gate: the run analyzes the
317
+ // operator's intent + the named files/dirs, then the TERMINAL `propose` phase emits the
318
+ // PROPOSED steering rules and its unconditional human gate pauses the run `awaiting_human`
319
+ // (core evaluates a terminal phase's own gate before finalize — seam finding #4), so the
320
+ // operator approves/amends/rejects via the standard POST /runs/:id/gate. Approved rules land
321
+ // through the governed rules CRUD with `provenance.source: "chat"` — the run itself must
322
+ // never write the store, which is why both phases say so out loud.
323
+ //
324
+ // Crew-authored drop-in (like `chat`): NOT in CORE_SEEDED_WORKFLOWS, so launchRun's
325
+ // `_writeBuiltinOverlay` write is the only way core resolves the id — the same delivery
326
+ // mechanism every crew drop-in uses.
327
+ id: 'steering-author',
328
+ is_system: true,
329
+ phases: [
330
+ { id: 'analyze', kind: 'recon', instructions: 'Read the operator intent and every file or directory listed in the problem statement. Identify candidate steering rules: durable, prescriptive statements a coding agent must follow, each classified into one steering type (architecture, development, security, testing, operations, compliance, design-ux). For each candidate note the statement, steering type, severity, and the evidence in the source material. Analysis only — do not write any rule to any store, and do not emit final rule JSON yet.', gate_type: 'value', gate: 'auto', executes_code: false, verified_evidence: false, required_deliverables: [], depends_on: [], role: 'neutral', skill_ref: null, allowed_skills: [], validator_pin: null },
331
+ { id: 'propose', kind: 'recon', instructions: 'From the prior analysis, emit the PROPOSED steering rules as one JSON array. Each entry is a conformance-rule object: id (PAT-<digits> for rule_type "pattern", POL-<digits> for "policy"), rule_type, statement, severity (info|warn|error|critical), confidence (0..1), targets, steering_type (default to the type named in the problem statement), provenance {"source":"chat"}, and — only where the source material supports them — the enforcement fields applies_to, excludes, weight, effect, trigger, obligations, criteria. This output is a PROPOSAL for the human gate: rules land in the store only after approval, via the governance rules API — do not write them yourself.', gate_type: 'value', gate: { human_confirm: { unconditional: true } }, executes_code: false, verified_evidence: false, required_deliverables: [], depends_on: ['analyze'], role: 'creator', skill_ref: null, allowed_skills: [], validator_pin: null },
332
+ ],
333
+ },
314
334
  {
315
335
  id: 'collab',
316
336
  is_system: true,
@@ -421,6 +441,36 @@ export class CampaignsUnsupportedError extends Error {
421
441
  * never 400 ("fix your request"). Gated on METHOD PRESENCE, the campaigns doctrine — true on
422
442
  * whatever release actually carries the binding.
423
443
  */
444
+ /**
445
+ * The unified steering-rule model (STEERING program) is not available in this deployment —
446
+ * wicked-core-ts predates the `steeringImport` binding (ships in ≥ 0.7.5, alongside the model
447
+ * merge). Typed for the same reason as `ChatUnsupportedError`: the routes answer 501 ("upgrade
448
+ * the engine") on this, never 400 ("fix your request") — and never the WORSE failure of passing
449
+ * a steering-field write through to an engine that would silently drop the fields.
450
+ */
451
+ export class SteeringUnsupportedError extends Error {
452
+ constructor(what) {
453
+ super(`${what} is not supported by this wicked-core build (the installed wicked-core-ts addon ` +
454
+ 'has no steeringImport binding — upgrade it to a release carrying the unified steering ' +
455
+ 'model, >= 0.7.5)');
456
+ this.name = 'SteeringUnsupportedError';
457
+ }
458
+ }
459
+ /**
460
+ * The installed engine addon predates the governance-evals surface (crew-testing; the
461
+ * `governanceEvals` + `governanceCorpusImport` bindings ship with wicked-core-ts 0.7.5, which is
462
+ * unreleased at the time this seam lands). Typed for the same reason as `SteeringUnsupportedError`:
463
+ * the testing routes answer 501 ("upgrade the engine") on this, never 400 ("fix your request") —
464
+ * and they must not crash a daemon running against the released 0.7.4 addon.
465
+ */
466
+ export class GovernanceEvalsUnsupportedError extends Error {
467
+ constructor(what) {
468
+ super(`${what} is not supported by this wicked-core build (the installed wicked-core-ts addon ` +
469
+ 'has no governanceEvals binding — upgrade it to a release carrying the governance ' +
470
+ 'evals surface, >= 0.7.5)');
471
+ this.name = 'GovernanceEvalsUnsupportedError';
472
+ }
473
+ }
424
474
  export class GovernanceScoreboardUnsupportedError extends Error {
425
475
  constructor(what) {
426
476
  super(`${what} is not supported by this wicked-core build (the installed wicked-core-ts has ` +
@@ -516,6 +566,14 @@ export class CoreAdapter {
516
566
  closed = false;
517
567
  /** Built-in workflow ids whose overlay JSON has been written this process lifetime. */
518
568
  _builtinOverlayWritten = new Set();
569
+ /**
570
+ * The estate db the Core actor was spawned over (`CoreAdapterOptions.dbPath` — the `--db`
571
+ * flag / `~/.wicked-crew/core.db` default). Kept because some engine bindings take the db
572
+ * path as an ARG rather than reading the actor's own handle (`governanceEvals` runs its evals
573
+ * over a read-only connection to this same store); crew resolves it here, the one place the
574
+ * path is already known, so no route grows a second spelling of where the store lives.
575
+ */
576
+ dbPath;
519
577
  /** `true` when this adapter armed the event-driven exec seam (for readiness/reporting). */
520
578
  engineExec;
521
579
  /** The bus db the exec seam runs over when armed (else `undefined`). */
@@ -562,6 +620,7 @@ export class CoreAdapter {
562
620
  process.env['WICKED_CORE_EXE'] = wcExe;
563
621
  }
564
622
  this.stub = opts.stub === true;
623
+ this.dbPath = opts.dbPath;
565
624
  this.core = this.stub ? Core.spawnStub(opts.dbPath) : Core.spawn(opts.dbPath);
566
625
  // The ONE subscribe() for the process. Error-first callback (index.d.ts:56):
567
626
  // one JSON string per CoreEvent, in emission order. A throw in a listener is
@@ -1226,7 +1285,11 @@ export class CoreAdapter {
1226
1285
  }
1227
1286
  /** All conformance rules on the store. */
1228
1287
  async listConformanceRules() {
1229
- return JSON.parse(await this.core.listConformanceRules());
1288
+ // includeRetired=true: the BROWSE surface defaults to status=all and filters in the route, so
1289
+ // the fetch must not silently withdraw retired rows (a steering engine's default excludes
1290
+ // them — with the bare call, `?status=retired` / `include_retired=true` answered [] for every
1291
+ // engine-retired rule, a vacuous facet). Pre-0.7.5 bindings ignore the extra args.
1292
+ return JSON.parse(await this.core.listConformanceRules(null, true));
1230
1293
  }
1231
1294
  /** All recorded conformance claims (governance decisions). */
1232
1295
  async listConformanceClaims() {
@@ -1337,6 +1400,97 @@ export class CoreAdapter {
1337
1400
  const rows = parseEngineJson(await fn.call(this.core), 'listRuleSets');
1338
1401
  return Array.isArray(rows) ? rows.length : null;
1339
1402
  }
1403
+ // ── Steering (STEERING program — the unified steering-rule model) ───────────
1404
+ /**
1405
+ * Whether the installed engine addon carries the unified steering-rule model (core-ts ≥ 0.7.5).
1406
+ *
1407
+ * The sentinel is the `steeringImport` binding, which ships WITH the model merge — see the
1408
+ * `GovernanceMethods` comment. Consulted by the routes before: filtering rules by
1409
+ * `?type=` (rows on an old engine carry no `steering_type`, so an empty answer would
1410
+ * impersonate "no rules of that type"); accepting a rule write that carries steering fields
1411
+ * (an old engine would silently drop them — the extraWriteRoots doctrine); and folding the
1412
+ * legacy policy write surface (410 only once the unified store exists to point at).
1413
+ */
1414
+ steeringSupported() {
1415
+ return typeof this.core.steeringImport === 'function';
1416
+ }
1417
+ /**
1418
+ * Batch-import steering rules (frontmattered markdown docs and/or ready rule JSON) through the
1419
+ * engine's ingest normalize/validate path — the SAME path `rules ingest --dir` runs, on the
1420
+ * single-writer actor (the daemon must never open the store for writes itself). Fail-closed
1421
+ * PER ENTRY: one bad entry rejects alone with its reason in that entry's result row, the rest
1422
+ * still land. `defaultType` is the page's inferred steering type, applied to entries that
1423
+ * omit one.
1424
+ *
1425
+ * Presence-gated (the campaigns doctrine): throws {@link SteeringUnsupportedError} on an addon
1426
+ * that predates the binding, which the route maps to 501 ("upgrade the engine").
1427
+ */
1428
+ async importSteeringRules(entries, defaultType) {
1429
+ const fn = this.core.steeringImport;
1430
+ if (typeof fn !== 'function') {
1431
+ throw new SteeringUnsupportedError('Importing steering rules');
1432
+ }
1433
+ const rows = parseEngineJson(await fn.call(this.core, JSON.stringify({ default_type: defaultType ?? null, entries })), 'steeringImport');
1434
+ // Rust spells an absent `Option` as `null` unless the engine adds `skip_serializing_if`;
1435
+ // crew's published wire type (`SteeringImportResult.name/ids/error?`) spells absence as an
1436
+ // ABSENT KEY. Pin the shape on OUR side of the seam — strip null-valued keys — so the HTTP
1437
+ // response honors the contract whichever spelling the installed addon ships.
1438
+ return rows.map((r) => Object.fromEntries(Object.entries(r).filter(([, v]) => v !== null)));
1439
+ }
1440
+ // ── Testing (crew-testing) — governance evals over the steering-rule store ──
1441
+ /**
1442
+ * Whether the installed engine addon carries the governance-evals surface (core-ts ≥ 0.7.5,
1443
+ * unreleased at the time this seam lands). The sentinel is the `governanceEvals` binding —
1444
+ * for the WHOLE evals seam, corpus import included: the two bindings ship together, and a
1445
+ * daemon running against the released 0.7.4 addon must answer 501 on both routes, never crash.
1446
+ */
1447
+ governanceEvalsSupported() {
1448
+ return typeof this.core.governanceEvals === 'function';
1449
+ }
1450
+ /**
1451
+ * Run the governance evals: every sample of the corpus (`corpus` = an `evals:<name>` estate
1452
+ * scope minted by {@link importGovernanceCorpus}; omitted = the engine's built-in default
1453
+ * corpus) is pushed through the decide path and compared to what its `kind` says SHOULD have
1454
+ * happened. Resolves the engine's serde report — snake_case field names, passed to the wire
1455
+ * verbatim (the pinned crew/studio contract).
1456
+ *
1457
+ * `dbPath` rides the args because the eval run opens its own read-only connection to the
1458
+ * steering store — the SAME store this adapter's actor writes (`this.dbPath`, the one spelling
1459
+ * of where it lives). `knowledgeDb` is deliberately omitted: crew configures no separate
1460
+ * knowledge db (the knowledge store is the engine's single-writer sidecar, derived from its
1461
+ * own config exactly as the steering ingest path derives it).
1462
+ *
1463
+ * Presence-gated (the campaigns doctrine): throws {@link GovernanceEvalsUnsupportedError} on
1464
+ * an addon that predates the binding, which the route maps to 501 ("upgrade the engine").
1465
+ */
1466
+ async runGovernanceEvals(args) {
1467
+ const fn = this.core.governanceEvals;
1468
+ if (typeof fn !== 'function') {
1469
+ throw new GovernanceEvalsUnsupportedError('Running governance evals');
1470
+ }
1471
+ const payload = {
1472
+ ...(args.type !== undefined ? { type: args.type } : {}),
1473
+ ...(args.corpus !== undefined ? { corpus: args.corpus } : {}),
1474
+ dbPath: this.dbPath,
1475
+ };
1476
+ return parseEngineJson(await fn.call(this.core, JSON.stringify(payload)), 'governanceEvals');
1477
+ }
1478
+ /**
1479
+ * Import a named eval corpus into the knowledge store under the `evals:<name>` scope (the
1480
+ * string a later {@link runGovernanceEvals} names as `corpus`). `knowledgeDb` is omitted for
1481
+ * the same reason as in {@link runGovernanceEvals} — the engine derives its own sidecar.
1482
+ *
1483
+ * Gated on the `governanceEvals` sentinel as well as the binding itself: the two ship
1484
+ * together, and importing a corpus no engine on this host can ever run would be a trap, not
1485
+ * a feature (the steering author-route doctrine).
1486
+ */
1487
+ async importGovernanceCorpus(name, samples) {
1488
+ const importFn = this.core.governanceCorpusImport;
1489
+ if (typeof this.core.governanceEvals !== 'function' || typeof importFn !== 'function') {
1490
+ throw new GovernanceEvalsUnsupportedError('Importing an eval corpus');
1491
+ }
1492
+ return parseEngineJson(await importFn.call(this.core, JSON.stringify({ name, samples })), 'governanceCorpusImport');
1493
+ }
1340
1494
  // ── Workflow viewer + builder (crew#44) ────────────────────────────────────
1341
1495
  // Built-ins are static TypeScript mirrors of workflow.rs. User-registered
1342
1496
  // workflows are added to `userWorkflows` and persisted to disk; the Rust actor