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

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 (303) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/api-enums.contract.d.ts +5 -3
  3. package/dist/api-enums.contract.js +14 -12
  4. package/dist/api-enums.contract.js.map +1 -1
  5. package/dist/component-boundary.contract.d.ts +14 -0
  6. package/dist/component-boundary.contract.js +174 -0
  7. package/dist/component-boundary.contract.js.map +1 -0
  8. package/dist/component-host-boundary.contract.d.ts +46 -0
  9. package/dist/component-host-boundary.contract.js +60 -0
  10. package/dist/component-host-boundary.contract.js.map +1 -0
  11. package/dist/context-pack.contract.d.ts +5 -3
  12. package/dist/context-pack.contract.js.map +1 -1
  13. package/dist/{defineTable-CBQ03FXl.d.ts → defineTable-t1wr5wgn.d.ts} +1 -1
  14. package/dist/{dsl-BgpoVOVQ.d.ts → dsl-DVPthQGY.d.ts} +2 -2
  15. package/dist/dsl.d.ts +2 -2
  16. package/dist/dsl.js +1 -4
  17. package/dist/dsl.js.map +1 -1
  18. package/dist/edge-policy-manifest-Dw5IhT1L.d.ts +133 -0
  19. package/dist/function-registry/beliefs.d.ts +54 -41
  20. package/dist/function-registry/beliefs.js +759 -38
  21. package/dist/function-registry/beliefs.js.map +1 -1
  22. package/dist/function-registry/coding.d.ts +9 -0
  23. package/dist/function-registry/coding.js +811 -39
  24. package/dist/function-registry/coding.js.map +1 -1
  25. package/dist/function-registry/context.d.ts +19 -13
  26. package/dist/function-registry/context.js +750 -42
  27. package/dist/function-registry/context.js.map +1 -1
  28. package/dist/function-registry/contracts.d.ts +6 -0
  29. package/dist/function-registry/contracts.js +715 -35
  30. package/dist/function-registry/contracts.js.map +1 -1
  31. package/dist/function-registry/coordination.d.ts +12 -0
  32. package/dist/function-registry/coordination.js +715 -35
  33. package/dist/function-registry/coordination.js.map +1 -1
  34. package/dist/function-registry/edges.d.ts +165 -0
  35. package/dist/function-registry/edges.js +923 -67
  36. package/dist/function-registry/edges.js.map +1 -1
  37. package/dist/function-registry/evidence.d.ts +44 -33
  38. package/dist/function-registry/evidence.js +769 -47
  39. package/dist/function-registry/evidence.js.map +1 -1
  40. package/dist/function-registry/graph.d.ts +149 -53
  41. package/dist/function-registry/graph.js +831 -42
  42. package/dist/function-registry/graph.js.map +1 -1
  43. package/dist/function-registry/helpers.d.ts +6 -3
  44. package/dist/function-registry/helpers.js +716 -36
  45. package/dist/function-registry/helpers.js.map +1 -1
  46. package/dist/function-registry/identity.d.ts +6 -0
  47. package/dist/function-registry/identity.js +715 -35
  48. package/dist/function-registry/identity.js.map +1 -1
  49. package/dist/function-registry/index.d.ts +5 -3
  50. package/dist/function-registry/index.js +722 -39
  51. package/dist/function-registry/index.js.map +1 -1
  52. package/dist/function-registry/judgments.d.ts +14 -9
  53. package/dist/function-registry/judgments.js +727 -38
  54. package/dist/function-registry/judgments.js.map +1 -1
  55. package/dist/function-registry/legacy.d.ts +4 -0
  56. package/dist/function-registry/legacy.js +715 -35
  57. package/dist/function-registry/legacy.js.map +1 -1
  58. package/dist/function-registry/lenses.d.ts +24 -17
  59. package/dist/function-registry/lenses.js +738 -38
  60. package/dist/function-registry/lenses.js.map +1 -1
  61. package/dist/function-registry/manifest.d.ts +6 -6
  62. package/dist/function-registry/manifest.js +18 -2
  63. package/dist/function-registry/manifest.js.map +1 -1
  64. package/dist/function-registry/nodes.d.ts +412 -0
  65. package/dist/function-registry/nodes.js +5303 -0
  66. package/dist/function-registry/nodes.js.map +1 -0
  67. package/dist/function-registry/ontologies.d.ts +59 -45
  68. package/dist/function-registry/ontologies.js +733 -41
  69. package/dist/function-registry/ontologies.js.map +1 -1
  70. package/dist/function-registry/pipeline.d.ts +19 -13
  71. package/dist/function-registry/pipeline.js +724 -38
  72. package/dist/function-registry/pipeline.js.map +1 -1
  73. package/dist/function-registry/questions.d.ts +64 -49
  74. package/dist/function-registry/questions.js +812 -43
  75. package/dist/function-registry/questions.js.map +1 -1
  76. package/dist/function-registry/tasks.d.ts +24 -17
  77. package/dist/function-registry/tasks.js +776 -44
  78. package/dist/function-registry/tasks.js.map +1 -1
  79. package/dist/function-registry/topics.d.ts +109 -21
  80. package/dist/function-registry/topics.js +797 -39
  81. package/dist/function-registry/topics.js.map +1 -1
  82. package/dist/function-registry/types.d.ts +6 -2
  83. package/dist/function-registry/worktrees.d.ts +94 -41
  84. package/dist/function-registry/worktrees.js +854 -47
  85. package/dist/function-registry/worktrees.js.map +1 -1
  86. package/dist/function-registry-input-audit.d.ts +13 -0
  87. package/dist/function-registry-input-audit.js +166 -0
  88. package/dist/function-registry-input-audit.js.map +1 -0
  89. package/dist/gateway.contract.d.ts +5 -0
  90. package/dist/gateway.contract.js.map +1 -1
  91. package/dist/generated/convexSchemas.d.ts +3 -3
  92. package/dist/generated/convexSchemas.js +38 -18
  93. package/dist/generated/convexSchemas.js.map +1 -1
  94. package/dist/generated/infisicalRuntimeEnv.d.ts +70 -0
  95. package/dist/generated/infisicalRuntimeEnv.js +26572 -0
  96. package/dist/generated/infisicalRuntimeEnv.js.map +1 -0
  97. package/dist/generated/lucernGatewayEnv.d.ts +17 -0
  98. package/dist/generated/lucernGatewayEnv.js +38 -0
  99. package/dist/generated/lucernGatewayEnv.js.map +1 -0
  100. package/dist/generated/lucernWebPublicEnv.d.ts +26 -0
  101. package/dist/generated/lucernWebPublicEnv.js +32 -0
  102. package/dist/generated/lucernWebPublicEnv.js.map +1 -0
  103. package/dist/generated/lucernWebServerEnv.d.ts +33 -0
  104. package/dist/generated/lucernWebServerEnv.js +51 -0
  105. package/dist/generated/lucernWebServerEnv.js.map +1 -0
  106. package/dist/generated/schema-manifest.json +1199 -138
  107. package/dist/generated/tableOwnership.d.ts +47 -27
  108. package/dist/generated/tableOwnership.js +66 -26
  109. package/dist/generated/tableOwnership.js.map +1 -1
  110. package/dist/generated/tier-expectations.json +62 -8
  111. package/dist/graph-intelligence.contract.d.ts +506 -0
  112. package/dist/graph-intelligence.contract.js +595 -0
  113. package/dist/graph-intelligence.contract.js.map +1 -0
  114. package/dist/graph-types/index.d.ts +5 -1
  115. package/dist/graph-types/index.js +15 -4
  116. package/dist/graph-types/index.js.map +1 -1
  117. package/dist/index-CM1Pl_vI.d.ts +28 -0
  118. package/dist/index.d.ts +29 -414
  119. package/dist/index.js +34791 -1088
  120. package/dist/index.js.map +1 -1
  121. package/dist/infisical-runtime.contract.d.ts +1768 -0
  122. package/dist/infisical-runtime.contract.js +3093 -0
  123. package/dist/infisical-runtime.contract.js.map +1 -0
  124. package/dist/lens-filter.contract.js +4 -3
  125. package/dist/lens-filter.contract.js.map +1 -1
  126. package/dist/lens-workflow.contract.js +4 -3
  127. package/dist/lens-workflow.contract.js.map +1 -1
  128. package/dist/manifests/edge-policy-manifest.d.ts +2 -0
  129. package/dist/manifests/edge-policy-manifest.data.d.ts +13 -0
  130. package/dist/manifests/edge-policy-manifest.data.js +26 -0
  131. package/dist/manifests/edge-policy-manifest.data.js.map +1 -0
  132. package/dist/manifests/edge-policy-manifest.js +92 -0
  133. package/dist/manifests/edge-policy-manifest.js.map +1 -0
  134. package/dist/manifests/infisical-runtime-manifest.d.ts +1672 -0
  135. package/dist/manifests/infisical-runtime-manifest.js +2948 -0
  136. package/dist/manifests/infisical-runtime-manifest.js.map +1 -0
  137. package/dist/manifests/invariant-manifest.d.ts +65 -0
  138. package/dist/manifests/invariant-manifest.js +18 -0
  139. package/dist/manifests/invariant-manifest.js.map +1 -0
  140. package/dist/manifests/invariants/ast-utils.d.ts +14 -0
  141. package/dist/manifests/invariants/ast-utils.js +54 -0
  142. package/dist/manifests/invariants/ast-utils.js.map +1 -0
  143. package/dist/manifests/invariants/index.d.ts +15 -0
  144. package/dist/manifests/invariants/index.js +183 -0
  145. package/dist/manifests/invariants/index.js.map +1 -0
  146. package/dist/manifests/invariants/inv-1-beliefs-append-only.d.ts +12 -0
  147. package/dist/manifests/invariants/inv-1-beliefs-append-only.js +94 -0
  148. package/dist/manifests/invariants/inv-1-beliefs-append-only.js.map +1 -0
  149. package/dist/manifests/invariants/inv-14-no-silent-transitions.d.ts +12 -0
  150. package/dist/manifests/invariants/inv-14-no-silent-transitions.js +99 -0
  151. package/dist/manifests/invariants/inv-14-no-silent-transitions.js.map +1 -0
  152. package/dist/manifests/invariants/manifest-1-projections-declare-audit.d.ts +12 -0
  153. package/dist/manifests/invariants/manifest-1-projections-declare-audit.js +42 -0
  154. package/dist/manifests/invariants/manifest-1-projections-declare-audit.js.map +1 -0
  155. package/dist/manifests/tenant-client-manifest.d.ts +322 -0
  156. package/dist/manifests/tenant-client-manifest.js +432 -0
  157. package/dist/manifests/tenant-client-manifest.js.map +1 -0
  158. package/dist/mcp-gateway-boundary.contract.d.ts +201 -0
  159. package/dist/mcp-gateway-boundary.contract.js +45 -0
  160. package/dist/mcp-gateway-boundary.contract.js.map +1 -0
  161. package/dist/projections/check-convex-args-shape.d.ts +3 -0
  162. package/dist/projections/check-convex-args-shape.js +403 -0
  163. package/dist/projections/check-convex-args-shape.js.map +1 -0
  164. package/dist/projections/create-evidence.projection.d.ts +176 -0
  165. package/dist/projections/create-evidence.projection.js +130 -0
  166. package/dist/projections/create-evidence.projection.js.map +1 -0
  167. package/dist/projections/index.d.ts +102 -0
  168. package/dist/projections/index.js +352 -0
  169. package/dist/projections/index.js.map +1 -0
  170. package/dist/projections/list-beliefs.projection.d.ts +36 -0
  171. package/dist/projections/list-beliefs.projection.js +54 -0
  172. package/dist/projections/list-beliefs.projection.js.map +1 -0
  173. package/dist/projections/list-tasks.projection.d.ts +44 -0
  174. package/dist/projections/list-tasks.projection.js +57 -0
  175. package/dist/projections/list-tasks.projection.js.map +1 -0
  176. package/dist/projections/modulate-confidence.projection.d.ts +219 -0
  177. package/dist/projections/modulate-confidence.projection.js +148 -0
  178. package/dist/projections/modulate-confidence.projection.js.map +1 -0
  179. package/dist/projections/projection-dsl.d.ts +11 -0
  180. package/dist/projections/projection-dsl.js +8 -0
  181. package/dist/projections/projection-dsl.js.map +1 -0
  182. package/dist/proof-attestation.json +45 -0
  183. package/dist/schema-helpers/enumValidation.js +2 -5
  184. package/dist/schema-helpers/enumValidation.js.map +1 -1
  185. package/dist/schema-helpers/spine/nodes/decision.js +2 -1
  186. package/dist/schema-helpers/spine/nodes/decision.js.map +1 -1
  187. package/dist/schema-helpers/spine/tables/epistemicNodes.js +27 -27
  188. package/dist/schema-helpers/spine/tables/epistemicNodes.js.map +1 -1
  189. package/dist/schemas/component-table-manifest.d.ts +6 -6
  190. package/dist/schemas/component-table-manifest.js +2 -2
  191. package/dist/schemas/component-table-manifest.js.map +1 -1
  192. package/dist/schemas/enums.d.ts +5 -2
  193. package/dist/schemas/enums.js +5 -2
  194. package/dist/schemas/enums.js.map +1 -1
  195. package/dist/schemas/index.d.ts +3 -3
  196. package/dist/schemas/index.js +1129 -139
  197. package/dist/schemas/index.js.map +1 -1
  198. package/dist/schemas/manifest.d.ts +2979 -949
  199. package/dist/schemas/manifest.js +1127 -137
  200. package/dist/schemas/manifest.js.map +1 -1
  201. package/dist/schemas/sl-opinion.d.ts +4 -4
  202. package/dist/schemas/tables/controlPlane/accessControl.d.ts +260 -0
  203. package/dist/schemas/tables/controlPlane/accessControl.js +653 -0
  204. package/dist/schemas/tables/controlPlane/accessControl.js.map +1 -0
  205. package/dist/schemas/tables/{identity → controlPlane}/agent.d.ts +1 -1
  206. package/dist/schemas/tables/{identity → controlPlane}/agent.js +3 -3
  207. package/dist/schemas/tables/controlPlane/agent.js.map +1 -0
  208. package/dist/schemas/tables/{identity → controlPlane}/epistemic.d.ts +1 -1
  209. package/dist/schemas/tables/{identity → controlPlane}/epistemic.js +3 -3
  210. package/dist/schemas/tables/controlPlane/epistemic.js.map +1 -0
  211. package/dist/schemas/tables/{identity → controlPlane}/model.d.ts +1 -1
  212. package/dist/schemas/tables/{identity → controlPlane}/model.js +6 -6
  213. package/dist/schemas/tables/controlPlane/model.js.map +1 -0
  214. package/dist/schemas/tables/{identity → controlPlane}/platform.d.ts +11 -11
  215. package/dist/schemas/tables/{identity → controlPlane}/platform.js +18 -18
  216. package/dist/schemas/tables/controlPlane/platform.js.map +1 -0
  217. package/dist/schemas/tables/{identity → controlPlane}/project.d.ts +1 -1
  218. package/dist/schemas/tables/{identity → controlPlane}/project.js +3 -3
  219. package/dist/schemas/tables/controlPlane/project.js.map +1 -0
  220. package/dist/schemas/tables/{identity → controlPlane}/user.d.ts +1 -1
  221. package/dist/schemas/tables/{identity → controlPlane}/user.js +3 -3
  222. package/dist/schemas/tables/controlPlane/user.js.map +1 -0
  223. package/dist/schemas/tables/kernel/config.d.ts +1 -1
  224. package/dist/schemas/tables/kernel/config.js.map +1 -1
  225. package/dist/schemas/tables/kernel/coordination.d.ts +1 -1
  226. package/dist/schemas/tables/kernel/coordination.js.map +1 -1
  227. package/dist/schemas/tables/kernel/decision.d.ts +1 -1
  228. package/dist/schemas/tables/kernel/decision.js.map +1 -1
  229. package/dist/schemas/tables/kernel/embedding.d.ts +1 -1
  230. package/dist/schemas/tables/kernel/embedding.js.map +1 -1
  231. package/dist/schemas/tables/kernel/epistemic.d.ts +7 -7
  232. package/dist/schemas/tables/kernel/epistemic.js.map +1 -1
  233. package/dist/schemas/tables/kernel/idempotency.d.ts +1 -1
  234. package/dist/schemas/tables/kernel/idempotency.js.map +1 -1
  235. package/dist/schemas/tables/kernel/infra.d.ts +5 -5
  236. package/dist/schemas/tables/kernel/infra.js.map +1 -1
  237. package/dist/schemas/tables/kernel/intelligence.d.ts +11 -11
  238. package/dist/schemas/tables/kernel/intelligence.js.map +1 -1
  239. package/dist/schemas/tables/kernel/lens.d.ts +5 -5
  240. package/dist/schemas/tables/kernel/lens.js.map +1 -1
  241. package/dist/schemas/tables/kernel/ontology.d.ts +1 -1
  242. package/dist/schemas/tables/kernel/ontology.js.map +1 -1
  243. package/dist/schemas/tables/kernel/platform.d.ts +13 -13
  244. package/dist/schemas/tables/kernel/platform.js.map +1 -1
  245. package/dist/schemas/tables/kernel/spine.d.ts +5 -4
  246. package/dist/schemas/tables/kernel/spine.js +6 -2
  247. package/dist/schemas/tables/kernel/spine.js.map +1 -1
  248. package/dist/schemas/tables/kernel/task.d.ts +43 -43
  249. package/dist/schemas/tables/kernel/task.js.map +1 -1
  250. package/dist/schemas/tables/kernel/topic.d.ts +1 -1
  251. package/dist/schemas/tables/kernel/topic.js +5 -1
  252. package/dist/schemas/tables/kernel/topic.js.map +1 -1
  253. package/dist/schemas/tables/kernel/workflow.d.ts +1 -1
  254. package/dist/schemas/tables/kernel/workflow.js.map +1 -1
  255. package/dist/schemas/tables/kernel/worktree.d.ts +55 -55
  256. package/dist/schemas/tables/kernel/worktree.js.map +1 -1
  257. package/dist/schemas/tables/mc/identity.d.ts +44 -4
  258. package/dist/schemas/tables/mc/identity.js +66 -1
  259. package/dist/schemas/tables/mc/identity.js.map +1 -1
  260. package/dist/schemas/tables/mc/methodology.d.ts +1 -1
  261. package/dist/schemas/tables/mc/methodology.js.map +1 -1
  262. package/dist/schemas/tables/mc/pack.d.ts +21 -21
  263. package/dist/schemas/tables/mc/pack.js.map +1 -1
  264. package/dist/schemas/tables/mc/policy.d.ts +2 -2
  265. package/dist/schemas/tables/mc/policy.js +1 -1
  266. package/dist/schemas/tables/mc/policy.js.map +1 -1
  267. package/dist/schemas/tables/mc/registry.d.ts +5 -5
  268. package/dist/schemas/tables/mc/registry.js.map +1 -1
  269. package/dist/schemas/tables/mc/runtime.d.ts +109 -3
  270. package/dist/schemas/tables/mc/runtime.js +330 -104
  271. package/dist/schemas/tables/mc/runtime.js.map +1 -1
  272. package/dist/schemas/tables/mc/tenant.d.ts +3 -2
  273. package/dist/schemas/tables/mc/tenant.js +2 -1
  274. package/dist/schemas/tables/mc/tenant.js.map +1 -1
  275. package/dist/schemas/tables/mc/workspace.d.ts +28 -5
  276. package/dist/schemas/tables/mc/workspace.js +36 -2
  277. package/dist/schemas/tables/mc/workspace.js.map +1 -1
  278. package/dist/sdk-methods.contract.d.ts +2 -2
  279. package/dist/{sdk-tools.contract-S4ia0TTo.d.ts → sdk-tools.contract-BNklQDfB.d.ts} +2 -2
  280. package/dist/sdk-tools.contract.d.ts +2 -2
  281. package/dist/sdk-tools.contract.js +672 -24
  282. package/dist/sdk-tools.contract.js.map +1 -1
  283. package/dist/tenant-bootstrap-seed.contract.d.ts +1269 -0
  284. package/dist/tenant-bootstrap-seed.contract.js +751 -0
  285. package/dist/tenant-bootstrap-seed.contract.js.map +1 -0
  286. package/dist/tenant-bootstrap-seed.defaults.d.ts +16 -0
  287. package/dist/tenant-bootstrap-seed.defaults.js +303 -0
  288. package/dist/tenant-bootstrap-seed.defaults.js.map +1 -0
  289. package/dist/tenant-client.contract.d.ts +349 -0
  290. package/dist/tenant-client.contract.js +488 -0
  291. package/dist/tenant-client.contract.js.map +1 -0
  292. package/dist/{tool-contracts-C92-9ueT.d.ts → tool-contracts-BevD9Ho2.d.ts} +36 -2
  293. package/dist/tool-contracts.d.ts +1 -1
  294. package/dist/tool-contracts.js +673 -25
  295. package/dist/tool-contracts.js.map +1 -1
  296. package/package.json +30 -1
  297. package/dist/index-CV-0_VWJ.d.ts +0 -25
  298. package/dist/schemas/tables/identity/agent.js.map +0 -1
  299. package/dist/schemas/tables/identity/epistemic.js.map +0 -1
  300. package/dist/schemas/tables/identity/model.js.map +0 -1
  301. package/dist/schemas/tables/identity/platform.js.map +0 -1
  302. package/dist/schemas/tables/identity/project.js.map +0 -1
  303. package/dist/schemas/tables/identity/user.js.map +0 -1
@@ -2,6 +2,20 @@ import { z } from 'zod';
2
2
 
3
3
  // src/function-registry/edges.ts
4
4
 
5
+ // src/types/reasoning-method.ts
6
+ var REASONING_METHODS = [
7
+ "deductive",
8
+ "inductive",
9
+ "abductive",
10
+ "analogical",
11
+ "causal",
12
+ "correlational",
13
+ "testimonial",
14
+ "statistical",
15
+ "implicit",
16
+ "pattern_match"
17
+ ];
18
+
5
19
  // src/lens-workflow.contract.ts
6
20
  var LENS_PERSPECTIVE_TYPES = [
7
21
  "investigation",
@@ -422,7 +436,22 @@ var ADD_WORKTREE = {
422
436
  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.",
423
437
  parameters: {
424
438
  title: { type: "string", description: "Worktree name/objective" },
425
- topicId: { type: "string", description: "Optional topic scope hint" },
439
+ name: {
440
+ type: "string",
441
+ description: "Optional storage-name alias for callers that already use backend naming"
442
+ },
443
+ projectId: {
444
+ type: "string",
445
+ description: "Legacy topicId alias or resolver hint"
446
+ },
447
+ topicId: {
448
+ type: "string",
449
+ description: "Optional topic scope hint for resolver validation"
450
+ },
451
+ topicHint: {
452
+ type: "string",
453
+ description: "Natural-language topic hint for automatic topic resolution"
454
+ },
426
455
  branchId: {
427
456
  type: "string",
428
457
  description: "The branch this worktree investigates"
@@ -435,18 +464,107 @@ var ADD_WORKTREE = {
435
464
  type: "string",
436
465
  description: "The testable claim this worktree investigates"
437
466
  },
467
+ rationale: {
468
+ type: "string",
469
+ description: "Why this worktree exists and why it belongs in the campaign"
470
+ },
471
+ worktreeType: {
472
+ type: "string",
473
+ description: "Schema-enum worktree type used by the kernel lifecycle and retrieval layers"
474
+ },
475
+ gate: {
476
+ type: "string",
477
+ description: "Exit gate name for this worktree"
478
+ },
479
+ startDate: {
480
+ type: "number",
481
+ description: "Planned start timestamp in milliseconds since epoch"
482
+ },
483
+ endDate: {
484
+ type: "number",
485
+ description: "Planned end timestamp in milliseconds since epoch"
486
+ },
487
+ durationWeeks: {
488
+ type: "number",
489
+ description: "Planned duration in weeks"
490
+ },
491
+ confidenceImpact: {
492
+ type: "string",
493
+ description: "Expected confidence impact if the worktree succeeds",
494
+ enum: ["high", "medium", "low"]
495
+ },
496
+ beliefFocus: {
497
+ type: "string",
498
+ description: "Natural-language focus spanning the target belief neighborhood"
499
+ },
438
500
  beliefIds: {
439
501
  type: "array",
440
- description: "Beliefs to test in this worktree"
502
+ description: "Legacy alias for targetBeliefIds"
503
+ },
504
+ beliefs: {
505
+ type: "array",
506
+ description: "Legacy alias for targetBeliefIds"
507
+ },
508
+ targetBeliefIds: {
509
+ type: "array",
510
+ description: "Belief node IDs this worktree is expected to test or update"
511
+ },
512
+ targetQuestionIds: {
513
+ type: "array",
514
+ description: "Question node IDs this worktree is expected to answer"
515
+ },
516
+ keyQuestions: {
517
+ type: "array",
518
+ description: "Inline key question objects with question, optional status, answer, answerConfidence, and linkedQuestionId"
519
+ },
520
+ evidenceSignals: {
521
+ type: "array",
522
+ description: "Evidence signal objects with signal, optional collected state, progress, and notes"
523
+ },
524
+ decisionGate: {
525
+ type: "object",
526
+ description: "Decision gate object with goCriteria, noGoSignals, optional verdict, rationale, decidedAt, and decidedBy"
527
+ },
528
+ goCriteria: {
529
+ type: "array",
530
+ description: "Shorthand go criteria used to build decisionGate"
531
+ },
532
+ noGoSignals: {
533
+ type: "array",
534
+ description: "Shorthand no-go signals used to build decisionGate"
535
+ },
536
+ proofArtifacts: {
537
+ type: "array",
538
+ description: "Expected proof artifacts required to close the worktree"
441
539
  },
442
540
  autoShape: {
443
541
  type: "boolean",
444
542
  description: "Whether to invoke inquiry auto-shaping during worktree creation"
445
543
  },
544
+ autoFixPolicy: {
545
+ type: "object",
546
+ description: "Policy for permitted automatic remediation inside the worktree"
547
+ },
446
548
  domainPackId: {
447
549
  type: "string",
448
550
  description: "Optional domain pack whose shaping hooks should influence generated questions and tasks"
449
551
  },
552
+ tags: {
553
+ type: "array",
554
+ description: "Additional topic-resolution tags for the worktree"
555
+ },
556
+ touchedPaths: {
557
+ type: "array",
558
+ description: "File paths used as topic-resolution signals"
559
+ },
560
+ sourceRef: {
561
+ type: "string",
562
+ description: "Source reference used as a topic-resolution signal"
563
+ },
564
+ sourceKind: {
565
+ type: "string",
566
+ description: "Source kind used as a topic-resolution signal"
567
+ },
450
568
  campaign: {
451
569
  type: "number",
452
570
  description: "Top-level pipeline campaign number. Campaigns define the outer execution slice."
@@ -471,12 +589,20 @@ var ADD_WORKTREE = {
471
589
  type: "array",
472
590
  description: "Worktree IDs blocked by this worktree"
473
591
  },
474
- gate: {
592
+ staffingHint: {
475
593
  type: "string",
476
- description: "Exit gate name for this worktree"
594
+ description: "Suggested staffing or agent allocation note"
595
+ },
596
+ lensId: {
597
+ type: "string",
598
+ description: "Lens that scopes this worktree when applicable"
599
+ },
600
+ lastReconciledAt: {
601
+ type: "number",
602
+ description: "Timestamp when worktree metadata was last reconciled"
477
603
  }
478
604
  },
479
- required: ["title", "topicId"],
605
+ required: ["title"],
480
606
  response: {
481
607
  description: "The created worktree",
482
608
  fields: {
@@ -503,7 +629,7 @@ var MERGE = {
503
629
  worktreeId: { type: "string", description: "The worktree to merge" },
504
630
  outcomes: {
505
631
  type: "array",
506
- description: "Scoring outcomes for each belief: { beliefId, confidence, rationale }"
632
+ description: "Merge outcomes as key-finding strings, or scoring outcomes for beliefs: { beliefId, confidence, rationale }"
507
633
  },
508
634
  summary: { type: "string", description: "Overall findings summary" }
509
635
  },
@@ -721,19 +847,23 @@ var FIND_CONTRADICTIONS = {
721
847
  };
722
848
  var CREATE_EDGE = {
723
849
  name: "create_edge",
724
- 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).",
850
+ 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.",
725
851
  parameters: {
726
- sourceId: {
727
- type: "string",
728
- description: "Source node of the relationship"
852
+ from: {
853
+ type: "object",
854
+ description: "Source graph ref, e.g. { kind: 'epistemic_node', nodeId: '...', nodeType: 'topic' }"
729
855
  },
730
- targetId: {
731
- type: "string",
732
- description: "Target node of the relationship"
856
+ to: {
857
+ type: "object",
858
+ description: "Target graph ref, e.g. { kind: 'epistemic_node', nodeId: '...', nodeType: 'belief' }"
733
859
  },
734
860
  edgeType: {
735
861
  type: "string",
736
- description: "Relationship type (informs, tests, depends_on, supersedes, etc.)"
862
+ description: "Relationship type from the public epistemic edge enum."
863
+ },
864
+ globalId: {
865
+ type: "string",
866
+ description: "Optional idempotent edge global ID."
737
867
  },
738
868
  weight: {
739
869
  type: "number",
@@ -743,10 +873,14 @@ var CREATE_EDGE = {
743
873
  reasoningMethod: {
744
874
  type: "string",
745
875
  description: "How this was determined",
746
- enum: ["deductive", "inductive", "abductive", "analogical", "empirical"]
876
+ enum: [...REASONING_METHODS]
877
+ },
878
+ metadata: {
879
+ type: "object",
880
+ description: "Optional edge metadata."
747
881
  }
748
882
  },
749
- required: ["sourceId", "targetId", "edgeType"],
883
+ required: ["from", "to", "edgeType"],
750
884
  response: {
751
885
  description: "The created edge",
752
886
  fields: {
@@ -760,6 +894,240 @@ var CREATE_EDGE = {
760
894
  ontologyPrimitive: "edge",
761
895
  tier: "showcase"
762
896
  };
897
+ var UPDATE_EDGE = {
898
+ name: "update_edge",
899
+ description: "Amend metadata on an existing graph edge. Like `git commit --amend` \u2014 changes the edge annotation without recreating the relationship.",
900
+ parameters: {
901
+ edgeId: { type: "string", description: "Edge ID or global ID to update" },
902
+ weight: { type: "number", description: "Updated edge weight" },
903
+ confidence: { type: "number", description: "Updated confidence" },
904
+ context: { type: "string", description: "Updated human-readable context" },
905
+ derivationType: { type: "string", description: "Updated derivation type" },
906
+ metadata: { type: "object", description: "Updated metadata" }
907
+ },
908
+ required: ["edgeId"],
909
+ response: {
910
+ description: "Edge update result",
911
+ fields: { success: "boolean" }
912
+ },
913
+ ownerModule: "graph-primitives",
914
+ ontologyPrimitive: "edge",
915
+ tier: "workhorse"
916
+ };
917
+ var REMOVE_EDGE = {
918
+ name: "remove_edge",
919
+ description: "Remove one graph edge by ID. Like `git rm` \u2014 deletes a single explicit relationship from the spine.",
920
+ parameters: {
921
+ edgeId: { type: "string", description: "Edge ID or global ID to remove" }
922
+ },
923
+ required: ["edgeId"],
924
+ response: {
925
+ description: "Edge removal result",
926
+ fields: { success: "boolean" }
927
+ },
928
+ ownerModule: "graph-primitives",
929
+ ontologyPrimitive: "edge",
930
+ tier: "workhorse"
931
+ };
932
+ var REMOVE_EDGES_BETWEEN = {
933
+ name: "remove_edges_between",
934
+ description: "Remove graph edges between two nodes. Like `git rm <pathspec>` \u2014 deletes relationships matching a source, target, and optional type.",
935
+ parameters: {
936
+ fromNodeId: { type: "string", description: "Source node ID or global ID" },
937
+ toNodeId: { type: "string", description: "Target node ID or global ID" },
938
+ edgeType: { type: "string", description: "Optional edge type filter" }
939
+ },
940
+ required: ["fromNodeId", "toNodeId"],
941
+ response: {
942
+ description: "Matched edge removal result",
943
+ fields: { deleted: "number" }
944
+ },
945
+ ownerModule: "graph-primitives",
946
+ ontologyPrimitive: "edge",
947
+ tier: "workhorse"
948
+ };
949
+ var BATCH_CREATE_EDGES = {
950
+ name: "batch_create_edges",
951
+ description: "Commit multiple typed graph edges. Like `git commit` with many staged paths \u2014 writes a batch of explicit relationships atomically per edge.",
952
+ parameters: {
953
+ edges: {
954
+ type: "array",
955
+ description: "Edges to create, each with from, to, edgeType, and optional weight/confidence/context."
956
+ },
957
+ skipLayerValidation: {
958
+ type: "boolean",
959
+ description: "Skip kernel layer validation for trusted materialization flows."
960
+ }
961
+ },
962
+ required: ["edges"],
963
+ response: {
964
+ description: "Batch edge creation result",
965
+ fields: {
966
+ created: "number",
967
+ results: "array",
968
+ errors: "array"
969
+ }
970
+ },
971
+ ownerModule: "graph-primitives",
972
+ ontologyPrimitive: "edge",
973
+ tier: "workhorse"
974
+ };
975
+ var CREATE_EPISTEMIC_NODE = {
976
+ name: "create_epistemic_node",
977
+ 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.",
978
+ parameters: {
979
+ globalId: { type: "string", description: "Optional idempotent node global ID" },
980
+ nodeType: { type: "string", description: "Public epistemic node type" },
981
+ canonicalText: { type: "string", description: "Canonical node text" },
982
+ text: { type: "string", description: "Alias for canonicalText" },
983
+ contentHash: { type: "string", description: "Optional idempotency content hash" },
984
+ sourceType: { type: "string", description: "Source type for provenance" },
985
+ topicId: { type: "string", description: "Optional topic scope" },
986
+ content: { type: "string", description: "Extended content" },
987
+ title: { type: "string", description: "Display title" },
988
+ metadata: { type: "object", description: "Optional node metadata" }
989
+ },
990
+ required: ["nodeType"],
991
+ response: {
992
+ description: "Created node result",
993
+ fields: {
994
+ nodeId: "string",
995
+ nodeGlobalId: "string",
996
+ isDuplicate: "boolean"
997
+ }
998
+ },
999
+ ownerModule: "reasoning-kernel",
1000
+ ontologyPrimitive: "graph",
1001
+ tier: "showcase"
1002
+ };
1003
+ var GET_EPISTEMIC_NODE = {
1004
+ name: "get_epistemic_node",
1005
+ description: "Read one epistemic graph node. Like `git show` \u2014 resolves a canonical spine node by ID or global ID.",
1006
+ parameters: {
1007
+ nodeId: { type: "string", description: "Node ID or global ID" }
1008
+ },
1009
+ required: ["nodeId"],
1010
+ response: {
1011
+ description: "The resolved node",
1012
+ fields: { node: "object" }
1013
+ },
1014
+ ownerModule: "reasoning-kernel",
1015
+ ontologyPrimitive: "graph",
1016
+ tier: "workhorse"
1017
+ };
1018
+ var LIST_EPISTEMIC_NODES = {
1019
+ name: "list_epistemic_nodes",
1020
+ description: "List epistemic graph nodes. Like `git ls-tree` \u2014 lists canonical spine nodes by topic, type, status, or search query.",
1021
+ parameters: {
1022
+ topicId: { type: "string", description: "Optional topic scope" },
1023
+ nodeType: { type: "string", description: "Optional node type filter" },
1024
+ status: { type: "string", description: "Optional lifecycle status" },
1025
+ searchQuery: { type: "string", description: "Optional text search query" },
1026
+ limit: { type: "number", description: "Maximum nodes to return" }
1027
+ },
1028
+ required: [],
1029
+ response: {
1030
+ description: "Matching nodes",
1031
+ fields: { nodes: "array" }
1032
+ },
1033
+ ownerModule: "reasoning-kernel",
1034
+ ontologyPrimitive: "graph",
1035
+ tier: "workhorse"
1036
+ };
1037
+ var UPDATE_EPISTEMIC_NODE = {
1038
+ name: "update_epistemic_node",
1039
+ description: "Amend an epistemic graph node. Like `git commit --amend` \u2014 updates mutable node metadata, text, status, or verification fields.",
1040
+ parameters: {
1041
+ nodeId: { type: "string", description: "Node ID or global ID" },
1042
+ canonicalText: { type: "string", description: "Updated canonical text" },
1043
+ text: { type: "string", description: "Alias for canonicalText" },
1044
+ contentHash: { type: "string", description: "Updated content hash" },
1045
+ content: { type: "string", description: "Updated content" },
1046
+ title: { type: "string", description: "Updated display title" },
1047
+ metadata: { type: "object", description: "Updated metadata" },
1048
+ confidence: { type: "number", description: "Updated confidence" },
1049
+ verificationStatus: { type: "string", description: "Updated verification status" },
1050
+ status: { type: "string", description: "Updated lifecycle status" }
1051
+ },
1052
+ required: ["nodeId"],
1053
+ response: {
1054
+ description: "Node update result",
1055
+ fields: { success: "boolean" }
1056
+ },
1057
+ ownerModule: "reasoning-kernel",
1058
+ ontologyPrimitive: "graph",
1059
+ tier: "workhorse"
1060
+ };
1061
+ var ARCHIVE_EPISTEMIC_NODE = {
1062
+ name: "archive_epistemic_node",
1063
+ description: "Archive an epistemic graph node. Like `git rm --cached` \u2014 removes a node from active traversal without hard-deleting it.",
1064
+ parameters: {
1065
+ nodeId: { type: "string", description: "Node ID or global ID" }
1066
+ },
1067
+ required: ["nodeId"],
1068
+ response: {
1069
+ description: "Archive result",
1070
+ fields: { success: "boolean", effectiveStatus: "string" }
1071
+ },
1072
+ ownerModule: "reasoning-kernel",
1073
+ ontologyPrimitive: "graph",
1074
+ tier: "workhorse"
1075
+ };
1076
+ var VERIFY_EPISTEMIC_NODE = {
1077
+ name: "verify_epistemic_node",
1078
+ description: "Record verification state on an epistemic graph node. Like `git tag` \u2014 marks the node with a reviewed verification state.",
1079
+ parameters: {
1080
+ nodeId: { type: "string", description: "Node ID or global ID" },
1081
+ verificationStatus: { type: "string", description: "Verification status" },
1082
+ confidence: { type: "number", description: "Optional confidence update" }
1083
+ },
1084
+ required: ["nodeId", "verificationStatus"],
1085
+ response: {
1086
+ description: "Verification result",
1087
+ fields: { success: "boolean" }
1088
+ },
1089
+ ownerModule: "reasoning-kernel",
1090
+ ontologyPrimitive: "graph",
1091
+ tier: "workhorse"
1092
+ };
1093
+ var SUPERSEDE_EPISTEMIC_NODE = {
1094
+ name: "supersede_epistemic_node",
1095
+ 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.",
1096
+ parameters: {
1097
+ oldNodeId: { type: "string", description: "Node ID or global ID to supersede" },
1098
+ newGlobalId: { type: "string", description: "Optional replacement global ID" },
1099
+ newCanonicalText: { type: "string", description: "Replacement canonical text" },
1100
+ text: { type: "string", description: "Alias for newCanonicalText" },
1101
+ newContentHash: { type: "string", description: "Optional replacement content hash" },
1102
+ reason: { type: "string", description: "Reason for superseding" }
1103
+ },
1104
+ required: ["oldNodeId"],
1105
+ response: {
1106
+ description: "Supersede result",
1107
+ fields: { oldNodeId: "string", newNodeId: "string" }
1108
+ },
1109
+ ownerModule: "reasoning-kernel",
1110
+ ontologyPrimitive: "graph",
1111
+ tier: "workhorse"
1112
+ };
1113
+ var BATCH_CREATE_EPISTEMIC_NODES = {
1114
+ name: "batch_create_epistemic_nodes",
1115
+ description: "Commit multiple epistemic graph nodes. Like `git commit` with many staged files \u2014 writes a batch of canonical spine nodes.",
1116
+ parameters: {
1117
+ nodes: {
1118
+ type: "array",
1119
+ description: "Nodes to create with nodeType, canonicalText/text, and optional metadata."
1120
+ }
1121
+ },
1122
+ required: ["nodes"],
1123
+ response: {
1124
+ description: "Batch node creation result",
1125
+ fields: { created: "number", results: "array" }
1126
+ },
1127
+ ownerModule: "reasoning-kernel",
1128
+ ontologyPrimitive: "graph",
1129
+ tier: "workhorse"
1130
+ };
763
1131
  var RECORD_JUDGMENT = {
764
1132
  name: "record_judgment",
765
1133
  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).",
@@ -1057,6 +1425,74 @@ var GET_GRAPH_STRUCTURE_ANALYSIS = {
1057
1425
  ontologyPrimitive: "graph",
1058
1426
  tier: "showcase"
1059
1427
  };
1428
+ var LIST_GRAPH_INTELLIGENCE_QUERIES = {
1429
+ name: "list_graph_intelligence_queries",
1430
+ 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.",
1431
+ parameters: {
1432
+ categoryId: {
1433
+ type: "string",
1434
+ description: "Optional category filter, such as problems or strategic"
1435
+ },
1436
+ mode: {
1437
+ type: "string",
1438
+ description: "Optional mode filter: core, bias, stress, operational, alpha, semantic, or evidence"
1439
+ }
1440
+ },
1441
+ required: [],
1442
+ response: {
1443
+ description: "Graph Intelligence query catalog and mode-to-tool mapping",
1444
+ fields: {
1445
+ categories: "array \u2014 query categories",
1446
+ queries: "array \u2014 query definitions with prompt templates and tools",
1447
+ quickQueries: "array \u2014 recommended one-click query presets",
1448
+ publicToolNamesByMode: "object \u2014 public tool names available to each Graph Intelligence mode"
1449
+ }
1450
+ },
1451
+ ownerModule: "graph-intelligence",
1452
+ ontologyPrimitive: "graph",
1453
+ tier: "showcase"
1454
+ };
1455
+ var RUN_GRAPH_INTELLIGENCE_QUERY = {
1456
+ name: "run_graph_intelligence_query",
1457
+ 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.",
1458
+ parameters: {
1459
+ topicId: { type: "string", description: "Topic to analyze" },
1460
+ queryId: {
1461
+ type: "string",
1462
+ description: "Graph Intelligence query ID, such as confirmation-bias, pre-mortem, or thesis-summary"
1463
+ },
1464
+ prompt: {
1465
+ type: "string",
1466
+ description: "Optional custom prompt for custom analysis runs"
1467
+ },
1468
+ input: {
1469
+ type: "string",
1470
+ description: "Optional entity, theme, belief, company, or search text for input-driven queries"
1471
+ },
1472
+ mode: {
1473
+ type: "string",
1474
+ description: "Optional mode override: core, bias, stress, operational, alpha, semantic, or evidence"
1475
+ },
1476
+ limit: {
1477
+ type: "number",
1478
+ description: "Maximum graph context rows to return"
1479
+ }
1480
+ },
1481
+ required: ["topicId"],
1482
+ response: {
1483
+ description: "Graph Intelligence query result bundle ready for model or prompt-library synthesis",
1484
+ fields: {
1485
+ query: "object \u2014 selected query definition",
1486
+ prompt: "string \u2014 resolved prompt template",
1487
+ toolPlan: "array \u2014 public tools and args the model can call next",
1488
+ analysis: "object \u2014 structure, coverage, gap, and confirmation-bias analysis",
1489
+ context: "object \u2014 sampled beliefs, questions, evidence, edges, and contradictions"
1490
+ }
1491
+ },
1492
+ ownerModule: "graph-intelligence",
1493
+ ontologyPrimitive: "graph",
1494
+ tier: "showcase"
1495
+ };
1060
1496
  var GET_FALSIFICATION_QUESTIONS = {
1061
1497
  name: "get_falsification_questions",
1062
1498
  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.",
@@ -1905,15 +2341,15 @@ var IDENTITY_WHOAMI = {
1905
2341
  };
1906
2342
  var COMPILE_CONTEXT = {
1907
2343
  name: "compile_context",
1908
- 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.",
2344
+ 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.",
1909
2345
  parameters: {
1910
2346
  topicId: {
1911
2347
  type: "string",
1912
- description: "Topic scope ID to compile"
2348
+ description: "Optional topic scope ID. Omit to resolve the topic from query."
1913
2349
  },
1914
2350
  query: {
1915
2351
  type: "string",
1916
- description: "Optional focus query used to rank context items"
2352
+ description: "Focus query used to resolve the topic and rank context items. Required when topicId is omitted."
1917
2353
  },
1918
2354
  budget: {
1919
2355
  type: "number",
@@ -1937,7 +2373,7 @@ var COMPILE_CONTEXT = {
1937
2373
  description: "Include related ontological entities in the compiled result"
1938
2374
  }
1939
2375
  },
1940
- required: ["topicId"],
2376
+ required: [],
1941
2377
  response: {
1942
2378
  description: "Compiled context pack for the requested topic",
1943
2379
  fields: {
@@ -2111,18 +2547,64 @@ var CREATE_TASK = {
2111
2547
  name: "create_task",
2112
2548
  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.",
2113
2549
  parameters: {
2114
- title: { type: "string", description: "Task description" },
2550
+ title: { type: "string", description: "Task title" },
2115
2551
  topicId: { type: "string", description: "Topic scope" },
2552
+ description: {
2553
+ type: "string",
2554
+ description: "Long-form task description"
2555
+ },
2116
2556
  taskType: {
2117
2557
  type: "string",
2118
- description: "Type: research, interview, analysis, data_collection",
2119
- enum: ["research", "interview", "analysis", "data_collection"]
2558
+ description: "Task taxonomy",
2559
+ enum: [
2560
+ "general",
2561
+ "find_evidence",
2562
+ "verify_claim",
2563
+ "research",
2564
+ "review",
2565
+ "interview",
2566
+ "analysis",
2567
+ "track_metrics"
2568
+ ]
2569
+ },
2570
+ priority: {
2571
+ type: "string",
2572
+ description: "Priority",
2573
+ enum: ["urgent", "high", "medium", "low"]
2574
+ },
2575
+ status: {
2576
+ type: "string",
2577
+ description: "Initial status (defaults to todo)",
2578
+ enum: ["todo", "in_progress", "blocked", "done"]
2579
+ },
2580
+ linkedWorktreeId: {
2581
+ type: "string",
2582
+ description: "Worktree this task belongs to"
2583
+ },
2584
+ linkedBeliefId: {
2585
+ type: "string",
2586
+ description: "Belief this task supports"
2120
2587
  },
2121
2588
  linkedQuestionId: {
2122
2589
  type: "string",
2123
2590
  description: "Question this task addresses"
2124
2591
  },
2125
- linkedWorktreeId: { type: "string", description: "Worktree scope" }
2592
+ assigneeId: {
2593
+ type: "string",
2594
+ description: "Principal assigned to the task"
2595
+ },
2596
+ dueDate: {
2597
+ type: "number",
2598
+ description: "Due date as epoch milliseconds"
2599
+ },
2600
+ tags: {
2601
+ type: "array",
2602
+ description: "Free-form string tags"
2603
+ },
2604
+ metadata: {
2605
+ type: "object",
2606
+ description: "Structured task metadata for handoff context and routing hints"
2607
+ }
2126
2608
  },
2127
2609
  required: ["title"],
2128
2610
  response: {
@@ -2195,6 +2677,10 @@ var UPDATE_TASK = {
2195
2677
  type: "string",
2196
2678
  description: "Updated status",
2197
2679
  enum: ["todo", "in_progress", "blocked", "done"]
2680
+ },
2681
+ metadata: {
2682
+ type: "object",
2683
+ description: "Structured task metadata to replace or refine"
2198
2684
  }
2199
2685
  },
2200
2686
  required: ["taskId"],
@@ -2242,6 +2728,10 @@ var CREATE_TOPIC = {
2242
2728
  name: "create_topic",
2243
2729
  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.",
2244
2730
  parameters: {
2731
+ globalId: {
2732
+ type: "string",
2733
+ description: "Optional idempotent topic global ID"
2734
+ },
2245
2735
  name: { type: "string", description: "Topic name" },
2246
2736
  type: {
2247
2737
  type: "string",
@@ -2252,6 +2742,18 @@ var CREATE_TOPIC = {
2252
2742
  type: "string",
2253
2743
  description: "Optional parent topic for nesting"
2254
2744
  },
2745
+ parentTopicGlobalId: {
2746
+ type: "string",
2747
+ description: "Optional parent topic global ID for nesting"
2748
+ },
2749
+ tenantId: { type: "string", description: "Optional tenant scope" },
2750
+ workspaceId: { type: "string", description: "Optional workspace scope" },
2751
+ visibility: {
2752
+ type: "string",
2753
+ description: "Topic visibility",
2754
+ enum: ["private", "team", "firm", "external", "public"]
2755
+ },
2756
+ metadata: { type: "object", description: "Optional topic metadata" },
2255
2757
  createdBy: { type: "string", description: "Who created this topic" }
2256
2758
  },
2257
2759
  required: ["name", "type"],
@@ -2260,6 +2762,9 @@ var CREATE_TOPIC = {
2260
2762
  fields: {
2261
2763
  id: "string \u2014 topic ID",
2262
2764
  globalId: "string \u2014 globally unique ID",
2765
+ topicGlobalId: "string \u2014 topic global ID",
2766
+ epistemicNodeId: "string \u2014 materialized topic node ID",
2767
+ epistemicNodeGlobalId: "string \u2014 materialized topic node global ID",
2263
2768
  depth: "number \u2014 nesting depth"
2264
2769
  }
2265
2770
  },
@@ -2390,6 +2895,65 @@ var GET_TOPIC_TREE = {
2390
2895
  ontologyPrimitive: "graph",
2391
2896
  tier: "workhorse"
2392
2897
  };
2898
+ var MATERIALIZE_TOPIC_GRAPH = {
2899
+ name: "materialize_topic_graph",
2900
+ description: "Backfill the topic graph spine. Like `git fsck --connectivity-only` with repair enabled \u2014 creates missing topic nodes and parent-child edges idempotently.",
2901
+ parameters: {
2902
+ rootTopicId: {
2903
+ type: "string",
2904
+ description: "Optional root topic for a bounded materialization pass"
2905
+ },
2906
+ dryRun: {
2907
+ type: "boolean",
2908
+ description: "When true, report missing rows without writing them"
2909
+ }
2910
+ },
2911
+ required: [],
2912
+ response: {
2913
+ description: "Topic graph materialization counts",
2914
+ fields: {
2915
+ topicsSeen: "number",
2916
+ nodesCreated: "number",
2917
+ nodesExisting: "number",
2918
+ edgesCreated: "number",
2919
+ edgesExisting: "number",
2920
+ errors: "array"
2921
+ }
2922
+ },
2923
+ ownerModule: "reasoning-kernel",
2924
+ ontologyPrimitive: "graph",
2925
+ tier: "workhorse"
2926
+ };
2927
+ var GET_TOPIC_GRAPH_SPINE = {
2928
+ name: "get_topic_graph_spine",
2929
+ description: "Verify the topic graph spine. Like `git fsck` \u2014 reads topics, materialized topic nodes, parent-child edges, and missing spine rows.",
2930
+ parameters: {
2931
+ rootTopicId: {
2932
+ type: "string",
2933
+ description: "Optional root topic for a bounded verifier pass"
2934
+ },
2935
+ includeTopicBeliefEdges: {
2936
+ type: "boolean",
2937
+ description: "Include topic -> belief edges in the verifier payload"
2938
+ }
2939
+ },
2940
+ required: [],
2941
+ response: {
2942
+ description: "Topic graph spine verification payload",
2943
+ fields: {
2944
+ ok: "boolean",
2945
+ counts: "object",
2946
+ topics: "array",
2947
+ topicNodes: "array",
2948
+ parentEdges: "array",
2949
+ missingTopicNodes: "array",
2950
+ missingParentEdges: "array"
2951
+ }
2952
+ },
2953
+ ownerModule: "reasoning-kernel",
2954
+ ontologyPrimitive: "graph",
2955
+ tier: "workhorse"
2956
+ };
2393
2957
  var GET_CODE_CONTEXT = {
2394
2958
  name: "get_code_context",
2395
2959
  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.",
@@ -3522,6 +4086,72 @@ var GENERATE_SESSION_HANDOFF = {
3522
4086
  tier: "showcase",
3523
4087
  internal: true
3524
4088
  };
4089
+ var BEGIN_BUILD_SESSION = {
4090
+ name: "begin_build_session",
4091
+ 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.",
4092
+ parameters: {
4093
+ worktreeId: {
4094
+ type: "string",
4095
+ description: "The Lucern worktree ID to bootstrap."
4096
+ },
4097
+ branch: {
4098
+ type: "string",
4099
+ description: "Optional git branch name. Auto-generated from the worktree name when omitted."
4100
+ },
4101
+ branchBase: {
4102
+ type: "string",
4103
+ description: 'Base branch for the feature branch. Default: "staging".'
4104
+ },
4105
+ prBase: {
4106
+ type: "string",
4107
+ description: 'Target branch for the PR. Default: "staging".'
4108
+ },
4109
+ sessionMode: {
4110
+ type: "string",
4111
+ description: 'Session mode: "async" for Codex/headless or "interactive" for live sessions.',
4112
+ enum: ["async", "interactive"]
4113
+ },
4114
+ activateIfPlanning: {
4115
+ type: "boolean",
4116
+ description: "When true, automatically activate a planning worktree during bootstrap."
4117
+ }
4118
+ },
4119
+ required: ["worktreeId"],
4120
+ response: {
4121
+ description: "A compact build-session packet with worktree metadata, graph anchors, questions, dependencies, and git defaults.",
4122
+ fields: {
4123
+ topicId: "string \u2014 canonical topic scope",
4124
+ topicName: "string \u2014 human-readable topic name",
4125
+ worktreeId: "string \u2014 worktree ID",
4126
+ worktreeName: "string \u2014 human-readable worktree name",
4127
+ branch: "string \u2014 git branch name",
4128
+ branchBase: "string \u2014 base branch",
4129
+ prBase: "string \u2014 PR target branch",
4130
+ campaign: "number | null \u2014 top-level pipeline campaign",
4131
+ lane: "string \u2014 campaign lane",
4132
+ gate: "string \u2014 exit gate",
4133
+ hypothesis: "string \u2014 worktree hypothesis",
4134
+ focus: "string \u2014 session focus",
4135
+ status: "string \u2014 worktree status after optional activation",
4136
+ sessionMode: "string \u2014 async | interactive",
4137
+ targetBeliefIds: "array \u2014 scoped belief IDs",
4138
+ targetQuestionIds: "array \u2014 scoped question IDs",
4139
+ taskIds: "array \u2014 assigned task IDs for this worktree",
4140
+ incompleteTaskIds: "array \u2014 assigned task IDs that still require done/deferred/blocked proof",
4141
+ tasks: "array \u2014 assigned task packet with id, title, status, priority, links, and summaries",
4142
+ topBeliefs: "array \u2014 highest-confidence scoped beliefs",
4143
+ openQuestions: "array \u2014 open scoped questions",
4144
+ resolvedDecisions: "array \u2014 answered questions summarized for the session",
4145
+ dependencies: "array \u2014 upstream worktrees",
4146
+ unblocks: "array \u2014 downstream worktrees",
4147
+ mergeOrderNotes: "string \u2014 merge ordering advisory"
4148
+ }
4149
+ },
4150
+ ownerModule: "bootstrap",
4151
+ ontologyPrimitive: "worktree",
4152
+ tier: "showcase",
4153
+ internal: true
4154
+ };
3525
4155
  var MCP_TOOL_CONTRACTS = {
3526
4156
  // Belief lifecycle (commit, amend, fork, archive)
3527
4157
  create_belief: CREATE_BELIEF,
@@ -3564,11 +4194,26 @@ var MCP_TOOL_CONTRACTS = {
3564
4194
  bisect_confidence: BISECT_CONFIDENCE,
3565
4195
  // Edges (commit)
3566
4196
  create_edge: CREATE_EDGE,
4197
+ update_edge: UPDATE_EDGE,
4198
+ remove_edge: REMOVE_EDGE,
4199
+ remove_edges_between: REMOVE_EDGES_BETWEEN,
4200
+ batch_create_edges: BATCH_CREATE_EDGES,
4201
+ // Epistemic node spine (commit/amend/show)
4202
+ create_epistemic_node: CREATE_EPISTEMIC_NODE,
4203
+ get_epistemic_node: GET_EPISTEMIC_NODE,
4204
+ list_epistemic_nodes: LIST_EPISTEMIC_NODES,
4205
+ update_epistemic_node: UPDATE_EPISTEMIC_NODE,
4206
+ archive_epistemic_node: ARCHIVE_EPISTEMIC_NODE,
4207
+ verify_epistemic_node: VERIFY_EPISTEMIC_NODE,
4208
+ supersede_epistemic_node: SUPERSEDE_EPISTEMIC_NODE,
4209
+ batch_create_epistemic_nodes: BATCH_CREATE_EPISTEMIC_NODES,
3567
4210
  // Judgments (tag)
3568
4211
  record_judgment: RECORD_JUDGMENT,
3569
4212
  // Graph intelligence (showcase)
3570
4213
  detect_confirmation_bias: DETECT_CONFIRMATION_BIAS,
3571
4214
  get_graph_structure_analysis: GET_GRAPH_STRUCTURE_ANALYSIS,
4215
+ list_graph_intelligence_queries: LIST_GRAPH_INTELLIGENCE_QUERIES,
4216
+ run_graph_intelligence_query: RUN_GRAPH_INTELLIGENCE_QUERY,
3572
4217
  get_falsification_questions: GET_FALSIFICATION_QUESTIONS,
3573
4218
  // Evidence operations (workhorse)
3574
4219
  search_evidence: SEARCH_EVIDENCE,
@@ -3615,6 +4260,7 @@ var MCP_TOOL_CONTRACTS = {
3615
4260
  get_agent_inbox: GET_AGENT_INBOX,
3616
4261
  claim_files: CLAIM_FILES,
3617
4262
  generate_session_handoff: GENERATE_SESSION_HANDOFF,
4263
+ begin_build_session: BEGIN_BUILD_SESSION,
3618
4264
  // Policy / ACL (workhorse)
3619
4265
  check_permission: CHECK_PERMISSION,
3620
4266
  filter_by_permission: FILTER_BY_PERMISSION,
@@ -3634,6 +4280,8 @@ var MCP_TOOL_CONTRACTS = {
3634
4280
  get_topic: GET_TOPIC,
3635
4281
  update_topic: UPDATE_TOPIC,
3636
4282
  get_topic_tree: GET_TOPIC_TREE,
4283
+ materialize_topic_graph: MATERIALIZE_TOPIC_GRAPH,
4284
+ get_topic_graph_spine: GET_TOPIC_GRAPH_SPINE,
3637
4285
  // Coding intelligence (code-grounded knowledge)
3638
4286
  get_code_context: GET_CODE_CONTEXT,
3639
4287
  get_change_history: GET_CHANGE_HISTORY,
@@ -3738,18 +4386,34 @@ var MCP_CORE_OPERATION_NAMES = [
3738
4386
  "find_missing_questions",
3739
4387
  "get_high_priority_questions",
3740
4388
  "get_falsification_questions",
4389
+ "create_epistemic_node",
4390
+ "get_epistemic_node",
4391
+ "list_epistemic_nodes",
4392
+ "update_epistemic_node",
4393
+ "archive_epistemic_node",
4394
+ "verify_epistemic_node",
4395
+ "supersede_epistemic_node",
4396
+ "batch_create_epistemic_nodes",
3741
4397
  "create_topic",
3742
4398
  "get_topic",
3743
4399
  "list_topics",
3744
4400
  "update_topic",
3745
- "get_topic_tree"
4401
+ "get_topic_tree",
4402
+ "materialize_topic_graph",
4403
+ "get_topic_graph_spine"
3746
4404
  ];
3747
4405
  var MCP_ANALYSIS_PLATFORM_OPERATION_NAMES = [
3748
4406
  "create_edge",
4407
+ "update_edge",
4408
+ "remove_edge",
4409
+ "remove_edges_between",
4410
+ "batch_create_edges",
3749
4411
  "query_lineage",
3750
4412
  "traverse_graph",
3751
4413
  "get_graph_neighborhood",
3752
4414
  "get_graph_structure_analysis",
4415
+ "list_graph_intelligence_queries",
4416
+ "run_graph_intelligence_query",
3753
4417
  "find_contradictions",
3754
4418
  "flag_contradiction",
3755
4419
  "detect_confirmation_bias",
@@ -3828,6 +4492,7 @@ var PLATFORM_INTERNAL_OPERATION_NAMES = [
3828
4492
  "get_change_history",
3829
4493
  "get_failure_log",
3830
4494
  "record_attempt",
4495
+ "begin_build_session",
3831
4496
  "push",
3832
4497
  "open_pull_request",
3833
4498
  "record_judgment",
@@ -3882,7 +4547,6 @@ var SDK_ONLY_OPERATION_NAMES = [
3882
4547
  "find_semantic_orphans"
3883
4548
  ];
3884
4549
  var MCP_ONLY_INTERNAL_OPERATION_NAMES = [
3885
- "begin_build_session",
3886
4550
  "evaluate_engineering_contract",
3887
4551
  "evaluate_research_contract"
3888
4552
  ];
@@ -3979,6 +4643,13 @@ var LUCERN_OPERATION_MANIFEST = {
3979
4643
  "Lucern MCP-only platform operation for local agent/bootstrap or verification workflows. Hidden from public discovery."
3980
4644
  )
3981
4645
  };
4646
+ z.enum(["decision", "belief", "question", "theme", "deal", "topic", "claim", "evidence", "synthesis", "answer", "atomic_fact", "excerpt", "source", "company", "person", "investor", "function", "value_chain"]);
4647
+ 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"];
4648
+ var STORAGE_EDGE_TYPE_VALUES = [...EDGE_TYPE_VALUES, "extracted_from"];
4649
+ z.enum(EDGE_TYPE_VALUES);
4650
+ z.enum(STORAGE_EDGE_TYPE_VALUES);
4651
+ z.enum(["active", "archived", "watching"]);
4652
+ z.enum(["private", "team", "firm", "external", "public"]);
3982
4653
 
3983
4654
  // src/function-registry/helpers.ts
3984
4655
  var jsonObjectSchema = z.record(z.unknown());
@@ -4075,12 +4746,20 @@ function unwrapMcpParameterSchema(schema) {
4075
4746
  current = current._def.schema;
4076
4747
  continue;
4077
4748
  default:
4078
- return { schema: current, required, description: description ?? current.description };
4749
+ return {
4750
+ schema: current,
4751
+ required,
4752
+ description: description ?? current.description
4753
+ };
4079
4754
  }
4080
4755
  }
4081
4756
  }
4082
4757
  function mcpParameterFromZod(fieldName, schema, contractName) {
4083
- const { schema: unwrapped, required, description: schemaDescription } = unwrapMcpParameterSchema(schema);
4758
+ const {
4759
+ schema: unwrapped,
4760
+ required,
4761
+ description: schemaDescription
4762
+ } = unwrapMcpParameterSchema(schema);
4084
4763
  const description = schemaDescription ?? unwrapped.description ?? fieldName;
4085
4764
  switch (unwrapped._def.typeName) {
4086
4765
  case z.ZodFirstPartyTypeKind.ZodString:
@@ -4125,10 +4804,12 @@ function mcpContractFromArgsSchema(base, args, contractName) {
4125
4804
  const entries2 = Object.entries(getObjectShape(args)).sort(
4126
4805
  ([left], [right]) => left.localeCompare(right)
4127
4806
  );
4128
- const converted = entries2.map(([fieldName, schema]) => [
4129
- fieldName,
4130
- mcpParameterFromZod(fieldName, schema, contractName)
4131
- ]);
4807
+ const converted = entries2.map(
4808
+ ([fieldName, schema]) => [
4809
+ fieldName,
4810
+ mcpParameterFromZod(fieldName, schema, contractName)
4811
+ ]
4812
+ );
4132
4813
  return {
4133
4814
  ...base,
4134
4815
  parameters: Object.fromEntries(
@@ -4137,9 +4818,7 @@ function mcpContractFromArgsSchema(base, args, contractName) {
4137
4818
  required: converted.filter(([, field]) => field.required).map(([fieldName]) => fieldName)
4138
4819
  };
4139
4820
  }
4140
- function defineFunctionContract(contract) {
4141
- return contract;
4142
- }
4821
+ var defineFunctionContract = (contract) => contract;
4143
4822
  function authUserId(context) {
4144
4823
  return context.userId ?? context.principalId ?? "lucern-agent";
4145
4824
  }
@@ -4233,6 +4912,7 @@ function surfaceContract(args) {
4233
4912
  allowedPrincipalTypes: ["user", "service", "agent"]
4234
4913
  },
4235
4914
  convex: args.convex,
4915
+ gateway: args.gateway,
4236
4916
  args: canonicalArgs,
4237
4917
  returns: canonicalReturns,
4238
4918
  input,
@@ -4243,17 +4923,44 @@ function surfaceContract(args) {
4243
4923
  }
4244
4924
  });
4245
4925
  }
4246
- var EpistemicNodeTypeSchema = z.enum([
4926
+
4927
+ // src/schema-helpers/spine/tables/epistemicNodes.ts
4928
+ var NODE_TYPES = [
4929
+ "decision",
4247
4930
  "belief",
4248
- "evidence",
4249
4931
  "question",
4250
- "answer",
4932
+ "theme",
4933
+ "deal",
4251
4934
  "topic",
4935
+ "claim",
4936
+ "evidence",
4937
+ "synthesis",
4938
+ "answer",
4939
+ "atomic_fact",
4940
+ "excerpt",
4941
+ "source",
4942
+ "company",
4943
+ "person",
4944
+ "investor",
4945
+ "function",
4946
+ "value_chain"
4947
+ ];
4948
+ new Set(NODE_TYPES);
4949
+
4950
+ // src/types/graph-ref.ts
4951
+ var GRAPH_REF_EXTRA_NODE_TYPES = [
4252
4952
  "edge",
4253
4953
  "ontology",
4254
4954
  "lens",
4255
4955
  "contradiction"
4256
- ]);
4956
+ ];
4957
+ var GRAPH_REF_NODE_TYPES = [
4958
+ ...NODE_TYPES,
4959
+ ...GRAPH_REF_EXTRA_NODE_TYPES
4960
+ ];
4961
+ var EpistemicNodeTypeSchema = z.enum(
4962
+ GRAPH_REF_NODE_TYPES
4963
+ );
4257
4964
  var GraphRefSchema = z.discriminatedUnion("kind", [
4258
4965
  z.object({
4259
4966
  kind: z.literal("epistemic_node"),
@@ -4303,49 +5010,70 @@ function assertEdgePolicyAllowed(manifest, edgeType, from, to) {
4303
5010
  }
4304
5011
 
4305
5012
  // src/manifests/edge-policy-manifest.data.ts
5013
+ var publicEpistemicNodeEdgePolicy = (edgeType) => ({
5014
+ edgeType,
5015
+ fromKinds: ["epistemic_node"],
5016
+ toKinds: ["epistemic_node"],
5017
+ description: "Canonical public create_edge policy for graph-node relationships. The policy layer gates edge-type membership, not endpoint semantics."
5018
+ });
4306
5019
  var edgePolicyManifest = {
4307
- policies: [
4308
- {
4309
- edgeType: "evidence_derived_from_evidence",
4310
- fromKinds: ["epistemic_node"],
4311
- fromNodeTypes: ["evidence"],
4312
- toKinds: ["epistemic_node"],
4313
- toNodeTypes: ["evidence"],
4314
- description: "Evidence E2 was synthesized from evidence E1 by a transformation. Provides chain-of-evidence lineage."
4315
- },
4316
- {
4317
- edgeType: "evidence_supports_belief",
4318
- fromKinds: ["epistemic_node"],
4319
- fromNodeTypes: ["evidence"],
4320
- toKinds: ["epistemic_node"],
4321
- toNodeTypes: ["belief"],
4322
- description: "Existing link_evidence_to_belief semantics promoted to the create_edge policy source."
4323
- },
4324
- {
4325
- edgeType: "evidence_supports_question",
4326
- fromKinds: ["epistemic_node"],
4327
- fromNodeTypes: ["evidence"],
4328
- toKinds: ["epistemic_node"],
4329
- toNodeTypes: ["question"],
4330
- description: "Existing link_evidence_to_question semantics promoted to the create_edge policy source."
4331
- }
4332
- ]
5020
+ policies: EDGE_TYPE_VALUES.map(publicEpistemicNodeEdgePolicy)
4333
5021
  };
4334
5022
 
4335
5023
  // src/function-registry/edges.ts
5024
+ var CREATE_EDGE_TYPES = edgePolicyManifest.policies.map(
5025
+ (policy) => policy.edgeType
5026
+ );
5027
+ var REASONING_METHOD_TYPES = [...REASONING_METHODS];
4336
5028
  var createEdgeArgs = z.object({
4337
5029
  from: GraphRefSchema,
4338
5030
  to: GraphRefSchema,
4339
- edgeType: z.string(),
5031
+ edgeType: z.enum(CREATE_EDGE_TYPES),
4340
5032
  globalId: z.string().optional(),
4341
5033
  weight: z.number().optional(),
4342
5034
  confidence: z.number().optional(),
4343
5035
  context: z.string().optional(),
4344
5036
  reasoning: z.string().optional(),
5037
+ reasoningMethod: z.enum(REASONING_METHOD_TYPES).optional(),
4345
5038
  derivationType: z.string().optional(),
5039
+ metadata: z.record(z.unknown()).optional(),
4346
5040
  topicId: z.string().optional(),
4347
5041
  trustedBypassAccessCheck: z.boolean().optional()
4348
5042
  });
5043
+ var updateEdgeArgs = z.object({
5044
+ edgeId: z.string().describe("Edge ID or global ID."),
5045
+ weight: z.number().optional(),
5046
+ confidence: z.number().optional(),
5047
+ context: z.string().optional(),
5048
+ reasoning: z.string().optional(),
5049
+ derivationType: z.string().optional(),
5050
+ metadata: z.record(z.unknown()).optional(),
5051
+ userId: z.string().optional()
5052
+ });
5053
+ var removeEdgeArgs = z.object({
5054
+ edgeId: z.string().describe("Edge ID or global ID."),
5055
+ userId: z.string().optional()
5056
+ });
5057
+ var removeEdgesBetweenArgs = z.object({
5058
+ from: GraphRefSchema.optional(),
5059
+ to: GraphRefSchema.optional(),
5060
+ fromNodeId: z.string().optional(),
5061
+ toNodeId: z.string().optional(),
5062
+ edgeType: z.enum(CREATE_EDGE_TYPES).optional()
5063
+ });
5064
+ var batchCreateEdgesArgs = z.object({
5065
+ edges: z.array(createEdgeArgs),
5066
+ skipLayerValidation: z.boolean().optional()
5067
+ });
5068
+ var queryLineageArgs = z.object({
5069
+ nodeId: z.string().describe("Starting node to trace from."),
5070
+ startNode: z.string().optional().describe("Starting node alias accepted by traversal callers."),
5071
+ depth: z.number().optional().describe("Traversal depth alias."),
5072
+ maxDepth: z.number().optional().describe("Maximum traversal depth."),
5073
+ mode: z.string().optional().describe("Traversal mode."),
5074
+ minLayer: z.string().optional().describe("Minimum epistemic layer."),
5075
+ maxLayer: z.string().optional().describe("Maximum epistemic layer.")
5076
+ });
4349
5077
  function graphRefNodeId(ref) {
4350
5078
  if (ref.kind === "epistemic_node") {
4351
5079
  return ref.nodeId;
@@ -4385,7 +5113,9 @@ var edgesContracts = [
4385
5113
  weight: parsed.weight,
4386
5114
  confidence: parsed.confidence,
4387
5115
  context: parsed.context ?? parsed.reasoning,
5116
+ reasoningMethod: parsed.reasoningMethod,
4388
5117
  derivationType: parsed.derivationType,
5118
+ metadata: parsed.metadata,
4389
5119
  skipLayerValidation: true,
4390
5120
  topicId: parsed.topicId,
4391
5121
  trustedBypassAccessCheck: parsed.trustedBypassAccessCheck
@@ -4396,6 +5126,131 @@ var edgesContracts = [
4396
5126
  },
4397
5127
  args: createEdgeArgs
4398
5128
  }),
5129
+ surfaceContract({
5130
+ name: "update_edge",
5131
+ kind: "mutation",
5132
+ domain: "edges",
5133
+ surfaceClass: "platform_public",
5134
+ method: "PATCH",
5135
+ path: "/edges",
5136
+ sdkNamespace: "edges",
5137
+ sdkMethod: "updateEdge",
5138
+ summary: "Update an epistemic edge.",
5139
+ convex: {
5140
+ module: "edges",
5141
+ functionName: "update",
5142
+ kind: "mutation",
5143
+ inputProjection: (input, context) => compactRecord({
5144
+ edgeId: input.edgeId,
5145
+ weight: input.weight,
5146
+ confidence: input.confidence,
5147
+ context: input.context ?? input.reasoning,
5148
+ derivationType: input.derivationType,
5149
+ metadata: input.metadata,
5150
+ userId: input.userId ?? context.userId ?? context.principalId
5151
+ })
5152
+ },
5153
+ args: updateEdgeArgs
5154
+ }),
5155
+ surfaceContract({
5156
+ name: "remove_edge",
5157
+ kind: "mutation",
5158
+ domain: "edges",
5159
+ surfaceClass: "platform_public",
5160
+ method: "DELETE",
5161
+ path: "/edges",
5162
+ sdkNamespace: "edges",
5163
+ sdkMethod: "removeEdge",
5164
+ summary: "Remove an epistemic edge.",
5165
+ convex: {
5166
+ module: "edges",
5167
+ functionName: "remove",
5168
+ kind: "mutation",
5169
+ inputProjection: (input, context) => compactRecord({
5170
+ edgeId: input.edgeId,
5171
+ userId: input.userId ?? context.userId ?? context.principalId
5172
+ })
5173
+ },
5174
+ args: removeEdgeArgs
5175
+ }),
5176
+ surfaceContract({
5177
+ name: "remove_edges_between",
5178
+ kind: "mutation",
5179
+ domain: "edges",
5180
+ surfaceClass: "platform_public",
5181
+ method: "DELETE",
5182
+ path: "/edges/between",
5183
+ sdkNamespace: "edges",
5184
+ sdkMethod: "removeEdgesBetween",
5185
+ summary: "Remove epistemic edges between two nodes.",
5186
+ convex: {
5187
+ module: "edges",
5188
+ functionName: "removeBetween",
5189
+ kind: "mutation",
5190
+ inputProjection: (input) => {
5191
+ const parsed = removeEdgesBetweenArgs.parse(input);
5192
+ const fromNodeId = parsed.from ? graphRefNodeId(parsed.from) : parsed.fromNodeId;
5193
+ const toNodeId = parsed.to ? graphRefNodeId(parsed.to) : parsed.toNodeId;
5194
+ if (!fromNodeId || !toNodeId) {
5195
+ throw new Error("from/to or fromNodeId/toNodeId are required.");
5196
+ }
5197
+ return compactRecord({
5198
+ fromNodeId,
5199
+ toNodeId,
5200
+ edgeType: parsed.edgeType
5201
+ });
5202
+ }
5203
+ },
5204
+ args: removeEdgesBetweenArgs
5205
+ }),
5206
+ surfaceContract({
5207
+ name: "batch_create_edges",
5208
+ kind: "mutation",
5209
+ domain: "edges",
5210
+ surfaceClass: "platform_public",
5211
+ path: "/edges/batch",
5212
+ sdkNamespace: "edges",
5213
+ sdkMethod: "batchCreateEdges",
5214
+ summary: "Batch create epistemic edges.",
5215
+ convex: {
5216
+ module: "edges",
5217
+ functionName: "batchCreate",
5218
+ kind: "mutation",
5219
+ inputProjection: (input, context) => {
5220
+ const parsed = batchCreateEdgesArgs.parse(input);
5221
+ return {
5222
+ skipLayerValidation: parsed.skipLayerValidation ?? true,
5223
+ edges: parsed.edges.map((edge) => {
5224
+ assertEdgePolicyAllowed(
5225
+ edgePolicyManifest,
5226
+ edge.edgeType,
5227
+ edge.from,
5228
+ edge.to
5229
+ );
5230
+ const fromNodeId = graphRefNodeId(edge.from);
5231
+ const toNodeId = graphRefNodeId(edge.to);
5232
+ return withCreatedBy(
5233
+ compactRecord({
5234
+ fromNodeId,
5235
+ toNodeId,
5236
+ edgeType: edge.edgeType,
5237
+ globalId: edge.globalId ?? `edge:${fromNodeId}:${toNodeId}:${edge.edgeType}`,
5238
+ weight: edge.weight,
5239
+ confidence: edge.confidence,
5240
+ context: edge.context ?? edge.reasoning,
5241
+ reasoningMethod: edge.reasoningMethod,
5242
+ derivationType: edge.derivationType,
5243
+ metadata: edge.metadata,
5244
+ topicId: edge.topicId
5245
+ }),
5246
+ context
5247
+ );
5248
+ })
5249
+ };
5250
+ }
5251
+ },
5252
+ args: batchCreateEdgesArgs
5253
+ }),
4399
5254
  surfaceContract({
4400
5255
  name: "query_lineage",
4401
5256
  kind: "query",
@@ -4416,7 +5271,8 @@ var edgesContracts = [
4416
5271
  minLayer: input.minLayer,
4417
5272
  maxLayer: input.maxLayer
4418
5273
  })
4419
- }
5274
+ },
5275
+ args: queryLineageArgs
4420
5276
  })
4421
5277
  ];
4422
5278