@lucern/contracts 0.3.0-alpha.0 → 0.3.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/dist/dsl.js +3 -0
  2. package/dist/dsl.js.map +1 -1
  3. package/dist/function-registry/beliefs.d.ts +11 -51
  4. package/dist/function-registry/beliefs.js +445 -94
  5. package/dist/function-registry/beliefs.js.map +1 -1
  6. package/dist/function-registry/coding.d.ts +7 -31
  7. package/dist/function-registry/coding.js +264 -81
  8. package/dist/function-registry/coding.js.map +1 -1
  9. package/dist/function-registry/context.d.ts +4 -16
  10. package/dist/function-registry/context.js +223 -62
  11. package/dist/function-registry/context.js.map +1 -1
  12. package/dist/function-registry/contracts.d.ts +4 -16
  13. package/dist/function-registry/contracts.js +195 -54
  14. package/dist/function-registry/contracts.js.map +1 -1
  15. package/dist/function-registry/coordination.d.ts +10 -46
  16. package/dist/function-registry/coordination.js +208 -57
  17. package/dist/function-registry/coordination.js.map +1 -1
  18. package/dist/function-registry/edges.d.ts +10 -18
  19. package/dist/function-registry/edges.js +343 -68
  20. package/dist/function-registry/edges.js.map +1 -1
  21. package/dist/function-registry/evidence.d.ts +17 -49
  22. package/dist/function-registry/evidence.js +395 -99
  23. package/dist/function-registry/evidence.js.map +1 -1
  24. package/dist/function-registry/graph.d.ts +14 -66
  25. package/dist/function-registry/graph.js +225 -65
  26. package/dist/function-registry/graph.js.map +1 -1
  27. package/dist/function-registry/helpers.d.ts +6 -8
  28. package/dist/function-registry/helpers.js +204 -55
  29. package/dist/function-registry/helpers.js.map +1 -1
  30. package/dist/function-registry/identity.d.ts +4 -16
  31. package/dist/function-registry/identity.js +195 -54
  32. package/dist/function-registry/identity.js.map +1 -1
  33. package/dist/function-registry/index.d.ts +2 -2
  34. package/dist/function-registry/index.js +204 -55
  35. package/dist/function-registry/index.js.map +1 -1
  36. package/dist/function-registry/judgments.d.ts +5 -13
  37. package/dist/function-registry/judgments.js +214 -63
  38. package/dist/function-registry/judgments.js.map +1 -1
  39. package/dist/function-registry/legacy.d.ts +2 -6
  40. package/dist/function-registry/legacy.js +195 -54
  41. package/dist/function-registry/legacy.js.map +1 -1
  42. package/dist/function-registry/lenses.d.ts +5 -21
  43. package/dist/function-registry/lenses.js +241 -58
  44. package/dist/function-registry/lenses.js.map +1 -1
  45. package/dist/function-registry/manifest.d.ts +3 -3
  46. package/dist/function-registry/manifest.js +1 -0
  47. package/dist/function-registry/manifest.js.map +1 -1
  48. package/dist/function-registry/ontologies.d.ts +12 -56
  49. package/dist/function-registry/ontologies.js +227 -77
  50. package/dist/function-registry/ontologies.js.map +1 -1
  51. package/dist/function-registry/pipeline.d.ts +4 -16
  52. package/dist/function-registry/pipeline.js +207 -55
  53. package/dist/function-registry/pipeline.js.map +1 -1
  54. package/dist/function-registry/questions.d.ts +13 -61
  55. package/dist/function-registry/questions.js +281 -82
  56. package/dist/function-registry/questions.js.map +1 -1
  57. package/dist/function-registry/tasks.d.ts +5 -21
  58. package/dist/function-registry/tasks.js +265 -58
  59. package/dist/function-registry/tasks.js.map +1 -1
  60. package/dist/function-registry/topics.d.ts +6 -26
  61. package/dist/function-registry/topics.js +214 -57
  62. package/dist/function-registry/topics.js.map +1 -1
  63. package/dist/function-registry/types.d.ts +2 -2
  64. package/dist/function-registry/worktrees.d.ts +49 -46
  65. package/dist/function-registry/worktrees.js +326 -81
  66. package/dist/function-registry/worktrees.js.map +1 -1
  67. package/dist/generated/convexSchemas.js +4 -3
  68. package/dist/generated/convexSchemas.js.map +1 -1
  69. package/dist/generated/schema-manifest.json +55 -3
  70. package/dist/generated/tableOwnership.d.ts +2 -1
  71. package/dist/generated/tableOwnership.js +2 -0
  72. package/dist/generated/tableOwnership.js.map +1 -1
  73. package/dist/generated/tier-expectations.json +6 -3
  74. package/dist/index-CV-0_VWJ.d.ts +25 -0
  75. package/dist/index.d.ts +414 -4
  76. package/dist/index.js +665 -62
  77. package/dist/index.js.map +1 -1
  78. package/dist/schema-helpers/validators.d.ts +1 -1
  79. package/dist/schema-helpers/validators.js +1 -1
  80. package/dist/schema-helpers/validators.js.map +1 -1
  81. package/dist/schemas/component-table-manifest.d.ts +74 -0
  82. package/dist/schemas/component-table-manifest.js +26 -0
  83. package/dist/schemas/component-table-manifest.js.map +1 -0
  84. package/dist/schemas/index.d.ts +2 -0
  85. package/dist/schemas/index.js +68 -10
  86. package/dist/schemas/index.js.map +1 -1
  87. package/dist/schemas/manifest.d.ts +110 -45
  88. package/dist/schemas/manifest.js +36 -9
  89. package/dist/schemas/manifest.js.map +1 -1
  90. package/dist/schemas/sl-opinion.d.ts +31 -0
  91. package/dist/schemas/sl-opinion.js +19 -0
  92. package/dist/schemas/sl-opinion.js.map +1 -0
  93. package/dist/schemas/tables/kernel/epistemic.d.ts +6 -4
  94. package/dist/schemas/tables/kernel/epistemic.js +6 -4
  95. package/dist/schemas/tables/kernel/epistemic.js.map +1 -1
  96. package/dist/schemas/tables/kernel/infra.d.ts +13 -1
  97. package/dist/schemas/tables/kernel/infra.js +23 -1
  98. package/dist/schemas/tables/kernel/infra.js.map +1 -1
  99. package/dist/schemas/tables/kernel/worktree.d.ts +4 -4
  100. package/dist/schemas/tables/kernel/worktree.js +6 -4
  101. package/dist/schemas/tables/kernel/worktree.js.map +1 -1
  102. package/dist/schemas/tables/mc/runtime.d.ts +1 -1
  103. package/dist/schemas/tables/mc/runtime.js +1 -1
  104. package/dist/schemas/tables/mc/runtime.js.map +1 -1
  105. package/dist/sdk-methods.contract.d.ts +5 -2
  106. package/dist/{sdk-tools.contract-C2kQN_Xk.d.ts → sdk-tools.contract-S4ia0TTo.d.ts} +1 -1
  107. package/dist/sdk-tools.contract.d.ts +2 -2
  108. package/dist/sdk-tools.contract.js +154 -51
  109. package/dist/sdk-tools.contract.js.map +1 -1
  110. package/dist/{tool-contracts-WCnuE9DW.d.ts → tool-contracts-C92-9ueT.d.ts} +5 -3
  111. package/dist/tool-contracts.d.ts +1 -1
  112. package/dist/tool-contracts.js +155 -52
  113. package/dist/tool-contracts.js.map +1 -1
  114. package/dist/workflow-runtime.contract.js +1 -1
  115. package/dist/workflow-runtime.contract.js.map +1 -1
  116. package/package.json +19 -1
  117. package/dist/index-DoDXl8KS.d.ts +0 -19
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { v } from 'convex/values';
2
3
 
3
4
  // src/function-registry/helpers.ts
4
5
 
@@ -14,7 +15,7 @@ var LENS_PERSPECTIVE_TYPES = [
14
15
  // src/tool-contracts.ts
15
16
  var CREATE_BELIEF = {
16
17
  name: "create_belief",
17
- description: "Commit a new belief (knowledge unit) to the reasoning graph. Like `git commit` \u2014 creates an atomic, traceable knowledge object with a mandatory prior. Creation stores the vacuous opinion `(0, 0, 1, a)`; use modulate_confidence to record the first evidential update.",
18
+ description: "Commit a new belief (knowledge unit) to the reasoning graph. Like `git commit` \u2014 creates an atomic, traceable knowledge object with a prior. Creation stores the vacuous opinion `(0, 0, 1, a)`; use modulate_confidence to record the first evidential update.",
18
19
  parameters: {
19
20
  canonicalText: {
20
21
  type: "string",
@@ -26,7 +27,7 @@ var CREATE_BELIEF = {
26
27
  },
27
28
  baseRate: {
28
29
  type: "number",
29
- description: "Required prior probability used to seed the vacuous opinion `(0, 0, 1, a)` at creation time."
30
+ description: "Prior probability used to seed the vacuous opinion `(0, 0, 1, a)` at creation time. Defaults to 0.5 when omitted."
30
31
  },
31
32
  beliefType: {
32
33
  type: "string",
@@ -37,7 +38,7 @@ var CREATE_BELIEF = {
37
38
  description: "Optional extra metadata merged into the node (e.g., { codeAnchors: ['path/to/file.ts'] } for coding intelligence)"
38
39
  }
39
40
  },
40
- required: ["canonicalText", "baseRate"],
41
+ required: ["canonicalText"],
41
42
  response: {
42
43
  description: "The created canonical belief record",
43
44
  fields: {
@@ -100,7 +101,7 @@ var REFINE_BELIEF = {
100
101
  };
101
102
  var MODULATE_CONFIDENCE = {
102
103
  name: "modulate_confidence",
103
- description: "Record a confidence change for a belief. Like `git commit` to the credence log \u2014 an atomic, append-only write. Each modulation is a new entry in the history, not an overwrite. Scoring happens via merge; this tool records the individual data points. Pass the full subjective-logic tuple (`belief`, `disbelief`, `uncertainty`, `baseRate`) directly. If a caller only has a scalar probability, use `@lucern/sdk` helpers `opinionFromBaseRate`, `opinionFromDogmatic`, or `opinionFromProjected` to name the intended interpretation before calling this tool. Triggers: evidence_added, evidence_removed, contradiction_detected, contradiction_resolved, agent_assessment, worktree_outcome, worktree_completed, fusion, discount, deduction, manual, decay.",
104
+ description: "Record a confidence change for a belief. Like `git commit` to the credence log \u2014 an atomic, append-only write. Each modulation is a new entry in the history, not an overwrite. Scoring happens via merge; this tool records the individual data points. Pass the full subjective-logic tuple (`belief`, `disbelief`, `uncertainty`, `baseRate`) directly. If a caller only has a scalar probability, use `@lucern/sdk` helpers `opinionFromBaseRate`, `opinionFromDogmatic`, or `opinionFromProjected` to name the intended interpretation before calling this tool. Every modulation must cite a truth-bearing artifact: triggeringEvidenceId, triggeringQuestionId, triggeringAnswerId, triggeringContradictionId, or triggeringWorktreeId. Triggers: evidence_added, evidence_removed, contradiction_detected, contradiction_resolved, agent_assessment, worktree_outcome, worktree_completed, fusion, discount, deduction.",
104
105
  parameters: {
105
106
  nodeId: { type: "string", description: "The belief to score" },
106
107
  belief: {
@@ -119,9 +120,9 @@ var MODULATE_CONFIDENCE = {
119
120
  type: "number",
120
121
  description: "Subjective-logic base rate `a` in [0, 1]. Required for tuple payloads."
121
122
  },
122
- confidence: {
123
- type: "number",
124
- description: "Deprecated scalar confidence value in [0, 1]. Scalar-only payloads are rejected as AMBIGUOUS_SCALAR."
123
+ worktreeId: {
124
+ type: "string",
125
+ description: "Completed worktree that tested this belief when confidence policy requires merge-backed scoring."
125
126
  },
126
127
  trigger: {
127
128
  type: "string",
@@ -136,17 +137,43 @@ var MODULATE_CONFIDENCE = {
136
137
  "worktree_completed",
137
138
  "fusion",
138
139
  "discount",
139
- "deduction",
140
- "manual",
141
- "decay"
140
+ "deduction"
142
141
  ]
143
142
  },
143
+ triggeringEvidenceId: {
144
+ type: "string",
145
+ description: "Evidence node that caused an evidence-triggered modulation"
146
+ },
147
+ triggeringQuestionId: {
148
+ type: "string",
149
+ description: "Answered question whose resolution supports this modulation"
150
+ },
151
+ triggeringAnswerId: {
152
+ type: "string",
153
+ description: "Answer node whose content supports this modulation"
154
+ },
155
+ triggeringContradictionId: {
156
+ type: "string",
157
+ description: "Contradiction record that caused a contradiction-triggered modulation"
158
+ },
159
+ triggeringWorktreeId: {
160
+ type: "string",
161
+ description: "Completed worktree whose outcome caused a worktree-triggered modulation"
162
+ },
144
163
  rationale: {
145
164
  type: "string",
146
165
  description: "Human-readable explanation of why confidence changed"
147
166
  }
148
167
  },
149
- required: ["nodeId", "trigger", "rationale"],
168
+ required: [
169
+ "nodeId",
170
+ "belief",
171
+ "disbelief",
172
+ "uncertainty",
173
+ "baseRate",
174
+ "trigger",
175
+ "rationale"
176
+ ],
150
177
  response: {
151
178
  description: "Confidence modulation result",
152
179
  fields: {
@@ -340,7 +367,7 @@ var ADD_EVIDENCE = {
340
367
  description: "Optional extra metadata merged into the node (e.g., { codeAnchors: ['path/to/file.ts'], failedApproach: true } for coding intelligence)"
341
368
  }
342
369
  },
343
- required: ["canonicalText", "targetNodeId"],
370
+ required: ["canonicalText", "targetNodeId", "reasoning"],
344
371
  response: {
345
372
  description: "The created evidence node and its edge",
346
373
  fields: {
@@ -421,9 +448,21 @@ var ADD_WORKTREE = {
421
448
  type: "string",
422
449
  description: "Optional domain pack whose shaping hooks should influence generated questions and tasks"
423
450
  },
424
- executionOrder: {
451
+ campaign: {
452
+ type: "number",
453
+ description: "Top-level pipeline campaign number. Campaigns define the outer execution slice."
454
+ },
455
+ lane: {
456
+ type: "string",
457
+ description: "GitButler-aligned workstream lane name inside the campaign."
458
+ },
459
+ laneOrderInCampaign: {
460
+ type: "number",
461
+ description: "Ordering for this lane within its campaign."
462
+ },
463
+ orderInLane: {
425
464
  type: "number",
426
- description: "Global execution order for this worktree"
465
+ description: "Position of this worktree inside its lane."
427
466
  },
428
467
  dependsOn: {
429
468
  type: "array",
@@ -1081,6 +1120,10 @@ var CREATE_EVIDENCE = {
1081
1120
  type: "object",
1082
1121
  description: "Optional metadata merged into the canonical evidence node"
1083
1122
  },
1123
+ rationale: {
1124
+ type: "string",
1125
+ description: "Why this evidence should enter the reasoning graph"
1126
+ },
1084
1127
  title: { type: "string", description: "Optional short title" },
1085
1128
  content: { type: "string", description: "Optional long-form content" },
1086
1129
  contentType: {
@@ -1089,7 +1132,7 @@ var CREATE_EVIDENCE = {
1089
1132
  },
1090
1133
  kind: { type: "string", description: "Optional evidence kind" }
1091
1134
  },
1092
- required: ["text"],
1135
+ required: ["text", "rationale"],
1093
1136
  response: {
1094
1137
  description: "The created canonical evidence record",
1095
1138
  fields: {
@@ -1137,7 +1180,7 @@ var LIST_EVIDENCE = {
1137
1180
  limit: { type: "number", description: "Max results" },
1138
1181
  cursor: { type: "string", description: "Pagination cursor" }
1139
1182
  },
1140
- required: [],
1183
+ required: ["topicId"],
1141
1184
  response: {
1142
1185
  description: "Canonical evidence page",
1143
1186
  fields: {
@@ -1322,6 +1365,7 @@ var ANSWER_QUESTION = {
1322
1365
  description: "Answer a question with optional evidence links. Like `git commit` on the question thread \u2014 records the answer and closes the loop with a canonical answered state.",
1323
1366
  parameters: {
1324
1367
  id: { type: "string", description: "Canonical question ID" },
1368
+ topicId: { type: "string", description: "Topic scope for the answer" },
1325
1369
  text: { type: "string", description: "Answer text" },
1326
1370
  confidence: {
1327
1371
  type: "string",
@@ -1334,7 +1378,7 @@ var ANSWER_QUESTION = {
1334
1378
  },
1335
1379
  rationale: { type: "string", description: "Why this answer is credible" }
1336
1380
  },
1337
- required: ["id", "text"],
1381
+ required: ["id", "topicId", "text"],
1338
1382
  response: {
1339
1383
  description: "Answer result",
1340
1384
  fields: {
@@ -1553,6 +1597,10 @@ var LIST_BELIEFS = {
1553
1597
  minConfidence: {
1554
1598
  type: "number",
1555
1599
  description: "Minimum confidence threshold"
1600
+ },
1601
+ limit: {
1602
+ type: "number",
1603
+ description: "Maximum results"
1556
1604
  }
1557
1605
  },
1558
1606
  required: ["topicId"],
@@ -1569,20 +1617,37 @@ var LIST_BELIEFS = {
1569
1617
  };
1570
1618
  var LIST_WORKTREES = {
1571
1619
  name: "list_worktrees",
1572
- description: "List all worktrees for a topic. Like `git worktree list` \u2014 shows active and completed investigation branches with their phase, status, and belief counts.",
1620
+ description: "List all worktrees for a topic. Like `git worktree list` \u2014 shows active and completed investigation branches with lifecycle phase, pipeline campaign/lane, status, and belief counts.",
1573
1621
  parameters: {
1574
1622
  topicId: { type: "string", description: "Topic scope" },
1575
1623
  status: {
1576
1624
  type: "string",
1577
1625
  description: "Filter: active, merged, abandoned",
1578
1626
  enum: ["active", "merged", "abandoned"]
1627
+ },
1628
+ groupBy: {
1629
+ type: "string",
1630
+ description: "Optional grouping mode for the response.",
1631
+ enum: ["campaign", "lane", "flat"]
1632
+ },
1633
+ lane: {
1634
+ type: "string",
1635
+ description: "Filter by GitButler-aligned lane name."
1636
+ },
1637
+ campaign: {
1638
+ type: "number",
1639
+ description: "Filter by top-level pipeline campaign number."
1640
+ },
1641
+ limit: {
1642
+ type: "number",
1643
+ description: "Maximum results to return."
1579
1644
  }
1580
1645
  },
1581
1646
  required: ["topicId"],
1582
1647
  response: {
1583
- description: "Worktrees with phase, status, belief count, and creation time",
1648
+ description: "Worktrees with lifecycle phase, campaign, lane, status, belief count, and creation time",
1584
1649
  fields: {
1585
- worktrees: "array \u2014 { worktreeId, title, phase, status, beliefCount, createdAt }"
1650
+ worktrees: "array \u2014 { worktreeId, title, phase, campaign, lane, laneOrderInCampaign, orderInLane, status, beliefCount, createdAt }"
1586
1651
  }
1587
1652
  },
1588
1653
  ownerModule: "workflow-engine",
@@ -1591,7 +1656,7 @@ var LIST_WORKTREES = {
1591
1656
  };
1592
1657
  var LIST_ALL_WORKTREES = {
1593
1658
  name: "list_all_worktrees",
1594
- description: "List ALL worktrees across ALL topics in one query. No topic scope required. Like `git worktree list --all` \u2014 returns the complete pipeline inventory with track, trackPosition, executionBand, dependencies, and status. Supports filtering by status, track, and executionBand. This is the PM's primary pipeline query \u2014 one call, full picture.",
1659
+ description: "List ALL worktrees across ALL topics in one query. No topic scope required. Like `git worktree list --all` \u2014 returns the complete pipeline inventory with campaign, lane, lane order, dependencies, and status. Supports filtering by status, lane, and campaign. This is the PM's primary pipeline query \u2014 one call, full picture.",
1595
1660
  parameters: {
1596
1661
  status: {
1597
1662
  type: "string",
@@ -1609,13 +1674,18 @@ var LIST_ALL_WORKTREES = {
1609
1674
  "dismissed"
1610
1675
  ]
1611
1676
  },
1612
- track: {
1677
+ lane: {
1613
1678
  type: "string",
1614
- description: "Filter by track name (e.g., 'ontology', 'tc-scope', 'control-plane', 'dev-portal', 'mcp-sdk-parity')"
1679
+ description: "Filter by lane name (e.g., 'ontology', 'tc-scope', 'control-plane', 'dev-portal', 'mcp-sdk-parity')"
1615
1680
  },
1616
- executionBand: {
1681
+ campaign: {
1617
1682
  type: "number",
1618
- description: "Filter by execution band number (e.g., 1, 2, 3). Returns only worktrees in that parallel execution group."
1683
+ description: "Filter by campaign number (e.g., 1, 2, 3). Returns only worktrees in that campaign."
1684
+ },
1685
+ groupBy: {
1686
+ type: "string",
1687
+ description: "Optional grouping mode for the response.",
1688
+ enum: ["campaign", "lane", "flat"]
1619
1689
  },
1620
1690
  limit: {
1621
1691
  type: "number",
@@ -1626,10 +1696,39 @@ var LIST_ALL_WORKTREES = {
1626
1696
  response: {
1627
1697
  description: "All worktrees across all topics with full pipeline metadata",
1628
1698
  fields: {
1629
- worktrees: "array \u2014 { worktreeId, title, topicId, topicName, phase, status, hypothesis, track, trackPosition, executionBand, executionOrder, dependsOn, blocks, gate, createdAt }",
1699
+ worktrees: "array \u2014 { worktreeId, title, topicId, topicName, phase, status, hypothesis, campaign, lane, laneOrderInCampaign, orderInLane, dependsOn, blocks, gate, createdAt }",
1630
1700
  total: "number \u2014 total count after filtering",
1631
- tracks: "object \u2014 { trackName: count } summary of worktrees per track",
1632
- bands: "object \u2014 { bandNumber: count } summary of worktrees per execution band"
1701
+ lanes: "object \u2014 { laneName: count } summary of worktrees per lane",
1702
+ campaigns: "object \u2014 { campaignNumber: count } summary of worktrees per campaign"
1703
+ }
1704
+ },
1705
+ ownerModule: "workflow-engine",
1706
+ ontologyPrimitive: "worktree",
1707
+ tier: "showcase"
1708
+ };
1709
+ var LIST_CAMPAIGNS = {
1710
+ name: "list_campaigns",
1711
+ description: "List compact pipeline campaigns with their nested lanes. Use this to see the top-level campaign > lane > worktree shape without pulling the full worktree inventory.",
1712
+ parameters: {
1713
+ topicId: {
1714
+ type: "string",
1715
+ description: "Optional topic scope."
1716
+ },
1717
+ status: {
1718
+ type: "string",
1719
+ description: "Optional worktree status filter before grouping campaigns and lanes."
1720
+ },
1721
+ limit: {
1722
+ type: "number",
1723
+ description: "Maximum worktrees to scan before grouping."
1724
+ }
1725
+ },
1726
+ required: [],
1727
+ response: {
1728
+ description: "Pipeline campaigns with nested lane summaries.",
1729
+ fields: {
1730
+ campaigns: "array \u2014 { campaign, lanes: [{ lane, laneOrderInCampaign, worktreeCount, activeCount, readyCount, blockedCount, completedCount, nextWorktree }] }",
1731
+ totalWorktrees: "number \u2014 total worktrees scanned after filtering"
1633
1732
  }
1634
1733
  },
1635
1734
  ownerModule: "workflow-engine",
@@ -1692,16 +1791,28 @@ var UPDATE_WORKTREE_TARGETS = {
1692
1791
  };
1693
1792
  var UPDATE_WORKTREE_METADATA = {
1694
1793
  name: "update_worktree_metadata",
1695
- description: "Update worktree sequencing metadata \u2014 execution order, dependencies, blocking relations, and gates. Like `git config` for a worktree \u2014 sets the scheduling and dependency metadata that determines when this worktree can activate relative to others. Use to backfill or correct sequencing data.",
1794
+ description: "Update worktree sequencing metadata \u2014 campaign, lane, dependencies, blocking relations, and gates. Like `git config` for a worktree \u2014 sets the scheduling and dependency metadata that determines when this worktree can activate relative to others. Use to backfill or correct sequencing data.",
1696
1795
  parameters: {
1697
1796
  worktreeId: { type: "string", description: "The worktree to update" },
1698
1797
  hypothesis: {
1699
1798
  type: "string",
1700
1799
  description: "Testable claim this worktree investigates"
1701
1800
  },
1702
- executionOrder: {
1801
+ campaign: {
1703
1802
  type: "number",
1704
- description: "Global execution order (1 = first, higher = later)"
1803
+ description: "Top-level pipeline campaign number."
1804
+ },
1805
+ lane: {
1806
+ type: "string",
1807
+ description: "GitButler-aligned workstream lane name inside the campaign."
1808
+ },
1809
+ laneOrderInCampaign: {
1810
+ type: "number",
1811
+ description: "Ordering for this lane within the campaign."
1812
+ },
1813
+ orderInLane: {
1814
+ type: "number",
1815
+ description: "Position of this worktree inside its lane."
1705
1816
  },
1706
1817
  dependsOn: {
1707
1818
  type: "array",
@@ -1739,18 +1850,6 @@ var UPDATE_WORKTREE_METADATA = {
1739
1850
  type: "object",
1740
1851
  description: "Calibrated auto-fix policy controlling dry-run vs safe execution, per-run action caps, and permitted mutation tiers."
1741
1852
  },
1742
- track: {
1743
- type: "string",
1744
- description: "Parallel workstream name (e.g., 'ontology', 'tc-scope', 'control-plane', 'dev-portal', 'mcp-sdk-parity', 'execution-program'). Groups worktrees into named lanes for pipeline visualization and PM analysis."
1745
- },
1746
- trackPosition: {
1747
- type: "number",
1748
- description: "Position within the track (1-indexed). E.g., TC-A=1, TC-B=2, TC-C=3 within the 'tc-scope' track."
1749
- },
1750
- executionBand: {
1751
- type: "number",
1752
- description: "Parallel execution band number. All worktrees in the same band can run simultaneously. Band 2 = OE-B + TC-A, Band 3 = TC-B + 11D-R + S2-13A, etc."
1753
- },
1754
1853
  status: {
1755
1854
  type: "string",
1756
1855
  description: "Override the worktree status. Use for lifecycle transitions like marking a worktree superseded, long-term, or as a raw idea.",
@@ -2120,6 +2219,10 @@ var LIST_TASKS = {
2120
2219
  type: "string",
2121
2220
  description: "Filter to tasks linked to this worktree"
2122
2221
  },
2222
+ worktreeId: {
2223
+ type: "string",
2224
+ description: "Alias for linkedWorktreeId"
2225
+ },
2123
2226
  status: {
2124
2227
  type: "string",
2125
2228
  description: "Filter by status: todo, in_progress, blocked, done",
@@ -2207,7 +2310,7 @@ var GET_TOPIC = {
2207
2310
  description: "Legacy alias for topicId"
2208
2311
  }
2209
2312
  },
2210
- required: [],
2313
+ required: ["topicId"],
2211
2314
  response: {
2212
2315
  description: "Single topic record",
2213
2316
  fields: {
@@ -2562,7 +2665,7 @@ var GET_ONTOLOGY = {
2562
2665
  description: "Tenant scope for key lookup. Omit for platform-level."
2563
2666
  }
2564
2667
  },
2565
- required: [],
2668
+ required: ["id"],
2566
2669
  response: {
2567
2670
  description: "Ontology definition with latest published version",
2568
2671
  fields: {
@@ -2629,7 +2732,7 @@ var MATCH_ENTITY_TYPE = {
2629
2732
  description: "Optional maximum number of ranked matches to return"
2630
2733
  }
2631
2734
  },
2632
- required: ["text"],
2735
+ required: ["text", "ontologyId"],
2633
2736
  response: {
2634
2737
  description: "Ranked ontology entity type matches",
2635
2738
  fields: {
@@ -2883,7 +2986,7 @@ var RECORD_SCOPE_LEARNING = {
2883
2986
  };
2884
2987
  var PIPELINE_SNAPSHOT = {
2885
2988
  name: "pipeline_snapshot",
2886
- description: "Summarize a topic's worktree pipeline in band-and-lane form. Like `git status --short` for Lucern execution \u2014 returns the hinge worktree, next planned wave, blockers, critical path, superseded work, and graph hygiene debt.",
2989
+ description: "Summarize a topic's worktree pipeline in campaign-and-lane form. Like `git status --short` for Lucern execution \u2014 returns the hinge worktree, next planned wave, blockers, critical path, superseded work, and graph hygiene debt.",
2887
2990
  parameters: {
2888
2991
  topicId: { type: "string", description: "Topic scope ID" }
2889
2992
  },
@@ -2893,14 +2996,14 @@ var PIPELINE_SNAPSHOT = {
2893
2996
  fields: {
2894
2997
  topicId: "string",
2895
2998
  topicName: "string",
2896
- currentBand: "number | null",
2897
- nextBand: "number | null",
2999
+ currentCampaign: "number | null",
3000
+ nextCampaign: "number | null",
2898
3001
  activeWorktrees: "array \u2014 current hinge worktree(s)",
2899
- nextWave: "array \u2014 worktrees in the next planned band",
3002
+ nextWave: "array \u2014 worktrees in the next planned campaign",
2900
3003
  readyNow: "array \u2014 planning worktrees with dependencies completed",
2901
3004
  blockedBy: "array \u2014 grouped blockers",
2902
3005
  criticalPath: "array \u2014 ordered incomplete worktree chain",
2903
- bands: "array \u2014 incomplete worktrees grouped by executionBand",
3006
+ campaigns: "array \u2014 incomplete worktrees grouped by campaign",
2904
3007
  superseded: "array \u2014 worktrees marked superseded or not for activation",
2905
3008
  graphHygiene: "object \u2014 untargeted and taskless worktree debt",
2906
3009
  riskQuestions: "array \u2014 critical/high open questions",
@@ -3489,6 +3592,7 @@ var MCP_TOOL_CONTRACTS = {
3489
3592
  list_beliefs: LIST_BELIEFS,
3490
3593
  list_worktrees: LIST_WORKTREES,
3491
3594
  list_all_worktrees: LIST_ALL_WORKTREES,
3595
+ list_campaigns: LIST_CAMPAIGNS,
3492
3596
  activate_worktree: ACTIVATE_WORKTREE,
3493
3597
  update_worktree_targets: UPDATE_WORKTREE_TARGETS,
3494
3598
  update_worktree_metadata: UPDATE_WORKTREE_METADATA,
@@ -3671,6 +3775,7 @@ var MCP_WORKFLOW_PLATFORM_OPERATION_NAMES = [
3671
3775
  "activate_worktree",
3672
3776
  "list_worktrees",
3673
3777
  "list_all_worktrees",
3778
+ "list_campaigns",
3674
3779
  "update_worktree_targets",
3675
3780
  "update_worktree_metadata",
3676
3781
  "create_task",
@@ -3878,6 +3983,7 @@ var LUCERN_OPERATION_MANIFEST = {
3878
3983
 
3879
3984
  // src/function-registry/helpers.ts
3880
3985
  var jsonObjectSchema = z.record(z.unknown());
3986
+ var sdkSessionIdSchema = z.string().optional();
3881
3987
  function mcpContractShape(contract) {
3882
3988
  const required = new Set(contract.required);
3883
3989
  return Object.fromEntries(
@@ -3912,10 +4018,40 @@ function argsSchemaFromMcpContract(contract) {
3912
4018
  return z.object(mcpContractShape(contract));
3913
4019
  }
3914
4020
  function inputSchemaFromMcpContract(contract) {
3915
- return argsSchemaFromMcpContract(contract).passthrough();
4021
+ return withInternalSurfaceFields(argsSchemaFromMcpContract(contract));
4022
+ }
4023
+ function withInternalSurfaceFields(schema) {
4024
+ return schema.extend({ __sdkSessionId: sdkSessionIdSchema }).strict();
4025
+ }
4026
+ function normalizeInputSchema(schema) {
4027
+ if (schema instanceof z.ZodObject) {
4028
+ return withInternalSurfaceFields(schema);
4029
+ }
4030
+ return schema;
4031
+ }
4032
+ function unwrapObjectSchema(schema) {
4033
+ let current = schema;
4034
+ while (true) {
4035
+ switch (current._def.typeName) {
4036
+ case z.ZodFirstPartyTypeKind.ZodEffects:
4037
+ current = current._def.schema;
4038
+ continue;
4039
+ case z.ZodFirstPartyTypeKind.ZodBranded:
4040
+ current = current._def.type;
4041
+ continue;
4042
+ default:
4043
+ return current instanceof z.ZodObject ? current : void 0;
4044
+ }
4045
+ }
3916
4046
  }
3917
4047
  function getObjectShape(schema) {
3918
- const shape = typeof schema._def.shape === "function" ? schema._def.shape() : schema._def.shape;
4048
+ const objectSchema = unwrapObjectSchema(schema);
4049
+ if (!objectSchema) {
4050
+ throw new Error(
4051
+ `Expected a Zod object schema, received ${schema._def.typeName}.`
4052
+ );
4053
+ }
4054
+ const shape = typeof objectSchema._def.shape === "function" ? objectSchema._def.shape() : objectSchema._def.shape;
3919
4055
  return shape;
3920
4056
  }
3921
4057
  function unwrapMcpParameterSchema(schema) {
@@ -3936,6 +4072,9 @@ function unwrapMcpParameterSchema(schema) {
3936
4072
  case z.ZodFirstPartyTypeKind.ZodBranded:
3937
4073
  current = current._def.type;
3938
4074
  continue;
4075
+ case z.ZodFirstPartyTypeKind.ZodEffects:
4076
+ current = current._def.schema;
4077
+ continue;
3939
4078
  default:
3940
4079
  return { schema: current, required, description: description ?? current.description };
3941
4080
  }
@@ -3955,6 +4094,7 @@ function mcpParameterFromZod(fieldName, schema, contractName) {
3955
4094
  return { parameter: { type: "array", description }, required };
3956
4095
  case z.ZodFirstPartyTypeKind.ZodObject:
3957
4096
  case z.ZodFirstPartyTypeKind.ZodRecord:
4097
+ case z.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
3958
4098
  return { parameter: { type: "object", description }, required };
3959
4099
  case z.ZodFirstPartyTypeKind.ZodEnum:
3960
4100
  return {
@@ -4010,6 +4150,11 @@ function withUserId(input, context) {
4010
4150
  userId: typeof input.userId === "string" ? input.userId : authUserId(context)
4011
4151
  };
4012
4152
  }
4153
+ function compactRecord(input) {
4154
+ return Object.fromEntries(
4155
+ Object.entries(input).filter(([, value]) => value !== void 0)
4156
+ );
4157
+ }
4013
4158
  function surfaceMcpContract(name) {
4014
4159
  const contract = MCP_TOOL_CONTRACTS[name];
4015
4160
  if (!contract) {
@@ -4054,7 +4199,9 @@ function surfaceContract(args) {
4054
4199
  const canonicalArgs = args.args ?? argsSchemaFromMcpContract(baseMcp);
4055
4200
  const mcp = args.args ? mcpContractFromArgsSchema(baseMcp, canonicalArgs, args.name) : baseMcp;
4056
4201
  const canonicalReturns = args.returns ?? jsonObjectSchema;
4057
- const input = args.input ?? inputSchemaFromMcpContract(mcp);
4202
+ const input = normalizeInputSchema(
4203
+ args.input ?? inputSchemaFromMcpContract(mcp)
4204
+ );
4058
4205
  const output = args.output ?? canonicalReturns;
4059
4206
  return defineFunctionContract({
4060
4207
  name: args.name,
@@ -4098,43 +4245,242 @@ function surfaceContract(args) {
4098
4245
  });
4099
4246
  }
4100
4247
 
4248
+ // src/projections/projection-dsl.ts
4249
+ function defineProjection(def) {
4250
+ return def;
4251
+ }
4252
+
4253
+ // src/projections/list-beliefs.projection.ts
4254
+ var beliefStatusSchema = z.enum(["active", "superseded", "archived", "unscored", "scored"]).optional().describe("Filter by belief lifecycle or scoring status");
4255
+ var listBeliefsInputSchema = z.object({
4256
+ topicId: z.string().describe("Topic scope"),
4257
+ worktreeId: z.string().optional().describe("Filter to worktree scope"),
4258
+ status: beliefStatusSchema,
4259
+ minConfidence: z.number().optional().describe("Minimum confidence threshold"),
4260
+ limit: z.number().optional().describe("Maximum results"),
4261
+ includeEdgeAssociated: z.boolean().optional().describe("Include beliefs associated to the topic through edges")
4262
+ });
4263
+ function kernelStatus(status) {
4264
+ return status === "active" || status === "superseded" || status === "archived" ? status : void 0;
4265
+ }
4266
+ function compactRecord2(input) {
4267
+ return Object.fromEntries(
4268
+ Object.entries(input).filter(([, value]) => value !== void 0)
4269
+ );
4270
+ }
4271
+ var listBeliefsProjection = defineProjection({
4272
+ contractName: "list_beliefs",
4273
+ inputSchema: listBeliefsInputSchema,
4274
+ project: (input) => compactRecord2({
4275
+ topicId: input.topicId,
4276
+ status: kernelStatus(input.status),
4277
+ limit: input.limit,
4278
+ includeEdgeAssociated: input.includeEdgeAssociated
4279
+ }),
4280
+ convexArgsValidator: v.object({
4281
+ topicId: v.string(),
4282
+ status: v.optional(
4283
+ v.union(
4284
+ v.literal("active"),
4285
+ v.literal("superseded"),
4286
+ v.literal("archived")
4287
+ )
4288
+ ),
4289
+ limit: v.optional(v.number()),
4290
+ includeEdgeAssociated: v.optional(v.boolean())
4291
+ })
4292
+ });
4293
+ var confidenceTriggerSchema = z.enum([
4294
+ "evidence_added",
4295
+ "evidence_removed",
4296
+ "contradiction_resolved",
4297
+ "agent_assessment",
4298
+ "worktree_outcome",
4299
+ "worktree_completed",
4300
+ "contradiction_detected",
4301
+ "answer_recorded",
4302
+ "fusion",
4303
+ "discount",
4304
+ "deduction",
4305
+ "backfill_synthetic"
4306
+ ]);
4307
+ var provenanceSchema = z.object({
4308
+ evidence: z.string().optional(),
4309
+ question: z.string().optional(),
4310
+ answer: z.string().optional(),
4311
+ contradiction: z.string().optional(),
4312
+ worktree: z.string().optional()
4313
+ });
4314
+ var slOpinionProjectionSchema = z.object({
4315
+ belief: z.number(),
4316
+ disbelief: z.number(),
4317
+ uncertainty: z.number(),
4318
+ baseRate: z.number()
4319
+ });
4320
+ var modulateConfidenceInputObjectSchema = z.object({
4321
+ nodeId: z.string().optional(),
4322
+ beliefNodeId: z.string().optional(),
4323
+ worktreeId: z.string().optional(),
4324
+ opinion: slOpinionProjectionSchema.optional(),
4325
+ belief: z.number().optional(),
4326
+ disbelief: z.number().optional(),
4327
+ uncertainty: z.number().optional(),
4328
+ baseRate: z.number().optional(),
4329
+ trigger: confidenceTriggerSchema,
4330
+ provenance: provenanceSchema.optional(),
4331
+ triggeringEvidenceId: z.string().optional(),
4332
+ triggeringQuestionId: z.string().optional(),
4333
+ triggeringAnswerId: z.string().optional(),
4334
+ triggeringContradictionId: z.string().optional(),
4335
+ triggeringWorktreeId: z.string().optional(),
4336
+ rationale: z.string(),
4337
+ trustedBypassAccessCheck: z.boolean().optional()
4338
+ });
4339
+ var modulateConfidenceInputSchema = modulateConfidenceInputObjectSchema.superRefine((input, ctx) => {
4340
+ if (hasProvenance(input)) {
4341
+ return;
4342
+ }
4343
+ ctx.addIssue({
4344
+ code: z.ZodIssueCode.custom,
4345
+ message: "modulate_confidence requires evidence, question, answer, contradiction, or worktree provenance",
4346
+ path: ["provenance"]
4347
+ });
4348
+ });
4349
+ var modulateConfidenceProjection = defineProjection({
4350
+ contractName: "modulate_confidence",
4351
+ inputSchema: modulateConfidenceInputSchema,
4352
+ project: (input) => {
4353
+ const nodeId = input.beliefNodeId ?? input.nodeId;
4354
+ if (!nodeId) {
4355
+ throw new Error("modulate_confidence requires beliefNodeId or nodeId");
4356
+ }
4357
+ const opinion = input.opinion ?? {
4358
+ belief: requireNumber(input.belief, "belief"),
4359
+ disbelief: requireNumber(input.disbelief, "disbelief"),
4360
+ uncertainty: requireNumber(input.uncertainty, "uncertainty"),
4361
+ baseRate: requireNumber(input.baseRate, "baseRate")
4362
+ };
4363
+ assertProvenance(input);
4364
+ return {
4365
+ nodeId,
4366
+ worktreeId: input.worktreeId,
4367
+ belief: opinion.belief,
4368
+ disbelief: opinion.disbelief,
4369
+ uncertainty: opinion.uncertainty,
4370
+ baseRate: opinion.baseRate,
4371
+ trigger: input.trigger === "answer_recorded" ? "agent_assessment" : input.trigger,
4372
+ triggeringEvidenceId: input.provenance?.evidence ?? input.triggeringEvidenceId,
4373
+ triggeringQuestionId: input.provenance?.question ?? input.triggeringQuestionId,
4374
+ triggeringAnswerId: input.provenance?.answer ?? input.triggeringAnswerId,
4375
+ triggeringContradictionId: input.provenance?.contradiction ?? input.triggeringContradictionId,
4376
+ triggeringWorktreeId: input.provenance?.worktree ?? input.triggeringWorktreeId,
4377
+ rationale: input.rationale,
4378
+ trustedBypassAccessCheck: input.trustedBypassAccessCheck ?? true
4379
+ };
4380
+ },
4381
+ convexArgsValidator: v.object({
4382
+ nodeId: v.string(),
4383
+ worktreeId: v.optional(v.string()),
4384
+ belief: v.number(),
4385
+ disbelief: v.number(),
4386
+ uncertainty: v.number(),
4387
+ baseRate: v.number(),
4388
+ trigger: v.union(
4389
+ v.literal("evidence_added"),
4390
+ v.literal("evidence_removed"),
4391
+ v.literal("worktree_completed"),
4392
+ v.literal("contradiction_detected"),
4393
+ v.literal("contradiction_resolved"),
4394
+ v.literal("agent_assessment"),
4395
+ v.literal("worktree_outcome"),
4396
+ v.literal("fusion"),
4397
+ v.literal("discount"),
4398
+ v.literal("deduction"),
4399
+ v.literal("backfill_synthetic")
4400
+ ),
4401
+ triggeringEvidenceId: v.optional(v.string()),
4402
+ triggeringQuestionId: v.optional(v.string()),
4403
+ triggeringAnswerId: v.optional(v.string()),
4404
+ triggeringContradictionId: v.optional(v.string()),
4405
+ triggeringWorktreeId: v.optional(v.string()),
4406
+ rationale: v.string(),
4407
+ trustedBypassAccessCheck: v.optional(v.boolean())
4408
+ })
4409
+ });
4410
+ function requireNumber(value, field) {
4411
+ if (value === void 0) {
4412
+ throw new Error(`modulate_confidence requires ${field}`);
4413
+ }
4414
+ return value;
4415
+ }
4416
+ function assertProvenance(input) {
4417
+ if (!hasProvenance(input)) {
4418
+ throw new Error(
4419
+ "modulate_confidence requires evidence, question, answer, contradiction, or worktree provenance"
4420
+ );
4421
+ }
4422
+ }
4423
+ function hasProvenance(input) {
4424
+ return input.trigger === "backfill_synthetic" || Boolean(input.provenance && Object.values(input.provenance).some(Boolean)) || Boolean(input.triggeringEvidenceId) || Boolean(input.triggeringQuestionId) || Boolean(input.triggeringAnswerId) || Boolean(input.triggeringContradictionId) || Boolean(input.triggeringWorktreeId);
4425
+ }
4426
+
4101
4427
  // src/function-registry/beliefs.ts
4102
- var withBeliefId = (input) => ({
4103
- ...input,
4428
+ var beliefLookupInput = (input) => compactRecord({
4104
4429
  nodeId: input.nodeId ?? input.id ?? input.beliefId,
4105
- beliefId: input.beliefId ?? input.id ?? input.nodeId
4430
+ beliefId: input.beliefId
4106
4431
  });
4107
- var createBeliefInput = (input, context) => withUserId(
4108
- {
4109
- ...input,
4110
- formulation: input.formulation ?? input.canonicalText,
4111
- baseRate: input.baseRate ?? 0.5,
4112
- trustedBypassAccessCheck: input.trustedBypassAccessCheck ?? true
4113
- },
4114
- context
4115
- );
4432
+ var beliefNodeInput = (input) => compactRecord({
4433
+ nodeId: input.nodeId ?? input.id ?? input.beliefId
4434
+ });
4435
+ var beliefTopicInput = (input) => {
4436
+ const parsed = listBeliefsProjection.inputSchema.safeParse(input);
4437
+ if (!parsed.success) {
4438
+ throw new Error(
4439
+ `list_beliefs projection input rejected: ${parsed.error.message}`
4440
+ );
4441
+ }
4442
+ return compactRecord(listBeliefsProjection.project(parsed.data));
4443
+ };
4444
+ var createBeliefInput = (input, context) => {
4445
+ return withUserId(
4446
+ compactRecord({
4447
+ projectId: input.projectId,
4448
+ topicId: input.topicId,
4449
+ formulation: input.formulation ?? input.canonicalText,
4450
+ beliefType: input.beliefType,
4451
+ rationale: input.rationale,
4452
+ pillar: input.pillar,
4453
+ worktreeId: input.worktreeId,
4454
+ sourceBeliefIds: input.sourceBeliefIds,
4455
+ sourceType: input.sourceType,
4456
+ reversibility: input.reversibility,
4457
+ predictionMeta: input.predictionMeta,
4458
+ baseRate: input.baseRate ?? 0.5,
4459
+ metadata: input.metadata,
4460
+ trustedBypassAccessCheck: input.trustedBypassAccessCheck ?? true
4461
+ }),
4462
+ context
4463
+ );
4464
+ };
4116
4465
  var forkBeliefInput = (input, context) => withUserId(
4117
- {
4118
- ...input,
4466
+ compactRecord({
4119
4467
  parentNodeId: input.parentNodeId ?? input.nodeId ?? input.id,
4468
+ newFormulation: input.newFormulation,
4469
+ forkReason: input.forkReason,
4470
+ rationale: input.rationale,
4120
4471
  trustedBypassAccessCheck: input.trustedBypassAccessCheck ?? true
4121
- },
4472
+ }),
4122
4473
  context
4123
4474
  );
4124
4475
  var confidenceInput = (input, context) => {
4125
- const confidence = typeof input.confidence === "number" ? input.confidence : void 0;
4126
- const belief = typeof input.belief === "number" ? input.belief : confidence ?? 0.5;
4127
- const disbelief = typeof input.disbelief === "number" ? input.disbelief : 0;
4128
- const uncertainty = typeof input.uncertainty === "number" ? input.uncertainty : Math.max(0, 1 - belief - disbelief);
4476
+ const parsed = modulateConfidenceProjection.inputSchema.safeParse(input);
4477
+ if (!parsed.success) {
4478
+ throw new Error(
4479
+ `modulate_confidence projection input rejected: ${parsed.error.message}`
4480
+ );
4481
+ }
4129
4482
  return withUserId(
4130
- {
4131
- ...input,
4132
- belief,
4133
- disbelief,
4134
- uncertainty,
4135
- baseRate: input.baseRate ?? 0.5,
4136
- trustedBypassAccessCheck: input.trustedBypassAccessCheck ?? true
4137
- },
4483
+ compactRecord(modulateConfidenceProjection.project(parsed.data)),
4138
4484
  context
4139
4485
  );
4140
4486
  };
@@ -4169,7 +4515,7 @@ var beliefsContracts = [
4169
4515
  module: "beliefs",
4170
4516
  functionName: "getById",
4171
4517
  kind: "query",
4172
- inputProjection: withBeliefId
4518
+ inputProjection: beliefLookupInput
4173
4519
  }
4174
4520
  }),
4175
4521
  surfaceContract({
@@ -4185,8 +4531,10 @@ var beliefsContracts = [
4185
4531
  convex: {
4186
4532
  module: "beliefs",
4187
4533
  functionName: "getByTopic",
4188
- kind: "query"
4189
- }
4534
+ kind: "query",
4535
+ inputProjection: beliefTopicInput
4536
+ },
4537
+ args: listBeliefsInputSchema
4190
4538
  }),
4191
4539
  surfaceContract({
4192
4540
  name: "refine_belief",
@@ -4204,7 +4552,7 @@ var beliefsContracts = [
4204
4552
  kind: "mutation",
4205
4553
  inputProjection: (input, context) => withUserId(
4206
4554
  {
4207
- ...withBeliefId(input),
4555
+ ...beliefLookupInput(input),
4208
4556
  trustedBypassAccessCheck: input.trustedBypassAccessCheck ?? true
4209
4557
  },
4210
4558
  context
@@ -4225,7 +4573,8 @@ var beliefsContracts = [
4225
4573
  functionName: "modulateConfidence",
4226
4574
  kind: "mutation",
4227
4575
  inputProjection: confidenceInput
4228
- }
4576
+ },
4577
+ args: modulateConfidenceInputSchema
4229
4578
  }),
4230
4579
  surfaceContract({
4231
4580
  name: "fork_belief",
@@ -4258,10 +4607,10 @@ var beliefsContracts = [
4258
4607
  functionName: "archive",
4259
4608
  kind: "mutation",
4260
4609
  inputProjection: (input, context) => withUserId(
4261
- {
4262
- ...withBeliefId(input),
4610
+ compactRecord({
4611
+ ...beliefNodeInput(input),
4263
4612
  reason: input.reason ?? input.rationale
4264
- },
4613
+ }),
4265
4614
  context
4266
4615
  )
4267
4616
  }
@@ -4279,10 +4628,12 @@ var beliefsContracts = [
4279
4628
  module: "nodes",
4280
4629
  functionName: "search",
4281
4630
  kind: "query",
4282
- inputProjection: (input) => ({
4283
- ...input,
4631
+ inputProjection: (input) => compactRecord({
4284
4632
  searchQuery: input.searchQuery ?? input.query,
4285
- nodeType: "belief"
4633
+ projectId: input.projectId,
4634
+ topicId: input.topicId,
4635
+ nodeType: "belief",
4636
+ limit: input.limit
4286
4637
  })
4287
4638
  }
4288
4639
  }),
@@ -4299,7 +4650,7 @@ var beliefsContracts = [
4299
4650
  module: "beliefs",
4300
4651
  functionName: "getConfidenceHistory",
4301
4652
  kind: "query",
4302
- inputProjection: withBeliefId
4653
+ inputProjection: beliefNodeInput
4303
4654
  }
4304
4655
  }),
4305
4656
  surfaceContract({
@@ -4316,7 +4667,7 @@ var beliefsContracts = [
4316
4667
  module: "beliefs",
4317
4668
  functionName: "getConfidenceHistory",
4318
4669
  kind: "query",
4319
- inputProjection: withBeliefId
4670
+ inputProjection: beliefNodeInput
4320
4671
  }
4321
4672
  })
4322
4673
  ];