@maintainabilityai/research-runner 0.1.1

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.
Files changed (102) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +82 -0
  3. package/bin/research-runner.js +2 -0
  4. package/dist/cli.d.ts +1 -0
  5. package/dist/cli.js +209 -0
  6. package/dist/llm/anthropic-client.d.ts +39 -0
  7. package/dist/llm/anthropic-client.js +74 -0
  8. package/dist/llm/github-models-client.d.ts +46 -0
  9. package/dist/llm/github-models-client.js +78 -0
  10. package/dist/llm/llm-router.d.ts +46 -0
  11. package/dist/llm/llm-router.js +60 -0
  12. package/dist/mesh/get-mesh-sha.d.ts +1 -0
  13. package/dist/mesh/get-mesh-sha.js +27 -0
  14. package/dist/mesh/mesh-reader.d.ts +14 -0
  15. package/dist/mesh/mesh-reader.js +392 -0
  16. package/dist/mesh/prompt-loader.d.ts +22 -0
  17. package/dist/mesh/prompt-loader.js +119 -0
  18. package/dist/mesh/threat-model-reader.d.ts +33 -0
  19. package/dist/mesh/threat-model-reader.js +123 -0
  20. package/dist/runner/archeologist.d.ts +39 -0
  21. package/dist/runner/archeologist.js +620 -0
  22. package/dist/runner/audit-emitter.d.ts +62 -0
  23. package/dist/runner/audit-emitter.js +210 -0
  24. package/dist/runner/hatters-tag-builder.d.ts +52 -0
  25. package/dist/runner/hatters-tag-builder.js +40 -0
  26. package/dist/runner/nodes/analyze-architecture.d.ts +10 -0
  27. package/dist/runner/nodes/analyze-architecture.js +447 -0
  28. package/dist/runner/nodes/arxiv-search.d.ts +12 -0
  29. package/dist/runner/nodes/arxiv-search.js +52 -0
  30. package/dist/runner/nodes/clone-and-index.d.ts +32 -0
  31. package/dist/runner/nodes/clone-and-index.js +158 -0
  32. package/dist/runner/nodes/dedupe-and-rank.d.ts +27 -0
  33. package/dist/runner/nodes/dedupe-and-rank.js +98 -0
  34. package/dist/runner/nodes/deterministic-review.d.ts +55 -0
  35. package/dist/runner/nodes/deterministic-review.js +206 -0
  36. package/dist/runner/nodes/expert-review.d.ts +68 -0
  37. package/dist/runner/nodes/expert-review.js +197 -0
  38. package/dist/runner/nodes/gap-analysis.d.ts +48 -0
  39. package/dist/runner/nodes/gap-analysis.js +153 -0
  40. package/dist/runner/nodes/generate-prd-manifest.d.ts +53 -0
  41. package/dist/runner/nodes/generate-prd-manifest.js +209 -0
  42. package/dist/runner/nodes/hackernews-search.d.ts +12 -0
  43. package/dist/runner/nodes/hackernews-search.js +63 -0
  44. package/dist/runner/nodes/identify-gaps.d.ts +33 -0
  45. package/dist/runner/nodes/identify-gaps.js +185 -0
  46. package/dist/runner/nodes/plan-queries.d.ts +28 -0
  47. package/dist/runner/nodes/plan-queries.js +120 -0
  48. package/dist/runner/nodes/prd-validator.d.ts +51 -0
  49. package/dist/runner/nodes/prd-validator.js +203 -0
  50. package/dist/runner/nodes/synthesis-archaeology-validator.d.ts +22 -0
  51. package/dist/runner/nodes/synthesis-archaeology-validator.js +131 -0
  52. package/dist/runner/nodes/synthesis-validator.d.ts +51 -0
  53. package/dist/runner/nodes/synthesis-validator.js +185 -0
  54. package/dist/runner/nodes/synthesize-prd.d.ts +84 -0
  55. package/dist/runner/nodes/synthesize-prd.js +202 -0
  56. package/dist/runner/nodes/synthesize-report.d.ts +53 -0
  57. package/dist/runner/nodes/synthesize-report.js +188 -0
  58. package/dist/runner/nodes/tavily-search.d.ts +21 -0
  59. package/dist/runner/nodes/tavily-search.js +57 -0
  60. package/dist/runner/nodes/uspto-search.d.ts +13 -0
  61. package/dist/runner/nodes/uspto-search.js +62 -0
  62. package/dist/runner/nodes/verify-grounding.d.ts +54 -0
  63. package/dist/runner/nodes/verify-grounding.js +134 -0
  64. package/dist/runner/prd.d.ts +28 -0
  65. package/dist/runner/prd.js +494 -0
  66. package/dist/schemas/audit-event.d.ts +1151 -0
  67. package/dist/schemas/audit-event.js +141 -0
  68. package/dist/schemas/index.d.ts +17 -0
  69. package/dist/schemas/index.js +33 -0
  70. package/dist/schemas/mesh-context.d.ts +415 -0
  71. package/dist/schemas/mesh-context.js +95 -0
  72. package/dist/schemas/observed-architecture.d.ts +262 -0
  73. package/dist/schemas/observed-architecture.js +90 -0
  74. package/dist/schemas/prd-brief.d.ts +111 -0
  75. package/dist/schemas/prd-brief.js +37 -0
  76. package/dist/schemas/prd-doc.d.ts +249 -0
  77. package/dist/schemas/prd-doc.js +42 -0
  78. package/dist/schemas/prd-manifest.d.ts +171 -0
  79. package/dist/schemas/prd-manifest.js +73 -0
  80. package/dist/schemas/primitives.d.ts +47 -0
  81. package/dist/schemas/primitives.js +41 -0
  82. package/dist/schemas/query-plan.d.ts +33 -0
  83. package/dist/schemas/query-plan.js +25 -0
  84. package/dist/schemas/ranked-source.d.ts +82 -0
  85. package/dist/schemas/ranked-source.js +29 -0
  86. package/dist/schemas/research-brief.d.ts +114 -0
  87. package/dist/schemas/research-brief.js +49 -0
  88. package/dist/schemas/research-doc.d.ts +104 -0
  89. package/dist/schemas/research-doc.js +37 -0
  90. package/dist/search/arxiv-client.d.ts +41 -0
  91. package/dist/search/arxiv-client.js +88 -0
  92. package/dist/search/hackernews-client.d.ts +33 -0
  93. package/dist/search/hackernews-client.js +44 -0
  94. package/dist/search/provider-result.d.ts +25 -0
  95. package/dist/search/provider-result.js +2 -0
  96. package/dist/search/tavily-client.d.ts +38 -0
  97. package/dist/search/tavily-client.js +53 -0
  98. package/dist/search/uspto-client.d.ts +50 -0
  99. package/dist/search/uspto-client.js +112 -0
  100. package/dist/utils/run-id.d.ts +2 -0
  101. package/dist/utils/run-id.js +22 -0
  102. package/package.json +53 -0
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuditEvent = void 0;
4
+ /**
5
+ * AuditEvent — the hash-chained JSONL events written to
6
+ * `.research-audit/<run_id>.jsonl` by every node in both pipelines.
7
+ *
8
+ * Discriminated by `node_kind`. The common envelope at the top of every
9
+ * variant carries the chain: `prev_event_hash` + `event_hash`, both
10
+ * SHA-256. The first event in a run has `prev_event_hash: null`. The
11
+ * `run_complete` event closes the run with a chain root hash.
12
+ *
13
+ * See docs/design/research-and-prd-agents.md §"Audit schema — per-node
14
+ * JSONL events" for the canonical definitions.
15
+ */
16
+ const zod_1 = require("zod");
17
+ const primitives_1 = require("./primitives");
18
+ /** Common envelope present on every event (NOT a partial — shared base). */
19
+ const Envelope = zod_1.z.object({
20
+ run_id: primitives_1.RunId,
21
+ /** Monotonically incrementing within a run, starting at 1. */
22
+ event_id: zod_1.z.number().int().positive(),
23
+ ts: primitives_1.IsoTimestamp,
24
+ node_name: zod_1.z.string().min(1),
25
+ duration_ms: zod_1.z.number().int().nonnegative(),
26
+ /** SHA-256 of the previous serialized event (without its own event_hash). Null on event 1. */
27
+ prev_event_hash: primitives_1.Sha256.nullable(),
28
+ /** SHA-256 of THIS event with `event_hash` set to the empty string. */
29
+ event_hash: primitives_1.Sha256,
30
+ });
31
+ /** `pure_api` — deterministic external HTTP call (Tavily, arXiv, USPTO, HN, GitHub REST). */
32
+ const PureApiEvent = Envelope.extend({
33
+ node_kind: zod_1.z.literal('pure_api'),
34
+ api: zod_1.z.object({
35
+ provider: zod_1.z.string(),
36
+ endpoint: zod_1.z.string(),
37
+ /** Redacted query / body — secrets must NOT appear here. */
38
+ request_summary: zod_1.z.string(),
39
+ http_status: zod_1.z.number().int(),
40
+ response_byte_count: zod_1.z.number().int().nonnegative(),
41
+ }),
42
+ });
43
+ /** `llm` — non-deterministic LLM call (plan_queries, synthesize, expert reviews). */
44
+ const LlmEvent = Envelope.extend({
45
+ node_kind: zod_1.z.literal('llm'),
46
+ llm: zod_1.z.object({
47
+ provider: primitives_1.LlmProvider,
48
+ model: zod_1.z.string(),
49
+ prompt_pack: zod_1.z.object({
50
+ /** Path relative to mesh root, e.g. `.caterpillar/prompts/research/synthesis.md@v1.0.0`. */
51
+ path: zod_1.z.string(),
52
+ sha256: primitives_1.Sha256,
53
+ }),
54
+ input_tokens: zod_1.z.number().int().nonnegative(),
55
+ output_tokens: zod_1.z.number().int().nonnegative(),
56
+ /** USD cost estimate. */
57
+ cost_usd: zod_1.z.number().nonnegative(),
58
+ /** Guardrail decisions for this hop. */
59
+ guardrails: zod_1.z.object({
60
+ mode: primitives_1.GuardrailMode,
61
+ pre: zod_1.z.enum(['PASS', 'WARN', 'BLOCK']),
62
+ post: zod_1.z.enum(['PASS', 'WARN', 'BLOCK']),
63
+ }),
64
+ }),
65
+ });
66
+ /** `pure` — local-only deterministic computation (validate, dedupe, structural check). */
67
+ const PureEvent = Envelope.extend({
68
+ node_kind: zod_1.z.literal('pure'),
69
+ pure: zod_1.z.object({
70
+ inputs_summary: zod_1.z.string(),
71
+ outputs_summary: zod_1.z.string(),
72
+ }),
73
+ });
74
+ /** `node_error` — any node failure, before any retry. */
75
+ const NodeErrorEvent = Envelope.extend({
76
+ node_kind: zod_1.z.literal('node_error'),
77
+ error: zod_1.z.object({
78
+ message: zod_1.z.string(),
79
+ /** Optional stack — redacted of secrets. */
80
+ stack: zod_1.z.string().optional(),
81
+ retryable: zod_1.z.boolean(),
82
+ }),
83
+ });
84
+ /**
85
+ * `iteration_summary` — emitted once per PRD refinement loop iteration after
86
+ * `verify_grounding` resolves. Carries the 4 reviewer signals + composite +
87
+ * verdict in one place so the published PRD can render a score-progression
88
+ * table without re-parsing earlier events.
89
+ */
90
+ const IterationSummaryEvent = Envelope.extend({
91
+ node_kind: zod_1.z.literal('iteration_summary'),
92
+ iteration: zod_1.z.number().int().min(1).max(5),
93
+ summary: zod_1.z.object({
94
+ det_arch: zod_1.z.object({
95
+ severity: zod_1.z.enum(['PASS', 'MINOR', 'MAJOR']),
96
+ invalid_citations: zod_1.z.number().int().nonnegative(),
97
+ coverage_discrepancies: zod_1.z.number().int().nonnegative(),
98
+ }),
99
+ det_sec: zod_1.z.object({
100
+ severity: zod_1.z.enum(['PASS', 'MINOR', 'MAJOR']),
101
+ invalid_citations: zod_1.z.number().int().nonnegative(),
102
+ coverage_discrepancies: zod_1.z.number().int().nonnegative(),
103
+ }),
104
+ llm_arch: zod_1.z.object({
105
+ score: zod_1.z.number().min(0).max(1),
106
+ severity: zod_1.z.enum(['PASS', 'MINOR', 'MAJOR', 'BLOCKING']),
107
+ }),
108
+ llm_sec: zod_1.z.object({
109
+ score: zod_1.z.number().min(0).max(1),
110
+ severity: zod_1.z.enum(['PASS', 'MINOR', 'MAJOR', 'BLOCKING']),
111
+ }),
112
+ composite_score: zod_1.z.number().min(0).max(1),
113
+ /** |llm_arch.score - llm_sec.score| — used by verify_grounding for the disagreement rule. */
114
+ disagreement_delta: zod_1.z.number().min(0).max(1),
115
+ verdict: zod_1.z.enum(['PASS', 'ITERATE', 'EXHAUSTED']),
116
+ reason: zod_1.z.string(),
117
+ }),
118
+ });
119
+ /** `run_complete` — final event emitted by verify_and_trigger. Closes the chain. */
120
+ const RunCompleteEvent = Envelope.extend({
121
+ node_kind: zod_1.z.literal('run_complete'),
122
+ outcome: zod_1.z.object({
123
+ status: zod_1.z.enum(['ok', 'failed', 'partial']),
124
+ mesh_sha: primitives_1.GitSha,
125
+ total_input_tokens: zod_1.z.number().int().nonnegative(),
126
+ total_output_tokens: zod_1.z.number().int().nonnegative(),
127
+ total_cost_usd: zod_1.z.number().nonnegative(),
128
+ artifact_paths: zod_1.z.array(zod_1.z.string()),
129
+ pr_url: zod_1.z.string().url().optional(),
130
+ /** SHA-256 of the entire chain (the last event's event_hash). */
131
+ chain_root_hash: primitives_1.Sha256,
132
+ }),
133
+ });
134
+ exports.AuditEvent = zod_1.z.discriminatedUnion('node_kind', [
135
+ PureApiEvent,
136
+ LlmEvent,
137
+ PureEvent,
138
+ NodeErrorEvent,
139
+ IterationSummaryEvent,
140
+ RunCompleteEvent,
141
+ ]);
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Public schema surface for @maintainabilityai/research-runner.
3
+ *
4
+ * Importers should reference schemas through this barrel so internal file
5
+ * reorganisation doesn't break downstream code.
6
+ */
7
+ export * from './primitives';
8
+ export * from './research-brief';
9
+ export * from './mesh-context';
10
+ export * from './query-plan';
11
+ export * from './ranked-source';
12
+ export * from './research-doc';
13
+ export * from './prd-brief';
14
+ export * from './prd-doc';
15
+ export * from './prd-manifest';
16
+ export * from './audit-event';
17
+ export * from './observed-architecture';
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ /**
18
+ * Public schema surface for @maintainabilityai/research-runner.
19
+ *
20
+ * Importers should reference schemas through this barrel so internal file
21
+ * reorganisation doesn't break downstream code.
22
+ */
23
+ __exportStar(require("./primitives"), exports);
24
+ __exportStar(require("./research-brief"), exports);
25
+ __exportStar(require("./mesh-context"), exports);
26
+ __exportStar(require("./query-plan"), exports);
27
+ __exportStar(require("./ranked-source"), exports);
28
+ __exportStar(require("./research-doc"), exports);
29
+ __exportStar(require("./prd-brief"), exports);
30
+ __exportStar(require("./prd-doc"), exports);
31
+ __exportStar(require("./prd-manifest"), exports);
32
+ __exportStar(require("./audit-event"), exports);
33
+ __exportStar(require("./observed-architecture"), exports);
@@ -0,0 +1,415 @@
1
+ /**
2
+ * MeshContext — what `gather_mesh_context` produces for every LLM node.
3
+ *
4
+ * Mirrors the shape defined in the design doc (§"gather_mesh_context — the
5
+ * mesh IS the expert"). Every LLM call in both the Archeologist and PRD
6
+ * pipelines receives this as its grounding payload.
7
+ */
8
+ import { z } from 'zod';
9
+ /** Structural gap kinds the GovernanceScorer detects per BAR. */
10
+ export declare const MeshGapKind: z.ZodEnum<["no_threat_model", "no_controls_mapping", "no_adrs", "stale_research", "missing_prd_for_planned_feature", "low_architecture_pillar", "low_security_pillar"]>;
11
+ export type MeshGapKind = z.infer<typeof MeshGapKind>;
12
+ export declare const MeshContext: z.ZodObject<{
13
+ scope: z.ZodObject<{
14
+ level: z.ZodEnum<["platform", "bar"]>;
15
+ bar_id: z.ZodOptional<z.ZodString>;
16
+ platform_id: z.ZodOptional<z.ZodString>;
17
+ }, "strip", z.ZodTypeAny, {
18
+ level: "platform" | "bar";
19
+ bar_id?: string | undefined;
20
+ platform_id?: string | undefined;
21
+ }, {
22
+ level: "platform" | "bar";
23
+ bar_id?: string | undefined;
24
+ platform_id?: string | undefined;
25
+ }>;
26
+ /** Git SHA of the mesh repo at the moment context was read. */
27
+ mesh_sha: z.ZodString;
28
+ /** Always populated. */
29
+ portfolio: z.ZodObject<{
30
+ name: z.ZodString;
31
+ governance_policy: z.ZodUnknown;
32
+ capability_models: z.ZodArray<z.ZodUnknown, "many">;
33
+ related_research_summaries: z.ZodArray<z.ZodObject<{
34
+ research_id: z.ZodString;
35
+ topic: z.ZodString;
36
+ published_at: z.ZodString;
37
+ }, "strip", z.ZodTypeAny, {
38
+ topic: string;
39
+ research_id: string;
40
+ published_at: string;
41
+ }, {
42
+ topic: string;
43
+ research_id: string;
44
+ published_at: string;
45
+ }>, "many">;
46
+ }, "strip", z.ZodTypeAny, {
47
+ name: string;
48
+ capability_models: unknown[];
49
+ related_research_summaries: {
50
+ topic: string;
51
+ research_id: string;
52
+ published_at: string;
53
+ }[];
54
+ governance_policy?: unknown;
55
+ }, {
56
+ name: string;
57
+ capability_models: unknown[];
58
+ related_research_summaries: {
59
+ topic: string;
60
+ research_id: string;
61
+ published_at: string;
62
+ }[];
63
+ governance_policy?: unknown;
64
+ }>;
65
+ /** Populated when level is platform OR bar. */
66
+ platform: z.ZodNullable<z.ZodObject<{
67
+ platform_id: z.ZodString;
68
+ architecture: z.ZodUnknown;
69
+ sibling_bars: z.ZodArray<z.ZodObject<{
70
+ bar_id: z.ZodString;
71
+ name: z.ZodString;
72
+ composite_score: z.ZodNumber;
73
+ /** owner/repo entries parsed from each sibling BAR's app.yaml. */
74
+ linked_repos: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
75
+ /** CALM node ids the BAR owns. Used by generate-prd-manifest's
76
+ * impact classification to decide whether a sibling is HIGH
77
+ * confidence (one of these nodes is referenced by an endpoint)
78
+ * or LOW (no citation overlap). */
79
+ calm_node_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
80
+ /** Threat ids declared in the BAR's threat-model.yaml. Used by the
81
+ * same impact classification to flag siblings whose threats are
82
+ * cited by the PRD's security requirements. */
83
+ threat_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
84
+ }, "strip", z.ZodTypeAny, {
85
+ bar_id: string;
86
+ name: string;
87
+ composite_score: number;
88
+ linked_repos: string[];
89
+ calm_node_ids: string[];
90
+ threat_ids: string[];
91
+ }, {
92
+ bar_id: string;
93
+ name: string;
94
+ composite_score: number;
95
+ linked_repos?: string[] | undefined;
96
+ calm_node_ids?: string[] | undefined;
97
+ threat_ids?: string[] | undefined;
98
+ }>, "many">;
99
+ related_research_summaries: z.ZodArray<z.ZodObject<{
100
+ research_id: z.ZodString;
101
+ topic: z.ZodString;
102
+ published_at: z.ZodString;
103
+ }, "strip", z.ZodTypeAny, {
104
+ topic: string;
105
+ research_id: string;
106
+ published_at: string;
107
+ }, {
108
+ topic: string;
109
+ research_id: string;
110
+ published_at: string;
111
+ }>, "many">;
112
+ }, "strip", z.ZodTypeAny, {
113
+ platform_id: string;
114
+ related_research_summaries: {
115
+ topic: string;
116
+ research_id: string;
117
+ published_at: string;
118
+ }[];
119
+ sibling_bars: {
120
+ bar_id: string;
121
+ name: string;
122
+ composite_score: number;
123
+ linked_repos: string[];
124
+ calm_node_ids: string[];
125
+ threat_ids: string[];
126
+ }[];
127
+ architecture?: unknown;
128
+ }, {
129
+ platform_id: string;
130
+ related_research_summaries: {
131
+ topic: string;
132
+ research_id: string;
133
+ published_at: string;
134
+ }[];
135
+ sibling_bars: {
136
+ bar_id: string;
137
+ name: string;
138
+ composite_score: number;
139
+ linked_repos?: string[] | undefined;
140
+ calm_node_ids?: string[] | undefined;
141
+ threat_ids?: string[] | undefined;
142
+ }[];
143
+ architecture?: unknown;
144
+ }>>;
145
+ /** Populated only when level is bar. */
146
+ bar: z.ZodNullable<z.ZodObject<{
147
+ bar_id: z.ZodString;
148
+ name: z.ZodString;
149
+ composite_score: z.ZodNumber;
150
+ tier: z.ZodEnum<["restricted", "supervised", "autonomous"]>;
151
+ calm_model: z.ZodUnknown;
152
+ threats: z.ZodNullable<z.ZodUnknown>;
153
+ controls: z.ZodNullable<z.ZodUnknown>;
154
+ adrs: z.ZodArray<z.ZodObject<{
155
+ id: z.ZodString;
156
+ title: z.ZodString;
157
+ status: z.ZodString;
158
+ decision: z.ZodString;
159
+ }, "strip", z.ZodTypeAny, {
160
+ status: string;
161
+ id: string;
162
+ title: string;
163
+ decision: string;
164
+ }, {
165
+ status: string;
166
+ id: string;
167
+ title: string;
168
+ decision: string;
169
+ }>, "many">;
170
+ pillar_scores: z.ZodObject<{
171
+ architecture: z.ZodNumber;
172
+ security: z.ZodNumber;
173
+ info_risk: z.ZodNumber;
174
+ operations: z.ZodNumber;
175
+ }, "strip", z.ZodTypeAny, {
176
+ architecture: number;
177
+ security: number;
178
+ info_risk: number;
179
+ operations: number;
180
+ }, {
181
+ architecture: number;
182
+ security: number;
183
+ info_risk: number;
184
+ operations: number;
185
+ }>;
186
+ related_research: z.ZodArray<z.ZodObject<{
187
+ research_id: z.ZodString;
188
+ topic: z.ZodString;
189
+ published_at: z.ZodString;
190
+ }, "strip", z.ZodTypeAny, {
191
+ topic: string;
192
+ research_id: string;
193
+ published_at: string;
194
+ }, {
195
+ topic: string;
196
+ research_id: string;
197
+ published_at: string;
198
+ }>, "many">;
199
+ related_prds: z.ZodArray<z.ZodObject<{
200
+ research_id: z.ZodString;
201
+ topic: z.ZodString;
202
+ published_at: z.ZodString;
203
+ }, "strip", z.ZodTypeAny, {
204
+ topic: string;
205
+ research_id: string;
206
+ published_at: string;
207
+ }, {
208
+ topic: string;
209
+ research_id: string;
210
+ published_at: string;
211
+ }>, "many">;
212
+ mesh_gaps: z.ZodArray<z.ZodEnum<["no_threat_model", "no_controls_mapping", "no_adrs", "stale_research", "missing_prd_for_planned_feature", "low_architecture_pillar", "low_security_pillar"]>, "many">;
213
+ /** owner/repo entries parsed from app.yaml application.repos — drives PrdManifest.target_repos. */
214
+ linked_repos: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
215
+ }, "strip", z.ZodTypeAny, {
216
+ bar_id: string;
217
+ name: string;
218
+ composite_score: number;
219
+ linked_repos: string[];
220
+ tier: "restricted" | "supervised" | "autonomous";
221
+ adrs: {
222
+ status: string;
223
+ id: string;
224
+ title: string;
225
+ decision: string;
226
+ }[];
227
+ pillar_scores: {
228
+ architecture: number;
229
+ security: number;
230
+ info_risk: number;
231
+ operations: number;
232
+ };
233
+ related_research: {
234
+ topic: string;
235
+ research_id: string;
236
+ published_at: string;
237
+ }[];
238
+ related_prds: {
239
+ topic: string;
240
+ research_id: string;
241
+ published_at: string;
242
+ }[];
243
+ mesh_gaps: ("no_threat_model" | "no_controls_mapping" | "no_adrs" | "stale_research" | "missing_prd_for_planned_feature" | "low_architecture_pillar" | "low_security_pillar")[];
244
+ calm_model?: unknown;
245
+ threats?: unknown;
246
+ controls?: unknown;
247
+ }, {
248
+ bar_id: string;
249
+ name: string;
250
+ composite_score: number;
251
+ tier: "restricted" | "supervised" | "autonomous";
252
+ adrs: {
253
+ status: string;
254
+ id: string;
255
+ title: string;
256
+ decision: string;
257
+ }[];
258
+ pillar_scores: {
259
+ architecture: number;
260
+ security: number;
261
+ info_risk: number;
262
+ operations: number;
263
+ };
264
+ related_research: {
265
+ topic: string;
266
+ research_id: string;
267
+ published_at: string;
268
+ }[];
269
+ related_prds: {
270
+ topic: string;
271
+ research_id: string;
272
+ published_at: string;
273
+ }[];
274
+ mesh_gaps: ("no_threat_model" | "no_controls_mapping" | "no_adrs" | "stale_research" | "missing_prd_for_planned_feature" | "low_architecture_pillar" | "low_security_pillar")[];
275
+ linked_repos?: string[] | undefined;
276
+ calm_model?: unknown;
277
+ threats?: unknown;
278
+ controls?: unknown;
279
+ }>>;
280
+ }, "strip", z.ZodTypeAny, {
281
+ platform: {
282
+ platform_id: string;
283
+ related_research_summaries: {
284
+ topic: string;
285
+ research_id: string;
286
+ published_at: string;
287
+ }[];
288
+ sibling_bars: {
289
+ bar_id: string;
290
+ name: string;
291
+ composite_score: number;
292
+ linked_repos: string[];
293
+ calm_node_ids: string[];
294
+ threat_ids: string[];
295
+ }[];
296
+ architecture?: unknown;
297
+ } | null;
298
+ bar: {
299
+ bar_id: string;
300
+ name: string;
301
+ composite_score: number;
302
+ linked_repos: string[];
303
+ tier: "restricted" | "supervised" | "autonomous";
304
+ adrs: {
305
+ status: string;
306
+ id: string;
307
+ title: string;
308
+ decision: string;
309
+ }[];
310
+ pillar_scores: {
311
+ architecture: number;
312
+ security: number;
313
+ info_risk: number;
314
+ operations: number;
315
+ };
316
+ related_research: {
317
+ topic: string;
318
+ research_id: string;
319
+ published_at: string;
320
+ }[];
321
+ related_prds: {
322
+ topic: string;
323
+ research_id: string;
324
+ published_at: string;
325
+ }[];
326
+ mesh_gaps: ("no_threat_model" | "no_controls_mapping" | "no_adrs" | "stale_research" | "missing_prd_for_planned_feature" | "low_architecture_pillar" | "low_security_pillar")[];
327
+ calm_model?: unknown;
328
+ threats?: unknown;
329
+ controls?: unknown;
330
+ } | null;
331
+ scope: {
332
+ level: "platform" | "bar";
333
+ bar_id?: string | undefined;
334
+ platform_id?: string | undefined;
335
+ };
336
+ mesh_sha: string;
337
+ portfolio: {
338
+ name: string;
339
+ capability_models: unknown[];
340
+ related_research_summaries: {
341
+ topic: string;
342
+ research_id: string;
343
+ published_at: string;
344
+ }[];
345
+ governance_policy?: unknown;
346
+ };
347
+ }, {
348
+ platform: {
349
+ platform_id: string;
350
+ related_research_summaries: {
351
+ topic: string;
352
+ research_id: string;
353
+ published_at: string;
354
+ }[];
355
+ sibling_bars: {
356
+ bar_id: string;
357
+ name: string;
358
+ composite_score: number;
359
+ linked_repos?: string[] | undefined;
360
+ calm_node_ids?: string[] | undefined;
361
+ threat_ids?: string[] | undefined;
362
+ }[];
363
+ architecture?: unknown;
364
+ } | null;
365
+ bar: {
366
+ bar_id: string;
367
+ name: string;
368
+ composite_score: number;
369
+ tier: "restricted" | "supervised" | "autonomous";
370
+ adrs: {
371
+ status: string;
372
+ id: string;
373
+ title: string;
374
+ decision: string;
375
+ }[];
376
+ pillar_scores: {
377
+ architecture: number;
378
+ security: number;
379
+ info_risk: number;
380
+ operations: number;
381
+ };
382
+ related_research: {
383
+ topic: string;
384
+ research_id: string;
385
+ published_at: string;
386
+ }[];
387
+ related_prds: {
388
+ topic: string;
389
+ research_id: string;
390
+ published_at: string;
391
+ }[];
392
+ mesh_gaps: ("no_threat_model" | "no_controls_mapping" | "no_adrs" | "stale_research" | "missing_prd_for_planned_feature" | "low_architecture_pillar" | "low_security_pillar")[];
393
+ linked_repos?: string[] | undefined;
394
+ calm_model?: unknown;
395
+ threats?: unknown;
396
+ controls?: unknown;
397
+ } | null;
398
+ scope: {
399
+ level: "platform" | "bar";
400
+ bar_id?: string | undefined;
401
+ platform_id?: string | undefined;
402
+ };
403
+ mesh_sha: string;
404
+ portfolio: {
405
+ name: string;
406
+ capability_models: unknown[];
407
+ related_research_summaries: {
408
+ topic: string;
409
+ research_id: string;
410
+ published_at: string;
411
+ }[];
412
+ governance_policy?: unknown;
413
+ };
414
+ }>;
415
+ export type MeshContext = z.infer<typeof MeshContext>;