@lucern/events 0.3.0-alpha.3 → 0.3.0-alpha.5

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/dist/outbox.js CHANGED
@@ -1,6 +1,487 @@
1
1
  import { z } from 'zod';
2
2
  import { v } from 'convex/values';
3
3
 
4
+ // ../contracts/src/graph-intelligence.contract.ts
5
+ var GRAPH_INTELLIGENCE_MODE_TOOL_NAMES = {
6
+ core: [
7
+ "get_graph_structure_analysis",
8
+ "get_topic_coverage",
9
+ "get_graph_gaps",
10
+ "list_beliefs",
11
+ "list_questions",
12
+ "search_evidence"
13
+ ],
14
+ bias: [
15
+ "get_graph_structure_analysis",
16
+ "detect_confirmation_bias",
17
+ "find_contradictions",
18
+ "search_evidence",
19
+ "list_beliefs"
20
+ ],
21
+ stress: [
22
+ "get_graph_structure_analysis",
23
+ "get_graph_gaps",
24
+ "find_contradictions",
25
+ "get_falsification_questions",
26
+ "list_beliefs",
27
+ "list_questions"
28
+ ],
29
+ operational: [
30
+ "get_topic_coverage",
31
+ "get_graph_gaps",
32
+ "list_beliefs",
33
+ "list_questions",
34
+ "search_evidence"
35
+ ],
36
+ alpha: [
37
+ "get_graph_structure_analysis",
38
+ "detect_confirmation_bias",
39
+ "find_contradictions",
40
+ "search_beliefs",
41
+ "search_evidence"
42
+ ],
43
+ semantic: [
44
+ "get_graph_structure_analysis",
45
+ "search_beliefs",
46
+ "search_evidence",
47
+ "traverse_graph",
48
+ "query_lineage",
49
+ "get_graph_neighborhood"
50
+ ],
51
+ evidence: [
52
+ "get_graph_structure_analysis",
53
+ "get_topic_coverage",
54
+ "search_evidence",
55
+ "get_falsification_questions",
56
+ "find_contradictions"
57
+ ]
58
+ };
59
+ var byMode = (mode) => GRAPH_INTELLIGENCE_MODE_TOOL_NAMES[mode];
60
+ var GRAPH_INTELLIGENCE_QUERIES = [
61
+ {
62
+ id: "confirmation-bias",
63
+ categoryId: "problems",
64
+ mode: "bias",
65
+ name: "Find Confirmation Bias",
66
+ description: "Find beliefs supported mainly by confirming evidence.",
67
+ prompt: "Find beliefs where supporting evidence overwhelms challenging evidence. Prioritize high-conviction beliefs with few defeaters.",
68
+ highlightStrategy: "bias-risk",
69
+ riskLevel: "high"
70
+ },
71
+ {
72
+ id: "contradiction-map",
73
+ categoryId: "problems",
74
+ mode: "stress",
75
+ name: "Map Contradictions",
76
+ description: "Surface direct and indirect contradiction clusters.",
77
+ prompt: "Map the graph's contradiction clusters and explain which tensions matter most.",
78
+ highlightStrategy: "contradictions",
79
+ riskLevel: "high"
80
+ },
81
+ {
82
+ id: "weak-evidence",
83
+ categoryId: "problems",
84
+ mode: "stress",
85
+ name: "Weak Evidence Chains",
86
+ description: "Find important claims with thin or indirect evidence.",
87
+ prompt: "Find high-importance beliefs whose evidence support is thin, indirect, stale, or low quality.",
88
+ highlightStrategy: "weak-support",
89
+ riskLevel: "medium"
90
+ },
91
+ {
92
+ id: "single-source",
93
+ categoryId: "problems",
94
+ mode: "bias",
95
+ name: "Single-Source Risk",
96
+ description: "Find claims overly dependent on one source or source type.",
97
+ prompt: "Identify beliefs that rely on a single source, one methodology, or one repeated perspective.",
98
+ highlightStrategy: "source-concentration",
99
+ riskLevel: "medium"
100
+ },
101
+ {
102
+ id: "untested-assumptions",
103
+ categoryId: "problems",
104
+ mode: "stress",
105
+ name: "Untested Assumptions",
106
+ description: "Find load-bearing assumptions without falsification paths.",
107
+ prompt: "Find assumptions that appear load-bearing but do not have direct testing questions or falsification evidence.",
108
+ highlightStrategy: "untested",
109
+ riskLevel: "high"
110
+ },
111
+ {
112
+ id: "load-bearing-beliefs",
113
+ categoryId: "problems",
114
+ mode: "stress",
115
+ name: "Load-Bearing Beliefs",
116
+ description: "Find central beliefs whose failure would affect many claims.",
117
+ prompt: "Find the beliefs with the largest downstream impact if they are wrong.",
118
+ highlightStrategy: "load-bearing",
119
+ riskLevel: "high"
120
+ },
121
+ {
122
+ id: "cascade-analysis",
123
+ categoryId: "problems",
124
+ mode: "stress",
125
+ name: "Cascade Analysis",
126
+ description: "Trace what changes if a belief is weakened or invalidated.",
127
+ prompt: "Analyze likely downstream cascades if the most central or uncertain beliefs are weakened.",
128
+ highlightStrategy: "cascade",
129
+ riskLevel: "high"
130
+ },
131
+ {
132
+ id: "unanswered-questions",
133
+ categoryId: "gaps",
134
+ mode: "operational",
135
+ name: "Unanswered Questions",
136
+ description: "Find important open questions that block confidence.",
137
+ prompt: "Identify the most important unanswered questions and explain which beliefs they block.",
138
+ highlightStrategy: "open-questions"
139
+ },
140
+ {
141
+ id: "thin-themes",
142
+ categoryId: "gaps",
143
+ mode: "operational",
144
+ name: "Thin Themes",
145
+ description: "Find topics with shallow belief or evidence coverage.",
146
+ prompt: "Find themes that look underdeveloped relative to their role in the graph.",
147
+ highlightStrategy: "thin-themes"
148
+ },
149
+ {
150
+ id: "missing-evidence",
151
+ categoryId: "gaps",
152
+ mode: "stress",
153
+ name: "Missing Evidence",
154
+ description: "Find beliefs that need specific missing evidence.",
155
+ prompt: "Find the most valuable missing evidence needed to strengthen or falsify the graph.",
156
+ highlightStrategy: "missing-evidence"
157
+ },
158
+ {
159
+ id: "isolated-clusters",
160
+ categoryId: "gaps",
161
+ mode: "operational",
162
+ name: "Isolated Clusters",
163
+ description: "Find clusters not connected to the broader graph.",
164
+ prompt: "Find isolated graph clusters and recommend bridge questions or bridge evidence.",
165
+ highlightStrategy: "isolated-clusters"
166
+ },
167
+ {
168
+ id: "source-contribution",
169
+ categoryId: "gaps",
170
+ mode: "evidence",
171
+ name: "Source Contribution",
172
+ description: "Assess how source mix shapes the graph.",
173
+ prompt: "Assess whether the source mix is balanced enough for the graph's strongest claims.",
174
+ highlightStrategy: "source-mix"
175
+ },
176
+ {
177
+ id: "stale-beliefs",
178
+ categoryId: "gaps",
179
+ mode: "operational",
180
+ name: "Stale Beliefs",
181
+ description: "Find beliefs that need review because they are old or stale.",
182
+ prompt: "Find beliefs that should be revisited because they are stale, unsupported by recent evidence, or contradicted by newer context.",
183
+ highlightStrategy: "staleness"
184
+ },
185
+ {
186
+ id: "assumption-pyramid",
187
+ categoryId: "reasoning",
188
+ mode: "operational",
189
+ name: "Assumption Pyramid",
190
+ description: "Show which conclusions rest on which assumptions.",
191
+ prompt: "Build an assumption pyramid from the graph: foundational assumptions, intermediate claims, and top-level conclusions.",
192
+ highlightStrategy: "assumptions"
193
+ },
194
+ {
195
+ id: "converging-evidence",
196
+ categoryId: "reasoning",
197
+ mode: "evidence",
198
+ name: "Converging Evidence",
199
+ description: "Find claims supported by independent evidence streams.",
200
+ prompt: "Find beliefs with genuinely independent converging evidence and explain why they are robust.",
201
+ highlightStrategy: "convergence"
202
+ },
203
+ {
204
+ id: "weakest-links",
205
+ categoryId: "reasoning",
206
+ mode: "stress",
207
+ name: "Weakest Links",
208
+ description: "Find the weakest links in important reasoning chains.",
209
+ prompt: "Find the weakest links in important reasoning chains and explain how to test them.",
210
+ highlightStrategy: "weak-links",
211
+ riskLevel: "medium"
212
+ },
213
+ {
214
+ id: "challenged-beliefs",
215
+ categoryId: "reasoning",
216
+ mode: "stress",
217
+ name: "Challenged Beliefs",
218
+ description: "Find beliefs with active challenges or defeaters.",
219
+ prompt: "Find beliefs with active challenges, contradiction edges, or unresolved defeaters.",
220
+ highlightStrategy: "challenged"
221
+ },
222
+ {
223
+ id: "contrarian-map",
224
+ categoryId: "strategic",
225
+ mode: "alpha",
226
+ name: "Contrarian Map",
227
+ description: "Find non-consensus beliefs and where they are grounded.",
228
+ prompt: "Find the graph's strongest contrarian or non-consensus beliefs and explain their support.",
229
+ highlightStrategy: "contrarian"
230
+ },
231
+ {
232
+ id: "irreversibility-audit",
233
+ categoryId: "strategic",
234
+ mode: "stress",
235
+ name: "Irreversibility Audit",
236
+ description: "Find irreversible bets and assumptions behind them.",
237
+ prompt: "Audit irreversible decisions or beliefs and identify what must be true before acting.",
238
+ highlightStrategy: "irreversible",
239
+ riskLevel: "high"
240
+ },
241
+ {
242
+ id: "pre-mortem",
243
+ categoryId: "strategic",
244
+ mode: "stress",
245
+ name: "Pre-Mortem",
246
+ description: "Explain how the graph could be wrong.",
247
+ prompt: "Run a pre-mortem: assume the current thesis fails and identify the most plausible failure paths.",
248
+ highlightStrategy: "failure-paths",
249
+ riskLevel: "high"
250
+ },
251
+ {
252
+ id: "devils-advocate",
253
+ categoryId: "strategic",
254
+ mode: "stress",
255
+ name: "Devil's Advocate",
256
+ description: "Generate the strongest critique of the graph.",
257
+ prompt: "Produce the strongest evidence-grounded critique of the current graph and its main thesis.",
258
+ highlightStrategy: "critique"
259
+ },
260
+ {
261
+ id: "falsification-map",
262
+ categoryId: "strategic",
263
+ mode: "stress",
264
+ name: "Falsification Map",
265
+ description: "Find the cheapest tests that would disprove key beliefs.",
266
+ prompt: "Map the cheapest, clearest falsification tests for the graph's key claims.",
267
+ highlightStrategy: "falsification",
268
+ riskLevel: "high"
269
+ },
270
+ {
271
+ id: "prediction-tracker",
272
+ categoryId: "strategic",
273
+ mode: "evidence",
274
+ name: "Prediction Tracker",
275
+ description: "Find beliefs that imply measurable predictions.",
276
+ prompt: "Find beliefs that imply measurable predictions and suggest tracking signals.",
277
+ highlightStrategy: "predictions"
278
+ },
279
+ {
280
+ id: "belief-pagerank",
281
+ categoryId: "deep",
282
+ mode: "semantic",
283
+ name: "Belief PageRank",
284
+ description: "Identify structurally central beliefs.",
285
+ prompt: "Use graph centrality to identify the most structurally important beliefs.",
286
+ highlightStrategy: "centrality"
287
+ },
288
+ {
289
+ id: "underdetermination",
290
+ categoryId: "deep",
291
+ mode: "semantic",
292
+ name: "Underdetermination",
293
+ description: "Find places where evidence supports multiple explanations.",
294
+ prompt: "Find places where the same evidence could support multiple incompatible explanations.",
295
+ highlightStrategy: "underdetermination"
296
+ },
297
+ {
298
+ id: "confidence-propagation",
299
+ categoryId: "deep",
300
+ mode: "semantic",
301
+ name: "Confidence Propagation",
302
+ description: "Assess how uncertainty moves through the graph.",
303
+ prompt: "Explain how uncertainty propagates from weak or contested beliefs through downstream conclusions.",
304
+ highlightStrategy: "confidence-flow"
305
+ },
306
+ {
307
+ id: "argument-depth",
308
+ categoryId: "deep",
309
+ mode: "evidence",
310
+ name: "Argument Depth",
311
+ description: "Assess reasoning depth and chain quality.",
312
+ prompt: "Assess reasoning depth: where claims are shallow, deeply supported, or overextended.",
313
+ highlightStrategy: "depth"
314
+ },
315
+ {
316
+ id: "information-edge",
317
+ categoryId: "deep",
318
+ mode: "alpha",
319
+ name: "Information Edge",
320
+ description: "Find differentiated evidence or signals.",
321
+ prompt: "Find evidence, sources, or beliefs that could represent differentiated information edge.",
322
+ highlightStrategy: "information-edge"
323
+ },
324
+ {
325
+ id: "thesis-summary",
326
+ categoryId: "browse",
327
+ mode: "semantic",
328
+ name: "Thesis Summary",
329
+ description: "Summarize the graph's core thesis and support.",
330
+ prompt: "Summarize the graph's core thesis, strongest support, weakest support, and open questions.",
331
+ highlightStrategy: "summary"
332
+ },
333
+ {
334
+ id: "theme-deep-dive",
335
+ categoryId: "browse",
336
+ mode: "semantic",
337
+ name: "Theme Deep Dive",
338
+ description: "Deep dive into a named theme.",
339
+ prompt: "Deep dive into {input}. Explain the key beliefs, evidence, contradictions, and open questions.",
340
+ inputType: "theme",
341
+ highlightStrategy: "theme"
342
+ },
343
+ {
344
+ id: "belief-detail",
345
+ categoryId: "browse",
346
+ mode: "semantic",
347
+ name: "Belief Detail",
348
+ description: "Explain one belief and its graph neighborhood.",
349
+ prompt: "Explain {input} and its support, challenges, related beliefs, and downstream implications.",
350
+ inputType: "belief",
351
+ highlightStrategy: "belief"
352
+ },
353
+ {
354
+ id: "strongest-beliefs",
355
+ categoryId: "browse",
356
+ mode: "operational",
357
+ name: "Strongest Beliefs",
358
+ description: "Find the graph's strongest current beliefs.",
359
+ prompt: "Find the strongest current beliefs and explain why each one deserves confidence.",
360
+ highlightStrategy: "strongest"
361
+ },
362
+ {
363
+ id: "cross-theme-connection",
364
+ categoryId: "browse",
365
+ mode: "semantic",
366
+ name: "Cross-Theme Connections",
367
+ description: "Find bridges between themes.",
368
+ prompt: "Find meaningful connections across themes and explain which bridge beliefs matter.",
369
+ highlightStrategy: "bridges"
370
+ },
371
+ {
372
+ id: "research-velocity",
373
+ categoryId: "browse",
374
+ mode: "operational",
375
+ name: "Research Velocity",
376
+ description: "Summarize recent graph movement and momentum.",
377
+ prompt: "Assess research velocity: what changed recently, where progress is fastest, and what is stuck.",
378
+ highlightStrategy: "velocity"
379
+ },
380
+ {
381
+ id: "search",
382
+ categoryId: "browse",
383
+ mode: "semantic",
384
+ name: "Graph Search",
385
+ description: "Search the graph with semantic context.",
386
+ prompt: "Search the graph for {input}. Return the most relevant beliefs, evidence, and questions.",
387
+ inputType: "search",
388
+ highlightStrategy: "search"
389
+ },
390
+ {
391
+ id: "expert-coverage",
392
+ categoryId: "browse",
393
+ mode: "semantic",
394
+ name: "Expert Coverage",
395
+ description: "Assess coverage from expert/source perspectives.",
396
+ prompt: "Assess whether the graph has enough expert, primary, and dissenting coverage.",
397
+ highlightStrategy: "expert-coverage"
398
+ },
399
+ {
400
+ id: "value-chain-map",
401
+ categoryId: "browse",
402
+ mode: "semantic",
403
+ name: "Value Chain Map",
404
+ description: "Map entities, dependencies, and value-chain logic.",
405
+ prompt: "Map the value chain implied by this graph: entities, dependencies, pressure points, and missing links.",
406
+ highlightStrategy: "value-chain"
407
+ },
408
+ {
409
+ id: "meeting-brief",
410
+ categoryId: "prep",
411
+ mode: "semantic",
412
+ name: "Meeting Brief",
413
+ description: "Prepare a meeting brief from graph context.",
414
+ prompt: "Prepare a concise meeting brief using the graph: thesis, open questions, risks, and recommended asks.",
415
+ highlightStrategy: "brief"
416
+ },
417
+ {
418
+ id: "open-questions-entity",
419
+ categoryId: "prep",
420
+ mode: "semantic",
421
+ name: "Entity Open Questions",
422
+ description: "Find open questions about a specific entity.",
423
+ prompt: "Find the most important open questions about {input} and the beliefs those questions would unlock.",
424
+ inputType: "entity",
425
+ highlightStrategy: "entity-questions"
426
+ },
427
+ {
428
+ id: "company-context",
429
+ categoryId: "prep",
430
+ mode: "semantic",
431
+ name: "Company Context",
432
+ description: "Summarize graph context about a company.",
433
+ prompt: "Summarize what the graph knows about {input}: thesis relevance, evidence, risks, and open questions.",
434
+ inputType: "company",
435
+ highlightStrategy: "company"
436
+ },
437
+ {
438
+ id: "company-theme-fit",
439
+ categoryId: "prep",
440
+ mode: "semantic",
441
+ name: "Company Theme Fit",
442
+ description: "Assess how a company fits graph themes.",
443
+ prompt: "Assess how {input} fits the graph's themes and where the fit is weak or uncertain.",
444
+ inputType: "company",
445
+ highlightStrategy: "fit"
446
+ },
447
+ {
448
+ id: "company-comparison",
449
+ categoryId: "prep",
450
+ mode: "semantic",
451
+ name: "Company Comparison",
452
+ description: "Compare companies through graph context.",
453
+ prompt: "Compare {input} using graph beliefs, evidence, risks, and open questions.",
454
+ inputType: "company-list",
455
+ highlightStrategy: "comparison"
456
+ },
457
+ {
458
+ id: "questions-to-ask",
459
+ categoryId: "prep",
460
+ mode: "operational",
461
+ name: "Questions to Ask",
462
+ description: "Generate high-signal questions from graph gaps.",
463
+ prompt: "Generate the highest-signal questions to ask next, grounded in current graph gaps.",
464
+ highlightStrategy: "questions"
465
+ },
466
+ {
467
+ id: "beliefs-to-test",
468
+ categoryId: "prep",
469
+ mode: "stress",
470
+ name: "Beliefs to Test",
471
+ description: "Prioritize beliefs that should be tested next.",
472
+ prompt: "Prioritize the beliefs that should be tested next and explain the cheapest test for each.",
473
+ highlightStrategy: "tests",
474
+ riskLevel: "medium"
475
+ }
476
+ ];
477
+ GRAPH_INTELLIGENCE_QUERIES.map((query) => {
478
+ const definition = query;
479
+ return {
480
+ ...definition,
481
+ tools: definition.tools ?? byMode(definition.mode)
482
+ };
483
+ });
484
+
4
485
  // ../contracts/src/events.contract.ts
5
486
  var DOMAIN_EVENT_VERSION = "1.0";
6
487
  var EVENT_RETENTION_DEFAULT_DAYS = 30;
@@ -112,7 +593,10 @@ function idOf(table) {
112
593
  return schema;
113
594
  }
114
595
  var NODE_TYPE = z.enum(["decision", "belief", "question", "theme", "deal", "topic", "claim", "evidence", "synthesis", "answer", "atomic_fact", "excerpt", "source", "company", "person", "investor", "function", "value_chain"]);
115
- var EDGE_TYPE = z.enum(["supports", "informs", "depends_on", "extracted_from", "contains", "tests", "supersedes", "responds_to", "belongs_to", "relates_to_thesis", "works_at", "invested_in", "competes_with", "participates_in", "founded_by", "evaluates", "performs", "function_in", "impacts", "raised_from", "mentioned_in", "perspective_on", "plays_theme", "answers", "explores", "qualifies", "based_on", "based_on_belief", "based_on_question", "blocked_by_contradiction", "informed_by_theme", "same_as", "reinforces", "parent_of", "child_of", "falsified_by", "exclusive_with", "collapses_if", "cascade_from", "counterfactual_of", "cascade_to", "mutually_exclusive", "correlates_with", "amplifies", "precondition_for", "in_tension_with", "strengthened_by", "weakened_by", "alternative_to", "subsumes", "validated_by", "required_for", "blocks", "prerequisite_for", "parallel_to", "corroborates", "extends", "same_source_as", "same_theme_as", "assumes", "would_predict", "analogous_to", "independent_of", "implements", "violates", "co_changes_with", "migrating_from", "migrating_to", "scoped_by", "about_entity", "entity_referenced_in", "contradicts", "cites", "summarizes", "related_to", "partially_answers", "refines", "branches_from"]);
596
+ var EDGE_TYPE_VALUES = ["supports", "informs", "depends_on", "derived_from", "contains", "tests", "supersedes", "responds_to", "belongs_to", "relates_to_thesis", "works_at", "invested_in", "competes_with", "participates_in", "founded_by", "evaluates", "performs", "function_in", "impacts", "raised_from", "mentioned_in", "perspective_on", "plays_theme", "answers", "explores", "qualifies", "based_on", "based_on_belief", "based_on_question", "blocked_by_contradiction", "informed_by_theme", "same_as", "reinforces", "parent_of", "child_of", "falsified_by", "exclusive_with", "collapses_if", "cascade_from", "counterfactual_of", "cascade_to", "mutually_exclusive", "correlates_with", "amplifies", "precondition_for", "in_tension_with", "strengthened_by", "weakened_by", "alternative_to", "subsumes", "validated_by", "required_for", "blocks", "prerequisite_for", "parallel_to", "corroborates", "extends", "same_source_as", "same_theme_as", "assumes", "would_predict", "analogous_to", "independent_of", "implements", "violates", "co_changes_with", "migrating_from", "migrating_to", "scoped_by", "about_entity", "entity_referenced_in", "contradicts", "cites", "summarizes", "related_to", "partially_answers", "refines", "branches_from"];
597
+ var STORAGE_EDGE_TYPE_VALUES = [...EDGE_TYPE_VALUES, "extracted_from"];
598
+ z.enum(EDGE_TYPE_VALUES);
599
+ var STORAGE_EDGE_TYPE = z.enum(STORAGE_EDGE_TYPE_VALUES);
116
600
  var TOPIC_STATUS = z.enum(["active", "archived", "watching"]);
117
601
  var TOPIC_VISIBILITY = z.enum(["private", "team", "firm", "external", "public"]);
118
602
  defineTable({
@@ -1597,7 +2081,7 @@ defineTable({
1597
2081
  "toNodeId": z.string().optional(),
1598
2082
  "sourceGlobalId": z.string().optional(),
1599
2083
  "targetGlobalId": z.string().optional(),
1600
- "edgeType": EDGE_TYPE,
2084
+ "edgeType": STORAGE_EDGE_TYPE,
1601
2085
  "edgeTier": z.string().optional(),
1602
2086
  "domainNamespace": z.string().optional(),
1603
2087
  "constraint": z.string().optional(),
@@ -3930,7 +4414,9 @@ defineTable({
3930
4414
  "defaultProjectVisibility": z.enum(["private", "team", "firm", "external", "public"]).optional(),
3931
4415
  "deployments": z.record(z.object({
3932
4416
  "url": z.string(),
3933
- "encryptedDeployKey": z.string()
4417
+ "target": z.enum(["kernelDeployment", "appDeployment"]).optional(),
4418
+ "encryptedDeployKey": z.string().optional(),
4419
+ "credentialRef": z.string().optional()
3934
4420
  })).optional(),
3935
4421
  "metadata": z.record(z.any()).optional(),
3936
4422
  "createdBy": z.string().optional(),
@@ -4366,6 +4852,128 @@ var edgePolicyManifest = {
4366
4852
  }
4367
4853
  ]
4368
4854
  };
4855
+
4856
+ // ../contracts/src/tenant-client.contract.ts
4857
+ var TENANT_CLIENT_INSTALLABLE_PACKAGES = [
4858
+ {
4859
+ packageName: "@lucern/access-control",
4860
+ role: "runtime_entrypoint",
4861
+ directTenantImport: true
4862
+ },
4863
+ {
4864
+ packageName: "@lucern/agent",
4865
+ role: "platform_runtime",
4866
+ directTenantImport: false
4867
+ },
4868
+ {
4869
+ packageName: "@lucern/auth",
4870
+ role: "sdk_dependency",
4871
+ directTenantImport: false
4872
+ },
4873
+ {
4874
+ packageName: "@lucern/cli",
4875
+ role: "developer_tool",
4876
+ directTenantImport: false
4877
+ },
4878
+ {
4879
+ packageName: "@lucern/client-core",
4880
+ role: "sdk_dependency",
4881
+ directTenantImport: false
4882
+ },
4883
+ {
4884
+ packageName: "@lucern/confidence",
4885
+ role: "sdk_dependency",
4886
+ directTenantImport: false
4887
+ },
4888
+ {
4889
+ packageName: "@lucern/config",
4890
+ role: "configuration",
4891
+ directTenantImport: false
4892
+ },
4893
+ {
4894
+ packageName: "@lucern/contracts",
4895
+ role: "contract_entrypoint",
4896
+ directTenantImport: true
4897
+ },
4898
+ {
4899
+ packageName: "@lucern/control-plane",
4900
+ role: "platform_runtime",
4901
+ directTenantImport: false
4902
+ },
4903
+ {
4904
+ packageName: "@lucern/developer-kit",
4905
+ role: "developer_tool",
4906
+ directTenantImport: false
4907
+ },
4908
+ {
4909
+ packageName: "@lucern/events",
4910
+ role: "sdk_dependency",
4911
+ directTenantImport: false
4912
+ },
4913
+ {
4914
+ packageName: "@lucern/graph-primitives",
4915
+ role: "sdk_dependency",
4916
+ directTenantImport: false
4917
+ },
4918
+ {
4919
+ packageName: "@lucern/identity",
4920
+ role: "component_runtime",
4921
+ directTenantImport: false
4922
+ },
4923
+ {
4924
+ packageName: "@lucern/mcp",
4925
+ role: "runtime_entrypoint",
4926
+ directTenantImport: true
4927
+ },
4928
+ {
4929
+ packageName: "@lucern/pack-host",
4930
+ role: "platform_runtime",
4931
+ directTenantImport: false
4932
+ },
4933
+ {
4934
+ packageName: "@lucern/pack-installer",
4935
+ role: "developer_tool",
4936
+ directTenantImport: false
4937
+ },
4938
+ {
4939
+ packageName: "@lucern/proof-compiler",
4940
+ role: "developer_tool",
4941
+ directTenantImport: false
4942
+ },
4943
+ {
4944
+ packageName: "@lucern/react",
4945
+ role: "runtime_entrypoint",
4946
+ directTenantImport: true
4947
+ },
4948
+ {
4949
+ packageName: "@lucern/reasoning-kernel",
4950
+ role: "component_runtime",
4951
+ directTenantImport: false
4952
+ },
4953
+ {
4954
+ packageName: "@lucern/sdk",
4955
+ role: "runtime_entrypoint",
4956
+ directTenantImport: true
4957
+ },
4958
+ {
4959
+ packageName: "@lucern/server-core",
4960
+ role: "platform_runtime",
4961
+ directTenantImport: false
4962
+ },
4963
+ {
4964
+ packageName: "@lucern/testing",
4965
+ role: "test_support",
4966
+ directTenantImport: false
4967
+ },
4968
+ {
4969
+ packageName: "@lucern/types",
4970
+ role: "contract_entrypoint",
4971
+ directTenantImport: true
4972
+ }
4973
+ ];
4974
+ TENANT_CLIENT_INSTALLABLE_PACKAGES.map(
4975
+ (entry) => entry.packageName
4976
+ );
4369
4977
  z.object({
4370
4978
  manifestVersion: z.literal("1.0.0"),
4371
4979
  rules: z.array(
@@ -5127,6 +5735,14 @@ var ADD_WORKTREE = {
5127
5735
  description: "Check out a branch into an active worktree for investigation. Like `git worktree add <branch>` \u2014 creates independent working state on a thematic branch. Beliefs committed within the worktree can be freely amended (draft code on a feature branch). When investigation is complete, `merge` integrates findings into main.",
5128
5736
  parameters: {
5129
5737
  title: { type: "string", description: "Worktree name/objective" },
5738
+ name: {
5739
+ type: "string",
5740
+ description: "Optional storage-name alias for callers that already use backend naming"
5741
+ },
5742
+ projectId: {
5743
+ type: "string",
5744
+ description: "Legacy topicId alias"
5745
+ },
5130
5746
  topicId: { type: "string", description: "Optional topic scope hint" },
5131
5747
  branchId: {
5132
5748
  type: "string",
@@ -5140,14 +5756,87 @@ var ADD_WORKTREE = {
5140
5756
  type: "string",
5141
5757
  description: "The testable claim this worktree investigates"
5142
5758
  },
5759
+ rationale: {
5760
+ type: "string",
5761
+ description: "Why this worktree exists and why it belongs in the campaign"
5762
+ },
5763
+ worktreeType: {
5764
+ type: "string",
5765
+ description: "Schema-enum worktree type used by the kernel lifecycle and retrieval layers"
5766
+ },
5767
+ gate: {
5768
+ type: "string",
5769
+ description: "Exit gate name for this worktree"
5770
+ },
5771
+ startDate: {
5772
+ type: "number",
5773
+ description: "Planned start timestamp in milliseconds since epoch"
5774
+ },
5775
+ endDate: {
5776
+ type: "number",
5777
+ description: "Planned end timestamp in milliseconds since epoch"
5778
+ },
5779
+ durationWeeks: {
5780
+ type: "number",
5781
+ description: "Planned duration in weeks"
5782
+ },
5783
+ confidenceImpact: {
5784
+ type: "string",
5785
+ description: "Expected confidence impact if the worktree succeeds",
5786
+ enum: ["high", "medium", "low"]
5787
+ },
5788
+ beliefFocus: {
5789
+ type: "string",
5790
+ description: "Natural-language focus spanning the target belief neighborhood"
5791
+ },
5143
5792
  beliefIds: {
5144
5793
  type: "array",
5145
- description: "Beliefs to test in this worktree"
5794
+ description: "Legacy alias for targetBeliefIds"
5795
+ },
5796
+ beliefs: {
5797
+ type: "array",
5798
+ description: "Legacy alias for targetBeliefIds"
5799
+ },
5800
+ targetBeliefIds: {
5801
+ type: "array",
5802
+ description: "Belief node IDs this worktree is expected to test or update"
5803
+ },
5804
+ targetQuestionIds: {
5805
+ type: "array",
5806
+ description: "Question node IDs this worktree is expected to answer"
5807
+ },
5808
+ keyQuestions: {
5809
+ type: "array",
5810
+ description: "Inline key question objects with question, optional status, answer, answerConfidence, and linkedQuestionId"
5811
+ },
5812
+ evidenceSignals: {
5813
+ type: "array",
5814
+ description: "Evidence signal objects with signal, optional collected state, progress, and notes"
5815
+ },
5816
+ decisionGate: {
5817
+ type: "object",
5818
+ description: "Decision gate object with goCriteria, noGoSignals, optional verdict, rationale, decidedAt, and decidedBy"
5819
+ },
5820
+ goCriteria: {
5821
+ type: "array",
5822
+ description: "Shorthand go criteria used to build decisionGate"
5823
+ },
5824
+ noGoSignals: {
5825
+ type: "array",
5826
+ description: "Shorthand no-go signals used to build decisionGate"
5827
+ },
5828
+ proofArtifacts: {
5829
+ type: "array",
5830
+ description: "Expected proof artifacts required to close the worktree"
5146
5831
  },
5147
5832
  autoShape: {
5148
5833
  type: "boolean",
5149
5834
  description: "Whether to invoke inquiry auto-shaping during worktree creation"
5150
5835
  },
5836
+ autoFixPolicy: {
5837
+ type: "object",
5838
+ description: "Policy for permitted automatic remediation inside the worktree"
5839
+ },
5151
5840
  domainPackId: {
5152
5841
  type: "string",
5153
5842
  description: "Optional domain pack whose shaping hooks should influence generated questions and tasks"
@@ -5176,9 +5865,17 @@ var ADD_WORKTREE = {
5176
5865
  type: "array",
5177
5866
  description: "Worktree IDs blocked by this worktree"
5178
5867
  },
5179
- gate: {
5868
+ staffingHint: {
5180
5869
  type: "string",
5181
- description: "Exit gate name for this worktree"
5870
+ description: "Suggested staffing or agent allocation note"
5871
+ },
5872
+ lensId: {
5873
+ type: "string",
5874
+ description: "Lens that scopes this worktree when applicable"
5875
+ },
5876
+ lastReconciledAt: {
5877
+ type: "number",
5878
+ description: "Timestamp when worktree metadata was last reconciled"
5182
5879
  }
5183
5880
  },
5184
5881
  required: ["title", "topicId"],
@@ -5208,7 +5905,7 @@ var MERGE = {
5208
5905
  worktreeId: { type: "string", description: "The worktree to merge" },
5209
5906
  outcomes: {
5210
5907
  type: "array",
5211
- description: "Scoring outcomes for each belief: { beliefId, confidence, rationale }"
5908
+ description: "Merge outcomes as key-finding strings, or scoring outcomes for beliefs: { beliefId, confidence, rationale }"
5212
5909
  },
5213
5910
  summary: { type: "string", description: "Overall findings summary" }
5214
5911
  },
@@ -5762,6 +6459,74 @@ var GET_GRAPH_STRUCTURE_ANALYSIS = {
5762
6459
  ontologyPrimitive: "graph",
5763
6460
  tier: "showcase"
5764
6461
  };
6462
+ var LIST_GRAPH_INTELLIGENCE_QUERIES = {
6463
+ name: "list_graph_intelligence_queries",
6464
+ description: "List the Graph Intelligence query catalog that powers structural graph analysis experiences. Returns categories, query IDs, prompt templates, modes, and the public tool plan each query can use.",
6465
+ parameters: {
6466
+ categoryId: {
6467
+ type: "string",
6468
+ description: "Optional category filter, such as problems or strategic"
6469
+ },
6470
+ mode: {
6471
+ type: "string",
6472
+ description: "Optional mode filter: core, bias, stress, operational, alpha, semantic, or evidence"
6473
+ }
6474
+ },
6475
+ required: [],
6476
+ response: {
6477
+ description: "Graph Intelligence query catalog and mode-to-tool mapping",
6478
+ fields: {
6479
+ categories: "array \u2014 query categories",
6480
+ queries: "array \u2014 query definitions with prompt templates and tools",
6481
+ quickQueries: "array \u2014 recommended one-click query presets",
6482
+ publicToolNamesByMode: "object \u2014 public tool names available to each Graph Intelligence mode"
6483
+ }
6484
+ },
6485
+ ownerModule: "graph-intelligence",
6486
+ ontologyPrimitive: "graph",
6487
+ tier: "showcase"
6488
+ };
6489
+ var RUN_GRAPH_INTELLIGENCE_QUERY = {
6490
+ name: "run_graph_intelligence_query",
6491
+ description: "Run a named Graph Intelligence query against a tenant topic graph. Returns the selected query, prompt, deterministic graph-analysis bundle, graph context, and public tool plan for model synthesis.",
6492
+ parameters: {
6493
+ topicId: { type: "string", description: "Topic to analyze" },
6494
+ queryId: {
6495
+ type: "string",
6496
+ description: "Graph Intelligence query ID, such as confirmation-bias, pre-mortem, or thesis-summary"
6497
+ },
6498
+ prompt: {
6499
+ type: "string",
6500
+ description: "Optional custom prompt for custom analysis runs"
6501
+ },
6502
+ input: {
6503
+ type: "string",
6504
+ description: "Optional entity, theme, belief, company, or search text for input-driven queries"
6505
+ },
6506
+ mode: {
6507
+ type: "string",
6508
+ description: "Optional mode override: core, bias, stress, operational, alpha, semantic, or evidence"
6509
+ },
6510
+ limit: {
6511
+ type: "number",
6512
+ description: "Maximum graph context rows to return"
6513
+ }
6514
+ },
6515
+ required: ["topicId"],
6516
+ response: {
6517
+ description: "Graph Intelligence query result bundle ready for model or prompt-library synthesis",
6518
+ fields: {
6519
+ query: "object \u2014 selected query definition",
6520
+ prompt: "string \u2014 resolved prompt template",
6521
+ toolPlan: "array \u2014 public tools and args the model can call next",
6522
+ analysis: "object \u2014 structure, coverage, gap, and confirmation-bias analysis",
6523
+ context: "object \u2014 sampled beliefs, questions, evidence, edges, and contradictions"
6524
+ }
6525
+ },
6526
+ ownerModule: "graph-intelligence",
6527
+ ontologyPrimitive: "graph",
6528
+ tier: "showcase"
6529
+ };
5765
6530
  var GET_FALSIFICATION_QUESTIONS = {
5766
6531
  name: "get_falsification_questions",
5767
6532
  description: "Generate Popperian falsification questions for beliefs. Like `git test` \u2014 identifies the questions most likely to disprove current beliefs. Karl Popper as a tool: surfaces what would need to be true to invalidate each belief.",
@@ -8227,22 +8992,85 @@ var GENERATE_SESSION_HANDOFF = {
8227
8992
  tier: "showcase",
8228
8993
  internal: true
8229
8994
  };
8230
- var MCP_TOOL_CONTRACTS = {
8231
- // Belief lifecycle (commit, amend, fork, archive)
8232
- create_belief: CREATE_BELIEF,
8233
- get_belief: GET_BELIEF,
8234
- refine_belief: REFINE_BELIEF,
8235
- modulate_confidence: MODULATE_CONFIDENCE,
8236
- fork_belief: FORK_BELIEF,
8237
- archive_belief: ARCHIVE_BELIEF,
8238
- create_epistemic_contract: CREATE_EPISTEMIC_CONTRACT,
8239
- evaluate_contract: EVALUATE_CONTRACT,
8240
- get_contract_status: GET_CONTRACT_STATUS,
8241
- // Evidence (commit)
8242
- create_evidence: CREATE_EVIDENCE,
8243
- get_evidence: GET_EVIDENCE,
8244
- list_evidence: LIST_EVIDENCE,
8245
- link_evidence: LINK_EVIDENCE,
8995
+ var BEGIN_BUILD_SESSION = {
8996
+ name: "begin_build_session",
8997
+ description: "Bootstrap a coding build session for a Lucern worktree. Like `git worktree add` plus `git status` \u2014 returns the compact context packet an agent needs before editing.",
8998
+ parameters: {
8999
+ worktreeId: {
9000
+ type: "string",
9001
+ description: "The Lucern worktree ID to bootstrap."
9002
+ },
9003
+ branch: {
9004
+ type: "string",
9005
+ description: "Optional git branch name. Auto-generated from the worktree name when omitted."
9006
+ },
9007
+ branchBase: {
9008
+ type: "string",
9009
+ description: 'Base branch for the feature branch. Default: "staging".'
9010
+ },
9011
+ prBase: {
9012
+ type: "string",
9013
+ description: 'Target branch for the PR. Default: "staging".'
9014
+ },
9015
+ sessionMode: {
9016
+ type: "string",
9017
+ description: 'Session mode: "async" for Codex/headless or "interactive" for live sessions.',
9018
+ enum: ["async", "interactive"]
9019
+ },
9020
+ activateIfPlanning: {
9021
+ type: "boolean",
9022
+ description: "When true, automatically activate a planning worktree during bootstrap."
9023
+ }
9024
+ },
9025
+ required: ["worktreeId"],
9026
+ response: {
9027
+ description: "A compact build-session packet with worktree metadata, graph anchors, questions, dependencies, and git defaults.",
9028
+ fields: {
9029
+ topicId: "string \u2014 canonical topic scope",
9030
+ topicName: "string \u2014 human-readable topic name",
9031
+ worktreeId: "string \u2014 worktree ID",
9032
+ worktreeName: "string \u2014 human-readable worktree name",
9033
+ branch: "string \u2014 git branch name",
9034
+ branchBase: "string \u2014 base branch",
9035
+ prBase: "string \u2014 PR target branch",
9036
+ campaign: "number | null \u2014 top-level pipeline campaign",
9037
+ lane: "string \u2014 campaign lane",
9038
+ gate: "string \u2014 exit gate",
9039
+ hypothesis: "string \u2014 worktree hypothesis",
9040
+ focus: "string \u2014 session focus",
9041
+ status: "string \u2014 worktree status after optional activation",
9042
+ sessionMode: "string \u2014 async | interactive",
9043
+ targetBeliefIds: "array \u2014 scoped belief IDs",
9044
+ targetQuestionIds: "array \u2014 scoped question IDs",
9045
+ topBeliefs: "array \u2014 highest-confidence scoped beliefs",
9046
+ openQuestions: "array \u2014 open scoped questions",
9047
+ resolvedDecisions: "array \u2014 answered questions summarized for the session",
9048
+ dependencies: "array \u2014 upstream worktrees",
9049
+ unblocks: "array \u2014 downstream worktrees",
9050
+ mergeOrderNotes: "string \u2014 merge ordering advisory"
9051
+ }
9052
+ },
9053
+ ownerModule: "bootstrap",
9054
+ ontologyPrimitive: "worktree",
9055
+ tier: "showcase",
9056
+ internal: true
9057
+ };
9058
+ var MCP_TOOL_CONTRACTS = {
9059
+ // Belief lifecycle (commit, amend, fork, archive)
9060
+ create_belief: CREATE_BELIEF,
9061
+ get_belief: GET_BELIEF,
9062
+ refine_belief: REFINE_BELIEF,
9063
+ modulate_confidence: MODULATE_CONFIDENCE,
9064
+ fork_belief: FORK_BELIEF,
9065
+ archive_belief: ARCHIVE_BELIEF,
9066
+ create_epistemic_contract: CREATE_EPISTEMIC_CONTRACT,
9067
+ evaluate_contract: EVALUATE_CONTRACT,
9068
+ get_contract_status: GET_CONTRACT_STATUS,
9069
+ // Evidence (commit)
9070
+ create_evidence: CREATE_EVIDENCE,
9071
+ get_evidence: GET_EVIDENCE,
9072
+ list_evidence: LIST_EVIDENCE,
9073
+ link_evidence: LINK_EVIDENCE,
8246
9074
  add_evidence: ADD_EVIDENCE,
8247
9075
  // Contradictions (merge conflict)
8248
9076
  flag_contradiction: FLAG_CONTRADICTION,
@@ -8274,6 +9102,8 @@ var MCP_TOOL_CONTRACTS = {
8274
9102
  // Graph intelligence (showcase)
8275
9103
  detect_confirmation_bias: DETECT_CONFIRMATION_BIAS,
8276
9104
  get_graph_structure_analysis: GET_GRAPH_STRUCTURE_ANALYSIS,
9105
+ list_graph_intelligence_queries: LIST_GRAPH_INTELLIGENCE_QUERIES,
9106
+ run_graph_intelligence_query: RUN_GRAPH_INTELLIGENCE_QUERY,
8277
9107
  get_falsification_questions: GET_FALSIFICATION_QUESTIONS,
8278
9108
  // Evidence operations (workhorse)
8279
9109
  search_evidence: SEARCH_EVIDENCE,
@@ -8320,6 +9150,7 @@ var MCP_TOOL_CONTRACTS = {
8320
9150
  get_agent_inbox: GET_AGENT_INBOX,
8321
9151
  claim_files: CLAIM_FILES,
8322
9152
  generate_session_handoff: GENERATE_SESSION_HANDOFF,
9153
+ begin_build_session: BEGIN_BUILD_SESSION,
8323
9154
  // Policy / ACL (workhorse)
8324
9155
  check_permission: CHECK_PERMISSION,
8325
9156
  filter_by_permission: FILTER_BY_PERMISSION,
@@ -8455,6 +9286,8 @@ var MCP_ANALYSIS_PLATFORM_OPERATION_NAMES = [
8455
9286
  "traverse_graph",
8456
9287
  "get_graph_neighborhood",
8457
9288
  "get_graph_structure_analysis",
9289
+ "list_graph_intelligence_queries",
9290
+ "run_graph_intelligence_query",
8458
9291
  "find_contradictions",
8459
9292
  "flag_contradiction",
8460
9293
  "detect_confirmation_bias",
@@ -8533,6 +9366,7 @@ var PLATFORM_INTERNAL_OPERATION_NAMES = [
8533
9366
  "get_change_history",
8534
9367
  "get_failure_log",
8535
9368
  "record_attempt",
9369
+ "begin_build_session",
8536
9370
  "push",
8537
9371
  "open_pull_request",
8538
9372
  "record_judgment",
@@ -8587,7 +9421,6 @@ var SDK_ONLY_OPERATION_NAMES = [
8587
9421
  "find_semantic_orphans"
8588
9422
  ];
8589
9423
  var MCP_ONLY_INTERNAL_OPERATION_NAMES = [
8590
- "begin_build_session",
8591
9424
  "evaluate_engineering_contract",
8592
9425
  "evaluate_research_contract"
8593
9426
  ];
@@ -8973,8 +9806,31 @@ function assertSurfaceCoverage(contracts) {
8973
9806
  }
8974
9807
  }
8975
9808
  }
8976
-
8977
- // ../contracts/src/function-registry/context.ts
9809
+ var jsonRecordSchema2 = z.record(z.unknown());
9810
+ var observationArgs = z.object({
9811
+ topicId: z.string().optional().describe("Topic scope for the observation."),
9812
+ summary: z.string().describe("Short observation summary."),
9813
+ text: z.string().optional().describe("Canonical observation text alias."),
9814
+ title: z.string().optional().describe("Optional observation title."),
9815
+ content: z.string().optional().describe("Optional rich observation content."),
9816
+ contentType: z.string().optional().describe("Observation content type."),
9817
+ kind: z.string().optional().describe("Evidence kind to store."),
9818
+ observationType: z.string().optional().describe("Observation type."),
9819
+ tags: z.array(z.string()).optional().describe("Observation tags."),
9820
+ source: z.string().optional().describe("Observation source label."),
9821
+ sourceType: z.string().optional().describe("Evidence source type."),
9822
+ externalSourceType: z.string().optional().describe("External source type for imported observations."),
9823
+ sourceUrl: z.string().optional().describe("Canonical source URL."),
9824
+ confidence: z.number().optional().describe("Observation confidence."),
9825
+ metadata: jsonRecordSchema2.optional().describe("Observation metadata."),
9826
+ rationale: z.string().optional().describe("Why this observation should be recorded.")
9827
+ });
9828
+ var observationContextArgs = z.object({
9829
+ topicId: z.string().describe("Topic scope."),
9830
+ query: z.string().optional().describe("Optional context query."),
9831
+ limit: z.number().optional().describe("Maximum observations to return."),
9832
+ status: z.string().optional().describe("Observation status filter.")
9833
+ });
8978
9834
  var observationInput = (input, context) => withUserId(
8979
9835
  compactRecord4({
8980
9836
  projectId: input.projectId,
@@ -9033,7 +9889,8 @@ var contextContracts = [
9033
9889
  observationId: output && typeof output === "object" ? output.nodeId : void 0,
9034
9890
  observationType: input.observationType
9035
9891
  })
9036
- }
9892
+ },
9893
+ args: observationArgs
9037
9894
  }),
9038
9895
  surfaceContract({
9039
9896
  name: "get_observation_context",
@@ -9054,7 +9911,8 @@ var contextContracts = [
9054
9911
  status: input.status,
9055
9912
  userId: input.userId
9056
9913
  })
9057
- }
9914
+ },
9915
+ args: observationContextArgs
9058
9916
  })
9059
9917
  ];
9060
9918
 
@@ -9117,8 +9975,45 @@ var identityContracts = [
9117
9975
  }
9118
9976
  })
9119
9977
  ];
9120
-
9121
- // ../contracts/src/function-registry/beliefs.ts
9978
+ var jsonRecordSchema3 = z.record(z.unknown());
9979
+ var sourceTypeSchema = z.enum(["human", "ai_extracted", "ai_generated"]);
9980
+ var reversibilitySchema = z.enum([
9981
+ "irreversible",
9982
+ "hard_to_reverse",
9983
+ "reversible",
9984
+ "trivial"
9985
+ ]);
9986
+ var predictionMetaSchema = z.object({
9987
+ isPrediction: z.boolean().describe("Whether this belief is a prediction."),
9988
+ registeredAt: z.number().describe("Timestamp when the prediction was registered."),
9989
+ expectedBy: z.number().optional().describe("Timestamp when the prediction should be evaluated.")
9990
+ });
9991
+ var createBeliefArgs = z.object({
9992
+ canonicalText: z.string().describe("The belief statement the agent holds to be true."),
9993
+ topicId: z.string().optional().describe("Topic scope hint for the belief."),
9994
+ baseRate: z.number().optional().describe("Prior base rate used to seed the vacuous opinion."),
9995
+ beliefType: z.string().optional().describe("Schema belief type."),
9996
+ metadata: jsonRecordSchema3.optional().describe("Extra metadata merged into the belief node."),
9997
+ rationale: z.string().optional().describe("Why this belief should enter the reasoning graph."),
9998
+ pillar: z.string().optional().describe("Innovation pillar or product pillar associated with the belief."),
9999
+ worktreeId: z.string().optional().describe("Worktree responsible for creating or testing this belief."),
10000
+ sourceBeliefIds: z.array(z.string()).optional().describe("Source belief IDs this belief derives from."),
10001
+ sourceType: sourceTypeSchema.optional().describe("Actor/source class that produced the belief."),
10002
+ reversibility: reversibilitySchema.optional().describe("How reversible the belief's implied decision is."),
10003
+ predictionMeta: predictionMetaSchema.optional().describe("Prediction lifecycle metadata when this belief is a forecast.")
10004
+ });
10005
+ var forkBeliefArgs = z.object({
10006
+ nodeId: z.string().describe("The scored belief to fork from."),
10007
+ newFormulation: z.string().describe("The evolved belief statement."),
10008
+ forkReason: z.enum([
10009
+ "refinement",
10010
+ "contradiction_response",
10011
+ "scope_change",
10012
+ "confidence_collapse",
10013
+ "manual"
10014
+ ]).describe("Why this fork was created."),
10015
+ rationale: z.string().optional().describe("Why the fork is warranted.")
10016
+ });
9122
10017
  var beliefLookupInput = (input) => compactRecord4({
9123
10018
  nodeId: input.nodeId ?? input.id ?? input.beliefId,
9124
10019
  beliefId: input.beliefId
@@ -9193,7 +10088,8 @@ var beliefsContracts = [
9193
10088
  functionName: "create",
9194
10089
  kind: "mutation",
9195
10090
  inputProjection: createBeliefInput
9196
- }
10091
+ },
10092
+ args: createBeliefArgs
9197
10093
  }),
9198
10094
  surfaceContract({
9199
10095
  name: "get_belief",
@@ -9284,7 +10180,8 @@ var beliefsContracts = [
9284
10180
  functionName: "forkBelief",
9285
10181
  kind: "mutation",
9286
10182
  inputProjection: forkBeliefInput
9287
- }
10183
+ },
10184
+ args: forkBeliefArgs
9288
10185
  }),
9289
10186
  surfaceContract({
9290
10187
  name: "archive_belief",
@@ -9365,8 +10262,46 @@ var beliefsContracts = [
9365
10262
  }
9366
10263
  })
9367
10264
  ];
9368
-
9369
- // ../contracts/src/function-registry/evidence.ts
10265
+ var jsonRecordSchema4 = z.record(z.unknown());
10266
+ var evidenceRelationSchema = z.enum(["supports", "contradicts", "neutral"]);
10267
+ var createEvidenceArgs = z.object({
10268
+ topicId: z.string().optional().describe("Topic scope for the evidence."),
10269
+ text: z.string().describe("Canonical evidence text."),
10270
+ source: z.string().optional().describe("Source URL or source label."),
10271
+ sourceUrl: z.string().optional().describe("Canonical source URL."),
10272
+ targetId: z.string().optional().describe("Belief or question identifier to link immediately."),
10273
+ linkedBeliefNodeId: z.string().optional().describe("Belief node this evidence bears on."),
10274
+ evidenceRelation: evidenceRelationSchema.optional().describe("How the evidence relates to the linked belief."),
10275
+ confidence: z.number().optional().describe("Confidence in the evidence relation."),
10276
+ weight: z.number().optional().describe("Support weight from -1.0 to +1.0."),
10277
+ metadata: jsonRecordSchema4.optional().describe("Metadata merged into the canonical evidence node."),
10278
+ rationale: z.string().describe("Why this evidence should enter the reasoning graph."),
10279
+ reasoning: z.string().optional().describe("Reasoning note preserved in evidence metadata."),
10280
+ title: z.string().optional().describe("Optional short title."),
10281
+ content: z.string().optional().describe("Optional long-form content."),
10282
+ contentType: z.string().optional().describe("Content format or MIME hint."),
10283
+ kind: z.string().optional().describe("Evidence kind."),
10284
+ tags: z.array(z.string()).optional().describe("Evidence tags."),
10285
+ sourceType: z.string().optional().describe("Evidence source type."),
10286
+ externalSourceType: z.string().optional().describe("External source type for imported evidence."),
10287
+ sourceQuestionId: z.string().optional().describe("Question that sourced this evidence."),
10288
+ methodology: z.string().optional().describe("Collection methodology."),
10289
+ informationAsymmetry: z.string().optional().describe("Information asymmetry class."),
10290
+ sourceDescription: z.string().optional().describe("Human-readable source description.")
10291
+ });
10292
+ var addEvidenceArgs = z.object({
10293
+ canonicalText: z.string().describe("The evidence statement."),
10294
+ text: z.string().optional().describe("Canonical evidence text alias used by newer callers."),
10295
+ topicId: z.string().optional().describe("Topic scope hint."),
10296
+ sourceUrl: z.string().optional().describe("URL of the source material."),
10297
+ targetNodeId: z.string().describe("The belief this evidence bears on."),
10298
+ weight: z.number().optional().describe("Support weight from -1.0 to +1.0."),
10299
+ reasoning: z.string().describe("Why this evidence is relevant to the target belief."),
10300
+ title: z.string().optional().describe("Optional short title."),
10301
+ content: z.string().optional().describe("Optional long-form evidence content."),
10302
+ contentType: z.string().optional().describe("Content format or MIME hint."),
10303
+ metadata: jsonRecordSchema4.optional().describe("Optional metadata merged into the evidence node.")
10304
+ });
9370
10305
  var evidenceIdInput = (input) => compactRecord4({
9371
10306
  evidenceId: input.evidenceId,
9372
10307
  insightId: input.insightId,
@@ -9441,7 +10376,8 @@ var evidenceContracts = [
9441
10376
  functionName: "create",
9442
10377
  kind: "mutation",
9443
10378
  inputProjection: createEvidenceInput
9444
- }
10379
+ },
10380
+ args: createEvidenceArgs
9445
10381
  }),
9446
10382
  surfaceContract({
9447
10383
  name: "add_evidence",
@@ -9477,7 +10413,8 @@ var evidenceContracts = [
9477
10413
  context
9478
10414
  );
9479
10415
  }
9480
- }
10416
+ },
10417
+ args: addEvidenceArgs
9481
10418
  }),
9482
10419
  surfaceContract({
9483
10420
  name: "get_evidence",
@@ -9584,8 +10521,91 @@ var evidenceContracts = [
9584
10521
  }
9585
10522
  })
9586
10523
  ];
9587
-
9588
- // ../contracts/src/function-registry/questions.ts
10524
+ var jsonRecordSchema5 = z.record(z.unknown());
10525
+ var questionPrioritySchema = z.enum(["urgent", "high", "medium", "low"]);
10526
+ var kernelQuestionPrioritySchema = z.enum([
10527
+ "critical",
10528
+ "high",
10529
+ "medium",
10530
+ "low"
10531
+ ]);
10532
+ var questionTypeSchema = z.enum([
10533
+ "validation",
10534
+ "falsification",
10535
+ "assumption_probe",
10536
+ "prediction_test",
10537
+ "counterfactual",
10538
+ "discovery",
10539
+ "clarification",
10540
+ "comparison",
10541
+ "causal",
10542
+ "mechanism",
10543
+ "general"
10544
+ ]);
10545
+ var createQuestionArgs = z.object({
10546
+ text: z.string().describe("The question text."),
10547
+ question: z.string().optional().describe("Backend question text alias for kernel-native callers."),
10548
+ topicId: z.string().optional().describe("Topic scope hint."),
10549
+ priority: questionPrioritySchema.optional().describe("Human-facing question priority."),
10550
+ linkedBeliefId: z.string().optional().describe("Belief this question tests."),
10551
+ linkedBeliefNodeId: z.string().optional().describe("Belief node this question tests."),
10552
+ metadata: jsonRecordSchema5.optional().describe("Optional metadata merged into the question record."),
10553
+ category: z.string().optional().describe("Question category."),
10554
+ source: z.string().optional().describe("Question source."),
10555
+ testType: z.enum(["validates", "invalidates", "clarifies"]).optional().describe("How this question tests its linked belief."),
10556
+ importance: z.number().optional().describe("Numeric importance score."),
10557
+ epistemicUnlock: z.string().optional().describe("What this question unlocks if answered."),
10558
+ sourceQuestionIds: z.array(z.string()).optional().describe("Question IDs this question derives from."),
10559
+ linkedWorktreeId: z.string().optional().describe("Worktree this question belongs to."),
10560
+ questionType: questionTypeSchema.optional().describe("Question type."),
10561
+ questionPriority: kernelQuestionPrioritySchema.optional().describe("Kernel-native question priority.")
10562
+ });
10563
+ var refineQuestionArgs = z.object({
10564
+ id: z.string().describe("The question to refine."),
10565
+ text: z.string().describe("Updated question text."),
10566
+ question: z.string().optional().describe("Backend question text alias for kernel-native callers."),
10567
+ rationale: z.string().optional().describe("Why the question is refined."),
10568
+ category: z.string().optional().describe("Updated question category."),
10569
+ priority: questionPrioritySchema.optional().describe("Updated human-facing priority.")
10570
+ });
10571
+ var createAnswerArgs = z.object({
10572
+ questionNodeId: z.string().describe("The question node ID this answer responds to."),
10573
+ questionId: z.string().optional().describe("Question ID alias accepted by the projection."),
10574
+ answerText: z.string().describe("The answer content."),
10575
+ topicId: z.string().optional().describe("Topic scope for the answer."),
10576
+ confidence: z.string().optional().describe("Answer confidence."),
10577
+ evidenceNodeIds: z.array(z.string()).optional().describe("Evidence node IDs supporting the answer."),
10578
+ answerSource: z.string().optional().describe("How the answer was produced."),
10579
+ worktreeId: z.string().optional().describe("Worktree whose outcome produced this answer."),
10580
+ sprintId: z.string().optional().describe("Legacy sprint identifier.")
10581
+ });
10582
+ var answerQuestionArgs = z.object({
10583
+ id: z.string().describe("Canonical question ID."),
10584
+ topicId: z.string().describe("Topic scope for the answer."),
10585
+ text: z.string().describe("Answer text."),
10586
+ confidence: z.enum(["weak", "medium", "strong"]).optional().describe("Optional answer confidence."),
10587
+ evidenceIds: z.array(z.string()).optional().describe("Canonical evidence IDs supporting the answer."),
10588
+ rationale: z.string().optional().describe("Why this answer is credible."),
10589
+ questionId: z.string().optional().describe("Question ID alias accepted by the projection."),
10590
+ questionNodeId: z.string().optional().describe("Question node ID alias accepted by the projection."),
10591
+ answerText: z.string().optional().describe("Canonical answer text alias accepted by newer callers."),
10592
+ evidenceNodeIds: z.array(z.string()).optional().describe("Evidence node ID alias accepted by newer callers."),
10593
+ answerSource: z.string().optional().describe("How the answer was produced."),
10594
+ worktreeId: z.string().optional().describe("Worktree whose outcome produced this answer."),
10595
+ sprintId: z.string().optional().describe("Legacy sprint identifier.")
10596
+ });
10597
+ var missingQuestionsArgs = z.object({
10598
+ topicId: z.string().describe("Topic scope."),
10599
+ minConfidence: z.number().optional().describe("Minimum confidence threshold for missing-question checks."),
10600
+ status: z.string().optional().describe("Question status filter."),
10601
+ limit: z.number().optional().describe("Maximum questions to inspect.")
10602
+ });
10603
+ var falsificationQuestionsArgs = z.object({
10604
+ topicId: z.string().describe("Topic scope."),
10605
+ beliefIds: z.array(z.string()).optional().describe("Beliefs to generate falsification questions for."),
10606
+ status: z.string().optional().describe("Question status filter."),
10607
+ limit: z.number().optional().describe("Maximum questions to inspect.")
10608
+ });
9589
10609
  var questionNodeInput = (input) => compactRecord4({
9590
10610
  nodeId: input.nodeId ?? input.id ?? input.questionId,
9591
10611
  questionId: input.questionId
@@ -9632,7 +10652,8 @@ var questionsContracts = [
9632
10652
  functionName: "create",
9633
10653
  kind: "mutation",
9634
10654
  inputProjection: createQuestionInput
9635
- }
10655
+ },
10656
+ args: createQuestionArgs
9636
10657
  }),
9637
10658
  surfaceContract({
9638
10659
  name: "get_question",
@@ -9688,7 +10709,8 @@ var questionsContracts = [
9688
10709
  category: input.category,
9689
10710
  priority: input.priority
9690
10711
  })
9691
- }
10712
+ },
10713
+ args: refineQuestionArgs
9692
10714
  }),
9693
10715
  surfaceContract({
9694
10716
  name: "update_question_status",
@@ -9764,7 +10786,8 @@ var questionsContracts = [
9764
10786
  }),
9765
10787
  context
9766
10788
  )
9767
- }
10789
+ },
10790
+ args: createAnswerArgs
9768
10791
  }),
9769
10792
  surfaceContract({
9770
10793
  name: "answer_question",
@@ -9793,7 +10816,8 @@ var questionsContracts = [
9793
10816
  }),
9794
10817
  context
9795
10818
  )
9796
- }
10819
+ },
10820
+ args: answerQuestionArgs
9797
10821
  }),
9798
10822
  surfaceContract({
9799
10823
  name: "get_answer",
@@ -9825,7 +10849,8 @@ var questionsContracts = [
9825
10849
  functionName: "getByTopic",
9826
10850
  kind: "query",
9827
10851
  inputProjection: questionTopicInput
9828
- }
10852
+ },
10853
+ args: missingQuestionsArgs
9829
10854
  }),
9830
10855
  surfaceContract({
9831
10856
  name: "get_high_priority_questions",
@@ -9860,11 +10885,22 @@ var questionsContracts = [
9860
10885
  functionName: "getByTopic",
9861
10886
  kind: "query",
9862
10887
  inputProjection: questionTopicInput
9863
- }
10888
+ },
10889
+ args: falsificationQuestionsArgs
9864
10890
  })
9865
10891
  ];
9866
-
9867
- // ../contracts/src/function-registry/topics.ts
10892
+ var updateTopicArgs = z.object({
10893
+ id: z.string().describe("Topic ID."),
10894
+ topicId: z.string().optional().describe("Topic ID alias."),
10895
+ name: z.string().optional().describe("Topic name."),
10896
+ description: z.string().optional().describe("Topic description."),
10897
+ type: z.string().optional().describe("Topic type."),
10898
+ status: z.string().optional().describe("Topic status."),
10899
+ visibility: z.string().optional().describe("Topic visibility."),
10900
+ ontologyId: z.string().optional().describe("Ontology to bind."),
10901
+ clearOntologyId: z.boolean().optional().describe("Whether to clear the ontology binding."),
10902
+ metadata: z.record(z.unknown()).optional().describe("Topic metadata.")
10903
+ });
9868
10904
  var topicIdInput = (input) => compactRecord4({
9869
10905
  id: input.id ?? input.topicId
9870
10906
  });
@@ -9945,7 +10981,8 @@ var topicsContracts = [
9945
10981
  functionName: "update",
9946
10982
  kind: "mutation",
9947
10983
  inputProjection: updateTopicInput
9948
- }
10984
+ },
10985
+ args: updateTopicArgs
9949
10986
  }),
9950
10987
  surfaceContract({
9951
10988
  name: "get_topic_tree",
@@ -9964,8 +11001,27 @@ var topicsContracts = [
9964
11001
  }
9965
11002
  })
9966
11003
  ];
9967
-
9968
- // ../contracts/src/function-registry/lenses.ts
11004
+ var lensPerspectiveSchema = z.enum([
11005
+ "investigation",
11006
+ "monitoring",
11007
+ "analysis",
11008
+ "comparison",
11009
+ "taxonomy"
11010
+ ]);
11011
+ var jsonRecordSchema6 = z.record(z.unknown());
11012
+ var createLensArgs = z.object({
11013
+ name: z.string().describe("Lens name."),
11014
+ workspaceId: z.string().optional().describe("Workspace scope for the lens."),
11015
+ topicId: z.string().optional().describe("Originating topic scope."),
11016
+ description: z.string().optional().describe("What this lens investigates or monitors."),
11017
+ perspectiveType: lensPerspectiveSchema.describe("Perspective type."),
11018
+ promptTemplates: z.array(jsonRecordSchema6).optional().describe("Prompt templates used through this lens."),
11019
+ workflowTemplates: z.array(jsonRecordSchema6).optional().describe("Guided workflow templates."),
11020
+ taskTemplates: z.array(jsonRecordSchema6).optional().describe("Default task templates."),
11021
+ questionTemplates: z.array(jsonRecordSchema6).optional().describe("Default question templates."),
11022
+ filterCriteria: jsonRecordSchema6.optional().describe("Belief/evidence filtering criteria."),
11023
+ metadata: jsonRecordSchema6.optional().describe("Additional lens metadata.")
11024
+ });
9969
11025
  var createLensInput = (input, context) => compactRecord4({
9970
11026
  name: input.name,
9971
11027
  description: input.description,
@@ -10002,7 +11058,8 @@ var lensesContracts = [
10002
11058
  functionName: "create",
10003
11059
  kind: "mutation",
10004
11060
  inputProjection: createLensInput
10005
- }
11061
+ },
11062
+ args: createLensArgs
10006
11063
  }),
10007
11064
  surfaceContract({
10008
11065
  name: "list_lenses",
@@ -10064,8 +11121,18 @@ var lensesContracts = [
10064
11121
  }
10065
11122
  })
10066
11123
  ];
10067
-
10068
- // ../contracts/src/function-registry/ontologies.ts
11124
+ var updateOntologyArgs = z.object({
11125
+ id: z.string().describe("Ontology definition ID."),
11126
+ ontologyId: z.string().optional().describe("Ontology ID alias."),
11127
+ name: z.string().optional().describe("Ontology display name."),
11128
+ description: z.string().optional().describe("Ontology description."),
11129
+ status: z.string().optional().describe("Ontology lifecycle status.")
11130
+ });
11131
+ var ontologyVersionLifecycleArgs = z.object({
11132
+ id: z.string().describe("Ontology version ID."),
11133
+ versionId: z.string().optional().describe("Ontology version ID alias."),
11134
+ ontologyId: z.string().optional().describe("Ontology definition ID.")
11135
+ });
10069
11136
  var ontologyIdInput = (input) => compactRecord4({
10070
11137
  id: input.id ?? input.ontologyId
10071
11138
  });
@@ -10144,11 +11211,11 @@ var ontologiesContracts = [
10144
11211
  id: input.id ?? input.ontologyId,
10145
11212
  name: input.name,
10146
11213
  description: input.description,
10147
- parentOntologyId: input.parentOntologyId,
10148
11214
  status: input.status,
10149
11215
  actorId: input.actorId
10150
11216
  })
10151
- }
11217
+ },
11218
+ args: updateOntologyArgs
10152
11219
  }),
10153
11220
  surfaceContract({
10154
11221
  name: "archive_ontology",
@@ -10231,7 +11298,8 @@ var ontologiesContracts = [
10231
11298
  functionName: "publishOntologyVersion",
10232
11299
  kind: "mutation",
10233
11300
  inputProjection: ontologyVersionIdInput
10234
- }
11301
+ },
11302
+ args: ontologyVersionLifecycleArgs
10235
11303
  }),
10236
11304
  surfaceContract({
10237
11305
  name: "deprecate_ontology_version",
@@ -10247,7 +11315,8 @@ var ontologiesContracts = [
10247
11315
  functionName: "deprecateOntologyVersion",
10248
11316
  kind: "mutation",
10249
11317
  inputProjection: ontologyVersionIdInput
10250
- }
11318
+ },
11319
+ args: ontologyVersionLifecycleArgs
10251
11320
  }),
10252
11321
  surfaceContract({
10253
11322
  name: "resolve_effective_ontology",
@@ -10266,8 +11335,76 @@ var ontologiesContracts = [
10266
11335
  }
10267
11336
  })
10268
11337
  ];
10269
-
10270
- // ../contracts/src/function-registry/worktrees.ts
11338
+ var autoFixPolicyInputSchema = z.object({
11339
+ enabled: z.boolean().optional().describe("Whether automatic remediation is enabled."),
11340
+ mode: z.string().optional().describe("Automation mode for worktree auto-fixes."),
11341
+ maxAttempts: z.number().optional().describe("Maximum number of auto-fix attempts."),
11342
+ reviewer: z.string().optional().describe("Reviewer responsible for auto-fix oversight."),
11343
+ maxActionsPerRun: z.number().optional().describe("Maximum number of auto-fix actions per run."),
11344
+ permittedMutationTiers: z.array(z.enum(["read_only", "low_risk_write", "high_risk_write"])).optional().describe("Mutation tiers the auto-fix worker may execute."),
11345
+ requireAuditTrail: z.boolean().optional().describe("Whether auto-fix actions must write an audit trail."),
11346
+ escalationGate: z.string().optional().describe("Gate to trigger when auto-fix policy requires escalation.")
11347
+ }).passthrough().describe("Policy for permitted automatic remediation inside the worktree.");
11348
+ var worktreeKeyQuestionInputSchema = z.object({
11349
+ question: z.string().describe("Question the worktree must resolve."),
11350
+ status: z.enum(["open", "answered", "forked"]).optional().describe("Current disposition of the key question."),
11351
+ answer: z.string().optional().describe("Captured answer when the key question is resolved."),
11352
+ answerConfidence: z.enum(["high", "medium", "low"]).optional().describe("Confidence in the captured answer."),
11353
+ linkedQuestionId: z.string().optional().describe("Canonical question node linked to this key question.")
11354
+ }).passthrough().describe("Question contract embedded in the worktree plan.");
11355
+ var worktreeEvidenceSignalInputSchema = z.object({
11356
+ signal: z.string().describe("Evidence signal the worktree should collect."),
11357
+ collected: z.boolean().optional().describe("Whether the signal has already been collected."),
11358
+ progress: z.string().optional().describe("Collection progress note for the signal."),
11359
+ notes: z.string().optional().describe("Additional evidence collection notes.")
11360
+ }).passthrough().describe("Evidence signal embedded in the worktree plan.");
11361
+ var worktreeDecisionGateInputSchema = z.object({
11362
+ goCriteria: z.array(z.string()).describe("Criteria that must hold for the worktree to proceed."),
11363
+ noGoSignals: z.array(z.string()).describe("Signals that stop or redirect the worktree."),
11364
+ verdict: z.enum(["go", "no_go", "pivot", "pending"]).optional().describe("Current decision verdict for the worktree gate."),
11365
+ verdictRationale: z.string().optional().describe("Rationale supporting the current gate verdict."),
11366
+ decidedAt: z.number().optional().describe("Timestamp when the gate verdict was decided."),
11367
+ decidedBy: z.string().optional().describe("Actor that decided the gate verdict.")
11368
+ }).passthrough().describe("Decision gate contract for worktree activation or exit.");
11369
+ var addWorktreeArgs = z.object({
11370
+ title: z.string().optional().describe("Human-readable worktree name or objective."),
11371
+ name: z.string().optional().describe("Storage-name alias for callers that already use backend naming."),
11372
+ topicId: z.string().describe("Primary topic scope for the worktree."),
11373
+ projectId: z.string().optional().describe("Legacy topicId alias."),
11374
+ branchId: z.string().optional().describe("Legacy branch identifier for compatibility with workflow callers."),
11375
+ objective: z.string().optional().describe("Reasoning objective this worktree is intended to resolve."),
11376
+ hypothesis: z.string().optional().describe("Testable claim this worktree investigates."),
11377
+ rationale: z.string().optional().describe("Why this worktree exists and why it belongs in the campaign."),
11378
+ worktreeType: z.string().optional().describe("Schema-enum worktree type used for kernel lifecycle behavior."),
11379
+ gate: z.string().optional().describe("Exit gate for this worktree."),
11380
+ startDate: z.number().optional().describe("Planned start timestamp in milliseconds since epoch."),
11381
+ endDate: z.number().optional().describe("Planned end timestamp in milliseconds since epoch."),
11382
+ durationWeeks: z.number().optional().describe("Planned duration in weeks."),
11383
+ confidenceImpact: z.enum(["high", "medium", "low"]).optional().describe("Expected confidence impact if this worktree succeeds."),
11384
+ beliefFocus: z.string().optional().describe("Natural-language focus spanning the target belief neighborhood."),
11385
+ beliefIds: z.array(z.string()).optional().describe("Legacy alias for targetBeliefIds."),
11386
+ beliefs: z.array(z.string()).optional().describe("Legacy alias for targetBeliefIds."),
11387
+ targetBeliefIds: z.array(z.string()).optional().describe("Belief node IDs this worktree is expected to test or update."),
11388
+ targetQuestionIds: z.array(z.string()).optional().describe("Question node IDs this worktree is expected to answer."),
11389
+ keyQuestions: z.array(worktreeKeyQuestionInputSchema).optional().describe("Inline key questions captured as part of the worktree plan."),
11390
+ evidenceSignals: z.array(worktreeEvidenceSignalInputSchema).optional().describe("Evidence signals the worktree needs to collect or validate."),
11391
+ decisionGate: worktreeDecisionGateInputSchema.optional(),
11392
+ goCriteria: z.array(z.string()).optional().describe("Shorthand go criteria used to build decisionGate."),
11393
+ noGoSignals: z.array(z.string()).optional().describe("Shorthand no-go signals used to build decisionGate."),
11394
+ proofArtifacts: z.array(z.unknown()).optional().describe("Expected proof artifacts required to close the worktree."),
11395
+ autoShape: z.boolean().optional().describe("Whether to invoke inquiry auto-shaping during creation."),
11396
+ autoFixPolicy: autoFixPolicyInputSchema.optional(),
11397
+ domainPackId: z.string().optional().describe("Domain pack whose shaping hooks should influence the worktree."),
11398
+ campaign: z.number().optional().describe("Top-level pipeline campaign number."),
11399
+ lane: z.string().optional().describe("Campaign lane for the worktree."),
11400
+ laneOrderInCampaign: z.number().optional().describe("Ordering for this lane within its campaign."),
11401
+ orderInLane: z.number().optional().describe("Position of this worktree inside its lane."),
11402
+ dependsOn: z.array(z.string()).optional().describe("Worktree IDs that must complete before this worktree."),
11403
+ blocks: z.array(z.string()).optional().describe("Worktree IDs blocked by this worktree."),
11404
+ staffingHint: z.string().optional().describe("Suggested staffing or agent allocation note."),
11405
+ lensId: z.string().optional().describe("Lens that scopes this worktree when applicable."),
11406
+ lastReconciledAt: z.number().optional().describe("Timestamp when worktree metadata was last reconciled.")
11407
+ });
10271
11408
  var worktreeIdInput = (input) => compactRecord4({
10272
11409
  worktreeId: input.worktreeId ?? input.id
10273
11410
  });
@@ -10300,6 +11437,50 @@ var worktreeMetadataInput = (input) => compactRecord4({
10300
11437
  autoFixPolicy: input.autoFixPolicy,
10301
11438
  lastReconciledAt: input.lastReconciledAt
10302
11439
  });
11440
+ var worktreeMetadataArgs = z.object({
11441
+ worktreeId: z.string().describe("The worktree to update."),
11442
+ id: z.string().optional().describe("Worktree ID alias."),
11443
+ topicId: z.string().optional().describe("Primary topic scope."),
11444
+ additionalTopicIds: z.array(z.string()).optional().describe("Additional topic scopes associated with this worktree."),
11445
+ status: z.string().optional().describe("Worktree lifecycle status."),
11446
+ campaign: z.number().optional().describe("Top-level pipeline campaign."),
11447
+ lane: z.string().optional().describe("Campaign lane."),
11448
+ laneOrderInCampaign: z.number().optional().describe("Ordering for this lane within its campaign."),
11449
+ orderInLane: z.number().optional().describe("Position of this worktree inside its lane."),
11450
+ gate: z.string().optional().describe("Exit gate for this worktree."),
11451
+ hypothesis: z.string().optional().describe("Testable claim this worktree investigates."),
11452
+ objective: z.string().optional().describe("Reasoning objective for the worktree."),
11453
+ rationale: z.string().optional().describe("Why this worktree is sequenced here."),
11454
+ proofArtifacts: z.array(z.unknown()).optional().describe("Proof artifacts required to close the worktree."),
11455
+ staffingHint: z.string().optional().describe("Suggested staffing or agent allocation note."),
11456
+ blocks: z.array(z.string()).optional().describe("Worktree IDs blocked by this worktree."),
11457
+ dependsOn: z.array(z.string()).optional().describe("Worktree IDs this worktree depends on."),
11458
+ lensId: z.string().optional().describe("Lens that scopes this worktree."),
11459
+ autoFixPolicy: autoFixPolicyInputSchema.optional(),
11460
+ lastReconciledAt: z.number().optional().describe("Timestamp of the last deterministic reconciliation pass.")
11461
+ });
11462
+ var pushArgs = worktreeMetadataArgs.extend({
11463
+ targetContext: z.string().describe("Where to push merged findings."),
11464
+ beliefIds: z.array(z.string()).optional().describe("Optional subset of beliefs to push.")
11465
+ });
11466
+ var openPullRequestArgs = worktreeMetadataArgs.extend({
11467
+ reviewers: z.array(z.string()).optional().describe("User IDs of requested reviewers."),
11468
+ summary: z.string().describe("Summary of findings and why they are ready for review.")
11469
+ });
11470
+ var mergeKeyFindingsInput = (input) => {
11471
+ if (Array.isArray(input.keyFindings)) {
11472
+ return input.keyFindings;
11473
+ }
11474
+ if (Array.isArray(input.outcomes)) {
11475
+ const findings = input.outcomes.filter(
11476
+ (outcome) => typeof outcome === "string" && outcome.trim().length > 0
11477
+ );
11478
+ if (findings.length > 0) {
11479
+ return findings;
11480
+ }
11481
+ }
11482
+ return [input.summary ?? "Merged worktree"];
11483
+ };
10303
11484
  var listAllWorktreesInput = (input) => compactRecord4({
10304
11485
  status: input.status,
10305
11486
  lane: input.lane,
@@ -10307,6 +11488,16 @@ var listAllWorktreesInput = (input) => compactRecord4({
10307
11488
  limit: input.limit
10308
11489
  });
10309
11490
  var worktreesContracts = [
11491
+ surfaceContract({
11492
+ name: "begin_build_session",
11493
+ kind: "mutation",
11494
+ domain: "worktrees",
11495
+ surfaceClass: "platform_internal",
11496
+ path: "/mcp/build-session/begin",
11497
+ sdkNamespace: "worktrees",
11498
+ sdkMethod: "beginBuildSession",
11499
+ summary: "Begin a coding build session for a worktree."
11500
+ }),
10310
11501
  surfaceContract({
10311
11502
  name: "add_worktree",
10312
11503
  kind: "mutation",
@@ -10323,13 +11514,12 @@ var worktreesContracts = [
10323
11514
  inputProjection: (input, context) => withCreatedBy(
10324
11515
  compactRecord4({
10325
11516
  name: input.name ?? input.title,
10326
- topicId: input.topicId,
11517
+ topicId: input.topicId ?? input.projectId,
10327
11518
  worktreeType: input.worktreeType,
10328
11519
  objective: input.objective,
10329
11520
  gate: input.gate,
10330
11521
  hypothesis: input.hypothesis,
10331
11522
  rationale: input.rationale,
10332
- signal: input.signal,
10333
11523
  startDate: input.startDate,
10334
11524
  endDate: input.endDate,
10335
11525
  durationWeeks: input.durationWeeks,
@@ -10355,12 +11545,12 @@ var worktreesContracts = [
10355
11545
  staffingHint: input.staffingHint,
10356
11546
  domainPackId: input.domainPackId,
10357
11547
  lensId: input.lensId,
10358
- linkedQuestionId: input.linkedQuestionId,
10359
11548
  lastReconciledAt: input.lastReconciledAt
10360
11549
  }),
10361
11550
  context
10362
11551
  )
10363
- }
11552
+ },
11553
+ args: addWorktreeArgs
10364
11554
  }),
10365
11555
  surfaceContract({
10366
11556
  name: "activate_worktree",
@@ -10472,7 +11662,8 @@ var worktreesContracts = [
10472
11662
  functionName: "updateMetadata",
10473
11663
  kind: "mutation",
10474
11664
  inputProjection: worktreeMetadataInput
10475
- }
11665
+ },
11666
+ args: worktreeMetadataArgs
10476
11667
  }),
10477
11668
  surfaceContract({
10478
11669
  name: "merge",
@@ -10490,9 +11681,7 @@ var worktreesContracts = [
10490
11681
  inputProjection: (input, context) => withUserId(
10491
11682
  {
10492
11683
  ...worktreeIdInput(input),
10493
- keyFindings: input.keyFindings ?? [
10494
- input.summary ?? "Merged worktree"
10495
- ],
11684
+ keyFindings: mergeKeyFindingsInput(input),
10496
11685
  decisionsReached: input.decisionsReached ?? [],
10497
11686
  nextSteps: input.nextSteps ?? []
10498
11687
  },
@@ -10514,7 +11703,8 @@ var worktreesContracts = [
10514
11703
  functionName: "updateMetadata",
10515
11704
  kind: "mutation",
10516
11705
  inputProjection: worktreeMetadataInput
10517
- }
11706
+ },
11707
+ args: pushArgs
10518
11708
  }),
10519
11709
  surfaceContract({
10520
11710
  name: "open_pull_request",
@@ -10530,7 +11720,8 @@ var worktreesContracts = [
10530
11720
  functionName: "updateMetadata",
10531
11721
  kind: "mutation",
10532
11722
  inputProjection: worktreeMetadataInput
10533
- }
11723
+ },
11724
+ args: openPullRequestArgs
10534
11725
  })
10535
11726
  ];
10536
11727
 
@@ -10634,6 +11825,15 @@ var createEdgeArgs = z.object({
10634
11825
  topicId: z.string().optional(),
10635
11826
  trustedBypassAccessCheck: z.boolean().optional()
10636
11827
  });
11828
+ var queryLineageArgs = z.object({
11829
+ nodeId: z.string().describe("Starting node to trace from."),
11830
+ startNode: z.string().optional().describe("Starting node alias accepted by traversal callers."),
11831
+ depth: z.number().optional().describe("Traversal depth alias."),
11832
+ maxDepth: z.number().optional().describe("Maximum traversal depth."),
11833
+ mode: z.string().optional().describe("Traversal mode."),
11834
+ minLayer: z.string().optional().describe("Minimum epistemic layer."),
11835
+ maxLayer: z.string().optional().describe("Maximum epistemic layer.")
11836
+ });
10637
11837
  function graphRefNodeId(ref) {
10638
11838
  if (ref.kind === "epistemic_node") {
10639
11839
  return ref.nodeId;
@@ -10704,11 +11904,84 @@ var edgesContracts = [
10704
11904
  minLayer: input.minLayer,
10705
11905
  maxLayer: input.maxLayer
10706
11906
  })
10707
- }
11907
+ },
11908
+ args: queryLineageArgs
10708
11909
  })
10709
11910
  ];
10710
-
10711
- // ../contracts/src/function-registry/graph.ts
11911
+ var graphIntelligenceQueryModes = [
11912
+ "core",
11913
+ "bias",
11914
+ "stress",
11915
+ "operational",
11916
+ "alpha",
11917
+ "semantic",
11918
+ "evidence"
11919
+ ];
11920
+ var traversalLayerSchema = z.enum([
11921
+ "L4",
11922
+ "L3",
11923
+ "L2",
11924
+ "L1",
11925
+ "ontological",
11926
+ "organizational"
11927
+ ]);
11928
+ var traversalModeSchema = z.enum(["low", "medium", "high", "extra_high"]);
11929
+ var lineageAliasArgs = z.object({
11930
+ nodeId: z.string().optional().describe("Starting node to traverse from."),
11931
+ startNode: z.string().optional().describe("Starting node alias for traversal callers."),
11932
+ entityId: z.string().optional().describe("Entity identifier alias for impact tracing."),
11933
+ depth: z.number().optional().describe("Traversal depth alias."),
11934
+ maxDepth: z.number().optional().describe("Maximum traversal depth."),
11935
+ mode: traversalModeSchema.optional().describe("Traversal mode."),
11936
+ minLayer: traversalLayerSchema.optional().describe("Minimum epistemic layer to include."),
11937
+ maxLayer: traversalLayerSchema.optional().describe("Maximum epistemic layer to include.")
11938
+ });
11939
+ var lineageArgs = lineageAliasArgs.extend({
11940
+ nodeId: z.string().describe("Starting node to traverse from.")
11941
+ });
11942
+ var traverseGraphArgs = lineageAliasArgs.extend({
11943
+ startNode: z.string().describe("Node to start traversal from."),
11944
+ direction: z.enum(["up", "down", "both"]).optional().describe("Traversal direction.")
11945
+ });
11946
+ var graphNeighborhoodArgs = z.object({
11947
+ globalId: z.string().optional().describe("Single root global ID."),
11948
+ globalIds: z.array(z.string()).optional().describe("Root global IDs for the neighborhood."),
11949
+ maxDepth: z.number().optional().describe("Maximum traversal depth."),
11950
+ topicId: z.string().optional().describe("Topic scope for edge lookup."),
11951
+ limit: z.number().optional().describe("Maximum edges to return.")
11952
+ });
11953
+ var graphIntelligenceModeSchema = z.enum([
11954
+ graphIntelligenceQueryModes[0],
11955
+ ...graphIntelligenceQueryModes.slice(1)
11956
+ ]);
11957
+ var graphIntelligenceCatalogArgs = z.object({
11958
+ categoryId: z.string().optional().describe("Optional query category filter."),
11959
+ mode: graphIntelligenceModeSchema.optional().describe("Optional Graph Intelligence query mode filter.")
11960
+ });
11961
+ var graphIntelligenceRunArgs = z.object({
11962
+ topicId: z.string().describe("Topic to analyze."),
11963
+ queryId: z.string().optional().describe("Catalog query ID to run, such as pre-mortem."),
11964
+ prompt: z.string().optional().describe("Custom prompt when queryId is omitted or overridden."),
11965
+ input: z.string().optional().describe("Optional entity, theme, belief, company, or search text."),
11966
+ mode: graphIntelligenceModeSchema.optional().describe("Optional query mode override for custom prompts."),
11967
+ limit: z.number().optional().describe("Maximum graph context rows to return.")
11968
+ });
11969
+ var flagContradictionArgs = z.object({
11970
+ beliefA: z.string().describe("First belief in tension."),
11971
+ beliefB: z.string().describe("Second belief in tension."),
11972
+ topicId: z.string().optional().describe("Topic scope for the contradiction."),
11973
+ description: z.string().optional().describe("Human-readable contradiction."),
11974
+ severity: z.enum(["critical", "high", "medium", "low"]).optional().describe("Contradiction severity."),
11975
+ defeatType: z.string().optional().describe("Defeat type annotation."),
11976
+ supportingInsightIds: z.array(z.string()).optional().describe("Evidence supporting the primary belief."),
11977
+ contradictingInsightIds: z.array(z.string()).optional().describe("Evidence or beliefs contradicting the primary belief.")
11978
+ });
11979
+ var discoverEntityConnectionsArgs = lineageAliasArgs.extend({
11980
+ nodeId: z.string().describe("Epistemic node ID to find entity connections for."),
11981
+ topicId: z.string().optional().describe("Topic scope override."),
11982
+ minScore: z.number().optional().describe("Minimum match score."),
11983
+ limit: z.number().optional().describe("Maximum candidates to return.")
11984
+ });
10712
11985
  var contradictionSeverity = (value) => {
10713
11986
  switch (value) {
10714
11987
  case "critical":
@@ -10763,7 +12036,8 @@ var graphContracts = [
10763
12036
  functionName: "getLineage",
10764
12037
  kind: "query",
10765
12038
  inputProjection: lineageInput
10766
- }
12039
+ },
12040
+ args: traverseGraphArgs
10767
12041
  }),
10768
12042
  surfaceContract({
10769
12043
  name: "get_graph_neighborhood",
@@ -10779,7 +12053,8 @@ var graphContracts = [
10779
12053
  functionName: "getByTopic",
10780
12054
  kind: "query",
10781
12055
  inputProjection: topicEdgesInput
10782
- }
12056
+ },
12057
+ args: graphNeighborhoodArgs
10783
12058
  }),
10784
12059
  surfaceContract({
10785
12060
  name: "get_graph_structure_analysis",
@@ -10796,6 +12071,38 @@ var graphContracts = [
10796
12071
  kind: "query"
10797
12072
  }
10798
12073
  }),
12074
+ surfaceContract({
12075
+ name: "list_graph_intelligence_queries",
12076
+ kind: "query",
12077
+ domain: "graph",
12078
+ surfaceClass: "platform_public",
12079
+ path: "/graph-intelligence/queries",
12080
+ sdkNamespace: "graphAnalysis",
12081
+ sdkMethod: "listGraphIntelligenceQueries",
12082
+ summary: "List Graph Intelligence query catalog entries.",
12083
+ convex: {
12084
+ module: "contextCompiler",
12085
+ functionName: "listGraphIntelligenceQueries",
12086
+ kind: "query"
12087
+ },
12088
+ args: graphIntelligenceCatalogArgs
12089
+ }),
12090
+ surfaceContract({
12091
+ name: "run_graph_intelligence_query",
12092
+ kind: "query",
12093
+ domain: "graph",
12094
+ surfaceClass: "platform_public",
12095
+ path: "/graph-intelligence/run",
12096
+ sdkNamespace: "graphAnalysis",
12097
+ sdkMethod: "runGraphIntelligenceQuery",
12098
+ summary: "Run a Graph Intelligence query against a topic graph.",
12099
+ convex: {
12100
+ module: "contextCompiler",
12101
+ functionName: "runGraphIntelligenceQuery",
12102
+ kind: "query"
12103
+ },
12104
+ args: graphIntelligenceRunArgs
12105
+ }),
10799
12106
  surfaceContract({
10800
12107
  name: "find_contradictions",
10801
12108
  kind: "query",
@@ -10828,7 +12135,8 @@ var graphContracts = [
10828
12135
  functionName: "create",
10829
12136
  kind: "mutation",
10830
12137
  inputProjection: flagContradictionInput
10831
- }
12138
+ },
12139
+ args: flagContradictionArgs
10832
12140
  }),
10833
12141
  surfaceContract({
10834
12142
  name: "detect_confirmation_bias",
@@ -10919,7 +12227,8 @@ var graphContracts = [
10919
12227
  functionName: "getLineage",
10920
12228
  kind: "query",
10921
12229
  inputProjection: lineageInput
10922
- }
12230
+ },
12231
+ args: discoverEntityConnectionsArgs
10923
12232
  }),
10924
12233
  surfaceContract({
10925
12234
  name: "trigger_belief_review",
@@ -10950,7 +12259,8 @@ var graphContracts = [
10950
12259
  functionName: "getLineage",
10951
12260
  kind: "query",
10952
12261
  inputProjection: lineageInput
10953
- }
12262
+ },
12263
+ args: lineageArgs
10954
12264
  })
10955
12265
  ];
10956
12266
 
@@ -11002,8 +12312,16 @@ var contractsContracts = [
11002
12312
  }
11003
12313
  })
11004
12314
  ];
11005
-
11006
- // ../contracts/src/function-registry/judgments.ts
12315
+ var auditTrailArgs = z.object({
12316
+ nodeId: z.string().describe("The node to audit."),
12317
+ id: z.string().optional().describe("Node ID alias."),
12318
+ limit: z.number().optional().describe("Maximum entries to return."),
12319
+ depth: z.number().optional().describe("Traversal depth alias."),
12320
+ maxDepth: z.number().optional().describe("Maximum lineage depth."),
12321
+ mode: z.string().optional().describe("Traversal mode."),
12322
+ minLayer: z.string().optional().describe("Minimum epistemic layer."),
12323
+ maxLayer: z.string().optional().describe("Maximum epistemic layer.")
12324
+ });
11007
12325
  var judgmentsContracts = [
11008
12326
  surfaceContract({
11009
12327
  name: "record_judgment",
@@ -11058,7 +12376,8 @@ var judgmentsContracts = [
11058
12376
  minLayer: input.minLayer,
11059
12377
  maxLayer: input.maxLayer
11060
12378
  })
11061
- }
12379
+ },
12380
+ args: auditTrailArgs
11062
12381
  })
11063
12382
  ];
11064
12383
 
@@ -11226,8 +12545,13 @@ var coordinationContracts = [
11226
12545
  }
11227
12546
  })
11228
12547
  ];
11229
-
11230
- // ../contracts/src/function-registry/pipeline.ts
12548
+ var pipelineSnapshotArgs = z.object({
12549
+ topicId: z.string().describe("Topic scope ID."),
12550
+ status: z.string().optional().describe("Worktree status filter."),
12551
+ lane: z.string().optional().describe("Campaign lane filter."),
12552
+ campaign: z.number().optional().describe("Campaign number filter."),
12553
+ limit: z.number().optional().describe("Maximum worktrees to inspect.")
12554
+ });
11231
12555
  var pipelineContracts = [
11232
12556
  surfaceContract({
11233
12557
  name: "pipeline_snapshot",
@@ -11248,7 +12572,8 @@ var pipelineContracts = [
11248
12572
  campaign: input.campaign,
11249
12573
  limit: input.limit
11250
12574
  })
11251
- }
12575
+ },
12576
+ args: pipelineSnapshotArgs
11252
12577
  }),
11253
12578
  surfaceContract({
11254
12579
  name: "seed_belief_lattice",
@@ -11300,7 +12625,31 @@ var recordScopeLearningArgs = z.object({
11300
12625
  rationale: z.string().optional().describe("Why this learning should enter the reasoning graph"),
11301
12626
  createQuestionText: z.string().optional().describe("Optional follow-up question text"),
11302
12627
  createBeliefText: z.string().optional().describe("Optional new belief text"),
11303
- beliefType: z.string().optional().describe("Optional belief type for createBeliefText")
12628
+ beliefType: z.string().optional().describe("Optional belief type for createBeliefText"),
12629
+ text: z.string().optional().describe("Canonical learning text alias."),
12630
+ content: z.string().optional().describe("Canonical learning content alias."),
12631
+ kind: z.string().optional().describe("Evidence kind to store."),
12632
+ sourceType: z.string().optional().describe("Evidence source type."),
12633
+ externalSourceType: z.string().optional().describe("External source type alias."),
12634
+ metadata: z.record(z.unknown()).optional().describe("Learning metadata.")
12635
+ });
12636
+ var codeContextArgs = z.object({
12637
+ topicId: z.string().optional().describe("Topic scope."),
12638
+ filePath: z.string().optional().describe("File path anchor."),
12639
+ includeFailures: z.boolean().optional().describe("Whether to include failed attempts."),
12640
+ limit: z.number().optional().describe("Maximum records to return."),
12641
+ status: z.string().optional().describe("Evidence status filter.")
12642
+ });
12643
+ var recordAttemptArgs = z.object({
12644
+ topicId: z.string().optional().describe("Topic scope."),
12645
+ description: z.string().describe("Attempt description."),
12646
+ errorMessage: z.string().optional().describe("Failure or error message."),
12647
+ filePaths: z.array(z.string()).optional().describe("Files involved in the attempt."),
12648
+ filePath: z.string().optional().describe("Single file path alias."),
12649
+ linkedBeliefId: z.string().optional().describe("Linked belief ID."),
12650
+ metadata: z.record(z.unknown()).optional().describe("Attempt metadata."),
12651
+ rationale: z.string().optional().describe("Why this attempt should be recorded."),
12652
+ title: z.string().optional().describe("Attempt evidence title.")
11304
12653
  });
11305
12654
  var learningInput = (input, context) => {
11306
12655
  const sourceKind = input.sourceKind ?? input.externalSourceType;
@@ -11417,7 +12766,8 @@ var codingContracts = [
11417
12766
  status: input.status,
11418
12767
  userId: input.userId
11419
12768
  })
11420
- }
12769
+ },
12770
+ args: codeContextArgs
11421
12771
  }),
11422
12772
  surfaceContract({
11423
12773
  name: "get_change_history",
@@ -11454,7 +12804,8 @@ var codingContracts = [
11454
12804
  functionName: "create",
11455
12805
  kind: "mutation",
11456
12806
  inputProjection: attemptInput
11457
- }
12807
+ },
12808
+ args: recordAttemptArgs
11458
12809
  }),
11459
12810
  surfaceContract({
11460
12811
  name: "get_failure_log",
@@ -11529,6 +12880,604 @@ new Map(
11529
12880
  ALL_FUNCTION_CONTRACTS.map((contract) => [contract.name, contract])
11530
12881
  );
11531
12882
 
12883
+ // ../contracts/src/tenant-bootstrap-seed.contract.ts
12884
+ function isCopyableSeedRequirement(entry) {
12885
+ return (entry.copyMode === "template_global" || entry.copyMode === "template_tenant_rewrite" || entry.copyMode === "template_reference_remap") && Boolean(entry.scope) && Array.isArray(entry.uniqueKey) && entry.uniqueKey.length > 0;
12886
+ }
12887
+ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
12888
+ {
12889
+ component: "kernel",
12890
+ table: "agentMessages",
12891
+ prepopulation: "runtime_data",
12892
+ copyMode: "none",
12893
+ description: "Agent coordination messages are session data, not template data."
12894
+ },
12895
+ {
12896
+ component: "kernel",
12897
+ table: "agentSessions",
12898
+ prepopulation: "runtime_data",
12899
+ copyMode: "none",
12900
+ description: "Agent coordination sessions are created by active clients."
12901
+ },
12902
+ {
12903
+ component: "kernel",
12904
+ table: "autofixJobs",
12905
+ prepopulation: "runtime_queue",
12906
+ copyMode: "none",
12907
+ description: "Autofix work items are runtime queue rows."
12908
+ },
12909
+ {
12910
+ component: "kernel",
12911
+ table: "backgroundJobRuns",
12912
+ prepopulation: "runtime_log",
12913
+ copyMode: "none",
12914
+ description: "Background job executions are runtime logs."
12915
+ },
12916
+ {
12917
+ component: "kernel",
12918
+ table: "backgroundJobSettings",
12919
+ prepopulation: "required_template",
12920
+ copyMode: "template_global",
12921
+ scope: "global",
12922
+ uniqueKey: ["jobKey"],
12923
+ description: "Default job enablement settings must come from the K template."
12924
+ },
12925
+ {
12926
+ component: "kernel",
12927
+ table: "beliefConfidence",
12928
+ prepopulation: "runtime_data",
12929
+ copyMode: "none",
12930
+ description: "Belief confidence rows are created with tenant graph facts."
12931
+ },
12932
+ {
12933
+ component: "kernel",
12934
+ table: "beliefEvidenceLinks",
12935
+ prepopulation: "runtime_data",
12936
+ copyMode: "none",
12937
+ description: "Belief-to-evidence links are tenant graph data."
12938
+ },
12939
+ {
12940
+ component: "kernel",
12941
+ table: "beliefHistory",
12942
+ prepopulation: "runtime_data",
12943
+ copyMode: "none",
12944
+ description: "Belief history is append-only tenant graph data."
12945
+ },
12946
+ {
12947
+ component: "kernel",
12948
+ table: "beliefScenarios",
12949
+ prepopulation: "runtime_data",
12950
+ copyMode: "none",
12951
+ description: "Scenario rows are tenant-authored reasoning data."
12952
+ },
12953
+ {
12954
+ component: "kernel",
12955
+ table: "beliefVotes",
12956
+ prepopulation: "runtime_data",
12957
+ copyMode: "none",
12958
+ description: "Decision belief votes are tenant-authored data."
12959
+ },
12960
+ {
12961
+ component: "kernel",
12962
+ table: "calibrationScores",
12963
+ prepopulation: "runtime_derived",
12964
+ copyMode: "none",
12965
+ description: "Calibration scores are computed from tenant outcomes."
12966
+ },
12967
+ {
12968
+ component: "kernel",
12969
+ table: "contractEvaluations",
12970
+ prepopulation: "runtime_log",
12971
+ copyMode: "none",
12972
+ description: "Contract evaluation rows are runtime computation logs."
12973
+ },
12974
+ {
12975
+ component: "kernel",
12976
+ table: "contradictions",
12977
+ prepopulation: "runtime_data",
12978
+ copyMode: "none",
12979
+ description: "Contradictions are tenant graph facts."
12980
+ },
12981
+ {
12982
+ component: "kernel",
12983
+ table: "crossProjectConnections",
12984
+ prepopulation: "runtime_data",
12985
+ copyMode: "none",
12986
+ description: "Cross-topic connections are tenant graph facts."
12987
+ },
12988
+ {
12989
+ component: "kernel",
12990
+ table: "decisionComputedSummaries",
12991
+ prepopulation: "runtime_derived",
12992
+ copyMode: "none",
12993
+ description: "Decision summaries are derived tenant outputs."
12994
+ },
12995
+ {
12996
+ component: "kernel",
12997
+ table: "decisionEvents",
12998
+ prepopulation: "runtime_data",
12999
+ copyMode: "none",
13000
+ description: "Decision events are lifecycle data."
13001
+ },
13002
+ {
13003
+ component: "kernel",
13004
+ table: "decisionParticipants",
13005
+ prepopulation: "runtime_data",
13006
+ copyMode: "none",
13007
+ description: "Decision participants are tenant-selected actors."
13008
+ },
13009
+ {
13010
+ component: "kernel",
13011
+ table: "decisionRiskLedger",
13012
+ prepopulation: "runtime_data",
13013
+ copyMode: "none",
13014
+ description: "Decision risk rows are tenant decision data."
13015
+ },
13016
+ {
13017
+ component: "kernel",
13018
+ table: "decisionSnapshots",
13019
+ prepopulation: "runtime_derived",
13020
+ copyMode: "none",
13021
+ description: "Decision snapshots are derived from tenant state."
13022
+ },
13023
+ {
13024
+ component: "kernel",
13025
+ table: "deliberationContributions",
13026
+ prepopulation: "runtime_data",
13027
+ copyMode: "none",
13028
+ description: "Deliberation contributions are tenant-authored data."
13029
+ },
13030
+ {
13031
+ component: "kernel",
13032
+ table: "deliberationSessions",
13033
+ prepopulation: "runtime_data",
13034
+ copyMode: "none",
13035
+ description: "Deliberation sessions are created by tenant workflows."
13036
+ },
13037
+ {
13038
+ component: "kernel",
13039
+ table: "epistemicAudit",
13040
+ prepopulation: "runtime_log",
13041
+ copyMode: "none",
13042
+ description: "Epistemic audit rows are append-only runtime audit data."
13043
+ },
13044
+ {
13045
+ component: "kernel",
13046
+ table: "epistemicContracts",
13047
+ prepopulation: "runtime_data",
13048
+ copyMode: "none",
13049
+ description: "Epistemic contracts are tenant-authored governance data."
13050
+ },
13051
+ {
13052
+ component: "kernel",
13053
+ table: "epistemicEdges",
13054
+ prepopulation: "runtime_data",
13055
+ copyMode: "none",
13056
+ description: "Edges are tenant reasoning graph data."
13057
+ },
13058
+ {
13059
+ component: "kernel",
13060
+ table: "epistemicNodeEmbeddings",
13061
+ prepopulation: "runtime_derived",
13062
+ copyMode: "none",
13063
+ description: "Embeddings are derived from tenant graph nodes."
13064
+ },
13065
+ {
13066
+ component: "kernel",
13067
+ table: "epistemicNodes",
13068
+ prepopulation: "runtime_data",
13069
+ copyMode: "none",
13070
+ description: "Nodes are tenant reasoning graph data."
13071
+ },
13072
+ {
13073
+ component: "kernel",
13074
+ table: "graphAnalysisCache",
13075
+ prepopulation: "runtime_derived",
13076
+ copyMode: "none",
13077
+ description: "Graph analysis cache rows are derived from tenant graph state."
13078
+ },
13079
+ {
13080
+ component: "kernel",
13081
+ table: "graphAnalysisResults",
13082
+ prepopulation: "runtime_derived",
13083
+ copyMode: "none",
13084
+ description: "Graph analysis result rows are derived tenant outputs."
13085
+ },
13086
+ {
13087
+ component: "kernel",
13088
+ table: "graphSuggestions",
13089
+ prepopulation: "runtime_derived",
13090
+ copyMode: "none",
13091
+ description: "Graph suggestions are derived recommendations."
13092
+ },
13093
+ {
13094
+ component: "kernel",
13095
+ table: "harnessReplays",
13096
+ prepopulation: "runtime_log",
13097
+ copyMode: "none",
13098
+ description: "Harness replay rows are runtime verification logs."
13099
+ },
13100
+ {
13101
+ component: "kernel",
13102
+ table: "harnessRuns",
13103
+ prepopulation: "runtime_log",
13104
+ copyMode: "none",
13105
+ description: "Harness run rows are runtime verification logs."
13106
+ },
13107
+ {
13108
+ component: "kernel",
13109
+ table: "idempotencyTokens",
13110
+ prepopulation: "runtime_log",
13111
+ copyMode: "none",
13112
+ description: "Idempotency tokens are request-scoped runtime guards."
13113
+ },
13114
+ {
13115
+ component: "kernel",
13116
+ table: "lenses",
13117
+ prepopulation: "optional_template",
13118
+ copyMode: "none",
13119
+ description: "Reusable lens templates may live in K templates, but workspace-specific copies are not required for core SDK boot."
13120
+ },
13121
+ {
13122
+ component: "kernel",
13123
+ table: "lensTopicBindings",
13124
+ prepopulation: "runtime_data",
13125
+ copyMode: "none",
13126
+ description: "Lens bindings attach runtime topics to runtime/workspace lenses."
13127
+ },
13128
+ {
13129
+ component: "kernel",
13130
+ table: "neo4jSyncQueue",
13131
+ prepopulation: "runtime_queue",
13132
+ copyMode: "none",
13133
+ description: "Neo4j sync queue rows are runtime work items."
13134
+ },
13135
+ {
13136
+ component: "kernel",
13137
+ table: "ontologyDefinitions",
13138
+ prepopulation: "required_template",
13139
+ copyMode: "template_global",
13140
+ scope: "global",
13141
+ uniqueKey: ["ontologyKey"],
13142
+ description: "Platform ontology definitions power taxonomy reads and effective ontology resolution."
13143
+ },
13144
+ {
13145
+ component: "kernel",
13146
+ table: "ontologyVersions",
13147
+ prepopulation: "required_template",
13148
+ copyMode: "template_reference_remap",
13149
+ scope: "global",
13150
+ uniqueKey: ["ontologyKey", "version"],
13151
+ dependsOn: ["ontologyDefinitions"],
13152
+ description: "Ontology versions must be copied with ontologyDefinition ID remapping."
13153
+ },
13154
+ {
13155
+ component: "kernel",
13156
+ table: "platformAgentRunPolicyDecisions",
13157
+ prepopulation: "runtime_log",
13158
+ copyMode: "none",
13159
+ description: "Agent-run policy decisions are audit logs."
13160
+ },
13161
+ {
13162
+ component: "kernel",
13163
+ table: "platformAgentRunPromptResolutions",
13164
+ prepopulation: "runtime_log",
13165
+ copyMode: "none",
13166
+ description: "Agent-run prompt resolution rows are runtime logs."
13167
+ },
13168
+ {
13169
+ component: "kernel",
13170
+ table: "platformAgentRuns",
13171
+ prepopulation: "runtime_log",
13172
+ copyMode: "none",
13173
+ description: "Agent runs are runtime execution records."
13174
+ },
13175
+ {
13176
+ component: "kernel",
13177
+ table: "platformAgentRunToolCalls",
13178
+ prepopulation: "runtime_log",
13179
+ copyMode: "none",
13180
+ description: "Agent-run tool calls are runtime execution records."
13181
+ },
13182
+ {
13183
+ component: "kernel",
13184
+ table: "platformHarnessShadowAudit",
13185
+ prepopulation: "runtime_log",
13186
+ copyMode: "none",
13187
+ description: "Harness shadow audit rows are runtime audit records."
13188
+ },
13189
+ {
13190
+ component: "kernel",
13191
+ table: "publicationRules",
13192
+ prepopulation: "required_template",
13193
+ copyMode: "template_tenant_rewrite",
13194
+ scope: "tenant",
13195
+ uniqueKey: ["tenantId", "workspaceId", "name"],
13196
+ description: "Default publication policy rules are rewritten into each tenant."
13197
+ },
13198
+ {
13199
+ component: "kernel",
13200
+ table: "questionEvidenceLinks",
13201
+ prepopulation: "runtime_data",
13202
+ copyMode: "none",
13203
+ description: "Question-to-evidence links are tenant graph data."
13204
+ },
13205
+ {
13206
+ component: "kernel",
13207
+ table: "researchJobs",
13208
+ prepopulation: "runtime_queue",
13209
+ copyMode: "none",
13210
+ description: "Research job rows are runtime queue items."
13211
+ },
13212
+ {
13213
+ component: "kernel",
13214
+ table: "schemaEnumConfig",
13215
+ prepopulation: "required_template",
13216
+ copyMode: "template_global",
13217
+ scope: "global",
13218
+ uniqueKey: ["category", "value"],
13219
+ description: "Runtime-extensible enum defaults required by SDK graph APIs."
13220
+ },
13221
+ {
13222
+ component: "kernel",
13223
+ table: "stakeholderGroups",
13224
+ prepopulation: "runtime_data",
13225
+ copyMode: "none",
13226
+ description: "Stakeholder groups are tenant decision data."
13227
+ },
13228
+ {
13229
+ component: "kernel",
13230
+ table: "systemLogs",
13231
+ prepopulation: "runtime_log",
13232
+ copyMode: "none",
13233
+ description: "System logs are runtime telemetry."
13234
+ },
13235
+ {
13236
+ component: "kernel",
13237
+ table: "tasks",
13238
+ prepopulation: "runtime_data",
13239
+ copyMode: "none",
13240
+ description: "Tasks are tenant-authored work items."
13241
+ },
13242
+ {
13243
+ component: "kernel",
13244
+ table: "topics",
13245
+ prepopulation: "runtime_bootstrap",
13246
+ copyMode: "none",
13247
+ description: "Default topics are created by tenant provisioning, not copied from templates."
13248
+ },
13249
+ {
13250
+ component: "kernel",
13251
+ table: "workflowDefinitions",
13252
+ prepopulation: "optional_template",
13253
+ copyMode: "none",
13254
+ description: "Table-driven workflow definitions can be template data after the workflow engine leaves legacy mode."
13255
+ },
13256
+ {
13257
+ component: "kernel",
13258
+ table: "workflowPullRequests",
13259
+ prepopulation: "runtime_data",
13260
+ copyMode: "none",
13261
+ description: "Workflow pull requests are tenant workflow data."
13262
+ },
13263
+ {
13264
+ component: "kernel",
13265
+ table: "workflowStages",
13266
+ prepopulation: "optional_template",
13267
+ copyMode: "none",
13268
+ dependsOn: ["workflowDefinitions"],
13269
+ description: "Workflow stages can be template data after workflowDefinitions are enabled for bootstrap copying."
13270
+ },
13271
+ {
13272
+ component: "kernel",
13273
+ table: "worktreeBeliefCluster",
13274
+ prepopulation: "runtime_data",
13275
+ copyMode: "none",
13276
+ description: "Worktree cluster rows link runtime worktrees to runtime beliefs."
13277
+ },
13278
+ {
13279
+ component: "kernel",
13280
+ table: "worktrees",
13281
+ prepopulation: "runtime_data",
13282
+ copyMode: "none",
13283
+ description: "Worktrees are tenant/runtime planning data."
13284
+ },
13285
+ {
13286
+ component: "identity",
13287
+ table: "agents",
13288
+ prepopulation: "runtime_bootstrap",
13289
+ copyMode: "none",
13290
+ description: "Service agents are provisioned per tenant or service, not copied."
13291
+ },
13292
+ {
13293
+ component: "identity",
13294
+ table: "mcpWritePolicy",
13295
+ prepopulation: "required_template",
13296
+ copyMode: "template_global",
13297
+ scope: "global",
13298
+ uniqueKey: ["topicId", "role", "toolCategory"],
13299
+ description: "Global write policy defaults govern service and interactive MCP writes."
13300
+ },
13301
+ {
13302
+ component: "identity",
13303
+ table: "modelCallLogs",
13304
+ prepopulation: "runtime_log",
13305
+ copyMode: "none",
13306
+ description: "Model call logs are runtime telemetry."
13307
+ },
13308
+ {
13309
+ component: "identity",
13310
+ table: "modelFunctionSlots",
13311
+ prepopulation: "required_template",
13312
+ copyMode: "template_global",
13313
+ scope: "global",
13314
+ uniqueKey: ["slot"],
13315
+ description: "Function-to-model slots are required by model runtime resolution."
13316
+ },
13317
+ {
13318
+ component: "identity",
13319
+ table: "modelRegistry",
13320
+ prepopulation: "required_template",
13321
+ copyMode: "template_global",
13322
+ scope: "global",
13323
+ uniqueKey: ["key"],
13324
+ description: "Model catalog defaults are required by model runtime clients."
13325
+ },
13326
+ {
13327
+ component: "identity",
13328
+ table: "modelSlotConfigs",
13329
+ prepopulation: "required_template",
13330
+ copyMode: "template_global",
13331
+ scope: "global",
13332
+ uniqueKey: ["slot"],
13333
+ description: "Slot-level defaults are required before tenant overrides exist."
13334
+ },
13335
+ {
13336
+ component: "identity",
13337
+ table: "platformAudienceGrants",
13338
+ prepopulation: "runtime_data",
13339
+ copyMode: "none",
13340
+ description: "Audience grants are principal/group-specific access rows."
13341
+ },
13342
+ {
13343
+ component: "identity",
13344
+ table: "platformAudiences",
13345
+ prepopulation: "required_template",
13346
+ copyMode: "template_tenant_rewrite",
13347
+ scope: "tenant",
13348
+ uniqueKey: ["tenantId", "workspaceId", "audienceKey"],
13349
+ description: "Default tenant audience taxonomy rows are rewritten into each tenant."
13350
+ },
13351
+ {
13352
+ component: "identity",
13353
+ table: "platformPolicyDecisionLogs",
13354
+ prepopulation: "runtime_log",
13355
+ copyMode: "none",
13356
+ description: "Policy decisions are runtime audit logs."
13357
+ },
13358
+ {
13359
+ component: "identity",
13360
+ table: "projectGrants",
13361
+ prepopulation: "runtime_data",
13362
+ copyMode: "none",
13363
+ description: "Project/topic grants are principal or group-specific access rows."
13364
+ },
13365
+ {
13366
+ component: "identity",
13367
+ table: "reasoningPermissions",
13368
+ prepopulation: "runtime_data",
13369
+ copyMode: "none",
13370
+ description: "Reasoning permissions are principal-specific policy rows."
13371
+ },
13372
+ {
13373
+ component: "identity",
13374
+ table: "tenantApiKeys",
13375
+ prepopulation: "runtime_secret",
13376
+ copyMode: "none",
13377
+ description: "API keys are tenant credentials and must never be copied."
13378
+ },
13379
+ {
13380
+ component: "identity",
13381
+ table: "tenantConfig",
13382
+ prepopulation: "required_template",
13383
+ copyMode: "template_tenant_rewrite",
13384
+ scope: "tenant",
13385
+ uniqueKey: ["tenantId"],
13386
+ description: "Tenant-local config defaults are rewritten during bootstrap."
13387
+ },
13388
+ {
13389
+ component: "identity",
13390
+ table: "tenantIntegrations",
13391
+ prepopulation: "required_template",
13392
+ copyMode: "template_tenant_rewrite",
13393
+ scope: "tenant",
13394
+ uniqueKey: ["tenantId", "integrationKey"],
13395
+ description: "Non-secret integration descriptors are rewritten into each tenant."
13396
+ },
13397
+ {
13398
+ component: "identity",
13399
+ table: "tenantModelSlotBindings",
13400
+ prepopulation: "runtime_secret",
13401
+ copyMode: "none",
13402
+ description: "Tenant model slot bindings reference provider secrets and are runtime-only."
13403
+ },
13404
+ {
13405
+ component: "identity",
13406
+ table: "tenantPolicies",
13407
+ prepopulation: "required_template",
13408
+ copyMode: "template_tenant_rewrite",
13409
+ scope: "tenant",
13410
+ uniqueKey: ["tenantId", "workspaceId", "roleName"],
13411
+ description: "Default tenant policy roles are rewritten during bootstrap."
13412
+ },
13413
+ {
13414
+ component: "identity",
13415
+ table: "tenantProviderSecrets",
13416
+ prepopulation: "runtime_secret",
13417
+ copyMode: "none",
13418
+ description: "Provider secrets are credentials and must never be copied."
13419
+ },
13420
+ {
13421
+ component: "identity",
13422
+ table: "tenantProxyGatewayUsage",
13423
+ prepopulation: "runtime_log",
13424
+ copyMode: "none",
13425
+ description: "Proxy gateway usage rows are runtime telemetry."
13426
+ },
13427
+ {
13428
+ component: "identity",
13429
+ table: "tenantProxyTokenMints",
13430
+ prepopulation: "runtime_secret",
13431
+ copyMode: "none",
13432
+ description: "Proxy token mints are ephemeral secret-bearing runtime rows."
13433
+ },
13434
+ {
13435
+ component: "identity",
13436
+ table: "tenantSandboxAuditEvents",
13437
+ prepopulation: "runtime_log",
13438
+ copyMode: "none",
13439
+ description: "Sandbox audit rows are runtime security logs."
13440
+ },
13441
+ {
13442
+ component: "identity",
13443
+ table: "tenantSecrets",
13444
+ prepopulation: "runtime_secret",
13445
+ copyMode: "none",
13446
+ description: "Tenant secrets are credentials and must never be copied."
13447
+ },
13448
+ {
13449
+ component: "identity",
13450
+ table: "toolAcls",
13451
+ prepopulation: "required_template",
13452
+ copyMode: "template_global",
13453
+ scope: "global",
13454
+ uniqueKey: ["role", "toolName"],
13455
+ description: "Default role-to-tool grants are required for SDK/MCP tool access."
13456
+ },
13457
+ {
13458
+ component: "identity",
13459
+ table: "toolRegistry",
13460
+ prepopulation: "required_template",
13461
+ copyMode: "template_global",
13462
+ scope: "global",
13463
+ uniqueKey: ["toolName"],
13464
+ description: "Core tool catalog rows are required before pack or tenant tools exist."
13465
+ },
13466
+ {
13467
+ component: "identity",
13468
+ table: "users",
13469
+ prepopulation: "runtime_bootstrap",
13470
+ copyMode: "none",
13471
+ description: "Users are created from Clerk/MC principal resolution, not copied."
13472
+ }
13473
+ ];
13474
+ TENANT_BOOTSTRAP_TABLE_REQUIREMENTS.filter(
13475
+ isCopyableSeedRequirement
13476
+ );
13477
+ TENANT_BOOTSTRAP_TABLE_REQUIREMENTS.filter(
13478
+ (entry) => !isCopyableSeedRequirement(entry)
13479
+ ).map((entry) => entry.table);
13480
+
11532
13481
  export { buildDomainEvent, compareEventCursor, createEventId, decodeEventCursor, emitDomainEvent, encodeEventCursor, inferActorType, isAfterCursor, normalizeRetentionDays, sortEventsByCursor };
11533
13482
  //# sourceMappingURL=outbox.js.map
11534
13483
  //# sourceMappingURL=outbox.js.map