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

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 (237) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/component-boundary.contract.d.ts +14 -0
  3. package/dist/component-boundary.contract.js +155 -0
  4. package/dist/component-boundary.contract.js.map +1 -0
  5. package/dist/component-host-boundary.contract.d.ts +41 -0
  6. package/dist/component-host-boundary.contract.js +54 -0
  7. package/dist/component-host-boundary.contract.js.map +1 -0
  8. package/dist/context-pack.contract.d.ts +5 -3
  9. package/dist/context-pack.contract.js.map +1 -1
  10. package/dist/{dsl-BgpoVOVQ.d.ts → dsl-djCRfuWC.d.ts} +1 -1
  11. package/dist/dsl.d.ts +1 -1
  12. package/dist/dsl.js +4 -4
  13. package/dist/dsl.js.map +1 -1
  14. package/dist/edge-policy-manifest-Dw5IhT1L.d.ts +133 -0
  15. package/dist/function-registry/beliefs.d.ts +42 -82
  16. package/dist/function-registry/beliefs.js +1154 -125
  17. package/dist/function-registry/beliefs.js.map +1 -1
  18. package/dist/function-registry/coding.d.ts +7 -31
  19. package/dist/function-registry/coding.js +958 -112
  20. package/dist/function-registry/coding.js.map +1 -1
  21. package/dist/function-registry/context.d.ts +14 -26
  22. package/dist/function-registry/context.js +923 -97
  23. package/dist/function-registry/context.js.map +1 -1
  24. package/dist/function-registry/contracts.d.ts +4 -16
  25. package/dist/function-registry/contracts.js +860 -82
  26. package/dist/function-registry/contracts.js.map +1 -1
  27. package/dist/function-registry/coordination.d.ts +10 -46
  28. package/dist/function-registry/coordination.js +872 -84
  29. package/dist/function-registry/coordination.js.map +1 -1
  30. package/dist/function-registry/edges.d.ts +166 -18
  31. package/dist/function-registry/edges.js +1188 -97
  32. package/dist/function-registry/edges.js.map +1 -1
  33. package/dist/function-registry/evidence.d.ts +42 -74
  34. package/dist/function-registry/evidence.js +1106 -130
  35. package/dist/function-registry/evidence.js.map +1 -1
  36. package/dist/function-registry/graph.d.ts +132 -106
  37. package/dist/function-registry/graph.js +1006 -100
  38. package/dist/function-registry/graph.js.map +1 -1
  39. package/dist/function-registry/helpers.d.ts +8 -10
  40. package/dist/function-registry/helpers.js +869 -83
  41. package/dist/function-registry/helpers.js.map +1 -1
  42. package/dist/function-registry/identity.d.ts +4 -16
  43. package/dist/function-registry/identity.js +860 -82
  44. package/dist/function-registry/identity.js.map +1 -1
  45. package/dist/function-registry/index.d.ts +322 -8
  46. package/dist/function-registry/index.js +1249 -87
  47. package/dist/function-registry/index.js.map +1 -1
  48. package/dist/function-registry/judgments.d.ts +12 -20
  49. package/dist/function-registry/judgments.js +891 -94
  50. package/dist/function-registry/judgments.js.map +1 -1
  51. package/dist/function-registry/legacy.d.ts +2 -6
  52. package/dist/function-registry/legacy.js +860 -82
  53. package/dist/function-registry/legacy.js.map +1 -1
  54. package/dist/function-registry/lenses.d.ts +18 -34
  55. package/dist/function-registry/lenses.js +928 -88
  56. package/dist/function-registry/lenses.js.map +1 -1
  57. package/dist/function-registry/manifest.d.ts +7 -7
  58. package/dist/function-registry/manifest.js +19 -2
  59. package/dist/function-registry/manifest.js.map +1 -1
  60. package/dist/function-registry/ontologies.d.ts +46 -90
  61. package/dist/function-registry/ontologies.js +908 -109
  62. package/dist/function-registry/ontologies.js.map +1 -1
  63. package/dist/function-registry/pipeline.d.ts +14 -26
  64. package/dist/function-registry/pipeline.js +880 -85
  65. package/dist/function-registry/pipeline.js.map +1 -1
  66. package/dist/function-registry/questions.d.ts +50 -98
  67. package/dist/function-registry/questions.js +1043 -118
  68. package/dist/function-registry/questions.js.map +1 -1
  69. package/dist/function-registry/tasks.d.ts +18 -34
  70. package/dist/function-registry/tasks.js +973 -87
  71. package/dist/function-registry/tasks.js.map +1 -1
  72. package/dist/function-registry/topics.d.ts +100 -42
  73. package/dist/function-registry/topics.js +961 -89
  74. package/dist/function-registry/topics.js.map +1 -1
  75. package/dist/function-registry/types.d.ts +2 -2
  76. package/dist/function-registry/worktrees.d.ts +116 -74
  77. package/dist/function-registry/worktrees.js +1124 -115
  78. package/dist/function-registry/worktrees.js.map +1 -1
  79. package/dist/function-registry-input-audit.d.ts +13 -0
  80. package/dist/function-registry-input-audit.js +166 -0
  81. package/dist/function-registry-input-audit.js.map +1 -0
  82. package/dist/gateway.contract.d.ts +2 -0
  83. package/dist/gateway.contract.js.map +1 -1
  84. package/dist/generated/convexSchemas.js +8 -6
  85. package/dist/generated/convexSchemas.js.map +1 -1
  86. package/dist/generated/schema-manifest.json +103 -5
  87. package/dist/generated/tableOwnership.d.ts +4 -2
  88. package/dist/generated/tableOwnership.js +4 -0
  89. package/dist/generated/tableOwnership.js.map +1 -1
  90. package/dist/generated/tier-expectations.json +9 -4
  91. package/dist/graph-intelligence.contract.d.ts +506 -0
  92. package/dist/graph-intelligence.contract.js +595 -0
  93. package/dist/graph-intelligence.contract.js.map +1 -0
  94. package/dist/graph-types/index.d.ts +5 -1
  95. package/dist/graph-types/index.js +15 -4
  96. package/dist/graph-types/index.js.map +1 -1
  97. package/dist/index-O09U2xHk.d.ts +28 -0
  98. package/dist/index.d.ts +25 -4
  99. package/dist/index.js +3989 -236
  100. package/dist/index.js.map +1 -1
  101. package/dist/infisical-runtime.contract.d.ts +174 -0
  102. package/dist/infisical-runtime.contract.js +317 -0
  103. package/dist/infisical-runtime.contract.js.map +1 -0
  104. package/dist/lens-filter.contract.js +4 -3
  105. package/dist/lens-filter.contract.js.map +1 -1
  106. package/dist/lens-workflow.contract.js +4 -3
  107. package/dist/lens-workflow.contract.js.map +1 -1
  108. package/dist/manifests/edge-policy-manifest.d.ts +2 -0
  109. package/dist/manifests/edge-policy-manifest.data.d.ts +13 -0
  110. package/dist/manifests/edge-policy-manifest.data.js +26 -0
  111. package/dist/manifests/edge-policy-manifest.data.js.map +1 -0
  112. package/dist/manifests/edge-policy-manifest.js +92 -0
  113. package/dist/manifests/edge-policy-manifest.js.map +1 -0
  114. package/dist/manifests/infisical-runtime-manifest.d.ts +151 -0
  115. package/dist/manifests/infisical-runtime-manifest.js +316 -0
  116. package/dist/manifests/infisical-runtime-manifest.js.map +1 -0
  117. package/dist/manifests/invariant-manifest.d.ts +65 -0
  118. package/dist/manifests/invariant-manifest.js +18 -0
  119. package/dist/manifests/invariant-manifest.js.map +1 -0
  120. package/dist/manifests/invariants/ast-utils.d.ts +14 -0
  121. package/dist/manifests/invariants/ast-utils.js +54 -0
  122. package/dist/manifests/invariants/ast-utils.js.map +1 -0
  123. package/dist/manifests/invariants/index.d.ts +15 -0
  124. package/dist/manifests/invariants/index.js +183 -0
  125. package/dist/manifests/invariants/index.js.map +1 -0
  126. package/dist/manifests/invariants/inv-1-beliefs-append-only.d.ts +12 -0
  127. package/dist/manifests/invariants/inv-1-beliefs-append-only.js +94 -0
  128. package/dist/manifests/invariants/inv-1-beliefs-append-only.js.map +1 -0
  129. package/dist/manifests/invariants/inv-14-no-silent-transitions.d.ts +12 -0
  130. package/dist/manifests/invariants/inv-14-no-silent-transitions.js +99 -0
  131. package/dist/manifests/invariants/inv-14-no-silent-transitions.js.map +1 -0
  132. package/dist/manifests/invariants/manifest-1-projections-declare-audit.d.ts +12 -0
  133. package/dist/manifests/invariants/manifest-1-projections-declare-audit.js +42 -0
  134. package/dist/manifests/invariants/manifest-1-projections-declare-audit.js.map +1 -0
  135. package/dist/manifests/tenant-client-manifest.d.ts +322 -0
  136. package/dist/manifests/tenant-client-manifest.js +432 -0
  137. package/dist/manifests/tenant-client-manifest.js.map +1 -0
  138. package/dist/mcp-gateway-boundary.contract.d.ts +181 -0
  139. package/dist/mcp-gateway-boundary.contract.js +43 -0
  140. package/dist/mcp-gateway-boundary.contract.js.map +1 -0
  141. package/dist/projections/check-convex-args-shape.d.ts +3 -0
  142. package/dist/projections/check-convex-args-shape.js +399 -0
  143. package/dist/projections/check-convex-args-shape.js.map +1 -0
  144. package/dist/projections/create-evidence.projection.d.ts +176 -0
  145. package/dist/projections/create-evidence.projection.js +131 -0
  146. package/dist/projections/create-evidence.projection.js.map +1 -0
  147. package/dist/projections/index.d.ts +102 -0
  148. package/dist/projections/index.js +348 -0
  149. package/dist/projections/index.js.map +1 -0
  150. package/dist/projections/list-beliefs.projection.d.ts +36 -0
  151. package/dist/projections/list-beliefs.projection.js +54 -0
  152. package/dist/projections/list-beliefs.projection.js.map +1 -0
  153. package/dist/projections/list-tasks.projection.d.ts +32 -0
  154. package/dist/projections/list-tasks.projection.js +52 -0
  155. package/dist/projections/list-tasks.projection.js.map +1 -0
  156. package/dist/projections/modulate-confidence.projection.d.ts +219 -0
  157. package/dist/projections/modulate-confidence.projection.js +148 -0
  158. package/dist/projections/modulate-confidence.projection.js.map +1 -0
  159. package/dist/projections/projection-dsl.d.ts +11 -0
  160. package/dist/projections/projection-dsl.js +8 -0
  161. package/dist/projections/projection-dsl.js.map +1 -0
  162. package/dist/schema-helpers/enumValidation.js +2 -5
  163. package/dist/schema-helpers/enumValidation.js.map +1 -1
  164. package/dist/schema-helpers/spine/nodes/decision.js +2 -1
  165. package/dist/schema-helpers/spine/nodes/decision.js.map +1 -1
  166. package/dist/schema-helpers/spine/tables/epistemicNodes.js +27 -27
  167. package/dist/schema-helpers/spine/tables/epistemicNodes.js.map +1 -1
  168. package/dist/schema-helpers/validators.d.ts +1 -1
  169. package/dist/schema-helpers/validators.js +1 -1
  170. package/dist/schema-helpers/validators.js.map +1 -1
  171. package/dist/schemas/component-table-manifest.d.ts +74 -0
  172. package/dist/schemas/component-table-manifest.js +26 -0
  173. package/dist/schemas/component-table-manifest.js.map +1 -0
  174. package/dist/schemas/enums.d.ts +5 -2
  175. package/dist/schemas/enums.js +5 -2
  176. package/dist/schemas/enums.js.map +1 -1
  177. package/dist/schemas/index.d.ts +3 -1
  178. package/dist/schemas/index.js +112 -13
  179. package/dist/schemas/index.js.map +1 -1
  180. package/dist/schemas/manifest.d.ts +1154 -949
  181. package/dist/schemas/manifest.js +80 -12
  182. package/dist/schemas/manifest.js.map +1 -1
  183. package/dist/schemas/sl-opinion.d.ts +31 -0
  184. package/dist/schemas/sl-opinion.js +19 -0
  185. package/dist/schemas/sl-opinion.js.map +1 -0
  186. package/dist/schemas/tables/identity/platform.d.ts +10 -10
  187. package/dist/schemas/tables/kernel/epistemic.d.ts +12 -10
  188. package/dist/schemas/tables/kernel/epistemic.js +6 -4
  189. package/dist/schemas/tables/kernel/epistemic.js.map +1 -1
  190. package/dist/schemas/tables/kernel/infra.d.ts +17 -5
  191. package/dist/schemas/tables/kernel/infra.js +23 -1
  192. package/dist/schemas/tables/kernel/infra.js.map +1 -1
  193. package/dist/schemas/tables/kernel/intelligence.d.ts +10 -10
  194. package/dist/schemas/tables/kernel/lens.d.ts +4 -4
  195. package/dist/schemas/tables/kernel/platform.d.ts +12 -12
  196. package/dist/schemas/tables/kernel/spine.d.ts +3 -3
  197. package/dist/schemas/tables/kernel/spine.js +5 -2
  198. package/dist/schemas/tables/kernel/spine.js.map +1 -1
  199. package/dist/schemas/tables/kernel/task.d.ts +42 -42
  200. package/dist/schemas/tables/kernel/topic.js +5 -1
  201. package/dist/schemas/tables/kernel/topic.js.map +1 -1
  202. package/dist/schemas/tables/kernel/worktree.d.ts +62 -62
  203. package/dist/schemas/tables/kernel/worktree.js +6 -4
  204. package/dist/schemas/tables/kernel/worktree.js.map +1 -1
  205. package/dist/schemas/tables/mc/identity.d.ts +26 -3
  206. package/dist/schemas/tables/mc/identity.js +35 -1
  207. package/dist/schemas/tables/mc/identity.js.map +1 -1
  208. package/dist/schemas/tables/mc/pack.d.ts +20 -20
  209. package/dist/schemas/tables/mc/registry.d.ts +4 -4
  210. package/dist/schemas/tables/mc/runtime.d.ts +1 -1
  211. package/dist/schemas/tables/mc/runtime.js +1 -1
  212. package/dist/schemas/tables/mc/runtime.js.map +1 -1
  213. package/dist/schemas/tables/mc/workspace.d.ts +9 -3
  214. package/dist/schemas/tables/mc/workspace.js +3 -1
  215. package/dist/schemas/tables/mc/workspace.js.map +1 -1
  216. package/dist/sdk-methods.contract.d.ts +7 -4
  217. package/dist/{sdk-tools.contract-C2kQN_Xk.d.ts → sdk-tools.contract-BNklQDfB.d.ts} +2 -2
  218. package/dist/sdk-tools.contract.d.ts +2 -2
  219. package/dist/sdk-tools.contract.js +800 -74
  220. package/dist/sdk-tools.contract.js.map +1 -1
  221. package/dist/tenant-bootstrap-seed.contract.d.ts +1101 -0
  222. package/dist/tenant-bootstrap-seed.contract.js +653 -0
  223. package/dist/tenant-bootstrap-seed.contract.js.map +1 -0
  224. package/dist/tenant-bootstrap-seed.defaults.d.ts +16 -0
  225. package/dist/tenant-bootstrap-seed.defaults.js +303 -0
  226. package/dist/tenant-bootstrap-seed.defaults.js.map +1 -0
  227. package/dist/tenant-client.contract.d.ts +349 -0
  228. package/dist/tenant-client.contract.js +488 -0
  229. package/dist/tenant-client.contract.js.map +1 -0
  230. package/dist/{tool-contracts-WCnuE9DW.d.ts → tool-contracts-BevD9Ho2.d.ts} +39 -3
  231. package/dist/tool-contracts.d.ts +1 -1
  232. package/dist/tool-contracts.js +801 -75
  233. package/dist/tool-contracts.js.map +1 -1
  234. package/dist/workflow-runtime.contract.js +1 -1
  235. package/dist/workflow-runtime.contract.js.map +1 -1
  236. package/package.json +27 -1
  237. package/dist/index-DoDXl8KS.d.ts +0 -19
@@ -10,6 +10,7 @@ import { questionsContracts } from './questions.js';
10
10
  export { questionsContracts } from './questions.js';
11
11
  import { topicsContracts } from './topics.js';
12
12
  export { topicsContracts } from './topics.js';
13
+ import { z } from 'zod';
13
14
  import { lensesContracts } from './lenses.js';
14
15
  export { lensesContracts } from './lenses.js';
15
16
  import { ontologiesContracts } from './ontologies.js';
@@ -34,7 +35,6 @@ import { codingContracts } from './coding.js';
34
35
  export { codingContracts } from './coding.js';
35
36
  import { legacyContracts } from './legacy.js';
36
37
  export { legacyContracts } from './legacy.js';
37
- import { z } from 'zod';
38
38
 
39
39
  // src/function-registry/index.ts
40
40
 
@@ -50,7 +50,7 @@ var LENS_PERSPECTIVE_TYPES = [
50
50
  // src/tool-contracts.ts
51
51
  var CREATE_BELIEF = {
52
52
  name: "create_belief",
53
- 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.",
53
+ 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.",
54
54
  parameters: {
55
55
  canonicalText: {
56
56
  type: "string",
@@ -62,7 +62,7 @@ var CREATE_BELIEF = {
62
62
  },
63
63
  baseRate: {
64
64
  type: "number",
65
- description: "Required prior probability used to seed the vacuous opinion `(0, 0, 1, a)` at creation time."
65
+ description: "Prior probability used to seed the vacuous opinion `(0, 0, 1, a)` at creation time. Defaults to 0.5 when omitted."
66
66
  },
67
67
  beliefType: {
68
68
  type: "string",
@@ -73,7 +73,7 @@ var CREATE_BELIEF = {
73
73
  description: "Optional extra metadata merged into the node (e.g., { codeAnchors: ['path/to/file.ts'] } for coding intelligence)"
74
74
  }
75
75
  },
76
- required: ["canonicalText", "baseRate"],
76
+ required: ["canonicalText"],
77
77
  response: {
78
78
  description: "The created canonical belief record",
79
79
  fields: {
@@ -136,7 +136,7 @@ var REFINE_BELIEF = {
136
136
  };
137
137
  var MODULATE_CONFIDENCE = {
138
138
  name: "modulate_confidence",
139
- 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.",
139
+ 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.",
140
140
  parameters: {
141
141
  nodeId: { type: "string", description: "The belief to score" },
142
142
  belief: {
@@ -155,9 +155,9 @@ var MODULATE_CONFIDENCE = {
155
155
  type: "number",
156
156
  description: "Subjective-logic base rate `a` in [0, 1]. Required for tuple payloads."
157
157
  },
158
- confidence: {
159
- type: "number",
160
- description: "Deprecated scalar confidence value in [0, 1]. Scalar-only payloads are rejected as AMBIGUOUS_SCALAR."
158
+ worktreeId: {
159
+ type: "string",
160
+ description: "Completed worktree that tested this belief when confidence policy requires merge-backed scoring."
161
161
  },
162
162
  trigger: {
163
163
  type: "string",
@@ -172,17 +172,43 @@ var MODULATE_CONFIDENCE = {
172
172
  "worktree_completed",
173
173
  "fusion",
174
174
  "discount",
175
- "deduction",
176
- "manual",
177
- "decay"
175
+ "deduction"
178
176
  ]
179
177
  },
178
+ triggeringEvidenceId: {
179
+ type: "string",
180
+ description: "Evidence node that caused an evidence-triggered modulation"
181
+ },
182
+ triggeringQuestionId: {
183
+ type: "string",
184
+ description: "Answered question whose resolution supports this modulation"
185
+ },
186
+ triggeringAnswerId: {
187
+ type: "string",
188
+ description: "Answer node whose content supports this modulation"
189
+ },
190
+ triggeringContradictionId: {
191
+ type: "string",
192
+ description: "Contradiction record that caused a contradiction-triggered modulation"
193
+ },
194
+ triggeringWorktreeId: {
195
+ type: "string",
196
+ description: "Completed worktree whose outcome caused a worktree-triggered modulation"
197
+ },
180
198
  rationale: {
181
199
  type: "string",
182
200
  description: "Human-readable explanation of why confidence changed"
183
201
  }
184
202
  },
185
- required: ["nodeId", "trigger", "rationale"],
203
+ required: [
204
+ "nodeId",
205
+ "belief",
206
+ "disbelief",
207
+ "uncertainty",
208
+ "baseRate",
209
+ "trigger",
210
+ "rationale"
211
+ ],
186
212
  response: {
187
213
  description: "Confidence modulation result",
188
214
  fields: {
@@ -376,7 +402,7 @@ var ADD_EVIDENCE = {
376
402
  description: "Optional extra metadata merged into the node (e.g., { codeAnchors: ['path/to/file.ts'], failedApproach: true } for coding intelligence)"
377
403
  }
378
404
  },
379
- required: ["canonicalText", "targetNodeId"],
405
+ required: ["canonicalText", "targetNodeId", "reasoning"],
380
406
  response: {
381
407
  description: "The created evidence node and its edge",
382
408
  fields: {
@@ -432,7 +458,22 @@ var ADD_WORKTREE = {
432
458
  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.",
433
459
  parameters: {
434
460
  title: { type: "string", description: "Worktree name/objective" },
435
- topicId: { type: "string", description: "Optional topic scope hint" },
461
+ name: {
462
+ type: "string",
463
+ description: "Optional storage-name alias for callers that already use backend naming"
464
+ },
465
+ projectId: {
466
+ type: "string",
467
+ description: "Legacy topicId alias or resolver hint"
468
+ },
469
+ topicId: {
470
+ type: "string",
471
+ description: "Optional topic scope hint for resolver validation"
472
+ },
473
+ topicHint: {
474
+ type: "string",
475
+ description: "Natural-language topic hint for automatic topic resolution"
476
+ },
436
477
  branchId: {
437
478
  type: "string",
438
479
  description: "The branch this worktree investigates"
@@ -445,21 +486,122 @@ var ADD_WORKTREE = {
445
486
  type: "string",
446
487
  description: "The testable claim this worktree investigates"
447
488
  },
489
+ rationale: {
490
+ type: "string",
491
+ description: "Why this worktree exists and why it belongs in the campaign"
492
+ },
493
+ worktreeType: {
494
+ type: "string",
495
+ description: "Schema-enum worktree type used by the kernel lifecycle and retrieval layers"
496
+ },
497
+ gate: {
498
+ type: "string",
499
+ description: "Exit gate name for this worktree"
500
+ },
501
+ startDate: {
502
+ type: "number",
503
+ description: "Planned start timestamp in milliseconds since epoch"
504
+ },
505
+ endDate: {
506
+ type: "number",
507
+ description: "Planned end timestamp in milliseconds since epoch"
508
+ },
509
+ durationWeeks: {
510
+ type: "number",
511
+ description: "Planned duration in weeks"
512
+ },
513
+ confidenceImpact: {
514
+ type: "string",
515
+ description: "Expected confidence impact if the worktree succeeds",
516
+ enum: ["high", "medium", "low"]
517
+ },
518
+ beliefFocus: {
519
+ type: "string",
520
+ description: "Natural-language focus spanning the target belief neighborhood"
521
+ },
448
522
  beliefIds: {
449
523
  type: "array",
450
- description: "Beliefs to test in this worktree"
524
+ description: "Legacy alias for targetBeliefIds"
525
+ },
526
+ beliefs: {
527
+ type: "array",
528
+ description: "Legacy alias for targetBeliefIds"
529
+ },
530
+ targetBeliefIds: {
531
+ type: "array",
532
+ description: "Belief node IDs this worktree is expected to test or update"
533
+ },
534
+ targetQuestionIds: {
535
+ type: "array",
536
+ description: "Question node IDs this worktree is expected to answer"
537
+ },
538
+ keyQuestions: {
539
+ type: "array",
540
+ description: "Inline key question objects with question, optional status, answer, answerConfidence, and linkedQuestionId"
541
+ },
542
+ evidenceSignals: {
543
+ type: "array",
544
+ description: "Evidence signal objects with signal, optional collected state, progress, and notes"
545
+ },
546
+ decisionGate: {
547
+ type: "object",
548
+ description: "Decision gate object with goCriteria, noGoSignals, optional verdict, rationale, decidedAt, and decidedBy"
549
+ },
550
+ goCriteria: {
551
+ type: "array",
552
+ description: "Shorthand go criteria used to build decisionGate"
553
+ },
554
+ noGoSignals: {
555
+ type: "array",
556
+ description: "Shorthand no-go signals used to build decisionGate"
557
+ },
558
+ proofArtifacts: {
559
+ type: "array",
560
+ description: "Expected proof artifacts required to close the worktree"
451
561
  },
452
562
  autoShape: {
453
563
  type: "boolean",
454
564
  description: "Whether to invoke inquiry auto-shaping during worktree creation"
455
565
  },
566
+ autoFixPolicy: {
567
+ type: "object",
568
+ description: "Policy for permitted automatic remediation inside the worktree"
569
+ },
456
570
  domainPackId: {
457
571
  type: "string",
458
572
  description: "Optional domain pack whose shaping hooks should influence generated questions and tasks"
459
573
  },
460
- executionOrder: {
574
+ tags: {
575
+ type: "array",
576
+ description: "Additional topic-resolution tags for the worktree"
577
+ },
578
+ touchedPaths: {
579
+ type: "array",
580
+ description: "File paths used as topic-resolution signals"
581
+ },
582
+ sourceRef: {
583
+ type: "string",
584
+ description: "Source reference used as a topic-resolution signal"
585
+ },
586
+ sourceKind: {
587
+ type: "string",
588
+ description: "Source kind used as a topic-resolution signal"
589
+ },
590
+ campaign: {
461
591
  type: "number",
462
- description: "Global execution order for this worktree"
592
+ description: "Top-level pipeline campaign number. Campaigns define the outer execution slice."
593
+ },
594
+ lane: {
595
+ type: "string",
596
+ description: "GitButler-aligned workstream lane name inside the campaign."
597
+ },
598
+ laneOrderInCampaign: {
599
+ type: "number",
600
+ description: "Ordering for this lane within its campaign."
601
+ },
602
+ orderInLane: {
603
+ type: "number",
604
+ description: "Position of this worktree inside its lane."
463
605
  },
464
606
  dependsOn: {
465
607
  type: "array",
@@ -469,12 +611,20 @@ var ADD_WORKTREE = {
469
611
  type: "array",
470
612
  description: "Worktree IDs blocked by this worktree"
471
613
  },
472
- gate: {
614
+ staffingHint: {
473
615
  type: "string",
474
- description: "Exit gate name for this worktree"
616
+ description: "Suggested staffing or agent allocation note"
617
+ },
618
+ lensId: {
619
+ type: "string",
620
+ description: "Lens that scopes this worktree when applicable"
621
+ },
622
+ lastReconciledAt: {
623
+ type: "number",
624
+ description: "Timestamp when worktree metadata was last reconciled"
475
625
  }
476
626
  },
477
- required: ["title", "topicId"],
627
+ required: ["title"],
478
628
  response: {
479
629
  description: "The created worktree",
480
630
  fields: {
@@ -501,7 +651,7 @@ var MERGE = {
501
651
  worktreeId: { type: "string", description: "The worktree to merge" },
502
652
  outcomes: {
503
653
  type: "array",
504
- description: "Scoring outcomes for each belief: { beliefId, confidence, rationale }"
654
+ description: "Merge outcomes as key-finding strings, or scoring outcomes for beliefs: { beliefId, confidence, rationale }"
505
655
  },
506
656
  summary: { type: "string", description: "Overall findings summary" }
507
657
  },
@@ -719,19 +869,23 @@ var FIND_CONTRADICTIONS = {
719
869
  };
720
870
  var CREATE_EDGE = {
721
871
  name: "create_edge",
722
- description: "Commit a typed relationship between two nodes in the reasoning graph. Like `git commit` \u2014 an atomic write that declares a dependency between nodes. The engine enforces layer transition rules \u2014 for example, L1 \u2192 L3 direct edges are forbidden (must go through L2).",
872
+ description: "Commit a typed relationship between two nodes in the reasoning graph. Like `git commit` \u2014 an atomic write that declares a dependency between nodes. Accepts any public epistemic edge type between public graph node refs so agents can author the full spine.",
723
873
  parameters: {
724
- sourceId: {
725
- type: "string",
726
- description: "Source node of the relationship"
874
+ from: {
875
+ type: "object",
876
+ description: "Source graph ref, e.g. { kind: 'epistemic_node', nodeId: '...', nodeType: 'topic' }"
727
877
  },
728
- targetId: {
729
- type: "string",
730
- description: "Target node of the relationship"
878
+ to: {
879
+ type: "object",
880
+ description: "Target graph ref, e.g. { kind: 'epistemic_node', nodeId: '...', nodeType: 'belief' }"
731
881
  },
732
882
  edgeType: {
733
883
  type: "string",
734
- description: "Relationship type (informs, tests, depends_on, supersedes, etc.)"
884
+ description: "Relationship type from the public epistemic edge enum."
885
+ },
886
+ globalId: {
887
+ type: "string",
888
+ description: "Optional idempotent edge global ID."
735
889
  },
736
890
  weight: {
737
891
  type: "number",
@@ -742,9 +896,13 @@ var CREATE_EDGE = {
742
896
  type: "string",
743
897
  description: "How this was determined",
744
898
  enum: ["deductive", "inductive", "abductive", "analogical", "empirical"]
899
+ },
900
+ metadata: {
901
+ type: "object",
902
+ description: "Optional edge metadata."
745
903
  }
746
904
  },
747
- required: ["sourceId", "targetId", "edgeType"],
905
+ required: ["from", "to", "edgeType"],
748
906
  response: {
749
907
  description: "The created edge",
750
908
  fields: {
@@ -758,6 +916,240 @@ var CREATE_EDGE = {
758
916
  ontologyPrimitive: "edge",
759
917
  tier: "showcase"
760
918
  };
919
+ var UPDATE_EDGE = {
920
+ name: "update_edge",
921
+ description: "Amend metadata on an existing graph edge. Like `git commit --amend` \u2014 changes the edge annotation without recreating the relationship.",
922
+ parameters: {
923
+ edgeId: { type: "string", description: "Edge ID or global ID to update" },
924
+ weight: { type: "number", description: "Updated edge weight" },
925
+ confidence: { type: "number", description: "Updated confidence" },
926
+ context: { type: "string", description: "Updated human-readable context" },
927
+ derivationType: { type: "string", description: "Updated derivation type" },
928
+ metadata: { type: "object", description: "Updated metadata" }
929
+ },
930
+ required: ["edgeId"],
931
+ response: {
932
+ description: "Edge update result",
933
+ fields: { success: "boolean" }
934
+ },
935
+ ownerModule: "graph-primitives",
936
+ ontologyPrimitive: "edge",
937
+ tier: "workhorse"
938
+ };
939
+ var REMOVE_EDGE = {
940
+ name: "remove_edge",
941
+ description: "Remove one graph edge by ID. Like `git rm` \u2014 deletes a single explicit relationship from the spine.",
942
+ parameters: {
943
+ edgeId: { type: "string", description: "Edge ID or global ID to remove" }
944
+ },
945
+ required: ["edgeId"],
946
+ response: {
947
+ description: "Edge removal result",
948
+ fields: { success: "boolean" }
949
+ },
950
+ ownerModule: "graph-primitives",
951
+ ontologyPrimitive: "edge",
952
+ tier: "workhorse"
953
+ };
954
+ var REMOVE_EDGES_BETWEEN = {
955
+ name: "remove_edges_between",
956
+ description: "Remove graph edges between two nodes. Like `git rm <pathspec>` \u2014 deletes relationships matching a source, target, and optional type.",
957
+ parameters: {
958
+ fromNodeId: { type: "string", description: "Source node ID or global ID" },
959
+ toNodeId: { type: "string", description: "Target node ID or global ID" },
960
+ edgeType: { type: "string", description: "Optional edge type filter" }
961
+ },
962
+ required: ["fromNodeId", "toNodeId"],
963
+ response: {
964
+ description: "Matched edge removal result",
965
+ fields: { deleted: "number" }
966
+ },
967
+ ownerModule: "graph-primitives",
968
+ ontologyPrimitive: "edge",
969
+ tier: "workhorse"
970
+ };
971
+ var BATCH_CREATE_EDGES = {
972
+ name: "batch_create_edges",
973
+ description: "Commit multiple typed graph edges. Like `git commit` with many staged paths \u2014 writes a batch of explicit relationships atomically per edge.",
974
+ parameters: {
975
+ edges: {
976
+ type: "array",
977
+ description: "Edges to create, each with from, to, edgeType, and optional weight/confidence/context."
978
+ },
979
+ skipLayerValidation: {
980
+ type: "boolean",
981
+ description: "Skip kernel layer validation for trusted materialization flows."
982
+ }
983
+ },
984
+ required: ["edges"],
985
+ response: {
986
+ description: "Batch edge creation result",
987
+ fields: {
988
+ created: "number",
989
+ results: "array",
990
+ errors: "array"
991
+ }
992
+ },
993
+ ownerModule: "graph-primitives",
994
+ ontologyPrimitive: "edge",
995
+ tier: "workhorse"
996
+ };
997
+ var CREATE_EPISTEMIC_NODE = {
998
+ name: "create_epistemic_node",
999
+ description: "Commit a generic epistemic graph node. Like `git commit` \u2014 creates a canonical node in the public spine for topics, beliefs, evidence, questions, answers, sources, and entities.",
1000
+ parameters: {
1001
+ globalId: { type: "string", description: "Optional idempotent node global ID" },
1002
+ nodeType: { type: "string", description: "Public epistemic node type" },
1003
+ canonicalText: { type: "string", description: "Canonical node text" },
1004
+ text: { type: "string", description: "Alias for canonicalText" },
1005
+ contentHash: { type: "string", description: "Optional idempotency content hash" },
1006
+ sourceType: { type: "string", description: "Source type for provenance" },
1007
+ topicId: { type: "string", description: "Optional topic scope" },
1008
+ content: { type: "string", description: "Extended content" },
1009
+ title: { type: "string", description: "Display title" },
1010
+ metadata: { type: "object", description: "Optional node metadata" }
1011
+ },
1012
+ required: ["nodeType"],
1013
+ response: {
1014
+ description: "Created node result",
1015
+ fields: {
1016
+ nodeId: "string",
1017
+ nodeGlobalId: "string",
1018
+ isDuplicate: "boolean"
1019
+ }
1020
+ },
1021
+ ownerModule: "reasoning-kernel",
1022
+ ontologyPrimitive: "graph",
1023
+ tier: "showcase"
1024
+ };
1025
+ var GET_EPISTEMIC_NODE = {
1026
+ name: "get_epistemic_node",
1027
+ description: "Read one epistemic graph node. Like `git show` \u2014 resolves a canonical spine node by ID or global ID.",
1028
+ parameters: {
1029
+ nodeId: { type: "string", description: "Node ID or global ID" }
1030
+ },
1031
+ required: ["nodeId"],
1032
+ response: {
1033
+ description: "The resolved node",
1034
+ fields: { node: "object" }
1035
+ },
1036
+ ownerModule: "reasoning-kernel",
1037
+ ontologyPrimitive: "graph",
1038
+ tier: "workhorse"
1039
+ };
1040
+ var LIST_EPISTEMIC_NODES = {
1041
+ name: "list_epistemic_nodes",
1042
+ description: "List epistemic graph nodes. Like `git ls-tree` \u2014 lists canonical spine nodes by topic, type, status, or search query.",
1043
+ parameters: {
1044
+ topicId: { type: "string", description: "Optional topic scope" },
1045
+ nodeType: { type: "string", description: "Optional node type filter" },
1046
+ status: { type: "string", description: "Optional lifecycle status" },
1047
+ searchQuery: { type: "string", description: "Optional text search query" },
1048
+ limit: { type: "number", description: "Maximum nodes to return" }
1049
+ },
1050
+ required: [],
1051
+ response: {
1052
+ description: "Matching nodes",
1053
+ fields: { nodes: "array" }
1054
+ },
1055
+ ownerModule: "reasoning-kernel",
1056
+ ontologyPrimitive: "graph",
1057
+ tier: "workhorse"
1058
+ };
1059
+ var UPDATE_EPISTEMIC_NODE = {
1060
+ name: "update_epistemic_node",
1061
+ description: "Amend an epistemic graph node. Like `git commit --amend` \u2014 updates mutable node metadata, text, status, or verification fields.",
1062
+ parameters: {
1063
+ nodeId: { type: "string", description: "Node ID or global ID" },
1064
+ canonicalText: { type: "string", description: "Updated canonical text" },
1065
+ text: { type: "string", description: "Alias for canonicalText" },
1066
+ contentHash: { type: "string", description: "Updated content hash" },
1067
+ content: { type: "string", description: "Updated content" },
1068
+ title: { type: "string", description: "Updated display title" },
1069
+ metadata: { type: "object", description: "Updated metadata" },
1070
+ confidence: { type: "number", description: "Updated confidence" },
1071
+ verificationStatus: { type: "string", description: "Updated verification status" },
1072
+ status: { type: "string", description: "Updated lifecycle status" }
1073
+ },
1074
+ required: ["nodeId"],
1075
+ response: {
1076
+ description: "Node update result",
1077
+ fields: { success: "boolean" }
1078
+ },
1079
+ ownerModule: "reasoning-kernel",
1080
+ ontologyPrimitive: "graph",
1081
+ tier: "workhorse"
1082
+ };
1083
+ var ARCHIVE_EPISTEMIC_NODE = {
1084
+ name: "archive_epistemic_node",
1085
+ description: "Archive an epistemic graph node. Like `git rm --cached` \u2014 removes a node from active traversal without hard-deleting it.",
1086
+ parameters: {
1087
+ nodeId: { type: "string", description: "Node ID or global ID" }
1088
+ },
1089
+ required: ["nodeId"],
1090
+ response: {
1091
+ description: "Archive result",
1092
+ fields: { success: "boolean", effectiveStatus: "string" }
1093
+ },
1094
+ ownerModule: "reasoning-kernel",
1095
+ ontologyPrimitive: "graph",
1096
+ tier: "workhorse"
1097
+ };
1098
+ var VERIFY_EPISTEMIC_NODE = {
1099
+ name: "verify_epistemic_node",
1100
+ description: "Record verification state on an epistemic graph node. Like `git tag` \u2014 marks the node with a reviewed verification state.",
1101
+ parameters: {
1102
+ nodeId: { type: "string", description: "Node ID or global ID" },
1103
+ verificationStatus: { type: "string", description: "Verification status" },
1104
+ confidence: { type: "number", description: "Optional confidence update" }
1105
+ },
1106
+ required: ["nodeId", "verificationStatus"],
1107
+ response: {
1108
+ description: "Verification result",
1109
+ fields: { success: "boolean" }
1110
+ },
1111
+ ownerModule: "reasoning-kernel",
1112
+ ontologyPrimitive: "graph",
1113
+ tier: "workhorse"
1114
+ };
1115
+ var SUPERSEDE_EPISTEMIC_NODE = {
1116
+ name: "supersede_epistemic_node",
1117
+ description: "Supersede an epistemic graph node with a new version. Like `git commit --amend` on an immutable history branch \u2014 creates the replacement and marks the old node superseded.",
1118
+ parameters: {
1119
+ oldNodeId: { type: "string", description: "Node ID or global ID to supersede" },
1120
+ newGlobalId: { type: "string", description: "Optional replacement global ID" },
1121
+ newCanonicalText: { type: "string", description: "Replacement canonical text" },
1122
+ text: { type: "string", description: "Alias for newCanonicalText" },
1123
+ newContentHash: { type: "string", description: "Optional replacement content hash" },
1124
+ reason: { type: "string", description: "Reason for superseding" }
1125
+ },
1126
+ required: ["oldNodeId"],
1127
+ response: {
1128
+ description: "Supersede result",
1129
+ fields: { oldNodeId: "string", newNodeId: "string" }
1130
+ },
1131
+ ownerModule: "reasoning-kernel",
1132
+ ontologyPrimitive: "graph",
1133
+ tier: "workhorse"
1134
+ };
1135
+ var BATCH_CREATE_EPISTEMIC_NODES = {
1136
+ name: "batch_create_epistemic_nodes",
1137
+ description: "Commit multiple epistemic graph nodes. Like `git commit` with many staged files \u2014 writes a batch of canonical spine nodes.",
1138
+ parameters: {
1139
+ nodes: {
1140
+ type: "array",
1141
+ description: "Nodes to create with nodeType, canonicalText/text, and optional metadata."
1142
+ }
1143
+ },
1144
+ required: ["nodes"],
1145
+ response: {
1146
+ description: "Batch node creation result",
1147
+ fields: { created: "number", results: "array" }
1148
+ },
1149
+ ownerModule: "reasoning-kernel",
1150
+ ontologyPrimitive: "graph",
1151
+ tier: "workhorse"
1152
+ };
761
1153
  var RECORD_JUDGMENT = {
762
1154
  name: "record_judgment",
763
1155
  description: "Record a judgment \u2014 an irreversible commitment based on the current epistemic state. Like a `git tag` marking a release. A judgment synthesizes beliefs, evidence, and uncertainties into a determination. Once issued, a judgment is evaluated against the epistemic state that existed when it was made (knowledge horizon evaluation, Invariant #10).",
@@ -1055,6 +1447,74 @@ var GET_GRAPH_STRUCTURE_ANALYSIS = {
1055
1447
  ontologyPrimitive: "graph",
1056
1448
  tier: "showcase"
1057
1449
  };
1450
+ var LIST_GRAPH_INTELLIGENCE_QUERIES = {
1451
+ name: "list_graph_intelligence_queries",
1452
+ 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.",
1453
+ parameters: {
1454
+ categoryId: {
1455
+ type: "string",
1456
+ description: "Optional category filter, such as problems or strategic"
1457
+ },
1458
+ mode: {
1459
+ type: "string",
1460
+ description: "Optional mode filter: core, bias, stress, operational, alpha, semantic, or evidence"
1461
+ }
1462
+ },
1463
+ required: [],
1464
+ response: {
1465
+ description: "Graph Intelligence query catalog and mode-to-tool mapping",
1466
+ fields: {
1467
+ categories: "array \u2014 query categories",
1468
+ queries: "array \u2014 query definitions with prompt templates and tools",
1469
+ quickQueries: "array \u2014 recommended one-click query presets",
1470
+ publicToolNamesByMode: "object \u2014 public tool names available to each Graph Intelligence mode"
1471
+ }
1472
+ },
1473
+ ownerModule: "graph-intelligence",
1474
+ ontologyPrimitive: "graph",
1475
+ tier: "showcase"
1476
+ };
1477
+ var RUN_GRAPH_INTELLIGENCE_QUERY = {
1478
+ name: "run_graph_intelligence_query",
1479
+ 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.",
1480
+ parameters: {
1481
+ topicId: { type: "string", description: "Topic to analyze" },
1482
+ queryId: {
1483
+ type: "string",
1484
+ description: "Graph Intelligence query ID, such as confirmation-bias, pre-mortem, or thesis-summary"
1485
+ },
1486
+ prompt: {
1487
+ type: "string",
1488
+ description: "Optional custom prompt for custom analysis runs"
1489
+ },
1490
+ input: {
1491
+ type: "string",
1492
+ description: "Optional entity, theme, belief, company, or search text for input-driven queries"
1493
+ },
1494
+ mode: {
1495
+ type: "string",
1496
+ description: "Optional mode override: core, bias, stress, operational, alpha, semantic, or evidence"
1497
+ },
1498
+ limit: {
1499
+ type: "number",
1500
+ description: "Maximum graph context rows to return"
1501
+ }
1502
+ },
1503
+ required: ["topicId"],
1504
+ response: {
1505
+ description: "Graph Intelligence query result bundle ready for model or prompt-library synthesis",
1506
+ fields: {
1507
+ query: "object \u2014 selected query definition",
1508
+ prompt: "string \u2014 resolved prompt template",
1509
+ toolPlan: "array \u2014 public tools and args the model can call next",
1510
+ analysis: "object \u2014 structure, coverage, gap, and confirmation-bias analysis",
1511
+ context: "object \u2014 sampled beliefs, questions, evidence, edges, and contradictions"
1512
+ }
1513
+ },
1514
+ ownerModule: "graph-intelligence",
1515
+ ontologyPrimitive: "graph",
1516
+ tier: "showcase"
1517
+ };
1058
1518
  var GET_FALSIFICATION_QUESTIONS = {
1059
1519
  name: "get_falsification_questions",
1060
1520
  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.",
@@ -1117,6 +1577,10 @@ var CREATE_EVIDENCE = {
1117
1577
  type: "object",
1118
1578
  description: "Optional metadata merged into the canonical evidence node"
1119
1579
  },
1580
+ rationale: {
1581
+ type: "string",
1582
+ description: "Why this evidence should enter the reasoning graph"
1583
+ },
1120
1584
  title: { type: "string", description: "Optional short title" },
1121
1585
  content: { type: "string", description: "Optional long-form content" },
1122
1586
  contentType: {
@@ -1125,7 +1589,7 @@ var CREATE_EVIDENCE = {
1125
1589
  },
1126
1590
  kind: { type: "string", description: "Optional evidence kind" }
1127
1591
  },
1128
- required: ["text"],
1592
+ required: ["text", "rationale"],
1129
1593
  response: {
1130
1594
  description: "The created canonical evidence record",
1131
1595
  fields: {
@@ -1173,7 +1637,7 @@ var LIST_EVIDENCE = {
1173
1637
  limit: { type: "number", description: "Max results" },
1174
1638
  cursor: { type: "string", description: "Pagination cursor" }
1175
1639
  },
1176
- required: [],
1640
+ required: ["topicId"],
1177
1641
  response: {
1178
1642
  description: "Canonical evidence page",
1179
1643
  fields: {
@@ -1358,6 +1822,7 @@ var ANSWER_QUESTION = {
1358
1822
  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.",
1359
1823
  parameters: {
1360
1824
  id: { type: "string", description: "Canonical question ID" },
1825
+ topicId: { type: "string", description: "Topic scope for the answer" },
1361
1826
  text: { type: "string", description: "Answer text" },
1362
1827
  confidence: {
1363
1828
  type: "string",
@@ -1370,7 +1835,7 @@ var ANSWER_QUESTION = {
1370
1835
  },
1371
1836
  rationale: { type: "string", description: "Why this answer is credible" }
1372
1837
  },
1373
- required: ["id", "text"],
1838
+ required: ["id", "topicId", "text"],
1374
1839
  response: {
1375
1840
  description: "Answer result",
1376
1841
  fields: {
@@ -1589,6 +2054,10 @@ var LIST_BELIEFS = {
1589
2054
  minConfidence: {
1590
2055
  type: "number",
1591
2056
  description: "Minimum confidence threshold"
2057
+ },
2058
+ limit: {
2059
+ type: "number",
2060
+ description: "Maximum results"
1592
2061
  }
1593
2062
  },
1594
2063
  required: ["topicId"],
@@ -1605,20 +2074,37 @@ var LIST_BELIEFS = {
1605
2074
  };
1606
2075
  var LIST_WORKTREES = {
1607
2076
  name: "list_worktrees",
1608
- 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.",
2077
+ 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.",
1609
2078
  parameters: {
1610
2079
  topicId: { type: "string", description: "Topic scope" },
1611
2080
  status: {
1612
2081
  type: "string",
1613
2082
  description: "Filter: active, merged, abandoned",
1614
2083
  enum: ["active", "merged", "abandoned"]
2084
+ },
2085
+ groupBy: {
2086
+ type: "string",
2087
+ description: "Optional grouping mode for the response.",
2088
+ enum: ["campaign", "lane", "flat"]
2089
+ },
2090
+ lane: {
2091
+ type: "string",
2092
+ description: "Filter by GitButler-aligned lane name."
2093
+ },
2094
+ campaign: {
2095
+ type: "number",
2096
+ description: "Filter by top-level pipeline campaign number."
2097
+ },
2098
+ limit: {
2099
+ type: "number",
2100
+ description: "Maximum results to return."
1615
2101
  }
1616
2102
  },
1617
2103
  required: ["topicId"],
1618
2104
  response: {
1619
- description: "Worktrees with phase, status, belief count, and creation time",
2105
+ description: "Worktrees with lifecycle phase, campaign, lane, status, belief count, and creation time",
1620
2106
  fields: {
1621
- worktrees: "array \u2014 { worktreeId, title, phase, status, beliefCount, createdAt }"
2107
+ worktrees: "array \u2014 { worktreeId, title, phase, campaign, lane, laneOrderInCampaign, orderInLane, status, beliefCount, createdAt }"
1622
2108
  }
1623
2109
  },
1624
2110
  ownerModule: "workflow-engine",
@@ -1627,7 +2113,7 @@ var LIST_WORKTREES = {
1627
2113
  };
1628
2114
  var LIST_ALL_WORKTREES = {
1629
2115
  name: "list_all_worktrees",
1630
- 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.",
2116
+ 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.",
1631
2117
  parameters: {
1632
2118
  status: {
1633
2119
  type: "string",
@@ -1645,13 +2131,18 @@ var LIST_ALL_WORKTREES = {
1645
2131
  "dismissed"
1646
2132
  ]
1647
2133
  },
1648
- track: {
2134
+ lane: {
1649
2135
  type: "string",
1650
- description: "Filter by track name (e.g., 'ontology', 'tc-scope', 'control-plane', 'dev-portal', 'mcp-sdk-parity')"
2136
+ description: "Filter by lane name (e.g., 'ontology', 'tc-scope', 'control-plane', 'dev-portal', 'mcp-sdk-parity')"
1651
2137
  },
1652
- executionBand: {
2138
+ campaign: {
1653
2139
  type: "number",
1654
- description: "Filter by execution band number (e.g., 1, 2, 3). Returns only worktrees in that parallel execution group."
2140
+ description: "Filter by campaign number (e.g., 1, 2, 3). Returns only worktrees in that campaign."
2141
+ },
2142
+ groupBy: {
2143
+ type: "string",
2144
+ description: "Optional grouping mode for the response.",
2145
+ enum: ["campaign", "lane", "flat"]
1655
2146
  },
1656
2147
  limit: {
1657
2148
  type: "number",
@@ -1662,10 +2153,39 @@ var LIST_ALL_WORKTREES = {
1662
2153
  response: {
1663
2154
  description: "All worktrees across all topics with full pipeline metadata",
1664
2155
  fields: {
1665
- worktrees: "array \u2014 { worktreeId, title, topicId, topicName, phase, status, hypothesis, track, trackPosition, executionBand, executionOrder, dependsOn, blocks, gate, createdAt }",
2156
+ worktrees: "array \u2014 { worktreeId, title, topicId, topicName, phase, status, hypothesis, campaign, lane, laneOrderInCampaign, orderInLane, dependsOn, blocks, gate, createdAt }",
1666
2157
  total: "number \u2014 total count after filtering",
1667
- tracks: "object \u2014 { trackName: count } summary of worktrees per track",
1668
- bands: "object \u2014 { bandNumber: count } summary of worktrees per execution band"
2158
+ lanes: "object \u2014 { laneName: count } summary of worktrees per lane",
2159
+ campaigns: "object \u2014 { campaignNumber: count } summary of worktrees per campaign"
2160
+ }
2161
+ },
2162
+ ownerModule: "workflow-engine",
2163
+ ontologyPrimitive: "worktree",
2164
+ tier: "showcase"
2165
+ };
2166
+ var LIST_CAMPAIGNS = {
2167
+ name: "list_campaigns",
2168
+ 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.",
2169
+ parameters: {
2170
+ topicId: {
2171
+ type: "string",
2172
+ description: "Optional topic scope."
2173
+ },
2174
+ status: {
2175
+ type: "string",
2176
+ description: "Optional worktree status filter before grouping campaigns and lanes."
2177
+ },
2178
+ limit: {
2179
+ type: "number",
2180
+ description: "Maximum worktrees to scan before grouping."
2181
+ }
2182
+ },
2183
+ required: [],
2184
+ response: {
2185
+ description: "Pipeline campaigns with nested lane summaries.",
2186
+ fields: {
2187
+ campaigns: "array \u2014 { campaign, lanes: [{ lane, laneOrderInCampaign, worktreeCount, activeCount, readyCount, blockedCount, completedCount, nextWorktree }] }",
2188
+ totalWorktrees: "number \u2014 total worktrees scanned after filtering"
1669
2189
  }
1670
2190
  },
1671
2191
  ownerModule: "workflow-engine",
@@ -1728,16 +2248,28 @@ var UPDATE_WORKTREE_TARGETS = {
1728
2248
  };
1729
2249
  var UPDATE_WORKTREE_METADATA = {
1730
2250
  name: "update_worktree_metadata",
1731
- 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.",
2251
+ 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.",
1732
2252
  parameters: {
1733
2253
  worktreeId: { type: "string", description: "The worktree to update" },
1734
2254
  hypothesis: {
1735
2255
  type: "string",
1736
2256
  description: "Testable claim this worktree investigates"
1737
2257
  },
1738
- executionOrder: {
2258
+ campaign: {
2259
+ type: "number",
2260
+ description: "Top-level pipeline campaign number."
2261
+ },
2262
+ lane: {
2263
+ type: "string",
2264
+ description: "GitButler-aligned workstream lane name inside the campaign."
2265
+ },
2266
+ laneOrderInCampaign: {
1739
2267
  type: "number",
1740
- description: "Global execution order (1 = first, higher = later)"
2268
+ description: "Ordering for this lane within the campaign."
2269
+ },
2270
+ orderInLane: {
2271
+ type: "number",
2272
+ description: "Position of this worktree inside its lane."
1741
2273
  },
1742
2274
  dependsOn: {
1743
2275
  type: "array",
@@ -1775,18 +2307,6 @@ var UPDATE_WORKTREE_METADATA = {
1775
2307
  type: "object",
1776
2308
  description: "Calibrated auto-fix policy controlling dry-run vs safe execution, per-run action caps, and permitted mutation tiers."
1777
2309
  },
1778
- track: {
1779
- type: "string",
1780
- 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."
1781
- },
1782
- trackPosition: {
1783
- type: "number",
1784
- description: "Position within the track (1-indexed). E.g., TC-A=1, TC-B=2, TC-C=3 within the 'tc-scope' track."
1785
- },
1786
- executionBand: {
1787
- type: "number",
1788
- 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."
1789
- },
1790
2310
  status: {
1791
2311
  type: "string",
1792
2312
  description: "Override the worktree status. Use for lifecycle transitions like marking a worktree superseded, long-term, or as a raw idea.",
@@ -1843,15 +2363,15 @@ var IDENTITY_WHOAMI = {
1843
2363
  };
1844
2364
  var COMPILE_CONTEXT = {
1845
2365
  name: "compile_context",
1846
- description: "Compile a focused reasoning context for a topic. Like `git log --graph --decorate` for the reasoning substrate \u2014 returns the canonical Pillar 3 context pack through the public API shape.",
2366
+ description: "Compile a focused reasoning context. If topicId is omitted, Lucern resolves the best topic from the query. Like `git log --graph --decorate` for the reasoning substrate \u2014 returns the canonical Pillar 3 context pack through the public API shape.",
1847
2367
  parameters: {
1848
2368
  topicId: {
1849
2369
  type: "string",
1850
- description: "Topic scope ID to compile"
2370
+ description: "Optional topic scope ID. Omit to resolve the topic from query."
1851
2371
  },
1852
2372
  query: {
1853
2373
  type: "string",
1854
- description: "Optional focus query used to rank context items"
2374
+ description: "Focus query used to resolve the topic and rank context items. Required when topicId is omitted."
1855
2375
  },
1856
2376
  budget: {
1857
2377
  type: "number",
@@ -1875,7 +2395,7 @@ var COMPILE_CONTEXT = {
1875
2395
  description: "Include related ontological entities in the compiled result"
1876
2396
  }
1877
2397
  },
1878
- required: ["topicId"],
2398
+ required: [],
1879
2399
  response: {
1880
2400
  description: "Compiled context pack for the requested topic",
1881
2401
  fields: {
@@ -2049,18 +2569,60 @@ var CREATE_TASK = {
2049
2569
  name: "create_task",
2050
2570
  description: "Create an execution task tied to the reasoning state. Like `git task` \u2014 tracks concrete work items (calls to make, data to gather, analyses to run) linked to questions, beliefs, or worktrees.",
2051
2571
  parameters: {
2052
- title: { type: "string", description: "Task description" },
2572
+ title: { type: "string", description: "Task title" },
2053
2573
  topicId: { type: "string", description: "Topic scope" },
2574
+ description: {
2575
+ type: "string",
2576
+ description: "Long-form task description"
2577
+ },
2054
2578
  taskType: {
2055
2579
  type: "string",
2056
- description: "Type: research, interview, analysis, data_collection",
2057
- enum: ["research", "interview", "analysis", "data_collection"]
2580
+ description: "Task taxonomy",
2581
+ enum: [
2582
+ "general",
2583
+ "find_evidence",
2584
+ "verify_claim",
2585
+ "research",
2586
+ "review",
2587
+ "interview",
2588
+ "analysis",
2589
+ "track_metrics"
2590
+ ]
2591
+ },
2592
+ priority: {
2593
+ type: "string",
2594
+ description: "Priority",
2595
+ enum: ["urgent", "high", "medium", "low"]
2596
+ },
2597
+ status: {
2598
+ type: "string",
2599
+ description: "Initial status (defaults to todo)",
2600
+ enum: ["todo", "in_progress", "blocked", "done"]
2601
+ },
2602
+ linkedWorktreeId: {
2603
+ type: "string",
2604
+ description: "Worktree this task belongs to"
2605
+ },
2606
+ linkedBeliefId: {
2607
+ type: "string",
2608
+ description: "Belief this task supports"
2058
2609
  },
2059
2610
  linkedQuestionId: {
2060
2611
  type: "string",
2061
2612
  description: "Question this task addresses"
2062
2613
  },
2063
- linkedWorktreeId: { type: "string", description: "Worktree scope" }
2614
+ assigneeId: {
2615
+ type: "string",
2616
+ description: "Principal assigned to the task"
2617
+ },
2618
+ dueDate: {
2619
+ type: "number",
2620
+ description: "Due date as epoch milliseconds"
2621
+ },
2622
+ tags: {
2623
+ type: "array",
2624
+ description: "Free-form string tags"
2625
+ }
2064
2626
  },
2065
2627
  required: ["title"],
2066
2628
  response: {
@@ -2156,6 +2718,10 @@ var LIST_TASKS = {
2156
2718
  type: "string",
2157
2719
  description: "Filter to tasks linked to this worktree"
2158
2720
  },
2721
+ worktreeId: {
2722
+ type: "string",
2723
+ description: "Alias for linkedWorktreeId"
2724
+ },
2159
2725
  status: {
2160
2726
  type: "string",
2161
2727
  description: "Filter by status: todo, in_progress, blocked, done",
@@ -2176,6 +2742,10 @@ var CREATE_TOPIC = {
2176
2742
  name: "create_topic",
2177
2743
  description: "Create a new topic container for scoping knowledge. Like `git init` \u2014 initializes a new repository for a knowledge domain. Topics are hierarchical: a deal topic can nest under a theme topic. Types: domain, theme, deal, strategy, constitution, project, portfolio.",
2178
2744
  parameters: {
2745
+ globalId: {
2746
+ type: "string",
2747
+ description: "Optional idempotent topic global ID"
2748
+ },
2179
2749
  name: { type: "string", description: "Topic name" },
2180
2750
  type: {
2181
2751
  type: "string",
@@ -2186,6 +2756,18 @@ var CREATE_TOPIC = {
2186
2756
  type: "string",
2187
2757
  description: "Optional parent topic for nesting"
2188
2758
  },
2759
+ parentTopicGlobalId: {
2760
+ type: "string",
2761
+ description: "Optional parent topic global ID for nesting"
2762
+ },
2763
+ tenantId: { type: "string", description: "Optional tenant scope" },
2764
+ workspaceId: { type: "string", description: "Optional workspace scope" },
2765
+ visibility: {
2766
+ type: "string",
2767
+ description: "Topic visibility",
2768
+ enum: ["private", "team", "firm", "external", "public"]
2769
+ },
2770
+ metadata: { type: "object", description: "Optional topic metadata" },
2189
2771
  createdBy: { type: "string", description: "Who created this topic" }
2190
2772
  },
2191
2773
  required: ["name", "type"],
@@ -2194,6 +2776,9 @@ var CREATE_TOPIC = {
2194
2776
  fields: {
2195
2777
  id: "string \u2014 topic ID",
2196
2778
  globalId: "string \u2014 globally unique ID",
2779
+ topicGlobalId: "string \u2014 topic global ID",
2780
+ epistemicNodeId: "string \u2014 materialized topic node ID",
2781
+ epistemicNodeGlobalId: "string \u2014 materialized topic node global ID",
2197
2782
  depth: "number \u2014 nesting depth"
2198
2783
  }
2199
2784
  },
@@ -2243,7 +2828,7 @@ var GET_TOPIC = {
2243
2828
  description: "Legacy alias for topicId"
2244
2829
  }
2245
2830
  },
2246
- required: [],
2831
+ required: ["topicId"],
2247
2832
  response: {
2248
2833
  description: "Single topic record",
2249
2834
  fields: {
@@ -2324,6 +2909,65 @@ var GET_TOPIC_TREE = {
2324
2909
  ontologyPrimitive: "graph",
2325
2910
  tier: "workhorse"
2326
2911
  };
2912
+ var MATERIALIZE_TOPIC_GRAPH = {
2913
+ name: "materialize_topic_graph",
2914
+ description: "Backfill the topic graph spine. Like `git fsck --connectivity-only` with repair enabled \u2014 creates missing topic nodes and parent-child edges idempotently.",
2915
+ parameters: {
2916
+ rootTopicId: {
2917
+ type: "string",
2918
+ description: "Optional root topic for a bounded materialization pass"
2919
+ },
2920
+ dryRun: {
2921
+ type: "boolean",
2922
+ description: "When true, report missing rows without writing them"
2923
+ }
2924
+ },
2925
+ required: [],
2926
+ response: {
2927
+ description: "Topic graph materialization counts",
2928
+ fields: {
2929
+ topicsSeen: "number",
2930
+ nodesCreated: "number",
2931
+ nodesExisting: "number",
2932
+ edgesCreated: "number",
2933
+ edgesExisting: "number",
2934
+ errors: "array"
2935
+ }
2936
+ },
2937
+ ownerModule: "reasoning-kernel",
2938
+ ontologyPrimitive: "graph",
2939
+ tier: "workhorse"
2940
+ };
2941
+ var GET_TOPIC_GRAPH_SPINE = {
2942
+ name: "get_topic_graph_spine",
2943
+ description: "Verify the topic graph spine. Like `git fsck` \u2014 reads topics, materialized topic nodes, parent-child edges, and missing spine rows.",
2944
+ parameters: {
2945
+ rootTopicId: {
2946
+ type: "string",
2947
+ description: "Optional root topic for a bounded verifier pass"
2948
+ },
2949
+ includeTopicBeliefEdges: {
2950
+ type: "boolean",
2951
+ description: "Include topic -> belief edges in the verifier payload"
2952
+ }
2953
+ },
2954
+ required: [],
2955
+ response: {
2956
+ description: "Topic graph spine verification payload",
2957
+ fields: {
2958
+ ok: "boolean",
2959
+ counts: "object",
2960
+ topics: "array",
2961
+ topicNodes: "array",
2962
+ parentEdges: "array",
2963
+ missingTopicNodes: "array",
2964
+ missingParentEdges: "array"
2965
+ }
2966
+ },
2967
+ ownerModule: "reasoning-kernel",
2968
+ ontologyPrimitive: "graph",
2969
+ tier: "workhorse"
2970
+ };
2327
2971
  var GET_CODE_CONTEXT = {
2328
2972
  name: "get_code_context",
2329
2973
  description: "Returns code-grounded beliefs, contracts, migration states, and failed attempts anchored to a specific file or function path. Like `git log -- <path>` \u2014 filters the knowledge graph to nodes anchored to a file path via metadata.codeAnchors. Results are separated by coding belief type: decisions, contracts, migrations, patterns, deprecations, and failures.",
@@ -2598,7 +3242,7 @@ var GET_ONTOLOGY = {
2598
3242
  description: "Tenant scope for key lookup. Omit for platform-level."
2599
3243
  }
2600
3244
  },
2601
- required: [],
3245
+ required: ["id"],
2602
3246
  response: {
2603
3247
  description: "Ontology definition with latest published version",
2604
3248
  fields: {
@@ -2665,7 +3309,7 @@ var MATCH_ENTITY_TYPE = {
2665
3309
  description: "Optional maximum number of ranked matches to return"
2666
3310
  }
2667
3311
  },
2668
- required: ["text"],
3312
+ required: ["text", "ontologyId"],
2669
3313
  response: {
2670
3314
  description: "Ranked ontology entity type matches",
2671
3315
  fields: {
@@ -2919,7 +3563,7 @@ var RECORD_SCOPE_LEARNING = {
2919
3563
  };
2920
3564
  var PIPELINE_SNAPSHOT = {
2921
3565
  name: "pipeline_snapshot",
2922
- 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.",
3566
+ 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.",
2923
3567
  parameters: {
2924
3568
  topicId: { type: "string", description: "Topic scope ID" }
2925
3569
  },
@@ -2929,14 +3573,14 @@ var PIPELINE_SNAPSHOT = {
2929
3573
  fields: {
2930
3574
  topicId: "string",
2931
3575
  topicName: "string",
2932
- currentBand: "number | null",
2933
- nextBand: "number | null",
3576
+ currentCampaign: "number | null",
3577
+ nextCampaign: "number | null",
2934
3578
  activeWorktrees: "array \u2014 current hinge worktree(s)",
2935
- nextWave: "array \u2014 worktrees in the next planned band",
3579
+ nextWave: "array \u2014 worktrees in the next planned campaign",
2936
3580
  readyNow: "array \u2014 planning worktrees with dependencies completed",
2937
3581
  blockedBy: "array \u2014 grouped blockers",
2938
3582
  criticalPath: "array \u2014 ordered incomplete worktree chain",
2939
- bands: "array \u2014 incomplete worktrees grouped by executionBand",
3583
+ campaigns: "array \u2014 incomplete worktrees grouped by campaign",
2940
3584
  superseded: "array \u2014 worktrees marked superseded or not for activation",
2941
3585
  graphHygiene: "object \u2014 untargeted and taskless worktree debt",
2942
3586
  riskQuestions: "array \u2014 critical/high open questions",
@@ -3456,6 +4100,69 @@ var GENERATE_SESSION_HANDOFF = {
3456
4100
  tier: "showcase",
3457
4101
  internal: true
3458
4102
  };
4103
+ var BEGIN_BUILD_SESSION = {
4104
+ name: "begin_build_session",
4105
+ 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.",
4106
+ parameters: {
4107
+ worktreeId: {
4108
+ type: "string",
4109
+ description: "The Lucern worktree ID to bootstrap."
4110
+ },
4111
+ branch: {
4112
+ type: "string",
4113
+ description: "Optional git branch name. Auto-generated from the worktree name when omitted."
4114
+ },
4115
+ branchBase: {
4116
+ type: "string",
4117
+ description: 'Base branch for the feature branch. Default: "staging".'
4118
+ },
4119
+ prBase: {
4120
+ type: "string",
4121
+ description: 'Target branch for the PR. Default: "staging".'
4122
+ },
4123
+ sessionMode: {
4124
+ type: "string",
4125
+ description: 'Session mode: "async" for Codex/headless or "interactive" for live sessions.',
4126
+ enum: ["async", "interactive"]
4127
+ },
4128
+ activateIfPlanning: {
4129
+ type: "boolean",
4130
+ description: "When true, automatically activate a planning worktree during bootstrap."
4131
+ }
4132
+ },
4133
+ required: ["worktreeId"],
4134
+ response: {
4135
+ description: "A compact build-session packet with worktree metadata, graph anchors, questions, dependencies, and git defaults.",
4136
+ fields: {
4137
+ topicId: "string \u2014 canonical topic scope",
4138
+ topicName: "string \u2014 human-readable topic name",
4139
+ worktreeId: "string \u2014 worktree ID",
4140
+ worktreeName: "string \u2014 human-readable worktree name",
4141
+ branch: "string \u2014 git branch name",
4142
+ branchBase: "string \u2014 base branch",
4143
+ prBase: "string \u2014 PR target branch",
4144
+ campaign: "number | null \u2014 top-level pipeline campaign",
4145
+ lane: "string \u2014 campaign lane",
4146
+ gate: "string \u2014 exit gate",
4147
+ hypothesis: "string \u2014 worktree hypothesis",
4148
+ focus: "string \u2014 session focus",
4149
+ status: "string \u2014 worktree status after optional activation",
4150
+ sessionMode: "string \u2014 async | interactive",
4151
+ targetBeliefIds: "array \u2014 scoped belief IDs",
4152
+ targetQuestionIds: "array \u2014 scoped question IDs",
4153
+ topBeliefs: "array \u2014 highest-confidence scoped beliefs",
4154
+ openQuestions: "array \u2014 open scoped questions",
4155
+ resolvedDecisions: "array \u2014 answered questions summarized for the session",
4156
+ dependencies: "array \u2014 upstream worktrees",
4157
+ unblocks: "array \u2014 downstream worktrees",
4158
+ mergeOrderNotes: "string \u2014 merge ordering advisory"
4159
+ }
4160
+ },
4161
+ ownerModule: "bootstrap",
4162
+ ontologyPrimitive: "worktree",
4163
+ tier: "showcase",
4164
+ internal: true
4165
+ };
3459
4166
  var MCP_TOOL_CONTRACTS = {
3460
4167
  // Belief lifecycle (commit, amend, fork, archive)
3461
4168
  create_belief: CREATE_BELIEF,
@@ -3498,11 +4205,26 @@ var MCP_TOOL_CONTRACTS = {
3498
4205
  bisect_confidence: BISECT_CONFIDENCE,
3499
4206
  // Edges (commit)
3500
4207
  create_edge: CREATE_EDGE,
4208
+ update_edge: UPDATE_EDGE,
4209
+ remove_edge: REMOVE_EDGE,
4210
+ remove_edges_between: REMOVE_EDGES_BETWEEN,
4211
+ batch_create_edges: BATCH_CREATE_EDGES,
4212
+ // Epistemic node spine (commit/amend/show)
4213
+ create_epistemic_node: CREATE_EPISTEMIC_NODE,
4214
+ get_epistemic_node: GET_EPISTEMIC_NODE,
4215
+ list_epistemic_nodes: LIST_EPISTEMIC_NODES,
4216
+ update_epistemic_node: UPDATE_EPISTEMIC_NODE,
4217
+ archive_epistemic_node: ARCHIVE_EPISTEMIC_NODE,
4218
+ verify_epistemic_node: VERIFY_EPISTEMIC_NODE,
4219
+ supersede_epistemic_node: SUPERSEDE_EPISTEMIC_NODE,
4220
+ batch_create_epistemic_nodes: BATCH_CREATE_EPISTEMIC_NODES,
3501
4221
  // Judgments (tag)
3502
4222
  record_judgment: RECORD_JUDGMENT,
3503
4223
  // Graph intelligence (showcase)
3504
4224
  detect_confirmation_bias: DETECT_CONFIRMATION_BIAS,
3505
4225
  get_graph_structure_analysis: GET_GRAPH_STRUCTURE_ANALYSIS,
4226
+ list_graph_intelligence_queries: LIST_GRAPH_INTELLIGENCE_QUERIES,
4227
+ run_graph_intelligence_query: RUN_GRAPH_INTELLIGENCE_QUERY,
3506
4228
  get_falsification_questions: GET_FALSIFICATION_QUESTIONS,
3507
4229
  // Evidence operations (workhorse)
3508
4230
  search_evidence: SEARCH_EVIDENCE,
@@ -3525,6 +4247,7 @@ var MCP_TOOL_CONTRACTS = {
3525
4247
  list_beliefs: LIST_BELIEFS,
3526
4248
  list_worktrees: LIST_WORKTREES,
3527
4249
  list_all_worktrees: LIST_ALL_WORKTREES,
4250
+ list_campaigns: LIST_CAMPAIGNS,
3528
4251
  activate_worktree: ACTIVATE_WORKTREE,
3529
4252
  update_worktree_targets: UPDATE_WORKTREE_TARGETS,
3530
4253
  update_worktree_metadata: UPDATE_WORKTREE_METADATA,
@@ -3548,6 +4271,7 @@ var MCP_TOOL_CONTRACTS = {
3548
4271
  get_agent_inbox: GET_AGENT_INBOX,
3549
4272
  claim_files: CLAIM_FILES,
3550
4273
  generate_session_handoff: GENERATE_SESSION_HANDOFF,
4274
+ begin_build_session: BEGIN_BUILD_SESSION,
3551
4275
  // Policy / ACL (workhorse)
3552
4276
  check_permission: CHECK_PERMISSION,
3553
4277
  filter_by_permission: FILTER_BY_PERMISSION,
@@ -3567,6 +4291,8 @@ var MCP_TOOL_CONTRACTS = {
3567
4291
  get_topic: GET_TOPIC,
3568
4292
  update_topic: UPDATE_TOPIC,
3569
4293
  get_topic_tree: GET_TOPIC_TREE,
4294
+ materialize_topic_graph: MATERIALIZE_TOPIC_GRAPH,
4295
+ get_topic_graph_spine: GET_TOPIC_GRAPH_SPINE,
3570
4296
  // Coding intelligence (code-grounded knowledge)
3571
4297
  get_code_context: GET_CODE_CONTEXT,
3572
4298
  get_change_history: GET_CHANGE_HISTORY,
@@ -3671,18 +4397,34 @@ var MCP_CORE_OPERATION_NAMES = [
3671
4397
  "find_missing_questions",
3672
4398
  "get_high_priority_questions",
3673
4399
  "get_falsification_questions",
4400
+ "create_epistemic_node",
4401
+ "get_epistemic_node",
4402
+ "list_epistemic_nodes",
4403
+ "update_epistemic_node",
4404
+ "archive_epistemic_node",
4405
+ "verify_epistemic_node",
4406
+ "supersede_epistemic_node",
4407
+ "batch_create_epistemic_nodes",
3674
4408
  "create_topic",
3675
4409
  "get_topic",
3676
4410
  "list_topics",
3677
4411
  "update_topic",
3678
- "get_topic_tree"
4412
+ "get_topic_tree",
4413
+ "materialize_topic_graph",
4414
+ "get_topic_graph_spine"
3679
4415
  ];
3680
4416
  var MCP_ANALYSIS_PLATFORM_OPERATION_NAMES = [
3681
4417
  "create_edge",
4418
+ "update_edge",
4419
+ "remove_edge",
4420
+ "remove_edges_between",
4421
+ "batch_create_edges",
3682
4422
  "query_lineage",
3683
4423
  "traverse_graph",
3684
4424
  "get_graph_neighborhood",
3685
4425
  "get_graph_structure_analysis",
4426
+ "list_graph_intelligence_queries",
4427
+ "run_graph_intelligence_query",
3686
4428
  "find_contradictions",
3687
4429
  "flag_contradiction",
3688
4430
  "detect_confirmation_bias",
@@ -3707,6 +4449,7 @@ var MCP_WORKFLOW_PLATFORM_OPERATION_NAMES = [
3707
4449
  "activate_worktree",
3708
4450
  "list_worktrees",
3709
4451
  "list_all_worktrees",
4452
+ "list_campaigns",
3710
4453
  "update_worktree_targets",
3711
4454
  "update_worktree_metadata",
3712
4455
  "create_task",
@@ -3773,6 +4516,7 @@ var PLATFORM_INTERNAL_OPERATION_NAMES = [
3773
4516
  "get_change_history",
3774
4517
  "get_failure_log",
3775
4518
  "record_attempt",
4519
+ "begin_build_session",
3776
4520
  "push",
3777
4521
  "open_pull_request",
3778
4522
  "record_judgment",
@@ -3827,7 +4571,6 @@ var SDK_ONLY_OPERATION_NAMES = [
3827
4571
  "find_semantic_orphans"
3828
4572
  ];
3829
4573
  var MCP_ONLY_INTERNAL_OPERATION_NAMES = [
3830
- "begin_build_session",
3831
4574
  "evaluate_engineering_contract",
3832
4575
  "evaluate_research_contract"
3833
4576
  ];
@@ -3954,6 +4697,7 @@ function surfaceIntentGateViolations(entry) {
3954
4697
 
3955
4698
  // src/function-registry/helpers.ts
3956
4699
  var jsonObjectSchema = z.record(z.unknown());
4700
+ var sdkSessionIdSchema = z.string().optional();
3957
4701
  function mcpContractShape(contract) {
3958
4702
  const required = new Set(contract.required);
3959
4703
  return Object.fromEntries(
@@ -3988,10 +4732,40 @@ function argsSchemaFromMcpContract(contract) {
3988
4732
  return z.object(mcpContractShape(contract));
3989
4733
  }
3990
4734
  function inputSchemaFromMcpContract(contract) {
3991
- return argsSchemaFromMcpContract(contract).passthrough();
4735
+ return withInternalSurfaceFields(argsSchemaFromMcpContract(contract));
4736
+ }
4737
+ function withInternalSurfaceFields(schema) {
4738
+ return schema.extend({ __sdkSessionId: sdkSessionIdSchema }).strict();
4739
+ }
4740
+ function normalizeInputSchema(schema) {
4741
+ if (schema instanceof z.ZodObject) {
4742
+ return withInternalSurfaceFields(schema);
4743
+ }
4744
+ return schema;
4745
+ }
4746
+ function unwrapObjectSchema(schema) {
4747
+ let current = schema;
4748
+ while (true) {
4749
+ switch (current._def.typeName) {
4750
+ case z.ZodFirstPartyTypeKind.ZodEffects:
4751
+ current = current._def.schema;
4752
+ continue;
4753
+ case z.ZodFirstPartyTypeKind.ZodBranded:
4754
+ current = current._def.type;
4755
+ continue;
4756
+ default:
4757
+ return current instanceof z.ZodObject ? current : void 0;
4758
+ }
4759
+ }
3992
4760
  }
3993
4761
  function getObjectShape(schema) {
3994
- const shape = typeof schema._def.shape === "function" ? schema._def.shape() : schema._def.shape;
4762
+ const objectSchema = unwrapObjectSchema(schema);
4763
+ if (!objectSchema) {
4764
+ throw new Error(
4765
+ `Expected a Zod object schema, received ${schema._def.typeName}.`
4766
+ );
4767
+ }
4768
+ const shape = typeof objectSchema._def.shape === "function" ? objectSchema._def.shape() : objectSchema._def.shape;
3995
4769
  return shape;
3996
4770
  }
3997
4771
  function unwrapMcpParameterSchema(schema) {
@@ -4012,6 +4786,9 @@ function unwrapMcpParameterSchema(schema) {
4012
4786
  case z.ZodFirstPartyTypeKind.ZodBranded:
4013
4787
  current = current._def.type;
4014
4788
  continue;
4789
+ case z.ZodFirstPartyTypeKind.ZodEffects:
4790
+ current = current._def.schema;
4791
+ continue;
4015
4792
  default:
4016
4793
  return { schema: current, required, description: description ?? current.description };
4017
4794
  }
@@ -4031,6 +4808,7 @@ function mcpParameterFromZod(fieldName, schema, contractName) {
4031
4808
  return { parameter: { type: "array", description }, required };
4032
4809
  case z.ZodFirstPartyTypeKind.ZodObject:
4033
4810
  case z.ZodFirstPartyTypeKind.ZodRecord:
4811
+ case z.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
4034
4812
  return { parameter: { type: "object", description }, required };
4035
4813
  case z.ZodFirstPartyTypeKind.ZodEnum:
4036
4814
  return {
@@ -4074,9 +4852,7 @@ function mcpContractFromArgsSchema(base, args, contractName) {
4074
4852
  required: converted.filter(([, field]) => field.required).map(([fieldName]) => fieldName)
4075
4853
  };
4076
4854
  }
4077
- function defineFunctionContract(contract) {
4078
- return contract;
4079
- }
4855
+ var defineFunctionContract = (contract) => contract;
4080
4856
  function classifyContract(contract, surfaceClass) {
4081
4857
  return {
4082
4858
  ...contract,
@@ -4098,6 +4874,14 @@ function withCreatedBy(input, context) {
4098
4874
  createdBy: typeof input.createdBy === "string" ? input.createdBy : authUserId(context)
4099
4875
  };
4100
4876
  }
4877
+ function compactRecord(input) {
4878
+ return Object.fromEntries(
4879
+ Object.entries(input).filter(([, value]) => value !== void 0)
4880
+ );
4881
+ }
4882
+ function recordValue(value) {
4883
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
4884
+ }
4101
4885
  function surfaceMcpContract(name) {
4102
4886
  const contract = MCP_TOOL_CONTRACTS[name];
4103
4887
  if (!contract) {
@@ -4142,7 +4926,9 @@ function surfaceContract(args) {
4142
4926
  const canonicalArgs = args.args ?? argsSchemaFromMcpContract(baseMcp);
4143
4927
  const mcp = args.args ? mcpContractFromArgsSchema(baseMcp, canonicalArgs, args.name) : baseMcp;
4144
4928
  const canonicalReturns = args.returns ?? jsonObjectSchema;
4145
- const input = args.input ?? inputSchemaFromMcpContract(mcp);
4929
+ const input = normalizeInputSchema(
4930
+ args.input ?? inputSchemaFromMcpContract(mcp)
4931
+ );
4146
4932
  const output = args.output ?? canonicalReturns;
4147
4933
  return defineFunctionContract({
4148
4934
  name: args.name,
@@ -4201,6 +4987,381 @@ function assertSurfaceCoverage(contracts) {
4201
4987
  }
4202
4988
  }
4203
4989
  }
4990
+ 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"]);
4991
+ 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"];
4992
+ var STORAGE_EDGE_TYPE_VALUES = [...EDGE_TYPE_VALUES, "extracted_from"];
4993
+ z.enum(EDGE_TYPE_VALUES);
4994
+ z.enum(STORAGE_EDGE_TYPE_VALUES);
4995
+ z.enum(["active", "archived", "watching"]);
4996
+ z.enum(["private", "team", "firm", "external", "public"]);
4997
+
4998
+ // src/function-registry/nodes.ts
4999
+ var sourceTypeSchema = z.enum([
5000
+ "human",
5001
+ "ai_extracted",
5002
+ "ai_generated",
5003
+ "imported",
5004
+ "system",
5005
+ "verified",
5006
+ "proprietary"
5007
+ ]);
5008
+ var verificationStatusSchema = z.enum([
5009
+ "unverified",
5010
+ "human_verified",
5011
+ "ai_verified",
5012
+ "contradicted",
5013
+ "outdated"
5014
+ ]);
5015
+ var nodeStatusSchema = z.enum([
5016
+ "active",
5017
+ "superseded",
5018
+ "archived",
5019
+ "deleted"
5020
+ ]);
5021
+ var externalIdsArgs = z.object({
5022
+ crunchbase: z.string().optional(),
5023
+ linkedin: z.string().optional(),
5024
+ pitchbook: z.string().optional(),
5025
+ twitter: z.string().optional(),
5026
+ website: z.string().optional()
5027
+ }).optional();
5028
+ var createEpistemicNodeItemArgs = z.object({
5029
+ globalId: z.string().optional().describe("Optional idempotent node global ID."),
5030
+ nodeType: NODE_TYPE.describe("Public epistemic node type."),
5031
+ subtype: z.string().optional(),
5032
+ canonicalText: z.string().optional().describe("Canonical node text."),
5033
+ text: z.string().optional().describe("Alias for canonicalText."),
5034
+ contentHash: z.string().optional().describe("Optional idempotency content hash."),
5035
+ content: z.string().optional(),
5036
+ contentType: z.string().optional(),
5037
+ title: z.string().optional(),
5038
+ tags: z.array(z.string()).optional(),
5039
+ domain: z.string().optional(),
5040
+ metadata: z.record(z.unknown()).optional(),
5041
+ externalIds: externalIdsArgs,
5042
+ sourceType: sourceTypeSchema.optional(),
5043
+ aiProvider: z.string().optional(),
5044
+ extractedFromNodeId: z.string().optional(),
5045
+ confidence: z.number().optional(),
5046
+ verificationStatus: verificationStatusSchema.optional(),
5047
+ topicId: z.string().optional(),
5048
+ projectId: z.string().optional(),
5049
+ createdBy: z.string().optional(),
5050
+ trustedBypassAccessCheck: z.boolean().optional()
5051
+ });
5052
+ var createEpistemicNodeArgs = createEpistemicNodeItemArgs;
5053
+ var batchCreateEpistemicNodesArgs = z.object({
5054
+ nodes: z.array(createEpistemicNodeItemArgs)
5055
+ });
5056
+ var getEpistemicNodeArgs = z.object({
5057
+ nodeId: z.string().describe("Node ID or global ID."),
5058
+ globalId: z.string().optional().describe("Node global ID alias.")
5059
+ });
5060
+ var listEpistemicNodesArgs = z.object({
5061
+ topicId: z.string().optional(),
5062
+ projectId: z.string().optional(),
5063
+ nodeType: NODE_TYPE.optional(),
5064
+ status: nodeStatusSchema.optional(),
5065
+ searchQuery: z.string().optional(),
5066
+ query: z.string().optional(),
5067
+ limit: z.number().optional()
5068
+ });
5069
+ var updateEpistemicNodeArgs = z.object({
5070
+ nodeId: z.string().describe("Node ID or global ID."),
5071
+ id: z.string().optional().describe("Node ID alias."),
5072
+ subtype: z.string().optional(),
5073
+ canonicalText: z.string().optional(),
5074
+ text: z.string().optional(),
5075
+ contentHash: z.string().optional(),
5076
+ content: z.string().optional(),
5077
+ contentType: z.string().optional(),
5078
+ title: z.string().optional(),
5079
+ tags: z.array(z.string()).optional(),
5080
+ domain: z.string().optional(),
5081
+ metadata: z.record(z.unknown()).optional(),
5082
+ externalIds: externalIdsArgs,
5083
+ confidence: z.number().optional(),
5084
+ verificationStatus: verificationStatusSchema.optional(),
5085
+ status: nodeStatusSchema.optional(),
5086
+ userId: z.string().optional(),
5087
+ trustedBypassAccessCheck: z.boolean().optional()
5088
+ });
5089
+ var archiveEpistemicNodeArgs = z.object({
5090
+ nodeId: z.string().describe("Node ID or global ID."),
5091
+ id: z.string().optional().describe("Node ID alias."),
5092
+ userId: z.string().optional(),
5093
+ trustedBypassAccessCheck: z.boolean().optional()
5094
+ });
5095
+ var verifyEpistemicNodeArgs = z.object({
5096
+ nodeId: z.string().describe("Node ID or global ID."),
5097
+ id: z.string().optional().describe("Node ID alias."),
5098
+ verificationStatus: verificationStatusSchema,
5099
+ confidence: z.number().optional(),
5100
+ userId: z.string().optional()
5101
+ });
5102
+ var supersedeEpistemicNodeArgs = z.object({
5103
+ oldNodeId: z.string().describe("Node ID or global ID to supersede."),
5104
+ nodeId: z.string().optional().describe("Old node ID alias."),
5105
+ newGlobalId: z.string().optional(),
5106
+ newCanonicalText: z.string().optional(),
5107
+ text: z.string().optional(),
5108
+ canonicalText: z.string().optional(),
5109
+ newContentHash: z.string().optional(),
5110
+ reason: z.string().optional(),
5111
+ createdBy: z.string().optional(),
5112
+ trustedBypassAccessCheck: z.boolean().optional()
5113
+ });
5114
+ function generatedGlobalId(prefix) {
5115
+ return `${prefix}:${crypto.randomUUID()}`;
5116
+ }
5117
+ function resolveCanonicalText(input) {
5118
+ const text = input.canonicalText ?? input.text ?? input.title ?? input.content;
5119
+ if (typeof text !== "string" || text.trim().length === 0) {
5120
+ throw new Error("canonicalText or text is required.");
5121
+ }
5122
+ return text;
5123
+ }
5124
+ function createNodeInput(input, context) {
5125
+ const canonicalText = resolveCanonicalText(input);
5126
+ const nodeType = String(input.nodeType);
5127
+ return withCreatedBy(
5128
+ compactRecord({
5129
+ globalId: typeof input.globalId === "string" && input.globalId.trim() ? input.globalId : generatedGlobalId(nodeType),
5130
+ nodeType,
5131
+ subtype: input.subtype,
5132
+ canonicalText,
5133
+ contentHash: typeof input.contentHash === "string" && input.contentHash.trim() ? input.contentHash : `${nodeType}:${canonicalText}`,
5134
+ content: input.content,
5135
+ contentType: input.contentType,
5136
+ title: input.title,
5137
+ tags: input.tags,
5138
+ domain: input.domain,
5139
+ metadata: input.metadata,
5140
+ externalIds: input.externalIds,
5141
+ sourceType: typeof input.sourceType === "string" && input.sourceType.trim() ? input.sourceType : "human",
5142
+ aiProvider: input.aiProvider,
5143
+ extractedFromNodeId: input.extractedFromNodeId,
5144
+ confidence: input.confidence,
5145
+ verificationStatus: input.verificationStatus,
5146
+ topicId: input.topicId,
5147
+ projectId: input.projectId
5148
+ }),
5149
+ context
5150
+ );
5151
+ }
5152
+ var getNodeInput = (input) => compactRecord({
5153
+ nodeId: input.nodeId ?? input.globalId
5154
+ });
5155
+ var listNodesInput = (input) => compactRecord({
5156
+ topicId: input.topicId,
5157
+ projectId: input.projectId,
5158
+ nodeType: input.nodeType,
5159
+ status: input.status,
5160
+ searchQuery: input.searchQuery ?? input.query,
5161
+ limit: input.limit
5162
+ });
5163
+ var updateNodeInput = (input, context) => withUserId(
5164
+ compactRecord({
5165
+ nodeId: input.nodeId ?? input.id,
5166
+ subtype: input.subtype,
5167
+ canonicalText: input.canonicalText ?? input.text,
5168
+ contentHash: input.contentHash,
5169
+ content: input.content,
5170
+ contentType: input.contentType,
5171
+ title: input.title,
5172
+ tags: input.tags,
5173
+ domain: input.domain,
5174
+ metadata: input.metadata,
5175
+ externalIds: input.externalIds,
5176
+ confidence: input.confidence,
5177
+ verificationStatus: input.verificationStatus,
5178
+ status: input.status,
5179
+ trustedBypassAccessCheck: input.trustedBypassAccessCheck
5180
+ }),
5181
+ context
5182
+ );
5183
+ var archiveNodeInput = (input, context) => withUserId(
5184
+ compactRecord({
5185
+ nodeId: input.nodeId ?? input.id,
5186
+ trustedBypassAccessCheck: input.trustedBypassAccessCheck
5187
+ }),
5188
+ context
5189
+ );
5190
+ var verifyNodeInput = (input, context) => withUserId(
5191
+ compactRecord({
5192
+ nodeId: input.nodeId ?? input.id,
5193
+ verificationStatus: input.verificationStatus,
5194
+ confidence: input.confidence
5195
+ }),
5196
+ context
5197
+ );
5198
+ var supersedeNodeInput = (input, context) => {
5199
+ const newCanonicalText = input.newCanonicalText ?? input.canonicalText ?? input.text;
5200
+ if (typeof newCanonicalText !== "string" || newCanonicalText.trim().length === 0) {
5201
+ throw new Error("newCanonicalText or text is required.");
5202
+ }
5203
+ return {
5204
+ oldNodeId: input.oldNodeId ?? input.nodeId,
5205
+ newGlobalId: typeof input.newGlobalId === "string" && input.newGlobalId.trim() ? input.newGlobalId : generatedGlobalId("node"),
5206
+ newCanonicalText,
5207
+ newContentHash: typeof input.newContentHash === "string" && input.newContentHash.trim() ? input.newContentHash : `superseded:${newCanonicalText}`,
5208
+ createdBy: typeof input.createdBy === "string" ? input.createdBy : authUserId(context),
5209
+ reason: input.reason,
5210
+ trustedBypassAccessCheck: input.trustedBypassAccessCheck
5211
+ };
5212
+ };
5213
+ var batchCreateNodesInput = (input, context) => {
5214
+ const nodes = Array.isArray(input.nodes) ? input.nodes : [];
5215
+ return {
5216
+ nodes: nodes.map(
5217
+ (node) => createNodeInput(
5218
+ node && typeof node === "object" ? node : {},
5219
+ context
5220
+ )
5221
+ )
5222
+ };
5223
+ };
5224
+ var nodesContracts = [
5225
+ surfaceContract({
5226
+ name: "create_epistemic_node",
5227
+ kind: "mutation",
5228
+ domain: "nodes",
5229
+ surfaceClass: "platform_public",
5230
+ path: "/nodes",
5231
+ sdkNamespace: "nodes",
5232
+ sdkMethod: "createEpistemicNode",
5233
+ summary: "Create a generic epistemic graph node.",
5234
+ convex: {
5235
+ module: "nodes",
5236
+ functionName: "create",
5237
+ kind: "mutation",
5238
+ inputProjection: createNodeInput
5239
+ },
5240
+ args: createEpistemicNodeArgs
5241
+ }),
5242
+ surfaceContract({
5243
+ name: "get_epistemic_node",
5244
+ kind: "query",
5245
+ domain: "nodes",
5246
+ surfaceClass: "platform_public",
5247
+ method: "GET",
5248
+ path: "/nodes/get",
5249
+ sdkNamespace: "nodes",
5250
+ sdkMethod: "getEpistemicNode",
5251
+ summary: "Get a generic epistemic graph node.",
5252
+ convex: {
5253
+ module: "nodes",
5254
+ functionName: "get",
5255
+ kind: "query",
5256
+ inputProjection: getNodeInput
5257
+ },
5258
+ args: getEpistemicNodeArgs
5259
+ }),
5260
+ surfaceContract({
5261
+ name: "list_epistemic_nodes",
5262
+ kind: "query",
5263
+ domain: "nodes",
5264
+ surfaceClass: "platform_public",
5265
+ method: "GET",
5266
+ path: "/nodes",
5267
+ sdkNamespace: "nodes",
5268
+ sdkMethod: "listEpistemicNodes",
5269
+ summary: "List generic epistemic graph nodes.",
5270
+ convex: {
5271
+ module: "nodes",
5272
+ functionName: "list",
5273
+ kind: "query",
5274
+ inputProjection: listNodesInput
5275
+ },
5276
+ args: listEpistemicNodesArgs
5277
+ }),
5278
+ surfaceContract({
5279
+ name: "update_epistemic_node",
5280
+ kind: "mutation",
5281
+ domain: "nodes",
5282
+ surfaceClass: "platform_public",
5283
+ method: "PATCH",
5284
+ path: "/nodes",
5285
+ sdkNamespace: "nodes",
5286
+ sdkMethod: "updateEpistemicNode",
5287
+ summary: "Update a generic epistemic graph node.",
5288
+ convex: {
5289
+ module: "nodes",
5290
+ functionName: "update",
5291
+ kind: "mutation",
5292
+ inputProjection: updateNodeInput
5293
+ },
5294
+ args: updateEpistemicNodeArgs
5295
+ }),
5296
+ surfaceContract({
5297
+ name: "archive_epistemic_node",
5298
+ kind: "mutation",
5299
+ domain: "nodes",
5300
+ surfaceClass: "platform_public",
5301
+ path: "/nodes/archive",
5302
+ sdkNamespace: "nodes",
5303
+ sdkMethod: "archiveEpistemicNode",
5304
+ summary: "Archive a generic epistemic graph node.",
5305
+ convex: {
5306
+ module: "nodes",
5307
+ functionName: "archive",
5308
+ kind: "mutation",
5309
+ inputProjection: archiveNodeInput
5310
+ },
5311
+ args: archiveEpistemicNodeArgs
5312
+ }),
5313
+ surfaceContract({
5314
+ name: "verify_epistemic_node",
5315
+ kind: "mutation",
5316
+ domain: "nodes",
5317
+ surfaceClass: "platform_public",
5318
+ path: "/nodes/verify",
5319
+ sdkNamespace: "nodes",
5320
+ sdkMethod: "verifyEpistemicNode",
5321
+ summary: "Verify a generic epistemic graph node.",
5322
+ convex: {
5323
+ module: "nodes",
5324
+ functionName: "verify",
5325
+ kind: "mutation",
5326
+ inputProjection: verifyNodeInput
5327
+ },
5328
+ args: verifyEpistemicNodeArgs
5329
+ }),
5330
+ surfaceContract({
5331
+ name: "supersede_epistemic_node",
5332
+ kind: "mutation",
5333
+ domain: "nodes",
5334
+ surfaceClass: "platform_public",
5335
+ path: "/nodes/supersede",
5336
+ sdkNamespace: "nodes",
5337
+ sdkMethod: "supersedeEpistemicNode",
5338
+ summary: "Supersede a generic epistemic graph node.",
5339
+ convex: {
5340
+ module: "nodes",
5341
+ functionName: "supersede",
5342
+ kind: "mutation",
5343
+ inputProjection: supersedeNodeInput
5344
+ },
5345
+ args: supersedeEpistemicNodeArgs
5346
+ }),
5347
+ surfaceContract({
5348
+ name: "batch_create_epistemic_nodes",
5349
+ kind: "mutation",
5350
+ domain: "nodes",
5351
+ surfaceClass: "platform_public",
5352
+ path: "/nodes/batch",
5353
+ sdkNamespace: "nodes",
5354
+ sdkMethod: "batchCreateEpistemicNodes",
5355
+ summary: "Batch create generic epistemic graph nodes.",
5356
+ convex: {
5357
+ module: "nodes",
5358
+ functionName: "batchCreate",
5359
+ kind: "mutation",
5360
+ inputProjection: batchCreateNodesInput
5361
+ },
5362
+ args: batchCreateEpistemicNodesArgs
5363
+ })
5364
+ ];
4204
5365
  var ALL_FUNCTION_CONTRACTS = [
4205
5366
  ...contextContracts,
4206
5367
  ...identityContracts,
@@ -4208,6 +5369,7 @@ var ALL_FUNCTION_CONTRACTS = [
4208
5369
  ...evidenceContracts,
4209
5370
  ...questionsContracts,
4210
5371
  ...topicsContracts,
5372
+ ...nodesContracts,
4211
5373
  ...lensesContracts,
4212
5374
  ...ontologiesContracts,
4213
5375
  ...worktreesContracts,
@@ -4226,10 +5388,10 @@ var FUNCTION_SURFACE_CONTRACTS = ALL_FUNCTION_CONTRACTS;
4226
5388
  var FUNCTION_CONTRACTS_BY_NAME = new Map(
4227
5389
  ALL_FUNCTION_CONTRACTS.map((contract) => [contract.name, contract])
4228
5390
  );
4229
- function getFunctionContract(name) {
4230
- return FUNCTION_CONTRACTS_BY_NAME.get(name);
4231
- }
5391
+ var getFunctionContract = FUNCTION_CONTRACTS_BY_NAME.get.bind(
5392
+ FUNCTION_CONTRACTS_BY_NAME
5393
+ );
4232
5394
 
4233
- export { ALL_FUNCTION_CONTRACTS, DUPLICATE_OPERATION_NAMES, FORBIDDEN_APPLICATION_OPERATION_NAMES, FUNCTION_CONTRACTS_BY_NAME, FUNCTION_SURFACE_CONTRACTS, LEGACY_COMPAT_OPERATION_NAMES, LUCERN_OPERATION_MANIFEST, MCP_ANALYSIS_PLATFORM_OPERATION_NAMES, MCP_ANALYSIS_TENANT_OPERATION_NAMES, MCP_AUTOMATION_OPERATION_NAMES, MCP_CORE_OPERATION_NAMES, MCP_GOVERNANCE_PLATFORM_OPERATION_NAMES, MCP_GOVERNANCE_TENANT_OPERATION_NAMES, MCP_ONLY_INTERNAL_OPERATION_NAMES, MCP_WORKFLOW_PLATFORM_OPERATION_NAMES, MCP_WORKFLOW_TENANT_OPERATION_NAMES, PLATFORM_INTERNAL_OPERATION_NAMES, PLATFORM_PUBLIC_OPERATION_NAMES, SDK_ONLY_OPERATION_NAMES, TENANT_PUBLIC_OPERATION_NAMES, argsSchemaFromMcpContract, assertSurfaceCoverage, authUserId, classifyContract, defineFunctionContract, getFunctionContract, inputSchemaFromMcpContract, jsonObjectSchema, surfaceContract, surfaceEnabled, surfaceIntentGateViolations, surfaceMcpContract, withCreatedBy, withUserId };
5395
+ export { ALL_FUNCTION_CONTRACTS, DUPLICATE_OPERATION_NAMES, FORBIDDEN_APPLICATION_OPERATION_NAMES, FUNCTION_CONTRACTS_BY_NAME, FUNCTION_SURFACE_CONTRACTS, LEGACY_COMPAT_OPERATION_NAMES, LUCERN_OPERATION_MANIFEST, MCP_ANALYSIS_PLATFORM_OPERATION_NAMES, MCP_ANALYSIS_TENANT_OPERATION_NAMES, MCP_AUTOMATION_OPERATION_NAMES, MCP_CORE_OPERATION_NAMES, MCP_GOVERNANCE_PLATFORM_OPERATION_NAMES, MCP_GOVERNANCE_TENANT_OPERATION_NAMES, MCP_ONLY_INTERNAL_OPERATION_NAMES, MCP_WORKFLOW_PLATFORM_OPERATION_NAMES, MCP_WORKFLOW_TENANT_OPERATION_NAMES, PLATFORM_INTERNAL_OPERATION_NAMES, PLATFORM_PUBLIC_OPERATION_NAMES, SDK_ONLY_OPERATION_NAMES, TENANT_PUBLIC_OPERATION_NAMES, argsSchemaFromMcpContract, assertSurfaceCoverage, authUserId, classifyContract, compactRecord, defineFunctionContract, getFunctionContract, inputSchemaFromMcpContract, jsonObjectSchema, nodesContracts, recordValue, surfaceContract, surfaceEnabled, surfaceIntentGateViolations, surfaceMcpContract, withCreatedBy, withUserId };
4234
5396
  //# sourceMappingURL=index.js.map
4235
5397
  //# sourceMappingURL=index.js.map