@maintainabilityai/research-runner 0.1.19 → 0.1.20

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.
@@ -12,6 +12,49 @@
12
12
  * cleanly in GitHub PR bodies + the rendered docs site.
13
13
  */
14
14
  import type { GuardrailMode, LlmProvider } from '../schemas';
15
+ /**
16
+ * v4 agentic-SDLC governance fields. All are OPTIONAL on the Hatter's
17
+ * Tag input — legacy CI-only runs (without an OKR anchor) omit them
18
+ * entirely and the emitted YAML skips those keys. OKR-anchored runs
19
+ * (Phase B+) populate them so the audit chain can be walked across
20
+ * repositories via `intent_thread_uuid`.
21
+ *
22
+ * See vscode-extension/design/agentic-sdlc.md §4.4 (intent_thread_uuid
23
+ * lifecycle) and §11.1 (Hatter's Tag full provenance schema).
24
+ */
25
+ export interface HattersTagOkrContext {
26
+ /** Cross-repo audit correlation key, generated at OKR-create time. */
27
+ intent_thread_uuid: string;
28
+ /** Run id of the prior phase that produced the input artifact (null on Why). */
29
+ parent_intent_thread?: string | null;
30
+ /** OKR card id (human-readable name, e.g. OKR-2026Q1-IMDB-001-celeb-api). */
31
+ okr_id: string;
32
+ /** Which phase produced this artifact. */
33
+ phase: 'why' | 'how' | 'what';
34
+ /** Tier frozen at run start (mitigates tier creep, §6.2). */
35
+ governance_tier: 'autonomous' | 'supervised' | 'restricted';
36
+ }
37
+ /**
38
+ * Author + reviewer attestation block (v4 §11.1). All optional; legacy
39
+ * runs without distinct agent DIDs omit it. Phase B+ stamps `author_did`
40
+ * from the GitHub App installation id + agent name; reviewers fill in
41
+ * `reviewer_dids[]` after their structured-review pack runs.
42
+ */
43
+ export interface HattersTagAttestation {
44
+ /** DID of the agent that authored this artifact. */
45
+ author_did?: string;
46
+ /** Prompt pack id + version cited by the author. */
47
+ author_prompt_pack_version?: string;
48
+ /** SHA256 of the author's system prompt at run time. */
49
+ author_system_prompt_sha?: string;
50
+ /** DIDs of reviewer-agent sessions that scored this PR. */
51
+ reviewer_dids?: string[];
52
+ /** Reviewer scores keyed by reviewer name. */
53
+ reviewer_scores?: {
54
+ architect?: number | null;
55
+ security?: number | null;
56
+ };
57
+ }
15
58
  export interface HattersTagInput {
16
59
  run_id: string;
17
60
  /** Git SHA of the mesh repo at run start. */
@@ -47,6 +90,10 @@ export interface HattersTagInput {
47
90
  };
48
91
  /** ISO timestamp the artifact was published (PR created). */
49
92
  published_at: string;
93
+ /** v4: OKR-anchored runs populate this; legacy CI-only runs omit it. */
94
+ okr?: HattersTagOkrContext;
95
+ /** v4: Phase B+ agent runs populate this; legacy runs omit it. */
96
+ attestation?: HattersTagAttestation;
50
97
  }
51
98
  /** Build the full Hatter's Tag block, including heading + fenced YAML. */
52
99
  export declare function buildHattersTag(input: HattersTagInput): string;
@@ -1,6 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildHattersTag = buildHattersTag;
4
+ function hasAnyAttestationField(a) {
5
+ return !!(a.author_did
6
+ || a.author_prompt_pack_version
7
+ || a.author_system_prompt_sha
8
+ || (a.reviewer_dids && a.reviewer_dids.length > 0)
9
+ || (a.reviewer_scores && (a.reviewer_scores.architect != null || a.reviewer_scores.security != null)));
10
+ }
4
11
  /** Build the full Hatter's Tag block, including heading + fenced YAML. */
5
12
  function buildHattersTag(input) {
6
13
  const lines = [];
@@ -29,6 +36,45 @@ function buildHattersTag(input) {
29
36
  lines.push(` iterations: ${input.grounding.iterations}`);
30
37
  lines.push(` passed: ${input.grounding.passed}`);
31
38
  }
39
+ if (input.okr) {
40
+ lines.push('okr:');
41
+ lines.push(` intent_thread_uuid: ${input.okr.intent_thread_uuid}`);
42
+ if (input.okr.parent_intent_thread !== undefined) {
43
+ lines.push(` parent_intent_thread: ${input.okr.parent_intent_thread ?? 'null'}`);
44
+ }
45
+ lines.push(` okr_id: ${input.okr.okr_id}`);
46
+ lines.push(` phase: ${input.okr.phase}`);
47
+ lines.push(` governance_tier: ${input.okr.governance_tier}`);
48
+ }
49
+ if (input.attestation && hasAnyAttestationField(input.attestation)) {
50
+ lines.push('attestation:');
51
+ if (input.attestation.author_did) {
52
+ lines.push(` author_did: ${input.attestation.author_did}`);
53
+ }
54
+ if (input.attestation.author_prompt_pack_version) {
55
+ lines.push(` author_prompt_pack_version: ${input.attestation.author_prompt_pack_version}`);
56
+ }
57
+ if (input.attestation.author_system_prompt_sha) {
58
+ lines.push(` author_system_prompt_sha: ${input.attestation.author_system_prompt_sha}`);
59
+ }
60
+ if (input.attestation.reviewer_dids && input.attestation.reviewer_dids.length > 0) {
61
+ lines.push(' reviewer_dids:');
62
+ for (const did of input.attestation.reviewer_dids) {
63
+ lines.push(` - ${did}`);
64
+ }
65
+ }
66
+ if (input.attestation.reviewer_scores
67
+ && (input.attestation.reviewer_scores.architect != null
68
+ || input.attestation.reviewer_scores.security != null)) {
69
+ lines.push(' reviewer_scores:');
70
+ if (input.attestation.reviewer_scores.architect != null) {
71
+ lines.push(` architect: ${input.attestation.reviewer_scores.architect}`);
72
+ }
73
+ if (input.attestation.reviewer_scores.security != null) {
74
+ lines.push(` security: ${input.attestation.reviewer_scores.security}`);
75
+ }
76
+ }
77
+ }
32
78
  lines.push('audit:');
33
79
  lines.push(` event_count: ${input.audit.event_count}`);
34
80
  lines.push(` chain_root_hash: ${input.audit.chain_root_hash}`);
@@ -23,6 +23,12 @@ declare const PureApiEvent: z.ZodObject<{
23
23
  prev_event_hash: z.ZodNullable<z.ZodString>;
24
24
  /** SHA-256 of THIS event with `event_hash` set to the empty string. */
25
25
  event_hash: z.ZodString;
26
+ /** Which OKR phase this event belongs to. */
27
+ phase: z.ZodOptional<z.ZodEnum<["why", "how", "what"]>>;
28
+ /** Anchor OKR id (human-readable). */
29
+ okr_id: z.ZodOptional<z.ZodString>;
30
+ /** Cross-repo audit correlation key (UUID v4). */
31
+ intent_thread_uuid: z.ZodOptional<z.ZodString>;
26
32
  } & {
27
33
  node_kind: z.ZodLiteral<"pure_api">;
28
34
  api: z.ZodObject<{
@@ -61,6 +67,9 @@ declare const PureApiEvent: z.ZodObject<{
61
67
  http_status: number;
62
68
  response_byte_count: number;
63
69
  };
70
+ phase?: "why" | "how" | "what" | undefined;
71
+ okr_id?: string | undefined;
72
+ intent_thread_uuid?: string | undefined;
64
73
  }, {
65
74
  run_id: string;
66
75
  event_id: number;
@@ -77,6 +86,9 @@ declare const PureApiEvent: z.ZodObject<{
77
86
  http_status: number;
78
87
  response_byte_count: number;
79
88
  };
89
+ phase?: "why" | "how" | "what" | undefined;
90
+ okr_id?: string | undefined;
91
+ intent_thread_uuid?: string | undefined;
80
92
  }>;
81
93
  /** `llm` — non-deterministic LLM call (plan_queries, synthesize, expert reviews). */
82
94
  declare const LlmEvent: z.ZodObject<{
@@ -90,6 +102,12 @@ declare const LlmEvent: z.ZodObject<{
90
102
  prev_event_hash: z.ZodNullable<z.ZodString>;
91
103
  /** SHA-256 of THIS event with `event_hash` set to the empty string. */
92
104
  event_hash: z.ZodString;
105
+ /** Which OKR phase this event belongs to. */
106
+ phase: z.ZodOptional<z.ZodEnum<["why", "how", "what"]>>;
107
+ /** Anchor OKR id (human-readable). */
108
+ okr_id: z.ZodOptional<z.ZodString>;
109
+ /** Cross-repo audit correlation key (UUID v4). */
110
+ intent_thread_uuid: z.ZodOptional<z.ZodString>;
93
111
  } & {
94
112
  node_kind: z.ZodLiteral<"llm">;
95
113
  llm: z.ZodObject<{
@@ -180,6 +198,9 @@ declare const LlmEvent: z.ZodObject<{
180
198
  output_tokens: number;
181
199
  cost_usd: number;
182
200
  };
201
+ phase?: "why" | "how" | "what" | undefined;
202
+ okr_id?: string | undefined;
203
+ intent_thread_uuid?: string | undefined;
183
204
  }, {
184
205
  run_id: string;
185
206
  event_id: number;
@@ -205,6 +226,9 @@ declare const LlmEvent: z.ZodObject<{
205
226
  output_tokens: number;
206
227
  cost_usd: number;
207
228
  };
229
+ phase?: "why" | "how" | "what" | undefined;
230
+ okr_id?: string | undefined;
231
+ intent_thread_uuid?: string | undefined;
208
232
  }>;
209
233
  /** `pure` — local-only deterministic computation (validate, dedupe, structural check). */
210
234
  declare const PureEvent: z.ZodObject<{
@@ -218,6 +242,12 @@ declare const PureEvent: z.ZodObject<{
218
242
  prev_event_hash: z.ZodNullable<z.ZodString>;
219
243
  /** SHA-256 of THIS event with `event_hash` set to the empty string. */
220
244
  event_hash: z.ZodString;
245
+ /** Which OKR phase this event belongs to. */
246
+ phase: z.ZodOptional<z.ZodEnum<["why", "how", "what"]>>;
247
+ /** Anchor OKR id (human-readable). */
248
+ okr_id: z.ZodOptional<z.ZodString>;
249
+ /** Cross-repo audit correlation key (UUID v4). */
250
+ intent_thread_uuid: z.ZodOptional<z.ZodString>;
221
251
  } & {
222
252
  node_kind: z.ZodLiteral<"pure">;
223
253
  pure: z.ZodObject<{
@@ -243,6 +273,9 @@ declare const PureEvent: z.ZodObject<{
243
273
  inputs_summary: string;
244
274
  outputs_summary: string;
245
275
  };
276
+ phase?: "why" | "how" | "what" | undefined;
277
+ okr_id?: string | undefined;
278
+ intent_thread_uuid?: string | undefined;
246
279
  }, {
247
280
  run_id: string;
248
281
  event_id: number;
@@ -256,6 +289,9 @@ declare const PureEvent: z.ZodObject<{
256
289
  inputs_summary: string;
257
290
  outputs_summary: string;
258
291
  };
292
+ phase?: "why" | "how" | "what" | undefined;
293
+ okr_id?: string | undefined;
294
+ intent_thread_uuid?: string | undefined;
259
295
  }>;
260
296
  /** `node_error` — any node failure, before any retry. */
261
297
  declare const NodeErrorEvent: z.ZodObject<{
@@ -269,6 +305,12 @@ declare const NodeErrorEvent: z.ZodObject<{
269
305
  prev_event_hash: z.ZodNullable<z.ZodString>;
270
306
  /** SHA-256 of THIS event with `event_hash` set to the empty string. */
271
307
  event_hash: z.ZodString;
308
+ /** Which OKR phase this event belongs to. */
309
+ phase: z.ZodOptional<z.ZodEnum<["why", "how", "what"]>>;
310
+ /** Anchor OKR id (human-readable). */
311
+ okr_id: z.ZodOptional<z.ZodString>;
312
+ /** Cross-repo audit correlation key (UUID v4). */
313
+ intent_thread_uuid: z.ZodOptional<z.ZodString>;
272
314
  } & {
273
315
  node_kind: z.ZodLiteral<"node_error">;
274
316
  error: z.ZodObject<{
@@ -299,6 +341,9 @@ declare const NodeErrorEvent: z.ZodObject<{
299
341
  retryable: boolean;
300
342
  stack?: string | undefined;
301
343
  };
344
+ phase?: "why" | "how" | "what" | undefined;
345
+ okr_id?: string | undefined;
346
+ intent_thread_uuid?: string | undefined;
302
347
  }, {
303
348
  run_id: string;
304
349
  event_id: number;
@@ -313,6 +358,9 @@ declare const NodeErrorEvent: z.ZodObject<{
313
358
  retryable: boolean;
314
359
  stack?: string | undefined;
315
360
  };
361
+ phase?: "why" | "how" | "what" | undefined;
362
+ okr_id?: string | undefined;
363
+ intent_thread_uuid?: string | undefined;
316
364
  }>;
317
365
  /**
318
366
  * `iteration_summary` — emitted once per PRD refinement loop iteration after
@@ -331,6 +379,12 @@ declare const IterationSummaryEvent: z.ZodObject<{
331
379
  prev_event_hash: z.ZodNullable<z.ZodString>;
332
380
  /** SHA-256 of THIS event with `event_hash` set to the empty string. */
333
381
  event_hash: z.ZodString;
382
+ /** Which OKR phase this event belongs to. */
383
+ phase: z.ZodOptional<z.ZodEnum<["why", "how", "what"]>>;
384
+ /** Anchor OKR id (human-readable). */
385
+ okr_id: z.ZodOptional<z.ZodString>;
386
+ /** Cross-repo audit correlation key (UUID v4). */
387
+ intent_thread_uuid: z.ZodOptional<z.ZodString>;
334
388
  } & {
335
389
  node_kind: z.ZodLiteral<"iteration_summary">;
336
390
  iteration: z.ZodNumber;
@@ -467,6 +521,9 @@ declare const IterationSummaryEvent: z.ZodObject<{
467
521
  verdict: "PASS" | "ITERATE" | "EXHAUSTED";
468
522
  reason: string;
469
523
  };
524
+ phase?: "why" | "how" | "what" | undefined;
525
+ okr_id?: string | undefined;
526
+ intent_thread_uuid?: string | undefined;
470
527
  }, {
471
528
  run_id: string;
472
529
  iteration: number;
@@ -501,6 +558,9 @@ declare const IterationSummaryEvent: z.ZodObject<{
501
558
  verdict: "PASS" | "ITERATE" | "EXHAUSTED";
502
559
  reason: string;
503
560
  };
561
+ phase?: "why" | "how" | "what" | undefined;
562
+ okr_id?: string | undefined;
563
+ intent_thread_uuid?: string | undefined;
504
564
  }>;
505
565
  /** `run_complete` — final event emitted by verify_and_trigger. Closes the chain. */
506
566
  declare const RunCompleteEvent: z.ZodObject<{
@@ -514,6 +574,12 @@ declare const RunCompleteEvent: z.ZodObject<{
514
574
  prev_event_hash: z.ZodNullable<z.ZodString>;
515
575
  /** SHA-256 of THIS event with `event_hash` set to the empty string. */
516
576
  event_hash: z.ZodString;
577
+ /** Which OKR phase this event belongs to. */
578
+ phase: z.ZodOptional<z.ZodEnum<["why", "how", "what"]>>;
579
+ /** Anchor OKR id (human-readable). */
580
+ okr_id: z.ZodOptional<z.ZodString>;
581
+ /** Cross-repo audit correlation key (UUID v4). */
582
+ intent_thread_uuid: z.ZodOptional<z.ZodString>;
517
583
  } & {
518
584
  node_kind: z.ZodLiteral<"run_complete">;
519
585
  outcome: z.ZodObject<{
@@ -564,6 +630,9 @@ declare const RunCompleteEvent: z.ZodObject<{
564
630
  chain_root_hash: string;
565
631
  pr_url?: string | undefined;
566
632
  };
633
+ phase?: "why" | "how" | "what" | undefined;
634
+ okr_id?: string | undefined;
635
+ intent_thread_uuid?: string | undefined;
567
636
  }, {
568
637
  run_id: string;
569
638
  event_id: number;
@@ -583,6 +652,9 @@ declare const RunCompleteEvent: z.ZodObject<{
583
652
  chain_root_hash: string;
584
653
  pr_url?: string | undefined;
585
654
  };
655
+ phase?: "why" | "how" | "what" | undefined;
656
+ okr_id?: string | undefined;
657
+ intent_thread_uuid?: string | undefined;
586
658
  }>;
587
659
  export declare const AuditEvent: z.ZodDiscriminatedUnion<"node_kind", [z.ZodObject<{
588
660
  run_id: z.ZodString;
@@ -595,6 +667,12 @@ export declare const AuditEvent: z.ZodDiscriminatedUnion<"node_kind", [z.ZodObje
595
667
  prev_event_hash: z.ZodNullable<z.ZodString>;
596
668
  /** SHA-256 of THIS event with `event_hash` set to the empty string. */
597
669
  event_hash: z.ZodString;
670
+ /** Which OKR phase this event belongs to. */
671
+ phase: z.ZodOptional<z.ZodEnum<["why", "how", "what"]>>;
672
+ /** Anchor OKR id (human-readable). */
673
+ okr_id: z.ZodOptional<z.ZodString>;
674
+ /** Cross-repo audit correlation key (UUID v4). */
675
+ intent_thread_uuid: z.ZodOptional<z.ZodString>;
598
676
  } & {
599
677
  node_kind: z.ZodLiteral<"pure_api">;
600
678
  api: z.ZodObject<{
@@ -633,6 +711,9 @@ export declare const AuditEvent: z.ZodDiscriminatedUnion<"node_kind", [z.ZodObje
633
711
  http_status: number;
634
712
  response_byte_count: number;
635
713
  };
714
+ phase?: "why" | "how" | "what" | undefined;
715
+ okr_id?: string | undefined;
716
+ intent_thread_uuid?: string | undefined;
636
717
  }, {
637
718
  run_id: string;
638
719
  event_id: number;
@@ -649,6 +730,9 @@ export declare const AuditEvent: z.ZodDiscriminatedUnion<"node_kind", [z.ZodObje
649
730
  http_status: number;
650
731
  response_byte_count: number;
651
732
  };
733
+ phase?: "why" | "how" | "what" | undefined;
734
+ okr_id?: string | undefined;
735
+ intent_thread_uuid?: string | undefined;
652
736
  }>, z.ZodObject<{
653
737
  run_id: z.ZodString;
654
738
  /** Monotonically incrementing within a run, starting at 1. */
@@ -660,6 +744,12 @@ export declare const AuditEvent: z.ZodDiscriminatedUnion<"node_kind", [z.ZodObje
660
744
  prev_event_hash: z.ZodNullable<z.ZodString>;
661
745
  /** SHA-256 of THIS event with `event_hash` set to the empty string. */
662
746
  event_hash: z.ZodString;
747
+ /** Which OKR phase this event belongs to. */
748
+ phase: z.ZodOptional<z.ZodEnum<["why", "how", "what"]>>;
749
+ /** Anchor OKR id (human-readable). */
750
+ okr_id: z.ZodOptional<z.ZodString>;
751
+ /** Cross-repo audit correlation key (UUID v4). */
752
+ intent_thread_uuid: z.ZodOptional<z.ZodString>;
663
753
  } & {
664
754
  node_kind: z.ZodLiteral<"llm">;
665
755
  llm: z.ZodObject<{
@@ -750,6 +840,9 @@ export declare const AuditEvent: z.ZodDiscriminatedUnion<"node_kind", [z.ZodObje
750
840
  output_tokens: number;
751
841
  cost_usd: number;
752
842
  };
843
+ phase?: "why" | "how" | "what" | undefined;
844
+ okr_id?: string | undefined;
845
+ intent_thread_uuid?: string | undefined;
753
846
  }, {
754
847
  run_id: string;
755
848
  event_id: number;
@@ -775,6 +868,9 @@ export declare const AuditEvent: z.ZodDiscriminatedUnion<"node_kind", [z.ZodObje
775
868
  output_tokens: number;
776
869
  cost_usd: number;
777
870
  };
871
+ phase?: "why" | "how" | "what" | undefined;
872
+ okr_id?: string | undefined;
873
+ intent_thread_uuid?: string | undefined;
778
874
  }>, z.ZodObject<{
779
875
  run_id: z.ZodString;
780
876
  /** Monotonically incrementing within a run, starting at 1. */
@@ -786,6 +882,12 @@ export declare const AuditEvent: z.ZodDiscriminatedUnion<"node_kind", [z.ZodObje
786
882
  prev_event_hash: z.ZodNullable<z.ZodString>;
787
883
  /** SHA-256 of THIS event with `event_hash` set to the empty string. */
788
884
  event_hash: z.ZodString;
885
+ /** Which OKR phase this event belongs to. */
886
+ phase: z.ZodOptional<z.ZodEnum<["why", "how", "what"]>>;
887
+ /** Anchor OKR id (human-readable). */
888
+ okr_id: z.ZodOptional<z.ZodString>;
889
+ /** Cross-repo audit correlation key (UUID v4). */
890
+ intent_thread_uuid: z.ZodOptional<z.ZodString>;
789
891
  } & {
790
892
  node_kind: z.ZodLiteral<"pure">;
791
893
  pure: z.ZodObject<{
@@ -811,6 +913,9 @@ export declare const AuditEvent: z.ZodDiscriminatedUnion<"node_kind", [z.ZodObje
811
913
  inputs_summary: string;
812
914
  outputs_summary: string;
813
915
  };
916
+ phase?: "why" | "how" | "what" | undefined;
917
+ okr_id?: string | undefined;
918
+ intent_thread_uuid?: string | undefined;
814
919
  }, {
815
920
  run_id: string;
816
921
  event_id: number;
@@ -824,6 +929,9 @@ export declare const AuditEvent: z.ZodDiscriminatedUnion<"node_kind", [z.ZodObje
824
929
  inputs_summary: string;
825
930
  outputs_summary: string;
826
931
  };
932
+ phase?: "why" | "how" | "what" | undefined;
933
+ okr_id?: string | undefined;
934
+ intent_thread_uuid?: string | undefined;
827
935
  }>, z.ZodObject<{
828
936
  run_id: z.ZodString;
829
937
  /** Monotonically incrementing within a run, starting at 1. */
@@ -835,6 +943,12 @@ export declare const AuditEvent: z.ZodDiscriminatedUnion<"node_kind", [z.ZodObje
835
943
  prev_event_hash: z.ZodNullable<z.ZodString>;
836
944
  /** SHA-256 of THIS event with `event_hash` set to the empty string. */
837
945
  event_hash: z.ZodString;
946
+ /** Which OKR phase this event belongs to. */
947
+ phase: z.ZodOptional<z.ZodEnum<["why", "how", "what"]>>;
948
+ /** Anchor OKR id (human-readable). */
949
+ okr_id: z.ZodOptional<z.ZodString>;
950
+ /** Cross-repo audit correlation key (UUID v4). */
951
+ intent_thread_uuid: z.ZodOptional<z.ZodString>;
838
952
  } & {
839
953
  node_kind: z.ZodLiteral<"node_error">;
840
954
  error: z.ZodObject<{
@@ -865,6 +979,9 @@ export declare const AuditEvent: z.ZodDiscriminatedUnion<"node_kind", [z.ZodObje
865
979
  retryable: boolean;
866
980
  stack?: string | undefined;
867
981
  };
982
+ phase?: "why" | "how" | "what" | undefined;
983
+ okr_id?: string | undefined;
984
+ intent_thread_uuid?: string | undefined;
868
985
  }, {
869
986
  run_id: string;
870
987
  event_id: number;
@@ -879,6 +996,9 @@ export declare const AuditEvent: z.ZodDiscriminatedUnion<"node_kind", [z.ZodObje
879
996
  retryable: boolean;
880
997
  stack?: string | undefined;
881
998
  };
999
+ phase?: "why" | "how" | "what" | undefined;
1000
+ okr_id?: string | undefined;
1001
+ intent_thread_uuid?: string | undefined;
882
1002
  }>, z.ZodObject<{
883
1003
  run_id: z.ZodString;
884
1004
  /** Monotonically incrementing within a run, starting at 1. */
@@ -890,6 +1010,12 @@ export declare const AuditEvent: z.ZodDiscriminatedUnion<"node_kind", [z.ZodObje
890
1010
  prev_event_hash: z.ZodNullable<z.ZodString>;
891
1011
  /** SHA-256 of THIS event with `event_hash` set to the empty string. */
892
1012
  event_hash: z.ZodString;
1013
+ /** Which OKR phase this event belongs to. */
1014
+ phase: z.ZodOptional<z.ZodEnum<["why", "how", "what"]>>;
1015
+ /** Anchor OKR id (human-readable). */
1016
+ okr_id: z.ZodOptional<z.ZodString>;
1017
+ /** Cross-repo audit correlation key (UUID v4). */
1018
+ intent_thread_uuid: z.ZodOptional<z.ZodString>;
893
1019
  } & {
894
1020
  node_kind: z.ZodLiteral<"iteration_summary">;
895
1021
  iteration: z.ZodNumber;
@@ -1026,6 +1152,9 @@ export declare const AuditEvent: z.ZodDiscriminatedUnion<"node_kind", [z.ZodObje
1026
1152
  verdict: "PASS" | "ITERATE" | "EXHAUSTED";
1027
1153
  reason: string;
1028
1154
  };
1155
+ phase?: "why" | "how" | "what" | undefined;
1156
+ okr_id?: string | undefined;
1157
+ intent_thread_uuid?: string | undefined;
1029
1158
  }, {
1030
1159
  run_id: string;
1031
1160
  iteration: number;
@@ -1060,6 +1189,9 @@ export declare const AuditEvent: z.ZodDiscriminatedUnion<"node_kind", [z.ZodObje
1060
1189
  verdict: "PASS" | "ITERATE" | "EXHAUSTED";
1061
1190
  reason: string;
1062
1191
  };
1192
+ phase?: "why" | "how" | "what" | undefined;
1193
+ okr_id?: string | undefined;
1194
+ intent_thread_uuid?: string | undefined;
1063
1195
  }>, z.ZodObject<{
1064
1196
  run_id: z.ZodString;
1065
1197
  /** Monotonically incrementing within a run, starting at 1. */
@@ -1071,6 +1203,12 @@ export declare const AuditEvent: z.ZodDiscriminatedUnion<"node_kind", [z.ZodObje
1071
1203
  prev_event_hash: z.ZodNullable<z.ZodString>;
1072
1204
  /** SHA-256 of THIS event with `event_hash` set to the empty string. */
1073
1205
  event_hash: z.ZodString;
1206
+ /** Which OKR phase this event belongs to. */
1207
+ phase: z.ZodOptional<z.ZodEnum<["why", "how", "what"]>>;
1208
+ /** Anchor OKR id (human-readable). */
1209
+ okr_id: z.ZodOptional<z.ZodString>;
1210
+ /** Cross-repo audit correlation key (UUID v4). */
1211
+ intent_thread_uuid: z.ZodOptional<z.ZodString>;
1074
1212
  } & {
1075
1213
  node_kind: z.ZodLiteral<"run_complete">;
1076
1214
  outcome: z.ZodObject<{
@@ -1121,6 +1259,9 @@ export declare const AuditEvent: z.ZodDiscriminatedUnion<"node_kind", [z.ZodObje
1121
1259
  chain_root_hash: string;
1122
1260
  pr_url?: string | undefined;
1123
1261
  };
1262
+ phase?: "why" | "how" | "what" | undefined;
1263
+ okr_id?: string | undefined;
1264
+ intent_thread_uuid?: string | undefined;
1124
1265
  }, {
1125
1266
  run_id: string;
1126
1267
  event_id: number;
@@ -1140,6 +1281,9 @@ export declare const AuditEvent: z.ZodDiscriminatedUnion<"node_kind", [z.ZodObje
1140
1281
  chain_root_hash: string;
1141
1282
  pr_url?: string | undefined;
1142
1283
  };
1284
+ phase?: "why" | "how" | "what" | undefined;
1285
+ okr_id?: string | undefined;
1286
+ intent_thread_uuid?: string | undefined;
1143
1287
  }>]>;
1144
1288
  export type AuditEvent = z.infer<typeof AuditEvent>;
1145
1289
  export type PureApiEvent = z.infer<typeof PureApiEvent>;
@@ -27,6 +27,17 @@ const Envelope = zod_1.z.object({
27
27
  prev_event_hash: primitives_1.Sha256.nullable(),
28
28
  /** SHA-256 of THIS event with `event_hash` set to the empty string. */
29
29
  event_hash: primitives_1.Sha256,
30
+ // ── v4 agentic-SDLC governance fields (Phase A-PR4) ─────────────────
31
+ // All three are OPTIONAL so legacy CI-only runs (without an OKR anchor)
32
+ // continue to validate. Phase B+ OKR-anchored runs populate them so
33
+ // verify-chain can stitch events across repos via intent_thread_uuid.
34
+ // See vscode-extension/design/agentic-sdlc.md §4.4 + §11.1.6.
35
+ /** Which OKR phase this event belongs to. */
36
+ phase: zod_1.z.enum(['why', 'how', 'what']).optional(),
37
+ /** Anchor OKR id (human-readable). */
38
+ okr_id: zod_1.z.string().optional(),
39
+ /** Cross-repo audit correlation key (UUID v4). */
40
+ intent_thread_uuid: zod_1.z.string().uuid().optional(),
30
41
  });
31
42
  /** `pure_api` — deterministic external HTTP call (Tavily, arXiv, USPTO, HN, GitHub REST). */
32
43
  const PureApiEvent = Envelope.extend({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maintainabilityai/research-runner",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "description": "Research + PRD agent runner — orchestrates the Archeologist and PRD pipelines for the MaintainabilityAI governance mesh",
5
5
  "license": "MIT",
6
6
  "author": "MaintainabilityAI",