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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/component-boundary.contract.d.ts +14 -0
  3. package/dist/component-boundary.contract.js +155 -0
  4. package/dist/component-boundary.contract.js.map +1 -0
  5. package/dist/component-host-boundary.contract.d.ts +41 -0
  6. package/dist/component-host-boundary.contract.js +54 -0
  7. package/dist/component-host-boundary.contract.js.map +1 -0
  8. package/dist/context-pack.contract.d.ts +5 -3
  9. package/dist/context-pack.contract.js.map +1 -1
  10. package/dist/{dsl-BgpoVOVQ.d.ts → dsl-djCRfuWC.d.ts} +1 -1
  11. package/dist/dsl.d.ts +1 -1
  12. package/dist/dsl.js +1 -4
  13. package/dist/dsl.js.map +1 -1
  14. package/dist/edge-policy-manifest-Dw5IhT1L.d.ts +133 -0
  15. package/dist/function-registry/beliefs.d.ts +41 -41
  16. package/dist/function-registry/beliefs.js +709 -31
  17. package/dist/function-registry/beliefs.js.map +1 -1
  18. package/dist/function-registry/coding.js +694 -31
  19. package/dist/function-registry/coding.js.map +1 -1
  20. package/dist/function-registry/context.d.ts +13 -13
  21. package/dist/function-registry/context.js +700 -35
  22. package/dist/function-registry/context.js.map +1 -1
  23. package/dist/function-registry/contracts.js +665 -28
  24. package/dist/function-registry/contracts.js.map +1 -1
  25. package/dist/function-registry/coordination.js +665 -28
  26. package/dist/function-registry/coordination.js.map +1 -1
  27. package/dist/function-registry/edges.d.ts +156 -0
  28. package/dist/function-registry/edges.js +876 -60
  29. package/dist/function-registry/edges.js.map +1 -1
  30. package/dist/function-registry/evidence.d.ts +33 -33
  31. package/dist/function-registry/evidence.js +717 -37
  32. package/dist/function-registry/evidence.js.map +1 -1
  33. package/dist/function-registry/graph.d.ts +131 -53
  34. package/dist/function-registry/graph.js +781 -35
  35. package/dist/function-registry/graph.js.map +1 -1
  36. package/dist/function-registry/helpers.d.ts +3 -3
  37. package/dist/function-registry/helpers.js +665 -28
  38. package/dist/function-registry/helpers.js.map +1 -1
  39. package/dist/function-registry/identity.js +665 -28
  40. package/dist/function-registry/identity.js.map +1 -1
  41. package/dist/function-registry/index.d.ts +321 -7
  42. package/dist/function-registry/index.js +1046 -33
  43. package/dist/function-registry/index.js.map +1 -1
  44. package/dist/function-registry/judgments.d.ts +9 -9
  45. package/dist/function-registry/judgments.js +677 -31
  46. package/dist/function-registry/judgments.js.map +1 -1
  47. package/dist/function-registry/legacy.js +665 -28
  48. package/dist/function-registry/legacy.js.map +1 -1
  49. package/dist/function-registry/lenses.d.ts +17 -17
  50. package/dist/function-registry/lenses.js +688 -31
  51. package/dist/function-registry/lenses.js.map +1 -1
  52. package/dist/function-registry/manifest.d.ts +6 -6
  53. package/dist/function-registry/manifest.js +18 -2
  54. package/dist/function-registry/manifest.js.map +1 -1
  55. package/dist/function-registry/ontologies.d.ts +45 -45
  56. package/dist/function-registry/ontologies.js +683 -34
  57. package/dist/function-registry/ontologies.js.map +1 -1
  58. package/dist/function-registry/pipeline.d.ts +13 -13
  59. package/dist/function-registry/pipeline.js +674 -31
  60. package/dist/function-registry/pipeline.js.map +1 -1
  61. package/dist/function-registry/questions.d.ts +49 -49
  62. package/dist/function-registry/questions.js +762 -36
  63. package/dist/function-registry/questions.js.map +1 -1
  64. package/dist/function-registry/tasks.d.ts +17 -17
  65. package/dist/function-registry/tasks.js +709 -30
  66. package/dist/function-registry/tasks.js.map +1 -1
  67. package/dist/function-registry/topics.d.ts +99 -21
  68. package/dist/function-registry/topics.js +747 -32
  69. package/dist/function-registry/topics.js.map +1 -1
  70. package/dist/function-registry/types.d.ts +1 -1
  71. package/dist/function-registry/worktrees.d.ts +80 -41
  72. package/dist/function-registry/worktrees.js +804 -40
  73. package/dist/function-registry/worktrees.js.map +1 -1
  74. package/dist/function-registry-input-audit.d.ts +13 -0
  75. package/dist/function-registry-input-audit.js +166 -0
  76. package/dist/function-registry-input-audit.js.map +1 -0
  77. package/dist/gateway.contract.d.ts +2 -0
  78. package/dist/gateway.contract.js.map +1 -1
  79. package/dist/generated/convexSchemas.js +4 -3
  80. package/dist/generated/convexSchemas.js.map +1 -1
  81. package/dist/generated/schema-manifest.json +49 -3
  82. package/dist/generated/tableOwnership.d.ts +2 -1
  83. package/dist/generated/tableOwnership.js +2 -0
  84. package/dist/generated/tableOwnership.js.map +1 -1
  85. package/dist/generated/tier-expectations.json +4 -2
  86. package/dist/graph-intelligence.contract.d.ts +506 -0
  87. package/dist/graph-intelligence.contract.js +595 -0
  88. package/dist/graph-intelligence.contract.js.map +1 -0
  89. package/dist/graph-types/index.d.ts +5 -1
  90. package/dist/graph-types/index.js +15 -4
  91. package/dist/graph-types/index.js.map +1 -1
  92. package/dist/{index-CV-0_VWJ.d.ts → index-O09U2xHk.d.ts} +5 -2
  93. package/dist/index.d.ts +24 -413
  94. package/dist/index.js +3286 -136
  95. package/dist/index.js.map +1 -1
  96. package/dist/infisical-runtime.contract.d.ts +174 -0
  97. package/dist/infisical-runtime.contract.js +317 -0
  98. package/dist/infisical-runtime.contract.js.map +1 -0
  99. package/dist/lens-filter.contract.js +4 -3
  100. package/dist/lens-filter.contract.js.map +1 -1
  101. package/dist/lens-workflow.contract.js +4 -3
  102. package/dist/lens-workflow.contract.js.map +1 -1
  103. package/dist/manifests/edge-policy-manifest.d.ts +2 -0
  104. package/dist/manifests/edge-policy-manifest.data.d.ts +13 -0
  105. package/dist/manifests/edge-policy-manifest.data.js +26 -0
  106. package/dist/manifests/edge-policy-manifest.data.js.map +1 -0
  107. package/dist/manifests/edge-policy-manifest.js +92 -0
  108. package/dist/manifests/edge-policy-manifest.js.map +1 -0
  109. package/dist/manifests/infisical-runtime-manifest.d.ts +151 -0
  110. package/dist/manifests/infisical-runtime-manifest.js +316 -0
  111. package/dist/manifests/infisical-runtime-manifest.js.map +1 -0
  112. package/dist/manifests/invariant-manifest.d.ts +65 -0
  113. package/dist/manifests/invariant-manifest.js +18 -0
  114. package/dist/manifests/invariant-manifest.js.map +1 -0
  115. package/dist/manifests/invariants/ast-utils.d.ts +14 -0
  116. package/dist/manifests/invariants/ast-utils.js +54 -0
  117. package/dist/manifests/invariants/ast-utils.js.map +1 -0
  118. package/dist/manifests/invariants/index.d.ts +15 -0
  119. package/dist/manifests/invariants/index.js +183 -0
  120. package/dist/manifests/invariants/index.js.map +1 -0
  121. package/dist/manifests/invariants/inv-1-beliefs-append-only.d.ts +12 -0
  122. package/dist/manifests/invariants/inv-1-beliefs-append-only.js +94 -0
  123. package/dist/manifests/invariants/inv-1-beliefs-append-only.js.map +1 -0
  124. package/dist/manifests/invariants/inv-14-no-silent-transitions.d.ts +12 -0
  125. package/dist/manifests/invariants/inv-14-no-silent-transitions.js +99 -0
  126. package/dist/manifests/invariants/inv-14-no-silent-transitions.js.map +1 -0
  127. package/dist/manifests/invariants/manifest-1-projections-declare-audit.d.ts +12 -0
  128. package/dist/manifests/invariants/manifest-1-projections-declare-audit.js +42 -0
  129. package/dist/manifests/invariants/manifest-1-projections-declare-audit.js.map +1 -0
  130. package/dist/manifests/tenant-client-manifest.d.ts +322 -0
  131. package/dist/manifests/tenant-client-manifest.js +432 -0
  132. package/dist/manifests/tenant-client-manifest.js.map +1 -0
  133. package/dist/mcp-gateway-boundary.contract.d.ts +181 -0
  134. package/dist/mcp-gateway-boundary.contract.js +43 -0
  135. package/dist/mcp-gateway-boundary.contract.js.map +1 -0
  136. package/dist/projections/check-convex-args-shape.d.ts +3 -0
  137. package/dist/projections/check-convex-args-shape.js +399 -0
  138. package/dist/projections/check-convex-args-shape.js.map +1 -0
  139. package/dist/projections/create-evidence.projection.d.ts +176 -0
  140. package/dist/projections/create-evidence.projection.js +131 -0
  141. package/dist/projections/create-evidence.projection.js.map +1 -0
  142. package/dist/projections/index.d.ts +102 -0
  143. package/dist/projections/index.js +348 -0
  144. package/dist/projections/index.js.map +1 -0
  145. package/dist/projections/list-beliefs.projection.d.ts +36 -0
  146. package/dist/projections/list-beliefs.projection.js +54 -0
  147. package/dist/projections/list-beliefs.projection.js.map +1 -0
  148. package/dist/projections/list-tasks.projection.d.ts +32 -0
  149. package/dist/projections/list-tasks.projection.js +52 -0
  150. package/dist/projections/list-tasks.projection.js.map +1 -0
  151. package/dist/projections/modulate-confidence.projection.d.ts +219 -0
  152. package/dist/projections/modulate-confidence.projection.js +148 -0
  153. package/dist/projections/modulate-confidence.projection.js.map +1 -0
  154. package/dist/projections/projection-dsl.d.ts +11 -0
  155. package/dist/projections/projection-dsl.js +8 -0
  156. package/dist/projections/projection-dsl.js.map +1 -0
  157. package/dist/schema-helpers/enumValidation.js +2 -5
  158. package/dist/schema-helpers/enumValidation.js.map +1 -1
  159. package/dist/schema-helpers/spine/nodes/decision.js +2 -1
  160. package/dist/schema-helpers/spine/nodes/decision.js.map +1 -1
  161. package/dist/schema-helpers/spine/tables/epistemicNodes.js +27 -27
  162. package/dist/schema-helpers/spine/tables/epistemicNodes.js.map +1 -1
  163. package/dist/schemas/component-table-manifest.d.ts +2 -2
  164. package/dist/schemas/enums.d.ts +5 -2
  165. package/dist/schemas/enums.js +5 -2
  166. package/dist/schemas/enums.js.map +1 -1
  167. package/dist/schemas/index.d.ts +1 -1
  168. package/dist/schemas/index.js +45 -4
  169. package/dist/schemas/index.js.map +1 -1
  170. package/dist/schemas/manifest.d.ts +1030 -890
  171. package/dist/schemas/manifest.js +44 -3
  172. package/dist/schemas/manifest.js.map +1 -1
  173. package/dist/schemas/sl-opinion.d.ts +4 -4
  174. package/dist/schemas/tables/identity/platform.d.ts +10 -10
  175. package/dist/schemas/tables/kernel/epistemic.d.ts +6 -6
  176. package/dist/schemas/tables/kernel/infra.d.ts +4 -4
  177. package/dist/schemas/tables/kernel/intelligence.d.ts +10 -10
  178. package/dist/schemas/tables/kernel/lens.d.ts +4 -4
  179. package/dist/schemas/tables/kernel/platform.d.ts +12 -12
  180. package/dist/schemas/tables/kernel/spine.d.ts +3 -3
  181. package/dist/schemas/tables/kernel/spine.js +5 -2
  182. package/dist/schemas/tables/kernel/spine.js.map +1 -1
  183. package/dist/schemas/tables/kernel/task.d.ts +42 -42
  184. package/dist/schemas/tables/kernel/topic.js +5 -1
  185. package/dist/schemas/tables/kernel/topic.js.map +1 -1
  186. package/dist/schemas/tables/kernel/worktree.d.ts +58 -58
  187. package/dist/schemas/tables/mc/identity.d.ts +26 -3
  188. package/dist/schemas/tables/mc/identity.js +35 -1
  189. package/dist/schemas/tables/mc/identity.js.map +1 -1
  190. package/dist/schemas/tables/mc/pack.d.ts +20 -20
  191. package/dist/schemas/tables/mc/registry.d.ts +4 -4
  192. package/dist/schemas/tables/mc/workspace.d.ts +9 -3
  193. package/dist/schemas/tables/mc/workspace.js +3 -1
  194. package/dist/schemas/tables/mc/workspace.js.map +1 -1
  195. package/dist/sdk-methods.contract.d.ts +2 -2
  196. package/dist/{sdk-tools.contract-S4ia0TTo.d.ts → sdk-tools.contract-BNklQDfB.d.ts} +2 -2
  197. package/dist/sdk-tools.contract.d.ts +2 -2
  198. package/dist/sdk-tools.contract.js +646 -23
  199. package/dist/sdk-tools.contract.js.map +1 -1
  200. package/dist/tenant-bootstrap-seed.contract.d.ts +1101 -0
  201. package/dist/tenant-bootstrap-seed.contract.js +653 -0
  202. package/dist/tenant-bootstrap-seed.contract.js.map +1 -0
  203. package/dist/tenant-bootstrap-seed.defaults.d.ts +16 -0
  204. package/dist/tenant-bootstrap-seed.defaults.js +303 -0
  205. package/dist/tenant-bootstrap-seed.defaults.js.map +1 -0
  206. package/dist/tenant-client.contract.d.ts +349 -0
  207. package/dist/tenant-client.contract.js +488 -0
  208. package/dist/tenant-client.contract.js.map +1 -0
  209. package/dist/{tool-contracts-C92-9ueT.d.ts → tool-contracts-BevD9Ho2.d.ts} +36 -2
  210. package/dist/tool-contracts.d.ts +1 -1
  211. package/dist/tool-contracts.js +647 -24
  212. package/dist/tool-contracts.js.map +1 -1
  213. package/package.json +9 -1
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { z, ZodFirstPartyTypeKind } from 'zod';
2
2
  import { v } from 'convex/values';
3
+ import { ALL_FUNCTION_CONTRACTS } from './function-registry/index.js';
3
4
  export * from './function-registry/index.js';
4
5
 
5
6
  var __defProp = Object.defineProperty;
@@ -224,6 +225,209 @@ function lastDelegator(delegationChain) {
224
225
  return delegationChain[delegationChain.length - 1]?.principalId;
225
226
  }
226
227
 
228
+ // src/generated/tableOwnership.ts
229
+ var TABLE_OWNERSHIP = {
230
+ "agentMessages": "K",
231
+ "agentRegistryEntries": "L",
232
+ "agents": "I",
233
+ "agentSessions": "K",
234
+ "apiKeys": "L",
235
+ "auditLog": "L",
236
+ "autofixJobs": "K",
237
+ "backgroundJobRuns": "K",
238
+ "backgroundJobSettings": "K",
239
+ "beliefConfidence": "K",
240
+ "beliefEvidenceLinks": "K",
241
+ "beliefHistory": "K",
242
+ "beliefScenarios": "K",
243
+ "beliefVotes": "K",
244
+ "calibrationScores": "K",
245
+ "compatibilityShims": "L",
246
+ "contractEvaluations": "K",
247
+ "contradictions": "K",
248
+ "controlPlaneTenantModelSlotBindings": "L",
249
+ "controlPlaneTenantProviderSecrets": "L",
250
+ "controlPlaneTenantProxyGatewayUsage": "L",
251
+ "controlPlaneToolAcls": "L",
252
+ "crossProjectConnections": "K",
253
+ "cutoverFlags": "L",
254
+ "decisionComputedSummaries": "K",
255
+ "decisionEvents": "K",
256
+ "decisionParticipants": "K",
257
+ "decisionRiskLedger": "K",
258
+ "decisionSnapshots": "K",
259
+ "deliberationContributions": "K",
260
+ "deliberationSessions": "K",
261
+ "epistemicAudit": "K",
262
+ "epistemicContracts": "K",
263
+ "epistemicEdges": "K",
264
+ "epistemicNodeEmbeddings": "K",
265
+ "epistemicNodes": "K",
266
+ "graphAnalysisCache": "K",
267
+ "graphAnalysisResults": "K",
268
+ "graphSuggestions": "K",
269
+ "groupMemberships": "L",
270
+ "groups": "L",
271
+ "harnessReplays": "K",
272
+ "harnessRuns": "K",
273
+ "idempotencyTokens": "K",
274
+ "lenses": "K",
275
+ "lensTopicBindings": "K",
276
+ "mcpWritePolicy": "I",
277
+ "memberships": "L",
278
+ "methodologyPacks": "L",
279
+ "modelCallLogs": "I",
280
+ "modelFunctionSlots": "I",
281
+ "modelRegistry": "I",
282
+ "modelSlotConfigs": "I",
283
+ "neo4jSyncQueue": "K",
284
+ "oauthDeviceCodes": "L",
285
+ "ontologyDefinitions": "K",
286
+ "ontologyVersions": "K",
287
+ "packAssignments": "L",
288
+ "packDefinitions": "L",
289
+ "packEntitlements": "L",
290
+ "packGroupAssignments": "L",
291
+ "packInstallations": "L",
292
+ "packVersions": "L",
293
+ "platformAgentRunPolicyDecisions": "K",
294
+ "platformAgentRunPromptResolutions": "K",
295
+ "platformAgentRuns": "K",
296
+ "platformAgentRunToolCalls": "K",
297
+ "platformAudienceGrants": "I",
298
+ "platformAudiences": "I",
299
+ "platformHarnessShadowAudit": "K",
300
+ "platformPolicyDecisionLogs": "I",
301
+ "policyBundles": "L",
302
+ "policyDecisionLogs": "L",
303
+ "policySimulations": "L",
304
+ "principals": "L",
305
+ "projectGrants": "I",
306
+ "publicationRules": "K",
307
+ "questionEvidenceLinks": "K",
308
+ "rateLimitWindows": "L",
309
+ "reasoningPermissions": "I",
310
+ "researchJobs": "K",
311
+ "schemaEnumConfig": "K",
312
+ "servicePrincipalKeys": "L",
313
+ "stakeholderGroups": "K",
314
+ "systemLogs": "K",
315
+ "tasks": "K",
316
+ "tenantApiKeys": "I",
317
+ "tenantConfig": "I",
318
+ "tenantDeploymentCredentials": "L",
319
+ "tenantIntegrations": "I",
320
+ "tenantMethodologyAssignments": "L",
321
+ "tenantModelSlotBindings": "I",
322
+ "tenantPolicies": "I",
323
+ "tenantProviderSecrets": "I",
324
+ "tenantProxyGatewayUsage": "I",
325
+ "tenantProxyTokenMints": "I",
326
+ "tenants": "L",
327
+ "tenantSandboxAuditEvents": "I",
328
+ "tenantSecrets": "I",
329
+ "toolAcls": "I",
330
+ "toolCatalog": "L",
331
+ "toolRegistry": "I",
332
+ "toolRegistryEntries": "L",
333
+ "topics": "K",
334
+ "users": "I",
335
+ "userSessions": "L",
336
+ "workflowDefinitions": "K",
337
+ "workflowPullRequests": "K",
338
+ "workflowStages": "K",
339
+ "workspaces": "L",
340
+ "worktreeBeliefCluster": "K",
341
+ "worktrees": "K"
342
+ };
343
+
344
+ // src/component-boundary.contract.ts
345
+ var COMPONENT_BOUNDARY_CONTRACT_VERSION = "2026-04-27";
346
+ var COMPONENT_BOUNDARY_COMPONENT_LAYERS = [
347
+ "I",
348
+ "K"
349
+ ];
350
+ var COMPONENT_BOUNDARY_DIRECT_DB_METHODS = [
351
+ "insert",
352
+ "patch",
353
+ "replace",
354
+ "delete",
355
+ "query"
356
+ ];
357
+ var COMPONENT_BOUNDARY_HOST_SOURCE_ROOTS = [
358
+ "services",
359
+ "apps",
360
+ "convex"
361
+ ];
362
+ var COMPONENT_BOUNDARY_HIGH_RISK_TABLES = [
363
+ "backgroundJobRuns",
364
+ "backgroundJobSettings",
365
+ "systemLogs",
366
+ "epistemicAudit",
367
+ "platformPolicyDecisionLogs",
368
+ "tenantApiKeys",
369
+ "projectGrants",
370
+ "userSessions"
371
+ ];
372
+ function getComponentBoundaryTableLayer(tableName) {
373
+ return TABLE_OWNERSHIP[tableName];
374
+ }
375
+ function isComponentBoundaryComponentOwnedTable(tableName) {
376
+ const layer = getComponentBoundaryTableLayer(tableName);
377
+ return layer === "I" || layer === "K";
378
+ }
379
+
380
+ // src/component-host-boundary.contract.ts
381
+ var COMPONENT_HOST_BOUNDARY_CONTRACT_VERSION = "2026-04-28";
382
+ var COMPONENT_HOST_PROTECTED_TABLES = [
383
+ "backgroundJobRuns",
384
+ "backgroundJobSettings",
385
+ "systemLogs",
386
+ "epistemicAudit",
387
+ "platformPolicyDecisionLogs",
388
+ "tenantApiKeys",
389
+ "projectGrants",
390
+ "userSessions"
391
+ ];
392
+ var COMPONENT_HOST_PROTECTED_TABLE_OWNERS = {
393
+ backgroundJobRuns: "kernel_component",
394
+ backgroundJobSettings: "kernel_component",
395
+ systemLogs: "kernel_component",
396
+ epistemicAudit: "reasoning_kernel_component",
397
+ platformPolicyDecisionLogs: "identity_component",
398
+ tenantApiKeys: "identity_component",
399
+ projectGrants: "identity_component",
400
+ userSessions: "tenant_or_control_plane_schema"
401
+ };
402
+ var COMPONENT_HOST_DB_WRITE_OPERATIONS = [
403
+ "insert",
404
+ "patch",
405
+ "replace",
406
+ "delete"
407
+ ];
408
+ var COMPONENT_HOST_DB_READ_OPERATIONS = ["query"];
409
+ var COMPONENT_HOST_WRITE_AUDIT_ROOTS = [
410
+ "apps/web/convex",
411
+ "packages/server-core/src",
412
+ "services/kernel-template/convex",
413
+ "services/identity-template/convex",
414
+ "services/master-control/convex"
415
+ ];
416
+ var COMPONENT_HOST_WRITE_ALLOWED_EXCEPTIONS = [
417
+ {
418
+ file: "services/master-control/convex/userSessions.ts",
419
+ table: "userSessions",
420
+ operation: "insert",
421
+ reason: "Master Control declares and owns its own userSessions table for gateway session validation."
422
+ },
423
+ {
424
+ file: "services/master-control/convex/userSessions.ts",
425
+ table: "userSessions",
426
+ operation: "query",
427
+ reason: "Master Control declares and owns its own userSessions table for gateway session validation."
428
+ }
429
+ ];
430
+
227
431
  // src/gateway.contract.ts
228
432
  function requireActorPrincipalId(authContext) {
229
433
  const principalId = typeof authContext.principalId === "string" ? authContext.principalId.trim() : "";
@@ -233,6 +437,598 @@ function requireActorPrincipalId(authContext) {
233
437
  throw new Error("Access denied: federated principal context required.");
234
438
  }
235
439
 
440
+ // src/graph-intelligence.contract.ts
441
+ var GRAPH_INTELLIGENCE_QUERY_CATALOG_VERSION = "graph_intelligence_query_catalog.v1";
442
+ var GRAPH_INTELLIGENCE_QUERY_MODES = [
443
+ "core",
444
+ "bias",
445
+ "stress",
446
+ "operational",
447
+ "alpha",
448
+ "semantic",
449
+ "evidence"
450
+ ];
451
+ var GRAPH_INTELLIGENCE_PUBLIC_TOOL_NAMES = [
452
+ "get_graph_structure_analysis",
453
+ "detect_confirmation_bias",
454
+ "get_graph_gaps",
455
+ "get_topic_coverage",
456
+ "find_contradictions",
457
+ "get_falsification_questions",
458
+ "search_beliefs",
459
+ "search_evidence",
460
+ "list_beliefs",
461
+ "list_questions",
462
+ "traverse_graph",
463
+ "query_lineage",
464
+ "get_graph_neighborhood"
465
+ ];
466
+ var GRAPH_INTELLIGENCE_MODE_TOOL_NAMES = {
467
+ core: [
468
+ "get_graph_structure_analysis",
469
+ "get_topic_coverage",
470
+ "get_graph_gaps",
471
+ "list_beliefs",
472
+ "list_questions",
473
+ "search_evidence"
474
+ ],
475
+ bias: [
476
+ "get_graph_structure_analysis",
477
+ "detect_confirmation_bias",
478
+ "find_contradictions",
479
+ "search_evidence",
480
+ "list_beliefs"
481
+ ],
482
+ stress: [
483
+ "get_graph_structure_analysis",
484
+ "get_graph_gaps",
485
+ "find_contradictions",
486
+ "get_falsification_questions",
487
+ "list_beliefs",
488
+ "list_questions"
489
+ ],
490
+ operational: [
491
+ "get_topic_coverage",
492
+ "get_graph_gaps",
493
+ "list_beliefs",
494
+ "list_questions",
495
+ "search_evidence"
496
+ ],
497
+ alpha: [
498
+ "get_graph_structure_analysis",
499
+ "detect_confirmation_bias",
500
+ "find_contradictions",
501
+ "search_beliefs",
502
+ "search_evidence"
503
+ ],
504
+ semantic: [
505
+ "get_graph_structure_analysis",
506
+ "search_beliefs",
507
+ "search_evidence",
508
+ "traverse_graph",
509
+ "query_lineage",
510
+ "get_graph_neighborhood"
511
+ ],
512
+ evidence: [
513
+ "get_graph_structure_analysis",
514
+ "get_topic_coverage",
515
+ "search_evidence",
516
+ "get_falsification_questions",
517
+ "find_contradictions"
518
+ ]
519
+ };
520
+ var GRAPH_INTELLIGENCE_QUERY_CATEGORIES = [
521
+ {
522
+ id: "problems",
523
+ name: "Find Problems",
524
+ description: "Risk, contradiction, bias, and structural weakness queries."
525
+ },
526
+ {
527
+ id: "gaps",
528
+ name: "Find Gaps",
529
+ description: "Missing evidence, unanswered questions, and sparse areas."
530
+ },
531
+ {
532
+ id: "reasoning",
533
+ name: "Reasoning Quality",
534
+ description: "Assumption chains, evidence convergence, and weak links."
535
+ },
536
+ {
537
+ id: "strategic",
538
+ name: "Strategic Analysis",
539
+ description: "Pre-mortems, falsification, contrarian signals, and bets."
540
+ },
541
+ {
542
+ id: "deep",
543
+ name: "Deep Graph Analysis",
544
+ description: "Centrality, propagation, underdetermination, and topology."
545
+ },
546
+ {
547
+ id: "browse",
548
+ name: "Browse and Explore",
549
+ description: "Narrative summaries, search, theme exploration, and bridges."
550
+ },
551
+ {
552
+ id: "prep",
553
+ name: "Meeting Prep",
554
+ description: "Company, entity, and question prep from graph context."
555
+ }
556
+ ];
557
+ var byMode = (mode) => GRAPH_INTELLIGENCE_MODE_TOOL_NAMES[mode];
558
+ var GRAPH_INTELLIGENCE_QUERIES = [
559
+ {
560
+ id: "confirmation-bias",
561
+ categoryId: "problems",
562
+ mode: "bias",
563
+ name: "Find Confirmation Bias",
564
+ description: "Find beliefs supported mainly by confirming evidence.",
565
+ prompt: "Find beliefs where supporting evidence overwhelms challenging evidence. Prioritize high-conviction beliefs with few defeaters.",
566
+ highlightStrategy: "bias-risk",
567
+ riskLevel: "high"
568
+ },
569
+ {
570
+ id: "contradiction-map",
571
+ categoryId: "problems",
572
+ mode: "stress",
573
+ name: "Map Contradictions",
574
+ description: "Surface direct and indirect contradiction clusters.",
575
+ prompt: "Map the graph's contradiction clusters and explain which tensions matter most.",
576
+ highlightStrategy: "contradictions",
577
+ riskLevel: "high"
578
+ },
579
+ {
580
+ id: "weak-evidence",
581
+ categoryId: "problems",
582
+ mode: "stress",
583
+ name: "Weak Evidence Chains",
584
+ description: "Find important claims with thin or indirect evidence.",
585
+ prompt: "Find high-importance beliefs whose evidence support is thin, indirect, stale, or low quality.",
586
+ highlightStrategy: "weak-support",
587
+ riskLevel: "medium"
588
+ },
589
+ {
590
+ id: "single-source",
591
+ categoryId: "problems",
592
+ mode: "bias",
593
+ name: "Single-Source Risk",
594
+ description: "Find claims overly dependent on one source or source type.",
595
+ prompt: "Identify beliefs that rely on a single source, one methodology, or one repeated perspective.",
596
+ highlightStrategy: "source-concentration",
597
+ riskLevel: "medium"
598
+ },
599
+ {
600
+ id: "untested-assumptions",
601
+ categoryId: "problems",
602
+ mode: "stress",
603
+ name: "Untested Assumptions",
604
+ description: "Find load-bearing assumptions without falsification paths.",
605
+ prompt: "Find assumptions that appear load-bearing but do not have direct testing questions or falsification evidence.",
606
+ highlightStrategy: "untested",
607
+ riskLevel: "high"
608
+ },
609
+ {
610
+ id: "load-bearing-beliefs",
611
+ categoryId: "problems",
612
+ mode: "stress",
613
+ name: "Load-Bearing Beliefs",
614
+ description: "Find central beliefs whose failure would affect many claims.",
615
+ prompt: "Find the beliefs with the largest downstream impact if they are wrong.",
616
+ highlightStrategy: "load-bearing",
617
+ riskLevel: "high"
618
+ },
619
+ {
620
+ id: "cascade-analysis",
621
+ categoryId: "problems",
622
+ mode: "stress",
623
+ name: "Cascade Analysis",
624
+ description: "Trace what changes if a belief is weakened or invalidated.",
625
+ prompt: "Analyze likely downstream cascades if the most central or uncertain beliefs are weakened.",
626
+ highlightStrategy: "cascade",
627
+ riskLevel: "high"
628
+ },
629
+ {
630
+ id: "unanswered-questions",
631
+ categoryId: "gaps",
632
+ mode: "operational",
633
+ name: "Unanswered Questions",
634
+ description: "Find important open questions that block confidence.",
635
+ prompt: "Identify the most important unanswered questions and explain which beliefs they block.",
636
+ highlightStrategy: "open-questions"
637
+ },
638
+ {
639
+ id: "thin-themes",
640
+ categoryId: "gaps",
641
+ mode: "operational",
642
+ name: "Thin Themes",
643
+ description: "Find topics with shallow belief or evidence coverage.",
644
+ prompt: "Find themes that look underdeveloped relative to their role in the graph.",
645
+ highlightStrategy: "thin-themes"
646
+ },
647
+ {
648
+ id: "missing-evidence",
649
+ categoryId: "gaps",
650
+ mode: "stress",
651
+ name: "Missing Evidence",
652
+ description: "Find beliefs that need specific missing evidence.",
653
+ prompt: "Find the most valuable missing evidence needed to strengthen or falsify the graph.",
654
+ highlightStrategy: "missing-evidence"
655
+ },
656
+ {
657
+ id: "isolated-clusters",
658
+ categoryId: "gaps",
659
+ mode: "operational",
660
+ name: "Isolated Clusters",
661
+ description: "Find clusters not connected to the broader graph.",
662
+ prompt: "Find isolated graph clusters and recommend bridge questions or bridge evidence.",
663
+ highlightStrategy: "isolated-clusters"
664
+ },
665
+ {
666
+ id: "source-contribution",
667
+ categoryId: "gaps",
668
+ mode: "evidence",
669
+ name: "Source Contribution",
670
+ description: "Assess how source mix shapes the graph.",
671
+ prompt: "Assess whether the source mix is balanced enough for the graph's strongest claims.",
672
+ highlightStrategy: "source-mix"
673
+ },
674
+ {
675
+ id: "stale-beliefs",
676
+ categoryId: "gaps",
677
+ mode: "operational",
678
+ name: "Stale Beliefs",
679
+ description: "Find beliefs that need review because they are old or stale.",
680
+ prompt: "Find beliefs that should be revisited because they are stale, unsupported by recent evidence, or contradicted by newer context.",
681
+ highlightStrategy: "staleness"
682
+ },
683
+ {
684
+ id: "assumption-pyramid",
685
+ categoryId: "reasoning",
686
+ mode: "operational",
687
+ name: "Assumption Pyramid",
688
+ description: "Show which conclusions rest on which assumptions.",
689
+ prompt: "Build an assumption pyramid from the graph: foundational assumptions, intermediate claims, and top-level conclusions.",
690
+ highlightStrategy: "assumptions"
691
+ },
692
+ {
693
+ id: "converging-evidence",
694
+ categoryId: "reasoning",
695
+ mode: "evidence",
696
+ name: "Converging Evidence",
697
+ description: "Find claims supported by independent evidence streams.",
698
+ prompt: "Find beliefs with genuinely independent converging evidence and explain why they are robust.",
699
+ highlightStrategy: "convergence"
700
+ },
701
+ {
702
+ id: "weakest-links",
703
+ categoryId: "reasoning",
704
+ mode: "stress",
705
+ name: "Weakest Links",
706
+ description: "Find the weakest links in important reasoning chains.",
707
+ prompt: "Find the weakest links in important reasoning chains and explain how to test them.",
708
+ highlightStrategy: "weak-links",
709
+ riskLevel: "medium"
710
+ },
711
+ {
712
+ id: "challenged-beliefs",
713
+ categoryId: "reasoning",
714
+ mode: "stress",
715
+ name: "Challenged Beliefs",
716
+ description: "Find beliefs with active challenges or defeaters.",
717
+ prompt: "Find beliefs with active challenges, contradiction edges, or unresolved defeaters.",
718
+ highlightStrategy: "challenged"
719
+ },
720
+ {
721
+ id: "contrarian-map",
722
+ categoryId: "strategic",
723
+ mode: "alpha",
724
+ name: "Contrarian Map",
725
+ description: "Find non-consensus beliefs and where they are grounded.",
726
+ prompt: "Find the graph's strongest contrarian or non-consensus beliefs and explain their support.",
727
+ highlightStrategy: "contrarian"
728
+ },
729
+ {
730
+ id: "irreversibility-audit",
731
+ categoryId: "strategic",
732
+ mode: "stress",
733
+ name: "Irreversibility Audit",
734
+ description: "Find irreversible bets and assumptions behind them.",
735
+ prompt: "Audit irreversible decisions or beliefs and identify what must be true before acting.",
736
+ highlightStrategy: "irreversible",
737
+ riskLevel: "high"
738
+ },
739
+ {
740
+ id: "pre-mortem",
741
+ categoryId: "strategic",
742
+ mode: "stress",
743
+ name: "Pre-Mortem",
744
+ description: "Explain how the graph could be wrong.",
745
+ prompt: "Run a pre-mortem: assume the current thesis fails and identify the most plausible failure paths.",
746
+ highlightStrategy: "failure-paths",
747
+ riskLevel: "high"
748
+ },
749
+ {
750
+ id: "devils-advocate",
751
+ categoryId: "strategic",
752
+ mode: "stress",
753
+ name: "Devil's Advocate",
754
+ description: "Generate the strongest critique of the graph.",
755
+ prompt: "Produce the strongest evidence-grounded critique of the current graph and its main thesis.",
756
+ highlightStrategy: "critique"
757
+ },
758
+ {
759
+ id: "falsification-map",
760
+ categoryId: "strategic",
761
+ mode: "stress",
762
+ name: "Falsification Map",
763
+ description: "Find the cheapest tests that would disprove key beliefs.",
764
+ prompt: "Map the cheapest, clearest falsification tests for the graph's key claims.",
765
+ highlightStrategy: "falsification",
766
+ riskLevel: "high"
767
+ },
768
+ {
769
+ id: "prediction-tracker",
770
+ categoryId: "strategic",
771
+ mode: "evidence",
772
+ name: "Prediction Tracker",
773
+ description: "Find beliefs that imply measurable predictions.",
774
+ prompt: "Find beliefs that imply measurable predictions and suggest tracking signals.",
775
+ highlightStrategy: "predictions"
776
+ },
777
+ {
778
+ id: "belief-pagerank",
779
+ categoryId: "deep",
780
+ mode: "semantic",
781
+ name: "Belief PageRank",
782
+ description: "Identify structurally central beliefs.",
783
+ prompt: "Use graph centrality to identify the most structurally important beliefs.",
784
+ highlightStrategy: "centrality"
785
+ },
786
+ {
787
+ id: "underdetermination",
788
+ categoryId: "deep",
789
+ mode: "semantic",
790
+ name: "Underdetermination",
791
+ description: "Find places where evidence supports multiple explanations.",
792
+ prompt: "Find places where the same evidence could support multiple incompatible explanations.",
793
+ highlightStrategy: "underdetermination"
794
+ },
795
+ {
796
+ id: "confidence-propagation",
797
+ categoryId: "deep",
798
+ mode: "semantic",
799
+ name: "Confidence Propagation",
800
+ description: "Assess how uncertainty moves through the graph.",
801
+ prompt: "Explain how uncertainty propagates from weak or contested beliefs through downstream conclusions.",
802
+ highlightStrategy: "confidence-flow"
803
+ },
804
+ {
805
+ id: "argument-depth",
806
+ categoryId: "deep",
807
+ mode: "evidence",
808
+ name: "Argument Depth",
809
+ description: "Assess reasoning depth and chain quality.",
810
+ prompt: "Assess reasoning depth: where claims are shallow, deeply supported, or overextended.",
811
+ highlightStrategy: "depth"
812
+ },
813
+ {
814
+ id: "information-edge",
815
+ categoryId: "deep",
816
+ mode: "alpha",
817
+ name: "Information Edge",
818
+ description: "Find differentiated evidence or signals.",
819
+ prompt: "Find evidence, sources, or beliefs that could represent differentiated information edge.",
820
+ highlightStrategy: "information-edge"
821
+ },
822
+ {
823
+ id: "thesis-summary",
824
+ categoryId: "browse",
825
+ mode: "semantic",
826
+ name: "Thesis Summary",
827
+ description: "Summarize the graph's core thesis and support.",
828
+ prompt: "Summarize the graph's core thesis, strongest support, weakest support, and open questions.",
829
+ highlightStrategy: "summary"
830
+ },
831
+ {
832
+ id: "theme-deep-dive",
833
+ categoryId: "browse",
834
+ mode: "semantic",
835
+ name: "Theme Deep Dive",
836
+ description: "Deep dive into a named theme.",
837
+ prompt: "Deep dive into {input}. Explain the key beliefs, evidence, contradictions, and open questions.",
838
+ inputType: "theme",
839
+ highlightStrategy: "theme"
840
+ },
841
+ {
842
+ id: "belief-detail",
843
+ categoryId: "browse",
844
+ mode: "semantic",
845
+ name: "Belief Detail",
846
+ description: "Explain one belief and its graph neighborhood.",
847
+ prompt: "Explain {input} and its support, challenges, related beliefs, and downstream implications.",
848
+ inputType: "belief",
849
+ highlightStrategy: "belief"
850
+ },
851
+ {
852
+ id: "strongest-beliefs",
853
+ categoryId: "browse",
854
+ mode: "operational",
855
+ name: "Strongest Beliefs",
856
+ description: "Find the graph's strongest current beliefs.",
857
+ prompt: "Find the strongest current beliefs and explain why each one deserves confidence.",
858
+ highlightStrategy: "strongest"
859
+ },
860
+ {
861
+ id: "cross-theme-connection",
862
+ categoryId: "browse",
863
+ mode: "semantic",
864
+ name: "Cross-Theme Connections",
865
+ description: "Find bridges between themes.",
866
+ prompt: "Find meaningful connections across themes and explain which bridge beliefs matter.",
867
+ highlightStrategy: "bridges"
868
+ },
869
+ {
870
+ id: "research-velocity",
871
+ categoryId: "browse",
872
+ mode: "operational",
873
+ name: "Research Velocity",
874
+ description: "Summarize recent graph movement and momentum.",
875
+ prompt: "Assess research velocity: what changed recently, where progress is fastest, and what is stuck.",
876
+ highlightStrategy: "velocity"
877
+ },
878
+ {
879
+ id: "search",
880
+ categoryId: "browse",
881
+ mode: "semantic",
882
+ name: "Graph Search",
883
+ description: "Search the graph with semantic context.",
884
+ prompt: "Search the graph for {input}. Return the most relevant beliefs, evidence, and questions.",
885
+ inputType: "search",
886
+ highlightStrategy: "search"
887
+ },
888
+ {
889
+ id: "expert-coverage",
890
+ categoryId: "browse",
891
+ mode: "semantic",
892
+ name: "Expert Coverage",
893
+ description: "Assess coverage from expert/source perspectives.",
894
+ prompt: "Assess whether the graph has enough expert, primary, and dissenting coverage.",
895
+ highlightStrategy: "expert-coverage"
896
+ },
897
+ {
898
+ id: "value-chain-map",
899
+ categoryId: "browse",
900
+ mode: "semantic",
901
+ name: "Value Chain Map",
902
+ description: "Map entities, dependencies, and value-chain logic.",
903
+ prompt: "Map the value chain implied by this graph: entities, dependencies, pressure points, and missing links.",
904
+ highlightStrategy: "value-chain"
905
+ },
906
+ {
907
+ id: "meeting-brief",
908
+ categoryId: "prep",
909
+ mode: "semantic",
910
+ name: "Meeting Brief",
911
+ description: "Prepare a meeting brief from graph context.",
912
+ prompt: "Prepare a concise meeting brief using the graph: thesis, open questions, risks, and recommended asks.",
913
+ highlightStrategy: "brief"
914
+ },
915
+ {
916
+ id: "open-questions-entity",
917
+ categoryId: "prep",
918
+ mode: "semantic",
919
+ name: "Entity Open Questions",
920
+ description: "Find open questions about a specific entity.",
921
+ prompt: "Find the most important open questions about {input} and the beliefs those questions would unlock.",
922
+ inputType: "entity",
923
+ highlightStrategy: "entity-questions"
924
+ },
925
+ {
926
+ id: "company-context",
927
+ categoryId: "prep",
928
+ mode: "semantic",
929
+ name: "Company Context",
930
+ description: "Summarize graph context about a company.",
931
+ prompt: "Summarize what the graph knows about {input}: thesis relevance, evidence, risks, and open questions.",
932
+ inputType: "company",
933
+ highlightStrategy: "company"
934
+ },
935
+ {
936
+ id: "company-theme-fit",
937
+ categoryId: "prep",
938
+ mode: "semantic",
939
+ name: "Company Theme Fit",
940
+ description: "Assess how a company fits graph themes.",
941
+ prompt: "Assess how {input} fits the graph's themes and where the fit is weak or uncertain.",
942
+ inputType: "company",
943
+ highlightStrategy: "fit"
944
+ },
945
+ {
946
+ id: "company-comparison",
947
+ categoryId: "prep",
948
+ mode: "semantic",
949
+ name: "Company Comparison",
950
+ description: "Compare companies through graph context.",
951
+ prompt: "Compare {input} using graph beliefs, evidence, risks, and open questions.",
952
+ inputType: "company-list",
953
+ highlightStrategy: "comparison"
954
+ },
955
+ {
956
+ id: "questions-to-ask",
957
+ categoryId: "prep",
958
+ mode: "operational",
959
+ name: "Questions to Ask",
960
+ description: "Generate high-signal questions from graph gaps.",
961
+ prompt: "Generate the highest-signal questions to ask next, grounded in current graph gaps.",
962
+ highlightStrategy: "questions"
963
+ },
964
+ {
965
+ id: "beliefs-to-test",
966
+ categoryId: "prep",
967
+ mode: "stress",
968
+ name: "Beliefs to Test",
969
+ description: "Prioritize beliefs that should be tested next.",
970
+ prompt: "Prioritize the beliefs that should be tested next and explain the cheapest test for each.",
971
+ highlightStrategy: "tests",
972
+ riskLevel: "medium"
973
+ }
974
+ ];
975
+ var GRAPH_INTELLIGENCE_QUERIES_WITH_TOOLS = GRAPH_INTELLIGENCE_QUERIES.map((query) => {
976
+ const definition = query;
977
+ return {
978
+ ...definition,
979
+ tools: definition.tools ?? byMode(definition.mode)
980
+ };
981
+ });
982
+ var GRAPH_INTELLIGENCE_QUICK_QUERIES = [
983
+ {
984
+ id: "health-check",
985
+ name: "Health Check",
986
+ queryId: "thesis-summary",
987
+ prompt: "Give me a fast graph health check: biggest strengths, biggest risks, and next best action."
988
+ },
989
+ {
990
+ id: "find-risks",
991
+ name: "Find Risks",
992
+ queryId: "weakest-links",
993
+ prompt: "Find the most important risks in this graph and the beliefs or evidence behind each one."
994
+ },
995
+ {
996
+ id: "pre-mortem",
997
+ name: "Pre-Mortem",
998
+ queryId: "pre-mortem",
999
+ prompt: "Assume this thesis fails. Explain the most plausible failure paths and what would reveal them early."
1000
+ },
1001
+ {
1002
+ id: "whats-next",
1003
+ name: "What's Next",
1004
+ queryId: "questions-to-ask",
1005
+ prompt: "What should I learn or test next to make this graph more useful?"
1006
+ }
1007
+ ];
1008
+ function isGraphIntelligenceQueryMode(value) {
1009
+ return typeof value === "string" && GRAPH_INTELLIGENCE_QUERY_MODES.includes(value);
1010
+ }
1011
+ function getGraphIntelligenceQuery(queryId) {
1012
+ return GRAPH_INTELLIGENCE_QUERIES_WITH_TOOLS.find(
1013
+ (query) => query.id === queryId
1014
+ );
1015
+ }
1016
+ function listGraphIntelligenceQueries(filter = {}) {
1017
+ return GRAPH_INTELLIGENCE_QUERIES_WITH_TOOLS.filter((query) => {
1018
+ if (filter.categoryId && query.categoryId !== filter.categoryId) {
1019
+ return false;
1020
+ }
1021
+ if (filter.mode && query.mode !== filter.mode) {
1022
+ return false;
1023
+ }
1024
+ return true;
1025
+ });
1026
+ }
1027
+ function fillGraphIntelligencePromptTemplate(prompt, input) {
1028
+ const replacement = input?.trim() || "the current topic";
1029
+ return prompt.split("{input}").join(replacement);
1030
+ }
1031
+
236
1032
  // src/context-pack.contract.ts
237
1033
  var CONTEXT_PACK_SCHEMA_VERSION = "1.0.0";
238
1034
  var CONTEXT_RANKING_PROFILES = [
@@ -712,9 +1508,6 @@ function encodeLiteral(value) {
712
1508
  }
713
1509
  return JSON.stringify(value);
714
1510
  }
715
- function quoteKey(value) {
716
- return JSON.stringify(value);
717
- }
718
1511
  function sortEntries(entries) {
719
1512
  return [...entries].sort(([left], [right]) => left.localeCompare(right));
720
1513
  }
@@ -877,7 +1670,7 @@ function convertSchemaInner(schema, state, path) {
877
1670
  convertSchema(value, state, [...path, key])
878
1671
  ]);
879
1672
  return {
880
- source: `v.object({ ${convertedFields.map(([key, converted]) => `${quoteKey(key)}: ${converted.source}`).join(", ")} })`,
1673
+ source: `v.object({ ${convertedFields.map(([key, converted]) => `${JSON.stringify(key)}: ${converted.source}`).join(", ")} })`,
881
1674
  defaults: convertedFields.flatMap(([, converted]) => converted.defaults)
882
1675
  };
883
1676
  }
@@ -1183,11 +1976,14 @@ __export(schemas_exports, {
1183
1976
  ALL_TABLE_CONTRACTS: () => ALL_TABLE_CONTRACTS,
1184
1977
  ComponentTableManifestSchema: () => ComponentTableManifestSchema,
1185
1978
  EDGE_TYPE: () => EDGE_TYPE,
1979
+ EDGE_TYPE_VALUES: () => EDGE_TYPE_VALUES,
1186
1980
  IDENTITY_TABLE_CONTRACTS: () => IDENTITY_TABLE_CONTRACTS,
1187
1981
  KERNEL_TABLE_CONTRACTS: () => KERNEL_TABLE_CONTRACTS,
1188
1982
  MC_TABLE_CONTRACTS: () => MC_TABLE_CONTRACTS,
1189
1983
  NODE_TYPE: () => NODE_TYPE,
1190
1984
  SLOpinionInputSchema: () => SLOpinionInputSchema,
1985
+ STORAGE_EDGE_TYPE: () => STORAGE_EDGE_TYPE,
1986
+ STORAGE_EDGE_TYPE_VALUES: () => STORAGE_EDGE_TYPE_VALUES,
1191
1987
  TABLE_CONTRACTS_BY_COMPONENT: () => TABLE_CONTRACTS_BY_COMPONENT,
1192
1988
  TOPIC_STATUS: () => TOPIC_STATUS,
1193
1989
  TOPIC_VISIBILITY: () => TOPIC_VISIBILITY,
@@ -1195,7 +1991,10 @@ __export(schemas_exports, {
1195
1991
  listTableContractsByName: () => listTableContractsByName
1196
1992
  });
1197
1993
  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"]);
1198
- var EDGE_TYPE = z.enum(["supports", "informs", "depends_on", "extracted_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"]);
1994
+ 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"];
1995
+ var STORAGE_EDGE_TYPE_VALUES = [...EDGE_TYPE_VALUES, "extracted_from"];
1996
+ var EDGE_TYPE = z.enum(EDGE_TYPE_VALUES);
1997
+ var STORAGE_EDGE_TYPE = z.enum(STORAGE_EDGE_TYPE_VALUES);
1199
1998
  var TOPIC_STATUS = z.enum(["active", "archived", "watching"]);
1200
1999
  var TOPIC_VISIBILITY = z.enum(["private", "team", "firm", "external", "public"]);
1201
2000
  var agentMessages = defineTable({
@@ -2680,7 +3479,7 @@ var epistemicEdges = defineTable({
2680
3479
  "toNodeId": z.string().optional(),
2681
3480
  "sourceGlobalId": z.string().optional(),
2682
3481
  "targetGlobalId": z.string().optional(),
2683
- "edgeType": EDGE_TYPE,
3482
+ "edgeType": STORAGE_EDGE_TYPE,
2684
3483
  "edgeTier": z.string().optional(),
2685
3484
  "domainNamespace": z.string().optional(),
2686
3485
  "constraint": z.string().optional(),
@@ -3023,6 +3822,40 @@ var rateLimitWindows = defineTable({
3023
3822
  { kind: "index", name: "by_tier_window_end", columns: ["tier", "windowEndMs"] }
3024
3823
  ]
3025
3824
  });
3825
+ var oauthDeviceCodes = defineTable({
3826
+ name: "oauthDeviceCodes",
3827
+ component: "mc",
3828
+ category: "identity",
3829
+ shape: z.object({
3830
+ "deviceCodeHash": z.string(),
3831
+ "userCode": z.string(),
3832
+ "clientId": z.string(),
3833
+ "scope": z.string(),
3834
+ "status": z.enum(["pending", "approved", "denied", "expired", "consumed"]),
3835
+ "expiresAt": z.number(),
3836
+ "intervalSeconds": z.number(),
3837
+ "lastPolledAt": z.number().optional(),
3838
+ "slowDownCount": z.number().optional(),
3839
+ "clerkUserId": z.string().optional(),
3840
+ "tenantId": idOf("tenants").optional(),
3841
+ "workspaceId": z.string().optional(),
3842
+ "principalId": z.string().optional(),
3843
+ "role": z.string().optional(),
3844
+ "scopes": z.array(z.string()).optional(),
3845
+ "sessionId": z.string().optional(),
3846
+ "approvedAt": z.number().optional(),
3847
+ "deniedAt": z.number().optional(),
3848
+ "consumedAt": z.number().optional(),
3849
+ "createdAt": z.number(),
3850
+ "updatedAt": z.number()
3851
+ }),
3852
+ indices: [
3853
+ { kind: "index", name: "by_deviceCodeHash", columns: ["deviceCodeHash"] },
3854
+ { kind: "index", name: "by_userCode", columns: ["userCode"] },
3855
+ { kind: "index", name: "by_status_expiresAt", columns: ["status", "expiresAt"] },
3856
+ { kind: "index", name: "by_sessionId", columns: ["sessionId"] }
3857
+ ]
3858
+ });
3026
3859
  var servicePrincipalKeys = defineTable({
3027
3860
  name: "servicePrincipalKeys",
3028
3861
  component: "mc",
@@ -4855,6 +5688,7 @@ var topics = defineTable({
4855
5688
  "updatedAt": z.number()
4856
5689
  }),
4857
5690
  indices: [
5691
+ { kind: "index", name: "by_globalId", columns: ["globalId"] },
4858
5692
  { kind: "index", name: "by_parent", columns: ["parentTopicId"] },
4859
5693
  { kind: "index", name: "by_type", columns: ["type"] },
4860
5694
  { kind: "index", name: "by_graph_scope_project", columns: ["graphScopeProjectId"] },
@@ -4979,7 +5813,9 @@ var workspaces = defineTable({
4979
5813
  "defaultProjectVisibility": z.enum(["private", "team", "firm", "external", "public"]).optional(),
4980
5814
  "deployments": z.record(z.object({
4981
5815
  "url": z.string(),
4982
- "encryptedDeployKey": z.string()
5816
+ "target": z.enum(["kernelDeployment", "appDeployment"]).optional(),
5817
+ "encryptedDeployKey": z.string().optional(),
5818
+ "credentialRef": z.string().optional()
4983
5819
  })).optional(),
4984
5820
  "metadata": z.record(z.any()).optional(),
4985
5821
  "createdBy": z.string().optional(),
@@ -5387,6 +6223,7 @@ var MC_TABLE_CONTRACTS = [
5387
6223
  groupMemberships,
5388
6224
  groups,
5389
6225
  memberships,
6226
+ oauthDeviceCodes,
5390
6227
  principals,
5391
6228
  rateLimitWindows,
5392
6229
  servicePrincipalKeys,
@@ -5467,17 +6304,44 @@ var SLOpinionInputSchema = z.object({
5467
6304
  message: "SL invariant b+d+u=1 violated at API boundary"
5468
6305
  }
5469
6306
  );
5470
- var EpistemicNodeTypeSchema = z.enum([
6307
+
6308
+ // src/schema-helpers/spine/tables/epistemicNodes.ts
6309
+ var NODE_TYPES = [
6310
+ "decision",
5471
6311
  "belief",
5472
- "evidence",
5473
6312
  "question",
5474
- "answer",
6313
+ "theme",
6314
+ "deal",
5475
6315
  "topic",
6316
+ "claim",
6317
+ "evidence",
6318
+ "synthesis",
6319
+ "answer",
6320
+ "atomic_fact",
6321
+ "excerpt",
6322
+ "source",
6323
+ "company",
6324
+ "person",
6325
+ "investor",
6326
+ "function",
6327
+ "value_chain"
6328
+ ];
6329
+ new Set(NODE_TYPES);
6330
+
6331
+ // src/types/graph-ref.ts
6332
+ var GRAPH_REF_EXTRA_NODE_TYPES = [
5476
6333
  "edge",
5477
6334
  "ontology",
5478
6335
  "lens",
5479
6336
  "contradiction"
5480
- ]);
6337
+ ];
6338
+ var GRAPH_REF_NODE_TYPES = [
6339
+ ...NODE_TYPES,
6340
+ ...GRAPH_REF_EXTRA_NODE_TYPES
6341
+ ];
6342
+ var EpistemicNodeTypeSchema = z.enum(
6343
+ GRAPH_REF_NODE_TYPES
6344
+ );
5481
6345
  var GraphRefSchema = z.discriminatedUnion("kind", [
5482
6346
  z.object({
5483
6347
  kind: z.literal("epistemic_node"),
@@ -5525,97 +6389,797 @@ function assertEdgePolicyAllowed(manifest, edgeType, from, to) {
5525
6389
  }
5526
6390
 
5527
6391
  // src/manifests/edge-policy-manifest.data.ts
6392
+ var publicEpistemicNodeEdgePolicy = (edgeType) => ({
6393
+ edgeType,
6394
+ fromKinds: ["epistemic_node"],
6395
+ toKinds: ["epistemic_node"],
6396
+ description: "Canonical public create_edge policy for graph-node relationships. The policy layer gates edge-type membership, not endpoint semantics."
6397
+ });
5528
6398
  var edgePolicyManifest = {
5529
6399
  manifestVersion: "1.0.0",
5530
- policies: [
5531
- {
5532
- edgeType: "evidence_derived_from_evidence",
5533
- fromKinds: ["epistemic_node"],
5534
- fromNodeTypes: ["evidence"],
5535
- toKinds: ["epistemic_node"],
5536
- toNodeTypes: ["evidence"],
5537
- description: "Evidence E2 was synthesized from evidence E1 by a transformation. Provides chain-of-evidence lineage."
5538
- },
5539
- {
5540
- edgeType: "evidence_supports_belief",
5541
- fromKinds: ["epistemic_node"],
5542
- fromNodeTypes: ["evidence"],
5543
- toKinds: ["epistemic_node"],
5544
- toNodeTypes: ["belief"],
5545
- description: "Existing link_evidence_to_belief semantics promoted to the create_edge policy source."
5546
- },
5547
- {
5548
- edgeType: "evidence_supports_question",
5549
- fromKinds: ["epistemic_node"],
5550
- fromNodeTypes: ["evidence"],
5551
- toKinds: ["epistemic_node"],
5552
- toNodeTypes: ["question"],
5553
- description: "Existing link_evidence_to_question semantics promoted to the create_edge policy source."
5554
- }
5555
- ]
6400
+ policies: EDGE_TYPE_VALUES.map(publicEpistemicNodeEdgePolicy)
5556
6401
  };
5557
- var InvariantManifestSchema = z.object({
5558
- manifestVersion: z.literal("1.0.0"),
5559
- rules: z.array(
5560
- z.object({
5561
- invariant: z.string(),
5562
- description: z.string(),
5563
- checker: z.enum(["ast", "manifest", "runtime"]),
5564
- severity: z.enum(["block_publish", "block_pr", "warn"])
5565
- })
5566
- )
5567
- });
5568
-
5569
- // src/projections/projection-dsl.ts
5570
- function defineProjection(def) {
5571
- return def;
5572
- }
5573
6402
 
5574
- // src/projections/create-evidence.projection.ts
5575
- var jsonRecordSchema = z.record(z.unknown());
5576
- var createEvidenceInputSchemaBase = z.object({
5577
- projectId: z.string().optional(),
5578
- topicId: z.string().optional(),
5579
- text: z.string().optional(),
5580
- canonicalText: z.string().optional(),
5581
- title: z.string().optional(),
5582
- content: z.string().optional(),
5583
- contentType: z.string().optional(),
5584
- kind: z.string().optional(),
5585
- tags: z.array(z.string()).optional(),
5586
- source: z.string().optional(),
5587
- sourceUrl: z.string().optional(),
5588
- sourceType: z.string().optional(),
5589
- externalSourceType: z.string().optional(),
5590
- sourceQuestionId: z.string().optional(),
5591
- methodology: z.string().optional(),
5592
- informationAsymmetry: z.string().optional(),
5593
- sourceDescription: z.string().optional(),
5594
- targetId: z.string().optional(),
5595
- targetNodeId: z.string().optional(),
5596
- linkedBeliefNodeId: z.string().optional(),
5597
- evidenceRelation: z.enum(["supports", "contradicts", "neutral"]).optional(),
5598
- confidence: z.number().optional(),
5599
- weight: z.number().optional(),
5600
- reasoning: z.string().optional(),
5601
- rationale: z.string(),
5602
- metadata: jsonRecordSchema.optional(),
5603
- trustedBypassAccessCheck: z.boolean().optional()
5604
- }).passthrough();
5605
- var createEvidenceInputSchema = createEvidenceInputSchemaBase.refine(
5606
- (input) => Boolean(input.text ?? input.canonicalText),
6403
+ // src/tenant-client.contract.ts
6404
+ var TENANT_CLIENT_CONTRACT_VERSION = "2026-04-27";
6405
+ var TENANT_CLIENT_AUTH_MODES = [
6406
+ "interactive_user",
6407
+ "service_principal",
6408
+ "tenant_api_key",
6409
+ "session_token"
6410
+ ];
6411
+ var TENANT_CLIENT_PRINCIPAL_TYPES = [
6412
+ "human",
6413
+ "service",
6414
+ "agent"
6415
+ ];
6416
+ var TENANT_CLIENT_REQUIRED_CONTEXT_FIELDS = [
6417
+ "tenantId",
6418
+ "workspaceId",
6419
+ "principalId",
6420
+ "authMode",
6421
+ "scopes"
6422
+ ];
6423
+ var TENANT_CLIENT_OPTIONAL_CONTEXT_FIELDS = [
6424
+ "principalType",
6425
+ "roles",
6426
+ "sessionId",
6427
+ "delegationChain"
6428
+ ];
6429
+ var TENANT_CLIENT_INSTALL_TOKEN_ENV = "INSTALL_LUCERN_NPM";
6430
+ var TENANT_CLIENT_INSTALL_TOKEN_INFISICAL_PATH = "tenants/shared";
6431
+ var TENANT_CLIENT_FORBIDDEN_INSTALL_TOKEN_INFISICAL_PATHS = [
6432
+ "/platform/publish"
6433
+ ];
6434
+ var TENANT_CLIENT_FORBIDDEN_SECRET_ENV = ["NPM_TOKEN"];
6435
+ var TENANT_CLIENT_INSTALLABLE_PACKAGES = [
5607
6436
  {
5608
- message: "create_evidence requires text",
5609
- path: ["text"]
5610
- }
5611
- );
5612
- function compactRecord(input) {
6437
+ packageName: "@lucern/access-control",
6438
+ role: "runtime_entrypoint",
6439
+ directTenantImport: true
6440
+ },
6441
+ {
6442
+ packageName: "@lucern/agent",
6443
+ role: "platform_runtime",
6444
+ directTenantImport: false
6445
+ },
6446
+ {
6447
+ packageName: "@lucern/auth",
6448
+ role: "sdk_dependency",
6449
+ directTenantImport: false
6450
+ },
6451
+ {
6452
+ packageName: "@lucern/cli",
6453
+ role: "developer_tool",
6454
+ directTenantImport: false
6455
+ },
6456
+ {
6457
+ packageName: "@lucern/client-core",
6458
+ role: "sdk_dependency",
6459
+ directTenantImport: false
6460
+ },
6461
+ {
6462
+ packageName: "@lucern/confidence",
6463
+ role: "sdk_dependency",
6464
+ directTenantImport: false
6465
+ },
6466
+ {
6467
+ packageName: "@lucern/config",
6468
+ role: "configuration",
6469
+ directTenantImport: false
6470
+ },
6471
+ {
6472
+ packageName: "@lucern/contracts",
6473
+ role: "contract_entrypoint",
6474
+ directTenantImport: true
6475
+ },
6476
+ {
6477
+ packageName: "@lucern/control-plane",
6478
+ role: "platform_runtime",
6479
+ directTenantImport: false
6480
+ },
6481
+ {
6482
+ packageName: "@lucern/developer-kit",
6483
+ role: "developer_tool",
6484
+ directTenantImport: false
6485
+ },
6486
+ {
6487
+ packageName: "@lucern/events",
6488
+ role: "sdk_dependency",
6489
+ directTenantImport: false
6490
+ },
6491
+ {
6492
+ packageName: "@lucern/graph-primitives",
6493
+ role: "sdk_dependency",
6494
+ directTenantImport: false
6495
+ },
6496
+ {
6497
+ packageName: "@lucern/graph-sync",
6498
+ role: "host_addon_runtime",
6499
+ directTenantImport: true
6500
+ },
6501
+ {
6502
+ packageName: "@lucern/identity",
6503
+ role: "component_runtime",
6504
+ directTenantImport: false
6505
+ },
6506
+ {
6507
+ packageName: "@lucern/mcp",
6508
+ role: "runtime_entrypoint",
6509
+ directTenantImport: true
6510
+ },
6511
+ {
6512
+ packageName: "@lucern/pack-host",
6513
+ role: "platform_runtime",
6514
+ directTenantImport: false
6515
+ },
6516
+ {
6517
+ packageName: "@lucern/pack-installer",
6518
+ role: "developer_tool",
6519
+ directTenantImport: false
6520
+ },
6521
+ {
6522
+ packageName: "@lucern/proof-compiler",
6523
+ role: "developer_tool",
6524
+ directTenantImport: false
6525
+ },
6526
+ {
6527
+ packageName: "@lucern/react",
6528
+ role: "runtime_entrypoint",
6529
+ directTenantImport: true
6530
+ },
6531
+ {
6532
+ packageName: "@lucern/reasoning-kernel",
6533
+ role: "component_runtime",
6534
+ directTenantImport: false
6535
+ },
6536
+ {
6537
+ packageName: "@lucern/sdk",
6538
+ role: "runtime_entrypoint",
6539
+ directTenantImport: true
6540
+ },
6541
+ {
6542
+ packageName: "@lucern/server-core",
6543
+ role: "platform_runtime",
6544
+ directTenantImport: false
6545
+ },
6546
+ {
6547
+ packageName: "@lucern/testing",
6548
+ role: "test_support",
6549
+ directTenantImport: false
6550
+ },
6551
+ {
6552
+ packageName: "@lucern/types",
6553
+ role: "contract_entrypoint",
6554
+ directTenantImport: true
6555
+ }
6556
+ ];
6557
+ var TENANT_CLIENT_FULL_SUITE_PACKAGE_NAMES = TENANT_CLIENT_INSTALLABLE_PACKAGES.map(
6558
+ (entry) => entry.packageName
6559
+ );
6560
+ var TENANT_CLIENT_INSTALL_PROFILES = [
6561
+ {
6562
+ id: "core_app_runtime",
6563
+ description: "Smallest tenant app/runtime install for typed Lucern API calls plus tool-access policy helpers.",
6564
+ packageNames: ["@lucern/sdk", "@lucern/access-control"],
6565
+ dependencyField: "dependencies"
6566
+ },
6567
+ {
6568
+ id: "react_app_runtime",
6569
+ description: "React tenant app install for hooks, provider, curated graph components, and direct SDK calls.",
6570
+ packageNames: ["@lucern/react", "@lucern/sdk", "@lucern/access-control"],
6571
+ dependencyField: "dependencies"
6572
+ },
6573
+ {
6574
+ id: "convex_components",
6575
+ description: "Tenant Convex host install for binding the Lucern identity and reasoning-kernel components.",
6576
+ packageNames: ["@lucern/identity", "@lucern/reasoning-kernel"],
6577
+ dependencyField: "dependencies"
6578
+ },
6579
+ {
6580
+ id: "graph_mirroring_addon",
6581
+ description: "Optional tenant Convex host install for Neo4j graph projection, edge topology writes, backfill, health checks, and query proxy helpers.",
6582
+ packageNames: ["@lucern/graph-sync"],
6583
+ dependencyField: "dependencies"
6584
+ },
6585
+ {
6586
+ id: "operator_cli",
6587
+ description: "Developer/operator install for the `lucern` binary, including tenant bootstrap seed commands.",
6588
+ packageNames: ["@lucern/cli"],
6589
+ dependencyField: "devDependencies"
6590
+ },
6591
+ {
6592
+ id: "mcp_runtime",
6593
+ description: "Agent runtime install for the standalone Lucern MCP server and hosted route helpers.",
6594
+ packageNames: ["@lucern/mcp"],
6595
+ dependencyField: "dependencies"
6596
+ },
6597
+ {
6598
+ id: "contracts_and_types",
6599
+ description: "Compile-time contract/type install for codegen, audits, and tenant integration validation.",
6600
+ packageNames: ["@lucern/contracts", "@lucern/types"],
6601
+ dependencyField: "dependencies"
6602
+ },
6603
+ {
6604
+ id: "full_suite",
6605
+ description: "Full coherent Lucern package suite for design-partner repos that want every published runtime, tool, component, test, and config package pinned together.",
6606
+ packageNames: TENANT_CLIENT_FULL_SUITE_PACKAGE_NAMES,
6607
+ dependencyField: "mixed"
6608
+ }
6609
+ ];
6610
+ var TENANT_CLIENT_PUBLIC_IMPORTS = [
6611
+ {
6612
+ packageName: "@lucern/sdk",
6613
+ surface: "runtime",
6614
+ subpaths: "published_exports",
6615
+ description: "TypeScript SDK runtime and generated operation namespaces."
6616
+ },
6617
+ {
6618
+ packageName: "@lucern/react",
6619
+ surface: "runtime",
6620
+ subpaths: "published_exports",
6621
+ description: "React bindings for tenant-owned UI applications."
6622
+ },
6623
+ {
6624
+ packageName: "@lucern/mcp",
6625
+ surface: "runtime",
6626
+ subpaths: "published_exports",
6627
+ description: "MCP client/server entry points and hosted route helpers."
6628
+ },
6629
+ {
6630
+ packageName: "@lucern/graph-sync",
6631
+ surface: "runtime",
6632
+ subpaths: "published_exports",
6633
+ description: "Optional Neo4j graph mirroring host actions, edge API, query proxy, backfill, and health helpers."
6634
+ },
6635
+ {
6636
+ packageName: "@lucern/contracts",
6637
+ surface: "contract",
6638
+ subpaths: "published_exports",
6639
+ description: "Published type and manifest contracts."
6640
+ },
6641
+ {
6642
+ packageName: "@lucern/access-control",
6643
+ surface: "runtime",
6644
+ subpaths: "published_exports",
6645
+ description: "Tenant runtime access-control helpers, including effective tool access."
6646
+ },
6647
+ {
6648
+ packageName: "@lucern/types",
6649
+ surface: "contract",
6650
+ subpaths: "published_exports",
6651
+ description: "Published type-only helpers for tenant integration code."
6652
+ }
6653
+ ];
6654
+ var TENANT_CLIENT_COMPONENT_CONFIG_IMPORTS = [
6655
+ {
6656
+ packageName: "@lucern/identity",
6657
+ importPath: "@lucern/identity/convex.config",
6658
+ surface: "component_config",
6659
+ description: "Convex component binding config for tenant deployments that install Lucern identity."
6660
+ },
6661
+ {
6662
+ packageName: "@lucern/reasoning-kernel",
6663
+ importPath: "@lucern/reasoning-kernel/convex.config",
6664
+ surface: "component_config",
6665
+ description: "Convex component binding config for tenant deployments that install the Lucern reasoning kernel."
6666
+ },
6667
+ {
6668
+ packageName: "@lucern/reasoning-kernel",
6669
+ importPath: "@lucern/reasoning-kernel/runtime.config",
6670
+ surface: "component_config",
6671
+ description: "Runtime config alias for tenant deployments that install the Lucern reasoning kernel."
6672
+ }
6673
+ ];
6674
+ function findTenantClientInstallablePackage(packageName) {
6675
+ return TENANT_CLIENT_INSTALLABLE_PACKAGES.find(
6676
+ (entry) => entry.packageName === packageName
6677
+ );
6678
+ }
6679
+ function isTenantClientInstallablePackage(packageName) {
6680
+ return Boolean(findTenantClientInstallablePackage(packageName));
6681
+ }
6682
+ var TENANT_CLIENT_REQUIRED_SDK_NAMESPACES = [
6683
+ "bootstrap",
6684
+ "context",
6685
+ "beliefs",
6686
+ "evidence",
6687
+ "questions",
6688
+ "graph",
6689
+ "worktrees",
6690
+ "topics",
6691
+ "edges",
6692
+ "contradictions",
6693
+ "contracts",
6694
+ "graphIntel",
6695
+ "graphIntelligence",
6696
+ "graphAnalysis",
6697
+ "graphRecommendations",
6698
+ "orgGraphSearch",
6699
+ "embeddings",
6700
+ "ontologyLinks",
6701
+ "graphStateClassifier",
6702
+ "tools",
6703
+ "identity",
6704
+ "modelRuntime",
6705
+ "events",
6706
+ "jobs",
6707
+ "telemetry"
6708
+ ];
6709
+ var TENANT_CLIENT_CAPABILITIES = [
6710
+ {
6711
+ id: "identity.bootstrap_session",
6712
+ description: "Start a scoped Lucern session for a tenant principal.",
6713
+ surfaces: ["@lucern/sdk", "@lucern/mcp"],
6714
+ requiredContextFields: TENANT_CLIENT_REQUIRED_CONTEXT_FIELDS
6715
+ },
6716
+ {
6717
+ id: "reasoning.context.compile",
6718
+ description: "Compile tenant and workspace scoped reasoning context.",
6719
+ surfaces: ["@lucern/sdk", "@lucern/react", "@lucern/mcp"],
6720
+ requiredContextFields: TENANT_CLIENT_REQUIRED_CONTEXT_FIELDS
6721
+ },
6722
+ {
6723
+ id: "reasoning.graph.read",
6724
+ description: "Read beliefs, evidence, questions, topics, graph edges, and lineage.",
6725
+ surfaces: ["@lucern/sdk", "@lucern/react", "@lucern/mcp"],
6726
+ requiredContextFields: TENANT_CLIENT_REQUIRED_CONTEXT_FIELDS
6727
+ },
6728
+ {
6729
+ id: "reasoning.graph.write",
6730
+ description: "Create and update graph objects through authorized APIs.",
6731
+ surfaces: ["@lucern/sdk", "@lucern/mcp"],
6732
+ requiredContextFields: TENANT_CLIENT_REQUIRED_CONTEXT_FIELDS
6733
+ },
6734
+ {
6735
+ id: "reasoning.graph_intelligence.run",
6736
+ description: "Discover and run Graph Intelligence query recipes for structural graph analysis.",
6737
+ surfaces: ["@lucern/sdk", "@lucern/cli", "@lucern/mcp"],
6738
+ requiredContextFields: TENANT_CLIENT_REQUIRED_CONTEXT_FIELDS
6739
+ },
6740
+ {
6741
+ id: "reasoning.graph_mirroring.install",
6742
+ description: "Install and run the optional Neo4j graph mirror for paid or enterprise tenant deployments.",
6743
+ surfaces: ["@lucern/graph-sync", "@lucern/cli"],
6744
+ requiredContextFields: TENANT_CLIENT_REQUIRED_CONTEXT_FIELDS
6745
+ },
6746
+ {
6747
+ id: "workflow.worktree_lifecycle",
6748
+ description: "Create, review, merge, and close scoped worktrees.",
6749
+ surfaces: ["@lucern/sdk", "@lucern/react", "@lucern/mcp"],
6750
+ requiredContextFields: TENANT_CLIENT_REQUIRED_CONTEXT_FIELDS
6751
+ }
6752
+ ];
6753
+ var TENANT_CLIENT_ISOLATION_RULES = [
6754
+ {
6755
+ id: "tenant_workspace_scope_required",
6756
+ description: "Runtime operations must resolve both tenantId and workspaceId before reaching Lucern reasoning state."
6757
+ },
6758
+ {
6759
+ id: "principal_audit_required",
6760
+ description: "Runtime operations must carry principalId, authMode, and scopes for audit attribution."
6761
+ },
6762
+ {
6763
+ id: "no_private_lucern_imports",
6764
+ description: "Tenant code must not import Lucern source, Convex internals, generated adapters, or unpublished package internals."
6765
+ }
6766
+ ];
6767
+ var TENANT_CLIENT_FORBIDDEN_IMPORT_PATTERNS = [
6768
+ {
6769
+ id: "deep_src_import",
6770
+ pattern: "^@lucern/[^/]+/src(?:/|$)",
6771
+ description: "Published packages must not be bypassed through src paths."
6772
+ },
6773
+ {
6774
+ id: "deep_dist_import",
6775
+ pattern: "^@lucern/[^/]+/dist(?:/|$)",
6776
+ description: "Published package exports must be used instead of dist file paths."
6777
+ },
6778
+ {
6779
+ id: "generated_adapter_import",
6780
+ pattern: "^@lucern/[^/]+/(?:adapters/)?_generated(?:/|$)",
6781
+ description: "Generated Lucern adapters are internal deployment artifacts."
6782
+ },
6783
+ {
6784
+ id: "private_runtime_import",
6785
+ pattern: "^@lucern/[^/]+/(?:internal|private)(?:/|$)",
6786
+ description: "Internal and private package subpaths are not public SDK API."
6787
+ },
6788
+ {
6789
+ id: "workspace_source_import",
6790
+ pattern: "^(?:packages|modules|services|lucern|apps)/(?:.+/)?src(?:/|$)",
6791
+ description: "Tenant clients must not import source files from the Lucern monorepo."
6792
+ },
6793
+ {
6794
+ id: "root_alias_lucern_import",
6795
+ pattern: "^@/(?:lucern|packages|modules|services|apps)(?:/|$)",
6796
+ description: "Tenant clients must not depend on Lucern repo-local path aliases."
6797
+ },
6798
+ {
6799
+ id: "relative_lucern_source_import",
6800
+ pattern: "^\\.\\.?/(?:.+/)?(?:packages|modules|services|lucern|apps)(?:/|$)",
6801
+ description: "Tenant clients must not reach back into Lucern source through relative paths."
6802
+ },
6803
+ {
6804
+ id: "monorepo_path_import",
6805
+ pattern: "lucern-repo",
6806
+ description: "Absolute imports that name the Lucern repository are not portable tenant code."
6807
+ }
6808
+ ];
6809
+ function matchesPublicImport(importPath) {
6810
+ const componentConfig = TENANT_CLIENT_COMPONENT_CONFIG_IMPORTS.find(
6811
+ (entry) => importPath === entry.importPath
6812
+ );
6813
+ if (componentConfig) {
6814
+ return componentConfig;
6815
+ }
6816
+ return TENANT_CLIENT_PUBLIC_IMPORTS.find(
6817
+ (entry) => importPath === entry.packageName || importPath.startsWith(`${entry.packageName}/`)
6818
+ );
6819
+ }
6820
+ function matchesForbiddenPattern(importPath) {
6821
+ return TENANT_CLIENT_FORBIDDEN_IMPORT_PATTERNS.find(
6822
+ (entry) => new RegExp(entry.pattern, "u").test(importPath)
6823
+ );
6824
+ }
6825
+ function classifyTenantClientImport(importPath) {
6826
+ const normalizedImportPath = importPath.trim();
6827
+ const pattern = matchesForbiddenPattern(normalizedImportPath);
6828
+ if (pattern) {
6829
+ return {
6830
+ importPath: normalizedImportPath,
6831
+ decision: "forbidden",
6832
+ pattern,
6833
+ reason: pattern.description
6834
+ };
6835
+ }
6836
+ const publicImport = matchesPublicImport(normalizedImportPath);
6837
+ if (publicImport) {
6838
+ return {
6839
+ importPath: normalizedImportPath,
6840
+ decision: "public",
6841
+ publicImport,
6842
+ reason: publicImport.description
6843
+ };
6844
+ }
6845
+ if (normalizedImportPath.startsWith("@lucern/")) {
6846
+ return {
6847
+ importPath: normalizedImportPath,
6848
+ decision: "forbidden",
6849
+ reason: "This @lucern package is not part of the tenant client public surface."
6850
+ };
6851
+ }
6852
+ if (normalizedImportPath.startsWith("./") || normalizedImportPath.startsWith("../")) {
6853
+ return {
6854
+ importPath: normalizedImportPath,
6855
+ decision: "local",
6856
+ reason: "Local tenant-owned import."
6857
+ };
6858
+ }
6859
+ return {
6860
+ importPath: normalizedImportPath,
6861
+ decision: "external",
6862
+ reason: "External dependency outside the Lucern package namespace."
6863
+ };
6864
+ }
6865
+ function isTenantClientPublicImport(importPath) {
6866
+ return classifyTenantClientImport(importPath).decision === "public";
6867
+ }
6868
+ function isTenantClientComponentConfigImport(importPath) {
6869
+ return TENANT_CLIENT_COMPONENT_CONFIG_IMPORTS.some(
6870
+ (entry) => importPath === entry.importPath
6871
+ );
6872
+ }
6873
+ function isTenantClientAllowedImport(importPath) {
6874
+ return classifyTenantClientImport(importPath).decision === "public";
6875
+ }
6876
+ function assertTenantClientImportAllowed(importPath) {
6877
+ const classification = classifyTenantClientImport(importPath);
6878
+ if (classification.decision !== "forbidden") {
6879
+ return;
6880
+ }
6881
+ throw new Error(formatTenantClientImportViolation(classification));
6882
+ }
6883
+ function formatTenantClientImportViolation(classification) {
6884
+ const patternId = classification.pattern ? ` [${classification.pattern.id}]` : "";
6885
+ return `Tenant client import is not allowed${patternId}: ${classification.importPath}. ${classification.reason}`;
6886
+ }
6887
+
6888
+ // src/infisical-runtime.contract.ts
6889
+ var INFISICAL_RUNTIME_CONTRACT_VERSION = "2026-04-28";
6890
+ var INFISICAL_RUNTIME_DEFAULT_API_URL = "https://app.infisical.com";
6891
+ var INFISICAL_RUNTIME_DEFAULT_PROJECT_ID = "344b0526-90df-4606-ba50-22c647a36c65";
6892
+ var INFISICAL_RUNTIME_ENVIRONMENTS = [
6893
+ "dev",
6894
+ "staging",
6895
+ "prod"
6896
+ ];
6897
+ var INFISICAL_RUNTIME_DELIVERY_MODES = [
6898
+ "vercel_sync",
6899
+ "runtime_fetch",
6900
+ "device_auth"
6901
+ ];
6902
+ var INFISICAL_RUNTIME_SURFACE_IDS = [
6903
+ "lucern-web",
6904
+ "lucern-gateway",
6905
+ "lucern-sdk",
6906
+ "lucern-cli",
6907
+ "lucern-mcp",
6908
+ "tenant-client"
6909
+ ];
6910
+ var INFISICAL_RUNTIME_BOOTSTRAP_ENV = {
6911
+ apiUrl: ["INFISICAL_API_URL", "INFISICAL_URL"],
6912
+ projectId: ["INFISICAL_PROJECT_ID", "INFISICAL_WORKSPACE_ID"],
6913
+ clientId: [
6914
+ "INFISICAL_CLIENT_ID",
6915
+ "INFISICAL_MACHINE_CLIENT_ID",
6916
+ "INFISICAL_UNIVERSAL_AUTH_CLIENT_ID"
6917
+ ],
6918
+ clientSecret: [
6919
+ "INFISICAL_CLIENT_SECRET",
6920
+ "INFISICAL_MACHINE_CLIENT_SECRET",
6921
+ "INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET"
6922
+ ],
6923
+ environment: ["INFISICAL_ENV", "LUCERN_INFISICAL_ENV"],
6924
+ organizationSlug: ["INFISICAL_ORG_SLUG", "INFISICAL_ORGANIZATION_SLUG"],
6925
+ disabled: ["LUCERN_INFISICAL_DISABLE", "INFISICAL_DISABLE"]
6926
+ };
6927
+ var INFISICAL_RUNTIME_PATHS = [
6928
+ {
6929
+ id: "platform-auth",
6930
+ secretPath: "/platform/auth",
6931
+ description: "Lucern platform authentication secrets. Synced into Vercel web/gateway projects; never distributed to tenant tools.",
6932
+ variables: [
6933
+ {
6934
+ name: "NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY",
6935
+ required: true,
6936
+ secret: false,
6937
+ public: true,
6938
+ description: "Clerk publishable key for the Lucern web origin."
6939
+ },
6940
+ {
6941
+ name: "CLERK_SECRET_KEY",
6942
+ required: true,
6943
+ secret: true,
6944
+ public: false,
6945
+ description: "Clerk backend secret key for Lucern server runtimes."
6946
+ },
6947
+ {
6948
+ name: "CLERK_JWT_ISSUER_DOMAIN",
6949
+ required: false,
6950
+ secret: false,
6951
+ public: false,
6952
+ description: "Expected Clerk issuer/JWKS domain for JWT verification."
6953
+ },
6954
+ {
6955
+ name: "NEXT_PUBLIC_CLERK_SIGN_IN_URL",
6956
+ required: false,
6957
+ secret: false,
6958
+ public: true,
6959
+ description: "Public sign-in URL for Lucern-owned web flows."
6960
+ },
6961
+ {
6962
+ name: "NEXT_PUBLIC_CLERK_SIGN_UP_URL",
6963
+ required: false,
6964
+ secret: false,
6965
+ public: true,
6966
+ description: "Public sign-up URL for Lucern-owned web flows."
6967
+ }
6968
+ ]
6969
+ },
6970
+ {
6971
+ id: "platform-runtime",
6972
+ secretPath: "/platform/runtime",
6973
+ description: "Runtime defaults shared by server-side Lucern clients and operator tooling.",
6974
+ variables: [
6975
+ {
6976
+ name: "LUCERN_API_URL",
6977
+ required: true,
6978
+ secret: false,
6979
+ public: false,
6980
+ aliases: ["LUCERN_API_BASE_URL", "LUCERN_BASE_URL"],
6981
+ description: "Canonical Lucern API gateway URL."
6982
+ },
6983
+ {
6984
+ name: "LUCERN_LOGIN_BASE_URL",
6985
+ required: false,
6986
+ secret: false,
6987
+ public: false,
6988
+ aliases: ["LUCERN_AUTH_BASE_URL"],
6989
+ description: "Browser login origin used when it differs from the API."
6990
+ },
6991
+ {
6992
+ name: "LUCERN_ENVIRONMENT",
6993
+ required: false,
6994
+ secret: false,
6995
+ public: false,
6996
+ aliases: ["LUCERN_ENV"],
6997
+ description: "Lucern environment label consumed by CLI profiles."
6998
+ }
6999
+ ]
7000
+ },
7001
+ {
7002
+ id: "tenant-shared-install",
7003
+ secretPath: TENANT_CLIENT_INSTALL_TOKEN_INFISICAL_PATH,
7004
+ description: "Tenant package-install secrets. This is install-only and distinct from platform publish credentials.",
7005
+ variables: [
7006
+ {
7007
+ name: "INSTALL_LUCERN_NPM",
7008
+ required: true,
7009
+ secret: true,
7010
+ public: false,
7011
+ description: "Read-only install token for the published @lucern/* suite."
7012
+ }
7013
+ ]
7014
+ }
7015
+ ];
7016
+ var INFISICAL_RUNTIME_SURFACES = [
7017
+ {
7018
+ id: "lucern-web",
7019
+ delivery: "vercel_sync",
7020
+ sourcePathIds: ["platform-auth", "platform-runtime"],
7021
+ consumer: "apps/web on Vercel project lucern",
7022
+ description: "Lucern web consumes Clerk and runtime config via Infisical-to-Vercel syncs."
7023
+ },
7024
+ {
7025
+ id: "lucern-gateway",
7026
+ delivery: "vercel_sync",
7027
+ sourcePathIds: ["platform-auth", "platform-runtime"],
7028
+ consumer: "apps/gateway on Vercel project lucern-gateway",
7029
+ description: "Lucern gateway consumes platform config via Infisical-to-Vercel syncs."
7030
+ },
7031
+ {
7032
+ id: "lucern-sdk",
7033
+ packageName: "@lucern/sdk",
7034
+ delivery: "runtime_fetch",
7035
+ sourcePathIds: ["platform-runtime"],
7036
+ consumer: "server-side SDK operator contexts with a scoped Infisical identity",
7037
+ description: "SDK exposes the runtime Infisical resolver used by clients that have machine identity credentials."
7038
+ },
7039
+ {
7040
+ id: "lucern-cli",
7041
+ packageName: "@lucern/cli",
7042
+ delivery: "runtime_fetch",
7043
+ fallback: "device_auth",
7044
+ sourcePathIds: ["platform-runtime"],
7045
+ consumer: "developer/operator CLI processes",
7046
+ description: "CLI hydrates runtime defaults from Infisical when configured, then authenticates users through Lucern device login."
7047
+ },
7048
+ {
7049
+ id: "lucern-mcp",
7050
+ packageName: "@lucern/mcp",
7051
+ delivery: "runtime_fetch",
7052
+ fallback: "device_auth",
7053
+ sourcePathIds: ["platform-runtime"],
7054
+ consumer: "MCP server/client processes",
7055
+ description: "MCP hydrates runtime defaults through the SDK resolver and remains a Lucern client, not a platform secret owner."
7056
+ },
7057
+ {
7058
+ id: "tenant-client",
7059
+ delivery: "device_auth",
7060
+ sourcePathIds: ["tenant-shared-install"],
7061
+ consumer: "tenant-owned apps and coding agents",
7062
+ description: "Tenant clients install the published packages and receive user/service credentials through Lucern auth surfaces."
7063
+ }
7064
+ ];
7065
+ function findInfisicalRuntimePath(pathId) {
7066
+ return INFISICAL_RUNTIME_PATHS.find((path) => path.id === pathId);
7067
+ }
7068
+ function findInfisicalRuntimeSurface(surfaceId) {
7069
+ return INFISICAL_RUNTIME_SURFACES.find(
7070
+ (surface) => surface.id === surfaceId
7071
+ );
7072
+ }
7073
+
7074
+ // src/manifests/infisical-runtime-manifest.ts
7075
+ var INFISICAL_RUNTIME_MANIFEST = {
7076
+ manifestVersion: "1.0.0",
7077
+ contractVersion: INFISICAL_RUNTIME_CONTRACT_VERSION,
7078
+ project: {
7079
+ id: INFISICAL_RUNTIME_DEFAULT_PROJECT_ID,
7080
+ apiUrl: INFISICAL_RUNTIME_DEFAULT_API_URL
7081
+ },
7082
+ environments: INFISICAL_RUNTIME_ENVIRONMENTS,
7083
+ deliveryModes: INFISICAL_RUNTIME_DELIVERY_MODES,
7084
+ bootstrapEnv: INFISICAL_RUNTIME_BOOTSTRAP_ENV,
7085
+ paths: INFISICAL_RUNTIME_PATHS,
7086
+ surfaces: INFISICAL_RUNTIME_SURFACES
7087
+ };
7088
+ var InvariantManifestSchema = z.object({
7089
+ manifestVersion: z.literal("1.0.0"),
7090
+ rules: z.array(
7091
+ z.object({
7092
+ invariant: z.string(),
7093
+ description: z.string(),
7094
+ checker: z.enum(["ast", "manifest", "runtime"]),
7095
+ severity: z.enum(["block_publish", "block_pr", "warn"])
7096
+ })
7097
+ )
7098
+ });
7099
+
7100
+ // src/manifests/tenant-client-manifest.ts
7101
+ var TENANT_CLIENT_MANIFEST = {
7102
+ manifestVersion: "1.0.0",
7103
+ contractVersion: TENANT_CLIENT_CONTRACT_VERSION,
7104
+ auth: {
7105
+ modes: TENANT_CLIENT_AUTH_MODES,
7106
+ principalTypes: TENANT_CLIENT_PRINCIPAL_TYPES,
7107
+ requiredContextFields: TENANT_CLIENT_REQUIRED_CONTEXT_FIELDS,
7108
+ optionalContextFields: TENANT_CLIENT_OPTIONAL_CONTEXT_FIELDS
7109
+ },
7110
+ installToken: {
7111
+ env: TENANT_CLIENT_INSTALL_TOKEN_ENV,
7112
+ infisicalPath: TENANT_CLIENT_INSTALL_TOKEN_INFISICAL_PATH,
7113
+ forbiddenInfisicalPaths: TENANT_CLIENT_FORBIDDEN_INSTALL_TOKEN_INFISICAL_PATHS,
7114
+ forbiddenSecretEnv: TENANT_CLIENT_FORBIDDEN_SECRET_ENV
7115
+ },
7116
+ packages: {
7117
+ installable: TENANT_CLIENT_INSTALLABLE_PACKAGES,
7118
+ installProfiles: TENANT_CLIENT_INSTALL_PROFILES,
7119
+ directImports: TENANT_CLIENT_PUBLIC_IMPORTS,
7120
+ componentConfigImports: TENANT_CLIENT_COMPONENT_CONFIG_IMPORTS
7121
+ },
7122
+ sdk: {
7123
+ requiredNamespaces: TENANT_CLIENT_REQUIRED_SDK_NAMESPACES
7124
+ },
7125
+ capabilities: TENANT_CLIENT_CAPABILITIES,
7126
+ isolationRules: TENANT_CLIENT_ISOLATION_RULES,
7127
+ forbiddenImportPatterns: TENANT_CLIENT_FORBIDDEN_IMPORT_PATTERNS
7128
+ };
7129
+
7130
+ // src/projections/projection-dsl.ts
7131
+ function defineProjection(def) {
7132
+ return def;
7133
+ }
7134
+
7135
+ // src/projections/create-evidence.projection.ts
7136
+ var jsonRecordSchema = z.record(z.unknown());
7137
+ var createEvidenceInputSchemaBase = z.object({
7138
+ projectId: z.string().optional(),
7139
+ topicId: z.string().optional(),
7140
+ text: z.string().optional(),
7141
+ canonicalText: z.string().optional(),
7142
+ title: z.string().optional(),
7143
+ content: z.string().optional(),
7144
+ contentType: z.string().optional(),
7145
+ kind: z.string().optional(),
7146
+ tags: z.array(z.string()).optional(),
7147
+ source: z.string().optional(),
7148
+ sourceUrl: z.string().optional(),
7149
+ sourceType: z.string().optional(),
7150
+ externalSourceType: z.string().optional(),
7151
+ sourceQuestionId: z.string().optional(),
7152
+ methodology: z.string().optional(),
7153
+ informationAsymmetry: z.string().optional(),
7154
+ sourceDescription: z.string().optional(),
7155
+ targetId: z.string().optional(),
7156
+ targetNodeId: z.string().optional(),
7157
+ linkedBeliefNodeId: z.string().optional(),
7158
+ evidenceRelation: z.enum(["supports", "contradicts", "neutral"]).optional(),
7159
+ confidence: z.number().optional(),
7160
+ weight: z.number().optional(),
7161
+ reasoning: z.string().optional(),
7162
+ rationale: z.string(),
7163
+ metadata: jsonRecordSchema.optional(),
7164
+ trustedBypassAccessCheck: z.boolean().optional()
7165
+ }).passthrough();
7166
+ var createEvidenceInputSchema = createEvidenceInputSchemaBase.refine(
7167
+ (input) => Boolean(input.text ?? input.canonicalText),
7168
+ {
7169
+ message: "create_evidence requires text",
7170
+ path: ["text"]
7171
+ }
7172
+ );
7173
+ function compactRecord(input) {
5613
7174
  return Object.fromEntries(
5614
7175
  Object.entries(input).filter(([, value]) => value !== void 0)
5615
7176
  );
5616
7177
  }
7178
+ function isRecord(value) {
7179
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
7180
+ }
5617
7181
  function recordValue(value) {
5618
- return value && typeof value === "object" && !Array.isArray(value) ? value : {};
7182
+ return isRecord(value) ? value : {};
5619
7183
  }
5620
7184
  var createEvidenceProjection = defineProjection({
5621
7185
  contractName: "create_evidence",
@@ -5915,8 +7479,12 @@ __export(tool_contracts_exports, {
5915
7479
  APPLY_LENS_TO_TOPIC: () => APPLY_LENS_TO_TOPIC,
5916
7480
  APPLY_ONTOLOGY: () => APPLY_ONTOLOGY,
5917
7481
  ARCHIVE_BELIEF: () => ARCHIVE_BELIEF,
7482
+ ARCHIVE_EPISTEMIC_NODE: () => ARCHIVE_EPISTEMIC_NODE,
5918
7483
  ARCHIVE_ONTOLOGY: () => ARCHIVE_ONTOLOGY,
5919
7484
  ARCHIVE_QUESTION: () => ARCHIVE_QUESTION,
7485
+ BATCH_CREATE_EDGES: () => BATCH_CREATE_EDGES,
7486
+ BATCH_CREATE_EPISTEMIC_NODES: () => BATCH_CREATE_EPISTEMIC_NODES,
7487
+ BEGIN_BUILD_SESSION: () => BEGIN_BUILD_SESSION,
5920
7488
  BISECT_CONFIDENCE: () => BISECT_CONFIDENCE,
5921
7489
  BROADCAST_MESSAGE: () => BROADCAST_MESSAGE,
5922
7490
  CHECK_PERMISSION: () => CHECK_PERMISSION,
@@ -5927,6 +7495,7 @@ __export(tool_contracts_exports, {
5927
7495
  CREATE_BELIEF: () => CREATE_BELIEF,
5928
7496
  CREATE_EDGE: () => CREATE_EDGE,
5929
7497
  CREATE_EPISTEMIC_CONTRACT: () => CREATE_EPISTEMIC_CONTRACT,
7498
+ CREATE_EPISTEMIC_NODE: () => CREATE_EPISTEMIC_NODE,
5930
7499
  CREATE_EVIDENCE: () => CREATE_EVIDENCE,
5931
7500
  CREATE_LENS: () => CREATE_LENS,
5932
7501
  CREATE_ONTOLOGY: () => CREATE_ONTOLOGY,
@@ -5954,6 +7523,7 @@ __export(tool_contracts_exports, {
5954
7523
  GET_CODE_CONTEXT: () => GET_CODE_CONTEXT,
5955
7524
  GET_CONFIDENCE_HISTORY: () => GET_CONFIDENCE_HISTORY,
5956
7525
  GET_CONTRACT_STATUS: () => GET_CONTRACT_STATUS,
7526
+ GET_EPISTEMIC_NODE: () => GET_EPISTEMIC_NODE,
5957
7527
  GET_EVIDENCE: () => GET_EVIDENCE,
5958
7528
  GET_FAILURE_LOG: () => GET_FAILURE_LOG,
5959
7529
  GET_FALSIFICATION_QUESTIONS: () => GET_FALSIFICATION_QUESTIONS,
@@ -5967,6 +7537,7 @@ __export(tool_contracts_exports, {
5967
7537
  GET_QUESTION: () => GET_QUESTION,
5968
7538
  GET_TOPIC: () => GET_TOPIC,
5969
7539
  GET_TOPIC_COVERAGE: () => GET_TOPIC_COVERAGE,
7540
+ GET_TOPIC_GRAPH_SPINE: () => GET_TOPIC_GRAPH_SPINE,
5970
7541
  GET_TOPIC_TREE: () => GET_TOPIC_TREE,
5971
7542
  GIT_SEMANTIC_REQUIRED_TOOLS: () => GIT_SEMANTIC_REQUIRED_TOOLS,
5972
7543
  HEARTBEAT_SESSION: () => HEARTBEAT_SESSION,
@@ -5979,7 +7550,9 @@ __export(tool_contracts_exports, {
5979
7550
  LIST_ALL_WORKTREES: () => LIST_ALL_WORKTREES,
5980
7551
  LIST_BELIEFS: () => LIST_BELIEFS,
5981
7552
  LIST_CAMPAIGNS: () => LIST_CAMPAIGNS,
7553
+ LIST_EPISTEMIC_NODES: () => LIST_EPISTEMIC_NODES,
5982
7554
  LIST_EVIDENCE: () => LIST_EVIDENCE,
7555
+ LIST_GRAPH_INTELLIGENCE_QUERIES: () => LIST_GRAPH_INTELLIGENCE_QUERIES,
5983
7556
  LIST_LENSES: () => LIST_LENSES,
5984
7557
  LIST_ONTOLOGIES: () => LIST_ONTOLOGIES,
5985
7558
  LIST_QUESTIONS: () => LIST_QUESTIONS,
@@ -5988,6 +7561,7 @@ __export(tool_contracts_exports, {
5988
7561
  LIST_WORKTREES: () => LIST_WORKTREES,
5989
7562
  MANAGE_WRITE_POLICY: () => MANAGE_WRITE_POLICY,
5990
7563
  MATCH_ENTITY_TYPE: () => MATCH_ENTITY_TYPE,
7564
+ MATERIALIZE_TOPIC_GRAPH: () => MATERIALIZE_TOPIC_GRAPH,
5991
7565
  MCP_TOOL_CONTRACTS: () => MCP_TOOL_CONTRACTS,
5992
7566
  MERGE: () => MERGE,
5993
7567
  MODULATE_CONFIDENCE: () => MODULATE_CONFIDENCE,
@@ -6002,21 +7576,28 @@ __export(tool_contracts_exports, {
6002
7576
  REFINE_BELIEF: () => REFINE_BELIEF,
6003
7577
  REFINE_QUESTION: () => REFINE_QUESTION,
6004
7578
  REGISTER_SESSION: () => REGISTER_SESSION,
7579
+ REMOVE_EDGE: () => REMOVE_EDGE,
7580
+ REMOVE_EDGES_BETWEEN: () => REMOVE_EDGES_BETWEEN,
6005
7581
  REMOVE_LENS_FROM_TOPIC: () => REMOVE_LENS_FROM_TOPIC,
6006
7582
  RESOLVE_EFFECTIVE_ONTOLOGY: () => RESOLVE_EFFECTIVE_ONTOLOGY,
7583
+ RUN_GRAPH_INTELLIGENCE_QUERY: () => RUN_GRAPH_INTELLIGENCE_QUERY,
6007
7584
  SEARCH_BELIEFS: () => SEARCH_BELIEFS,
6008
7585
  SEARCH_EVIDENCE: () => SEARCH_EVIDENCE,
6009
7586
  SEED_BELIEF_LATTICE: () => SEED_BELIEF_LATTICE,
6010
7587
  SEND_AGENT_MESSAGE: () => SEND_AGENT_MESSAGE,
7588
+ SUPERSEDE_EPISTEMIC_NODE: () => SUPERSEDE_EPISTEMIC_NODE,
6011
7589
  TRACE_ENTITY_IMPACT: () => TRACE_ENTITY_IMPACT,
6012
7590
  TRAVERSE_GRAPH: () => TRAVERSE_GRAPH,
6013
7591
  TRIGGER_BELIEF_REVIEW: () => TRIGGER_BELIEF_REVIEW,
7592
+ UPDATE_EDGE: () => UPDATE_EDGE,
7593
+ UPDATE_EPISTEMIC_NODE: () => UPDATE_EPISTEMIC_NODE,
6014
7594
  UPDATE_ONTOLOGY: () => UPDATE_ONTOLOGY,
6015
7595
  UPDATE_QUESTION_STATUS: () => UPDATE_QUESTION_STATUS,
6016
7596
  UPDATE_TASK: () => UPDATE_TASK,
6017
7597
  UPDATE_TOPIC: () => UPDATE_TOPIC,
6018
7598
  UPDATE_WORKTREE_METADATA: () => UPDATE_WORKTREE_METADATA,
6019
7599
  UPDATE_WORKTREE_TARGETS: () => UPDATE_WORKTREE_TARGETS,
7600
+ VERIFY_EPISTEMIC_NODE: () => VERIFY_EPISTEMIC_NODE,
6020
7601
  validateGitSemantics: () => validateGitSemantics
6021
7602
  });
6022
7603
 
@@ -6440,7 +8021,22 @@ var ADD_WORKTREE = {
6440
8021
  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.",
6441
8022
  parameters: {
6442
8023
  title: { type: "string", description: "Worktree name/objective" },
6443
- topicId: { type: "string", description: "Optional topic scope hint" },
8024
+ name: {
8025
+ type: "string",
8026
+ description: "Optional storage-name alias for callers that already use backend naming"
8027
+ },
8028
+ projectId: {
8029
+ type: "string",
8030
+ description: "Legacy topicId alias or resolver hint"
8031
+ },
8032
+ topicId: {
8033
+ type: "string",
8034
+ description: "Optional topic scope hint for resolver validation"
8035
+ },
8036
+ topicHint: {
8037
+ type: "string",
8038
+ description: "Natural-language topic hint for automatic topic resolution"
8039
+ },
6444
8040
  branchId: {
6445
8041
  type: "string",
6446
8042
  description: "The branch this worktree investigates"
@@ -6453,17 +8049,106 @@ var ADD_WORKTREE = {
6453
8049
  type: "string",
6454
8050
  description: "The testable claim this worktree investigates"
6455
8051
  },
8052
+ rationale: {
8053
+ type: "string",
8054
+ description: "Why this worktree exists and why it belongs in the campaign"
8055
+ },
8056
+ worktreeType: {
8057
+ type: "string",
8058
+ description: "Schema-enum worktree type used by the kernel lifecycle and retrieval layers"
8059
+ },
8060
+ gate: {
8061
+ type: "string",
8062
+ description: "Exit gate name for this worktree"
8063
+ },
8064
+ startDate: {
8065
+ type: "number",
8066
+ description: "Planned start timestamp in milliseconds since epoch"
8067
+ },
8068
+ endDate: {
8069
+ type: "number",
8070
+ description: "Planned end timestamp in milliseconds since epoch"
8071
+ },
8072
+ durationWeeks: {
8073
+ type: "number",
8074
+ description: "Planned duration in weeks"
8075
+ },
8076
+ confidenceImpact: {
8077
+ type: "string",
8078
+ description: "Expected confidence impact if the worktree succeeds",
8079
+ enum: ["high", "medium", "low"]
8080
+ },
8081
+ beliefFocus: {
8082
+ type: "string",
8083
+ description: "Natural-language focus spanning the target belief neighborhood"
8084
+ },
6456
8085
  beliefIds: {
6457
8086
  type: "array",
6458
- description: "Beliefs to test in this worktree"
8087
+ description: "Legacy alias for targetBeliefIds"
8088
+ },
8089
+ beliefs: {
8090
+ type: "array",
8091
+ description: "Legacy alias for targetBeliefIds"
8092
+ },
8093
+ targetBeliefIds: {
8094
+ type: "array",
8095
+ description: "Belief node IDs this worktree is expected to test or update"
8096
+ },
8097
+ targetQuestionIds: {
8098
+ type: "array",
8099
+ description: "Question node IDs this worktree is expected to answer"
8100
+ },
8101
+ keyQuestions: {
8102
+ type: "array",
8103
+ description: "Inline key question objects with question, optional status, answer, answerConfidence, and linkedQuestionId"
8104
+ },
8105
+ evidenceSignals: {
8106
+ type: "array",
8107
+ description: "Evidence signal objects with signal, optional collected state, progress, and notes"
8108
+ },
8109
+ decisionGate: {
8110
+ type: "object",
8111
+ description: "Decision gate object with goCriteria, noGoSignals, optional verdict, rationale, decidedAt, and decidedBy"
8112
+ },
8113
+ goCriteria: {
8114
+ type: "array",
8115
+ description: "Shorthand go criteria used to build decisionGate"
8116
+ },
8117
+ noGoSignals: {
8118
+ type: "array",
8119
+ description: "Shorthand no-go signals used to build decisionGate"
8120
+ },
8121
+ proofArtifacts: {
8122
+ type: "array",
8123
+ description: "Expected proof artifacts required to close the worktree"
8124
+ },
8125
+ autoShape: {
8126
+ type: "boolean",
8127
+ description: "Whether to invoke inquiry auto-shaping during worktree creation"
8128
+ },
8129
+ autoFixPolicy: {
8130
+ type: "object",
8131
+ description: "Policy for permitted automatic remediation inside the worktree"
8132
+ },
8133
+ domainPackId: {
8134
+ type: "string",
8135
+ description: "Optional domain pack whose shaping hooks should influence generated questions and tasks"
8136
+ },
8137
+ tags: {
8138
+ type: "array",
8139
+ description: "Additional topic-resolution tags for the worktree"
8140
+ },
8141
+ touchedPaths: {
8142
+ type: "array",
8143
+ description: "File paths used as topic-resolution signals"
6459
8144
  },
6460
- autoShape: {
6461
- type: "boolean",
6462
- description: "Whether to invoke inquiry auto-shaping during worktree creation"
8145
+ sourceRef: {
8146
+ type: "string",
8147
+ description: "Source reference used as a topic-resolution signal"
6463
8148
  },
6464
- domainPackId: {
8149
+ sourceKind: {
6465
8150
  type: "string",
6466
- description: "Optional domain pack whose shaping hooks should influence generated questions and tasks"
8151
+ description: "Source kind used as a topic-resolution signal"
6467
8152
  },
6468
8153
  campaign: {
6469
8154
  type: "number",
@@ -6489,12 +8174,20 @@ var ADD_WORKTREE = {
6489
8174
  type: "array",
6490
8175
  description: "Worktree IDs blocked by this worktree"
6491
8176
  },
6492
- gate: {
8177
+ staffingHint: {
6493
8178
  type: "string",
6494
- description: "Exit gate name for this worktree"
8179
+ description: "Suggested staffing or agent allocation note"
8180
+ },
8181
+ lensId: {
8182
+ type: "string",
8183
+ description: "Lens that scopes this worktree when applicable"
8184
+ },
8185
+ lastReconciledAt: {
8186
+ type: "number",
8187
+ description: "Timestamp when worktree metadata was last reconciled"
6495
8188
  }
6496
8189
  },
6497
- required: ["title", "topicId"],
8190
+ required: ["title"],
6498
8191
  response: {
6499
8192
  description: "The created worktree",
6500
8193
  fields: {
@@ -6521,7 +8214,7 @@ var MERGE = {
6521
8214
  worktreeId: { type: "string", description: "The worktree to merge" },
6522
8215
  outcomes: {
6523
8216
  type: "array",
6524
- description: "Scoring outcomes for each belief: { beliefId, confidence, rationale }"
8217
+ description: "Merge outcomes as key-finding strings, or scoring outcomes for beliefs: { beliefId, confidence, rationale }"
6525
8218
  },
6526
8219
  summary: { type: "string", description: "Overall findings summary" }
6527
8220
  },
@@ -6739,19 +8432,23 @@ var FIND_CONTRADICTIONS = {
6739
8432
  };
6740
8433
  var CREATE_EDGE = {
6741
8434
  name: "create_edge",
6742
- 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).",
8435
+ 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.",
6743
8436
  parameters: {
6744
- sourceId: {
6745
- type: "string",
6746
- description: "Source node of the relationship"
8437
+ from: {
8438
+ type: "object",
8439
+ description: "Source graph ref, e.g. { kind: 'epistemic_node', nodeId: '...', nodeType: 'topic' }"
6747
8440
  },
6748
- targetId: {
6749
- type: "string",
6750
- description: "Target node of the relationship"
8441
+ to: {
8442
+ type: "object",
8443
+ description: "Target graph ref, e.g. { kind: 'epistemic_node', nodeId: '...', nodeType: 'belief' }"
6751
8444
  },
6752
8445
  edgeType: {
6753
8446
  type: "string",
6754
- description: "Relationship type (informs, tests, depends_on, supersedes, etc.)"
8447
+ description: "Relationship type from the public epistemic edge enum."
8448
+ },
8449
+ globalId: {
8450
+ type: "string",
8451
+ description: "Optional idempotent edge global ID."
6755
8452
  },
6756
8453
  weight: {
6757
8454
  type: "number",
@@ -6762,9 +8459,13 @@ var CREATE_EDGE = {
6762
8459
  type: "string",
6763
8460
  description: "How this was determined",
6764
8461
  enum: ["deductive", "inductive", "abductive", "analogical", "empirical"]
8462
+ },
8463
+ metadata: {
8464
+ type: "object",
8465
+ description: "Optional edge metadata."
6765
8466
  }
6766
8467
  },
6767
- required: ["sourceId", "targetId", "edgeType"],
8468
+ required: ["from", "to", "edgeType"],
6768
8469
  response: {
6769
8470
  description: "The created edge",
6770
8471
  fields: {
@@ -6778,6 +8479,240 @@ var CREATE_EDGE = {
6778
8479
  ontologyPrimitive: "edge",
6779
8480
  tier: "showcase"
6780
8481
  };
8482
+ var UPDATE_EDGE = {
8483
+ name: "update_edge",
8484
+ description: "Amend metadata on an existing graph edge. Like `git commit --amend` \u2014 changes the edge annotation without recreating the relationship.",
8485
+ parameters: {
8486
+ edgeId: { type: "string", description: "Edge ID or global ID to update" },
8487
+ weight: { type: "number", description: "Updated edge weight" },
8488
+ confidence: { type: "number", description: "Updated confidence" },
8489
+ context: { type: "string", description: "Updated human-readable context" },
8490
+ derivationType: { type: "string", description: "Updated derivation type" },
8491
+ metadata: { type: "object", description: "Updated metadata" }
8492
+ },
8493
+ required: ["edgeId"],
8494
+ response: {
8495
+ description: "Edge update result",
8496
+ fields: { success: "boolean" }
8497
+ },
8498
+ ownerModule: "graph-primitives",
8499
+ ontologyPrimitive: "edge",
8500
+ tier: "workhorse"
8501
+ };
8502
+ var REMOVE_EDGE = {
8503
+ name: "remove_edge",
8504
+ description: "Remove one graph edge by ID. Like `git rm` \u2014 deletes a single explicit relationship from the spine.",
8505
+ parameters: {
8506
+ edgeId: { type: "string", description: "Edge ID or global ID to remove" }
8507
+ },
8508
+ required: ["edgeId"],
8509
+ response: {
8510
+ description: "Edge removal result",
8511
+ fields: { success: "boolean" }
8512
+ },
8513
+ ownerModule: "graph-primitives",
8514
+ ontologyPrimitive: "edge",
8515
+ tier: "workhorse"
8516
+ };
8517
+ var REMOVE_EDGES_BETWEEN = {
8518
+ name: "remove_edges_between",
8519
+ description: "Remove graph edges between two nodes. Like `git rm <pathspec>` \u2014 deletes relationships matching a source, target, and optional type.",
8520
+ parameters: {
8521
+ fromNodeId: { type: "string", description: "Source node ID or global ID" },
8522
+ toNodeId: { type: "string", description: "Target node ID or global ID" },
8523
+ edgeType: { type: "string", description: "Optional edge type filter" }
8524
+ },
8525
+ required: ["fromNodeId", "toNodeId"],
8526
+ response: {
8527
+ description: "Matched edge removal result",
8528
+ fields: { deleted: "number" }
8529
+ },
8530
+ ownerModule: "graph-primitives",
8531
+ ontologyPrimitive: "edge",
8532
+ tier: "workhorse"
8533
+ };
8534
+ var BATCH_CREATE_EDGES = {
8535
+ name: "batch_create_edges",
8536
+ description: "Commit multiple typed graph edges. Like `git commit` with many staged paths \u2014 writes a batch of explicit relationships atomically per edge.",
8537
+ parameters: {
8538
+ edges: {
8539
+ type: "array",
8540
+ description: "Edges to create, each with from, to, edgeType, and optional weight/confidence/context."
8541
+ },
8542
+ skipLayerValidation: {
8543
+ type: "boolean",
8544
+ description: "Skip kernel layer validation for trusted materialization flows."
8545
+ }
8546
+ },
8547
+ required: ["edges"],
8548
+ response: {
8549
+ description: "Batch edge creation result",
8550
+ fields: {
8551
+ created: "number",
8552
+ results: "array",
8553
+ errors: "array"
8554
+ }
8555
+ },
8556
+ ownerModule: "graph-primitives",
8557
+ ontologyPrimitive: "edge",
8558
+ tier: "workhorse"
8559
+ };
8560
+ var CREATE_EPISTEMIC_NODE = {
8561
+ name: "create_epistemic_node",
8562
+ 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.",
8563
+ parameters: {
8564
+ globalId: { type: "string", description: "Optional idempotent node global ID" },
8565
+ nodeType: { type: "string", description: "Public epistemic node type" },
8566
+ canonicalText: { type: "string", description: "Canonical node text" },
8567
+ text: { type: "string", description: "Alias for canonicalText" },
8568
+ contentHash: { type: "string", description: "Optional idempotency content hash" },
8569
+ sourceType: { type: "string", description: "Source type for provenance" },
8570
+ topicId: { type: "string", description: "Optional topic scope" },
8571
+ content: { type: "string", description: "Extended content" },
8572
+ title: { type: "string", description: "Display title" },
8573
+ metadata: { type: "object", description: "Optional node metadata" }
8574
+ },
8575
+ required: ["nodeType"],
8576
+ response: {
8577
+ description: "Created node result",
8578
+ fields: {
8579
+ nodeId: "string",
8580
+ nodeGlobalId: "string",
8581
+ isDuplicate: "boolean"
8582
+ }
8583
+ },
8584
+ ownerModule: "reasoning-kernel",
8585
+ ontologyPrimitive: "graph",
8586
+ tier: "showcase"
8587
+ };
8588
+ var GET_EPISTEMIC_NODE = {
8589
+ name: "get_epistemic_node",
8590
+ description: "Read one epistemic graph node. Like `git show` \u2014 resolves a canonical spine node by ID or global ID.",
8591
+ parameters: {
8592
+ nodeId: { type: "string", description: "Node ID or global ID" }
8593
+ },
8594
+ required: ["nodeId"],
8595
+ response: {
8596
+ description: "The resolved node",
8597
+ fields: { node: "object" }
8598
+ },
8599
+ ownerModule: "reasoning-kernel",
8600
+ ontologyPrimitive: "graph",
8601
+ tier: "workhorse"
8602
+ };
8603
+ var LIST_EPISTEMIC_NODES = {
8604
+ name: "list_epistemic_nodes",
8605
+ description: "List epistemic graph nodes. Like `git ls-tree` \u2014 lists canonical spine nodes by topic, type, status, or search query.",
8606
+ parameters: {
8607
+ topicId: { type: "string", description: "Optional topic scope" },
8608
+ nodeType: { type: "string", description: "Optional node type filter" },
8609
+ status: { type: "string", description: "Optional lifecycle status" },
8610
+ searchQuery: { type: "string", description: "Optional text search query" },
8611
+ limit: { type: "number", description: "Maximum nodes to return" }
8612
+ },
8613
+ required: [],
8614
+ response: {
8615
+ description: "Matching nodes",
8616
+ fields: { nodes: "array" }
8617
+ },
8618
+ ownerModule: "reasoning-kernel",
8619
+ ontologyPrimitive: "graph",
8620
+ tier: "workhorse"
8621
+ };
8622
+ var UPDATE_EPISTEMIC_NODE = {
8623
+ name: "update_epistemic_node",
8624
+ description: "Amend an epistemic graph node. Like `git commit --amend` \u2014 updates mutable node metadata, text, status, or verification fields.",
8625
+ parameters: {
8626
+ nodeId: { type: "string", description: "Node ID or global ID" },
8627
+ canonicalText: { type: "string", description: "Updated canonical text" },
8628
+ text: { type: "string", description: "Alias for canonicalText" },
8629
+ contentHash: { type: "string", description: "Updated content hash" },
8630
+ content: { type: "string", description: "Updated content" },
8631
+ title: { type: "string", description: "Updated display title" },
8632
+ metadata: { type: "object", description: "Updated metadata" },
8633
+ confidence: { type: "number", description: "Updated confidence" },
8634
+ verificationStatus: { type: "string", description: "Updated verification status" },
8635
+ status: { type: "string", description: "Updated lifecycle status" }
8636
+ },
8637
+ required: ["nodeId"],
8638
+ response: {
8639
+ description: "Node update result",
8640
+ fields: { success: "boolean" }
8641
+ },
8642
+ ownerModule: "reasoning-kernel",
8643
+ ontologyPrimitive: "graph",
8644
+ tier: "workhorse"
8645
+ };
8646
+ var ARCHIVE_EPISTEMIC_NODE = {
8647
+ name: "archive_epistemic_node",
8648
+ description: "Archive an epistemic graph node. Like `git rm --cached` \u2014 removes a node from active traversal without hard-deleting it.",
8649
+ parameters: {
8650
+ nodeId: { type: "string", description: "Node ID or global ID" }
8651
+ },
8652
+ required: ["nodeId"],
8653
+ response: {
8654
+ description: "Archive result",
8655
+ fields: { success: "boolean", effectiveStatus: "string" }
8656
+ },
8657
+ ownerModule: "reasoning-kernel",
8658
+ ontologyPrimitive: "graph",
8659
+ tier: "workhorse"
8660
+ };
8661
+ var VERIFY_EPISTEMIC_NODE = {
8662
+ name: "verify_epistemic_node",
8663
+ description: "Record verification state on an epistemic graph node. Like `git tag` \u2014 marks the node with a reviewed verification state.",
8664
+ parameters: {
8665
+ nodeId: { type: "string", description: "Node ID or global ID" },
8666
+ verificationStatus: { type: "string", description: "Verification status" },
8667
+ confidence: { type: "number", description: "Optional confidence update" }
8668
+ },
8669
+ required: ["nodeId", "verificationStatus"],
8670
+ response: {
8671
+ description: "Verification result",
8672
+ fields: { success: "boolean" }
8673
+ },
8674
+ ownerModule: "reasoning-kernel",
8675
+ ontologyPrimitive: "graph",
8676
+ tier: "workhorse"
8677
+ };
8678
+ var SUPERSEDE_EPISTEMIC_NODE = {
8679
+ name: "supersede_epistemic_node",
8680
+ 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.",
8681
+ parameters: {
8682
+ oldNodeId: { type: "string", description: "Node ID or global ID to supersede" },
8683
+ newGlobalId: { type: "string", description: "Optional replacement global ID" },
8684
+ newCanonicalText: { type: "string", description: "Replacement canonical text" },
8685
+ text: { type: "string", description: "Alias for newCanonicalText" },
8686
+ newContentHash: { type: "string", description: "Optional replacement content hash" },
8687
+ reason: { type: "string", description: "Reason for superseding" }
8688
+ },
8689
+ required: ["oldNodeId"],
8690
+ response: {
8691
+ description: "Supersede result",
8692
+ fields: { oldNodeId: "string", newNodeId: "string" }
8693
+ },
8694
+ ownerModule: "reasoning-kernel",
8695
+ ontologyPrimitive: "graph",
8696
+ tier: "workhorse"
8697
+ };
8698
+ var BATCH_CREATE_EPISTEMIC_NODES = {
8699
+ name: "batch_create_epistemic_nodes",
8700
+ description: "Commit multiple epistemic graph nodes. Like `git commit` with many staged files \u2014 writes a batch of canonical spine nodes.",
8701
+ parameters: {
8702
+ nodes: {
8703
+ type: "array",
8704
+ description: "Nodes to create with nodeType, canonicalText/text, and optional metadata."
8705
+ }
8706
+ },
8707
+ required: ["nodes"],
8708
+ response: {
8709
+ description: "Batch node creation result",
8710
+ fields: { created: "number", results: "array" }
8711
+ },
8712
+ ownerModule: "reasoning-kernel",
8713
+ ontologyPrimitive: "graph",
8714
+ tier: "workhorse"
8715
+ };
6781
8716
  var RECORD_JUDGMENT = {
6782
8717
  name: "record_judgment",
6783
8718
  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).",
@@ -7075,6 +9010,74 @@ var GET_GRAPH_STRUCTURE_ANALYSIS = {
7075
9010
  ontologyPrimitive: "graph",
7076
9011
  tier: "showcase"
7077
9012
  };
9013
+ var LIST_GRAPH_INTELLIGENCE_QUERIES = {
9014
+ name: "list_graph_intelligence_queries",
9015
+ 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.",
9016
+ parameters: {
9017
+ categoryId: {
9018
+ type: "string",
9019
+ description: "Optional category filter, such as problems or strategic"
9020
+ },
9021
+ mode: {
9022
+ type: "string",
9023
+ description: "Optional mode filter: core, bias, stress, operational, alpha, semantic, or evidence"
9024
+ }
9025
+ },
9026
+ required: [],
9027
+ response: {
9028
+ description: "Graph Intelligence query catalog and mode-to-tool mapping",
9029
+ fields: {
9030
+ categories: "array \u2014 query categories",
9031
+ queries: "array \u2014 query definitions with prompt templates and tools",
9032
+ quickQueries: "array \u2014 recommended one-click query presets",
9033
+ publicToolNamesByMode: "object \u2014 public tool names available to each Graph Intelligence mode"
9034
+ }
9035
+ },
9036
+ ownerModule: "graph-intelligence",
9037
+ ontologyPrimitive: "graph",
9038
+ tier: "showcase"
9039
+ };
9040
+ var RUN_GRAPH_INTELLIGENCE_QUERY = {
9041
+ name: "run_graph_intelligence_query",
9042
+ 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.",
9043
+ parameters: {
9044
+ topicId: { type: "string", description: "Topic to analyze" },
9045
+ queryId: {
9046
+ type: "string",
9047
+ description: "Graph Intelligence query ID, such as confirmation-bias, pre-mortem, or thesis-summary"
9048
+ },
9049
+ prompt: {
9050
+ type: "string",
9051
+ description: "Optional custom prompt for custom analysis runs"
9052
+ },
9053
+ input: {
9054
+ type: "string",
9055
+ description: "Optional entity, theme, belief, company, or search text for input-driven queries"
9056
+ },
9057
+ mode: {
9058
+ type: "string",
9059
+ description: "Optional mode override: core, bias, stress, operational, alpha, semantic, or evidence"
9060
+ },
9061
+ limit: {
9062
+ type: "number",
9063
+ description: "Maximum graph context rows to return"
9064
+ }
9065
+ },
9066
+ required: ["topicId"],
9067
+ response: {
9068
+ description: "Graph Intelligence query result bundle ready for model or prompt-library synthesis",
9069
+ fields: {
9070
+ query: "object \u2014 selected query definition",
9071
+ prompt: "string \u2014 resolved prompt template",
9072
+ toolPlan: "array \u2014 public tools and args the model can call next",
9073
+ analysis: "object \u2014 structure, coverage, gap, and confirmation-bias analysis",
9074
+ context: "object \u2014 sampled beliefs, questions, evidence, edges, and contradictions"
9075
+ }
9076
+ },
9077
+ ownerModule: "graph-intelligence",
9078
+ ontologyPrimitive: "graph",
9079
+ tier: "showcase"
9080
+ };
7078
9081
  var GET_FALSIFICATION_QUESTIONS = {
7079
9082
  name: "get_falsification_questions",
7080
9083
  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.",
@@ -7923,15 +9926,15 @@ var IDENTITY_WHOAMI = {
7923
9926
  };
7924
9927
  var COMPILE_CONTEXT = {
7925
9928
  name: "compile_context",
7926
- 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.",
9929
+ 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.",
7927
9930
  parameters: {
7928
9931
  topicId: {
7929
9932
  type: "string",
7930
- description: "Topic scope ID to compile"
9933
+ description: "Optional topic scope ID. Omit to resolve the topic from query."
7931
9934
  },
7932
9935
  query: {
7933
9936
  type: "string",
7934
- description: "Optional focus query used to rank context items"
9937
+ description: "Focus query used to resolve the topic and rank context items. Required when topicId is omitted."
7935
9938
  },
7936
9939
  budget: {
7937
9940
  type: "number",
@@ -7955,7 +9958,7 @@ var COMPILE_CONTEXT = {
7955
9958
  description: "Include related ontological entities in the compiled result"
7956
9959
  }
7957
9960
  },
7958
- required: ["topicId"],
9961
+ required: [],
7959
9962
  response: {
7960
9963
  description: "Compiled context pack for the requested topic",
7961
9964
  fields: {
@@ -8129,18 +10132,60 @@ var CREATE_TASK = {
8129
10132
  name: "create_task",
8130
10133
  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.",
8131
10134
  parameters: {
8132
- title: { type: "string", description: "Task description" },
10135
+ title: { type: "string", description: "Task title" },
8133
10136
  topicId: { type: "string", description: "Topic scope" },
10137
+ description: {
10138
+ type: "string",
10139
+ description: "Long-form task description"
10140
+ },
8134
10141
  taskType: {
8135
10142
  type: "string",
8136
- description: "Type: research, interview, analysis, data_collection",
8137
- enum: ["research", "interview", "analysis", "data_collection"]
10143
+ description: "Task taxonomy",
10144
+ enum: [
10145
+ "general",
10146
+ "find_evidence",
10147
+ "verify_claim",
10148
+ "research",
10149
+ "review",
10150
+ "interview",
10151
+ "analysis",
10152
+ "track_metrics"
10153
+ ]
10154
+ },
10155
+ priority: {
10156
+ type: "string",
10157
+ description: "Priority",
10158
+ enum: ["urgent", "high", "medium", "low"]
10159
+ },
10160
+ status: {
10161
+ type: "string",
10162
+ description: "Initial status (defaults to todo)",
10163
+ enum: ["todo", "in_progress", "blocked", "done"]
10164
+ },
10165
+ linkedWorktreeId: {
10166
+ type: "string",
10167
+ description: "Worktree this task belongs to"
10168
+ },
10169
+ linkedBeliefId: {
10170
+ type: "string",
10171
+ description: "Belief this task supports"
8138
10172
  },
8139
10173
  linkedQuestionId: {
8140
10174
  type: "string",
8141
10175
  description: "Question this task addresses"
8142
10176
  },
8143
- linkedWorktreeId: { type: "string", description: "Worktree scope" }
10177
+ assigneeId: {
10178
+ type: "string",
10179
+ description: "Principal assigned to the task"
10180
+ },
10181
+ dueDate: {
10182
+ type: "number",
10183
+ description: "Due date as epoch milliseconds"
10184
+ },
10185
+ tags: {
10186
+ type: "array",
10187
+ description: "Free-form string tags"
10188
+ }
8144
10189
  },
8145
10190
  required: ["title"],
8146
10191
  response: {
@@ -8260,6 +10305,10 @@ var CREATE_TOPIC = {
8260
10305
  name: "create_topic",
8261
10306
  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.",
8262
10307
  parameters: {
10308
+ globalId: {
10309
+ type: "string",
10310
+ description: "Optional idempotent topic global ID"
10311
+ },
8263
10312
  name: { type: "string", description: "Topic name" },
8264
10313
  type: {
8265
10314
  type: "string",
@@ -8270,6 +10319,18 @@ var CREATE_TOPIC = {
8270
10319
  type: "string",
8271
10320
  description: "Optional parent topic for nesting"
8272
10321
  },
10322
+ parentTopicGlobalId: {
10323
+ type: "string",
10324
+ description: "Optional parent topic global ID for nesting"
10325
+ },
10326
+ tenantId: { type: "string", description: "Optional tenant scope" },
10327
+ workspaceId: { type: "string", description: "Optional workspace scope" },
10328
+ visibility: {
10329
+ type: "string",
10330
+ description: "Topic visibility",
10331
+ enum: ["private", "team", "firm", "external", "public"]
10332
+ },
10333
+ metadata: { type: "object", description: "Optional topic metadata" },
8273
10334
  createdBy: { type: "string", description: "Who created this topic" }
8274
10335
  },
8275
10336
  required: ["name", "type"],
@@ -8278,6 +10339,9 @@ var CREATE_TOPIC = {
8278
10339
  fields: {
8279
10340
  id: "string \u2014 topic ID",
8280
10341
  globalId: "string \u2014 globally unique ID",
10342
+ topicGlobalId: "string \u2014 topic global ID",
10343
+ epistemicNodeId: "string \u2014 materialized topic node ID",
10344
+ epistemicNodeGlobalId: "string \u2014 materialized topic node global ID",
8281
10345
  depth: "number \u2014 nesting depth"
8282
10346
  }
8283
10347
  },
@@ -8377,32 +10441,91 @@ var UPDATE_TOPIC = {
8377
10441
  },
8378
10442
  required: [],
8379
10443
  response: {
8380
- description: "The updated topic",
10444
+ description: "The updated topic",
10445
+ fields: {
10446
+ id: "string \u2014 topic ID",
10447
+ globalId: "string \u2014 globally unique ID",
10448
+ status: "string \u2014 topic lifecycle status",
10449
+ visibility: "string \u2014 topic visibility"
10450
+ }
10451
+ },
10452
+ ownerModule: "reasoning-kernel",
10453
+ ontologyPrimitive: "graph",
10454
+ tier: "workhorse"
10455
+ };
10456
+ var GET_TOPIC_TREE = {
10457
+ name: "get_topic_tree",
10458
+ description: "Get the full topic hierarchy from a root. Like `git log --graph --all` \u2014 shows the complete tree of nested topics.",
10459
+ parameters: {
10460
+ rootId: { type: "string", description: "Root topic to start from" },
10461
+ maxDepth: {
10462
+ type: "number",
10463
+ description: "Maximum depth to traverse (default: 5)"
10464
+ }
10465
+ },
10466
+ required: ["rootId"],
10467
+ response: {
10468
+ description: "Tree of topics with nesting",
10469
+ fields: { tree: "array \u2014 topics in BFS order with depth and path" }
10470
+ },
10471
+ ownerModule: "reasoning-kernel",
10472
+ ontologyPrimitive: "graph",
10473
+ tier: "workhorse"
10474
+ };
10475
+ var MATERIALIZE_TOPIC_GRAPH = {
10476
+ name: "materialize_topic_graph",
10477
+ description: "Backfill the topic graph spine. Like `git fsck --connectivity-only` with repair enabled \u2014 creates missing topic nodes and parent-child edges idempotently.",
10478
+ parameters: {
10479
+ rootTopicId: {
10480
+ type: "string",
10481
+ description: "Optional root topic for a bounded materialization pass"
10482
+ },
10483
+ dryRun: {
10484
+ type: "boolean",
10485
+ description: "When true, report missing rows without writing them"
10486
+ }
10487
+ },
10488
+ required: [],
10489
+ response: {
10490
+ description: "Topic graph materialization counts",
8381
10491
  fields: {
8382
- id: "string \u2014 topic ID",
8383
- globalId: "string \u2014 globally unique ID",
8384
- status: "string \u2014 topic lifecycle status",
8385
- visibility: "string \u2014 topic visibility"
10492
+ topicsSeen: "number",
10493
+ nodesCreated: "number",
10494
+ nodesExisting: "number",
10495
+ edgesCreated: "number",
10496
+ edgesExisting: "number",
10497
+ errors: "array"
8386
10498
  }
8387
10499
  },
8388
10500
  ownerModule: "reasoning-kernel",
8389
10501
  ontologyPrimitive: "graph",
8390
10502
  tier: "workhorse"
8391
10503
  };
8392
- var GET_TOPIC_TREE = {
8393
- name: "get_topic_tree",
8394
- description: "Get the full topic hierarchy from a root. Like `git log --graph --all` \u2014 shows the complete tree of nested topics.",
10504
+ var GET_TOPIC_GRAPH_SPINE = {
10505
+ name: "get_topic_graph_spine",
10506
+ description: "Verify the topic graph spine. Like `git fsck` \u2014 reads topics, materialized topic nodes, parent-child edges, and missing spine rows.",
8395
10507
  parameters: {
8396
- rootId: { type: "string", description: "Root topic to start from" },
8397
- maxDepth: {
8398
- type: "number",
8399
- description: "Maximum depth to traverse (default: 5)"
10508
+ rootTopicId: {
10509
+ type: "string",
10510
+ description: "Optional root topic for a bounded verifier pass"
10511
+ },
10512
+ includeTopicBeliefEdges: {
10513
+ type: "boolean",
10514
+ description: "Include topic -> belief edges in the verifier payload"
8400
10515
  }
8401
10516
  },
8402
- required: ["rootId"],
10517
+ required: [],
8403
10518
  response: {
8404
- description: "Tree of topics with nesting",
8405
- fields: { tree: "array \u2014 topics in BFS order with depth and path" }
10519
+ description: "Topic graph spine verification payload",
10520
+ fields: {
10521
+ ok: "boolean",
10522
+ counts: "object",
10523
+ topics: "array",
10524
+ topicNodes: "array",
10525
+ parentEdges: "array",
10526
+ missingTopicNodes: "array",
10527
+ missingParentEdges: "array"
10528
+ }
8406
10529
  },
8407
10530
  ownerModule: "reasoning-kernel",
8408
10531
  ontologyPrimitive: "graph",
@@ -9540,6 +11663,69 @@ var GENERATE_SESSION_HANDOFF = {
9540
11663
  tier: "showcase",
9541
11664
  internal: true
9542
11665
  };
11666
+ var BEGIN_BUILD_SESSION = {
11667
+ name: "begin_build_session",
11668
+ 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.",
11669
+ parameters: {
11670
+ worktreeId: {
11671
+ type: "string",
11672
+ description: "The Lucern worktree ID to bootstrap."
11673
+ },
11674
+ branch: {
11675
+ type: "string",
11676
+ description: "Optional git branch name. Auto-generated from the worktree name when omitted."
11677
+ },
11678
+ branchBase: {
11679
+ type: "string",
11680
+ description: 'Base branch for the feature branch. Default: "staging".'
11681
+ },
11682
+ prBase: {
11683
+ type: "string",
11684
+ description: 'Target branch for the PR. Default: "staging".'
11685
+ },
11686
+ sessionMode: {
11687
+ type: "string",
11688
+ description: 'Session mode: "async" for Codex/headless or "interactive" for live sessions.',
11689
+ enum: ["async", "interactive"]
11690
+ },
11691
+ activateIfPlanning: {
11692
+ type: "boolean",
11693
+ description: "When true, automatically activate a planning worktree during bootstrap."
11694
+ }
11695
+ },
11696
+ required: ["worktreeId"],
11697
+ response: {
11698
+ description: "A compact build-session packet with worktree metadata, graph anchors, questions, dependencies, and git defaults.",
11699
+ fields: {
11700
+ topicId: "string \u2014 canonical topic scope",
11701
+ topicName: "string \u2014 human-readable topic name",
11702
+ worktreeId: "string \u2014 worktree ID",
11703
+ worktreeName: "string \u2014 human-readable worktree name",
11704
+ branch: "string \u2014 git branch name",
11705
+ branchBase: "string \u2014 base branch",
11706
+ prBase: "string \u2014 PR target branch",
11707
+ campaign: "number | null \u2014 top-level pipeline campaign",
11708
+ lane: "string \u2014 campaign lane",
11709
+ gate: "string \u2014 exit gate",
11710
+ hypothesis: "string \u2014 worktree hypothesis",
11711
+ focus: "string \u2014 session focus",
11712
+ status: "string \u2014 worktree status after optional activation",
11713
+ sessionMode: "string \u2014 async | interactive",
11714
+ targetBeliefIds: "array \u2014 scoped belief IDs",
11715
+ targetQuestionIds: "array \u2014 scoped question IDs",
11716
+ topBeliefs: "array \u2014 highest-confidence scoped beliefs",
11717
+ openQuestions: "array \u2014 open scoped questions",
11718
+ resolvedDecisions: "array \u2014 answered questions summarized for the session",
11719
+ dependencies: "array \u2014 upstream worktrees",
11720
+ unblocks: "array \u2014 downstream worktrees",
11721
+ mergeOrderNotes: "string \u2014 merge ordering advisory"
11722
+ }
11723
+ },
11724
+ ownerModule: "bootstrap",
11725
+ ontologyPrimitive: "worktree",
11726
+ tier: "showcase",
11727
+ internal: true
11728
+ };
9543
11729
  var MCP_TOOL_CONTRACTS = {
9544
11730
  // Belief lifecycle (commit, amend, fork, archive)
9545
11731
  create_belief: CREATE_BELIEF,
@@ -9582,11 +11768,26 @@ var MCP_TOOL_CONTRACTS = {
9582
11768
  bisect_confidence: BISECT_CONFIDENCE,
9583
11769
  // Edges (commit)
9584
11770
  create_edge: CREATE_EDGE,
11771
+ update_edge: UPDATE_EDGE,
11772
+ remove_edge: REMOVE_EDGE,
11773
+ remove_edges_between: REMOVE_EDGES_BETWEEN,
11774
+ batch_create_edges: BATCH_CREATE_EDGES,
11775
+ // Epistemic node spine (commit/amend/show)
11776
+ create_epistemic_node: CREATE_EPISTEMIC_NODE,
11777
+ get_epistemic_node: GET_EPISTEMIC_NODE,
11778
+ list_epistemic_nodes: LIST_EPISTEMIC_NODES,
11779
+ update_epistemic_node: UPDATE_EPISTEMIC_NODE,
11780
+ archive_epistemic_node: ARCHIVE_EPISTEMIC_NODE,
11781
+ verify_epistemic_node: VERIFY_EPISTEMIC_NODE,
11782
+ supersede_epistemic_node: SUPERSEDE_EPISTEMIC_NODE,
11783
+ batch_create_epistemic_nodes: BATCH_CREATE_EPISTEMIC_NODES,
9585
11784
  // Judgments (tag)
9586
11785
  record_judgment: RECORD_JUDGMENT,
9587
11786
  // Graph intelligence (showcase)
9588
11787
  detect_confirmation_bias: DETECT_CONFIRMATION_BIAS,
9589
11788
  get_graph_structure_analysis: GET_GRAPH_STRUCTURE_ANALYSIS,
11789
+ list_graph_intelligence_queries: LIST_GRAPH_INTELLIGENCE_QUERIES,
11790
+ run_graph_intelligence_query: RUN_GRAPH_INTELLIGENCE_QUERY,
9590
11791
  get_falsification_questions: GET_FALSIFICATION_QUESTIONS,
9591
11792
  // Evidence operations (workhorse)
9592
11793
  search_evidence: SEARCH_EVIDENCE,
@@ -9633,6 +11834,7 @@ var MCP_TOOL_CONTRACTS = {
9633
11834
  get_agent_inbox: GET_AGENT_INBOX,
9634
11835
  claim_files: CLAIM_FILES,
9635
11836
  generate_session_handoff: GENERATE_SESSION_HANDOFF,
11837
+ begin_build_session: BEGIN_BUILD_SESSION,
9636
11838
  // Policy / ACL (workhorse)
9637
11839
  check_permission: CHECK_PERMISSION,
9638
11840
  filter_by_permission: FILTER_BY_PERMISSION,
@@ -9652,6 +11854,8 @@ var MCP_TOOL_CONTRACTS = {
9652
11854
  get_topic: GET_TOPIC,
9653
11855
  update_topic: UPDATE_TOPIC,
9654
11856
  get_topic_tree: GET_TOPIC_TREE,
11857
+ materialize_topic_graph: MATERIALIZE_TOPIC_GRAPH,
11858
+ get_topic_graph_spine: GET_TOPIC_GRAPH_SPINE,
9655
11859
  // Coding intelligence (code-grounded knowledge)
9656
11860
  get_code_context: GET_CODE_CONTEXT,
9657
11861
  get_change_history: GET_CHANGE_HISTORY,
@@ -11300,6 +13504,952 @@ function validateSdkGitSemantics(tool) {
11300
13504
  return { valid: true };
11301
13505
  }
11302
13506
 
13507
+ // src/tenant-bootstrap-seed.contract.ts
13508
+ var TENANT_BOOTSTRAP_SEED_CONTRACT_VERSION = "2026-04-30";
13509
+ var TENANT_BOOTSTRAP_SEED_AUTH_METADATA_FIELDS = [
13510
+ "tenantId",
13511
+ "workspaceId",
13512
+ "principalId",
13513
+ "role",
13514
+ "authMode",
13515
+ "correlationId",
13516
+ "auditMetadata"
13517
+ ];
13518
+ var TENANT_BOOTSTRAP_SEED_COMPONENTS = {
13519
+ kernel: {
13520
+ componentName: "lucern",
13521
+ migrationModule: "adapters/migration",
13522
+ templateService: "services/kernel-template",
13523
+ templateDeployments: {
13524
+ staging: "kindly-goldfish-162",
13525
+ prod: "cool-badger-368"
13526
+ }
13527
+ },
13528
+ identity: {
13529
+ componentName: "identity",
13530
+ migrationModule: "migration",
13531
+ templateService: "services/identity-template",
13532
+ templateDeployments: {
13533
+ staging: "industrious-cheetah-864",
13534
+ prod: "combative-beagle-879"
13535
+ }
13536
+ }
13537
+ };
13538
+ function isCopyableSeedRequirement(entry) {
13539
+ return (entry.copyMode === "template_global" || entry.copyMode === "template_tenant_rewrite" || entry.copyMode === "template_reference_remap") && Boolean(entry.scope) && Array.isArray(entry.uniqueKey) && entry.uniqueKey.length > 0;
13540
+ }
13541
+ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
13542
+ {
13543
+ component: "kernel",
13544
+ table: "agentMessages",
13545
+ prepopulation: "runtime_data",
13546
+ copyMode: "none",
13547
+ description: "Agent coordination messages are session data, not template data."
13548
+ },
13549
+ {
13550
+ component: "kernel",
13551
+ table: "agentSessions",
13552
+ prepopulation: "runtime_data",
13553
+ copyMode: "none",
13554
+ description: "Agent coordination sessions are created by active clients."
13555
+ },
13556
+ {
13557
+ component: "kernel",
13558
+ table: "autofixJobs",
13559
+ prepopulation: "runtime_queue",
13560
+ copyMode: "none",
13561
+ description: "Autofix work items are runtime queue rows."
13562
+ },
13563
+ {
13564
+ component: "kernel",
13565
+ table: "backgroundJobRuns",
13566
+ prepopulation: "runtime_log",
13567
+ copyMode: "none",
13568
+ description: "Background job executions are runtime logs."
13569
+ },
13570
+ {
13571
+ component: "kernel",
13572
+ table: "backgroundJobSettings",
13573
+ prepopulation: "required_template",
13574
+ copyMode: "template_global",
13575
+ scope: "global",
13576
+ uniqueKey: ["jobKey"],
13577
+ description: "Default job enablement settings must come from the K template."
13578
+ },
13579
+ {
13580
+ component: "kernel",
13581
+ table: "beliefConfidence",
13582
+ prepopulation: "runtime_data",
13583
+ copyMode: "none",
13584
+ description: "Belief confidence rows are created with tenant graph facts."
13585
+ },
13586
+ {
13587
+ component: "kernel",
13588
+ table: "beliefEvidenceLinks",
13589
+ prepopulation: "runtime_data",
13590
+ copyMode: "none",
13591
+ description: "Belief-to-evidence links are tenant graph data."
13592
+ },
13593
+ {
13594
+ component: "kernel",
13595
+ table: "beliefHistory",
13596
+ prepopulation: "runtime_data",
13597
+ copyMode: "none",
13598
+ description: "Belief history is append-only tenant graph data."
13599
+ },
13600
+ {
13601
+ component: "kernel",
13602
+ table: "beliefScenarios",
13603
+ prepopulation: "runtime_data",
13604
+ copyMode: "none",
13605
+ description: "Scenario rows are tenant-authored reasoning data."
13606
+ },
13607
+ {
13608
+ component: "kernel",
13609
+ table: "beliefVotes",
13610
+ prepopulation: "runtime_data",
13611
+ copyMode: "none",
13612
+ description: "Decision belief votes are tenant-authored data."
13613
+ },
13614
+ {
13615
+ component: "kernel",
13616
+ table: "calibrationScores",
13617
+ prepopulation: "runtime_derived",
13618
+ copyMode: "none",
13619
+ description: "Calibration scores are computed from tenant outcomes."
13620
+ },
13621
+ {
13622
+ component: "kernel",
13623
+ table: "contractEvaluations",
13624
+ prepopulation: "runtime_log",
13625
+ copyMode: "none",
13626
+ description: "Contract evaluation rows are runtime computation logs."
13627
+ },
13628
+ {
13629
+ component: "kernel",
13630
+ table: "contradictions",
13631
+ prepopulation: "runtime_data",
13632
+ copyMode: "none",
13633
+ description: "Contradictions are tenant graph facts."
13634
+ },
13635
+ {
13636
+ component: "kernel",
13637
+ table: "crossProjectConnections",
13638
+ prepopulation: "runtime_data",
13639
+ copyMode: "none",
13640
+ description: "Cross-topic connections are tenant graph facts."
13641
+ },
13642
+ {
13643
+ component: "kernel",
13644
+ table: "decisionComputedSummaries",
13645
+ prepopulation: "runtime_derived",
13646
+ copyMode: "none",
13647
+ description: "Decision summaries are derived tenant outputs."
13648
+ },
13649
+ {
13650
+ component: "kernel",
13651
+ table: "decisionEvents",
13652
+ prepopulation: "runtime_data",
13653
+ copyMode: "none",
13654
+ description: "Decision events are lifecycle data."
13655
+ },
13656
+ {
13657
+ component: "kernel",
13658
+ table: "decisionParticipants",
13659
+ prepopulation: "runtime_data",
13660
+ copyMode: "none",
13661
+ description: "Decision participants are tenant-selected actors."
13662
+ },
13663
+ {
13664
+ component: "kernel",
13665
+ table: "decisionRiskLedger",
13666
+ prepopulation: "runtime_data",
13667
+ copyMode: "none",
13668
+ description: "Decision risk rows are tenant decision data."
13669
+ },
13670
+ {
13671
+ component: "kernel",
13672
+ table: "decisionSnapshots",
13673
+ prepopulation: "runtime_derived",
13674
+ copyMode: "none",
13675
+ description: "Decision snapshots are derived from tenant state."
13676
+ },
13677
+ {
13678
+ component: "kernel",
13679
+ table: "deliberationContributions",
13680
+ prepopulation: "runtime_data",
13681
+ copyMode: "none",
13682
+ description: "Deliberation contributions are tenant-authored data."
13683
+ },
13684
+ {
13685
+ component: "kernel",
13686
+ table: "deliberationSessions",
13687
+ prepopulation: "runtime_data",
13688
+ copyMode: "none",
13689
+ description: "Deliberation sessions are created by tenant workflows."
13690
+ },
13691
+ {
13692
+ component: "kernel",
13693
+ table: "epistemicAudit",
13694
+ prepopulation: "runtime_log",
13695
+ copyMode: "none",
13696
+ description: "Epistemic audit rows are append-only runtime audit data."
13697
+ },
13698
+ {
13699
+ component: "kernel",
13700
+ table: "epistemicContracts",
13701
+ prepopulation: "runtime_data",
13702
+ copyMode: "none",
13703
+ description: "Epistemic contracts are tenant-authored governance data."
13704
+ },
13705
+ {
13706
+ component: "kernel",
13707
+ table: "epistemicEdges",
13708
+ prepopulation: "runtime_data",
13709
+ copyMode: "none",
13710
+ description: "Edges are tenant reasoning graph data."
13711
+ },
13712
+ {
13713
+ component: "kernel",
13714
+ table: "epistemicNodeEmbeddings",
13715
+ prepopulation: "runtime_derived",
13716
+ copyMode: "none",
13717
+ description: "Embeddings are derived from tenant graph nodes."
13718
+ },
13719
+ {
13720
+ component: "kernel",
13721
+ table: "epistemicNodes",
13722
+ prepopulation: "runtime_data",
13723
+ copyMode: "none",
13724
+ description: "Nodes are tenant reasoning graph data."
13725
+ },
13726
+ {
13727
+ component: "kernel",
13728
+ table: "graphAnalysisCache",
13729
+ prepopulation: "runtime_derived",
13730
+ copyMode: "none",
13731
+ description: "Graph analysis cache rows are derived from tenant graph state."
13732
+ },
13733
+ {
13734
+ component: "kernel",
13735
+ table: "graphAnalysisResults",
13736
+ prepopulation: "runtime_derived",
13737
+ copyMode: "none",
13738
+ description: "Graph analysis result rows are derived tenant outputs."
13739
+ },
13740
+ {
13741
+ component: "kernel",
13742
+ table: "graphSuggestions",
13743
+ prepopulation: "runtime_derived",
13744
+ copyMode: "none",
13745
+ description: "Graph suggestions are derived recommendations."
13746
+ },
13747
+ {
13748
+ component: "kernel",
13749
+ table: "harnessReplays",
13750
+ prepopulation: "runtime_log",
13751
+ copyMode: "none",
13752
+ description: "Harness replay rows are runtime verification logs."
13753
+ },
13754
+ {
13755
+ component: "kernel",
13756
+ table: "harnessRuns",
13757
+ prepopulation: "runtime_log",
13758
+ copyMode: "none",
13759
+ description: "Harness run rows are runtime verification logs."
13760
+ },
13761
+ {
13762
+ component: "kernel",
13763
+ table: "idempotencyTokens",
13764
+ prepopulation: "runtime_log",
13765
+ copyMode: "none",
13766
+ description: "Idempotency tokens are request-scoped runtime guards."
13767
+ },
13768
+ {
13769
+ component: "kernel",
13770
+ table: "lenses",
13771
+ prepopulation: "optional_template",
13772
+ copyMode: "none",
13773
+ description: "Reusable lens templates may live in K templates, but workspace-specific copies are not required for core SDK boot."
13774
+ },
13775
+ {
13776
+ component: "kernel",
13777
+ table: "lensTopicBindings",
13778
+ prepopulation: "runtime_data",
13779
+ copyMode: "none",
13780
+ description: "Lens bindings attach runtime topics to runtime/workspace lenses."
13781
+ },
13782
+ {
13783
+ component: "kernel",
13784
+ table: "neo4jSyncQueue",
13785
+ prepopulation: "runtime_queue",
13786
+ copyMode: "none",
13787
+ description: "Neo4j sync queue rows are runtime work items."
13788
+ },
13789
+ {
13790
+ component: "kernel",
13791
+ table: "ontologyDefinitions",
13792
+ prepopulation: "required_template",
13793
+ copyMode: "template_global",
13794
+ scope: "global",
13795
+ uniqueKey: ["ontologyKey"],
13796
+ description: "Platform ontology definitions power taxonomy reads and effective ontology resolution."
13797
+ },
13798
+ {
13799
+ component: "kernel",
13800
+ table: "ontologyVersions",
13801
+ prepopulation: "required_template",
13802
+ copyMode: "template_reference_remap",
13803
+ scope: "global",
13804
+ uniqueKey: ["ontologyKey", "version"],
13805
+ dependsOn: ["ontologyDefinitions"],
13806
+ description: "Ontology versions must be copied with ontologyDefinition ID remapping."
13807
+ },
13808
+ {
13809
+ component: "kernel",
13810
+ table: "platformAgentRunPolicyDecisions",
13811
+ prepopulation: "runtime_log",
13812
+ copyMode: "none",
13813
+ description: "Agent-run policy decisions are audit logs."
13814
+ },
13815
+ {
13816
+ component: "kernel",
13817
+ table: "platformAgentRunPromptResolutions",
13818
+ prepopulation: "runtime_log",
13819
+ copyMode: "none",
13820
+ description: "Agent-run prompt resolution rows are runtime logs."
13821
+ },
13822
+ {
13823
+ component: "kernel",
13824
+ table: "platformAgentRuns",
13825
+ prepopulation: "runtime_log",
13826
+ copyMode: "none",
13827
+ description: "Agent runs are runtime execution records."
13828
+ },
13829
+ {
13830
+ component: "kernel",
13831
+ table: "platformAgentRunToolCalls",
13832
+ prepopulation: "runtime_log",
13833
+ copyMode: "none",
13834
+ description: "Agent-run tool calls are runtime execution records."
13835
+ },
13836
+ {
13837
+ component: "kernel",
13838
+ table: "platformHarnessShadowAudit",
13839
+ prepopulation: "runtime_log",
13840
+ copyMode: "none",
13841
+ description: "Harness shadow audit rows are runtime audit records."
13842
+ },
13843
+ {
13844
+ component: "kernel",
13845
+ table: "publicationRules",
13846
+ prepopulation: "required_template",
13847
+ copyMode: "template_tenant_rewrite",
13848
+ scope: "tenant",
13849
+ uniqueKey: ["tenantId", "workspaceId", "name"],
13850
+ description: "Default publication policy rules are rewritten into each tenant."
13851
+ },
13852
+ {
13853
+ component: "kernel",
13854
+ table: "questionEvidenceLinks",
13855
+ prepopulation: "runtime_data",
13856
+ copyMode: "none",
13857
+ description: "Question-to-evidence links are tenant graph data."
13858
+ },
13859
+ {
13860
+ component: "kernel",
13861
+ table: "researchJobs",
13862
+ prepopulation: "runtime_queue",
13863
+ copyMode: "none",
13864
+ description: "Research job rows are runtime queue items."
13865
+ },
13866
+ {
13867
+ component: "kernel",
13868
+ table: "schemaEnumConfig",
13869
+ prepopulation: "required_template",
13870
+ copyMode: "template_global",
13871
+ scope: "global",
13872
+ uniqueKey: ["category", "value"],
13873
+ description: "Runtime-extensible enum defaults required by SDK graph APIs."
13874
+ },
13875
+ {
13876
+ component: "kernel",
13877
+ table: "stakeholderGroups",
13878
+ prepopulation: "runtime_data",
13879
+ copyMode: "none",
13880
+ description: "Stakeholder groups are tenant decision data."
13881
+ },
13882
+ {
13883
+ component: "kernel",
13884
+ table: "systemLogs",
13885
+ prepopulation: "runtime_log",
13886
+ copyMode: "none",
13887
+ description: "System logs are runtime telemetry."
13888
+ },
13889
+ {
13890
+ component: "kernel",
13891
+ table: "tasks",
13892
+ prepopulation: "runtime_data",
13893
+ copyMode: "none",
13894
+ description: "Tasks are tenant-authored work items."
13895
+ },
13896
+ {
13897
+ component: "kernel",
13898
+ table: "topics",
13899
+ prepopulation: "runtime_bootstrap",
13900
+ copyMode: "none",
13901
+ description: "Default topics are created by tenant provisioning, not copied from templates."
13902
+ },
13903
+ {
13904
+ component: "kernel",
13905
+ table: "workflowDefinitions",
13906
+ prepopulation: "optional_template",
13907
+ copyMode: "none",
13908
+ description: "Table-driven workflow definitions can be template data after the workflow engine leaves legacy mode."
13909
+ },
13910
+ {
13911
+ component: "kernel",
13912
+ table: "workflowPullRequests",
13913
+ prepopulation: "runtime_data",
13914
+ copyMode: "none",
13915
+ description: "Workflow pull requests are tenant workflow data."
13916
+ },
13917
+ {
13918
+ component: "kernel",
13919
+ table: "workflowStages",
13920
+ prepopulation: "optional_template",
13921
+ copyMode: "none",
13922
+ dependsOn: ["workflowDefinitions"],
13923
+ description: "Workflow stages can be template data after workflowDefinitions are enabled for bootstrap copying."
13924
+ },
13925
+ {
13926
+ component: "kernel",
13927
+ table: "worktreeBeliefCluster",
13928
+ prepopulation: "runtime_data",
13929
+ copyMode: "none",
13930
+ description: "Worktree cluster rows link runtime worktrees to runtime beliefs."
13931
+ },
13932
+ {
13933
+ component: "kernel",
13934
+ table: "worktrees",
13935
+ prepopulation: "runtime_data",
13936
+ copyMode: "none",
13937
+ description: "Worktrees are tenant/runtime planning data."
13938
+ },
13939
+ {
13940
+ component: "identity",
13941
+ table: "agents",
13942
+ prepopulation: "runtime_bootstrap",
13943
+ copyMode: "none",
13944
+ description: "Service agents are provisioned per tenant or service, not copied."
13945
+ },
13946
+ {
13947
+ component: "identity",
13948
+ table: "mcpWritePolicy",
13949
+ prepopulation: "required_template",
13950
+ copyMode: "template_global",
13951
+ scope: "global",
13952
+ uniqueKey: ["topicId", "role", "toolCategory"],
13953
+ description: "Global write policy defaults govern service and interactive MCP writes."
13954
+ },
13955
+ {
13956
+ component: "identity",
13957
+ table: "modelCallLogs",
13958
+ prepopulation: "runtime_log",
13959
+ copyMode: "none",
13960
+ description: "Model call logs are runtime telemetry."
13961
+ },
13962
+ {
13963
+ component: "identity",
13964
+ table: "modelFunctionSlots",
13965
+ prepopulation: "required_template",
13966
+ copyMode: "template_global",
13967
+ scope: "global",
13968
+ uniqueKey: ["slot"],
13969
+ description: "Function-to-model slots are required by model runtime resolution."
13970
+ },
13971
+ {
13972
+ component: "identity",
13973
+ table: "modelRegistry",
13974
+ prepopulation: "required_template",
13975
+ copyMode: "template_global",
13976
+ scope: "global",
13977
+ uniqueKey: ["key"],
13978
+ description: "Model catalog defaults are required by model runtime clients."
13979
+ },
13980
+ {
13981
+ component: "identity",
13982
+ table: "modelSlotConfigs",
13983
+ prepopulation: "required_template",
13984
+ copyMode: "template_global",
13985
+ scope: "global",
13986
+ uniqueKey: ["slot"],
13987
+ description: "Slot-level defaults are required before tenant overrides exist."
13988
+ },
13989
+ {
13990
+ component: "identity",
13991
+ table: "platformAudienceGrants",
13992
+ prepopulation: "runtime_data",
13993
+ copyMode: "none",
13994
+ description: "Audience grants are principal/group-specific access rows."
13995
+ },
13996
+ {
13997
+ component: "identity",
13998
+ table: "platformAudiences",
13999
+ prepopulation: "required_template",
14000
+ copyMode: "template_tenant_rewrite",
14001
+ scope: "tenant",
14002
+ uniqueKey: ["tenantId", "workspaceId", "audienceKey"],
14003
+ description: "Default tenant audience taxonomy rows are rewritten into each tenant."
14004
+ },
14005
+ {
14006
+ component: "identity",
14007
+ table: "platformPolicyDecisionLogs",
14008
+ prepopulation: "runtime_log",
14009
+ copyMode: "none",
14010
+ description: "Policy decisions are runtime audit logs."
14011
+ },
14012
+ {
14013
+ component: "identity",
14014
+ table: "projectGrants",
14015
+ prepopulation: "runtime_data",
14016
+ copyMode: "none",
14017
+ description: "Project/topic grants are principal or group-specific access rows."
14018
+ },
14019
+ {
14020
+ component: "identity",
14021
+ table: "reasoningPermissions",
14022
+ prepopulation: "runtime_data",
14023
+ copyMode: "none",
14024
+ description: "Reasoning permissions are principal-specific policy rows."
14025
+ },
14026
+ {
14027
+ component: "identity",
14028
+ table: "tenantApiKeys",
14029
+ prepopulation: "runtime_secret",
14030
+ copyMode: "none",
14031
+ description: "API keys are tenant credentials and must never be copied."
14032
+ },
14033
+ {
14034
+ component: "identity",
14035
+ table: "tenantConfig",
14036
+ prepopulation: "required_template",
14037
+ copyMode: "template_tenant_rewrite",
14038
+ scope: "tenant",
14039
+ uniqueKey: ["tenantId"],
14040
+ description: "Tenant-local config defaults are rewritten during bootstrap."
14041
+ },
14042
+ {
14043
+ component: "identity",
14044
+ table: "tenantIntegrations",
14045
+ prepopulation: "required_template",
14046
+ copyMode: "template_tenant_rewrite",
14047
+ scope: "tenant",
14048
+ uniqueKey: ["tenantId", "integrationKey"],
14049
+ description: "Non-secret integration descriptors are rewritten into each tenant."
14050
+ },
14051
+ {
14052
+ component: "identity",
14053
+ table: "tenantModelSlotBindings",
14054
+ prepopulation: "runtime_secret",
14055
+ copyMode: "none",
14056
+ description: "Tenant model slot bindings reference provider secrets and are runtime-only."
14057
+ },
14058
+ {
14059
+ component: "identity",
14060
+ table: "tenantPolicies",
14061
+ prepopulation: "required_template",
14062
+ copyMode: "template_tenant_rewrite",
14063
+ scope: "tenant",
14064
+ uniqueKey: ["tenantId", "workspaceId", "roleName"],
14065
+ description: "Default tenant policy roles are rewritten during bootstrap."
14066
+ },
14067
+ {
14068
+ component: "identity",
14069
+ table: "tenantProviderSecrets",
14070
+ prepopulation: "runtime_secret",
14071
+ copyMode: "none",
14072
+ description: "Provider secrets are credentials and must never be copied."
14073
+ },
14074
+ {
14075
+ component: "identity",
14076
+ table: "tenantProxyGatewayUsage",
14077
+ prepopulation: "runtime_log",
14078
+ copyMode: "none",
14079
+ description: "Proxy gateway usage rows are runtime telemetry."
14080
+ },
14081
+ {
14082
+ component: "identity",
14083
+ table: "tenantProxyTokenMints",
14084
+ prepopulation: "runtime_secret",
14085
+ copyMode: "none",
14086
+ description: "Proxy token mints are ephemeral secret-bearing runtime rows."
14087
+ },
14088
+ {
14089
+ component: "identity",
14090
+ table: "tenantSandboxAuditEvents",
14091
+ prepopulation: "runtime_log",
14092
+ copyMode: "none",
14093
+ description: "Sandbox audit rows are runtime security logs."
14094
+ },
14095
+ {
14096
+ component: "identity",
14097
+ table: "tenantSecrets",
14098
+ prepopulation: "runtime_secret",
14099
+ copyMode: "none",
14100
+ description: "Tenant secrets are credentials and must never be copied."
14101
+ },
14102
+ {
14103
+ component: "identity",
14104
+ table: "toolAcls",
14105
+ prepopulation: "required_template",
14106
+ copyMode: "template_global",
14107
+ scope: "global",
14108
+ uniqueKey: ["role", "toolName"],
14109
+ description: "Default role-to-tool grants are required for SDK/MCP tool access."
14110
+ },
14111
+ {
14112
+ component: "identity",
14113
+ table: "toolRegistry",
14114
+ prepopulation: "required_template",
14115
+ copyMode: "template_global",
14116
+ scope: "global",
14117
+ uniqueKey: ["toolName"],
14118
+ description: "Core tool catalog rows are required before pack or tenant tools exist."
14119
+ },
14120
+ {
14121
+ component: "identity",
14122
+ table: "users",
14123
+ prepopulation: "runtime_bootstrap",
14124
+ copyMode: "none",
14125
+ description: "Users are created from Clerk/MC principal resolution, not copied."
14126
+ }
14127
+ ];
14128
+ var TENANT_BOOTSTRAP_SEED_TABLES = TENANT_BOOTSTRAP_TABLE_REQUIREMENTS.filter(
14129
+ isCopyableSeedRequirement
14130
+ );
14131
+ var TENANT_BOOTSTRAP_FORBIDDEN_SEED_TABLES = TENANT_BOOTSTRAP_TABLE_REQUIREMENTS.filter(
14132
+ (entry) => !isCopyableSeedRequirement(entry)
14133
+ ).map((entry) => entry.table);
14134
+ var TENANT_BOOTSTRAP_SEED_MANIFEST = {
14135
+ contractVersion: TENANT_BOOTSTRAP_SEED_CONTRACT_VERSION,
14136
+ authMetadataFields: TENANT_BOOTSTRAP_SEED_AUTH_METADATA_FIELDS,
14137
+ components: TENANT_BOOTSTRAP_SEED_COMPONENTS,
14138
+ tableRequirements: TENANT_BOOTSTRAP_TABLE_REQUIREMENTS,
14139
+ tables: TENANT_BOOTSTRAP_SEED_TABLES,
14140
+ forbiddenTables: TENANT_BOOTSTRAP_FORBIDDEN_SEED_TABLES
14141
+ };
14142
+ function findTenantBootstrapTableRequirement(table) {
14143
+ return TENANT_BOOTSTRAP_TABLE_REQUIREMENTS.find(
14144
+ (entry) => entry.table === table
14145
+ );
14146
+ }
14147
+ function findTenantBootstrapSeedTable(table) {
14148
+ return TENANT_BOOTSTRAP_SEED_TABLES.find((entry) => entry.table === table);
14149
+ }
14150
+ function isTenantBootstrapSeedTable(table) {
14151
+ return Boolean(findTenantBootstrapSeedTable(table));
14152
+ }
14153
+ function isTenantBootstrapForbiddenSeedTable(table) {
14154
+ return TENANT_BOOTSTRAP_FORBIDDEN_SEED_TABLES.some((entry) => entry === table);
14155
+ }
14156
+ var TENANT_BOOTSTRAP_TEMPLATE_SEED_VERSION = "2026-04-30.1";
14157
+ var TENANT_BOOTSTRAP_TEMPLATE_TENANT_ID = "tenant_template";
14158
+ var TENANT_BOOTSTRAP_TEMPLATE_ACTOR = "system:lucern-template-seed";
14159
+ var DEFAULT_SEED_TIME = Date.UTC(2026, 3, 30);
14160
+ var ROLE_GRANTS = {
14161
+ viewer: ["viewer", "auditor", "editor", "workspace_admin", "tenant_admin", "platform_admin", "service_agent"],
14162
+ auditor: ["auditor", "tenant_admin", "platform_admin", "service_agent"],
14163
+ editor: ["editor", "workspace_admin", "tenant_admin", "platform_admin", "service_agent"],
14164
+ workspace_admin: ["workspace_admin", "tenant_admin", "platform_admin", "service_agent"],
14165
+ tenant_admin: ["tenant_admin", "platform_admin", "service_agent"],
14166
+ platform_admin: ["platform_admin", "service_agent"],
14167
+ service_agent: ["service_agent"]
14168
+ };
14169
+ var ENUM_VALUES = {
14170
+ topic_type: ["domain", "theme", "deal", "strategy", "constitution", "project", "portfolio", "architecture", "capability", "runtime", "interface", "governance", "operations", "security", "data"],
14171
+ branch_schema: ["pillar", "track", "dimension", "axis", "phase"],
14172
+ belief_type: ["belief", "hypothesis", "principle", "invariant", "assumption", "tenet", "prior", "preference", "goal", "forecast", "decision", "constraint", "tradeoff", "policy", "implementation_choice", "implementation_decision", "interface_contract", "migration_state", "code_pattern", "deprecation_notice"],
14173
+ edge_type: ["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"],
14174
+ worktree_type: ["belief_test", "lens", "existential", "contradiction", "refinement", "coverage", "discovery", "clarification", "confirmation"],
14175
+ worktree_phase: ["cluster_mapping", "hypothesis_formation", "question_generation", "evidence_collection", "synthesis", "decision", "retrospective"],
14176
+ activity_type: ["create", "update", "review", "merge", "archive", "comment", "status_change", "evidence_added", "question_added"],
14177
+ lens_perspective_type: ["investigation", "monitoring", "analysis", "comparison", "taxonomy"],
14178
+ node_type: ["belief", "question", "theme", "deal", "evidence", "claim", "synthesis", "source", "excerpt", "atomic_fact", "person", "company", "investor", "value_chain", "function", "decision"]
14179
+ };
14180
+ var MODEL_REGISTRY = [
14181
+ ["claude-sonnet-4", "Claude Sonnet 4", "claude-sonnet-4-20250514", "anthropic", 2e5, 64e3, 1, 3, 15],
14182
+ ["claude-sonnet-4.5", "Claude Sonnet 4.5", "claude-sonnet-4-5-20250929", "anthropic", 2e5, 64e3, 1, 3, 15],
14183
+ ["claude-opus-4", "Claude Opus 4", "claude-opus-4-20250514", "anthropic", 2e5, 32e3, 1, 15, 75],
14184
+ ["gpt-4o", "GPT-4o", "gpt-4o", "openai", 128e3, 16e3, 0.7, 5, 15],
14185
+ ["gpt-4o-mini", "GPT-4o Mini", "gpt-4o-mini", "openai", 128e3, 16e3, 0.7, 0.15, 0.6],
14186
+ ["gemini-2.5-pro", "Gemini 2.5 Pro", "gemini-2.5-pro", "google", 1e6, 32e3, 0.7, 1.25, 10],
14187
+ ["sonar-pro", "Sonar Pro", "sonar-pro", "perplexity", 128e3, 8e3, 0.3, 3, 15]
14188
+ ];
14189
+ var MODEL_SLOTS = [
14190
+ ["primer_default", "primers", "Default primer generation for general topics", "claude-sonnet-4", "agents/primer/system", 1, 4e3, ["text_generation", "reasoning"]],
14191
+ ["primer_technical", "primers", "Technical and engineering focused primers", "claude-sonnet-4", "agents/primer/system", 0.8, 4e3, ["text_generation", "reasoning", "code"]],
14192
+ ["primer_intelligence", "document_intelligence", "Extract evidence, beliefs, and questions from documents", "claude-sonnet-4", "agents/primer-intelligence", 0.3, 8e3, ["text_generation", "structured_output", "reasoning"]],
14193
+ ["fact_checker", "research", "Verify claims without web search", "claude-sonnet-4", "agents/internet-fact-checker", 0.3, 4e3, ["text_generation", "reasoning"]],
14194
+ ["fact_checker_web", "research", "Verify claims with web search", "sonar-pro", "agents/internet-fact-checker", 0.3, 4e3, ["web_search"]],
14195
+ ["deep_research", "research", "Deep research with extended analysis", "claude-opus-4", void 0, 0.7, 8e3, ["text_generation", "reasoning", "long_context"]],
14196
+ ["belief_classifier", "classification", "Classify beliefs by epistemic type", "claude-sonnet-4", "classification/belief-category", 0.2, 1e3, ["text_generation", "reasoning"]],
14197
+ ["evidence_classifier", "classification", "Classify evidence methodology and quality", "claude-sonnet-4", "classification/evidence-rules", 0.3, 1e3, ["text_generation", "reasoning"]],
14198
+ ["edge_classifier", "classification", "Classify edge reasoning method and temporal class", "claude-sonnet-4", "classification/epistemic-guidance", 0.3, 1e3, ["text_generation", "reasoning"]],
14199
+ ["entity_extractor", "extraction", "Extract entities from text", "claude-sonnet-4", void 0, 0.2, 2e3, ["text_generation", "structured_output"]],
14200
+ ["graph_intelligence_query", "graph_intelligence", "Analyze graph health, gaps, and structural risks", "claude-sonnet-4", "graph-intelligence/query", 0.5, 8e3, ["text_generation", "reasoning", "tool_use"]],
14201
+ ["graph_intelligence_suggestions", "graph_intelligence", "Extract actionable graph suggestions", "claude-sonnet-4", "graph-intelligence/suggestions-extraction", 0.2, 4e3, ["text_generation", "structured_output"]],
14202
+ ["text_to_cypher", "graph_intelligence", "Generate read-only Cypher from graph questions", "claude-sonnet-4", "graph-intelligence/text-to-cypher", 0.2, 2e3, ["text_generation", "code", "reasoning"]],
14203
+ ["contradiction_verifier", "epistemic", "Verify semantic contradiction candidates", "claude-sonnet-4", "lucern/verify-contradiction", 0.2, 500, ["text_generation", "reasoning"]],
14204
+ ["task_execution", "tasks", "Execute research tasks with structured analysis", "claude-sonnet-4", void 0, 0.3, 4e3, ["text_generation", "reasoning", "structured_output"]],
14205
+ ["sprint_unified", "sprints", "Unified worktree chat across all phases", "claude-opus-4", "worktrees/unified-system-prompt", 0.7, 8e3, ["text_generation", "reasoning", "tool_use"]],
14206
+ ["evidence_assessor", "sprints", "Assess evidence for belief valence and certainty", "claude-sonnet-4", "worktrees/scoring/evidence-assessor", 0.3, 4e3, ["text_generation", "reasoning", "structured_output"]],
14207
+ ["title_generator", "utility", "Generate concise titles", "gpt-4o-mini", void 0, 0.7, 100, ["text_generation", "fast", "cheap"]],
14208
+ ["help_desk_agent", "utility", "Help desk support agent for workflow guidance", "claude-sonnet-4", "agents/help-desk-agent", 0.4, 2e3, ["text_generation", "reasoning"]],
14209
+ ["bug_detective_agent", "utility", "Bug triage assistant for structured diagnosis", "claude-sonnet-4", "agents/bug-detective-agent", 0.3, 2e3, ["text_generation", "reasoning"]]
14210
+ ];
14211
+ function labelFor(value) {
14212
+ return value.split(/[_-]/).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
14213
+ }
14214
+ function seedContext(options) {
14215
+ return {
14216
+ now: options.now ?? DEFAULT_SEED_TIME,
14217
+ templateTenantId: options.templateTenantId ?? TENANT_BOOTSTRAP_TEMPLATE_TENANT_ID,
14218
+ actor: options.actorPrincipalId ?? TENANT_BOOTSTRAP_TEMPLATE_ACTOR,
14219
+ version: options.version ?? TENANT_BOOTSTRAP_TEMPLATE_SEED_VERSION
14220
+ };
14221
+ }
14222
+ function toolCategory(contract) {
14223
+ if (contract.surfaceIntent === "system") return "system";
14224
+ if (contract.effects.includes("admin")) return "admin";
14225
+ if (contract.effects.includes("write") || contract.kind !== "query") return "write";
14226
+ return "read";
14227
+ }
14228
+ function requiredRole(category) {
14229
+ if (category === "system") return "service_agent";
14230
+ if (category === "admin") return "tenant_admin";
14231
+ if (category === "write") return "editor";
14232
+ return "viewer";
14233
+ }
14234
+ function requiredAction(category) {
14235
+ if (category === "admin" || category === "system") return "admin";
14236
+ if (category === "write") return "mutate";
14237
+ return "read";
14238
+ }
14239
+ function enabledSurfaces(contract) {
14240
+ return [
14241
+ contract.surfaces.mcp !== "none" ? "mcp" : void 0,
14242
+ contract.surfaces.sdk !== "none" ? "sdk" : void 0,
14243
+ contract.surfaces.cli !== "none" ? "cli" : void 0,
14244
+ contract.surfaces.rest !== "none" ? "api" : void 0
14245
+ ].filter((value) => Boolean(value));
14246
+ }
14247
+ function buildToolRegistry(now, actor, version) {
14248
+ const rows = /* @__PURE__ */ new Map();
14249
+ for (const contract of ALL_FUNCTION_CONTRACTS) {
14250
+ const surfaces = enabledSurfaces(contract);
14251
+ if (surfaces.length === 0) continue;
14252
+ const category = toolCategory(contract);
14253
+ const readOnly = category === "read";
14254
+ const toolName = contract.mcp.toolName || contract.name;
14255
+ rows.set(toolName, {
14256
+ toolName,
14257
+ description: contract.openapi.summary,
14258
+ version,
14259
+ status: "active",
14260
+ requiredRole: requiredRole(category),
14261
+ requiredAction: requiredAction(category),
14262
+ surfaces,
14263
+ category,
14264
+ parameterSchema: { contract: contract.name, sdk: contract.sdk },
14265
+ handlerRef: contract.convex ? `${contract.convex.module}.${contract.convex.functionName}` : contract.name,
14266
+ executionAdapter: contract.convex?.kind === "action" ? "convex_action" : contract.convex?.kind === "mutation" ? "convex_mutation" : "mcp_tool",
14267
+ safetyMetadata: {
14268
+ readOnly,
14269
+ idempotent: readOnly || contract.idempotent === true || contract.idempotent === "required",
14270
+ sideEffectLevel: readOnly ? "none" : category === "admin" ? "high" : "low"
14271
+ },
14272
+ isCore: true,
14273
+ mcVersion: version,
14274
+ registeredBy: actor,
14275
+ registeredAt: now
14276
+ });
14277
+ }
14278
+ return [...rows.values()].sort(
14279
+ (a, b) => String(a.toolName).localeCompare(String(b.toolName))
14280
+ );
14281
+ }
14282
+ function buildToolAcls(tools, now, actor) {
14283
+ return tools.flatMap(
14284
+ (tool) => (ROLE_GRANTS[tool.requiredRole] ?? [tool.requiredRole]).map(
14285
+ (role) => ({ role, toolName: tool.toolName, createdBy: actor, createdAt: now })
14286
+ )
14287
+ );
14288
+ }
14289
+ function buildMcpWritePolicy(now, actor) {
14290
+ return [
14291
+ ...["viewer", "auditor"].map((role) => ({
14292
+ role,
14293
+ toolCategory: "write",
14294
+ permission: "deny",
14295
+ enabled: true,
14296
+ rationale: "Read-only roles cannot mutate the reasoning graph.",
14297
+ createdAt: now,
14298
+ updatedAt: now,
14299
+ createdBy: actor
14300
+ })),
14301
+ ...["editor", "workspace_admin", "tenant_admin", "platform_admin", "service_agent"].map((role) => ({
14302
+ role,
14303
+ toolCategory: "write",
14304
+ permission: "allow",
14305
+ maxWritesPerSession: role === "editor" ? 200 : void 0,
14306
+ enabled: true,
14307
+ rationale: "Default global write policy for trusted graph mutation roles.",
14308
+ createdAt: now,
14309
+ updatedAt: now,
14310
+ createdBy: actor
14311
+ }))
14312
+ ];
14313
+ }
14314
+ function buildTenantPolicies(tenantId, now, actor) {
14315
+ const rows = [
14316
+ ["viewer", "Read graph and runtime metadata.", [{ resource: "graph", actions: ["read"] }]],
14317
+ ["auditor", "Read graph, audit, and policy decisions.", [{ resource: "audit", actions: ["read", "export"] }]],
14318
+ ["editor", "Read and mutate tenant reasoning state.", [{ resource: "graph", actions: ["read", "create", "update", "mutate"] }]],
14319
+ ["workspace_admin", "Manage workspace-scoped reasoning operations.", [{ resource: "workspace", actions: ["read", "update", "admin"] }]],
14320
+ ["tenant_admin", "Manage tenant policy, tools, users, and publication.", [{ resource: "tenant", actions: ["read", "update", "admin"] }, { resource: "policy", actions: ["read", "create", "update", "admin"] }]],
14321
+ ["service_agent", "Service principal execution role for automation.", [{ resource: "runtime", actions: ["read", "create", "update"] }, { resource: "graph", actions: ["read", "create", "update", "mutate"] }]]
14322
+ ];
14323
+ return rows.map(([roleName, description, permissions]) => ({
14324
+ tenantId,
14325
+ roleName,
14326
+ description,
14327
+ permissions,
14328
+ groupBindings: [],
14329
+ createdAt: now,
14330
+ updatedAt: now,
14331
+ createdBy: actor,
14332
+ updatedBy: actor
14333
+ }));
14334
+ }
14335
+ function modelRegistryRows(now) {
14336
+ return MODEL_REGISTRY.map(([key, name, modelId, provider, contextWindow, maxOutputTokens, defaultTemperature, inputCostPer1M, outputCostPer1M]) => ({
14337
+ key,
14338
+ name,
14339
+ modelId,
14340
+ provider,
14341
+ capabilities: ["text_generation", "reasoning"],
14342
+ contextWindow,
14343
+ maxOutputTokens,
14344
+ defaultTemperature,
14345
+ inputCostPer1M,
14346
+ outputCostPer1M,
14347
+ recommended: true,
14348
+ enabled: true,
14349
+ createdAt: now,
14350
+ updatedAt: now
14351
+ }));
14352
+ }
14353
+ function modelFunctionSlotRows(now) {
14354
+ return MODEL_SLOTS.map(([slot, category, description, modelKey, promptName, temperature, maxTokens, requiredCapabilities]) => ({
14355
+ slot,
14356
+ category,
14357
+ description,
14358
+ modelKey,
14359
+ promptName,
14360
+ temperature,
14361
+ maxTokens,
14362
+ requiredCapabilities,
14363
+ enabled: true,
14364
+ isDefault: true,
14365
+ notes: `Seeded by ${TENANT_BOOTSTRAP_TEMPLATE_SEED_VERSION}.`,
14366
+ createdAt: now,
14367
+ updatedAt: now
14368
+ }));
14369
+ }
14370
+ function modelSlotConfigRows(now) {
14371
+ return MODEL_SLOTS.map(([slot, , , modelKey, , temperature, maxTokens]) => ({
14372
+ slot,
14373
+ modelKey,
14374
+ temperature,
14375
+ maxTokens,
14376
+ enabled: true,
14377
+ notes: `Default routing for ${slot}.`,
14378
+ createdAt: now,
14379
+ updatedAt: now
14380
+ }));
14381
+ }
14382
+ function schemaEnumRows(now) {
14383
+ return Object.entries(ENUM_VALUES).flatMap(
14384
+ ([category, values]) => values.map((value, index) => ({
14385
+ category,
14386
+ value,
14387
+ label: labelFor(value),
14388
+ description: `${labelFor(value)} ${category} value.`,
14389
+ tier: "platform",
14390
+ metadata: { seedVersion: TENANT_BOOTSTRAP_TEMPLATE_SEED_VERSION },
14391
+ isDefault: index === 0,
14392
+ sortOrder: index + 1,
14393
+ status: "active",
14394
+ createdAt: now,
14395
+ updatedAt: now
14396
+ }))
14397
+ );
14398
+ }
14399
+ function buildTenantBootstrapTemplateSeedRows(options = {}) {
14400
+ const ctx = seedContext(options);
14401
+ const toolRegistry2 = buildToolRegistry(ctx.now, ctx.actor, ctx.version);
14402
+ return {
14403
+ kernel: {
14404
+ backgroundJobSettings: [
14405
+ { jobKey: "neo4j_sync", enabled: false, notes: "Disabled until graph-sync credentials are configured.", updatedAt: ctx.now, updatedBy: ctx.actor },
14406
+ { jobKey: "calibration_rollups", enabled: true, notes: "Compute calibration rollups when calibration data exists.", updatedAt: ctx.now, updatedBy: ctx.actor }
14407
+ ],
14408
+ ontologyDefinitions: [
14409
+ { ontologyKey: "lucern-core", name: "Lucern Core", description: "Core Lucern reasoning taxonomy.", tier: "platform", status: "active", createdBy: ctx.actor, createdAt: ctx.now, updatedAt: ctx.now }
14410
+ ],
14411
+ ontologyVersions: [
14412
+ {
14413
+ ontologyId: "lucern-core",
14414
+ ontologyKey: "lucern-core",
14415
+ version: ctx.version,
14416
+ status: "published",
14417
+ entityTypes: ["belief", "question", "evidence", "answer", "decision", "task", "worktree", "topic", "source"].map((value) => ({ value, label: labelFor(value) })),
14418
+ edgeTypes: ["supports", "informs", "depends_on", "derived_from", "contains", "tests", "supersedes", "responds_to"].map((value) => ({ value, label: labelFor(value) })),
14419
+ releaseNotes: "Initial platform ontology seed.",
14420
+ publishedBy: ctx.actor,
14421
+ publishedAt: ctx.now,
14422
+ createdAt: ctx.now
14423
+ }
14424
+ ],
14425
+ publicationRules: [
14426
+ { tenantId: ctx.templateTenantId, name: "publish-high-confidence-beliefs", description: "Publish high-confidence beliefs to tenant-level consumers.", conditionType: "confidence_threshold", conditions: { minConfidence: 0.85 }, enabled: true, priority: 100, createdBy: ctx.actor, createdAt: ctx.now, updatedAt: ctx.now }
14427
+ ],
14428
+ schemaEnumConfig: schemaEnumRows(ctx.now)
14429
+ },
14430
+ identity: {
14431
+ mcpWritePolicy: buildMcpWritePolicy(ctx.now, ctx.actor),
14432
+ modelFunctionSlots: modelFunctionSlotRows(ctx.now),
14433
+ modelRegistry: modelRegistryRows(ctx.now),
14434
+ modelSlotConfigs: modelSlotConfigRows(ctx.now),
14435
+ platformAudiences: [
14436
+ ["internal", "Internal", "internal"],
14437
+ ["lp", "Limited Partners", "restricted_external"],
14438
+ ["public", "Public", "public"]
14439
+ ].map(([audienceKey, audienceLabel, audienceClass]) => ({ tenantId: ctx.templateTenantId, audienceKey, audienceLabel, audienceClass, status: "active", metadata: { seedVersion: ctx.version }, createdBy: ctx.actor, createdAt: ctx.now, updatedAt: ctx.now })),
14440
+ tenantConfig: [
14441
+ { tenantId: ctx.templateTenantId, authPolicyMode: "open", defaultSessionTTL: 28800, defaultTopicVisibility: "tenant", featureFlags: { sdkBootstrapSeeds: true, interactiveRoleAuth: true }, maxWorkspaceCount: 25, defaultModelSlotOverrides: {}, updatedAt: ctx.now, updatedBy: ctx.actor }
14442
+ ],
14443
+ tenantIntegrations: [
14444
+ { tenantId: ctx.templateTenantId, integrationKey: "web-search", displayName: "Web Search", description: "Tenant-configurable search integration placeholder.", category: "search", capabilities: ["search", "deep_research", "summarize"], config: { apiBaseUrl: "https://example.invalid/lucern/search", authType: "none", timeout: 3e4 }, endpoints: { search: { path: "/search", method: "POST", queryParamName: "query", resultPath: "results" } }, status: "disabled", usageCount: 0, createdAt: ctx.now, updatedAt: ctx.now, createdBy: ctx.actor }
14445
+ ],
14446
+ tenantPolicies: buildTenantPolicies(ctx.templateTenantId, ctx.now, ctx.actor),
14447
+ toolAcls: buildToolAcls(toolRegistry2, ctx.now, ctx.actor),
14448
+ toolRegistry: toolRegistry2
14449
+ }
14450
+ };
14451
+ }
14452
+
11303
14453
  // src/v1/topics/v1.ts
11304
14454
  var ROOT_TOPIC_ID = "n17tm38rwet7wqgzrmwahyt1z582590y";
11305
14455
  function collectTopicNeighborhood(topics2, rootTopicId, maxDescendantDepth = 2) {
@@ -11593,6 +14743,6 @@ var CANONICAL_WORKFLOW_DEFINITIONS = [
11593
14743
  }
11594
14744
  ];
11595
14745
 
11596
- export { BELIEF_STATUSES, BELIEF_TYPE_BONUS, BRANCH_STATUSES, CANONICAL_WORKFLOW_DEFINITIONS, CONFIDENCE_TRIGGERS, CONTEXT_PACK_SCHEMA_VERSION, CONTEXT_PACK_SECTION_KEYS, CONTEXT_RANKING_PROFILES, CONTRADICTION_SEVERITIES, CONTRADICTION_STATUSES, ComponentTableManifestSchema, DEFAULT_BELIEF_TYPE_BONUS, DEFAULT_COMPILATION_MODE, DEFAULT_ENTITY_LIMIT, DEFAULT_PRIORITY_SCORE, DEFAULT_RANKING_PROFILE, DEFAULT_SECTION_LIMIT, DEFAULT_SEVERITY_SCORE, DEFAULT_TIER_APPROVAL_MODE, DEFAULT_TOKEN_BUDGET, DEFAULT_WORKFLOW_AUTO_FIX_POLICY, DEFEAT_TYPES, DOMAIN_EVENT_TYPES, DOMAIN_EVENT_VERSION, ENTITY_RANKING_WEIGHTS, EPISTEMIC_LAYERS, EVENT_RETENTION_DEFAULT_DAYS, EdgePolicyEntrySchema, EdgePolicyManifestSchema, EpistemicNodeTypeSchema, FORK_REASONS, GraphRefSchema, INTEGRATION_EDGE_TYPES, InvariantManifestSchema, JUDGMENT_TYPES, MAX_ENTITY_LIMIT, MAX_SECTION_LIMIT, MAX_TOKEN_BUDGET, MERGE_OUTCOMES, MIN_CONTRADICTION_BUDGET, MIN_TOKEN_BUDGET, MIN_TOKEN_ESTIMATE, MORNING_BRIEF_WORKFLOW_ID, NIGHTLY_RECONCILIATION_WORKFLOW_ID, PRIORITY_SCORES, PULL_REQUEST_STATUSES, RANKING_WEIGHTS, REASONING_METHODS, RECENCY_HALF_LIFE_DAYS, RESOLVED_QUESTION_STATUSES, ROOT_TOPIC_ID, SECTION_BUDGET_RATIOS, SESSION_AUTH_MODES, SESSION_LIFECYCLE_STATUSES, SESSION_PRINCIPAL_TYPES, SEVERITY_SCORES, SLOpinionInputSchema, TOKENS_PER_WORD, WEBHOOK_MAX_ATTEMPTS, WEBHOOK_RETRY_DELAYS_MS, WORKFLOW_ACTION_KINDS, WORKFLOW_APPROVAL_MODES, WORKFLOW_AUTO_FIX_MODES, WORKFLOW_HOOK_EVENTS, WORKFLOW_INTEGRITY_CHECKS, WORKFLOW_MUTATION_TIERS, WORKFLOW_OUTPUT_KINDS, WORKFLOW_PROOF_ARTIFACT_KINDS, WORKFLOW_RUNTIME_SCHEMA_VERSION, WORKFLOW_RUN_STATUSES, WORKFLOW_STAFFING_HINTS, WORKFLOW_TRIGGER_KINDS, WORKTREE_PHASES, assertEdgePolicyAllowed, bigramTokenize, buildDomainEvent, collectTopicNeighborhood, compareEventCursor, dsl_exports as contractDsl, createEventId, createEvidenceProjection, decodeEventCursor, decodePrefixedId, defineProjection, edgePolicyManifest, emitDomainEvent, encodeEventCursor, encodePrefixedId, findEdgePolicy, hasPrefixedIdPrefix, inferActorType, inferSessionPrincipalType, isAfterCursor, isLucernPrompt, jaccardSimilarity, lastDelegator, listBeliefsProjection, listTasksProjection, tool_contracts_exports as mcpToolsContract, modulateConfidenceProjection, normalizeDelegationChain, normalizeRetentionDays, prepareLexicalQuery, projections, rankEntityConnections, rankEntityTypeMatches, rankWindowScore, requireActorPrincipalId, rerankLexicalWindow, schemas_exports as schemaContracts, scoreEntityConnection, scoreEntityTypeMatch, scoreLexicalSignal, scoreLexicalSignals, sdk_tools_contract_exports as sdkToolsContract, sortEventsByCursor, stemToken, tokenOverlapScore, tokenizeSearchText, wordOverlapScore, wordTokenize };
14746
+ export { BELIEF_STATUSES, BELIEF_TYPE_BONUS, BRANCH_STATUSES, CANONICAL_WORKFLOW_DEFINITIONS, COMPONENT_BOUNDARY_COMPONENT_LAYERS, COMPONENT_BOUNDARY_CONTRACT_VERSION, COMPONENT_BOUNDARY_DIRECT_DB_METHODS, COMPONENT_BOUNDARY_HIGH_RISK_TABLES, COMPONENT_BOUNDARY_HOST_SOURCE_ROOTS, COMPONENT_HOST_BOUNDARY_CONTRACT_VERSION, COMPONENT_HOST_DB_READ_OPERATIONS, COMPONENT_HOST_DB_WRITE_OPERATIONS, COMPONENT_HOST_PROTECTED_TABLES, COMPONENT_HOST_PROTECTED_TABLE_OWNERS, COMPONENT_HOST_WRITE_ALLOWED_EXCEPTIONS, COMPONENT_HOST_WRITE_AUDIT_ROOTS, CONFIDENCE_TRIGGERS, CONTEXT_PACK_SCHEMA_VERSION, CONTEXT_PACK_SECTION_KEYS, CONTEXT_RANKING_PROFILES, CONTRADICTION_SEVERITIES, CONTRADICTION_STATUSES, ComponentTableManifestSchema, DEFAULT_BELIEF_TYPE_BONUS, DEFAULT_COMPILATION_MODE, DEFAULT_ENTITY_LIMIT, DEFAULT_PRIORITY_SCORE, DEFAULT_RANKING_PROFILE, DEFAULT_SECTION_LIMIT, DEFAULT_SEVERITY_SCORE, DEFAULT_TIER_APPROVAL_MODE, DEFAULT_TOKEN_BUDGET, DEFAULT_WORKFLOW_AUTO_FIX_POLICY, DEFEAT_TYPES, DOMAIN_EVENT_TYPES, DOMAIN_EVENT_VERSION, ENTITY_RANKING_WEIGHTS, EPISTEMIC_LAYERS, EVENT_RETENTION_DEFAULT_DAYS, EdgePolicyEntrySchema, EdgePolicyManifestSchema, EpistemicNodeTypeSchema, FORK_REASONS, GRAPH_INTELLIGENCE_MODE_TOOL_NAMES, GRAPH_INTELLIGENCE_PUBLIC_TOOL_NAMES, GRAPH_INTELLIGENCE_QUERIES, GRAPH_INTELLIGENCE_QUERIES_WITH_TOOLS, GRAPH_INTELLIGENCE_QUERY_CATALOG_VERSION, GRAPH_INTELLIGENCE_QUERY_CATEGORIES, GRAPH_INTELLIGENCE_QUERY_MODES, GRAPH_INTELLIGENCE_QUICK_QUERIES, GRAPH_REF_NODE_TYPES, GraphRefSchema, INFISICAL_RUNTIME_BOOTSTRAP_ENV, INFISICAL_RUNTIME_CONTRACT_VERSION, INFISICAL_RUNTIME_DEFAULT_API_URL, INFISICAL_RUNTIME_DEFAULT_PROJECT_ID, INFISICAL_RUNTIME_DELIVERY_MODES, INFISICAL_RUNTIME_ENVIRONMENTS, INFISICAL_RUNTIME_MANIFEST, INFISICAL_RUNTIME_PATHS, INFISICAL_RUNTIME_SURFACES, INFISICAL_RUNTIME_SURFACE_IDS, INTEGRATION_EDGE_TYPES, InvariantManifestSchema, JUDGMENT_TYPES, MAX_ENTITY_LIMIT, MAX_SECTION_LIMIT, MAX_TOKEN_BUDGET, MERGE_OUTCOMES, MIN_CONTRADICTION_BUDGET, MIN_TOKEN_BUDGET, MIN_TOKEN_ESTIMATE, MORNING_BRIEF_WORKFLOW_ID, NIGHTLY_RECONCILIATION_WORKFLOW_ID, PRIORITY_SCORES, PULL_REQUEST_STATUSES, RANKING_WEIGHTS, REASONING_METHODS, RECENCY_HALF_LIFE_DAYS, RESOLVED_QUESTION_STATUSES, ROOT_TOPIC_ID, SECTION_BUDGET_RATIOS, SESSION_AUTH_MODES, SESSION_LIFECYCLE_STATUSES, SESSION_PRINCIPAL_TYPES, SEVERITY_SCORES, SLOpinionInputSchema, TENANT_BOOTSTRAP_FORBIDDEN_SEED_TABLES, TENANT_BOOTSTRAP_SEED_AUTH_METADATA_FIELDS, TENANT_BOOTSTRAP_SEED_COMPONENTS, TENANT_BOOTSTRAP_SEED_CONTRACT_VERSION, TENANT_BOOTSTRAP_SEED_MANIFEST, TENANT_BOOTSTRAP_SEED_TABLES, TENANT_BOOTSTRAP_TABLE_REQUIREMENTS, TENANT_BOOTSTRAP_TEMPLATE_ACTOR, TENANT_BOOTSTRAP_TEMPLATE_SEED_VERSION, TENANT_BOOTSTRAP_TEMPLATE_TENANT_ID, TENANT_CLIENT_AUTH_MODES, TENANT_CLIENT_CAPABILITIES, TENANT_CLIENT_COMPONENT_CONFIG_IMPORTS, TENANT_CLIENT_CONTRACT_VERSION, TENANT_CLIENT_FORBIDDEN_IMPORT_PATTERNS, TENANT_CLIENT_FORBIDDEN_INSTALL_TOKEN_INFISICAL_PATHS, TENANT_CLIENT_FORBIDDEN_SECRET_ENV, TENANT_CLIENT_FULL_SUITE_PACKAGE_NAMES, TENANT_CLIENT_INSTALLABLE_PACKAGES, TENANT_CLIENT_INSTALL_PROFILES, TENANT_CLIENT_INSTALL_TOKEN_ENV, TENANT_CLIENT_INSTALL_TOKEN_INFISICAL_PATH, TENANT_CLIENT_ISOLATION_RULES, TENANT_CLIENT_MANIFEST, TENANT_CLIENT_OPTIONAL_CONTEXT_FIELDS, TENANT_CLIENT_PRINCIPAL_TYPES, TENANT_CLIENT_PUBLIC_IMPORTS, TENANT_CLIENT_REQUIRED_CONTEXT_FIELDS, TENANT_CLIENT_REQUIRED_SDK_NAMESPACES, TOKENS_PER_WORD, WEBHOOK_MAX_ATTEMPTS, WEBHOOK_RETRY_DELAYS_MS, WORKFLOW_ACTION_KINDS, WORKFLOW_APPROVAL_MODES, WORKFLOW_AUTO_FIX_MODES, WORKFLOW_HOOK_EVENTS, WORKFLOW_INTEGRITY_CHECKS, WORKFLOW_MUTATION_TIERS, WORKFLOW_OUTPUT_KINDS, WORKFLOW_PROOF_ARTIFACT_KINDS, WORKFLOW_RUNTIME_SCHEMA_VERSION, WORKFLOW_RUN_STATUSES, WORKFLOW_STAFFING_HINTS, WORKFLOW_TRIGGER_KINDS, WORKTREE_PHASES, assertEdgePolicyAllowed, assertTenantClientImportAllowed, bigramTokenize, buildDomainEvent, buildTenantBootstrapTemplateSeedRows, classifyTenantClientImport, collectTopicNeighborhood, compareEventCursor, dsl_exports as contractDsl, createEventId, createEvidenceProjection, decodeEventCursor, decodePrefixedId, defineProjection, edgePolicyManifest, emitDomainEvent, encodeEventCursor, encodePrefixedId, fillGraphIntelligencePromptTemplate, findEdgePolicy, findInfisicalRuntimePath, findInfisicalRuntimeSurface, findTenantBootstrapSeedTable, findTenantBootstrapTableRequirement, findTenantClientInstallablePackage, formatTenantClientImportViolation, getComponentBoundaryTableLayer, getGraphIntelligenceQuery, hasPrefixedIdPrefix, inferActorType, inferSessionPrincipalType, isAfterCursor, isComponentBoundaryComponentOwnedTable, isGraphIntelligenceQueryMode, isLucernPrompt, isTenantBootstrapForbiddenSeedTable, isTenantBootstrapSeedTable, isTenantClientAllowedImport, isTenantClientComponentConfigImport, isTenantClientInstallablePackage, isTenantClientPublicImport, jaccardSimilarity, lastDelegator, listBeliefsProjection, listGraphIntelligenceQueries, listTasksProjection, tool_contracts_exports as mcpToolsContract, modulateConfidenceProjection, normalizeDelegationChain, normalizeRetentionDays, prepareLexicalQuery, projections, rankEntityConnections, rankEntityTypeMatches, rankWindowScore, requireActorPrincipalId, rerankLexicalWindow, schemas_exports as schemaContracts, scoreEntityConnection, scoreEntityTypeMatch, scoreLexicalSignal, scoreLexicalSignals, sdk_tools_contract_exports as sdkToolsContract, sortEventsByCursor, stemToken, tokenOverlapScore, tokenizeSearchText, wordOverlapScore, wordTokenize };
11597
14747
  //# sourceMappingURL=index.js.map
11598
14748
  //# sourceMappingURL=index.js.map