@lucern/contracts 0.3.0-alpha.9 → 1.0.0

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 (253) hide show
  1. package/CHANGELOG.md +7 -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/auth-context.contract.js +14 -2
  6. package/dist/auth-context.contract.js.map +1 -1
  7. package/dist/auth-session.contract.js +14 -2
  8. package/dist/auth-session.contract.js.map +1 -1
  9. package/dist/auth.contract.d.ts +1 -1
  10. package/dist/auth.contract.js +14 -2
  11. package/dist/auth.contract.js.map +1 -1
  12. package/dist/component-boundary.contract.d.ts +1 -1
  13. package/dist/component-boundary.contract.js +46 -26
  14. package/dist/component-boundary.contract.js.map +1 -1
  15. package/dist/component-host-boundary.contract.d.ts +10 -5
  16. package/dist/component-host-boundary.contract.js +10 -4
  17. package/dist/component-host-boundary.contract.js.map +1 -1
  18. package/dist/{defineTable-CBQ03FXl.d.ts → defineTable-t1wr5wgn.d.ts} +1 -1
  19. package/dist/{dsl-djCRfuWC.d.ts → dsl-DVPthQGY.d.ts} +1 -1
  20. package/dist/dsl.d.ts +2 -2
  21. package/dist/dsl.js.map +1 -1
  22. package/dist/function-registry/beliefs.d.ts +23 -10
  23. package/dist/function-registry/beliefs.js +467 -36
  24. package/dist/function-registry/beliefs.js.map +1 -1
  25. package/dist/function-registry/coding.d.ts +15 -6
  26. package/dist/function-registry/coding.js +531 -22
  27. package/dist/function-registry/coding.js.map +1 -1
  28. package/dist/function-registry/context.d.ts +9 -3
  29. package/dist/function-registry/context.js +464 -21
  30. package/dist/function-registry/context.js.map +1 -1
  31. package/dist/function-registry/contracts.d.ts +9 -3
  32. package/dist/function-registry/contracts.js +464 -21
  33. package/dist/function-registry/contracts.js.map +1 -1
  34. package/dist/function-registry/coordination.d.ts +21 -9
  35. package/dist/function-registry/coordination.js +464 -21
  36. package/dist/function-registry/coordination.js.map +1 -1
  37. package/dist/function-registry/edges.d.ts +167 -2
  38. package/dist/function-registry/edges.js +619 -28
  39. package/dist/function-registry/edges.js.map +1 -1
  40. package/dist/function-registry/evidence.d.ts +19 -8
  41. package/dist/function-registry/evidence.js +469 -36
  42. package/dist/function-registry/evidence.js.map +1 -1
  43. package/dist/function-registry/graph.d.ts +33 -15
  44. package/dist/function-registry/graph.js +464 -21
  45. package/dist/function-registry/graph.js.map +1 -1
  46. package/dist/function-registry/helpers.d.ts +6 -3
  47. package/dist/function-registry/helpers.js +465 -22
  48. package/dist/function-registry/helpers.js.map +1 -1
  49. package/dist/function-registry/identity.d.ts +62 -16
  50. package/dist/function-registry/identity.js +487 -27
  51. package/dist/function-registry/identity.js.map +1 -1
  52. package/dist/function-registry/index.d.ts +4 -2
  53. package/dist/function-registry/index.js +468 -22
  54. package/dist/function-registry/index.js.map +1 -1
  55. package/dist/function-registry/judgments.d.ts +7 -2
  56. package/dist/function-registry/judgments.js +464 -21
  57. package/dist/function-registry/judgments.js.map +1 -1
  58. package/dist/function-registry/legacy.d.ts +5 -1
  59. package/dist/function-registry/legacy.js +464 -21
  60. package/dist/function-registry/legacy.js.map +1 -1
  61. package/dist/function-registry/lenses.d.ts +11 -4
  62. package/dist/function-registry/lenses.js +464 -21
  63. package/dist/function-registry/lenses.js.map +1 -1
  64. package/dist/function-registry/manifest.d.ts +4 -4
  65. package/dist/function-registry/manifest.js +16 -1
  66. package/dist/function-registry/manifest.js.map +1 -1
  67. package/dist/function-registry/nodes.d.ts +412 -0
  68. package/dist/function-registry/nodes.js +5354 -0
  69. package/dist/function-registry/nodes.js.map +1 -0
  70. package/dist/function-registry/ontologies.d.ts +25 -11
  71. package/dist/function-registry/ontologies.js +464 -21
  72. package/dist/function-registry/ontologies.js.map +1 -1
  73. package/dist/function-registry/pipeline.d.ts +9 -3
  74. package/dist/function-registry/pipeline.js +464 -21
  75. package/dist/function-registry/pipeline.js.map +1 -1
  76. package/dist/function-registry/questions.d.ts +27 -12
  77. package/dist/function-registry/questions.js +466 -26
  78. package/dist/function-registry/questions.js.map +1 -1
  79. package/dist/function-registry/tasks.d.ts +11 -4
  80. package/dist/function-registry/tasks.js +497 -30
  81. package/dist/function-registry/tasks.js.map +1 -1
  82. package/dist/function-registry/topics.d.ts +93 -5
  83. package/dist/function-registry/topics.js +534 -24
  84. package/dist/function-registry/topics.js.map +1 -1
  85. package/dist/function-registry/types.d.ts +7 -3
  86. package/dist/function-registry/worktrees.d.ts +25 -11
  87. package/dist/function-registry/worktrees.js +480 -21
  88. package/dist/function-registry/worktrees.js.map +1 -1
  89. package/dist/gateway.contract.d.ts +4 -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 +37 -17
  93. package/dist/generated/convexSchemas.js.map +1 -1
  94. package/dist/generated/infisicalRuntimeEnv.d.ts +70 -0
  95. package/dist/generated/infisicalRuntimeEnv.js +27585 -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 +1221 -114
  107. package/dist/generated/tableOwnership.d.ts +48 -28
  108. package/dist/generated/tableOwnership.js +66 -26
  109. package/dist/generated/tableOwnership.js.map +1 -1
  110. package/dist/generated/tier-expectations.json +64 -9
  111. package/dist/{index-O09U2xHk.d.ts → index-CM1Pl_vI.d.ts} +3 -3
  112. package/dist/index.d.ts +11 -6
  113. package/dist/index.js +32838 -413
  114. package/dist/index.js.map +1 -1
  115. package/dist/infisical-runtime.contract.d.ts +1763 -6
  116. package/dist/infisical-runtime.contract.js +2994 -15
  117. package/dist/infisical-runtime.contract.js.map +1 -1
  118. package/dist/manifests/infisical-runtime-manifest.d.ts +1689 -6
  119. package/dist/manifests/infisical-runtime-manifest.js +2847 -12
  120. package/dist/manifests/infisical-runtime-manifest.js.map +1 -1
  121. package/dist/manifests/tenant-client-manifest.d.ts +19 -14
  122. package/dist/manifests/tenant-client-manifest.js +29 -12
  123. package/dist/manifests/tenant-client-manifest.js.map +1 -1
  124. package/dist/mcp-gateway-boundary.contract.d.ts +23 -3
  125. package/dist/mcp-gateway-boundary.contract.js +2 -0
  126. package/dist/mcp-gateway-boundary.contract.js.map +1 -1
  127. package/dist/permit-principal-projection.contract.d.ts +74 -0
  128. package/dist/permit-principal-projection.contract.js +167 -0
  129. package/dist/permit-principal-projection.contract.js.map +1 -0
  130. package/dist/projections/check-convex-args-shape.js +10 -6
  131. package/dist/projections/check-convex-args-shape.js.map +1 -1
  132. package/dist/projections/create-evidence.projection.d.ts +6 -6
  133. package/dist/projections/create-evidence.projection.js +2 -3
  134. package/dist/projections/create-evidence.projection.js.map +1 -1
  135. package/dist/projections/index.d.ts +3 -3
  136. package/dist/projections/index.js +10 -6
  137. package/dist/projections/index.js.map +1 -1
  138. package/dist/projections/list-tasks.projection.d.ts +20 -8
  139. package/dist/projections/list-tasks.projection.js +8 -3
  140. package/dist/projections/list-tasks.projection.js.map +1 -1
  141. package/dist/proof-attestation.json +45 -0
  142. package/dist/schemas/component-table-manifest.d.ts +6 -6
  143. package/dist/schemas/component-table-manifest.js +2 -2
  144. package/dist/schemas/component-table-manifest.js.map +1 -1
  145. package/dist/schemas/index.d.ts +2 -2
  146. package/dist/schemas/index.js +1123 -137
  147. package/dist/schemas/index.js.map +1 -1
  148. package/dist/schemas/manifest.d.ts +2102 -132
  149. package/dist/schemas/manifest.js +1121 -135
  150. package/dist/schemas/manifest.js.map +1 -1
  151. package/dist/schemas/tables/controlPlane/accessControl.d.ts +260 -0
  152. package/dist/schemas/tables/controlPlane/accessControl.js +658 -0
  153. package/dist/schemas/tables/controlPlane/accessControl.js.map +1 -0
  154. package/dist/schemas/tables/{identity → controlPlane}/agent.d.ts +1 -1
  155. package/dist/schemas/tables/{identity → controlPlane}/agent.js +3 -3
  156. package/dist/schemas/tables/controlPlane/agent.js.map +1 -0
  157. package/dist/schemas/tables/{identity → controlPlane}/epistemic.d.ts +1 -1
  158. package/dist/schemas/tables/{identity → controlPlane}/epistemic.js +3 -3
  159. package/dist/schemas/tables/controlPlane/epistemic.js.map +1 -0
  160. package/dist/schemas/tables/{identity → controlPlane}/model.d.ts +1 -1
  161. package/dist/schemas/tables/{identity → controlPlane}/model.js +6 -6
  162. package/dist/schemas/tables/controlPlane/model.js.map +1 -0
  163. package/dist/schemas/tables/{identity → controlPlane}/platform.d.ts +1 -1
  164. package/dist/schemas/tables/{identity → controlPlane}/platform.js +18 -18
  165. package/dist/schemas/tables/controlPlane/platform.js.map +1 -0
  166. package/dist/schemas/tables/{identity → controlPlane}/project.d.ts +1 -1
  167. package/dist/schemas/tables/{identity → controlPlane}/project.js +3 -3
  168. package/dist/schemas/tables/controlPlane/project.js.map +1 -0
  169. package/dist/schemas/tables/{identity → controlPlane}/user.d.ts +1 -1
  170. package/dist/schemas/tables/{identity → controlPlane}/user.js +3 -3
  171. package/dist/schemas/tables/controlPlane/user.js.map +1 -0
  172. package/dist/schemas/tables/kernel/config.d.ts +1 -1
  173. package/dist/schemas/tables/kernel/config.js.map +1 -1
  174. package/dist/schemas/tables/kernel/coordination.d.ts +1 -1
  175. package/dist/schemas/tables/kernel/coordination.js.map +1 -1
  176. package/dist/schemas/tables/kernel/decision.d.ts +1 -1
  177. package/dist/schemas/tables/kernel/decision.js.map +1 -1
  178. package/dist/schemas/tables/kernel/embedding.d.ts +1 -1
  179. package/dist/schemas/tables/kernel/embedding.js.map +1 -1
  180. package/dist/schemas/tables/kernel/epistemic.d.ts +1 -1
  181. package/dist/schemas/tables/kernel/epistemic.js.map +1 -1
  182. package/dist/schemas/tables/kernel/events.d.ts +21 -0
  183. package/dist/schemas/tables/kernel/events.js +43 -0
  184. package/dist/schemas/tables/kernel/events.js.map +1 -0
  185. package/dist/schemas/tables/kernel/idempotency.d.ts +1 -1
  186. package/dist/schemas/tables/kernel/idempotency.js.map +1 -1
  187. package/dist/schemas/tables/kernel/infra.d.ts +1 -1
  188. package/dist/schemas/tables/kernel/infra.js.map +1 -1
  189. package/dist/schemas/tables/kernel/intelligence.d.ts +1 -1
  190. package/dist/schemas/tables/kernel/intelligence.js.map +1 -1
  191. package/dist/schemas/tables/kernel/lens.d.ts +1 -1
  192. package/dist/schemas/tables/kernel/lens.js.map +1 -1
  193. package/dist/schemas/tables/kernel/ontology.d.ts +1 -1
  194. package/dist/schemas/tables/kernel/ontology.js.map +1 -1
  195. package/dist/schemas/tables/kernel/platform.d.ts +1 -1
  196. package/dist/schemas/tables/kernel/platform.js.map +1 -1
  197. package/dist/schemas/tables/kernel/spine.d.ts +2 -1
  198. package/dist/schemas/tables/kernel/spine.js +1 -0
  199. package/dist/schemas/tables/kernel/spine.js.map +1 -1
  200. package/dist/schemas/tables/kernel/task.d.ts +1 -1
  201. package/dist/schemas/tables/kernel/task.js.map +1 -1
  202. package/dist/schemas/tables/kernel/topic.d.ts +1 -1
  203. package/dist/schemas/tables/kernel/topic.js +1 -0
  204. package/dist/schemas/tables/kernel/topic.js.map +1 -1
  205. package/dist/schemas/tables/kernel/workflow.d.ts +1 -1
  206. package/dist/schemas/tables/kernel/workflow.js.map +1 -1
  207. package/dist/schemas/tables/kernel/worktree.d.ts +17 -17
  208. package/dist/schemas/tables/kernel/worktree.js.map +1 -1
  209. package/dist/schemas/tables/mc/identity.d.ts +19 -2
  210. package/dist/schemas/tables/mc/identity.js +32 -1
  211. package/dist/schemas/tables/mc/identity.js.map +1 -1
  212. package/dist/schemas/tables/mc/methodology.d.ts +1 -1
  213. package/dist/schemas/tables/mc/methodology.js.map +1 -1
  214. package/dist/schemas/tables/mc/pack.d.ts +1 -1
  215. package/dist/schemas/tables/mc/pack.js.map +1 -1
  216. package/dist/schemas/tables/mc/policy.d.ts +2 -2
  217. package/dist/schemas/tables/mc/policy.js +1 -1
  218. package/dist/schemas/tables/mc/policy.js.map +1 -1
  219. package/dist/schemas/tables/mc/registry.d.ts +1 -1
  220. package/dist/schemas/tables/mc/registry.js.map +1 -1
  221. package/dist/schemas/tables/mc/runtime.d.ts +109 -3
  222. package/dist/schemas/tables/mc/runtime.js +330 -104
  223. package/dist/schemas/tables/mc/runtime.js.map +1 -1
  224. package/dist/schemas/tables/mc/tenant.d.ts +4 -2
  225. package/dist/schemas/tables/mc/tenant.js +3 -1
  226. package/dist/schemas/tables/mc/tenant.js.map +1 -1
  227. package/dist/schemas/tables/mc/workspace.d.ts +22 -5
  228. package/dist/schemas/tables/mc/workspace.js +34 -2
  229. package/dist/schemas/tables/mc/workspace.js.map +1 -1
  230. package/dist/{sdk-tools.contract-Ci8bkoai.d.ts → sdk-tools.contract-CKmSsrZ2.d.ts} +1 -1
  231. package/dist/sdk-tools.contract.d.ts +2 -2
  232. package/dist/sdk-tools.contract.js +417 -13
  233. package/dist/sdk-tools.contract.js.map +1 -1
  234. package/dist/tenant-bootstrap-seed.contract.d.ts +244 -56
  235. package/dist/tenant-bootstrap-seed.contract.js +139 -28
  236. package/dist/tenant-bootstrap-seed.contract.js.map +1 -1
  237. package/dist/tenant-bootstrap-seed.defaults.d.ts +2 -2
  238. package/dist/tenant-bootstrap-seed.defaults.js +31 -13
  239. package/dist/tenant-bootstrap-seed.defaults.js.map +1 -1
  240. package/dist/tenant-client.contract.d.ts +20 -15
  241. package/dist/tenant-client.contract.js +29 -12
  242. package/dist/tenant-client.contract.js.map +1 -1
  243. package/dist/{tool-contracts-B4iWhejG.d.ts → tool-contracts-C_xvM9q2.d.ts} +32 -2
  244. package/dist/tool-contracts.d.ts +1 -1
  245. package/dist/tool-contracts.js +418 -14
  246. package/dist/tool-contracts.js.map +1 -1
  247. package/package.json +22 -1
  248. package/dist/schemas/tables/identity/agent.js.map +0 -1
  249. package/dist/schemas/tables/identity/epistemic.js.map +0 -1
  250. package/dist/schemas/tables/identity/model.js.map +0 -1
  251. package/dist/schemas/tables/identity/platform.js.map +0 -1
  252. package/dist/schemas/tables/identity/project.js.map +0 -1
  253. 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/helpers.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",
@@ -833,19 +847,23 @@ var FIND_CONTRADICTIONS = {
833
847
  };
834
848
  var CREATE_EDGE = {
835
849
  name: "create_edge",
836
- 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.",
837
851
  parameters: {
838
- sourceId: {
839
- type: "string",
840
- description: "Source node of the relationship"
852
+ from: {
853
+ type: "object",
854
+ description: "Source graph ref, e.g. { kind: 'epistemic_node', nodeId: '...', nodeType: 'topic' }"
841
855
  },
842
- targetId: {
843
- type: "string",
844
- description: "Target node of the relationship"
856
+ to: {
857
+ type: "object",
858
+ description: "Target graph ref, e.g. { kind: 'epistemic_node', nodeId: '...', nodeType: 'belief' }"
845
859
  },
846
860
  edgeType: {
847
861
  type: "string",
848
- 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."
849
867
  },
850
868
  weight: {
851
869
  type: "number",
@@ -855,10 +873,14 @@ var CREATE_EDGE = {
855
873
  reasoningMethod: {
856
874
  type: "string",
857
875
  description: "How this was determined",
858
- enum: ["deductive", "inductive", "abductive", "analogical", "empirical"]
876
+ enum: [...REASONING_METHODS]
877
+ },
878
+ metadata: {
879
+ type: "object",
880
+ description: "Optional edge metadata."
859
881
  }
860
882
  },
861
- required: ["sourceId", "targetId", "edgeType"],
883
+ required: ["from", "to", "edgeType"],
862
884
  response: {
863
885
  description: "The created edge",
864
886
  fields: {
@@ -872,6 +894,240 @@ var CREATE_EDGE = {
872
894
  ontologyPrimitive: "edge",
873
895
  tier: "showcase"
874
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
+ };
875
1131
  var RECORD_JUDGMENT = {
876
1132
  name: "record_judgment",
877
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).",
@@ -2071,8 +2327,8 @@ var IDENTITY_WHOAMI = {
2071
2327
  response: {
2072
2328
  description: "Canonical identity summary for the current session",
2073
2329
  fields: {
2074
- principalId: "string \u2014 canonical federated principal identifier",
2075
- principalType: "string \u2014 human, service, or agent",
2330
+ principalId: "string \u2014 canonical principal identifier; for humans this is the Clerk user_... ID",
2331
+ principalType: "string \u2014 human, service, agent, group, or external_viewer",
2076
2332
  tenantId: "string | undefined \u2014 resolved tenant scope",
2077
2333
  workspaceId: "string | undefined \u2014 resolved workspace scope",
2078
2334
  scopes: "string[] | undefined \u2014 granted scopes for this session",
@@ -2083,6 +2339,49 @@ var IDENTITY_WHOAMI = {
2083
2339
  ontologyPrimitive: "identity",
2084
2340
  tier: "workhorse"
2085
2341
  };
2342
+ var RESOLVE_INTERACTIVE_PRINCIPAL = {
2343
+ name: "resolve_interactive_principal",
2344
+ description: "Read the Permit-backed Lucern principal context for an authenticated Clerk user. Like `git config --get user.email` plus the repository ACL \u2014 resolves the Clerk subject into tenant/workspace authorization context.",
2345
+ parameters: {
2346
+ clerkId: {
2347
+ type: "string",
2348
+ description: "Authenticated Clerk subject (`sub`). Clerk proves identity only; it is not the authorization record."
2349
+ },
2350
+ tenantId: {
2351
+ type: "string",
2352
+ description: "Optional tenant scope. Omit only when the Clerk alias is globally unambiguous."
2353
+ },
2354
+ workspaceId: {
2355
+ type: "string",
2356
+ description: "Optional workspace scope. Required when the principal has access to multiple workspaces and no default can be inferred."
2357
+ },
2358
+ providerProjectId: {
2359
+ type: "string",
2360
+ description: "Optional Clerk project or provider instance id for tenants with multiple identity providers."
2361
+ }
2362
+ },
2363
+ required: ["clerkId"],
2364
+ response: {
2365
+ description: "Permit-backed Lucern principal context for tenant SDK bootstrap",
2366
+ fields: {
2367
+ principalId: "string \u2014 canonical Clerk user_... ID for human sessions",
2368
+ principalType: "string \u2014 human, service, agent, group, or external_viewer",
2369
+ clerkId: "string \u2014 authenticated Clerk subject alias",
2370
+ tenantId: "string \u2014 resolved tenant scope",
2371
+ workspaceId: "string | null \u2014 resolved workspace scope",
2372
+ roles: "string[] \u2014 effective Permit roles",
2373
+ scopes: "string[] \u2014 effective scopes derived from Permit/control-plane projection",
2374
+ groupIds: "string[] \u2014 active Permit group memberships",
2375
+ principalStatus: "string \u2014 active, invited, suspended, disabled, revoked, or missing",
2376
+ tenantStatus: "string \u2014 projected tenant resource status",
2377
+ workspaceStatus: "string \u2014 projected workspace resource status",
2378
+ permit: "object \u2014 Permit subject, tenant, and optional workspace tuple"
2379
+ }
2380
+ },
2381
+ ownerModule: "control-plane",
2382
+ ontologyPrimitive: "identity",
2383
+ tier: "workhorse"
2384
+ };
2086
2385
  var COMPILE_CONTEXT = {
2087
2386
  name: "compile_context",
2088
2387
  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.",
@@ -2344,6 +2643,10 @@ var CREATE_TASK = {
2344
2643
  tags: {
2345
2644
  type: "array",
2346
2645
  description: "Free-form string tags"
2646
+ },
2647
+ metadata: {
2648
+ type: "object",
2649
+ description: "Structured task metadata for handoff context and routing hints"
2347
2650
  }
2348
2651
  },
2349
2652
  required: ["title"],
@@ -2417,6 +2720,10 @@ var UPDATE_TASK = {
2417
2720
  type: "string",
2418
2721
  description: "Updated status",
2419
2722
  enum: ["todo", "in_progress", "blocked", "done"]
2723
+ },
2724
+ metadata: {
2725
+ type: "object",
2726
+ description: "Structured task metadata to replace or refine"
2420
2727
  }
2421
2728
  },
2422
2729
  required: ["taskId"],
@@ -2464,6 +2771,10 @@ var CREATE_TOPIC = {
2464
2771
  name: "create_topic",
2465
2772
  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.",
2466
2773
  parameters: {
2774
+ globalId: {
2775
+ type: "string",
2776
+ description: "Optional idempotent topic global ID"
2777
+ },
2467
2778
  name: { type: "string", description: "Topic name" },
2468
2779
  type: {
2469
2780
  type: "string",
@@ -2474,6 +2785,18 @@ var CREATE_TOPIC = {
2474
2785
  type: "string",
2475
2786
  description: "Optional parent topic for nesting"
2476
2787
  },
2788
+ parentTopicGlobalId: {
2789
+ type: "string",
2790
+ description: "Optional parent topic global ID for nesting"
2791
+ },
2792
+ tenantId: { type: "string", description: "Optional tenant scope" },
2793
+ workspaceId: { type: "string", description: "Optional workspace scope" },
2794
+ visibility: {
2795
+ type: "string",
2796
+ description: "Topic visibility",
2797
+ enum: ["private", "team", "firm", "external", "public"]
2798
+ },
2799
+ metadata: { type: "object", description: "Optional topic metadata" },
2477
2800
  createdBy: { type: "string", description: "Who created this topic" }
2478
2801
  },
2479
2802
  required: ["name", "type"],
@@ -2482,6 +2805,9 @@ var CREATE_TOPIC = {
2482
2805
  fields: {
2483
2806
  id: "string \u2014 topic ID",
2484
2807
  globalId: "string \u2014 globally unique ID",
2808
+ topicGlobalId: "string \u2014 topic global ID",
2809
+ epistemicNodeId: "string \u2014 materialized topic node ID",
2810
+ epistemicNodeGlobalId: "string \u2014 materialized topic node global ID",
2485
2811
  depth: "number \u2014 nesting depth"
2486
2812
  }
2487
2813
  },
@@ -2612,6 +2938,65 @@ var GET_TOPIC_TREE = {
2612
2938
  ontologyPrimitive: "graph",
2613
2939
  tier: "workhorse"
2614
2940
  };
2941
+ var MATERIALIZE_TOPIC_GRAPH = {
2942
+ name: "materialize_topic_graph",
2943
+ description: "Backfill the topic graph spine. Like `git fsck --connectivity-only` with repair enabled \u2014 creates missing topic nodes and parent-child edges idempotently.",
2944
+ parameters: {
2945
+ rootTopicId: {
2946
+ type: "string",
2947
+ description: "Optional root topic for a bounded materialization pass"
2948
+ },
2949
+ dryRun: {
2950
+ type: "boolean",
2951
+ description: "When true, report missing rows without writing them"
2952
+ }
2953
+ },
2954
+ required: [],
2955
+ response: {
2956
+ description: "Topic graph materialization counts",
2957
+ fields: {
2958
+ topicsSeen: "number",
2959
+ nodesCreated: "number",
2960
+ nodesExisting: "number",
2961
+ edgesCreated: "number",
2962
+ edgesExisting: "number",
2963
+ errors: "array"
2964
+ }
2965
+ },
2966
+ ownerModule: "reasoning-kernel",
2967
+ ontologyPrimitive: "graph",
2968
+ tier: "workhorse"
2969
+ };
2970
+ var GET_TOPIC_GRAPH_SPINE = {
2971
+ name: "get_topic_graph_spine",
2972
+ description: "Verify the topic graph spine. Like `git fsck` \u2014 reads topics, materialized topic nodes, parent-child edges, and missing spine rows.",
2973
+ parameters: {
2974
+ rootTopicId: {
2975
+ type: "string",
2976
+ description: "Optional root topic for a bounded verifier pass"
2977
+ },
2978
+ includeTopicBeliefEdges: {
2979
+ type: "boolean",
2980
+ description: "Include topic -> belief edges in the verifier payload"
2981
+ }
2982
+ },
2983
+ required: [],
2984
+ response: {
2985
+ description: "Topic graph spine verification payload",
2986
+ fields: {
2987
+ ok: "boolean",
2988
+ counts: "object",
2989
+ topics: "array",
2990
+ topicNodes: "array",
2991
+ parentEdges: "array",
2992
+ missingTopicNodes: "array",
2993
+ missingParentEdges: "array"
2994
+ }
2995
+ },
2996
+ ownerModule: "reasoning-kernel",
2997
+ ontologyPrimitive: "graph",
2998
+ tier: "workhorse"
2999
+ };
2615
3000
  var GET_CODE_CONTEXT = {
2616
3001
  name: "get_code_context",
2617
3002
  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.",
@@ -2807,7 +3192,7 @@ var MANAGE_WRITE_POLICY = {
2807
3192
  },
2808
3193
  role: {
2809
3194
  type: "string",
2810
- description: "Role to set policy for (required for 'set'). E.g. 'agent:internal', 'user:analyst'."
3195
+ description: "Role to set policy for (required for 'set'). E.g. 'agent:internal' or a Permit role key such as 'workspace_admin'."
2811
3196
  },
2812
3197
  permission: {
2813
3198
  type: "string",
@@ -3794,6 +4179,9 @@ var BEGIN_BUILD_SESSION = {
3794
4179
  sessionMode: "string \u2014 async | interactive",
3795
4180
  targetBeliefIds: "array \u2014 scoped belief IDs",
3796
4181
  targetQuestionIds: "array \u2014 scoped question IDs",
4182
+ taskIds: "array \u2014 assigned task IDs for this worktree",
4183
+ incompleteTaskIds: "array \u2014 assigned task IDs that still require done/deferred/blocked proof",
4184
+ tasks: "array \u2014 assigned task packet with id, title, status, priority, links, and summaries",
3797
4185
  topBeliefs: "array \u2014 highest-confidence scoped beliefs",
3798
4186
  openQuestions: "array \u2014 open scoped questions",
3799
4187
  resolvedDecisions: "array \u2014 answered questions summarized for the session",
@@ -3849,6 +4237,19 @@ var MCP_TOOL_CONTRACTS = {
3849
4237
  bisect_confidence: BISECT_CONFIDENCE,
3850
4238
  // Edges (commit)
3851
4239
  create_edge: CREATE_EDGE,
4240
+ update_edge: UPDATE_EDGE,
4241
+ remove_edge: REMOVE_EDGE,
4242
+ remove_edges_between: REMOVE_EDGES_BETWEEN,
4243
+ batch_create_edges: BATCH_CREATE_EDGES,
4244
+ // Epistemic node spine (commit/amend/show)
4245
+ create_epistemic_node: CREATE_EPISTEMIC_NODE,
4246
+ get_epistemic_node: GET_EPISTEMIC_NODE,
4247
+ list_epistemic_nodes: LIST_EPISTEMIC_NODES,
4248
+ update_epistemic_node: UPDATE_EPISTEMIC_NODE,
4249
+ archive_epistemic_node: ARCHIVE_EPISTEMIC_NODE,
4250
+ verify_epistemic_node: VERIFY_EPISTEMIC_NODE,
4251
+ supersede_epistemic_node: SUPERSEDE_EPISTEMIC_NODE,
4252
+ batch_create_epistemic_nodes: BATCH_CREATE_EPISTEMIC_NODES,
3852
4253
  // Judgments (tag)
3853
4254
  record_judgment: RECORD_JUDGMENT,
3854
4255
  // Graph intelligence (showcase)
@@ -3883,6 +4284,7 @@ var MCP_TOOL_CONTRACTS = {
3883
4284
  update_worktree_targets: UPDATE_WORKTREE_TARGETS,
3884
4285
  update_worktree_metadata: UPDATE_WORKTREE_METADATA,
3885
4286
  identity_whoami: IDENTITY_WHOAMI,
4287
+ resolve_interactive_principal: RESOLVE_INTERACTIVE_PRINCIPAL,
3886
4288
  compile_context: COMPILE_CONTEXT,
3887
4289
  record_scope_learning: RECORD_SCOPE_LEARNING,
3888
4290
  pipeline_snapshot: PIPELINE_SNAPSHOT,
@@ -3922,6 +4324,8 @@ var MCP_TOOL_CONTRACTS = {
3922
4324
  get_topic: GET_TOPIC,
3923
4325
  update_topic: UPDATE_TOPIC,
3924
4326
  get_topic_tree: GET_TOPIC_TREE,
4327
+ materialize_topic_graph: MATERIALIZE_TOPIC_GRAPH,
4328
+ get_topic_graph_spine: GET_TOPIC_GRAPH_SPINE,
3925
4329
  // Coding intelligence (code-grounded knowledge)
3926
4330
  get_code_context: GET_CODE_CONTEXT,
3927
4331
  get_change_history: GET_CHANGE_HISTORY,
@@ -3998,6 +4402,7 @@ function entries(names, surfaceClass, surfaceIntent, surfaces, rationale) {
3998
4402
  var MCP_CORE_OPERATION_NAMES = [
3999
4403
  "compile_context",
4000
4404
  "identity_whoami",
4405
+ "resolve_interactive_principal",
4001
4406
  "check_permission",
4002
4407
  "filter_by_permission",
4003
4408
  "create_belief",
@@ -4026,14 +4431,28 @@ var MCP_CORE_OPERATION_NAMES = [
4026
4431
  "find_missing_questions",
4027
4432
  "get_high_priority_questions",
4028
4433
  "get_falsification_questions",
4434
+ "create_epistemic_node",
4435
+ "get_epistemic_node",
4436
+ "list_epistemic_nodes",
4437
+ "update_epistemic_node",
4438
+ "archive_epistemic_node",
4439
+ "verify_epistemic_node",
4440
+ "supersede_epistemic_node",
4441
+ "batch_create_epistemic_nodes",
4029
4442
  "create_topic",
4030
4443
  "get_topic",
4031
4444
  "list_topics",
4032
4445
  "update_topic",
4033
- "get_topic_tree"
4446
+ "get_topic_tree",
4447
+ "materialize_topic_graph",
4448
+ "get_topic_graph_spine"
4034
4449
  ];
4035
4450
  var MCP_ANALYSIS_PLATFORM_OPERATION_NAMES = [
4036
4451
  "create_edge",
4452
+ "update_edge",
4453
+ "remove_edge",
4454
+ "remove_edges_between",
4455
+ "batch_create_edges",
4037
4456
  "query_lineage",
4038
4457
  "traverse_graph",
4039
4458
  "get_graph_neighborhood",
@@ -4269,6 +4688,13 @@ var LUCERN_OPERATION_MANIFEST = {
4269
4688
  "Lucern MCP-only platform operation for local agent/bootstrap or verification workflows. Hidden from public discovery."
4270
4689
  )
4271
4690
  };
4691
+ 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"]);
4692
+ 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"];
4693
+ var STORAGE_EDGE_TYPE_VALUES = [...EDGE_TYPE_VALUES, "extracted_from"];
4694
+ z.enum(EDGE_TYPE_VALUES);
4695
+ z.enum(STORAGE_EDGE_TYPE_VALUES);
4696
+ z.enum(["active", "archived", "watching"]);
4697
+ z.enum(["private", "team", "firm", "external", "public"]);
4272
4698
 
4273
4699
  // src/function-registry/helpers.ts
4274
4700
  var jsonObjectSchema = z.record(z.unknown());
@@ -4365,12 +4791,20 @@ function unwrapMcpParameterSchema(schema) {
4365
4791
  current = current._def.schema;
4366
4792
  continue;
4367
4793
  default:
4368
- return { schema: current, required, description: description ?? current.description };
4794
+ return {
4795
+ schema: current,
4796
+ required,
4797
+ description: description ?? current.description
4798
+ };
4369
4799
  }
4370
4800
  }
4371
4801
  }
4372
4802
  function mcpParameterFromZod(fieldName, schema, contractName) {
4373
- const { schema: unwrapped, required, description: schemaDescription } = unwrapMcpParameterSchema(schema);
4803
+ const {
4804
+ schema: unwrapped,
4805
+ required,
4806
+ description: schemaDescription
4807
+ } = unwrapMcpParameterSchema(schema);
4374
4808
  const description = schemaDescription ?? unwrapped.description ?? fieldName;
4375
4809
  switch (unwrapped._def.typeName) {
4376
4810
  case z.ZodFirstPartyTypeKind.ZodString:
@@ -4415,10 +4849,12 @@ function mcpContractFromArgsSchema(base, args, contractName) {
4415
4849
  const entries2 = Object.entries(getObjectShape(args)).sort(
4416
4850
  ([left], [right]) => left.localeCompare(right)
4417
4851
  );
4418
- const converted = entries2.map(([fieldName, schema]) => [
4419
- fieldName,
4420
- mcpParameterFromZod(fieldName, schema, contractName)
4421
- ]);
4852
+ const converted = entries2.map(
4853
+ ([fieldName, schema]) => [
4854
+ fieldName,
4855
+ mcpParameterFromZod(fieldName, schema, contractName)
4856
+ ]
4857
+ );
4422
4858
  return {
4423
4859
  ...base,
4424
4860
  parameters: Object.fromEntries(
@@ -4533,9 +4969,16 @@ function surfaceContract(args) {
4533
4969
  scopes: args.scopes ?? [
4534
4970
  args.kind === "query" ? `${args.domain}.read` : `${args.domain}.write`
4535
4971
  ],
4536
- allowedPrincipalTypes: ["user", "service", "agent"]
4972
+ allowedPrincipalTypes: [
4973
+ "user",
4974
+ "service",
4975
+ "agent",
4976
+ "group",
4977
+ "external_viewer"
4978
+ ]
4537
4979
  },
4538
4980
  convex: args.convex,
4981
+ gateway: args.gateway,
4539
4982
  args: canonicalArgs,
4540
4983
  returns: canonicalReturns,
4541
4984
  input,
@@ -4563,6 +5006,6 @@ function assertSurfaceCoverage(contracts) {
4563
5006
  }
4564
5007
  }
4565
5008
 
4566
- export { argsSchemaFromMcpContract, assertSurfaceCoverage, authUserId, classifyContract, compactRecord, defineFunctionContract, inputSchemaFromMcpContract, jsonObjectSchema, recordValue, surfaceContract, surfaceMcpContract, withCreatedBy, withUserId };
5009
+ export { NODE_TYPE, argsSchemaFromMcpContract, assertSurfaceCoverage, authUserId, classifyContract, compactRecord, defineFunctionContract, inputSchemaFromMcpContract, jsonObjectSchema, recordValue, surfaceContract, surfaceMcpContract, withCreatedBy, withUserId };
4567
5010
  //# sourceMappingURL=helpers.js.map
4568
5011
  //# sourceMappingURL=helpers.js.map