@lucern/mcp 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/cli.js +26293 -20705
- package/dist/cli.js.map +1 -1
- package/dist/gateway.d.ts +7 -1
- package/dist/gateway.js +2366 -103
- package/dist/gateway.js.map +1 -1
- package/dist/hosted-route.js +9742 -4168
- package/dist/hosted-route.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +26160 -20565
- package/dist/index.js.map +1 -1
- package/dist/runtime.js +2185 -118
- package/dist/runtime.js.map +1 -1
- package/package.json +6 -6
package/dist/runtime.js
CHANGED
|
@@ -184,6 +184,487 @@ var autoBranchingHandlers = {
|
|
|
184
184
|
}
|
|
185
185
|
};
|
|
186
186
|
|
|
187
|
+
// ../contracts/src/graph-intelligence.contract.ts
|
|
188
|
+
var GRAPH_INTELLIGENCE_MODE_TOOL_NAMES = {
|
|
189
|
+
core: [
|
|
190
|
+
"get_graph_structure_analysis",
|
|
191
|
+
"get_topic_coverage",
|
|
192
|
+
"get_graph_gaps",
|
|
193
|
+
"list_beliefs",
|
|
194
|
+
"list_questions",
|
|
195
|
+
"search_evidence"
|
|
196
|
+
],
|
|
197
|
+
bias: [
|
|
198
|
+
"get_graph_structure_analysis",
|
|
199
|
+
"detect_confirmation_bias",
|
|
200
|
+
"find_contradictions",
|
|
201
|
+
"search_evidence",
|
|
202
|
+
"list_beliefs"
|
|
203
|
+
],
|
|
204
|
+
stress: [
|
|
205
|
+
"get_graph_structure_analysis",
|
|
206
|
+
"get_graph_gaps",
|
|
207
|
+
"find_contradictions",
|
|
208
|
+
"get_falsification_questions",
|
|
209
|
+
"list_beliefs",
|
|
210
|
+
"list_questions"
|
|
211
|
+
],
|
|
212
|
+
operational: [
|
|
213
|
+
"get_topic_coverage",
|
|
214
|
+
"get_graph_gaps",
|
|
215
|
+
"list_beliefs",
|
|
216
|
+
"list_questions",
|
|
217
|
+
"search_evidence"
|
|
218
|
+
],
|
|
219
|
+
alpha: [
|
|
220
|
+
"get_graph_structure_analysis",
|
|
221
|
+
"detect_confirmation_bias",
|
|
222
|
+
"find_contradictions",
|
|
223
|
+
"search_beliefs",
|
|
224
|
+
"search_evidence"
|
|
225
|
+
],
|
|
226
|
+
semantic: [
|
|
227
|
+
"get_graph_structure_analysis",
|
|
228
|
+
"search_beliefs",
|
|
229
|
+
"search_evidence",
|
|
230
|
+
"traverse_graph",
|
|
231
|
+
"query_lineage",
|
|
232
|
+
"get_graph_neighborhood"
|
|
233
|
+
],
|
|
234
|
+
evidence: [
|
|
235
|
+
"get_graph_structure_analysis",
|
|
236
|
+
"get_topic_coverage",
|
|
237
|
+
"search_evidence",
|
|
238
|
+
"get_falsification_questions",
|
|
239
|
+
"find_contradictions"
|
|
240
|
+
]
|
|
241
|
+
};
|
|
242
|
+
var byMode = (mode) => GRAPH_INTELLIGENCE_MODE_TOOL_NAMES[mode];
|
|
243
|
+
var GRAPH_INTELLIGENCE_QUERIES = [
|
|
244
|
+
{
|
|
245
|
+
id: "confirmation-bias",
|
|
246
|
+
categoryId: "problems",
|
|
247
|
+
mode: "bias",
|
|
248
|
+
name: "Find Confirmation Bias",
|
|
249
|
+
description: "Find beliefs supported mainly by confirming evidence.",
|
|
250
|
+
prompt: "Find beliefs where supporting evidence overwhelms challenging evidence. Prioritize high-conviction beliefs with few defeaters.",
|
|
251
|
+
highlightStrategy: "bias-risk",
|
|
252
|
+
riskLevel: "high"
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
id: "contradiction-map",
|
|
256
|
+
categoryId: "problems",
|
|
257
|
+
mode: "stress",
|
|
258
|
+
name: "Map Contradictions",
|
|
259
|
+
description: "Surface direct and indirect contradiction clusters.",
|
|
260
|
+
prompt: "Map the graph's contradiction clusters and explain which tensions matter most.",
|
|
261
|
+
highlightStrategy: "contradictions",
|
|
262
|
+
riskLevel: "high"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
id: "weak-evidence",
|
|
266
|
+
categoryId: "problems",
|
|
267
|
+
mode: "stress",
|
|
268
|
+
name: "Weak Evidence Chains",
|
|
269
|
+
description: "Find important claims with thin or indirect evidence.",
|
|
270
|
+
prompt: "Find high-importance beliefs whose evidence support is thin, indirect, stale, or low quality.",
|
|
271
|
+
highlightStrategy: "weak-support",
|
|
272
|
+
riskLevel: "medium"
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
id: "single-source",
|
|
276
|
+
categoryId: "problems",
|
|
277
|
+
mode: "bias",
|
|
278
|
+
name: "Single-Source Risk",
|
|
279
|
+
description: "Find claims overly dependent on one source or source type.",
|
|
280
|
+
prompt: "Identify beliefs that rely on a single source, one methodology, or one repeated perspective.",
|
|
281
|
+
highlightStrategy: "source-concentration",
|
|
282
|
+
riskLevel: "medium"
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
id: "untested-assumptions",
|
|
286
|
+
categoryId: "problems",
|
|
287
|
+
mode: "stress",
|
|
288
|
+
name: "Untested Assumptions",
|
|
289
|
+
description: "Find load-bearing assumptions without falsification paths.",
|
|
290
|
+
prompt: "Find assumptions that appear load-bearing but do not have direct testing questions or falsification evidence.",
|
|
291
|
+
highlightStrategy: "untested",
|
|
292
|
+
riskLevel: "high"
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
id: "load-bearing-beliefs",
|
|
296
|
+
categoryId: "problems",
|
|
297
|
+
mode: "stress",
|
|
298
|
+
name: "Load-Bearing Beliefs",
|
|
299
|
+
description: "Find central beliefs whose failure would affect many claims.",
|
|
300
|
+
prompt: "Find the beliefs with the largest downstream impact if they are wrong.",
|
|
301
|
+
highlightStrategy: "load-bearing",
|
|
302
|
+
riskLevel: "high"
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
id: "cascade-analysis",
|
|
306
|
+
categoryId: "problems",
|
|
307
|
+
mode: "stress",
|
|
308
|
+
name: "Cascade Analysis",
|
|
309
|
+
description: "Trace what changes if a belief is weakened or invalidated.",
|
|
310
|
+
prompt: "Analyze likely downstream cascades if the most central or uncertain beliefs are weakened.",
|
|
311
|
+
highlightStrategy: "cascade",
|
|
312
|
+
riskLevel: "high"
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
id: "unanswered-questions",
|
|
316
|
+
categoryId: "gaps",
|
|
317
|
+
mode: "operational",
|
|
318
|
+
name: "Unanswered Questions",
|
|
319
|
+
description: "Find important open questions that block confidence.",
|
|
320
|
+
prompt: "Identify the most important unanswered questions and explain which beliefs they block.",
|
|
321
|
+
highlightStrategy: "open-questions"
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
id: "thin-themes",
|
|
325
|
+
categoryId: "gaps",
|
|
326
|
+
mode: "operational",
|
|
327
|
+
name: "Thin Themes",
|
|
328
|
+
description: "Find topics with shallow belief or evidence coverage.",
|
|
329
|
+
prompt: "Find themes that look underdeveloped relative to their role in the graph.",
|
|
330
|
+
highlightStrategy: "thin-themes"
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
id: "missing-evidence",
|
|
334
|
+
categoryId: "gaps",
|
|
335
|
+
mode: "stress",
|
|
336
|
+
name: "Missing Evidence",
|
|
337
|
+
description: "Find beliefs that need specific missing evidence.",
|
|
338
|
+
prompt: "Find the most valuable missing evidence needed to strengthen or falsify the graph.",
|
|
339
|
+
highlightStrategy: "missing-evidence"
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
id: "isolated-clusters",
|
|
343
|
+
categoryId: "gaps",
|
|
344
|
+
mode: "operational",
|
|
345
|
+
name: "Isolated Clusters",
|
|
346
|
+
description: "Find clusters not connected to the broader graph.",
|
|
347
|
+
prompt: "Find isolated graph clusters and recommend bridge questions or bridge evidence.",
|
|
348
|
+
highlightStrategy: "isolated-clusters"
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
id: "source-contribution",
|
|
352
|
+
categoryId: "gaps",
|
|
353
|
+
mode: "evidence",
|
|
354
|
+
name: "Source Contribution",
|
|
355
|
+
description: "Assess how source mix shapes the graph.",
|
|
356
|
+
prompt: "Assess whether the source mix is balanced enough for the graph's strongest claims.",
|
|
357
|
+
highlightStrategy: "source-mix"
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
id: "stale-beliefs",
|
|
361
|
+
categoryId: "gaps",
|
|
362
|
+
mode: "operational",
|
|
363
|
+
name: "Stale Beliefs",
|
|
364
|
+
description: "Find beliefs that need review because they are old or stale.",
|
|
365
|
+
prompt: "Find beliefs that should be revisited because they are stale, unsupported by recent evidence, or contradicted by newer context.",
|
|
366
|
+
highlightStrategy: "staleness"
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
id: "assumption-pyramid",
|
|
370
|
+
categoryId: "reasoning",
|
|
371
|
+
mode: "operational",
|
|
372
|
+
name: "Assumption Pyramid",
|
|
373
|
+
description: "Show which conclusions rest on which assumptions.",
|
|
374
|
+
prompt: "Build an assumption pyramid from the graph: foundational assumptions, intermediate claims, and top-level conclusions.",
|
|
375
|
+
highlightStrategy: "assumptions"
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
id: "converging-evidence",
|
|
379
|
+
categoryId: "reasoning",
|
|
380
|
+
mode: "evidence",
|
|
381
|
+
name: "Converging Evidence",
|
|
382
|
+
description: "Find claims supported by independent evidence streams.",
|
|
383
|
+
prompt: "Find beliefs with genuinely independent converging evidence and explain why they are robust.",
|
|
384
|
+
highlightStrategy: "convergence"
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
id: "weakest-links",
|
|
388
|
+
categoryId: "reasoning",
|
|
389
|
+
mode: "stress",
|
|
390
|
+
name: "Weakest Links",
|
|
391
|
+
description: "Find the weakest links in important reasoning chains.",
|
|
392
|
+
prompt: "Find the weakest links in important reasoning chains and explain how to test them.",
|
|
393
|
+
highlightStrategy: "weak-links",
|
|
394
|
+
riskLevel: "medium"
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
id: "challenged-beliefs",
|
|
398
|
+
categoryId: "reasoning",
|
|
399
|
+
mode: "stress",
|
|
400
|
+
name: "Challenged Beliefs",
|
|
401
|
+
description: "Find beliefs with active challenges or defeaters.",
|
|
402
|
+
prompt: "Find beliefs with active challenges, contradiction edges, or unresolved defeaters.",
|
|
403
|
+
highlightStrategy: "challenged"
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
id: "contrarian-map",
|
|
407
|
+
categoryId: "strategic",
|
|
408
|
+
mode: "alpha",
|
|
409
|
+
name: "Contrarian Map",
|
|
410
|
+
description: "Find non-consensus beliefs and where they are grounded.",
|
|
411
|
+
prompt: "Find the graph's strongest contrarian or non-consensus beliefs and explain their support.",
|
|
412
|
+
highlightStrategy: "contrarian"
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
id: "irreversibility-audit",
|
|
416
|
+
categoryId: "strategic",
|
|
417
|
+
mode: "stress",
|
|
418
|
+
name: "Irreversibility Audit",
|
|
419
|
+
description: "Find irreversible bets and assumptions behind them.",
|
|
420
|
+
prompt: "Audit irreversible decisions or beliefs and identify what must be true before acting.",
|
|
421
|
+
highlightStrategy: "irreversible",
|
|
422
|
+
riskLevel: "high"
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
id: "pre-mortem",
|
|
426
|
+
categoryId: "strategic",
|
|
427
|
+
mode: "stress",
|
|
428
|
+
name: "Pre-Mortem",
|
|
429
|
+
description: "Explain how the graph could be wrong.",
|
|
430
|
+
prompt: "Run a pre-mortem: assume the current thesis fails and identify the most plausible failure paths.",
|
|
431
|
+
highlightStrategy: "failure-paths",
|
|
432
|
+
riskLevel: "high"
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
id: "devils-advocate",
|
|
436
|
+
categoryId: "strategic",
|
|
437
|
+
mode: "stress",
|
|
438
|
+
name: "Devil's Advocate",
|
|
439
|
+
description: "Generate the strongest critique of the graph.",
|
|
440
|
+
prompt: "Produce the strongest evidence-grounded critique of the current graph and its main thesis.",
|
|
441
|
+
highlightStrategy: "critique"
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
id: "falsification-map",
|
|
445
|
+
categoryId: "strategic",
|
|
446
|
+
mode: "stress",
|
|
447
|
+
name: "Falsification Map",
|
|
448
|
+
description: "Find the cheapest tests that would disprove key beliefs.",
|
|
449
|
+
prompt: "Map the cheapest, clearest falsification tests for the graph's key claims.",
|
|
450
|
+
highlightStrategy: "falsification",
|
|
451
|
+
riskLevel: "high"
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
id: "prediction-tracker",
|
|
455
|
+
categoryId: "strategic",
|
|
456
|
+
mode: "evidence",
|
|
457
|
+
name: "Prediction Tracker",
|
|
458
|
+
description: "Find beliefs that imply measurable predictions.",
|
|
459
|
+
prompt: "Find beliefs that imply measurable predictions and suggest tracking signals.",
|
|
460
|
+
highlightStrategy: "predictions"
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
id: "belief-pagerank",
|
|
464
|
+
categoryId: "deep",
|
|
465
|
+
mode: "semantic",
|
|
466
|
+
name: "Belief PageRank",
|
|
467
|
+
description: "Identify structurally central beliefs.",
|
|
468
|
+
prompt: "Use graph centrality to identify the most structurally important beliefs.",
|
|
469
|
+
highlightStrategy: "centrality"
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
id: "underdetermination",
|
|
473
|
+
categoryId: "deep",
|
|
474
|
+
mode: "semantic",
|
|
475
|
+
name: "Underdetermination",
|
|
476
|
+
description: "Find places where evidence supports multiple explanations.",
|
|
477
|
+
prompt: "Find places where the same evidence could support multiple incompatible explanations.",
|
|
478
|
+
highlightStrategy: "underdetermination"
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
id: "confidence-propagation",
|
|
482
|
+
categoryId: "deep",
|
|
483
|
+
mode: "semantic",
|
|
484
|
+
name: "Confidence Propagation",
|
|
485
|
+
description: "Assess how uncertainty moves through the graph.",
|
|
486
|
+
prompt: "Explain how uncertainty propagates from weak or contested beliefs through downstream conclusions.",
|
|
487
|
+
highlightStrategy: "confidence-flow"
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
id: "argument-depth",
|
|
491
|
+
categoryId: "deep",
|
|
492
|
+
mode: "evidence",
|
|
493
|
+
name: "Argument Depth",
|
|
494
|
+
description: "Assess reasoning depth and chain quality.",
|
|
495
|
+
prompt: "Assess reasoning depth: where claims are shallow, deeply supported, or overextended.",
|
|
496
|
+
highlightStrategy: "depth"
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
id: "information-edge",
|
|
500
|
+
categoryId: "deep",
|
|
501
|
+
mode: "alpha",
|
|
502
|
+
name: "Information Edge",
|
|
503
|
+
description: "Find differentiated evidence or signals.",
|
|
504
|
+
prompt: "Find evidence, sources, or beliefs that could represent differentiated information edge.",
|
|
505
|
+
highlightStrategy: "information-edge"
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
id: "thesis-summary",
|
|
509
|
+
categoryId: "browse",
|
|
510
|
+
mode: "semantic",
|
|
511
|
+
name: "Thesis Summary",
|
|
512
|
+
description: "Summarize the graph's core thesis and support.",
|
|
513
|
+
prompt: "Summarize the graph's core thesis, strongest support, weakest support, and open questions.",
|
|
514
|
+
highlightStrategy: "summary"
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
id: "theme-deep-dive",
|
|
518
|
+
categoryId: "browse",
|
|
519
|
+
mode: "semantic",
|
|
520
|
+
name: "Theme Deep Dive",
|
|
521
|
+
description: "Deep dive into a named theme.",
|
|
522
|
+
prompt: "Deep dive into {input}. Explain the key beliefs, evidence, contradictions, and open questions.",
|
|
523
|
+
inputType: "theme",
|
|
524
|
+
highlightStrategy: "theme"
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
id: "belief-detail",
|
|
528
|
+
categoryId: "browse",
|
|
529
|
+
mode: "semantic",
|
|
530
|
+
name: "Belief Detail",
|
|
531
|
+
description: "Explain one belief and its graph neighborhood.",
|
|
532
|
+
prompt: "Explain {input} and its support, challenges, related beliefs, and downstream implications.",
|
|
533
|
+
inputType: "belief",
|
|
534
|
+
highlightStrategy: "belief"
|
|
535
|
+
},
|
|
536
|
+
{
|
|
537
|
+
id: "strongest-beliefs",
|
|
538
|
+
categoryId: "browse",
|
|
539
|
+
mode: "operational",
|
|
540
|
+
name: "Strongest Beliefs",
|
|
541
|
+
description: "Find the graph's strongest current beliefs.",
|
|
542
|
+
prompt: "Find the strongest current beliefs and explain why each one deserves confidence.",
|
|
543
|
+
highlightStrategy: "strongest"
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
id: "cross-theme-connection",
|
|
547
|
+
categoryId: "browse",
|
|
548
|
+
mode: "semantic",
|
|
549
|
+
name: "Cross-Theme Connections",
|
|
550
|
+
description: "Find bridges between themes.",
|
|
551
|
+
prompt: "Find meaningful connections across themes and explain which bridge beliefs matter.",
|
|
552
|
+
highlightStrategy: "bridges"
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
id: "research-velocity",
|
|
556
|
+
categoryId: "browse",
|
|
557
|
+
mode: "operational",
|
|
558
|
+
name: "Research Velocity",
|
|
559
|
+
description: "Summarize recent graph movement and momentum.",
|
|
560
|
+
prompt: "Assess research velocity: what changed recently, where progress is fastest, and what is stuck.",
|
|
561
|
+
highlightStrategy: "velocity"
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
id: "search",
|
|
565
|
+
categoryId: "browse",
|
|
566
|
+
mode: "semantic",
|
|
567
|
+
name: "Graph Search",
|
|
568
|
+
description: "Search the graph with semantic context.",
|
|
569
|
+
prompt: "Search the graph for {input}. Return the most relevant beliefs, evidence, and questions.",
|
|
570
|
+
inputType: "search",
|
|
571
|
+
highlightStrategy: "search"
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
id: "expert-coverage",
|
|
575
|
+
categoryId: "browse",
|
|
576
|
+
mode: "semantic",
|
|
577
|
+
name: "Expert Coverage",
|
|
578
|
+
description: "Assess coverage from expert/source perspectives.",
|
|
579
|
+
prompt: "Assess whether the graph has enough expert, primary, and dissenting coverage.",
|
|
580
|
+
highlightStrategy: "expert-coverage"
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
id: "value-chain-map",
|
|
584
|
+
categoryId: "browse",
|
|
585
|
+
mode: "semantic",
|
|
586
|
+
name: "Value Chain Map",
|
|
587
|
+
description: "Map entities, dependencies, and value-chain logic.",
|
|
588
|
+
prompt: "Map the value chain implied by this graph: entities, dependencies, pressure points, and missing links.",
|
|
589
|
+
highlightStrategy: "value-chain"
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
id: "meeting-brief",
|
|
593
|
+
categoryId: "prep",
|
|
594
|
+
mode: "semantic",
|
|
595
|
+
name: "Meeting Brief",
|
|
596
|
+
description: "Prepare a meeting brief from graph context.",
|
|
597
|
+
prompt: "Prepare a concise meeting brief using the graph: thesis, open questions, risks, and recommended asks.",
|
|
598
|
+
highlightStrategy: "brief"
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
id: "open-questions-entity",
|
|
602
|
+
categoryId: "prep",
|
|
603
|
+
mode: "semantic",
|
|
604
|
+
name: "Entity Open Questions",
|
|
605
|
+
description: "Find open questions about a specific entity.",
|
|
606
|
+
prompt: "Find the most important open questions about {input} and the beliefs those questions would unlock.",
|
|
607
|
+
inputType: "entity",
|
|
608
|
+
highlightStrategy: "entity-questions"
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
id: "company-context",
|
|
612
|
+
categoryId: "prep",
|
|
613
|
+
mode: "semantic",
|
|
614
|
+
name: "Company Context",
|
|
615
|
+
description: "Summarize graph context about a company.",
|
|
616
|
+
prompt: "Summarize what the graph knows about {input}: thesis relevance, evidence, risks, and open questions.",
|
|
617
|
+
inputType: "company",
|
|
618
|
+
highlightStrategy: "company"
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
id: "company-theme-fit",
|
|
622
|
+
categoryId: "prep",
|
|
623
|
+
mode: "semantic",
|
|
624
|
+
name: "Company Theme Fit",
|
|
625
|
+
description: "Assess how a company fits graph themes.",
|
|
626
|
+
prompt: "Assess how {input} fits the graph's themes and where the fit is weak or uncertain.",
|
|
627
|
+
inputType: "company",
|
|
628
|
+
highlightStrategy: "fit"
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
id: "company-comparison",
|
|
632
|
+
categoryId: "prep",
|
|
633
|
+
mode: "semantic",
|
|
634
|
+
name: "Company Comparison",
|
|
635
|
+
description: "Compare companies through graph context.",
|
|
636
|
+
prompt: "Compare {input} using graph beliefs, evidence, risks, and open questions.",
|
|
637
|
+
inputType: "company-list",
|
|
638
|
+
highlightStrategy: "comparison"
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
id: "questions-to-ask",
|
|
642
|
+
categoryId: "prep",
|
|
643
|
+
mode: "operational",
|
|
644
|
+
name: "Questions to Ask",
|
|
645
|
+
description: "Generate high-signal questions from graph gaps.",
|
|
646
|
+
prompt: "Generate the highest-signal questions to ask next, grounded in current graph gaps.",
|
|
647
|
+
highlightStrategy: "questions"
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
id: "beliefs-to-test",
|
|
651
|
+
categoryId: "prep",
|
|
652
|
+
mode: "stress",
|
|
653
|
+
name: "Beliefs to Test",
|
|
654
|
+
description: "Prioritize beliefs that should be tested next.",
|
|
655
|
+
prompt: "Prioritize the beliefs that should be tested next and explain the cheapest test for each.",
|
|
656
|
+
highlightStrategy: "tests",
|
|
657
|
+
riskLevel: "medium"
|
|
658
|
+
}
|
|
659
|
+
];
|
|
660
|
+
GRAPH_INTELLIGENCE_QUERIES.map((query) => {
|
|
661
|
+
const definition = query;
|
|
662
|
+
return {
|
|
663
|
+
...definition,
|
|
664
|
+
tools: definition.tools ?? byMode(definition.mode)
|
|
665
|
+
};
|
|
666
|
+
});
|
|
667
|
+
|
|
187
668
|
// ../contracts/src/ids.contract.ts
|
|
188
669
|
var PREFIXED_ID_PATTERN = /^([a-z][a-z0-9]*)_(.+)$/;
|
|
189
670
|
function encodePrefixedId(prefix, value) {
|
|
@@ -222,7 +703,10 @@ function idOf(table) {
|
|
|
222
703
|
return schema;
|
|
223
704
|
}
|
|
224
705
|
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"]);
|
|
225
|
-
var
|
|
706
|
+
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"];
|
|
707
|
+
var STORAGE_EDGE_TYPE_VALUES = [...EDGE_TYPE_VALUES, "extracted_from"];
|
|
708
|
+
z.enum(EDGE_TYPE_VALUES);
|
|
709
|
+
var STORAGE_EDGE_TYPE = z.enum(STORAGE_EDGE_TYPE_VALUES);
|
|
226
710
|
var TOPIC_STATUS = z.enum(["active", "archived", "watching"]);
|
|
227
711
|
var TOPIC_VISIBILITY = z.enum(["private", "team", "firm", "external", "public"]);
|
|
228
712
|
defineTable({
|
|
@@ -1707,7 +2191,7 @@ defineTable({
|
|
|
1707
2191
|
"toNodeId": z.string().optional(),
|
|
1708
2192
|
"sourceGlobalId": z.string().optional(),
|
|
1709
2193
|
"targetGlobalId": z.string().optional(),
|
|
1710
|
-
"edgeType":
|
|
2194
|
+
"edgeType": STORAGE_EDGE_TYPE,
|
|
1711
2195
|
"edgeTier": z.string().optional(),
|
|
1712
2196
|
"domainNamespace": z.string().optional(),
|
|
1713
2197
|
"constraint": z.string().optional(),
|
|
@@ -4040,7 +4524,9 @@ defineTable({
|
|
|
4040
4524
|
"defaultProjectVisibility": z.enum(["private", "team", "firm", "external", "public"]).optional(),
|
|
4041
4525
|
"deployments": z.record(z.object({
|
|
4042
4526
|
"url": z.string(),
|
|
4043
|
-
"
|
|
4527
|
+
"target": z.enum(["kernelDeployment", "appDeployment"]).optional(),
|
|
4528
|
+
"encryptedDeployKey": z.string().optional(),
|
|
4529
|
+
"credentialRef": z.string().optional()
|
|
4044
4530
|
})).optional(),
|
|
4045
4531
|
"metadata": z.record(z.any()).optional(),
|
|
4046
4532
|
"createdBy": z.string().optional(),
|
|
@@ -4476,6 +4962,128 @@ var edgePolicyManifest = {
|
|
|
4476
4962
|
}
|
|
4477
4963
|
]
|
|
4478
4964
|
};
|
|
4965
|
+
|
|
4966
|
+
// ../contracts/src/tenant-client.contract.ts
|
|
4967
|
+
var TENANT_CLIENT_INSTALLABLE_PACKAGES = [
|
|
4968
|
+
{
|
|
4969
|
+
packageName: "@lucern/access-control",
|
|
4970
|
+
role: "runtime_entrypoint",
|
|
4971
|
+
directTenantImport: true
|
|
4972
|
+
},
|
|
4973
|
+
{
|
|
4974
|
+
packageName: "@lucern/agent",
|
|
4975
|
+
role: "platform_runtime",
|
|
4976
|
+
directTenantImport: false
|
|
4977
|
+
},
|
|
4978
|
+
{
|
|
4979
|
+
packageName: "@lucern/auth",
|
|
4980
|
+
role: "sdk_dependency",
|
|
4981
|
+
directTenantImport: false
|
|
4982
|
+
},
|
|
4983
|
+
{
|
|
4984
|
+
packageName: "@lucern/cli",
|
|
4985
|
+
role: "developer_tool",
|
|
4986
|
+
directTenantImport: false
|
|
4987
|
+
},
|
|
4988
|
+
{
|
|
4989
|
+
packageName: "@lucern/client-core",
|
|
4990
|
+
role: "sdk_dependency",
|
|
4991
|
+
directTenantImport: false
|
|
4992
|
+
},
|
|
4993
|
+
{
|
|
4994
|
+
packageName: "@lucern/confidence",
|
|
4995
|
+
role: "sdk_dependency",
|
|
4996
|
+
directTenantImport: false
|
|
4997
|
+
},
|
|
4998
|
+
{
|
|
4999
|
+
packageName: "@lucern/config",
|
|
5000
|
+
role: "configuration",
|
|
5001
|
+
directTenantImport: false
|
|
5002
|
+
},
|
|
5003
|
+
{
|
|
5004
|
+
packageName: "@lucern/contracts",
|
|
5005
|
+
role: "contract_entrypoint",
|
|
5006
|
+
directTenantImport: true
|
|
5007
|
+
},
|
|
5008
|
+
{
|
|
5009
|
+
packageName: "@lucern/control-plane",
|
|
5010
|
+
role: "platform_runtime",
|
|
5011
|
+
directTenantImport: false
|
|
5012
|
+
},
|
|
5013
|
+
{
|
|
5014
|
+
packageName: "@lucern/developer-kit",
|
|
5015
|
+
role: "developer_tool",
|
|
5016
|
+
directTenantImport: false
|
|
5017
|
+
},
|
|
5018
|
+
{
|
|
5019
|
+
packageName: "@lucern/events",
|
|
5020
|
+
role: "sdk_dependency",
|
|
5021
|
+
directTenantImport: false
|
|
5022
|
+
},
|
|
5023
|
+
{
|
|
5024
|
+
packageName: "@lucern/graph-primitives",
|
|
5025
|
+
role: "sdk_dependency",
|
|
5026
|
+
directTenantImport: false
|
|
5027
|
+
},
|
|
5028
|
+
{
|
|
5029
|
+
packageName: "@lucern/identity",
|
|
5030
|
+
role: "component_runtime",
|
|
5031
|
+
directTenantImport: false
|
|
5032
|
+
},
|
|
5033
|
+
{
|
|
5034
|
+
packageName: "@lucern/mcp",
|
|
5035
|
+
role: "runtime_entrypoint",
|
|
5036
|
+
directTenantImport: true
|
|
5037
|
+
},
|
|
5038
|
+
{
|
|
5039
|
+
packageName: "@lucern/pack-host",
|
|
5040
|
+
role: "platform_runtime",
|
|
5041
|
+
directTenantImport: false
|
|
5042
|
+
},
|
|
5043
|
+
{
|
|
5044
|
+
packageName: "@lucern/pack-installer",
|
|
5045
|
+
role: "developer_tool",
|
|
5046
|
+
directTenantImport: false
|
|
5047
|
+
},
|
|
5048
|
+
{
|
|
5049
|
+
packageName: "@lucern/proof-compiler",
|
|
5050
|
+
role: "developer_tool",
|
|
5051
|
+
directTenantImport: false
|
|
5052
|
+
},
|
|
5053
|
+
{
|
|
5054
|
+
packageName: "@lucern/react",
|
|
5055
|
+
role: "runtime_entrypoint",
|
|
5056
|
+
directTenantImport: true
|
|
5057
|
+
},
|
|
5058
|
+
{
|
|
5059
|
+
packageName: "@lucern/reasoning-kernel",
|
|
5060
|
+
role: "component_runtime",
|
|
5061
|
+
directTenantImport: false
|
|
5062
|
+
},
|
|
5063
|
+
{
|
|
5064
|
+
packageName: "@lucern/sdk",
|
|
5065
|
+
role: "runtime_entrypoint",
|
|
5066
|
+
directTenantImport: true
|
|
5067
|
+
},
|
|
5068
|
+
{
|
|
5069
|
+
packageName: "@lucern/server-core",
|
|
5070
|
+
role: "platform_runtime",
|
|
5071
|
+
directTenantImport: false
|
|
5072
|
+
},
|
|
5073
|
+
{
|
|
5074
|
+
packageName: "@lucern/testing",
|
|
5075
|
+
role: "test_support",
|
|
5076
|
+
directTenantImport: false
|
|
5077
|
+
},
|
|
5078
|
+
{
|
|
5079
|
+
packageName: "@lucern/types",
|
|
5080
|
+
role: "contract_entrypoint",
|
|
5081
|
+
directTenantImport: true
|
|
5082
|
+
}
|
|
5083
|
+
];
|
|
5084
|
+
TENANT_CLIENT_INSTALLABLE_PACKAGES.map(
|
|
5085
|
+
(entry) => entry.packageName
|
|
5086
|
+
);
|
|
4479
5087
|
z.object({
|
|
4480
5088
|
manifestVersion: z.literal("1.0.0"),
|
|
4481
5089
|
rules: z.array(
|
|
@@ -5305,6 +5913,14 @@ var ADD_WORKTREE = {
|
|
|
5305
5913
|
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.",
|
|
5306
5914
|
parameters: {
|
|
5307
5915
|
title: { type: "string", description: "Worktree name/objective" },
|
|
5916
|
+
name: {
|
|
5917
|
+
type: "string",
|
|
5918
|
+
description: "Optional storage-name alias for callers that already use backend naming"
|
|
5919
|
+
},
|
|
5920
|
+
projectId: {
|
|
5921
|
+
type: "string",
|
|
5922
|
+
description: "Legacy topicId alias"
|
|
5923
|
+
},
|
|
5308
5924
|
topicId: { type: "string", description: "Optional topic scope hint" },
|
|
5309
5925
|
branchId: {
|
|
5310
5926
|
type: "string",
|
|
@@ -5318,14 +5934,87 @@ var ADD_WORKTREE = {
|
|
|
5318
5934
|
type: "string",
|
|
5319
5935
|
description: "The testable claim this worktree investigates"
|
|
5320
5936
|
},
|
|
5937
|
+
rationale: {
|
|
5938
|
+
type: "string",
|
|
5939
|
+
description: "Why this worktree exists and why it belongs in the campaign"
|
|
5940
|
+
},
|
|
5941
|
+
worktreeType: {
|
|
5942
|
+
type: "string",
|
|
5943
|
+
description: "Schema-enum worktree type used by the kernel lifecycle and retrieval layers"
|
|
5944
|
+
},
|
|
5945
|
+
gate: {
|
|
5946
|
+
type: "string",
|
|
5947
|
+
description: "Exit gate name for this worktree"
|
|
5948
|
+
},
|
|
5949
|
+
startDate: {
|
|
5950
|
+
type: "number",
|
|
5951
|
+
description: "Planned start timestamp in milliseconds since epoch"
|
|
5952
|
+
},
|
|
5953
|
+
endDate: {
|
|
5954
|
+
type: "number",
|
|
5955
|
+
description: "Planned end timestamp in milliseconds since epoch"
|
|
5956
|
+
},
|
|
5957
|
+
durationWeeks: {
|
|
5958
|
+
type: "number",
|
|
5959
|
+
description: "Planned duration in weeks"
|
|
5960
|
+
},
|
|
5961
|
+
confidenceImpact: {
|
|
5962
|
+
type: "string",
|
|
5963
|
+
description: "Expected confidence impact if the worktree succeeds",
|
|
5964
|
+
enum: ["high", "medium", "low"]
|
|
5965
|
+
},
|
|
5966
|
+
beliefFocus: {
|
|
5967
|
+
type: "string",
|
|
5968
|
+
description: "Natural-language focus spanning the target belief neighborhood"
|
|
5969
|
+
},
|
|
5321
5970
|
beliefIds: {
|
|
5322
5971
|
type: "array",
|
|
5323
|
-
description: "
|
|
5972
|
+
description: "Legacy alias for targetBeliefIds"
|
|
5973
|
+
},
|
|
5974
|
+
beliefs: {
|
|
5975
|
+
type: "array",
|
|
5976
|
+
description: "Legacy alias for targetBeliefIds"
|
|
5977
|
+
},
|
|
5978
|
+
targetBeliefIds: {
|
|
5979
|
+
type: "array",
|
|
5980
|
+
description: "Belief node IDs this worktree is expected to test or update"
|
|
5981
|
+
},
|
|
5982
|
+
targetQuestionIds: {
|
|
5983
|
+
type: "array",
|
|
5984
|
+
description: "Question node IDs this worktree is expected to answer"
|
|
5985
|
+
},
|
|
5986
|
+
keyQuestions: {
|
|
5987
|
+
type: "array",
|
|
5988
|
+
description: "Inline key question objects with question, optional status, answer, answerConfidence, and linkedQuestionId"
|
|
5989
|
+
},
|
|
5990
|
+
evidenceSignals: {
|
|
5991
|
+
type: "array",
|
|
5992
|
+
description: "Evidence signal objects with signal, optional collected state, progress, and notes"
|
|
5993
|
+
},
|
|
5994
|
+
decisionGate: {
|
|
5995
|
+
type: "object",
|
|
5996
|
+
description: "Decision gate object with goCriteria, noGoSignals, optional verdict, rationale, decidedAt, and decidedBy"
|
|
5997
|
+
},
|
|
5998
|
+
goCriteria: {
|
|
5999
|
+
type: "array",
|
|
6000
|
+
description: "Shorthand go criteria used to build decisionGate"
|
|
6001
|
+
},
|
|
6002
|
+
noGoSignals: {
|
|
6003
|
+
type: "array",
|
|
6004
|
+
description: "Shorthand no-go signals used to build decisionGate"
|
|
6005
|
+
},
|
|
6006
|
+
proofArtifacts: {
|
|
6007
|
+
type: "array",
|
|
6008
|
+
description: "Expected proof artifacts required to close the worktree"
|
|
5324
6009
|
},
|
|
5325
6010
|
autoShape: {
|
|
5326
6011
|
type: "boolean",
|
|
5327
6012
|
description: "Whether to invoke inquiry auto-shaping during worktree creation"
|
|
5328
6013
|
},
|
|
6014
|
+
autoFixPolicy: {
|
|
6015
|
+
type: "object",
|
|
6016
|
+
description: "Policy for permitted automatic remediation inside the worktree"
|
|
6017
|
+
},
|
|
5329
6018
|
domainPackId: {
|
|
5330
6019
|
type: "string",
|
|
5331
6020
|
description: "Optional domain pack whose shaping hooks should influence generated questions and tasks"
|
|
@@ -5354,9 +6043,17 @@ var ADD_WORKTREE = {
|
|
|
5354
6043
|
type: "array",
|
|
5355
6044
|
description: "Worktree IDs blocked by this worktree"
|
|
5356
6045
|
},
|
|
5357
|
-
|
|
6046
|
+
staffingHint: {
|
|
5358
6047
|
type: "string",
|
|
5359
|
-
description: "
|
|
6048
|
+
description: "Suggested staffing or agent allocation note"
|
|
6049
|
+
},
|
|
6050
|
+
lensId: {
|
|
6051
|
+
type: "string",
|
|
6052
|
+
description: "Lens that scopes this worktree when applicable"
|
|
6053
|
+
},
|
|
6054
|
+
lastReconciledAt: {
|
|
6055
|
+
type: "number",
|
|
6056
|
+
description: "Timestamp when worktree metadata was last reconciled"
|
|
5360
6057
|
}
|
|
5361
6058
|
},
|
|
5362
6059
|
required: ["title", "topicId"],
|
|
@@ -5386,7 +6083,7 @@ var MERGE = {
|
|
|
5386
6083
|
worktreeId: { type: "string", description: "The worktree to merge" },
|
|
5387
6084
|
outcomes: {
|
|
5388
6085
|
type: "array",
|
|
5389
|
-
description: "
|
|
6086
|
+
description: "Merge outcomes as key-finding strings, or scoring outcomes for beliefs: { beliefId, confidence, rationale }"
|
|
5390
6087
|
},
|
|
5391
6088
|
summary: { type: "string", description: "Overall findings summary" }
|
|
5392
6089
|
},
|
|
@@ -5940,6 +6637,74 @@ var GET_GRAPH_STRUCTURE_ANALYSIS = {
|
|
|
5940
6637
|
ontologyPrimitive: "graph",
|
|
5941
6638
|
tier: "showcase"
|
|
5942
6639
|
};
|
|
6640
|
+
var LIST_GRAPH_INTELLIGENCE_QUERIES = {
|
|
6641
|
+
name: "list_graph_intelligence_queries",
|
|
6642
|
+
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.",
|
|
6643
|
+
parameters: {
|
|
6644
|
+
categoryId: {
|
|
6645
|
+
type: "string",
|
|
6646
|
+
description: "Optional category filter, such as problems or strategic"
|
|
6647
|
+
},
|
|
6648
|
+
mode: {
|
|
6649
|
+
type: "string",
|
|
6650
|
+
description: "Optional mode filter: core, bias, stress, operational, alpha, semantic, or evidence"
|
|
6651
|
+
}
|
|
6652
|
+
},
|
|
6653
|
+
required: [],
|
|
6654
|
+
response: {
|
|
6655
|
+
description: "Graph Intelligence query catalog and mode-to-tool mapping",
|
|
6656
|
+
fields: {
|
|
6657
|
+
categories: "array \u2014 query categories",
|
|
6658
|
+
queries: "array \u2014 query definitions with prompt templates and tools",
|
|
6659
|
+
quickQueries: "array \u2014 recommended one-click query presets",
|
|
6660
|
+
publicToolNamesByMode: "object \u2014 public tool names available to each Graph Intelligence mode"
|
|
6661
|
+
}
|
|
6662
|
+
},
|
|
6663
|
+
ownerModule: "graph-intelligence",
|
|
6664
|
+
ontologyPrimitive: "graph",
|
|
6665
|
+
tier: "showcase"
|
|
6666
|
+
};
|
|
6667
|
+
var RUN_GRAPH_INTELLIGENCE_QUERY = {
|
|
6668
|
+
name: "run_graph_intelligence_query",
|
|
6669
|
+
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.",
|
|
6670
|
+
parameters: {
|
|
6671
|
+
topicId: { type: "string", description: "Topic to analyze" },
|
|
6672
|
+
queryId: {
|
|
6673
|
+
type: "string",
|
|
6674
|
+
description: "Graph Intelligence query ID, such as confirmation-bias, pre-mortem, or thesis-summary"
|
|
6675
|
+
},
|
|
6676
|
+
prompt: {
|
|
6677
|
+
type: "string",
|
|
6678
|
+
description: "Optional custom prompt for custom analysis runs"
|
|
6679
|
+
},
|
|
6680
|
+
input: {
|
|
6681
|
+
type: "string",
|
|
6682
|
+
description: "Optional entity, theme, belief, company, or search text for input-driven queries"
|
|
6683
|
+
},
|
|
6684
|
+
mode: {
|
|
6685
|
+
type: "string",
|
|
6686
|
+
description: "Optional mode override: core, bias, stress, operational, alpha, semantic, or evidence"
|
|
6687
|
+
},
|
|
6688
|
+
limit: {
|
|
6689
|
+
type: "number",
|
|
6690
|
+
description: "Maximum graph context rows to return"
|
|
6691
|
+
}
|
|
6692
|
+
},
|
|
6693
|
+
required: ["topicId"],
|
|
6694
|
+
response: {
|
|
6695
|
+
description: "Graph Intelligence query result bundle ready for model or prompt-library synthesis",
|
|
6696
|
+
fields: {
|
|
6697
|
+
query: "object \u2014 selected query definition",
|
|
6698
|
+
prompt: "string \u2014 resolved prompt template",
|
|
6699
|
+
toolPlan: "array \u2014 public tools and args the model can call next",
|
|
6700
|
+
analysis: "object \u2014 structure, coverage, gap, and confirmation-bias analysis",
|
|
6701
|
+
context: "object \u2014 sampled beliefs, questions, evidence, edges, and contradictions"
|
|
6702
|
+
}
|
|
6703
|
+
},
|
|
6704
|
+
ownerModule: "graph-intelligence",
|
|
6705
|
+
ontologyPrimitive: "graph",
|
|
6706
|
+
tier: "showcase"
|
|
6707
|
+
};
|
|
5943
6708
|
var GET_FALSIFICATION_QUESTIONS = {
|
|
5944
6709
|
name: "get_falsification_questions",
|
|
5945
6710
|
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.",
|
|
@@ -8405,22 +9170,85 @@ var GENERATE_SESSION_HANDOFF = {
|
|
|
8405
9170
|
tier: "showcase",
|
|
8406
9171
|
internal: true
|
|
8407
9172
|
};
|
|
8408
|
-
var
|
|
8409
|
-
|
|
8410
|
-
|
|
8411
|
-
|
|
8412
|
-
|
|
8413
|
-
|
|
8414
|
-
|
|
8415
|
-
|
|
8416
|
-
|
|
8417
|
-
|
|
8418
|
-
|
|
8419
|
-
|
|
8420
|
-
|
|
8421
|
-
|
|
8422
|
-
|
|
8423
|
-
|
|
9173
|
+
var BEGIN_BUILD_SESSION = {
|
|
9174
|
+
name: "begin_build_session",
|
|
9175
|
+
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.",
|
|
9176
|
+
parameters: {
|
|
9177
|
+
worktreeId: {
|
|
9178
|
+
type: "string",
|
|
9179
|
+
description: "The Lucern worktree ID to bootstrap."
|
|
9180
|
+
},
|
|
9181
|
+
branch: {
|
|
9182
|
+
type: "string",
|
|
9183
|
+
description: "Optional git branch name. Auto-generated from the worktree name when omitted."
|
|
9184
|
+
},
|
|
9185
|
+
branchBase: {
|
|
9186
|
+
type: "string",
|
|
9187
|
+
description: 'Base branch for the feature branch. Default: "staging".'
|
|
9188
|
+
},
|
|
9189
|
+
prBase: {
|
|
9190
|
+
type: "string",
|
|
9191
|
+
description: 'Target branch for the PR. Default: "staging".'
|
|
9192
|
+
},
|
|
9193
|
+
sessionMode: {
|
|
9194
|
+
type: "string",
|
|
9195
|
+
description: 'Session mode: "async" for Codex/headless or "interactive" for live sessions.',
|
|
9196
|
+
enum: ["async", "interactive"]
|
|
9197
|
+
},
|
|
9198
|
+
activateIfPlanning: {
|
|
9199
|
+
type: "boolean",
|
|
9200
|
+
description: "When true, automatically activate a planning worktree during bootstrap."
|
|
9201
|
+
}
|
|
9202
|
+
},
|
|
9203
|
+
required: ["worktreeId"],
|
|
9204
|
+
response: {
|
|
9205
|
+
description: "A compact build-session packet with worktree metadata, graph anchors, questions, dependencies, and git defaults.",
|
|
9206
|
+
fields: {
|
|
9207
|
+
topicId: "string \u2014 canonical topic scope",
|
|
9208
|
+
topicName: "string \u2014 human-readable topic name",
|
|
9209
|
+
worktreeId: "string \u2014 worktree ID",
|
|
9210
|
+
worktreeName: "string \u2014 human-readable worktree name",
|
|
9211
|
+
branch: "string \u2014 git branch name",
|
|
9212
|
+
branchBase: "string \u2014 base branch",
|
|
9213
|
+
prBase: "string \u2014 PR target branch",
|
|
9214
|
+
campaign: "number | null \u2014 top-level pipeline campaign",
|
|
9215
|
+
lane: "string \u2014 campaign lane",
|
|
9216
|
+
gate: "string \u2014 exit gate",
|
|
9217
|
+
hypothesis: "string \u2014 worktree hypothesis",
|
|
9218
|
+
focus: "string \u2014 session focus",
|
|
9219
|
+
status: "string \u2014 worktree status after optional activation",
|
|
9220
|
+
sessionMode: "string \u2014 async | interactive",
|
|
9221
|
+
targetBeliefIds: "array \u2014 scoped belief IDs",
|
|
9222
|
+
targetQuestionIds: "array \u2014 scoped question IDs",
|
|
9223
|
+
topBeliefs: "array \u2014 highest-confidence scoped beliefs",
|
|
9224
|
+
openQuestions: "array \u2014 open scoped questions",
|
|
9225
|
+
resolvedDecisions: "array \u2014 answered questions summarized for the session",
|
|
9226
|
+
dependencies: "array \u2014 upstream worktrees",
|
|
9227
|
+
unblocks: "array \u2014 downstream worktrees",
|
|
9228
|
+
mergeOrderNotes: "string \u2014 merge ordering advisory"
|
|
9229
|
+
}
|
|
9230
|
+
},
|
|
9231
|
+
ownerModule: "bootstrap",
|
|
9232
|
+
ontologyPrimitive: "worktree",
|
|
9233
|
+
tier: "showcase",
|
|
9234
|
+
internal: true
|
|
9235
|
+
};
|
|
9236
|
+
var MCP_TOOL_CONTRACTS = {
|
|
9237
|
+
// Belief lifecycle (commit, amend, fork, archive)
|
|
9238
|
+
create_belief: CREATE_BELIEF,
|
|
9239
|
+
get_belief: GET_BELIEF,
|
|
9240
|
+
refine_belief: REFINE_BELIEF,
|
|
9241
|
+
modulate_confidence: MODULATE_CONFIDENCE,
|
|
9242
|
+
fork_belief: FORK_BELIEF,
|
|
9243
|
+
archive_belief: ARCHIVE_BELIEF,
|
|
9244
|
+
create_epistemic_contract: CREATE_EPISTEMIC_CONTRACT,
|
|
9245
|
+
evaluate_contract: EVALUATE_CONTRACT,
|
|
9246
|
+
get_contract_status: GET_CONTRACT_STATUS,
|
|
9247
|
+
// Evidence (commit)
|
|
9248
|
+
create_evidence: CREATE_EVIDENCE,
|
|
9249
|
+
get_evidence: GET_EVIDENCE,
|
|
9250
|
+
list_evidence: LIST_EVIDENCE,
|
|
9251
|
+
link_evidence: LINK_EVIDENCE,
|
|
8424
9252
|
add_evidence: ADD_EVIDENCE,
|
|
8425
9253
|
// Contradictions (merge conflict)
|
|
8426
9254
|
flag_contradiction: FLAG_CONTRADICTION,
|
|
@@ -8452,6 +9280,8 @@ var MCP_TOOL_CONTRACTS = {
|
|
|
8452
9280
|
// Graph intelligence (showcase)
|
|
8453
9281
|
detect_confirmation_bias: DETECT_CONFIRMATION_BIAS,
|
|
8454
9282
|
get_graph_structure_analysis: GET_GRAPH_STRUCTURE_ANALYSIS,
|
|
9283
|
+
list_graph_intelligence_queries: LIST_GRAPH_INTELLIGENCE_QUERIES,
|
|
9284
|
+
run_graph_intelligence_query: RUN_GRAPH_INTELLIGENCE_QUERY,
|
|
8455
9285
|
get_falsification_questions: GET_FALSIFICATION_QUESTIONS,
|
|
8456
9286
|
// Evidence operations (workhorse)
|
|
8457
9287
|
search_evidence: SEARCH_EVIDENCE,
|
|
@@ -8498,6 +9328,7 @@ var MCP_TOOL_CONTRACTS = {
|
|
|
8498
9328
|
get_agent_inbox: GET_AGENT_INBOX,
|
|
8499
9329
|
claim_files: CLAIM_FILES,
|
|
8500
9330
|
generate_session_handoff: GENERATE_SESSION_HANDOFF,
|
|
9331
|
+
begin_build_session: BEGIN_BUILD_SESSION,
|
|
8501
9332
|
// Policy / ACL (workhorse)
|
|
8502
9333
|
check_permission: CHECK_PERMISSION,
|
|
8503
9334
|
filter_by_permission: FILTER_BY_PERMISSION,
|
|
@@ -8633,6 +9464,8 @@ var MCP_ANALYSIS_PLATFORM_OPERATION_NAMES = [
|
|
|
8633
9464
|
"traverse_graph",
|
|
8634
9465
|
"get_graph_neighborhood",
|
|
8635
9466
|
"get_graph_structure_analysis",
|
|
9467
|
+
"list_graph_intelligence_queries",
|
|
9468
|
+
"run_graph_intelligence_query",
|
|
8636
9469
|
"find_contradictions",
|
|
8637
9470
|
"flag_contradiction",
|
|
8638
9471
|
"detect_confirmation_bias",
|
|
@@ -8711,6 +9544,7 @@ var PLATFORM_INTERNAL_OPERATION_NAMES = [
|
|
|
8711
9544
|
"get_change_history",
|
|
8712
9545
|
"get_failure_log",
|
|
8713
9546
|
"record_attempt",
|
|
9547
|
+
"begin_build_session",
|
|
8714
9548
|
"push",
|
|
8715
9549
|
"open_pull_request",
|
|
8716
9550
|
"record_judgment",
|
|
@@ -8765,7 +9599,6 @@ var SDK_ONLY_OPERATION_NAMES = [
|
|
|
8765
9599
|
"find_semantic_orphans"
|
|
8766
9600
|
];
|
|
8767
9601
|
var MCP_ONLY_INTERNAL_OPERATION_NAMES = [
|
|
8768
|
-
"begin_build_session",
|
|
8769
9602
|
"evaluate_engineering_contract",
|
|
8770
9603
|
"evaluate_research_contract"
|
|
8771
9604
|
];
|
|
@@ -9151,8 +9984,31 @@ function assertSurfaceCoverage(contracts) {
|
|
|
9151
9984
|
}
|
|
9152
9985
|
}
|
|
9153
9986
|
}
|
|
9154
|
-
|
|
9155
|
-
|
|
9987
|
+
var jsonRecordSchema2 = z.record(z.unknown());
|
|
9988
|
+
var observationArgs = z.object({
|
|
9989
|
+
topicId: z.string().optional().describe("Topic scope for the observation."),
|
|
9990
|
+
summary: z.string().describe("Short observation summary."),
|
|
9991
|
+
text: z.string().optional().describe("Canonical observation text alias."),
|
|
9992
|
+
title: z.string().optional().describe("Optional observation title."),
|
|
9993
|
+
content: z.string().optional().describe("Optional rich observation content."),
|
|
9994
|
+
contentType: z.string().optional().describe("Observation content type."),
|
|
9995
|
+
kind: z.string().optional().describe("Evidence kind to store."),
|
|
9996
|
+
observationType: z.string().optional().describe("Observation type."),
|
|
9997
|
+
tags: z.array(z.string()).optional().describe("Observation tags."),
|
|
9998
|
+
source: z.string().optional().describe("Observation source label."),
|
|
9999
|
+
sourceType: z.string().optional().describe("Evidence source type."),
|
|
10000
|
+
externalSourceType: z.string().optional().describe("External source type for imported observations."),
|
|
10001
|
+
sourceUrl: z.string().optional().describe("Canonical source URL."),
|
|
10002
|
+
confidence: z.number().optional().describe("Observation confidence."),
|
|
10003
|
+
metadata: jsonRecordSchema2.optional().describe("Observation metadata."),
|
|
10004
|
+
rationale: z.string().optional().describe("Why this observation should be recorded.")
|
|
10005
|
+
});
|
|
10006
|
+
var observationContextArgs = z.object({
|
|
10007
|
+
topicId: z.string().describe("Topic scope."),
|
|
10008
|
+
query: z.string().optional().describe("Optional context query."),
|
|
10009
|
+
limit: z.number().optional().describe("Maximum observations to return."),
|
|
10010
|
+
status: z.string().optional().describe("Observation status filter.")
|
|
10011
|
+
});
|
|
9156
10012
|
var observationInput = (input, context) => withUserId(
|
|
9157
10013
|
compactRecord4({
|
|
9158
10014
|
projectId: input.projectId,
|
|
@@ -9211,7 +10067,8 @@ var contextContracts = [
|
|
|
9211
10067
|
observationId: output && typeof output === "object" ? output.nodeId : void 0,
|
|
9212
10068
|
observationType: input.observationType
|
|
9213
10069
|
})
|
|
9214
|
-
}
|
|
10070
|
+
},
|
|
10071
|
+
args: observationArgs
|
|
9215
10072
|
}),
|
|
9216
10073
|
surfaceContract({
|
|
9217
10074
|
name: "get_observation_context",
|
|
@@ -9232,7 +10089,8 @@ var contextContracts = [
|
|
|
9232
10089
|
status: input.status,
|
|
9233
10090
|
userId: input.userId
|
|
9234
10091
|
})
|
|
9235
|
-
}
|
|
10092
|
+
},
|
|
10093
|
+
args: observationContextArgs
|
|
9236
10094
|
})
|
|
9237
10095
|
];
|
|
9238
10096
|
|
|
@@ -9295,8 +10153,45 @@ var identityContracts = [
|
|
|
9295
10153
|
}
|
|
9296
10154
|
})
|
|
9297
10155
|
];
|
|
9298
|
-
|
|
9299
|
-
|
|
10156
|
+
var jsonRecordSchema3 = z.record(z.unknown());
|
|
10157
|
+
var sourceTypeSchema = z.enum(["human", "ai_extracted", "ai_generated"]);
|
|
10158
|
+
var reversibilitySchema = z.enum([
|
|
10159
|
+
"irreversible",
|
|
10160
|
+
"hard_to_reverse",
|
|
10161
|
+
"reversible",
|
|
10162
|
+
"trivial"
|
|
10163
|
+
]);
|
|
10164
|
+
var predictionMetaSchema = z.object({
|
|
10165
|
+
isPrediction: z.boolean().describe("Whether this belief is a prediction."),
|
|
10166
|
+
registeredAt: z.number().describe("Timestamp when the prediction was registered."),
|
|
10167
|
+
expectedBy: z.number().optional().describe("Timestamp when the prediction should be evaluated.")
|
|
10168
|
+
});
|
|
10169
|
+
var createBeliefArgs = z.object({
|
|
10170
|
+
canonicalText: z.string().describe("The belief statement the agent holds to be true."),
|
|
10171
|
+
topicId: z.string().optional().describe("Topic scope hint for the belief."),
|
|
10172
|
+
baseRate: z.number().optional().describe("Prior base rate used to seed the vacuous opinion."),
|
|
10173
|
+
beliefType: z.string().optional().describe("Schema belief type."),
|
|
10174
|
+
metadata: jsonRecordSchema3.optional().describe("Extra metadata merged into the belief node."),
|
|
10175
|
+
rationale: z.string().optional().describe("Why this belief should enter the reasoning graph."),
|
|
10176
|
+
pillar: z.string().optional().describe("Innovation pillar or product pillar associated with the belief."),
|
|
10177
|
+
worktreeId: z.string().optional().describe("Worktree responsible for creating or testing this belief."),
|
|
10178
|
+
sourceBeliefIds: z.array(z.string()).optional().describe("Source belief IDs this belief derives from."),
|
|
10179
|
+
sourceType: sourceTypeSchema.optional().describe("Actor/source class that produced the belief."),
|
|
10180
|
+
reversibility: reversibilitySchema.optional().describe("How reversible the belief's implied decision is."),
|
|
10181
|
+
predictionMeta: predictionMetaSchema.optional().describe("Prediction lifecycle metadata when this belief is a forecast.")
|
|
10182
|
+
});
|
|
10183
|
+
var forkBeliefArgs = z.object({
|
|
10184
|
+
nodeId: z.string().describe("The scored belief to fork from."),
|
|
10185
|
+
newFormulation: z.string().describe("The evolved belief statement."),
|
|
10186
|
+
forkReason: z.enum([
|
|
10187
|
+
"refinement",
|
|
10188
|
+
"contradiction_response",
|
|
10189
|
+
"scope_change",
|
|
10190
|
+
"confidence_collapse",
|
|
10191
|
+
"manual"
|
|
10192
|
+
]).describe("Why this fork was created."),
|
|
10193
|
+
rationale: z.string().optional().describe("Why the fork is warranted.")
|
|
10194
|
+
});
|
|
9300
10195
|
var beliefLookupInput = (input) => compactRecord4({
|
|
9301
10196
|
nodeId: input.nodeId ?? input.id ?? input.beliefId,
|
|
9302
10197
|
beliefId: input.beliefId
|
|
@@ -9371,7 +10266,8 @@ var beliefsContracts = [
|
|
|
9371
10266
|
functionName: "create",
|
|
9372
10267
|
kind: "mutation",
|
|
9373
10268
|
inputProjection: createBeliefInput
|
|
9374
|
-
}
|
|
10269
|
+
},
|
|
10270
|
+
args: createBeliefArgs
|
|
9375
10271
|
}),
|
|
9376
10272
|
surfaceContract({
|
|
9377
10273
|
name: "get_belief",
|
|
@@ -9462,7 +10358,8 @@ var beliefsContracts = [
|
|
|
9462
10358
|
functionName: "forkBelief",
|
|
9463
10359
|
kind: "mutation",
|
|
9464
10360
|
inputProjection: forkBeliefInput
|
|
9465
|
-
}
|
|
10361
|
+
},
|
|
10362
|
+
args: forkBeliefArgs
|
|
9466
10363
|
}),
|
|
9467
10364
|
surfaceContract({
|
|
9468
10365
|
name: "archive_belief",
|
|
@@ -9543,8 +10440,46 @@ var beliefsContracts = [
|
|
|
9543
10440
|
}
|
|
9544
10441
|
})
|
|
9545
10442
|
];
|
|
9546
|
-
|
|
9547
|
-
|
|
10443
|
+
var jsonRecordSchema4 = z.record(z.unknown());
|
|
10444
|
+
var evidenceRelationSchema = z.enum(["supports", "contradicts", "neutral"]);
|
|
10445
|
+
var createEvidenceArgs = z.object({
|
|
10446
|
+
topicId: z.string().optional().describe("Topic scope for the evidence."),
|
|
10447
|
+
text: z.string().describe("Canonical evidence text."),
|
|
10448
|
+
source: z.string().optional().describe("Source URL or source label."),
|
|
10449
|
+
sourceUrl: z.string().optional().describe("Canonical source URL."),
|
|
10450
|
+
targetId: z.string().optional().describe("Belief or question identifier to link immediately."),
|
|
10451
|
+
linkedBeliefNodeId: z.string().optional().describe("Belief node this evidence bears on."),
|
|
10452
|
+
evidenceRelation: evidenceRelationSchema.optional().describe("How the evidence relates to the linked belief."),
|
|
10453
|
+
confidence: z.number().optional().describe("Confidence in the evidence relation."),
|
|
10454
|
+
weight: z.number().optional().describe("Support weight from -1.0 to +1.0."),
|
|
10455
|
+
metadata: jsonRecordSchema4.optional().describe("Metadata merged into the canonical evidence node."),
|
|
10456
|
+
rationale: z.string().describe("Why this evidence should enter the reasoning graph."),
|
|
10457
|
+
reasoning: z.string().optional().describe("Reasoning note preserved in evidence metadata."),
|
|
10458
|
+
title: z.string().optional().describe("Optional short title."),
|
|
10459
|
+
content: z.string().optional().describe("Optional long-form content."),
|
|
10460
|
+
contentType: z.string().optional().describe("Content format or MIME hint."),
|
|
10461
|
+
kind: z.string().optional().describe("Evidence kind."),
|
|
10462
|
+
tags: z.array(z.string()).optional().describe("Evidence tags."),
|
|
10463
|
+
sourceType: z.string().optional().describe("Evidence source type."),
|
|
10464
|
+
externalSourceType: z.string().optional().describe("External source type for imported evidence."),
|
|
10465
|
+
sourceQuestionId: z.string().optional().describe("Question that sourced this evidence."),
|
|
10466
|
+
methodology: z.string().optional().describe("Collection methodology."),
|
|
10467
|
+
informationAsymmetry: z.string().optional().describe("Information asymmetry class."),
|
|
10468
|
+
sourceDescription: z.string().optional().describe("Human-readable source description.")
|
|
10469
|
+
});
|
|
10470
|
+
var addEvidenceArgs = z.object({
|
|
10471
|
+
canonicalText: z.string().describe("The evidence statement."),
|
|
10472
|
+
text: z.string().optional().describe("Canonical evidence text alias used by newer callers."),
|
|
10473
|
+
topicId: z.string().optional().describe("Topic scope hint."),
|
|
10474
|
+
sourceUrl: z.string().optional().describe("URL of the source material."),
|
|
10475
|
+
targetNodeId: z.string().describe("The belief this evidence bears on."),
|
|
10476
|
+
weight: z.number().optional().describe("Support weight from -1.0 to +1.0."),
|
|
10477
|
+
reasoning: z.string().describe("Why this evidence is relevant to the target belief."),
|
|
10478
|
+
title: z.string().optional().describe("Optional short title."),
|
|
10479
|
+
content: z.string().optional().describe("Optional long-form evidence content."),
|
|
10480
|
+
contentType: z.string().optional().describe("Content format or MIME hint."),
|
|
10481
|
+
metadata: jsonRecordSchema4.optional().describe("Optional metadata merged into the evidence node.")
|
|
10482
|
+
});
|
|
9548
10483
|
var evidenceIdInput = (input) => compactRecord4({
|
|
9549
10484
|
evidenceId: input.evidenceId,
|
|
9550
10485
|
insightId: input.insightId,
|
|
@@ -9619,7 +10554,8 @@ var evidenceContracts = [
|
|
|
9619
10554
|
functionName: "create",
|
|
9620
10555
|
kind: "mutation",
|
|
9621
10556
|
inputProjection: createEvidenceInput
|
|
9622
|
-
}
|
|
10557
|
+
},
|
|
10558
|
+
args: createEvidenceArgs
|
|
9623
10559
|
}),
|
|
9624
10560
|
surfaceContract({
|
|
9625
10561
|
name: "add_evidence",
|
|
@@ -9655,7 +10591,8 @@ var evidenceContracts = [
|
|
|
9655
10591
|
context
|
|
9656
10592
|
);
|
|
9657
10593
|
}
|
|
9658
|
-
}
|
|
10594
|
+
},
|
|
10595
|
+
args: addEvidenceArgs
|
|
9659
10596
|
}),
|
|
9660
10597
|
surfaceContract({
|
|
9661
10598
|
name: "get_evidence",
|
|
@@ -9762,8 +10699,91 @@ var evidenceContracts = [
|
|
|
9762
10699
|
}
|
|
9763
10700
|
})
|
|
9764
10701
|
];
|
|
9765
|
-
|
|
9766
|
-
|
|
10702
|
+
var jsonRecordSchema5 = z.record(z.unknown());
|
|
10703
|
+
var questionPrioritySchema = z.enum(["urgent", "high", "medium", "low"]);
|
|
10704
|
+
var kernelQuestionPrioritySchema = z.enum([
|
|
10705
|
+
"critical",
|
|
10706
|
+
"high",
|
|
10707
|
+
"medium",
|
|
10708
|
+
"low"
|
|
10709
|
+
]);
|
|
10710
|
+
var questionTypeSchema = z.enum([
|
|
10711
|
+
"validation",
|
|
10712
|
+
"falsification",
|
|
10713
|
+
"assumption_probe",
|
|
10714
|
+
"prediction_test",
|
|
10715
|
+
"counterfactual",
|
|
10716
|
+
"discovery",
|
|
10717
|
+
"clarification",
|
|
10718
|
+
"comparison",
|
|
10719
|
+
"causal",
|
|
10720
|
+
"mechanism",
|
|
10721
|
+
"general"
|
|
10722
|
+
]);
|
|
10723
|
+
var createQuestionArgs = z.object({
|
|
10724
|
+
text: z.string().describe("The question text."),
|
|
10725
|
+
question: z.string().optional().describe("Backend question text alias for kernel-native callers."),
|
|
10726
|
+
topicId: z.string().optional().describe("Topic scope hint."),
|
|
10727
|
+
priority: questionPrioritySchema.optional().describe("Human-facing question priority."),
|
|
10728
|
+
linkedBeliefId: z.string().optional().describe("Belief this question tests."),
|
|
10729
|
+
linkedBeliefNodeId: z.string().optional().describe("Belief node this question tests."),
|
|
10730
|
+
metadata: jsonRecordSchema5.optional().describe("Optional metadata merged into the question record."),
|
|
10731
|
+
category: z.string().optional().describe("Question category."),
|
|
10732
|
+
source: z.string().optional().describe("Question source."),
|
|
10733
|
+
testType: z.enum(["validates", "invalidates", "clarifies"]).optional().describe("How this question tests its linked belief."),
|
|
10734
|
+
importance: z.number().optional().describe("Numeric importance score."),
|
|
10735
|
+
epistemicUnlock: z.string().optional().describe("What this question unlocks if answered."),
|
|
10736
|
+
sourceQuestionIds: z.array(z.string()).optional().describe("Question IDs this question derives from."),
|
|
10737
|
+
linkedWorktreeId: z.string().optional().describe("Worktree this question belongs to."),
|
|
10738
|
+
questionType: questionTypeSchema.optional().describe("Question type."),
|
|
10739
|
+
questionPriority: kernelQuestionPrioritySchema.optional().describe("Kernel-native question priority.")
|
|
10740
|
+
});
|
|
10741
|
+
var refineQuestionArgs = z.object({
|
|
10742
|
+
id: z.string().describe("The question to refine."),
|
|
10743
|
+
text: z.string().describe("Updated question text."),
|
|
10744
|
+
question: z.string().optional().describe("Backend question text alias for kernel-native callers."),
|
|
10745
|
+
rationale: z.string().optional().describe("Why the question is refined."),
|
|
10746
|
+
category: z.string().optional().describe("Updated question category."),
|
|
10747
|
+
priority: questionPrioritySchema.optional().describe("Updated human-facing priority.")
|
|
10748
|
+
});
|
|
10749
|
+
var createAnswerArgs = z.object({
|
|
10750
|
+
questionNodeId: z.string().describe("The question node ID this answer responds to."),
|
|
10751
|
+
questionId: z.string().optional().describe("Question ID alias accepted by the projection."),
|
|
10752
|
+
answerText: z.string().describe("The answer content."),
|
|
10753
|
+
topicId: z.string().optional().describe("Topic scope for the answer."),
|
|
10754
|
+
confidence: z.string().optional().describe("Answer confidence."),
|
|
10755
|
+
evidenceNodeIds: z.array(z.string()).optional().describe("Evidence node IDs supporting the answer."),
|
|
10756
|
+
answerSource: z.string().optional().describe("How the answer was produced."),
|
|
10757
|
+
worktreeId: z.string().optional().describe("Worktree whose outcome produced this answer."),
|
|
10758
|
+
sprintId: z.string().optional().describe("Legacy sprint identifier.")
|
|
10759
|
+
});
|
|
10760
|
+
var answerQuestionArgs = z.object({
|
|
10761
|
+
id: z.string().describe("Canonical question ID."),
|
|
10762
|
+
topicId: z.string().describe("Topic scope for the answer."),
|
|
10763
|
+
text: z.string().describe("Answer text."),
|
|
10764
|
+
confidence: z.enum(["weak", "medium", "strong"]).optional().describe("Optional answer confidence."),
|
|
10765
|
+
evidenceIds: z.array(z.string()).optional().describe("Canonical evidence IDs supporting the answer."),
|
|
10766
|
+
rationale: z.string().optional().describe("Why this answer is credible."),
|
|
10767
|
+
questionId: z.string().optional().describe("Question ID alias accepted by the projection."),
|
|
10768
|
+
questionNodeId: z.string().optional().describe("Question node ID alias accepted by the projection."),
|
|
10769
|
+
answerText: z.string().optional().describe("Canonical answer text alias accepted by newer callers."),
|
|
10770
|
+
evidenceNodeIds: z.array(z.string()).optional().describe("Evidence node ID alias accepted by newer callers."),
|
|
10771
|
+
answerSource: z.string().optional().describe("How the answer was produced."),
|
|
10772
|
+
worktreeId: z.string().optional().describe("Worktree whose outcome produced this answer."),
|
|
10773
|
+
sprintId: z.string().optional().describe("Legacy sprint identifier.")
|
|
10774
|
+
});
|
|
10775
|
+
var missingQuestionsArgs = z.object({
|
|
10776
|
+
topicId: z.string().describe("Topic scope."),
|
|
10777
|
+
minConfidence: z.number().optional().describe("Minimum confidence threshold for missing-question checks."),
|
|
10778
|
+
status: z.string().optional().describe("Question status filter."),
|
|
10779
|
+
limit: z.number().optional().describe("Maximum questions to inspect.")
|
|
10780
|
+
});
|
|
10781
|
+
var falsificationQuestionsArgs = z.object({
|
|
10782
|
+
topicId: z.string().describe("Topic scope."),
|
|
10783
|
+
beliefIds: z.array(z.string()).optional().describe("Beliefs to generate falsification questions for."),
|
|
10784
|
+
status: z.string().optional().describe("Question status filter."),
|
|
10785
|
+
limit: z.number().optional().describe("Maximum questions to inspect.")
|
|
10786
|
+
});
|
|
9767
10787
|
var questionNodeInput = (input) => compactRecord4({
|
|
9768
10788
|
nodeId: input.nodeId ?? input.id ?? input.questionId,
|
|
9769
10789
|
questionId: input.questionId
|
|
@@ -9810,7 +10830,8 @@ var questionsContracts = [
|
|
|
9810
10830
|
functionName: "create",
|
|
9811
10831
|
kind: "mutation",
|
|
9812
10832
|
inputProjection: createQuestionInput
|
|
9813
|
-
}
|
|
10833
|
+
},
|
|
10834
|
+
args: createQuestionArgs
|
|
9814
10835
|
}),
|
|
9815
10836
|
surfaceContract({
|
|
9816
10837
|
name: "get_question",
|
|
@@ -9866,7 +10887,8 @@ var questionsContracts = [
|
|
|
9866
10887
|
category: input.category,
|
|
9867
10888
|
priority: input.priority
|
|
9868
10889
|
})
|
|
9869
|
-
}
|
|
10890
|
+
},
|
|
10891
|
+
args: refineQuestionArgs
|
|
9870
10892
|
}),
|
|
9871
10893
|
surfaceContract({
|
|
9872
10894
|
name: "update_question_status",
|
|
@@ -9942,7 +10964,8 @@ var questionsContracts = [
|
|
|
9942
10964
|
}),
|
|
9943
10965
|
context
|
|
9944
10966
|
)
|
|
9945
|
-
}
|
|
10967
|
+
},
|
|
10968
|
+
args: createAnswerArgs
|
|
9946
10969
|
}),
|
|
9947
10970
|
surfaceContract({
|
|
9948
10971
|
name: "answer_question",
|
|
@@ -9971,7 +10994,8 @@ var questionsContracts = [
|
|
|
9971
10994
|
}),
|
|
9972
10995
|
context
|
|
9973
10996
|
)
|
|
9974
|
-
}
|
|
10997
|
+
},
|
|
10998
|
+
args: answerQuestionArgs
|
|
9975
10999
|
}),
|
|
9976
11000
|
surfaceContract({
|
|
9977
11001
|
name: "get_answer",
|
|
@@ -10003,7 +11027,8 @@ var questionsContracts = [
|
|
|
10003
11027
|
functionName: "getByTopic",
|
|
10004
11028
|
kind: "query",
|
|
10005
11029
|
inputProjection: questionTopicInput
|
|
10006
|
-
}
|
|
11030
|
+
},
|
|
11031
|
+
args: missingQuestionsArgs
|
|
10007
11032
|
}),
|
|
10008
11033
|
surfaceContract({
|
|
10009
11034
|
name: "get_high_priority_questions",
|
|
@@ -10038,11 +11063,22 @@ var questionsContracts = [
|
|
|
10038
11063
|
functionName: "getByTopic",
|
|
10039
11064
|
kind: "query",
|
|
10040
11065
|
inputProjection: questionTopicInput
|
|
10041
|
-
}
|
|
11066
|
+
},
|
|
11067
|
+
args: falsificationQuestionsArgs
|
|
10042
11068
|
})
|
|
10043
11069
|
];
|
|
10044
|
-
|
|
10045
|
-
|
|
11070
|
+
var updateTopicArgs = z.object({
|
|
11071
|
+
id: z.string().describe("Topic ID."),
|
|
11072
|
+
topicId: z.string().optional().describe("Topic ID alias."),
|
|
11073
|
+
name: z.string().optional().describe("Topic name."),
|
|
11074
|
+
description: z.string().optional().describe("Topic description."),
|
|
11075
|
+
type: z.string().optional().describe("Topic type."),
|
|
11076
|
+
status: z.string().optional().describe("Topic status."),
|
|
11077
|
+
visibility: z.string().optional().describe("Topic visibility."),
|
|
11078
|
+
ontologyId: z.string().optional().describe("Ontology to bind."),
|
|
11079
|
+
clearOntologyId: z.boolean().optional().describe("Whether to clear the ontology binding."),
|
|
11080
|
+
metadata: z.record(z.unknown()).optional().describe("Topic metadata.")
|
|
11081
|
+
});
|
|
10046
11082
|
var topicIdInput = (input) => compactRecord4({
|
|
10047
11083
|
id: input.id ?? input.topicId
|
|
10048
11084
|
});
|
|
@@ -10123,7 +11159,8 @@ var topicsContracts = [
|
|
|
10123
11159
|
functionName: "update",
|
|
10124
11160
|
kind: "mutation",
|
|
10125
11161
|
inputProjection: updateTopicInput
|
|
10126
|
-
}
|
|
11162
|
+
},
|
|
11163
|
+
args: updateTopicArgs
|
|
10127
11164
|
}),
|
|
10128
11165
|
surfaceContract({
|
|
10129
11166
|
name: "get_topic_tree",
|
|
@@ -10142,8 +11179,27 @@ var topicsContracts = [
|
|
|
10142
11179
|
}
|
|
10143
11180
|
})
|
|
10144
11181
|
];
|
|
10145
|
-
|
|
10146
|
-
|
|
11182
|
+
var lensPerspectiveSchema = z.enum([
|
|
11183
|
+
"investigation",
|
|
11184
|
+
"monitoring",
|
|
11185
|
+
"analysis",
|
|
11186
|
+
"comparison",
|
|
11187
|
+
"taxonomy"
|
|
11188
|
+
]);
|
|
11189
|
+
var jsonRecordSchema6 = z.record(z.unknown());
|
|
11190
|
+
var createLensArgs = z.object({
|
|
11191
|
+
name: z.string().describe("Lens name."),
|
|
11192
|
+
workspaceId: z.string().optional().describe("Workspace scope for the lens."),
|
|
11193
|
+
topicId: z.string().optional().describe("Originating topic scope."),
|
|
11194
|
+
description: z.string().optional().describe("What this lens investigates or monitors."),
|
|
11195
|
+
perspectiveType: lensPerspectiveSchema.describe("Perspective type."),
|
|
11196
|
+
promptTemplates: z.array(jsonRecordSchema6).optional().describe("Prompt templates used through this lens."),
|
|
11197
|
+
workflowTemplates: z.array(jsonRecordSchema6).optional().describe("Guided workflow templates."),
|
|
11198
|
+
taskTemplates: z.array(jsonRecordSchema6).optional().describe("Default task templates."),
|
|
11199
|
+
questionTemplates: z.array(jsonRecordSchema6).optional().describe("Default question templates."),
|
|
11200
|
+
filterCriteria: jsonRecordSchema6.optional().describe("Belief/evidence filtering criteria."),
|
|
11201
|
+
metadata: jsonRecordSchema6.optional().describe("Additional lens metadata.")
|
|
11202
|
+
});
|
|
10147
11203
|
var createLensInput = (input, context) => compactRecord4({
|
|
10148
11204
|
name: input.name,
|
|
10149
11205
|
description: input.description,
|
|
@@ -10180,7 +11236,8 @@ var lensesContracts = [
|
|
|
10180
11236
|
functionName: "create",
|
|
10181
11237
|
kind: "mutation",
|
|
10182
11238
|
inputProjection: createLensInput
|
|
10183
|
-
}
|
|
11239
|
+
},
|
|
11240
|
+
args: createLensArgs
|
|
10184
11241
|
}),
|
|
10185
11242
|
surfaceContract({
|
|
10186
11243
|
name: "list_lenses",
|
|
@@ -10242,8 +11299,18 @@ var lensesContracts = [
|
|
|
10242
11299
|
}
|
|
10243
11300
|
})
|
|
10244
11301
|
];
|
|
10245
|
-
|
|
10246
|
-
|
|
11302
|
+
var updateOntologyArgs = z.object({
|
|
11303
|
+
id: z.string().describe("Ontology definition ID."),
|
|
11304
|
+
ontologyId: z.string().optional().describe("Ontology ID alias."),
|
|
11305
|
+
name: z.string().optional().describe("Ontology display name."),
|
|
11306
|
+
description: z.string().optional().describe("Ontology description."),
|
|
11307
|
+
status: z.string().optional().describe("Ontology lifecycle status.")
|
|
11308
|
+
});
|
|
11309
|
+
var ontologyVersionLifecycleArgs = z.object({
|
|
11310
|
+
id: z.string().describe("Ontology version ID."),
|
|
11311
|
+
versionId: z.string().optional().describe("Ontology version ID alias."),
|
|
11312
|
+
ontologyId: z.string().optional().describe("Ontology definition ID.")
|
|
11313
|
+
});
|
|
10247
11314
|
var ontologyIdInput = (input) => compactRecord4({
|
|
10248
11315
|
id: input.id ?? input.ontologyId
|
|
10249
11316
|
});
|
|
@@ -10322,11 +11389,11 @@ var ontologiesContracts = [
|
|
|
10322
11389
|
id: input.id ?? input.ontologyId,
|
|
10323
11390
|
name: input.name,
|
|
10324
11391
|
description: input.description,
|
|
10325
|
-
parentOntologyId: input.parentOntologyId,
|
|
10326
11392
|
status: input.status,
|
|
10327
11393
|
actorId: input.actorId
|
|
10328
11394
|
})
|
|
10329
|
-
}
|
|
11395
|
+
},
|
|
11396
|
+
args: updateOntologyArgs
|
|
10330
11397
|
}),
|
|
10331
11398
|
surfaceContract({
|
|
10332
11399
|
name: "archive_ontology",
|
|
@@ -10409,7 +11476,8 @@ var ontologiesContracts = [
|
|
|
10409
11476
|
functionName: "publishOntologyVersion",
|
|
10410
11477
|
kind: "mutation",
|
|
10411
11478
|
inputProjection: ontologyVersionIdInput
|
|
10412
|
-
}
|
|
11479
|
+
},
|
|
11480
|
+
args: ontologyVersionLifecycleArgs
|
|
10413
11481
|
}),
|
|
10414
11482
|
surfaceContract({
|
|
10415
11483
|
name: "deprecate_ontology_version",
|
|
@@ -10425,7 +11493,8 @@ var ontologiesContracts = [
|
|
|
10425
11493
|
functionName: "deprecateOntologyVersion",
|
|
10426
11494
|
kind: "mutation",
|
|
10427
11495
|
inputProjection: ontologyVersionIdInput
|
|
10428
|
-
}
|
|
11496
|
+
},
|
|
11497
|
+
args: ontologyVersionLifecycleArgs
|
|
10429
11498
|
}),
|
|
10430
11499
|
surfaceContract({
|
|
10431
11500
|
name: "resolve_effective_ontology",
|
|
@@ -10444,8 +11513,76 @@ var ontologiesContracts = [
|
|
|
10444
11513
|
}
|
|
10445
11514
|
})
|
|
10446
11515
|
];
|
|
10447
|
-
|
|
10448
|
-
|
|
11516
|
+
var autoFixPolicyInputSchema = z.object({
|
|
11517
|
+
enabled: z.boolean().optional().describe("Whether automatic remediation is enabled."),
|
|
11518
|
+
mode: z.string().optional().describe("Automation mode for worktree auto-fixes."),
|
|
11519
|
+
maxAttempts: z.number().optional().describe("Maximum number of auto-fix attempts."),
|
|
11520
|
+
reviewer: z.string().optional().describe("Reviewer responsible for auto-fix oversight."),
|
|
11521
|
+
maxActionsPerRun: z.number().optional().describe("Maximum number of auto-fix actions per run."),
|
|
11522
|
+
permittedMutationTiers: z.array(z.enum(["read_only", "low_risk_write", "high_risk_write"])).optional().describe("Mutation tiers the auto-fix worker may execute."),
|
|
11523
|
+
requireAuditTrail: z.boolean().optional().describe("Whether auto-fix actions must write an audit trail."),
|
|
11524
|
+
escalationGate: z.string().optional().describe("Gate to trigger when auto-fix policy requires escalation.")
|
|
11525
|
+
}).passthrough().describe("Policy for permitted automatic remediation inside the worktree.");
|
|
11526
|
+
var worktreeKeyQuestionInputSchema = z.object({
|
|
11527
|
+
question: z.string().describe("Question the worktree must resolve."),
|
|
11528
|
+
status: z.enum(["open", "answered", "forked"]).optional().describe("Current disposition of the key question."),
|
|
11529
|
+
answer: z.string().optional().describe("Captured answer when the key question is resolved."),
|
|
11530
|
+
answerConfidence: z.enum(["high", "medium", "low"]).optional().describe("Confidence in the captured answer."),
|
|
11531
|
+
linkedQuestionId: z.string().optional().describe("Canonical question node linked to this key question.")
|
|
11532
|
+
}).passthrough().describe("Question contract embedded in the worktree plan.");
|
|
11533
|
+
var worktreeEvidenceSignalInputSchema = z.object({
|
|
11534
|
+
signal: z.string().describe("Evidence signal the worktree should collect."),
|
|
11535
|
+
collected: z.boolean().optional().describe("Whether the signal has already been collected."),
|
|
11536
|
+
progress: z.string().optional().describe("Collection progress note for the signal."),
|
|
11537
|
+
notes: z.string().optional().describe("Additional evidence collection notes.")
|
|
11538
|
+
}).passthrough().describe("Evidence signal embedded in the worktree plan.");
|
|
11539
|
+
var worktreeDecisionGateInputSchema = z.object({
|
|
11540
|
+
goCriteria: z.array(z.string()).describe("Criteria that must hold for the worktree to proceed."),
|
|
11541
|
+
noGoSignals: z.array(z.string()).describe("Signals that stop or redirect the worktree."),
|
|
11542
|
+
verdict: z.enum(["go", "no_go", "pivot", "pending"]).optional().describe("Current decision verdict for the worktree gate."),
|
|
11543
|
+
verdictRationale: z.string().optional().describe("Rationale supporting the current gate verdict."),
|
|
11544
|
+
decidedAt: z.number().optional().describe("Timestamp when the gate verdict was decided."),
|
|
11545
|
+
decidedBy: z.string().optional().describe("Actor that decided the gate verdict.")
|
|
11546
|
+
}).passthrough().describe("Decision gate contract for worktree activation or exit.");
|
|
11547
|
+
var addWorktreeArgs = z.object({
|
|
11548
|
+
title: z.string().optional().describe("Human-readable worktree name or objective."),
|
|
11549
|
+
name: z.string().optional().describe("Storage-name alias for callers that already use backend naming."),
|
|
11550
|
+
topicId: z.string().describe("Primary topic scope for the worktree."),
|
|
11551
|
+
projectId: z.string().optional().describe("Legacy topicId alias."),
|
|
11552
|
+
branchId: z.string().optional().describe("Legacy branch identifier for compatibility with workflow callers."),
|
|
11553
|
+
objective: z.string().optional().describe("Reasoning objective this worktree is intended to resolve."),
|
|
11554
|
+
hypothesis: z.string().optional().describe("Testable claim this worktree investigates."),
|
|
11555
|
+
rationale: z.string().optional().describe("Why this worktree exists and why it belongs in the campaign."),
|
|
11556
|
+
worktreeType: z.string().optional().describe("Schema-enum worktree type used for kernel lifecycle behavior."),
|
|
11557
|
+
gate: z.string().optional().describe("Exit gate for this worktree."),
|
|
11558
|
+
startDate: z.number().optional().describe("Planned start timestamp in milliseconds since epoch."),
|
|
11559
|
+
endDate: z.number().optional().describe("Planned end timestamp in milliseconds since epoch."),
|
|
11560
|
+
durationWeeks: z.number().optional().describe("Planned duration in weeks."),
|
|
11561
|
+
confidenceImpact: z.enum(["high", "medium", "low"]).optional().describe("Expected confidence impact if this worktree succeeds."),
|
|
11562
|
+
beliefFocus: z.string().optional().describe("Natural-language focus spanning the target belief neighborhood."),
|
|
11563
|
+
beliefIds: z.array(z.string()).optional().describe("Legacy alias for targetBeliefIds."),
|
|
11564
|
+
beliefs: z.array(z.string()).optional().describe("Legacy alias for targetBeliefIds."),
|
|
11565
|
+
targetBeliefIds: z.array(z.string()).optional().describe("Belief node IDs this worktree is expected to test or update."),
|
|
11566
|
+
targetQuestionIds: z.array(z.string()).optional().describe("Question node IDs this worktree is expected to answer."),
|
|
11567
|
+
keyQuestions: z.array(worktreeKeyQuestionInputSchema).optional().describe("Inline key questions captured as part of the worktree plan."),
|
|
11568
|
+
evidenceSignals: z.array(worktreeEvidenceSignalInputSchema).optional().describe("Evidence signals the worktree needs to collect or validate."),
|
|
11569
|
+
decisionGate: worktreeDecisionGateInputSchema.optional(),
|
|
11570
|
+
goCriteria: z.array(z.string()).optional().describe("Shorthand go criteria used to build decisionGate."),
|
|
11571
|
+
noGoSignals: z.array(z.string()).optional().describe("Shorthand no-go signals used to build decisionGate."),
|
|
11572
|
+
proofArtifacts: z.array(z.unknown()).optional().describe("Expected proof artifacts required to close the worktree."),
|
|
11573
|
+
autoShape: z.boolean().optional().describe("Whether to invoke inquiry auto-shaping during creation."),
|
|
11574
|
+
autoFixPolicy: autoFixPolicyInputSchema.optional(),
|
|
11575
|
+
domainPackId: z.string().optional().describe("Domain pack whose shaping hooks should influence the worktree."),
|
|
11576
|
+
campaign: z.number().optional().describe("Top-level pipeline campaign number."),
|
|
11577
|
+
lane: z.string().optional().describe("Campaign lane for the worktree."),
|
|
11578
|
+
laneOrderInCampaign: z.number().optional().describe("Ordering for this lane within its campaign."),
|
|
11579
|
+
orderInLane: z.number().optional().describe("Position of this worktree inside its lane."),
|
|
11580
|
+
dependsOn: z.array(z.string()).optional().describe("Worktree IDs that must complete before this worktree."),
|
|
11581
|
+
blocks: z.array(z.string()).optional().describe("Worktree IDs blocked by this worktree."),
|
|
11582
|
+
staffingHint: z.string().optional().describe("Suggested staffing or agent allocation note."),
|
|
11583
|
+
lensId: z.string().optional().describe("Lens that scopes this worktree when applicable."),
|
|
11584
|
+
lastReconciledAt: z.number().optional().describe("Timestamp when worktree metadata was last reconciled.")
|
|
11585
|
+
});
|
|
10449
11586
|
var worktreeIdInput = (input) => compactRecord4({
|
|
10450
11587
|
worktreeId: input.worktreeId ?? input.id
|
|
10451
11588
|
});
|
|
@@ -10478,6 +11615,50 @@ var worktreeMetadataInput = (input) => compactRecord4({
|
|
|
10478
11615
|
autoFixPolicy: input.autoFixPolicy,
|
|
10479
11616
|
lastReconciledAt: input.lastReconciledAt
|
|
10480
11617
|
});
|
|
11618
|
+
var worktreeMetadataArgs = z.object({
|
|
11619
|
+
worktreeId: z.string().describe("The worktree to update."),
|
|
11620
|
+
id: z.string().optional().describe("Worktree ID alias."),
|
|
11621
|
+
topicId: z.string().optional().describe("Primary topic scope."),
|
|
11622
|
+
additionalTopicIds: z.array(z.string()).optional().describe("Additional topic scopes associated with this worktree."),
|
|
11623
|
+
status: z.string().optional().describe("Worktree lifecycle status."),
|
|
11624
|
+
campaign: z.number().optional().describe("Top-level pipeline campaign."),
|
|
11625
|
+
lane: z.string().optional().describe("Campaign lane."),
|
|
11626
|
+
laneOrderInCampaign: z.number().optional().describe("Ordering for this lane within its campaign."),
|
|
11627
|
+
orderInLane: z.number().optional().describe("Position of this worktree inside its lane."),
|
|
11628
|
+
gate: z.string().optional().describe("Exit gate for this worktree."),
|
|
11629
|
+
hypothesis: z.string().optional().describe("Testable claim this worktree investigates."),
|
|
11630
|
+
objective: z.string().optional().describe("Reasoning objective for the worktree."),
|
|
11631
|
+
rationale: z.string().optional().describe("Why this worktree is sequenced here."),
|
|
11632
|
+
proofArtifacts: z.array(z.unknown()).optional().describe("Proof artifacts required to close the worktree."),
|
|
11633
|
+
staffingHint: z.string().optional().describe("Suggested staffing or agent allocation note."),
|
|
11634
|
+
blocks: z.array(z.string()).optional().describe("Worktree IDs blocked by this worktree."),
|
|
11635
|
+
dependsOn: z.array(z.string()).optional().describe("Worktree IDs this worktree depends on."),
|
|
11636
|
+
lensId: z.string().optional().describe("Lens that scopes this worktree."),
|
|
11637
|
+
autoFixPolicy: autoFixPolicyInputSchema.optional(),
|
|
11638
|
+
lastReconciledAt: z.number().optional().describe("Timestamp of the last deterministic reconciliation pass.")
|
|
11639
|
+
});
|
|
11640
|
+
var pushArgs = worktreeMetadataArgs.extend({
|
|
11641
|
+
targetContext: z.string().describe("Where to push merged findings."),
|
|
11642
|
+
beliefIds: z.array(z.string()).optional().describe("Optional subset of beliefs to push.")
|
|
11643
|
+
});
|
|
11644
|
+
var openPullRequestArgs = worktreeMetadataArgs.extend({
|
|
11645
|
+
reviewers: z.array(z.string()).optional().describe("User IDs of requested reviewers."),
|
|
11646
|
+
summary: z.string().describe("Summary of findings and why they are ready for review.")
|
|
11647
|
+
});
|
|
11648
|
+
var mergeKeyFindingsInput = (input) => {
|
|
11649
|
+
if (Array.isArray(input.keyFindings)) {
|
|
11650
|
+
return input.keyFindings;
|
|
11651
|
+
}
|
|
11652
|
+
if (Array.isArray(input.outcomes)) {
|
|
11653
|
+
const findings = input.outcomes.filter(
|
|
11654
|
+
(outcome) => typeof outcome === "string" && outcome.trim().length > 0
|
|
11655
|
+
);
|
|
11656
|
+
if (findings.length > 0) {
|
|
11657
|
+
return findings;
|
|
11658
|
+
}
|
|
11659
|
+
}
|
|
11660
|
+
return [input.summary ?? "Merged worktree"];
|
|
11661
|
+
};
|
|
10481
11662
|
var listAllWorktreesInput = (input) => compactRecord4({
|
|
10482
11663
|
status: input.status,
|
|
10483
11664
|
lane: input.lane,
|
|
@@ -10485,6 +11666,16 @@ var listAllWorktreesInput = (input) => compactRecord4({
|
|
|
10485
11666
|
limit: input.limit
|
|
10486
11667
|
});
|
|
10487
11668
|
var worktreesContracts = [
|
|
11669
|
+
surfaceContract({
|
|
11670
|
+
name: "begin_build_session",
|
|
11671
|
+
kind: "mutation",
|
|
11672
|
+
domain: "worktrees",
|
|
11673
|
+
surfaceClass: "platform_internal",
|
|
11674
|
+
path: "/mcp/build-session/begin",
|
|
11675
|
+
sdkNamespace: "worktrees",
|
|
11676
|
+
sdkMethod: "beginBuildSession",
|
|
11677
|
+
summary: "Begin a coding build session for a worktree."
|
|
11678
|
+
}),
|
|
10488
11679
|
surfaceContract({
|
|
10489
11680
|
name: "add_worktree",
|
|
10490
11681
|
kind: "mutation",
|
|
@@ -10501,13 +11692,12 @@ var worktreesContracts = [
|
|
|
10501
11692
|
inputProjection: (input, context) => withCreatedBy(
|
|
10502
11693
|
compactRecord4({
|
|
10503
11694
|
name: input.name ?? input.title,
|
|
10504
|
-
topicId: input.topicId,
|
|
11695
|
+
topicId: input.topicId ?? input.projectId,
|
|
10505
11696
|
worktreeType: input.worktreeType,
|
|
10506
11697
|
objective: input.objective,
|
|
10507
11698
|
gate: input.gate,
|
|
10508
11699
|
hypothesis: input.hypothesis,
|
|
10509
11700
|
rationale: input.rationale,
|
|
10510
|
-
signal: input.signal,
|
|
10511
11701
|
startDate: input.startDate,
|
|
10512
11702
|
endDate: input.endDate,
|
|
10513
11703
|
durationWeeks: input.durationWeeks,
|
|
@@ -10533,12 +11723,12 @@ var worktreesContracts = [
|
|
|
10533
11723
|
staffingHint: input.staffingHint,
|
|
10534
11724
|
domainPackId: input.domainPackId,
|
|
10535
11725
|
lensId: input.lensId,
|
|
10536
|
-
linkedQuestionId: input.linkedQuestionId,
|
|
10537
11726
|
lastReconciledAt: input.lastReconciledAt
|
|
10538
11727
|
}),
|
|
10539
11728
|
context
|
|
10540
11729
|
)
|
|
10541
|
-
}
|
|
11730
|
+
},
|
|
11731
|
+
args: addWorktreeArgs
|
|
10542
11732
|
}),
|
|
10543
11733
|
surfaceContract({
|
|
10544
11734
|
name: "activate_worktree",
|
|
@@ -10650,7 +11840,8 @@ var worktreesContracts = [
|
|
|
10650
11840
|
functionName: "updateMetadata",
|
|
10651
11841
|
kind: "mutation",
|
|
10652
11842
|
inputProjection: worktreeMetadataInput
|
|
10653
|
-
}
|
|
11843
|
+
},
|
|
11844
|
+
args: worktreeMetadataArgs
|
|
10654
11845
|
}),
|
|
10655
11846
|
surfaceContract({
|
|
10656
11847
|
name: "merge",
|
|
@@ -10668,9 +11859,7 @@ var worktreesContracts = [
|
|
|
10668
11859
|
inputProjection: (input, context) => withUserId(
|
|
10669
11860
|
{
|
|
10670
11861
|
...worktreeIdInput(input),
|
|
10671
|
-
keyFindings: input
|
|
10672
|
-
input.summary ?? "Merged worktree"
|
|
10673
|
-
],
|
|
11862
|
+
keyFindings: mergeKeyFindingsInput(input),
|
|
10674
11863
|
decisionsReached: input.decisionsReached ?? [],
|
|
10675
11864
|
nextSteps: input.nextSteps ?? []
|
|
10676
11865
|
},
|
|
@@ -10692,7 +11881,8 @@ var worktreesContracts = [
|
|
|
10692
11881
|
functionName: "updateMetadata",
|
|
10693
11882
|
kind: "mutation",
|
|
10694
11883
|
inputProjection: worktreeMetadataInput
|
|
10695
|
-
}
|
|
11884
|
+
},
|
|
11885
|
+
args: pushArgs
|
|
10696
11886
|
}),
|
|
10697
11887
|
surfaceContract({
|
|
10698
11888
|
name: "open_pull_request",
|
|
@@ -10708,7 +11898,8 @@ var worktreesContracts = [
|
|
|
10708
11898
|
functionName: "updateMetadata",
|
|
10709
11899
|
kind: "mutation",
|
|
10710
11900
|
inputProjection: worktreeMetadataInput
|
|
10711
|
-
}
|
|
11901
|
+
},
|
|
11902
|
+
args: openPullRequestArgs
|
|
10712
11903
|
})
|
|
10713
11904
|
];
|
|
10714
11905
|
|
|
@@ -10812,6 +12003,15 @@ var createEdgeArgs = z.object({
|
|
|
10812
12003
|
topicId: z.string().optional(),
|
|
10813
12004
|
trustedBypassAccessCheck: z.boolean().optional()
|
|
10814
12005
|
});
|
|
12006
|
+
var queryLineageArgs = z.object({
|
|
12007
|
+
nodeId: z.string().describe("Starting node to trace from."),
|
|
12008
|
+
startNode: z.string().optional().describe("Starting node alias accepted by traversal callers."),
|
|
12009
|
+
depth: z.number().optional().describe("Traversal depth alias."),
|
|
12010
|
+
maxDepth: z.number().optional().describe("Maximum traversal depth."),
|
|
12011
|
+
mode: z.string().optional().describe("Traversal mode."),
|
|
12012
|
+
minLayer: z.string().optional().describe("Minimum epistemic layer."),
|
|
12013
|
+
maxLayer: z.string().optional().describe("Maximum epistemic layer.")
|
|
12014
|
+
});
|
|
10815
12015
|
function graphRefNodeId(ref) {
|
|
10816
12016
|
if (ref.kind === "epistemic_node") {
|
|
10817
12017
|
return ref.nodeId;
|
|
@@ -10882,11 +12082,84 @@ var edgesContracts = [
|
|
|
10882
12082
|
minLayer: input.minLayer,
|
|
10883
12083
|
maxLayer: input.maxLayer
|
|
10884
12084
|
})
|
|
10885
|
-
}
|
|
12085
|
+
},
|
|
12086
|
+
args: queryLineageArgs
|
|
10886
12087
|
})
|
|
10887
12088
|
];
|
|
10888
|
-
|
|
10889
|
-
|
|
12089
|
+
var graphIntelligenceQueryModes = [
|
|
12090
|
+
"core",
|
|
12091
|
+
"bias",
|
|
12092
|
+
"stress",
|
|
12093
|
+
"operational",
|
|
12094
|
+
"alpha",
|
|
12095
|
+
"semantic",
|
|
12096
|
+
"evidence"
|
|
12097
|
+
];
|
|
12098
|
+
var traversalLayerSchema = z.enum([
|
|
12099
|
+
"L4",
|
|
12100
|
+
"L3",
|
|
12101
|
+
"L2",
|
|
12102
|
+
"L1",
|
|
12103
|
+
"ontological",
|
|
12104
|
+
"organizational"
|
|
12105
|
+
]);
|
|
12106
|
+
var traversalModeSchema = z.enum(["low", "medium", "high", "extra_high"]);
|
|
12107
|
+
var lineageAliasArgs = z.object({
|
|
12108
|
+
nodeId: z.string().optional().describe("Starting node to traverse from."),
|
|
12109
|
+
startNode: z.string().optional().describe("Starting node alias for traversal callers."),
|
|
12110
|
+
entityId: z.string().optional().describe("Entity identifier alias for impact tracing."),
|
|
12111
|
+
depth: z.number().optional().describe("Traversal depth alias."),
|
|
12112
|
+
maxDepth: z.number().optional().describe("Maximum traversal depth."),
|
|
12113
|
+
mode: traversalModeSchema.optional().describe("Traversal mode."),
|
|
12114
|
+
minLayer: traversalLayerSchema.optional().describe("Minimum epistemic layer to include."),
|
|
12115
|
+
maxLayer: traversalLayerSchema.optional().describe("Maximum epistemic layer to include.")
|
|
12116
|
+
});
|
|
12117
|
+
var lineageArgs = lineageAliasArgs.extend({
|
|
12118
|
+
nodeId: z.string().describe("Starting node to traverse from.")
|
|
12119
|
+
});
|
|
12120
|
+
var traverseGraphArgs = lineageAliasArgs.extend({
|
|
12121
|
+
startNode: z.string().describe("Node to start traversal from."),
|
|
12122
|
+
direction: z.enum(["up", "down", "both"]).optional().describe("Traversal direction.")
|
|
12123
|
+
});
|
|
12124
|
+
var graphNeighborhoodArgs = z.object({
|
|
12125
|
+
globalId: z.string().optional().describe("Single root global ID."),
|
|
12126
|
+
globalIds: z.array(z.string()).optional().describe("Root global IDs for the neighborhood."),
|
|
12127
|
+
maxDepth: z.number().optional().describe("Maximum traversal depth."),
|
|
12128
|
+
topicId: z.string().optional().describe("Topic scope for edge lookup."),
|
|
12129
|
+
limit: z.number().optional().describe("Maximum edges to return.")
|
|
12130
|
+
});
|
|
12131
|
+
var graphIntelligenceModeSchema = z.enum([
|
|
12132
|
+
graphIntelligenceQueryModes[0],
|
|
12133
|
+
...graphIntelligenceQueryModes.slice(1)
|
|
12134
|
+
]);
|
|
12135
|
+
var graphIntelligenceCatalogArgs = z.object({
|
|
12136
|
+
categoryId: z.string().optional().describe("Optional query category filter."),
|
|
12137
|
+
mode: graphIntelligenceModeSchema.optional().describe("Optional Graph Intelligence query mode filter.")
|
|
12138
|
+
});
|
|
12139
|
+
var graphIntelligenceRunArgs = z.object({
|
|
12140
|
+
topicId: z.string().describe("Topic to analyze."),
|
|
12141
|
+
queryId: z.string().optional().describe("Catalog query ID to run, such as pre-mortem."),
|
|
12142
|
+
prompt: z.string().optional().describe("Custom prompt when queryId is omitted or overridden."),
|
|
12143
|
+
input: z.string().optional().describe("Optional entity, theme, belief, company, or search text."),
|
|
12144
|
+
mode: graphIntelligenceModeSchema.optional().describe("Optional query mode override for custom prompts."),
|
|
12145
|
+
limit: z.number().optional().describe("Maximum graph context rows to return.")
|
|
12146
|
+
});
|
|
12147
|
+
var flagContradictionArgs = z.object({
|
|
12148
|
+
beliefA: z.string().describe("First belief in tension."),
|
|
12149
|
+
beliefB: z.string().describe("Second belief in tension."),
|
|
12150
|
+
topicId: z.string().optional().describe("Topic scope for the contradiction."),
|
|
12151
|
+
description: z.string().optional().describe("Human-readable contradiction."),
|
|
12152
|
+
severity: z.enum(["critical", "high", "medium", "low"]).optional().describe("Contradiction severity."),
|
|
12153
|
+
defeatType: z.string().optional().describe("Defeat type annotation."),
|
|
12154
|
+
supportingInsightIds: z.array(z.string()).optional().describe("Evidence supporting the primary belief."),
|
|
12155
|
+
contradictingInsightIds: z.array(z.string()).optional().describe("Evidence or beliefs contradicting the primary belief.")
|
|
12156
|
+
});
|
|
12157
|
+
var discoverEntityConnectionsArgs = lineageAliasArgs.extend({
|
|
12158
|
+
nodeId: z.string().describe("Epistemic node ID to find entity connections for."),
|
|
12159
|
+
topicId: z.string().optional().describe("Topic scope override."),
|
|
12160
|
+
minScore: z.number().optional().describe("Minimum match score."),
|
|
12161
|
+
limit: z.number().optional().describe("Maximum candidates to return.")
|
|
12162
|
+
});
|
|
10890
12163
|
var contradictionSeverity = (value) => {
|
|
10891
12164
|
switch (value) {
|
|
10892
12165
|
case "critical":
|
|
@@ -10941,7 +12214,8 @@ var graphContracts = [
|
|
|
10941
12214
|
functionName: "getLineage",
|
|
10942
12215
|
kind: "query",
|
|
10943
12216
|
inputProjection: lineageInput
|
|
10944
|
-
}
|
|
12217
|
+
},
|
|
12218
|
+
args: traverseGraphArgs
|
|
10945
12219
|
}),
|
|
10946
12220
|
surfaceContract({
|
|
10947
12221
|
name: "get_graph_neighborhood",
|
|
@@ -10957,7 +12231,8 @@ var graphContracts = [
|
|
|
10957
12231
|
functionName: "getByTopic",
|
|
10958
12232
|
kind: "query",
|
|
10959
12233
|
inputProjection: topicEdgesInput
|
|
10960
|
-
}
|
|
12234
|
+
},
|
|
12235
|
+
args: graphNeighborhoodArgs
|
|
10961
12236
|
}),
|
|
10962
12237
|
surfaceContract({
|
|
10963
12238
|
name: "get_graph_structure_analysis",
|
|
@@ -10974,6 +12249,38 @@ var graphContracts = [
|
|
|
10974
12249
|
kind: "query"
|
|
10975
12250
|
}
|
|
10976
12251
|
}),
|
|
12252
|
+
surfaceContract({
|
|
12253
|
+
name: "list_graph_intelligence_queries",
|
|
12254
|
+
kind: "query",
|
|
12255
|
+
domain: "graph",
|
|
12256
|
+
surfaceClass: "platform_public",
|
|
12257
|
+
path: "/graph-intelligence/queries",
|
|
12258
|
+
sdkNamespace: "graphAnalysis",
|
|
12259
|
+
sdkMethod: "listGraphIntelligenceQueries",
|
|
12260
|
+
summary: "List Graph Intelligence query catalog entries.",
|
|
12261
|
+
convex: {
|
|
12262
|
+
module: "contextCompiler",
|
|
12263
|
+
functionName: "listGraphIntelligenceQueries",
|
|
12264
|
+
kind: "query"
|
|
12265
|
+
},
|
|
12266
|
+
args: graphIntelligenceCatalogArgs
|
|
12267
|
+
}),
|
|
12268
|
+
surfaceContract({
|
|
12269
|
+
name: "run_graph_intelligence_query",
|
|
12270
|
+
kind: "query",
|
|
12271
|
+
domain: "graph",
|
|
12272
|
+
surfaceClass: "platform_public",
|
|
12273
|
+
path: "/graph-intelligence/run",
|
|
12274
|
+
sdkNamespace: "graphAnalysis",
|
|
12275
|
+
sdkMethod: "runGraphIntelligenceQuery",
|
|
12276
|
+
summary: "Run a Graph Intelligence query against a topic graph.",
|
|
12277
|
+
convex: {
|
|
12278
|
+
module: "contextCompiler",
|
|
12279
|
+
functionName: "runGraphIntelligenceQuery",
|
|
12280
|
+
kind: "query"
|
|
12281
|
+
},
|
|
12282
|
+
args: graphIntelligenceRunArgs
|
|
12283
|
+
}),
|
|
10977
12284
|
surfaceContract({
|
|
10978
12285
|
name: "find_contradictions",
|
|
10979
12286
|
kind: "query",
|
|
@@ -11006,7 +12313,8 @@ var graphContracts = [
|
|
|
11006
12313
|
functionName: "create",
|
|
11007
12314
|
kind: "mutation",
|
|
11008
12315
|
inputProjection: flagContradictionInput
|
|
11009
|
-
}
|
|
12316
|
+
},
|
|
12317
|
+
args: flagContradictionArgs
|
|
11010
12318
|
}),
|
|
11011
12319
|
surfaceContract({
|
|
11012
12320
|
name: "detect_confirmation_bias",
|
|
@@ -11097,7 +12405,8 @@ var graphContracts = [
|
|
|
11097
12405
|
functionName: "getLineage",
|
|
11098
12406
|
kind: "query",
|
|
11099
12407
|
inputProjection: lineageInput
|
|
11100
|
-
}
|
|
12408
|
+
},
|
|
12409
|
+
args: discoverEntityConnectionsArgs
|
|
11101
12410
|
}),
|
|
11102
12411
|
surfaceContract({
|
|
11103
12412
|
name: "trigger_belief_review",
|
|
@@ -11128,7 +12437,8 @@ var graphContracts = [
|
|
|
11128
12437
|
functionName: "getLineage",
|
|
11129
12438
|
kind: "query",
|
|
11130
12439
|
inputProjection: lineageInput
|
|
11131
|
-
}
|
|
12440
|
+
},
|
|
12441
|
+
args: lineageArgs
|
|
11132
12442
|
})
|
|
11133
12443
|
];
|
|
11134
12444
|
|
|
@@ -11180,8 +12490,16 @@ var contractsContracts = [
|
|
|
11180
12490
|
}
|
|
11181
12491
|
})
|
|
11182
12492
|
];
|
|
11183
|
-
|
|
11184
|
-
|
|
12493
|
+
var auditTrailArgs = z.object({
|
|
12494
|
+
nodeId: z.string().describe("The node to audit."),
|
|
12495
|
+
id: z.string().optional().describe("Node ID alias."),
|
|
12496
|
+
limit: z.number().optional().describe("Maximum entries to return."),
|
|
12497
|
+
depth: z.number().optional().describe("Traversal depth alias."),
|
|
12498
|
+
maxDepth: z.number().optional().describe("Maximum lineage depth."),
|
|
12499
|
+
mode: z.string().optional().describe("Traversal mode."),
|
|
12500
|
+
minLayer: z.string().optional().describe("Minimum epistemic layer."),
|
|
12501
|
+
maxLayer: z.string().optional().describe("Maximum epistemic layer.")
|
|
12502
|
+
});
|
|
11185
12503
|
var judgmentsContracts = [
|
|
11186
12504
|
surfaceContract({
|
|
11187
12505
|
name: "record_judgment",
|
|
@@ -11236,7 +12554,8 @@ var judgmentsContracts = [
|
|
|
11236
12554
|
minLayer: input.minLayer,
|
|
11237
12555
|
maxLayer: input.maxLayer
|
|
11238
12556
|
})
|
|
11239
|
-
}
|
|
12557
|
+
},
|
|
12558
|
+
args: auditTrailArgs
|
|
11240
12559
|
})
|
|
11241
12560
|
];
|
|
11242
12561
|
|
|
@@ -11404,8 +12723,13 @@ var coordinationContracts = [
|
|
|
11404
12723
|
}
|
|
11405
12724
|
})
|
|
11406
12725
|
];
|
|
11407
|
-
|
|
11408
|
-
|
|
12726
|
+
var pipelineSnapshotArgs = z.object({
|
|
12727
|
+
topicId: z.string().describe("Topic scope ID."),
|
|
12728
|
+
status: z.string().optional().describe("Worktree status filter."),
|
|
12729
|
+
lane: z.string().optional().describe("Campaign lane filter."),
|
|
12730
|
+
campaign: z.number().optional().describe("Campaign number filter."),
|
|
12731
|
+
limit: z.number().optional().describe("Maximum worktrees to inspect.")
|
|
12732
|
+
});
|
|
11409
12733
|
var pipelineContracts = [
|
|
11410
12734
|
surfaceContract({
|
|
11411
12735
|
name: "pipeline_snapshot",
|
|
@@ -11426,7 +12750,8 @@ var pipelineContracts = [
|
|
|
11426
12750
|
campaign: input.campaign,
|
|
11427
12751
|
limit: input.limit
|
|
11428
12752
|
})
|
|
11429
|
-
}
|
|
12753
|
+
},
|
|
12754
|
+
args: pipelineSnapshotArgs
|
|
11430
12755
|
}),
|
|
11431
12756
|
surfaceContract({
|
|
11432
12757
|
name: "seed_belief_lattice",
|
|
@@ -11478,7 +12803,31 @@ var recordScopeLearningArgs = z.object({
|
|
|
11478
12803
|
rationale: z.string().optional().describe("Why this learning should enter the reasoning graph"),
|
|
11479
12804
|
createQuestionText: z.string().optional().describe("Optional follow-up question text"),
|
|
11480
12805
|
createBeliefText: z.string().optional().describe("Optional new belief text"),
|
|
11481
|
-
beliefType: z.string().optional().describe("Optional belief type for createBeliefText")
|
|
12806
|
+
beliefType: z.string().optional().describe("Optional belief type for createBeliefText"),
|
|
12807
|
+
text: z.string().optional().describe("Canonical learning text alias."),
|
|
12808
|
+
content: z.string().optional().describe("Canonical learning content alias."),
|
|
12809
|
+
kind: z.string().optional().describe("Evidence kind to store."),
|
|
12810
|
+
sourceType: z.string().optional().describe("Evidence source type."),
|
|
12811
|
+
externalSourceType: z.string().optional().describe("External source type alias."),
|
|
12812
|
+
metadata: z.record(z.unknown()).optional().describe("Learning metadata.")
|
|
12813
|
+
});
|
|
12814
|
+
var codeContextArgs = z.object({
|
|
12815
|
+
topicId: z.string().optional().describe("Topic scope."),
|
|
12816
|
+
filePath: z.string().optional().describe("File path anchor."),
|
|
12817
|
+
includeFailures: z.boolean().optional().describe("Whether to include failed attempts."),
|
|
12818
|
+
limit: z.number().optional().describe("Maximum records to return."),
|
|
12819
|
+
status: z.string().optional().describe("Evidence status filter.")
|
|
12820
|
+
});
|
|
12821
|
+
var recordAttemptArgs = z.object({
|
|
12822
|
+
topicId: z.string().optional().describe("Topic scope."),
|
|
12823
|
+
description: z.string().describe("Attempt description."),
|
|
12824
|
+
errorMessage: z.string().optional().describe("Failure or error message."),
|
|
12825
|
+
filePaths: z.array(z.string()).optional().describe("Files involved in the attempt."),
|
|
12826
|
+
filePath: z.string().optional().describe("Single file path alias."),
|
|
12827
|
+
linkedBeliefId: z.string().optional().describe("Linked belief ID."),
|
|
12828
|
+
metadata: z.record(z.unknown()).optional().describe("Attempt metadata."),
|
|
12829
|
+
rationale: z.string().optional().describe("Why this attempt should be recorded."),
|
|
12830
|
+
title: z.string().optional().describe("Attempt evidence title.")
|
|
11482
12831
|
});
|
|
11483
12832
|
var learningInput = (input, context) => {
|
|
11484
12833
|
const sourceKind = input.sourceKind ?? input.externalSourceType;
|
|
@@ -11595,7 +12944,8 @@ var codingContracts = [
|
|
|
11595
12944
|
status: input.status,
|
|
11596
12945
|
userId: input.userId
|
|
11597
12946
|
})
|
|
11598
|
-
}
|
|
12947
|
+
},
|
|
12948
|
+
args: codeContextArgs
|
|
11599
12949
|
}),
|
|
11600
12950
|
surfaceContract({
|
|
11601
12951
|
name: "get_change_history",
|
|
@@ -11632,7 +12982,8 @@ var codingContracts = [
|
|
|
11632
12982
|
functionName: "create",
|
|
11633
12983
|
kind: "mutation",
|
|
11634
12984
|
inputProjection: attemptInput
|
|
11635
|
-
}
|
|
12985
|
+
},
|
|
12986
|
+
args: recordAttemptArgs
|
|
11636
12987
|
}),
|
|
11637
12988
|
surfaceContract({
|
|
11638
12989
|
name: "get_failure_log",
|
|
@@ -11707,6 +13058,604 @@ new Map(
|
|
|
11707
13058
|
ALL_FUNCTION_CONTRACTS.map((contract) => [contract.name, contract])
|
|
11708
13059
|
);
|
|
11709
13060
|
|
|
13061
|
+
// ../contracts/src/tenant-bootstrap-seed.contract.ts
|
|
13062
|
+
function isCopyableSeedRequirement(entry) {
|
|
13063
|
+
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;
|
|
13064
|
+
}
|
|
13065
|
+
var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
|
|
13066
|
+
{
|
|
13067
|
+
component: "kernel",
|
|
13068
|
+
table: "agentMessages",
|
|
13069
|
+
prepopulation: "runtime_data",
|
|
13070
|
+
copyMode: "none",
|
|
13071
|
+
description: "Agent coordination messages are session data, not template data."
|
|
13072
|
+
},
|
|
13073
|
+
{
|
|
13074
|
+
component: "kernel",
|
|
13075
|
+
table: "agentSessions",
|
|
13076
|
+
prepopulation: "runtime_data",
|
|
13077
|
+
copyMode: "none",
|
|
13078
|
+
description: "Agent coordination sessions are created by active clients."
|
|
13079
|
+
},
|
|
13080
|
+
{
|
|
13081
|
+
component: "kernel",
|
|
13082
|
+
table: "autofixJobs",
|
|
13083
|
+
prepopulation: "runtime_queue",
|
|
13084
|
+
copyMode: "none",
|
|
13085
|
+
description: "Autofix work items are runtime queue rows."
|
|
13086
|
+
},
|
|
13087
|
+
{
|
|
13088
|
+
component: "kernel",
|
|
13089
|
+
table: "backgroundJobRuns",
|
|
13090
|
+
prepopulation: "runtime_log",
|
|
13091
|
+
copyMode: "none",
|
|
13092
|
+
description: "Background job executions are runtime logs."
|
|
13093
|
+
},
|
|
13094
|
+
{
|
|
13095
|
+
component: "kernel",
|
|
13096
|
+
table: "backgroundJobSettings",
|
|
13097
|
+
prepopulation: "required_template",
|
|
13098
|
+
copyMode: "template_global",
|
|
13099
|
+
scope: "global",
|
|
13100
|
+
uniqueKey: ["jobKey"],
|
|
13101
|
+
description: "Default job enablement settings must come from the K template."
|
|
13102
|
+
},
|
|
13103
|
+
{
|
|
13104
|
+
component: "kernel",
|
|
13105
|
+
table: "beliefConfidence",
|
|
13106
|
+
prepopulation: "runtime_data",
|
|
13107
|
+
copyMode: "none",
|
|
13108
|
+
description: "Belief confidence rows are created with tenant graph facts."
|
|
13109
|
+
},
|
|
13110
|
+
{
|
|
13111
|
+
component: "kernel",
|
|
13112
|
+
table: "beliefEvidenceLinks",
|
|
13113
|
+
prepopulation: "runtime_data",
|
|
13114
|
+
copyMode: "none",
|
|
13115
|
+
description: "Belief-to-evidence links are tenant graph data."
|
|
13116
|
+
},
|
|
13117
|
+
{
|
|
13118
|
+
component: "kernel",
|
|
13119
|
+
table: "beliefHistory",
|
|
13120
|
+
prepopulation: "runtime_data",
|
|
13121
|
+
copyMode: "none",
|
|
13122
|
+
description: "Belief history is append-only tenant graph data."
|
|
13123
|
+
},
|
|
13124
|
+
{
|
|
13125
|
+
component: "kernel",
|
|
13126
|
+
table: "beliefScenarios",
|
|
13127
|
+
prepopulation: "runtime_data",
|
|
13128
|
+
copyMode: "none",
|
|
13129
|
+
description: "Scenario rows are tenant-authored reasoning data."
|
|
13130
|
+
},
|
|
13131
|
+
{
|
|
13132
|
+
component: "kernel",
|
|
13133
|
+
table: "beliefVotes",
|
|
13134
|
+
prepopulation: "runtime_data",
|
|
13135
|
+
copyMode: "none",
|
|
13136
|
+
description: "Decision belief votes are tenant-authored data."
|
|
13137
|
+
},
|
|
13138
|
+
{
|
|
13139
|
+
component: "kernel",
|
|
13140
|
+
table: "calibrationScores",
|
|
13141
|
+
prepopulation: "runtime_derived",
|
|
13142
|
+
copyMode: "none",
|
|
13143
|
+
description: "Calibration scores are computed from tenant outcomes."
|
|
13144
|
+
},
|
|
13145
|
+
{
|
|
13146
|
+
component: "kernel",
|
|
13147
|
+
table: "contractEvaluations",
|
|
13148
|
+
prepopulation: "runtime_log",
|
|
13149
|
+
copyMode: "none",
|
|
13150
|
+
description: "Contract evaluation rows are runtime computation logs."
|
|
13151
|
+
},
|
|
13152
|
+
{
|
|
13153
|
+
component: "kernel",
|
|
13154
|
+
table: "contradictions",
|
|
13155
|
+
prepopulation: "runtime_data",
|
|
13156
|
+
copyMode: "none",
|
|
13157
|
+
description: "Contradictions are tenant graph facts."
|
|
13158
|
+
},
|
|
13159
|
+
{
|
|
13160
|
+
component: "kernel",
|
|
13161
|
+
table: "crossProjectConnections",
|
|
13162
|
+
prepopulation: "runtime_data",
|
|
13163
|
+
copyMode: "none",
|
|
13164
|
+
description: "Cross-topic connections are tenant graph facts."
|
|
13165
|
+
},
|
|
13166
|
+
{
|
|
13167
|
+
component: "kernel",
|
|
13168
|
+
table: "decisionComputedSummaries",
|
|
13169
|
+
prepopulation: "runtime_derived",
|
|
13170
|
+
copyMode: "none",
|
|
13171
|
+
description: "Decision summaries are derived tenant outputs."
|
|
13172
|
+
},
|
|
13173
|
+
{
|
|
13174
|
+
component: "kernel",
|
|
13175
|
+
table: "decisionEvents",
|
|
13176
|
+
prepopulation: "runtime_data",
|
|
13177
|
+
copyMode: "none",
|
|
13178
|
+
description: "Decision events are lifecycle data."
|
|
13179
|
+
},
|
|
13180
|
+
{
|
|
13181
|
+
component: "kernel",
|
|
13182
|
+
table: "decisionParticipants",
|
|
13183
|
+
prepopulation: "runtime_data",
|
|
13184
|
+
copyMode: "none",
|
|
13185
|
+
description: "Decision participants are tenant-selected actors."
|
|
13186
|
+
},
|
|
13187
|
+
{
|
|
13188
|
+
component: "kernel",
|
|
13189
|
+
table: "decisionRiskLedger",
|
|
13190
|
+
prepopulation: "runtime_data",
|
|
13191
|
+
copyMode: "none",
|
|
13192
|
+
description: "Decision risk rows are tenant decision data."
|
|
13193
|
+
},
|
|
13194
|
+
{
|
|
13195
|
+
component: "kernel",
|
|
13196
|
+
table: "decisionSnapshots",
|
|
13197
|
+
prepopulation: "runtime_derived",
|
|
13198
|
+
copyMode: "none",
|
|
13199
|
+
description: "Decision snapshots are derived from tenant state."
|
|
13200
|
+
},
|
|
13201
|
+
{
|
|
13202
|
+
component: "kernel",
|
|
13203
|
+
table: "deliberationContributions",
|
|
13204
|
+
prepopulation: "runtime_data",
|
|
13205
|
+
copyMode: "none",
|
|
13206
|
+
description: "Deliberation contributions are tenant-authored data."
|
|
13207
|
+
},
|
|
13208
|
+
{
|
|
13209
|
+
component: "kernel",
|
|
13210
|
+
table: "deliberationSessions",
|
|
13211
|
+
prepopulation: "runtime_data",
|
|
13212
|
+
copyMode: "none",
|
|
13213
|
+
description: "Deliberation sessions are created by tenant workflows."
|
|
13214
|
+
},
|
|
13215
|
+
{
|
|
13216
|
+
component: "kernel",
|
|
13217
|
+
table: "epistemicAudit",
|
|
13218
|
+
prepopulation: "runtime_log",
|
|
13219
|
+
copyMode: "none",
|
|
13220
|
+
description: "Epistemic audit rows are append-only runtime audit data."
|
|
13221
|
+
},
|
|
13222
|
+
{
|
|
13223
|
+
component: "kernel",
|
|
13224
|
+
table: "epistemicContracts",
|
|
13225
|
+
prepopulation: "runtime_data",
|
|
13226
|
+
copyMode: "none",
|
|
13227
|
+
description: "Epistemic contracts are tenant-authored governance data."
|
|
13228
|
+
},
|
|
13229
|
+
{
|
|
13230
|
+
component: "kernel",
|
|
13231
|
+
table: "epistemicEdges",
|
|
13232
|
+
prepopulation: "runtime_data",
|
|
13233
|
+
copyMode: "none",
|
|
13234
|
+
description: "Edges are tenant reasoning graph data."
|
|
13235
|
+
},
|
|
13236
|
+
{
|
|
13237
|
+
component: "kernel",
|
|
13238
|
+
table: "epistemicNodeEmbeddings",
|
|
13239
|
+
prepopulation: "runtime_derived",
|
|
13240
|
+
copyMode: "none",
|
|
13241
|
+
description: "Embeddings are derived from tenant graph nodes."
|
|
13242
|
+
},
|
|
13243
|
+
{
|
|
13244
|
+
component: "kernel",
|
|
13245
|
+
table: "epistemicNodes",
|
|
13246
|
+
prepopulation: "runtime_data",
|
|
13247
|
+
copyMode: "none",
|
|
13248
|
+
description: "Nodes are tenant reasoning graph data."
|
|
13249
|
+
},
|
|
13250
|
+
{
|
|
13251
|
+
component: "kernel",
|
|
13252
|
+
table: "graphAnalysisCache",
|
|
13253
|
+
prepopulation: "runtime_derived",
|
|
13254
|
+
copyMode: "none",
|
|
13255
|
+
description: "Graph analysis cache rows are derived from tenant graph state."
|
|
13256
|
+
},
|
|
13257
|
+
{
|
|
13258
|
+
component: "kernel",
|
|
13259
|
+
table: "graphAnalysisResults",
|
|
13260
|
+
prepopulation: "runtime_derived",
|
|
13261
|
+
copyMode: "none",
|
|
13262
|
+
description: "Graph analysis result rows are derived tenant outputs."
|
|
13263
|
+
},
|
|
13264
|
+
{
|
|
13265
|
+
component: "kernel",
|
|
13266
|
+
table: "graphSuggestions",
|
|
13267
|
+
prepopulation: "runtime_derived",
|
|
13268
|
+
copyMode: "none",
|
|
13269
|
+
description: "Graph suggestions are derived recommendations."
|
|
13270
|
+
},
|
|
13271
|
+
{
|
|
13272
|
+
component: "kernel",
|
|
13273
|
+
table: "harnessReplays",
|
|
13274
|
+
prepopulation: "runtime_log",
|
|
13275
|
+
copyMode: "none",
|
|
13276
|
+
description: "Harness replay rows are runtime verification logs."
|
|
13277
|
+
},
|
|
13278
|
+
{
|
|
13279
|
+
component: "kernel",
|
|
13280
|
+
table: "harnessRuns",
|
|
13281
|
+
prepopulation: "runtime_log",
|
|
13282
|
+
copyMode: "none",
|
|
13283
|
+
description: "Harness run rows are runtime verification logs."
|
|
13284
|
+
},
|
|
13285
|
+
{
|
|
13286
|
+
component: "kernel",
|
|
13287
|
+
table: "idempotencyTokens",
|
|
13288
|
+
prepopulation: "runtime_log",
|
|
13289
|
+
copyMode: "none",
|
|
13290
|
+
description: "Idempotency tokens are request-scoped runtime guards."
|
|
13291
|
+
},
|
|
13292
|
+
{
|
|
13293
|
+
component: "kernel",
|
|
13294
|
+
table: "lenses",
|
|
13295
|
+
prepopulation: "optional_template",
|
|
13296
|
+
copyMode: "none",
|
|
13297
|
+
description: "Reusable lens templates may live in K templates, but workspace-specific copies are not required for core SDK boot."
|
|
13298
|
+
},
|
|
13299
|
+
{
|
|
13300
|
+
component: "kernel",
|
|
13301
|
+
table: "lensTopicBindings",
|
|
13302
|
+
prepopulation: "runtime_data",
|
|
13303
|
+
copyMode: "none",
|
|
13304
|
+
description: "Lens bindings attach runtime topics to runtime/workspace lenses."
|
|
13305
|
+
},
|
|
13306
|
+
{
|
|
13307
|
+
component: "kernel",
|
|
13308
|
+
table: "neo4jSyncQueue",
|
|
13309
|
+
prepopulation: "runtime_queue",
|
|
13310
|
+
copyMode: "none",
|
|
13311
|
+
description: "Neo4j sync queue rows are runtime work items."
|
|
13312
|
+
},
|
|
13313
|
+
{
|
|
13314
|
+
component: "kernel",
|
|
13315
|
+
table: "ontologyDefinitions",
|
|
13316
|
+
prepopulation: "required_template",
|
|
13317
|
+
copyMode: "template_global",
|
|
13318
|
+
scope: "global",
|
|
13319
|
+
uniqueKey: ["ontologyKey"],
|
|
13320
|
+
description: "Platform ontology definitions power taxonomy reads and effective ontology resolution."
|
|
13321
|
+
},
|
|
13322
|
+
{
|
|
13323
|
+
component: "kernel",
|
|
13324
|
+
table: "ontologyVersions",
|
|
13325
|
+
prepopulation: "required_template",
|
|
13326
|
+
copyMode: "template_reference_remap",
|
|
13327
|
+
scope: "global",
|
|
13328
|
+
uniqueKey: ["ontologyKey", "version"],
|
|
13329
|
+
dependsOn: ["ontologyDefinitions"],
|
|
13330
|
+
description: "Ontology versions must be copied with ontologyDefinition ID remapping."
|
|
13331
|
+
},
|
|
13332
|
+
{
|
|
13333
|
+
component: "kernel",
|
|
13334
|
+
table: "platformAgentRunPolicyDecisions",
|
|
13335
|
+
prepopulation: "runtime_log",
|
|
13336
|
+
copyMode: "none",
|
|
13337
|
+
description: "Agent-run policy decisions are audit logs."
|
|
13338
|
+
},
|
|
13339
|
+
{
|
|
13340
|
+
component: "kernel",
|
|
13341
|
+
table: "platformAgentRunPromptResolutions",
|
|
13342
|
+
prepopulation: "runtime_log",
|
|
13343
|
+
copyMode: "none",
|
|
13344
|
+
description: "Agent-run prompt resolution rows are runtime logs."
|
|
13345
|
+
},
|
|
13346
|
+
{
|
|
13347
|
+
component: "kernel",
|
|
13348
|
+
table: "platformAgentRuns",
|
|
13349
|
+
prepopulation: "runtime_log",
|
|
13350
|
+
copyMode: "none",
|
|
13351
|
+
description: "Agent runs are runtime execution records."
|
|
13352
|
+
},
|
|
13353
|
+
{
|
|
13354
|
+
component: "kernel",
|
|
13355
|
+
table: "platformAgentRunToolCalls",
|
|
13356
|
+
prepopulation: "runtime_log",
|
|
13357
|
+
copyMode: "none",
|
|
13358
|
+
description: "Agent-run tool calls are runtime execution records."
|
|
13359
|
+
},
|
|
13360
|
+
{
|
|
13361
|
+
component: "kernel",
|
|
13362
|
+
table: "platformHarnessShadowAudit",
|
|
13363
|
+
prepopulation: "runtime_log",
|
|
13364
|
+
copyMode: "none",
|
|
13365
|
+
description: "Harness shadow audit rows are runtime audit records."
|
|
13366
|
+
},
|
|
13367
|
+
{
|
|
13368
|
+
component: "kernel",
|
|
13369
|
+
table: "publicationRules",
|
|
13370
|
+
prepopulation: "required_template",
|
|
13371
|
+
copyMode: "template_tenant_rewrite",
|
|
13372
|
+
scope: "tenant",
|
|
13373
|
+
uniqueKey: ["tenantId", "workspaceId", "name"],
|
|
13374
|
+
description: "Default publication policy rules are rewritten into each tenant."
|
|
13375
|
+
},
|
|
13376
|
+
{
|
|
13377
|
+
component: "kernel",
|
|
13378
|
+
table: "questionEvidenceLinks",
|
|
13379
|
+
prepopulation: "runtime_data",
|
|
13380
|
+
copyMode: "none",
|
|
13381
|
+
description: "Question-to-evidence links are tenant graph data."
|
|
13382
|
+
},
|
|
13383
|
+
{
|
|
13384
|
+
component: "kernel",
|
|
13385
|
+
table: "researchJobs",
|
|
13386
|
+
prepopulation: "runtime_queue",
|
|
13387
|
+
copyMode: "none",
|
|
13388
|
+
description: "Research job rows are runtime queue items."
|
|
13389
|
+
},
|
|
13390
|
+
{
|
|
13391
|
+
component: "kernel",
|
|
13392
|
+
table: "schemaEnumConfig",
|
|
13393
|
+
prepopulation: "required_template",
|
|
13394
|
+
copyMode: "template_global",
|
|
13395
|
+
scope: "global",
|
|
13396
|
+
uniqueKey: ["category", "value"],
|
|
13397
|
+
description: "Runtime-extensible enum defaults required by SDK graph APIs."
|
|
13398
|
+
},
|
|
13399
|
+
{
|
|
13400
|
+
component: "kernel",
|
|
13401
|
+
table: "stakeholderGroups",
|
|
13402
|
+
prepopulation: "runtime_data",
|
|
13403
|
+
copyMode: "none",
|
|
13404
|
+
description: "Stakeholder groups are tenant decision data."
|
|
13405
|
+
},
|
|
13406
|
+
{
|
|
13407
|
+
component: "kernel",
|
|
13408
|
+
table: "systemLogs",
|
|
13409
|
+
prepopulation: "runtime_log",
|
|
13410
|
+
copyMode: "none",
|
|
13411
|
+
description: "System logs are runtime telemetry."
|
|
13412
|
+
},
|
|
13413
|
+
{
|
|
13414
|
+
component: "kernel",
|
|
13415
|
+
table: "tasks",
|
|
13416
|
+
prepopulation: "runtime_data",
|
|
13417
|
+
copyMode: "none",
|
|
13418
|
+
description: "Tasks are tenant-authored work items."
|
|
13419
|
+
},
|
|
13420
|
+
{
|
|
13421
|
+
component: "kernel",
|
|
13422
|
+
table: "topics",
|
|
13423
|
+
prepopulation: "runtime_bootstrap",
|
|
13424
|
+
copyMode: "none",
|
|
13425
|
+
description: "Default topics are created by tenant provisioning, not copied from templates."
|
|
13426
|
+
},
|
|
13427
|
+
{
|
|
13428
|
+
component: "kernel",
|
|
13429
|
+
table: "workflowDefinitions",
|
|
13430
|
+
prepopulation: "optional_template",
|
|
13431
|
+
copyMode: "none",
|
|
13432
|
+
description: "Table-driven workflow definitions can be template data after the workflow engine leaves legacy mode."
|
|
13433
|
+
},
|
|
13434
|
+
{
|
|
13435
|
+
component: "kernel",
|
|
13436
|
+
table: "workflowPullRequests",
|
|
13437
|
+
prepopulation: "runtime_data",
|
|
13438
|
+
copyMode: "none",
|
|
13439
|
+
description: "Workflow pull requests are tenant workflow data."
|
|
13440
|
+
},
|
|
13441
|
+
{
|
|
13442
|
+
component: "kernel",
|
|
13443
|
+
table: "workflowStages",
|
|
13444
|
+
prepopulation: "optional_template",
|
|
13445
|
+
copyMode: "none",
|
|
13446
|
+
dependsOn: ["workflowDefinitions"],
|
|
13447
|
+
description: "Workflow stages can be template data after workflowDefinitions are enabled for bootstrap copying."
|
|
13448
|
+
},
|
|
13449
|
+
{
|
|
13450
|
+
component: "kernel",
|
|
13451
|
+
table: "worktreeBeliefCluster",
|
|
13452
|
+
prepopulation: "runtime_data",
|
|
13453
|
+
copyMode: "none",
|
|
13454
|
+
description: "Worktree cluster rows link runtime worktrees to runtime beliefs."
|
|
13455
|
+
},
|
|
13456
|
+
{
|
|
13457
|
+
component: "kernel",
|
|
13458
|
+
table: "worktrees",
|
|
13459
|
+
prepopulation: "runtime_data",
|
|
13460
|
+
copyMode: "none",
|
|
13461
|
+
description: "Worktrees are tenant/runtime planning data."
|
|
13462
|
+
},
|
|
13463
|
+
{
|
|
13464
|
+
component: "identity",
|
|
13465
|
+
table: "agents",
|
|
13466
|
+
prepopulation: "runtime_bootstrap",
|
|
13467
|
+
copyMode: "none",
|
|
13468
|
+
description: "Service agents are provisioned per tenant or service, not copied."
|
|
13469
|
+
},
|
|
13470
|
+
{
|
|
13471
|
+
component: "identity",
|
|
13472
|
+
table: "mcpWritePolicy",
|
|
13473
|
+
prepopulation: "required_template",
|
|
13474
|
+
copyMode: "template_global",
|
|
13475
|
+
scope: "global",
|
|
13476
|
+
uniqueKey: ["topicId", "role", "toolCategory"],
|
|
13477
|
+
description: "Global write policy defaults govern service and interactive MCP writes."
|
|
13478
|
+
},
|
|
13479
|
+
{
|
|
13480
|
+
component: "identity",
|
|
13481
|
+
table: "modelCallLogs",
|
|
13482
|
+
prepopulation: "runtime_log",
|
|
13483
|
+
copyMode: "none",
|
|
13484
|
+
description: "Model call logs are runtime telemetry."
|
|
13485
|
+
},
|
|
13486
|
+
{
|
|
13487
|
+
component: "identity",
|
|
13488
|
+
table: "modelFunctionSlots",
|
|
13489
|
+
prepopulation: "required_template",
|
|
13490
|
+
copyMode: "template_global",
|
|
13491
|
+
scope: "global",
|
|
13492
|
+
uniqueKey: ["slot"],
|
|
13493
|
+
description: "Function-to-model slots are required by model runtime resolution."
|
|
13494
|
+
},
|
|
13495
|
+
{
|
|
13496
|
+
component: "identity",
|
|
13497
|
+
table: "modelRegistry",
|
|
13498
|
+
prepopulation: "required_template",
|
|
13499
|
+
copyMode: "template_global",
|
|
13500
|
+
scope: "global",
|
|
13501
|
+
uniqueKey: ["key"],
|
|
13502
|
+
description: "Model catalog defaults are required by model runtime clients."
|
|
13503
|
+
},
|
|
13504
|
+
{
|
|
13505
|
+
component: "identity",
|
|
13506
|
+
table: "modelSlotConfigs",
|
|
13507
|
+
prepopulation: "required_template",
|
|
13508
|
+
copyMode: "template_global",
|
|
13509
|
+
scope: "global",
|
|
13510
|
+
uniqueKey: ["slot"],
|
|
13511
|
+
description: "Slot-level defaults are required before tenant overrides exist."
|
|
13512
|
+
},
|
|
13513
|
+
{
|
|
13514
|
+
component: "identity",
|
|
13515
|
+
table: "platformAudienceGrants",
|
|
13516
|
+
prepopulation: "runtime_data",
|
|
13517
|
+
copyMode: "none",
|
|
13518
|
+
description: "Audience grants are principal/group-specific access rows."
|
|
13519
|
+
},
|
|
13520
|
+
{
|
|
13521
|
+
component: "identity",
|
|
13522
|
+
table: "platformAudiences",
|
|
13523
|
+
prepopulation: "required_template",
|
|
13524
|
+
copyMode: "template_tenant_rewrite",
|
|
13525
|
+
scope: "tenant",
|
|
13526
|
+
uniqueKey: ["tenantId", "workspaceId", "audienceKey"],
|
|
13527
|
+
description: "Default tenant audience taxonomy rows are rewritten into each tenant."
|
|
13528
|
+
},
|
|
13529
|
+
{
|
|
13530
|
+
component: "identity",
|
|
13531
|
+
table: "platformPolicyDecisionLogs",
|
|
13532
|
+
prepopulation: "runtime_log",
|
|
13533
|
+
copyMode: "none",
|
|
13534
|
+
description: "Policy decisions are runtime audit logs."
|
|
13535
|
+
},
|
|
13536
|
+
{
|
|
13537
|
+
component: "identity",
|
|
13538
|
+
table: "projectGrants",
|
|
13539
|
+
prepopulation: "runtime_data",
|
|
13540
|
+
copyMode: "none",
|
|
13541
|
+
description: "Project/topic grants are principal or group-specific access rows."
|
|
13542
|
+
},
|
|
13543
|
+
{
|
|
13544
|
+
component: "identity",
|
|
13545
|
+
table: "reasoningPermissions",
|
|
13546
|
+
prepopulation: "runtime_data",
|
|
13547
|
+
copyMode: "none",
|
|
13548
|
+
description: "Reasoning permissions are principal-specific policy rows."
|
|
13549
|
+
},
|
|
13550
|
+
{
|
|
13551
|
+
component: "identity",
|
|
13552
|
+
table: "tenantApiKeys",
|
|
13553
|
+
prepopulation: "runtime_secret",
|
|
13554
|
+
copyMode: "none",
|
|
13555
|
+
description: "API keys are tenant credentials and must never be copied."
|
|
13556
|
+
},
|
|
13557
|
+
{
|
|
13558
|
+
component: "identity",
|
|
13559
|
+
table: "tenantConfig",
|
|
13560
|
+
prepopulation: "required_template",
|
|
13561
|
+
copyMode: "template_tenant_rewrite",
|
|
13562
|
+
scope: "tenant",
|
|
13563
|
+
uniqueKey: ["tenantId"],
|
|
13564
|
+
description: "Tenant-local config defaults are rewritten during bootstrap."
|
|
13565
|
+
},
|
|
13566
|
+
{
|
|
13567
|
+
component: "identity",
|
|
13568
|
+
table: "tenantIntegrations",
|
|
13569
|
+
prepopulation: "required_template",
|
|
13570
|
+
copyMode: "template_tenant_rewrite",
|
|
13571
|
+
scope: "tenant",
|
|
13572
|
+
uniqueKey: ["tenantId", "integrationKey"],
|
|
13573
|
+
description: "Non-secret integration descriptors are rewritten into each tenant."
|
|
13574
|
+
},
|
|
13575
|
+
{
|
|
13576
|
+
component: "identity",
|
|
13577
|
+
table: "tenantModelSlotBindings",
|
|
13578
|
+
prepopulation: "runtime_secret",
|
|
13579
|
+
copyMode: "none",
|
|
13580
|
+
description: "Tenant model slot bindings reference provider secrets and are runtime-only."
|
|
13581
|
+
},
|
|
13582
|
+
{
|
|
13583
|
+
component: "identity",
|
|
13584
|
+
table: "tenantPolicies",
|
|
13585
|
+
prepopulation: "required_template",
|
|
13586
|
+
copyMode: "template_tenant_rewrite",
|
|
13587
|
+
scope: "tenant",
|
|
13588
|
+
uniqueKey: ["tenantId", "workspaceId", "roleName"],
|
|
13589
|
+
description: "Default tenant policy roles are rewritten during bootstrap."
|
|
13590
|
+
},
|
|
13591
|
+
{
|
|
13592
|
+
component: "identity",
|
|
13593
|
+
table: "tenantProviderSecrets",
|
|
13594
|
+
prepopulation: "runtime_secret",
|
|
13595
|
+
copyMode: "none",
|
|
13596
|
+
description: "Provider secrets are credentials and must never be copied."
|
|
13597
|
+
},
|
|
13598
|
+
{
|
|
13599
|
+
component: "identity",
|
|
13600
|
+
table: "tenantProxyGatewayUsage",
|
|
13601
|
+
prepopulation: "runtime_log",
|
|
13602
|
+
copyMode: "none",
|
|
13603
|
+
description: "Proxy gateway usage rows are runtime telemetry."
|
|
13604
|
+
},
|
|
13605
|
+
{
|
|
13606
|
+
component: "identity",
|
|
13607
|
+
table: "tenantProxyTokenMints",
|
|
13608
|
+
prepopulation: "runtime_secret",
|
|
13609
|
+
copyMode: "none",
|
|
13610
|
+
description: "Proxy token mints are ephemeral secret-bearing runtime rows."
|
|
13611
|
+
},
|
|
13612
|
+
{
|
|
13613
|
+
component: "identity",
|
|
13614
|
+
table: "tenantSandboxAuditEvents",
|
|
13615
|
+
prepopulation: "runtime_log",
|
|
13616
|
+
copyMode: "none",
|
|
13617
|
+
description: "Sandbox audit rows are runtime security logs."
|
|
13618
|
+
},
|
|
13619
|
+
{
|
|
13620
|
+
component: "identity",
|
|
13621
|
+
table: "tenantSecrets",
|
|
13622
|
+
prepopulation: "runtime_secret",
|
|
13623
|
+
copyMode: "none",
|
|
13624
|
+
description: "Tenant secrets are credentials and must never be copied."
|
|
13625
|
+
},
|
|
13626
|
+
{
|
|
13627
|
+
component: "identity",
|
|
13628
|
+
table: "toolAcls",
|
|
13629
|
+
prepopulation: "required_template",
|
|
13630
|
+
copyMode: "template_global",
|
|
13631
|
+
scope: "global",
|
|
13632
|
+
uniqueKey: ["role", "toolName"],
|
|
13633
|
+
description: "Default role-to-tool grants are required for SDK/MCP tool access."
|
|
13634
|
+
},
|
|
13635
|
+
{
|
|
13636
|
+
component: "identity",
|
|
13637
|
+
table: "toolRegistry",
|
|
13638
|
+
prepopulation: "required_template",
|
|
13639
|
+
copyMode: "template_global",
|
|
13640
|
+
scope: "global",
|
|
13641
|
+
uniqueKey: ["toolName"],
|
|
13642
|
+
description: "Core tool catalog rows are required before pack or tenant tools exist."
|
|
13643
|
+
},
|
|
13644
|
+
{
|
|
13645
|
+
component: "identity",
|
|
13646
|
+
table: "users",
|
|
13647
|
+
prepopulation: "runtime_bootstrap",
|
|
13648
|
+
copyMode: "none",
|
|
13649
|
+
description: "Users are created from Clerk/MC principal resolution, not copied."
|
|
13650
|
+
}
|
|
13651
|
+
];
|
|
13652
|
+
TENANT_BOOTSTRAP_TABLE_REQUIREMENTS.filter(
|
|
13653
|
+
isCopyableSeedRequirement
|
|
13654
|
+
);
|
|
13655
|
+
TENANT_BOOTSTRAP_TABLE_REQUIREMENTS.filter(
|
|
13656
|
+
(entry) => !isCopyableSeedRequirement(entry)
|
|
13657
|
+
).map((entry) => entry.table);
|
|
13658
|
+
|
|
11710
13659
|
// ../contracts/src/v1/topics/v1.ts
|
|
11711
13660
|
var ROOT_TOPIC_ID = "n17tm38rwet7wqgzrmwahyt1z582590y";
|
|
11712
13661
|
|
|
@@ -11721,6 +13670,12 @@ function getMcpRuntimeContext() {
|
|
|
11721
13670
|
// ../../apps/mcp-server/src/scope.ts
|
|
11722
13671
|
var defaultTopicId = null;
|
|
11723
13672
|
var PUBLIC_TOPIC_PREFIX = "top_";
|
|
13673
|
+
function encodePublicTopicId(topicId) {
|
|
13674
|
+
if (!isNonEmptyString(topicId)) {
|
|
13675
|
+
return void 0;
|
|
13676
|
+
}
|
|
13677
|
+
return topicId.startsWith(PUBLIC_TOPIC_PREFIX) ? topicId : `${PUBLIC_TOPIC_PREFIX}${topicId}`;
|
|
13678
|
+
}
|
|
11724
13679
|
function decodePublicTopicId(topicId) {
|
|
11725
13680
|
if (!isNonEmptyString(topicId)) {
|
|
11726
13681
|
return void 0;
|
|
@@ -11746,6 +13701,27 @@ function readLucernJson() {
|
|
|
11746
13701
|
return null;
|
|
11747
13702
|
}
|
|
11748
13703
|
}
|
|
13704
|
+
function writeLucernJson(context) {
|
|
13705
|
+
try {
|
|
13706
|
+
const previous = readLucernJson() ?? {};
|
|
13707
|
+
const topicId = encodePublicTopicId(context.topicId ?? previous.topicId);
|
|
13708
|
+
const topicName = context.topicName ?? previous.topicName;
|
|
13709
|
+
const normalized = {
|
|
13710
|
+
...previous,
|
|
13711
|
+
...context,
|
|
13712
|
+
...topicId ? { topicId, projectId: topicId } : {},
|
|
13713
|
+
...topicName ? { topicName, projectName: topicName } : {},
|
|
13714
|
+
lastUpdated: context.lastUpdated ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
13715
|
+
};
|
|
13716
|
+
fs.writeFileSync(
|
|
13717
|
+
LUCERN_JSON_PATH,
|
|
13718
|
+
`${JSON.stringify(normalized, null, 2)}
|
|
13719
|
+
`,
|
|
13720
|
+
"utf-8"
|
|
13721
|
+
);
|
|
13722
|
+
} catch {
|
|
13723
|
+
}
|
|
13724
|
+
}
|
|
11749
13725
|
function isNonEmptyString(value) {
|
|
11750
13726
|
return typeof value === "string" && value.trim().length > 0;
|
|
11751
13727
|
}
|
|
@@ -12035,6 +14011,37 @@ var beliefHandlers = {
|
|
|
12035
14011
|
};
|
|
12036
14012
|
|
|
12037
14013
|
// ../../apps/mcp-server/src/handlers/bootstrap.ts
|
|
14014
|
+
function readString2(value) {
|
|
14015
|
+
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
14016
|
+
}
|
|
14017
|
+
function readNullableNumber(value) {
|
|
14018
|
+
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
14019
|
+
}
|
|
14020
|
+
function refreshLucernContextFromBuildSession(payload, args) {
|
|
14021
|
+
if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
|
|
14022
|
+
return;
|
|
14023
|
+
}
|
|
14024
|
+
const record = payload;
|
|
14025
|
+
const topicId = readString2(record.topicId);
|
|
14026
|
+
const worktreeId = readString2(record.worktreeId) ?? readString2(args.worktreeId);
|
|
14027
|
+
if (!topicId || !worktreeId) {
|
|
14028
|
+
return;
|
|
14029
|
+
}
|
|
14030
|
+
writeLucernJson({
|
|
14031
|
+
topicId,
|
|
14032
|
+
topicName: readString2(record.topicName),
|
|
14033
|
+
activeWorktree: {
|
|
14034
|
+
worktreeId,
|
|
14035
|
+
title: readString2(record.worktreeName) ?? readString2(record.title) ?? readString2(record.name) ?? worktreeId,
|
|
14036
|
+
status: readString2(record.status) ?? "unknown",
|
|
14037
|
+
campaign: readNullableNumber(record.campaign),
|
|
14038
|
+
lane: readString2(record.lane) ?? null,
|
|
14039
|
+
orderInLane: readNullableNumber(record.orderInLane),
|
|
14040
|
+
gate: readString2(record.gate) ?? null,
|
|
14041
|
+
branch: readString2(record.branch) ?? readString2(args.branch) ?? null
|
|
14042
|
+
}
|
|
14043
|
+
});
|
|
14044
|
+
}
|
|
12038
14045
|
var bootstrapHandlers = {
|
|
12039
14046
|
async generate_session_handoff(args, ctx) {
|
|
12040
14047
|
return formatSdkResult(
|
|
@@ -12042,9 +14049,11 @@ var bootstrapHandlers = {
|
|
|
12042
14049
|
);
|
|
12043
14050
|
},
|
|
12044
14051
|
async begin_build_session(args, ctx) {
|
|
12045
|
-
|
|
14052
|
+
const payload = formatSdkResult(
|
|
12046
14053
|
await getSdkClient(ctx).mcp.beginBuildSession(args)
|
|
12047
14054
|
);
|
|
14055
|
+
refreshLucernContextFromBuildSession(payload, args);
|
|
14056
|
+
return payload;
|
|
12048
14057
|
}
|
|
12049
14058
|
};
|
|
12050
14059
|
|
|
@@ -12587,6 +14596,14 @@ var generatedFunctionSurfaceHandlers = {
|
|
|
12587
14596
|
)
|
|
12588
14597
|
);
|
|
12589
14598
|
},
|
|
14599
|
+
async begin_build_session(args, ctx) {
|
|
14600
|
+
return formatSdkResult(
|
|
14601
|
+
await getSdkClient(ctx).raw.functionSurface.beginBuildSession(
|
|
14602
|
+
stripInternalArgs(args),
|
|
14603
|
+
idempotencyKeyFrom(args)
|
|
14604
|
+
)
|
|
14605
|
+
);
|
|
14606
|
+
},
|
|
12590
14607
|
async bisect_confidence(args, ctx) {
|
|
12591
14608
|
return formatSdkResult(
|
|
12592
14609
|
await getSdkClient(ctx).raw.functionSurface.bisectConfidence(
|
|
@@ -13059,6 +15076,14 @@ var generatedFunctionSurfaceHandlers = {
|
|
|
13059
15076
|
)
|
|
13060
15077
|
);
|
|
13061
15078
|
},
|
|
15079
|
+
async list_graph_intelligence_queries(args, ctx) {
|
|
15080
|
+
return formatSdkResult(
|
|
15081
|
+
await getSdkClient(ctx).raw.functionSurface.listGraphIntelligenceQueries(
|
|
15082
|
+
stripInternalArgs(args),
|
|
15083
|
+
idempotencyKeyFrom(args)
|
|
15084
|
+
)
|
|
15085
|
+
);
|
|
15086
|
+
},
|
|
13062
15087
|
async list_lenses(args, ctx) {
|
|
13063
15088
|
return formatSdkResult(
|
|
13064
15089
|
await getSdkClient(ctx).raw.functionSurface.listLenses(
|
|
@@ -13243,6 +15268,14 @@ var generatedFunctionSurfaceHandlers = {
|
|
|
13243
15268
|
)
|
|
13244
15269
|
);
|
|
13245
15270
|
},
|
|
15271
|
+
async run_graph_intelligence_query(args, ctx) {
|
|
15272
|
+
return formatSdkResult(
|
|
15273
|
+
await getSdkClient(ctx).raw.functionSurface.runGraphIntelligenceQuery(
|
|
15274
|
+
stripInternalArgs(args),
|
|
15275
|
+
idempotencyKeyFrom(args)
|
|
15276
|
+
)
|
|
15277
|
+
);
|
|
15278
|
+
},
|
|
13246
15279
|
async search_beliefs(args, ctx) {
|
|
13247
15280
|
return formatSdkResult(
|
|
13248
15281
|
await getSdkClient(ctx).raw.functionSurface.searchBeliefs(
|
|
@@ -13455,7 +15488,7 @@ function getConvex(ctx) {
|
|
|
13455
15488
|
}
|
|
13456
15489
|
return requireMcpConvex(ctx, "topic-resolver");
|
|
13457
15490
|
}
|
|
13458
|
-
function
|
|
15491
|
+
function readString3(value) {
|
|
13459
15492
|
if (typeof value !== "string") {
|
|
13460
15493
|
return void 0;
|
|
13461
15494
|
}
|
|
@@ -13466,13 +15499,13 @@ function readStringArray2(value) {
|
|
|
13466
15499
|
if (!Array.isArray(value)) {
|
|
13467
15500
|
return [];
|
|
13468
15501
|
}
|
|
13469
|
-
return value.map((entry) =>
|
|
15502
|
+
return value.map((entry) => readString3(entry)).filter((entry) => Boolean(entry));
|
|
13470
15503
|
}
|
|
13471
15504
|
function asRecord2(value) {
|
|
13472
15505
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
13473
15506
|
}
|
|
13474
15507
|
function normalizeTopicId(value) {
|
|
13475
|
-
const normalized =
|
|
15508
|
+
const normalized = readString3(value);
|
|
13476
15509
|
if (!normalized) {
|
|
13477
15510
|
return void 0;
|
|
13478
15511
|
}
|
|
@@ -13484,7 +15517,7 @@ function normalizeTopicId(value) {
|
|
|
13484
15517
|
}
|
|
13485
15518
|
}
|
|
13486
15519
|
function normalizeExternalId(value, prefix) {
|
|
13487
|
-
const normalized =
|
|
15520
|
+
const normalized = readString3(value);
|
|
13488
15521
|
if (!normalized) {
|
|
13489
15522
|
return void 0;
|
|
13490
15523
|
}
|
|
@@ -13506,7 +15539,7 @@ function normalizeToken(value) {
|
|
|
13506
15539
|
return normalized;
|
|
13507
15540
|
}
|
|
13508
15541
|
function tokenize(value) {
|
|
13509
|
-
const normalized =
|
|
15542
|
+
const normalized = readString3(value);
|
|
13510
15543
|
if (!normalized) {
|
|
13511
15544
|
return [];
|
|
13512
15545
|
}
|
|
@@ -13621,22 +15654,22 @@ function scoreTopicMatch(topic, input) {
|
|
|
13621
15654
|
}
|
|
13622
15655
|
function normalizeTopicCandidate(value) {
|
|
13623
15656
|
const record = asRecord2(value);
|
|
13624
|
-
const rawId =
|
|
13625
|
-
const name =
|
|
15657
|
+
const rawId = readString3(record._id) ?? readString3(record.id) ?? normalizeTopicId(readString3(record.topicId)) ?? normalizeTopicId(readString3(record.projectId));
|
|
15658
|
+
const name = readString3(record.name);
|
|
13626
15659
|
if (!rawId || !name) {
|
|
13627
15660
|
return null;
|
|
13628
15661
|
}
|
|
13629
15662
|
return {
|
|
13630
15663
|
rawId,
|
|
13631
15664
|
name,
|
|
13632
|
-
description:
|
|
13633
|
-
type:
|
|
13634
|
-
parentTopicId: normalizeTopicId(
|
|
13635
|
-
tenantId:
|
|
13636
|
-
workspaceId:
|
|
13637
|
-
status:
|
|
15665
|
+
description: readString3(record.description),
|
|
15666
|
+
type: readString3(record.type),
|
|
15667
|
+
parentTopicId: normalizeTopicId(readString3(record.parentTopicId)) ?? null,
|
|
15668
|
+
tenantId: readString3(record.tenantId),
|
|
15669
|
+
workspaceId: readString3(record.workspaceId),
|
|
15670
|
+
status: readString3(record.status),
|
|
13638
15671
|
metadata: asRecord2(record.metadata),
|
|
13639
|
-
globalId:
|
|
15672
|
+
globalId: readString3(record.globalId)
|
|
13640
15673
|
};
|
|
13641
15674
|
}
|
|
13642
15675
|
function topicMatchesScope(topic, tenantId, workspaceId) {
|
|
@@ -13664,7 +15697,7 @@ async function fetchTopicById(ctx, topicId) {
|
|
|
13664
15697
|
function readRecordTopicId(value) {
|
|
13665
15698
|
const record = asRecord2(value);
|
|
13666
15699
|
return normalizeTopicId(
|
|
13667
|
-
|
|
15700
|
+
readString3(record.topicId) ?? readString3(record.projectId) ?? readString3(asRecord2(record.metadata).topicId)
|
|
13668
15701
|
);
|
|
13669
15702
|
}
|
|
13670
15703
|
async function fetchRecordTopicId(ctx, reference, args) {
|
|
@@ -13683,7 +15716,7 @@ async function resolveBeliefTopicId(ctx, beliefId) {
|
|
|
13683
15716
|
}
|
|
13684
15717
|
async function resolveCommonBeliefTopicId(ctx, beliefIds) {
|
|
13685
15718
|
const normalizedBeliefIds = (beliefIds ?? []).filter(
|
|
13686
|
-
(beliefId) => Boolean(
|
|
15719
|
+
(beliefId) => Boolean(readString3(beliefId))
|
|
13687
15720
|
);
|
|
13688
15721
|
if (normalizedBeliefIds.length === 0) {
|
|
13689
15722
|
return void 0;
|
|
@@ -13745,7 +15778,7 @@ function compactWhitespace(value) {
|
|
|
13745
15778
|
return value.replace(/\s+/g, " ").trim();
|
|
13746
15779
|
}
|
|
13747
15780
|
function deriveTopicName(input, parentTopic) {
|
|
13748
|
-
const textualHint =
|
|
15781
|
+
const textualHint = readString3(input.topicHint);
|
|
13749
15782
|
if (textualHint && tokenize(textualHint).length > 0) {
|
|
13750
15783
|
return titleCase(compactWhitespace(textualHint)).slice(0, 60);
|
|
13751
15784
|
}
|
|
@@ -13761,7 +15794,7 @@ function deriveTopicName(input, parentTopic) {
|
|
|
13761
15794
|
if (summary.length > 0) {
|
|
13762
15795
|
return titleCase(summary.slice(0, 60));
|
|
13763
15796
|
}
|
|
13764
|
-
const sourceRef =
|
|
15797
|
+
const sourceRef = readString3(input.sourceRef);
|
|
13765
15798
|
if (sourceRef) {
|
|
13766
15799
|
return titleCase(compactWhitespace(sourceRef.replace(/[-_:/]+/g, " "))).slice(0, 60);
|
|
13767
15800
|
}
|
|
@@ -13770,7 +15803,7 @@ function deriveTopicName(input, parentTopic) {
|
|
|
13770
15803
|
async function createChildTopic(ctx, parentTopic, input) {
|
|
13771
15804
|
const convex = getConvex(ctx);
|
|
13772
15805
|
const desiredTenantId = ctx.tenantId;
|
|
13773
|
-
const desiredWorkspaceId =
|
|
15806
|
+
const desiredWorkspaceId = readString3(input.workspaceId) ?? ctx.workspaceId;
|
|
13774
15807
|
const createdBy = ctx.principalId ?? ctx.userId;
|
|
13775
15808
|
const created = await convex.mutation(api.topics.create, {
|
|
13776
15809
|
name: deriveTopicName(input, parentTopic),
|
|
@@ -13790,7 +15823,7 @@ async function createChildTopic(ctx, parentTopic, input) {
|
|
|
13790
15823
|
}
|
|
13791
15824
|
});
|
|
13792
15825
|
const createdRecord = asRecord2(created);
|
|
13793
|
-
const createdId =
|
|
15826
|
+
const createdId = readString3(createdRecord.id) ?? readString3(createdRecord.topicId) ?? readString3(createdRecord._id);
|
|
13794
15827
|
const hydrated = await fetchTopicById(ctx, createdId);
|
|
13795
15828
|
if (!hydrated) {
|
|
13796
15829
|
throw new Error("[topic-resolver] Auto-created topic could not be reloaded.");
|
|
@@ -13810,11 +15843,32 @@ function pushTrace(trace, topic, score) {
|
|
|
13810
15843
|
score
|
|
13811
15844
|
});
|
|
13812
15845
|
}
|
|
15846
|
+
function pickBestTopic(topics2, input) {
|
|
15847
|
+
const ranked = topics2.filter((topic) => topic.status !== "archived").map((topic) => ({
|
|
15848
|
+
topic,
|
|
15849
|
+
score: scoreTopicMatch(topic, input)
|
|
15850
|
+
})).sort((left, right) => {
|
|
15851
|
+
if (right.score !== left.score) {
|
|
15852
|
+
return right.score - left.score;
|
|
15853
|
+
}
|
|
15854
|
+
const leftName = left.topic.name.trim().toLowerCase();
|
|
15855
|
+
const rightName = right.topic.name.trim().toLowerCase();
|
|
15856
|
+
return leftName.localeCompare(rightName);
|
|
15857
|
+
});
|
|
15858
|
+
return ranked[0]?.topic ?? null;
|
|
15859
|
+
}
|
|
15860
|
+
function pickFallbackRootTopic(topics2, input) {
|
|
15861
|
+
const parentless = topics2.filter((topic) => !topic.parentTopicId);
|
|
15862
|
+
return pickBestTopic(parentless, input) ?? pickBestTopic(topics2, input);
|
|
15863
|
+
}
|
|
13813
15864
|
async function loadTopicUniverse(ctx, input) {
|
|
13814
15865
|
const desiredTenantId = ctx.tenantId;
|
|
13815
|
-
const desiredWorkspaceId =
|
|
15866
|
+
const desiredWorkspaceId = readString3(input.workspaceId) ?? ctx.workspaceId;
|
|
13816
15867
|
const rawTopics = await fetchTopicTree(ctx);
|
|
13817
|
-
const
|
|
15868
|
+
const scopedTopics = rawTopics.filter(
|
|
15869
|
+
(topic) => topicMatchesScope(topic, desiredTenantId, desiredWorkspaceId)
|
|
15870
|
+
);
|
|
15871
|
+
const root = rawTopics.find((topic) => topic.rawId === ROOT_TOPIC_ID) ?? await fetchTopicById(ctx, ROOT_TOPIC_ID) ?? pickFallbackRootTopic(scopedTopics, input) ?? null;
|
|
13818
15872
|
if (!root) {
|
|
13819
15873
|
throw new Error("[topic-resolver] Root topic not found.");
|
|
13820
15874
|
}
|
|
@@ -14657,7 +16711,13 @@ var scopeContextHandlers = {
|
|
|
14657
16711
|
packWeightOverrides: Array.isArray(args.packWeightOverrides) ? args.packWeightOverrides : void 0
|
|
14658
16712
|
})
|
|
14659
16713
|
);
|
|
14660
|
-
|
|
16714
|
+
const publicContext = toPublicCompiledContext(compiled);
|
|
16715
|
+
writeLucernJson({
|
|
16716
|
+
topicId: publicContext.topicId ?? topicId,
|
|
16717
|
+
topicName: publicContext.topicName,
|
|
16718
|
+
activeWorktree: null
|
|
16719
|
+
});
|
|
16720
|
+
return publicContext;
|
|
14661
16721
|
},
|
|
14662
16722
|
async record_scope_learning(args, ctx) {
|
|
14663
16723
|
const explicitTopicId = readString(readTopicIdArg(args));
|
|
@@ -14852,20 +16912,27 @@ var worktreeHandlers = {
|
|
|
14852
16912
|
},
|
|
14853
16913
|
async merge(args, ctx) {
|
|
14854
16914
|
const record = asRecord(args);
|
|
14855
|
-
const outcomes = Array.isArray(record.outcomes) ? record.outcomes
|
|
16915
|
+
const outcomes = Array.isArray(record.outcomes) ? record.outcomes.map((entry) => {
|
|
16916
|
+
const finding = readString(entry);
|
|
16917
|
+
if (finding) {
|
|
16918
|
+
return finding;
|
|
16919
|
+
}
|
|
16920
|
+
const row = asRecord(entry);
|
|
16921
|
+
if (!Object.keys(row).length) {
|
|
16922
|
+
return null;
|
|
16923
|
+
}
|
|
16924
|
+
return {
|
|
16925
|
+
beliefId: readString(row.beliefId) ?? "",
|
|
16926
|
+
confidence: readNumber(row.confidence) ?? Number.NaN,
|
|
16927
|
+
rationale: readString(row.rationale) ?? ""
|
|
16928
|
+
};
|
|
16929
|
+
}).filter((entry) => entry !== null) : [];
|
|
14856
16930
|
return formatSdkResult(
|
|
14857
16931
|
await getSdkClient(ctx).worktrees.merge(
|
|
14858
16932
|
readString(record.worktreeId ?? record.id) ?? "",
|
|
14859
16933
|
{
|
|
14860
16934
|
summary: readString(record.summary),
|
|
14861
|
-
outcomes
|
|
14862
|
-
const row = asRecord(entry);
|
|
14863
|
-
return {
|
|
14864
|
-
beliefId: readString(row.beliefId) ?? "",
|
|
14865
|
-
confidence: readNumber(row.confidence) ?? Number.NaN,
|
|
14866
|
-
rationale: readString(row.rationale) ?? ""
|
|
14867
|
-
};
|
|
14868
|
-
})
|
|
16935
|
+
outcomes
|
|
14869
16936
|
}
|
|
14870
16937
|
)
|
|
14871
16938
|
);
|