@lucern/sdk 0.3.0-alpha.3 → 0.3.0-alpha.5

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 (136) hide show
  1. package/README.md +47 -0
  2. package/dist/adminClient.js +4 -3
  3. package/dist/adminClient.js.map +1 -1
  4. package/dist/answersClient.js +4 -3
  5. package/dist/answersClient.js.map +1 -1
  6. package/dist/audiencesClient.js +4 -3
  7. package/dist/audiencesClient.js.map +1 -1
  8. package/dist/auditClient.js +4 -3
  9. package/dist/auditClient.js.map +1 -1
  10. package/dist/authContext.js +4 -3
  11. package/dist/authContext.js.map +1 -1
  12. package/dist/beliefs/index.d.ts +3 -1
  13. package/dist/beliefs/index.js +333 -7
  14. package/dist/beliefs/index.js.map +1 -1
  15. package/dist/beliefsClient.js +4 -3
  16. package/dist/beliefsClient.js.map +1 -1
  17. package/dist/client.d.ts +2981 -40
  18. package/dist/client.js +333 -7
  19. package/dist/client.js.map +1 -1
  20. package/dist/contextClient.js +4 -3
  21. package/dist/contextClient.js.map +1 -1
  22. package/dist/contracts/api-enums.contract.d.ts +1 -1
  23. package/dist/contracts/api-enums.contract.js.map +1 -1
  24. package/dist/contracts/index.js.map +1 -1
  25. package/dist/contradictions/index.d.ts +3 -1
  26. package/dist/contradictions/index.js +333 -7
  27. package/dist/contradictions/index.js.map +1 -1
  28. package/dist/coreClient.js +4 -3
  29. package/dist/coreClient.js.map +1 -1
  30. package/dist/decisions/index.d.ts +3 -1
  31. package/dist/decisions/index.js +333 -7
  32. package/dist/decisions/index.js.map +1 -1
  33. package/dist/decisionsClient.js +4 -3
  34. package/dist/decisionsClient.js.map +1 -1
  35. package/dist/edges/index.d.ts +3 -1
  36. package/dist/edges/index.js +333 -7
  37. package/dist/edges/index.js.map +1 -1
  38. package/dist/embeddingsClient.js +4 -3
  39. package/dist/embeddingsClient.js.map +1 -1
  40. package/dist/eventingClient.js +4 -3
  41. package/dist/eventingClient.js.map +1 -1
  42. package/dist/eventsCore.js +4 -3
  43. package/dist/eventsCore.js.map +1 -1
  44. package/dist/evidence/index.d.ts +3 -1
  45. package/dist/evidence/index.js +333 -7
  46. package/dist/evidence/index.js.map +1 -1
  47. package/dist/evidenceClient.js +4 -3
  48. package/dist/evidenceClient.js.map +1 -1
  49. package/dist/functionSurface.d.ts +129 -0
  50. package/dist/functionSurface.js +1118 -0
  51. package/dist/functionSurface.js.map +1 -0
  52. package/dist/functionSurfaceClient.d.ts +8 -0
  53. package/dist/functionSurfaceClient.js +1118 -0
  54. package/dist/functionSurfaceClient.js.map +1 -0
  55. package/dist/gatewayFacades.d.ts +34 -1
  56. package/dist/gatewayFacades.js +4 -3
  57. package/dist/gatewayFacades.js.map +1 -1
  58. package/dist/graphAnalysisClient.d.ts +53 -1
  59. package/dist/graphAnalysisClient.js +31 -4
  60. package/dist/graphAnalysisClient.js.map +1 -1
  61. package/dist/graphClient.js +4 -3
  62. package/dist/graphClient.js.map +1 -1
  63. package/dist/graphIntel.d.ts +3 -0
  64. package/dist/graphIntel.js +3 -0
  65. package/dist/graphIntel.js.map +1 -0
  66. package/dist/graphIntelligence.d.ts +2 -0
  67. package/dist/graphIntelligence.js +47 -0
  68. package/dist/graphIntelligence.js.map +1 -0
  69. package/dist/graphRecommendationsClient.js +4 -3
  70. package/dist/graphRecommendationsClient.js.map +1 -1
  71. package/dist/graphStateClassifierClient.js +4 -3
  72. package/dist/graphStateClassifierClient.js.map +1 -1
  73. package/dist/harnessClient.js +4 -3
  74. package/dist/harnessClient.js.map +1 -1
  75. package/dist/identityClient.js +4 -3
  76. package/dist/identityClient.js.map +1 -1
  77. package/dist/index.d.ts +8 -3
  78. package/dist/index.js +670 -8
  79. package/dist/index.js.map +1 -1
  80. package/dist/infisicalRuntime.d.ts +42 -0
  81. package/dist/infisicalRuntime.js +291 -0
  82. package/dist/infisicalRuntime.js.map +1 -0
  83. package/dist/jobsClient.js +4 -3
  84. package/dist/jobsClient.js.map +1 -1
  85. package/dist/learningClient.js +4 -3
  86. package/dist/learningClient.js.map +1 -1
  87. package/dist/lenses/index.d.ts +28 -2
  88. package/dist/lenses/index.js +333 -7
  89. package/dist/lenses/index.js.map +1 -1
  90. package/dist/mcpClient.js +4 -3
  91. package/dist/mcpClient.js.map +1 -1
  92. package/dist/modelRuntimeClient.js +4 -3
  93. package/dist/modelRuntimeClient.js.map +1 -1
  94. package/dist/nodes/index.d.ts +21 -1
  95. package/dist/nodes/index.js +333 -7
  96. package/dist/nodes/index.js.map +1 -1
  97. package/dist/ontologies/index.d.ts +3 -1
  98. package/dist/ontologies/index.js +333 -7
  99. package/dist/ontologies/index.js.map +1 -1
  100. package/dist/ontologyClient.js +4 -3
  101. package/dist/ontologyClient.js.map +1 -1
  102. package/dist/ontologyLinksClient.js +4 -3
  103. package/dist/ontologyLinksClient.js.map +1 -1
  104. package/dist/orgGraphSearchClient.js +4 -3
  105. package/dist/orgGraphSearchClient.js.map +1 -1
  106. package/dist/packRuntime.d.ts +2 -1
  107. package/dist/packsClient.js +4 -3
  108. package/dist/packsClient.js.map +1 -1
  109. package/dist/policyClient.js +4 -3
  110. package/dist/policyClient.js.map +1 -1
  111. package/dist/questions/index.d.ts +3 -1
  112. package/dist/questions/index.js +333 -7
  113. package/dist/questions/index.js.map +1 -1
  114. package/dist/reportsClient.js +4 -3
  115. package/dist/reportsClient.js.map +1 -1
  116. package/dist/schemaClient.js +4 -3
  117. package/dist/schemaClient.js.map +1 -1
  118. package/dist/sourcesClient.js +4 -3
  119. package/dist/sourcesClient.js.map +1 -1
  120. package/dist/telemetryClient.js +4 -3
  121. package/dist/telemetryClient.js.map +1 -1
  122. package/dist/toolRegistryClient.js +4 -3
  123. package/dist/toolRegistryClient.js.map +1 -1
  124. package/dist/topics/index.d.ts +3 -1
  125. package/dist/topics/index.js +333 -7
  126. package/dist/topics/index.js.map +1 -1
  127. package/dist/topicsClient.js +4 -3
  128. package/dist/topicsClient.js.map +1 -1
  129. package/dist/workflowClient.d.ts +41 -7
  130. package/dist/workflowClient.js +4 -3
  131. package/dist/workflowClient.js.map +1 -1
  132. package/dist/worktrees/index.d.ts +29 -3
  133. package/dist/worktrees/index.js +333 -7
  134. package/dist/worktrees/index.js.map +1 -1
  135. package/package.json +12 -3
  136. package/dist/client-EiG9nJOY.d.ts +0 -2911
package/dist/index.js CHANGED
@@ -2,6 +2,10 @@ import { z } from 'zod';
2
2
  import { MCP_GATEWAY_EVALUATE_RESEARCH_CONTRACT_ENDPOINT, MCP_GATEWAY_EVALUATE_ENGINEERING_CONTRACT_ENDPOINT, MCP_GATEWAY_BEGIN_BUILD_SESSION_ENDPOINT, MCP_GATEWAY_WRITE_POLICY_CHECK_ENDPOINT, MCP_GATEWAY_BOOTSTRAP_ENDPOINT } from '@lucern/contracts/mcp-gateway-boundary.contract';
3
3
  import * as tool_contracts_star from '@lucern/contracts/tool-contracts';
4
4
  import { LUCERN_OPERATION_MANIFEST } from '@lucern/contracts/function-registry/manifest';
5
+ import * as graphIntel_star from '@lucern/reasoning-kernel/graphIntel';
6
+ import { listGraphIntelligenceQueries, isGraphIntelligenceQueryMode, getGraphIntelligenceQuery, fillGraphIntelligencePromptTemplate, GRAPH_INTELLIGENCE_QUICK_QUERIES, GRAPH_INTELLIGENCE_QUERY_MODES, GRAPH_INTELLIGENCE_QUERY_CATEGORIES, GRAPH_INTELLIGENCE_QUERY_CATALOG_VERSION, GRAPH_INTELLIGENCE_QUERIES_WITH_TOOLS, GRAPH_INTELLIGENCE_QUERIES, GRAPH_INTELLIGENCE_PUBLIC_TOOL_NAMES, GRAPH_INTELLIGENCE_MODE_TOOL_NAMES } from '@lucern/contracts/graph-intelligence.contract';
7
+ export { 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, fillGraphIntelligencePromptTemplate, getGraphIntelligenceQuery, isGraphIntelligenceQueryMode, listGraphIntelligenceQueries } from '@lucern/contracts/graph-intelligence.contract';
8
+ import { INFISICAL_RUNTIME_MANIFEST, INFISICAL_RUNTIME_DEFAULT_PROJECT_ID, INFISICAL_RUNTIME_DEFAULT_API_URL, findInfisicalRuntimeSurface, findInfisicalRuntimePath } from '@lucern/contracts';
5
9
 
6
10
  var __defProp = Object.defineProperty;
7
11
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -56,8 +60,17 @@ __export(src_exports, {
56
60
  GRAPH_ANALYSIS_ANALYSIS_FIELDS: () => GRAPH_ANALYSIS_ANALYSIS_FIELDS,
57
61
  GRAPH_ANALYSIS_COMPUTE_FIELDS: () => GRAPH_ANALYSIS_COMPUTE_FIELDS,
58
62
  GRAPH_ANALYSIS_SUGGESTION_FIELDS: () => GRAPH_ANALYSIS_SUGGESTION_FIELDS,
63
+ GRAPH_INTELLIGENCE_MODE_TOOL_NAMES: () => GRAPH_INTELLIGENCE_MODE_TOOL_NAMES,
64
+ GRAPH_INTELLIGENCE_PUBLIC_TOOL_NAMES: () => GRAPH_INTELLIGENCE_PUBLIC_TOOL_NAMES,
65
+ GRAPH_INTELLIGENCE_QUERIES: () => GRAPH_INTELLIGENCE_QUERIES,
66
+ GRAPH_INTELLIGENCE_QUERIES_WITH_TOOLS: () => GRAPH_INTELLIGENCE_QUERIES_WITH_TOOLS,
67
+ GRAPH_INTELLIGENCE_QUERY_CATALOG_VERSION: () => GRAPH_INTELLIGENCE_QUERY_CATALOG_VERSION,
68
+ GRAPH_INTELLIGENCE_QUERY_CATEGORIES: () => GRAPH_INTELLIGENCE_QUERY_CATEGORIES,
69
+ GRAPH_INTELLIGENCE_QUERY_MODES: () => GRAPH_INTELLIGENCE_QUERY_MODES,
70
+ GRAPH_INTELLIGENCE_QUICK_QUERIES: () => GRAPH_INTELLIGENCE_QUICK_QUERIES,
59
71
  GRAPH_RECOMMENDATION_FIELDS: () => GRAPH_RECOMMENDATION_FIELDS,
60
72
  GRAPH_STATE_CLASSIFIER_FIELDS: () => GRAPH_STATE_CLASSIFIER_FIELDS,
73
+ InfisicalRuntimeError: () => InfisicalRuntimeError,
61
74
  JOBS_FIELDS: () => JOBS_FIELDS,
62
75
  JUDGMENT_TYPES: () => JUDGMENT_TYPES,
63
76
  LENS_PERSPECTIVE_TYPES: () => LENS_PERSPECTIVE_TYPES,
@@ -97,6 +110,7 @@ __export(src_exports, {
97
110
  WORKFLOW_STAFFING_HINTS: () => WORKFLOW_STAFFING_HINTS,
98
111
  WORKFLOW_TRIGGER_KINDS: () => WORKFLOW_TRIGGER_KINDS,
99
112
  WORKTREE_PHASES: () => WORKTREE_PHASES,
113
+ applyInfisicalRuntimeEnv: () => applyInfisicalRuntimeEnv,
100
114
  asListItems: () => asListItems,
101
115
  assertValidWebhookSecret: () => assertValidWebhookSecret,
102
116
  assertValidWebhookUrl: () => assertValidWebhookUrl,
@@ -153,20 +167,26 @@ __export(src_exports, {
153
167
  emitDomainEvent: () => emitDomainEvent,
154
168
  encodeEventCursor: () => encodeEventCursor,
155
169
  eventPatternToRegExp: () => eventPatternToRegExp,
170
+ fillGraphIntelligencePromptTemplate: () => fillGraphIntelligencePromptTemplate,
156
171
  getControlObjectOwnershipCase: () => getControlObjectOwnershipCase,
172
+ getGraphIntelligenceQuery: () => getGraphIntelligenceQuery,
157
173
  getMcpToolExposure: () => getMcpToolExposure,
158
174
  getRegisteredCustomTool: () => getRegisteredCustomTool,
175
+ hydrateInfisicalRuntimeEnv: () => hydrateInfisicalRuntimeEnv,
159
176
  inferActorType: () => inferActorType,
160
177
  inferLensPerspectiveTypeFromBranchSchema: () => inferLensPerspectiveTypeFromBranchSchema,
161
178
  inferSessionPrincipalType: () => inferSessionPrincipalType,
162
179
  invokeRegisteredCustomTool: () => invokeRegisteredCustomTool,
163
180
  isAfterCursor: () => isAfterCursor,
181
+ isGraphIntelligenceQueryMode: () => isGraphIntelligenceQueryMode,
182
+ isInfisicalRuntimeDisabled: () => isInfisicalRuntimeDisabled,
164
183
  isLensFilterCriteria: () => isLensFilterCriteria,
165
184
  isLucernPrompt: () => isLucernPrompt,
166
185
  isMcpToolAllowed: () => isMcpToolAllowed,
167
186
  isTaxonomyFilterCriteriaV1: () => isTaxonomyFilterCriteriaV1,
168
187
  lastDelegator: () => lastDelegator,
169
188
  listControlObjectOwnershipCases: () => listControlObjectOwnershipCases,
189
+ listGraphIntelligenceQueries: () => listGraphIntelligenceQueries,
170
190
  listRegisteredCustomTools: () => listRegisteredCustomTools,
171
191
  mapAliasedList: () => mapAliasedList,
172
192
  mapGatewayData: () => mapGatewayData,
@@ -189,6 +209,7 @@ __export(src_exports, {
189
209
  opinionFromProjected: () => opinionFromProjected,
190
210
  planContextPackCompilation: () => planContextPackCompilation,
191
211
  randomIdempotencyKey: () => randomIdempotencyKey,
212
+ readInfisicalRuntimeBootstrap: () => readInfisicalRuntimeBootstrap,
192
213
  registerCustomTool: () => registerCustomTool,
193
214
  resolveDeliveryFailureStatus: () => resolveDeliveryFailureStatus,
194
215
  resolveText: () => resolveText,
@@ -320,14 +341,15 @@ function normalizeCanonicalLucernAuthContext(input) {
320
341
  );
321
342
  const roles = cleanStringList(input.roles);
322
343
  const scopes = cleanStringList(input.scopes);
323
- if (roles.length === 0 || scopes.length === 0) {
344
+ const principalType = requirePrincipalType(input.principalType);
345
+ const authMode = requireAuthMode(input.authMode);
346
+ const roleBasedInteractiveAuth = authMode === "interactive_user" && roles.length > 0;
347
+ if (roles.length === 0 || scopes.length === 0 && !roleBasedInteractiveAuth) {
324
348
  throw new LucernSdkAuthContextError(
325
349
  "membership_missing",
326
350
  "Canonical Lucern SDK auth context requires non-empty roles and scopes."
327
351
  );
328
352
  }
329
- const principalType = requirePrincipalType(input.principalType);
330
- const authMode = requireAuthMode(input.authMode);
331
353
  const subject = cleanString(input.permit?.subject) ?? principalId;
332
354
  const tenant = cleanString(input.permit?.tenant) ?? tenantId;
333
355
  const workspace = cleanString(input.permit?.workspace) ?? workspaceId;
@@ -4350,9 +4372,33 @@ function graphAnalysisQuery(input) {
4350
4372
  cursor: input.cursor
4351
4373
  };
4352
4374
  }
4375
+ function normalizeRunQueryPayload(input) {
4376
+ return {
4377
+ ...input,
4378
+ topicId: requireTopicId2(input),
4379
+ projectId: void 0
4380
+ };
4381
+ }
4353
4382
  function createGraphAnalysisClient(config = {}) {
4354
4383
  const gateway = createGatewayRequestClient(config);
4355
4384
  return {
4385
+ listGraphIntelligenceQueries(input = {}) {
4386
+ return gateway.request({
4387
+ path: "/api/platform/v1/graph-intelligence/queries",
4388
+ method: "POST",
4389
+ body: {
4390
+ categoryId: input.categoryId,
4391
+ mode: input.mode
4392
+ }
4393
+ });
4394
+ },
4395
+ runGraphIntelligenceQuery(input) {
4396
+ return gateway.request({
4397
+ path: "/api/platform/v1/graph-intelligence/run",
4398
+ method: "POST",
4399
+ body: normalizeRunQueryPayload(input)
4400
+ });
4401
+ },
4356
4402
  saveAnalysis(input, idempotencyKey) {
4357
4403
  return gateway.request({
4358
4404
  path: "/api/platform/v1/graph-analysis/analyses",
@@ -4434,7 +4480,9 @@ function createGraphAnalysisClient(config = {}) {
4434
4480
  topicId: requireTopicId2(input),
4435
4481
  workspaceId: input.workspaceId,
4436
4482
  analysisId: input.analysisId,
4437
- since: input.since,
4483
+ minimumCreatedAt: input.minimumCreatedAt ?? input.since ?? input.createdAt ?? input.analysisCreatedAt,
4484
+ sourceNodeIds: input.sourceNodeIds?.join(",") ?? (input.nodeId ? input.nodeId : void 0),
4485
+ sourceEdgeIds: input.sourceEdgeIds?.join(",") ?? (input.edgeId ? input.edgeId : void 0),
4438
4486
  limit: input.limit,
4439
4487
  cursor: input.cursor
4440
4488
  })}`
@@ -5236,6 +5284,8 @@ var FUNCTION_SURFACE_METHOD_PATHS = [
5236
5284
  "graph.getTopicCoverage",
5237
5285
  "graph.traceEntityImpact",
5238
5286
  "graph.traverseGraph",
5287
+ "graphAnalysis.listGraphIntelligenceQueries",
5288
+ "graphAnalysis.runGraphIntelligenceQuery",
5239
5289
  "identity.checkPermission",
5240
5290
  "identity.filterByPermission",
5241
5291
  "identity.whoami",
@@ -5279,6 +5329,7 @@ var FUNCTION_SURFACE_METHOD_PATHS = [
5279
5329
  "topics.updateTopic",
5280
5330
  "worktrees.activateWorktree",
5281
5331
  "worktrees.addWorktree",
5332
+ "worktrees.beginBuildSession",
5282
5333
  "worktrees.listAllWorktrees",
5283
5334
  "worktrees.listCampaigns",
5284
5335
  "worktrees.listWorktrees",
@@ -5301,6 +5352,7 @@ var CONTRACTS = {
5301
5352
  "archive_belief": { method: "DELETE", path: "/beliefs", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
5302
5353
  "archive_ontology": { method: "DELETE", path: "/ontologies", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
5303
5354
  "archive_question": { method: "DELETE", path: "/questions", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
5355
+ "begin_build_session": { method: "POST", path: "/mcp/build-session/begin", kind: "mutation", idempotent: true, surfaceIntent: "system" },
5304
5356
  "bisect_confidence": { method: "POST", path: "/beliefs/confidence/bisect", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
5305
5357
  "broadcast_message": { method: "POST", path: "/coordination/messages/broadcast", kind: "mutation", idempotent: true, surfaceIntent: "system" },
5306
5358
  "check_permission": { method: "POST", path: "/identity/check-permission", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
@@ -5363,6 +5415,7 @@ var CONTRACTS = {
5363
5415
  "list_beliefs": { method: "GET", path: "/beliefs", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
5364
5416
  "list_campaigns": { method: "GET", path: "/worktrees/campaigns", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
5365
5417
  "list_evidence": { method: "GET", path: "/evidence", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
5418
+ "list_graph_intelligence_queries": { method: "POST", path: "/graph-intelligence/queries", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
5366
5419
  "list_lenses": { method: "GET", path: "/lenses", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
5367
5420
  "list_ontologies": { method: "GET", path: "/ontologies", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
5368
5421
  "list_questions": { method: "GET", path: "/questions", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
@@ -5386,6 +5439,7 @@ var CONTRACTS = {
5386
5439
  "register_session": { method: "POST", path: "/coordination/register-session", kind: "mutation", idempotent: true, surfaceIntent: "system" },
5387
5440
  "remove_lens_from_topic": { method: "DELETE", path: "/lenses/apply", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
5388
5441
  "resolve_effective_ontology": { method: "POST", path: "/ontologies/effective", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
5442
+ "run_graph_intelligence_query": { method: "POST", path: "/graph-intelligence/run", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
5389
5443
  "search_beliefs": { method: "POST", path: "/beliefs/search", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
5390
5444
  "search_evidence": { method: "POST", path: "/evidence/search", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
5391
5445
  "seed_belief_lattice": { method: "POST", path: "/scope/belief-lattice/seed", kind: "mutation", idempotent: true, surfaceIntent: "system" },
@@ -5472,6 +5526,9 @@ function createFunctionSurfaceClient(config = {}) {
5472
5526
  archiveQuestion(input = {}, idempotencyKey) {
5473
5527
  return execute("archive_question", input, idempotencyKey);
5474
5528
  },
5529
+ beginBuildSession(input = {}, idempotencyKey) {
5530
+ return execute("begin_build_session", input, idempotencyKey);
5531
+ },
5475
5532
  bisectConfidence(input = {}, idempotencyKey) {
5476
5533
  return execute("bisect_confidence", input, idempotencyKey);
5477
5534
  },
@@ -5658,6 +5715,9 @@ function createFunctionSurfaceClient(config = {}) {
5658
5715
  listEvidence(input = {}, idempotencyKey) {
5659
5716
  return execute("list_evidence", input, idempotencyKey);
5660
5717
  },
5718
+ listGraphIntelligenceQueries(input = {}, idempotencyKey) {
5719
+ return execute("list_graph_intelligence_queries", input, idempotencyKey);
5720
+ },
5661
5721
  listLenses(input = {}, idempotencyKey) {
5662
5722
  return execute("list_lenses", input, idempotencyKey);
5663
5723
  },
@@ -5727,6 +5787,9 @@ function createFunctionSurfaceClient(config = {}) {
5727
5787
  resolveEffectiveOntology(input = {}, idempotencyKey) {
5728
5788
  return execute("resolve_effective_ontology", input, idempotencyKey);
5729
5789
  },
5790
+ runGraphIntelligenceQuery(input = {}, idempotencyKey) {
5791
+ return execute("run_graph_intelligence_query", input, idempotencyKey);
5792
+ },
5730
5793
  searchBeliefs(input = {}, idempotencyKey) {
5731
5794
  return execute("search_beliefs", input, idempotencyKey);
5732
5795
  },
@@ -7406,6 +7469,13 @@ function requireTopicId4(args) {
7406
7469
  }
7407
7470
  return topicId;
7408
7471
  }
7472
+ function requireTopicOrProjectId(args) {
7473
+ const topicId = args.topicId?.trim() || args.projectId?.trim() || void 0;
7474
+ if (!topicId) {
7475
+ throw new Error("topicId is required");
7476
+ }
7477
+ return topicId;
7478
+ }
7409
7479
  var AUDIT_NODE_REFERENCE_KEY_PATTERN = /(^|_)(id|nodeid|beliefid|resourceid|targetid|sourceid|subjectid|globalid|entityid|recordid|fromnodeid|tonodeid|linkednodeid|linkedbeliefid|nodeids|beliefids|resourceids)$/i;
7410
7480
  function matchesAuditNodeReference(value, nodeId) {
7411
7481
  if (Array.isArray(value)) {
@@ -7441,6 +7511,23 @@ function requireBaseRate(args) {
7441
7511
  function exposeGatewayData(response) {
7442
7512
  return Object.assign({}, response, response.data);
7443
7513
  }
7514
+ function sdkQueryString(input) {
7515
+ const params = new URLSearchParams();
7516
+ for (const [key, value] of Object.entries(input)) {
7517
+ if (value === void 0 || value === null) {
7518
+ continue;
7519
+ }
7520
+ if (Array.isArray(value)) {
7521
+ if (value.length > 0) {
7522
+ params.set(key, value.join(","));
7523
+ }
7524
+ continue;
7525
+ }
7526
+ params.set(key, String(value));
7527
+ }
7528
+ const serialized = params.toString();
7529
+ return serialized ? `?${serialized}` : "";
7530
+ }
7444
7531
  function createLucernClient(config = {}) {
7445
7532
  const gatewayConfig = toGatewayConfig(config);
7446
7533
  const beliefsClient = createBeliefsClient(gatewayConfig);
@@ -7861,6 +7948,30 @@ function createLucernClient(config = {}) {
7861
7948
  batchCreate(input, idempotencyKey) {
7862
7949
  return graphClient.batchCreateNodes(input, idempotencyKey);
7863
7950
  },
7951
+ listByTopicAndType(input) {
7952
+ return gateway.request({
7953
+ path: `/api/platform/v1/nodes${sdkQueryString({
7954
+ topicId: requireTopicOrProjectId(input),
7955
+ nodeType: input.nodeType,
7956
+ nodeTypes: input.nodeTypes,
7957
+ query: input.query,
7958
+ sourceText: input.sourceText,
7959
+ limit: input.limit,
7960
+ cursor: input.cursor
7961
+ })}`
7962
+ }).then(exposeGatewayData);
7963
+ },
7964
+ countByTopicAndType(input) {
7965
+ return gateway.request({
7966
+ path: `/api/platform/v1/nodes/count${sdkQueryString({
7967
+ topicId: requireTopicOrProjectId(input),
7968
+ nodeType: input.nodeType,
7969
+ nodeTypes: input.nodeTypes,
7970
+ query: input.query,
7971
+ limit: input.limit
7972
+ })}`
7973
+ }).then(exposeGatewayData);
7974
+ },
7864
7975
  supersede(input, idempotencyKey) {
7865
7976
  return graphClient.supersedeNode(input, idempotencyKey);
7866
7977
  },
@@ -7871,6 +7982,78 @@ function createLucernClient(config = {}) {
7871
7982
  return graphClient.hardDeleteNode(input, idempotencyKey);
7872
7983
  }
7873
7984
  };
7985
+ const publicationNamespace = {
7986
+ create(input, idempotencyKey) {
7987
+ return gateway.request({
7988
+ path: "/api/platform/v1/publication",
7989
+ method: "POST",
7990
+ body: input,
7991
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
7992
+ }).then(exposeGatewayData);
7993
+ },
7994
+ update(publicationId, input, idempotencyKey) {
7995
+ return gateway.request({
7996
+ path: `/api/platform/v1/publication/${encodeURIComponent(
7997
+ publicationId
7998
+ )}`,
7999
+ method: "PATCH",
8000
+ body: input,
8001
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
8002
+ }).then(exposeGatewayData);
8003
+ },
8004
+ list(input = {}) {
8005
+ return gateway.request({
8006
+ path: `/api/platform/v1/publication${sdkQueryString(input)}`
8007
+ }).then(exposeGatewayData);
8008
+ },
8009
+ getByTopic(input) {
8010
+ const topicId = typeof input === "string" ? input : input.topicId;
8011
+ const workspaceId = typeof input === "string" ? void 0 : input.workspaceId;
8012
+ return gateway.request({
8013
+ path: `/api/platform/v1/publication/by-topic/${encodeURIComponent(
8014
+ topicId
8015
+ )}${sdkQueryString({ workspaceId })}`
8016
+ }).then(exposeGatewayData);
8017
+ },
8018
+ publish(publicationId, input = {}, idempotencyKey) {
8019
+ return gateway.request({
8020
+ path: `/api/platform/v1/publication/${encodeURIComponent(
8021
+ publicationId
8022
+ )}/publish`,
8023
+ method: "POST",
8024
+ body: input,
8025
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
8026
+ }).then(exposeGatewayData);
8027
+ },
8028
+ unpublish(publicationId, input = {}, idempotencyKey) {
8029
+ return gateway.request({
8030
+ path: `/api/platform/v1/publication/${encodeURIComponent(
8031
+ publicationId
8032
+ )}/unpublish`,
8033
+ method: "POST",
8034
+ body: input,
8035
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
8036
+ }).then(exposeGatewayData);
8037
+ },
8038
+ remove(publicationId, input = {}) {
8039
+ return gateway.request({
8040
+ path: `/api/platform/v1/publication/${encodeURIComponent(
8041
+ publicationId
8042
+ )}${sdkQueryString(input)}`,
8043
+ method: "DELETE"
8044
+ }).then(exposeGatewayData);
8045
+ }
8046
+ };
8047
+ const ontologyLinksNamespace = {
8048
+ ...ontologyLinksClient,
8049
+ resolveThemeSource(input) {
8050
+ return gateway.request({
8051
+ path: "/api/platform/v1/ontology-links/theme-source",
8052
+ method: "POST",
8053
+ body: input
8054
+ }).then(exposeGatewayData);
8055
+ }
8056
+ };
7874
8057
  return {
7875
8058
  config,
7876
8059
  version: LUCERN_SDK_VERSION,
@@ -8352,6 +8535,54 @@ function createLucernClient(config = {}) {
8352
8535
  }));
8353
8536
  }
8354
8537
  },
8538
+ themes: {
8539
+ listByTopic(input) {
8540
+ return gateway.request({
8541
+ path: `/api/platform/v1/themes${sdkQueryString({
8542
+ topicId: requireTopicOrProjectId(input),
8543
+ query: input.query,
8544
+ limit: input.limit,
8545
+ cursor: input.cursor
8546
+ })}`
8547
+ }).then(exposeGatewayData);
8548
+ }
8549
+ },
8550
+ graphSearch: {
8551
+ keywordSearchNodes(input) {
8552
+ return gateway.request({
8553
+ path: "/api/platform/v1/graph-search/keyword-nodes",
8554
+ method: "POST",
8555
+ body: {
8556
+ ...input,
8557
+ topicId: requireTopicOrProjectId(input),
8558
+ projectId: void 0
8559
+ }
8560
+ }).then(exposeGatewayData);
8561
+ }
8562
+ },
8563
+ classifiers: {
8564
+ listBeliefCandidates(input) {
8565
+ return gateway.request({
8566
+ path: `/api/platform/v1/classifiers/belief-candidates${sdkQueryString({
8567
+ topicId: requireTopicOrProjectId(input),
8568
+ classifierKey: input.classifierKey,
8569
+ query: input.query,
8570
+ limit: input.limit,
8571
+ cursor: input.cursor
8572
+ })}`
8573
+ }).then(exposeGatewayData);
8574
+ }
8575
+ },
8576
+ archetypes: {
8577
+ getJudgmentSignature(input) {
8578
+ return gateway.request({
8579
+ path: `/api/platform/v1/archetypes/judgment-signature${sdkQueryString({
8580
+ topicId: requireTopicOrProjectId(input),
8581
+ principalId: input.principalId
8582
+ })}`
8583
+ }).then(exposeGatewayData);
8584
+ }
8585
+ },
8355
8586
  judgments: {
8356
8587
  create(input) {
8357
8588
  return decisionsClient.createJudgment(input);
@@ -8393,6 +8624,52 @@ function createLucernClient(config = {}) {
8393
8624
  });
8394
8625
  }
8395
8626
  },
8627
+ decisions: {
8628
+ create(input) {
8629
+ return decisionsClient.createJudgment(input);
8630
+ },
8631
+ record(input) {
8632
+ return decisionsClient.recordJudgment(input);
8633
+ },
8634
+ list(query5) {
8635
+ return decisionsClient.listJudgments(query5);
8636
+ },
8637
+ get(decisionId) {
8638
+ return decisionsClient.getJudgment(decisionId);
8639
+ },
8640
+ recordOutcome(decisionId, input) {
8641
+ return decisionsClient.recordJudgmentOutcome(decisionId, input);
8642
+ },
8643
+ lessons(decisionId, input, idempotencyKey) {
8644
+ return gateway.request({
8645
+ path: `/api/platform/v1/decisions/${encodeURIComponent(
8646
+ decisionId
8647
+ )}/lessons`,
8648
+ method: "POST",
8649
+ body: input,
8650
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
8651
+ }).then(exposeGatewayData);
8652
+ },
8653
+ archive(decisionId, input = {}, idempotencyKey) {
8654
+ return gateway.request({
8655
+ path: `/api/platform/v1/decisions/${encodeURIComponent(
8656
+ decisionId
8657
+ )}/archive`,
8658
+ method: "POST",
8659
+ body: input,
8660
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
8661
+ }).then(exposeGatewayData);
8662
+ },
8663
+ readiness(topicId) {
8664
+ return decisionsClient.getJudgmentReadiness({ topicId });
8665
+ },
8666
+ calibration(topicId) {
8667
+ return decisionsClient.getJudgmentCalibration({ topicId });
8668
+ },
8669
+ pendingOutcomeReview(topicId) {
8670
+ return decisionsClient.listPendingJudgmentOutcomeReview({ topicId });
8671
+ }
8672
+ },
8396
8673
  worktrees: {
8397
8674
  createBranch(input) {
8398
8675
  return workflowClient.createBranch(input);
@@ -8415,7 +8692,21 @@ function createLucernClient(config = {}) {
8415
8692
  topicId: requireTopicId4(input),
8416
8693
  objective: input.objective,
8417
8694
  hypothesis: input.hypothesis,
8695
+ rationale: input.rationale,
8696
+ worktreeType: input.worktreeType,
8697
+ startDate: input.startDate,
8698
+ endDate: input.endDate,
8699
+ durationWeeks: input.durationWeeks,
8700
+ confidenceImpact: input.confidenceImpact,
8701
+ beliefFocus: input.beliefFocus,
8418
8702
  beliefIds: input.beliefIds,
8703
+ targetBeliefIds: input.targetBeliefIds,
8704
+ targetQuestionIds: input.targetQuestionIds,
8705
+ keyQuestions: input.keyQuestions,
8706
+ evidenceSignals: input.evidenceSignals,
8707
+ decisionGate: input.decisionGate,
8708
+ goCriteria: input.goCriteria,
8709
+ noGoSignals: input.noGoSignals,
8419
8710
  autoShape: input.autoShape,
8420
8711
  domainPackId: input.domainPackId,
8421
8712
  campaign: input.campaign,
@@ -8428,7 +8719,8 @@ function createLucernClient(config = {}) {
8428
8719
  proofArtifacts: input.proofArtifacts,
8429
8720
  staffingHint: typeof input.staffingHint === "string" ? input.staffingHint : void 0,
8430
8721
  lastReconciledAt: input.lastReconciledAt,
8431
- autoFixPolicy: input.autoFixPolicy
8722
+ autoFixPolicy: input.autoFixPolicy,
8723
+ lensId: input.lensId
8432
8724
  });
8433
8725
  },
8434
8726
  add(input) {
@@ -8437,7 +8729,21 @@ function createLucernClient(config = {}) {
8437
8729
  topicId: requireTopicId4(input),
8438
8730
  objective: input.objective,
8439
8731
  hypothesis: input.hypothesis,
8732
+ rationale: input.rationale,
8733
+ worktreeType: input.worktreeType,
8734
+ startDate: input.startDate,
8735
+ endDate: input.endDate,
8736
+ durationWeeks: input.durationWeeks,
8737
+ confidenceImpact: input.confidenceImpact,
8738
+ beliefFocus: input.beliefFocus,
8440
8739
  beliefIds: input.beliefIds,
8740
+ targetBeliefIds: input.targetBeliefIds,
8741
+ targetQuestionIds: input.targetQuestionIds,
8742
+ keyQuestions: input.keyQuestions,
8743
+ evidenceSignals: input.evidenceSignals,
8744
+ decisionGate: input.decisionGate,
8745
+ goCriteria: input.goCriteria,
8746
+ noGoSignals: input.noGoSignals,
8441
8747
  autoShape: input.autoShape,
8442
8748
  domainPackId: input.domainPackId,
8443
8749
  campaign: input.campaign,
@@ -8450,7 +8756,8 @@ function createLucernClient(config = {}) {
8450
8756
  proofArtifacts: input.proofArtifacts,
8451
8757
  staffingHint: typeof input.staffingHint === "string" ? input.staffingHint : void 0,
8452
8758
  lastReconciledAt: input.lastReconciledAt,
8453
- autoFixPolicy: input.autoFixPolicy
8759
+ autoFixPolicy: input.autoFixPolicy,
8760
+ lensId: input.lensId
8454
8761
  });
8455
8762
  },
8456
8763
  list(query5) {
@@ -8460,6 +8767,22 @@ function createLucernClient(config = {}) {
8460
8767
  limit: query5.limit
8461
8768
  });
8462
8769
  },
8770
+ listByTopic(query5) {
8771
+ return worktreesFacade.list({
8772
+ topicId: requireTopicId4(query5),
8773
+ status: query5.status,
8774
+ limit: query5.limit
8775
+ });
8776
+ },
8777
+ findByPairedSprint(input) {
8778
+ return gateway.request({
8779
+ path: `/api/platform/v1/worktrees/paired-sprint${sdkQueryString({
8780
+ sprintId: input.sprintId,
8781
+ topicId: input.topicId ?? input.projectId,
8782
+ limit: input.limit
8783
+ })}`
8784
+ }).then(exposeGatewayData);
8785
+ },
8463
8786
  activate(worktreeId) {
8464
8787
  return worktreesFacade.activate({ id: worktreeId });
8465
8788
  },
@@ -8611,6 +8934,31 @@ function createLucernClient(config = {}) {
8611
8934
  status: typeof input.status === "string" ? input.status : void 0,
8612
8935
  limit: typeof input.limit === "number" ? input.limit : void 0
8613
8936
  });
8937
+ },
8938
+ listByTopic(input) {
8939
+ return tasksFacade.list({
8940
+ topicId: requireTopicId4(input),
8941
+ status: typeof input.status === "string" ? input.status : void 0,
8942
+ limit: typeof input.limit === "number" ? input.limit : void 0
8943
+ });
8944
+ },
8945
+ listByWorktree(input) {
8946
+ return tasksFacade.list({
8947
+ topicId: typeof input.topicId === "string" ? input.topicId : void 0,
8948
+ worktreeId: input.worktreeId,
8949
+ status: typeof input.status === "string" ? input.status : void 0,
8950
+ limit: typeof input.limit === "number" ? input.limit : void 0
8951
+ });
8952
+ },
8953
+ linkChat(taskId, input, idempotencyKey) {
8954
+ return gateway.request({
8955
+ path: `/api/platform/v1/tasks/${encodeURIComponent(
8956
+ taskId
8957
+ )}/link-chat`,
8958
+ method: "POST",
8959
+ body: input,
8960
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
8961
+ }).then(exposeGatewayData);
8614
8962
  }
8615
8963
  },
8616
8964
  topics: {
@@ -8895,11 +9243,13 @@ function createLucernClient(config = {}) {
8895
9243
  graphAnalysis: graphAnalysisClient,
8896
9244
  graphRecommendations: graphRecommendationsClient,
8897
9245
  orgGraphSearch: orgGraphSearchClient,
8898
- ontologyLinks: ontologyLinksClient,
9246
+ ontologyLinks: ontologyLinksNamespace,
8899
9247
  graphStateClassifier: graphStateClassifierClient,
8900
9248
  modelRuntime: modelRuntimeClient,
8901
9249
  jobs: jobsClient,
8902
9250
  telemetry: telemetryClient,
9251
+ publication: publicationNamespace,
9252
+ contentPublication: publicationNamespace,
8903
9253
  tools: {
8904
9254
  listCatalog: toolRegistryClient.listCatalog,
8905
9255
  listExecutable: toolRegistryClient.listExecutable,
@@ -11368,6 +11718,318 @@ function createWebhooksClientCore(config = {}) {
11368
11718
  };
11369
11719
  }
11370
11720
 
11371
- export { BELIEF_STATUSES, BRANCH_DEPRECATION_MESSAGE, CANONICAL_WORKFLOW_DEFINITIONS, CONFIDENCE_TRIGGERS, CONTRADICTION_SEVERITIES, CONTRADICTION_STATUSES, CONTROL_OBJECT_BLAST_RADII, CONTROL_OBJECT_EDIT_SURFACES, CONTROL_OBJECT_INHERITANCE_RULES, CONTROL_OBJECT_KINDS, CONTROL_OBJECT_OWNERSHIP_CONTRACT, CONTROL_OBJECT_OWNERSHIP_MATRIX, CONTROL_OBJECT_OWNERSHIP_ROWS, CONTROL_OBJECT_OWNER_SCOPES, CustomToolRegistryError, DEFAULT_TIER_APPROVAL_MODE, DEFAULT_WORKFLOW_AUTO_FIX_POLICY, DEFEAT_TYPES, DOMAIN_EVENT_TYPES, DOMAIN_EVENT_VERSION, DeviceAuthorizationError, EDGE_TYPES, EMBEDDINGS_FIELDS, EPISTEMIC_EDGE_TYPES, EPISTEMIC_LAYERS, EVENTING_FIELDS, EVENT_RETENTION_DEFAULT_DAYS, FORK_REASONS, FUNCTION_SURFACE_METHOD_PATHS, GRAPH_ANALYSIS_ANALYSIS_FIELDS, GRAPH_ANALYSIS_COMPUTE_FIELDS, GRAPH_ANALYSIS_SUGGESTION_FIELDS, GRAPH_RECOMMENDATION_FIELDS, GRAPH_STATE_CLASSIFIER_FIELDS, JOBS_FIELDS, JUDGMENT_TYPES, LENS_PERSPECTIVE_TYPES, LENS_STATUSES, LENS_TASK_TEMPLATE_PRIORITIES, LUCERN_SDK_VERSION, LucernApiError, LucernSdkAuthContextError, MAX_ENTITY_LIMIT, MCP_ALWAYS_ALLOWED_TOOL_NAMES, MERGE_OUTCOMES, MODEL_RUNTIME_FIELDS, MORNING_BRIEF_WORKFLOW_ID, NIGHTLY_RECONCILIATION_WORKFLOW_ID, ONTOLOGY_LINK_FIELDS, ORG_GRAPH_SEARCH_FIELDS, REASONING_METHODS, SESSION_AUTH_MODES, SESSION_LIFECYCLE_STATUSES, SESSION_PRINCIPAL_TYPES, STRUCTURAL_EDGE_TYPES, TELEMETRY_FIELDS, TENANT_IDENTITY_FIELDS, TOOL_REGISTRY_FIELDS, 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, asListItems, assertValidWebhookSecret, assertValidWebhookUrl, buildDeprecatedBranchMetadata, buildDomainEvent, buildMcpToolContracts, buildMcpToolManifest, clearRegisteredCustomTools, compareEventCursor, compileContextPackFromSnapshot, computeWebhookSignature, createAdminClient, createAnswersClient, createAudiencesClient, createAuditClient, createAuthDeviceClient, createBeliefsClient, createCanonicalAuthHeaders, createContextClient, createContextFacade, createDecisionsClient, createEmbeddingsClient, createEventId, createEventingClient, createEventsClientCore, createEvidenceClient, createFunctionSurfaceClient, createGatewayRequestClient, createGraphAnalysisClient, createGraphClient, createGraphRecommendationsClient, createGraphStateClassifierClient, createHarnessClient, createIdentityClient, createJobsClient, createLearningClient, createListResult, createLucernClient, createModelRuntimeClient, createOntologyClient, createOntologyLinksClient, createOrgGraphSearchClient, createPacksClient, createPolicyClient, createReportsClient, createSchemaClient, createSourcesClient, createTelemetryClient, createToolRegistryClient, createTopicsClient, createWebhooksClientCore, createWorkflowClient, decodeEventCursor, emitDomainEvent, encodeEventCursor, eventPatternToRegExp, getControlObjectOwnershipCase, getMcpToolExposure, getRegisteredCustomTool, inferActorType, inferLensPerspectiveTypeFromBranchSchema, inferSessionPrincipalType, invokeRegisteredCustomTool, isAfterCursor, isLensFilterCriteria, isLucernPrompt, isMcpToolAllowed, isTaxonomyFilterCriteriaV1, lastDelegator, listControlObjectOwnershipCases, listRegisteredCustomTools, mapAliasedList, mapGatewayData, mapOpinionHistoryEntriesFromGatewayData, matchesAnyEventPattern, matchesEventPattern, mcpContractToInputSchema, mcpContractToManifestEntry, migrateBranchToLens, nextDeliveryAttemptAt, normalizeCanonicalLucernAuthContext, normalizeDelegationChain, normalizeNodeVerificationStatus, normalizeNodeWriteInput, normalizeRetentionDays, normalizeTopicQuery, normalizeWebhookPatterns, opinionFromBaseRate, opinionFromDogmatic, opinionFromProjected, planContextPackCompilation, randomIdempotencyKey, registerCustomTool, resolveDeliveryFailureStatus, resolveText, resolveTopicId, sanitizeWebhookRecord, sortEventsByCursor, toQueryString, truncateWebhookResponseBody, unregisterCustomTool, validateFilterCriteria, withSdkAliases, withTextAlias, withTopicAlias };
11721
+ // src/graphIntel.ts
11722
+ var graphIntel_exports = {};
11723
+ __reExport(graphIntel_exports, graphIntel_star);
11724
+
11725
+ // src/index.ts
11726
+ __reExport(src_exports, graphIntel_exports);
11727
+
11728
+ // src/graphIntelligence.ts
11729
+ var graphIntelligence_exports = {};
11730
+ __export(graphIntelligence_exports, {
11731
+ GRAPH_INTELLIGENCE_MODE_TOOL_NAMES: () => GRAPH_INTELLIGENCE_MODE_TOOL_NAMES,
11732
+ GRAPH_INTELLIGENCE_PUBLIC_TOOL_NAMES: () => GRAPH_INTELLIGENCE_PUBLIC_TOOL_NAMES,
11733
+ GRAPH_INTELLIGENCE_QUERIES: () => GRAPH_INTELLIGENCE_QUERIES,
11734
+ GRAPH_INTELLIGENCE_QUERIES_WITH_TOOLS: () => GRAPH_INTELLIGENCE_QUERIES_WITH_TOOLS,
11735
+ GRAPH_INTELLIGENCE_QUERY_CATALOG_VERSION: () => GRAPH_INTELLIGENCE_QUERY_CATALOG_VERSION,
11736
+ GRAPH_INTELLIGENCE_QUERY_CATEGORIES: () => GRAPH_INTELLIGENCE_QUERY_CATEGORIES,
11737
+ GRAPH_INTELLIGENCE_QUERY_MODES: () => GRAPH_INTELLIGENCE_QUERY_MODES,
11738
+ GRAPH_INTELLIGENCE_QUICK_QUERIES: () => GRAPH_INTELLIGENCE_QUICK_QUERIES,
11739
+ fillGraphIntelligencePromptTemplate: () => fillGraphIntelligencePromptTemplate,
11740
+ getGraphIntelligenceQuery: () => getGraphIntelligenceQuery,
11741
+ isGraphIntelligenceQueryMode: () => isGraphIntelligenceQueryMode,
11742
+ listGraphIntelligenceQueries: () => listGraphIntelligenceQueries
11743
+ });
11744
+ __reExport(graphIntelligence_exports, graphIntel_exports);
11745
+
11746
+ // src/index.ts
11747
+ __reExport(src_exports, graphIntelligence_exports);
11748
+ var InfisicalRuntimeError = class extends Error {
11749
+ code;
11750
+ status;
11751
+ constructor(args) {
11752
+ super(args.message);
11753
+ this.name = "InfisicalRuntimeError";
11754
+ this.code = args.code;
11755
+ this.status = args.status;
11756
+ }
11757
+ };
11758
+ function readInfisicalRuntimeBootstrap(env = {}, overrides = {}) {
11759
+ if (isInfisicalRuntimeDisabled(env)) {
11760
+ return null;
11761
+ }
11762
+ const bootstrapEnv = INFISICAL_RUNTIME_MANIFEST.bootstrapEnv;
11763
+ const clientId = overrides.clientId ?? readFirst(env, bootstrapEnv.clientId);
11764
+ const clientSecret = overrides.clientSecret ?? readFirst(env, bootstrapEnv.clientSecret);
11765
+ const hasAuthSignal = Boolean(clientId || clientSecret);
11766
+ if (!hasAuthSignal) {
11767
+ return null;
11768
+ }
11769
+ if (!clientId || !clientSecret) {
11770
+ throw new InfisicalRuntimeError({
11771
+ code: "INFISICAL_BOOTSTRAP_INCOMPLETE",
11772
+ message: "Infisical runtime bootstrap requires both INFISICAL_CLIENT_ID and INFISICAL_CLIENT_SECRET."
11773
+ });
11774
+ }
11775
+ return {
11776
+ apiUrl: overrides.apiUrl ?? readFirst(env, bootstrapEnv.apiUrl) ?? INFISICAL_RUNTIME_DEFAULT_API_URL,
11777
+ projectId: overrides.projectId ?? readFirst(env, bootstrapEnv.projectId) ?? INFISICAL_RUNTIME_DEFAULT_PROJECT_ID,
11778
+ clientId,
11779
+ clientSecret,
11780
+ environment: normalizeInfisicalEnvironment(
11781
+ overrides.environment ?? readFirst(env, bootstrapEnv.environment)
11782
+ ),
11783
+ organizationSlug: overrides.organizationSlug ?? readFirst(env, bootstrapEnv.organizationSlug)
11784
+ };
11785
+ }
11786
+ function isInfisicalRuntimeDisabled(env = {}) {
11787
+ return INFISICAL_RUNTIME_MANIFEST.bootstrapEnv.disabled.some(
11788
+ (name) => isTruthyEnv(env[name])
11789
+ );
11790
+ }
11791
+ async function hydrateInfisicalRuntimeEnv(options) {
11792
+ const env = options.env ?? {};
11793
+ const bootstrap = mergeBootstrap(
11794
+ readInfisicalRuntimeBootstrap(env, options.bootstrap),
11795
+ options.bootstrap
11796
+ );
11797
+ if (!bootstrap) {
11798
+ return {
11799
+ status: "disabled",
11800
+ surfaceId: options.surfaceId,
11801
+ values: {},
11802
+ sourcePaths: []
11803
+ };
11804
+ }
11805
+ const surface = findInfisicalRuntimeSurface(options.surfaceId);
11806
+ if (!surface) {
11807
+ throw new InfisicalRuntimeError({
11808
+ code: "INFISICAL_UNKNOWN_SURFACE",
11809
+ message: `Unknown Lucern Infisical runtime surface: ${options.surfaceId}.`
11810
+ });
11811
+ }
11812
+ if (surface.delivery !== "runtime_fetch") {
11813
+ throw new InfisicalRuntimeError({
11814
+ code: "INFISICAL_UNSUPPORTED_SURFACE_DELIVERY",
11815
+ message: `${surface.id} uses ${surface.delivery}; runtime fetch is only valid for runtime_fetch surfaces.`
11816
+ });
11817
+ }
11818
+ const fetchImpl = options.fetchImpl ?? globalThis.fetch;
11819
+ if (typeof fetchImpl !== "function") {
11820
+ throw new InfisicalRuntimeError({
11821
+ code: "INFISICAL_FETCH_UNAVAILABLE",
11822
+ message: "No fetch implementation is available for Infisical runtime hydration."
11823
+ });
11824
+ }
11825
+ const token = await loginWithUniversalAuth(bootstrap, fetchImpl);
11826
+ const values = {};
11827
+ const missingRequired = [];
11828
+ const sourcePaths = [];
11829
+ for (const pathId of surface.sourcePathIds) {
11830
+ const path = findInfisicalRuntimePath(pathId);
11831
+ if (!path) {
11832
+ throw new InfisicalRuntimeError({
11833
+ code: "INFISICAL_UNKNOWN_PATH",
11834
+ message: `Unknown Lucern Infisical runtime path: ${pathId}.`
11835
+ });
11836
+ }
11837
+ sourcePaths.push(path.secretPath);
11838
+ for (const variable of path.variables) {
11839
+ const runtimeVariable = variable;
11840
+ const secretValue = await readVariableSecret({
11841
+ bootstrap,
11842
+ fetchImpl,
11843
+ token,
11844
+ secretPath: path.secretPath,
11845
+ variable: runtimeVariable
11846
+ });
11847
+ if (!secretValue) {
11848
+ if (runtimeVariable.required) {
11849
+ missingRequired.push(runtimeVariable.name);
11850
+ }
11851
+ continue;
11852
+ }
11853
+ values[runtimeVariable.name] = secretValue.value;
11854
+ for (const alias of runtimeVariable.aliases ?? []) {
11855
+ values[alias] = secretValue.value;
11856
+ }
11857
+ }
11858
+ }
11859
+ if (missingRequired.length > 0) {
11860
+ throw new InfisicalRuntimeError({
11861
+ code: "INFISICAL_REQUIRED_SECRETS_MISSING",
11862
+ message: `Missing required Infisical runtime secrets: ${missingRequired.join(", ")}.`
11863
+ });
11864
+ }
11865
+ return {
11866
+ status: "hydrated",
11867
+ surfaceId: options.surfaceId,
11868
+ environment: bootstrap.environment,
11869
+ values,
11870
+ sourcePaths
11871
+ };
11872
+ }
11873
+ function applyInfisicalRuntimeEnv(result, targetEnv, options = {}) {
11874
+ for (const [key, value] of Object.entries(result.values)) {
11875
+ if (options.overrideExisting || !targetEnv[key]) {
11876
+ targetEnv[key] = value;
11877
+ }
11878
+ }
11879
+ }
11880
+ function normalizeInfisicalEnvironment(value) {
11881
+ if (value === "dev" || value === "staging" || value === "prod") {
11882
+ return value;
11883
+ }
11884
+ if (value === "development") {
11885
+ return "dev";
11886
+ }
11887
+ if (value === "production") {
11888
+ return "prod";
11889
+ }
11890
+ return "prod";
11891
+ }
11892
+ function mergeBootstrap(base, overrides) {
11893
+ if (!base) {
11894
+ return null;
11895
+ }
11896
+ return {
11897
+ ...base,
11898
+ ...compact(overrides ?? {}),
11899
+ apiUrl: trimTrailingSlash(overrides?.apiUrl ?? base.apiUrl)
11900
+ };
11901
+ }
11902
+ async function loginWithUniversalAuth(bootstrap, fetchImpl) {
11903
+ const response = await fetchImpl(
11904
+ `${trimTrailingSlash(bootstrap.apiUrl)}/api/v1/auth/universal-auth/login`,
11905
+ {
11906
+ method: "POST",
11907
+ headers: {
11908
+ "Content-Type": "application/json"
11909
+ },
11910
+ body: JSON.stringify({
11911
+ clientId: bootstrap.clientId,
11912
+ clientSecret: bootstrap.clientSecret,
11913
+ ...bootstrap.organizationSlug ? { organizationSlug: bootstrap.organizationSlug } : {}
11914
+ })
11915
+ }
11916
+ );
11917
+ const body4 = await readJson2(response);
11918
+ if (!response.ok) {
11919
+ throw new InfisicalRuntimeError({
11920
+ code: "INFISICAL_UNIVERSAL_AUTH_FAILED",
11921
+ status: response.status,
11922
+ message: `Infisical Universal Auth failed with HTTP ${response.status}: ${messageFromBody(body4)}`
11923
+ });
11924
+ }
11925
+ const accessToken = readNestedString(body4, ["accessToken"]);
11926
+ if (!accessToken) {
11927
+ throw new InfisicalRuntimeError({
11928
+ code: "INFISICAL_UNIVERSAL_AUTH_INVALID_RESPONSE",
11929
+ message: "Infisical Universal Auth response did not include accessToken."
11930
+ });
11931
+ }
11932
+ return accessToken;
11933
+ }
11934
+ async function readVariableSecret(args) {
11935
+ const names = [args.variable.name, ...args.variable.aliases ?? []];
11936
+ for (const name of names) {
11937
+ const value = await readSecretValue({
11938
+ bootstrap: args.bootstrap,
11939
+ fetchImpl: args.fetchImpl,
11940
+ token: args.token,
11941
+ secretPath: args.secretPath,
11942
+ name,
11943
+ optional: true
11944
+ });
11945
+ if (value) {
11946
+ return { name, value };
11947
+ }
11948
+ }
11949
+ return null;
11950
+ }
11951
+ async function readSecretValue(args) {
11952
+ const params = new URLSearchParams({
11953
+ projectId: args.bootstrap.projectId,
11954
+ environment: args.bootstrap.environment,
11955
+ secretPath: args.secretPath,
11956
+ type: "shared",
11957
+ viewSecretValue: "true",
11958
+ expandSecretReferences: "true",
11959
+ includeImports: "true"
11960
+ });
11961
+ const response = await args.fetchImpl(
11962
+ `${trimTrailingSlash(args.bootstrap.apiUrl)}/api/v4/secrets/${encodeURIComponent(args.name)}?${params.toString()}`,
11963
+ {
11964
+ method: "GET",
11965
+ headers: {
11966
+ Authorization: `Bearer ${args.token}`
11967
+ }
11968
+ }
11969
+ );
11970
+ const body4 = await readJson2(response);
11971
+ if (response.status === 404 && args.optional) {
11972
+ return null;
11973
+ }
11974
+ if (!response.ok) {
11975
+ throw new InfisicalRuntimeError({
11976
+ code: "INFISICAL_SECRET_READ_FAILED",
11977
+ status: response.status,
11978
+ message: `Infisical secret ${args.name} read failed with HTTP ${response.status}: ${messageFromBody(body4)}`
11979
+ });
11980
+ }
11981
+ return readNestedString(body4, ["secret", "secretValue"]);
11982
+ }
11983
+ async function readJson2(response) {
11984
+ try {
11985
+ return await response.json();
11986
+ } catch {
11987
+ return void 0;
11988
+ }
11989
+ }
11990
+ function readNestedString(value, path) {
11991
+ let current = value;
11992
+ for (const key of path) {
11993
+ if (!current || typeof current !== "object" || !(key in current)) {
11994
+ return null;
11995
+ }
11996
+ current = current[key];
11997
+ }
11998
+ return typeof current === "string" && current.length > 0 ? current : null;
11999
+ }
12000
+ function messageFromBody(body4) {
12001
+ if (!body4 || typeof body4 !== "object") {
12002
+ return "no response body";
12003
+ }
12004
+ const record = body4;
12005
+ for (const key of ["message", "error", "errorMessage"]) {
12006
+ if (typeof record[key] === "string") {
12007
+ return record[key];
12008
+ }
12009
+ }
12010
+ return JSON.stringify(body4);
12011
+ }
12012
+ function readFirst(env, names) {
12013
+ for (const name of names) {
12014
+ const value = env[name]?.trim();
12015
+ if (value) {
12016
+ return value;
12017
+ }
12018
+ }
12019
+ return void 0;
12020
+ }
12021
+ function isTruthyEnv(value) {
12022
+ return ["1", "true", "yes", "on"].includes(value?.toLowerCase() ?? "");
12023
+ }
12024
+ function trimTrailingSlash(value) {
12025
+ return value.replace(/\/+$/u, "");
12026
+ }
12027
+ function compact(value) {
12028
+ return Object.fromEntries(
12029
+ Object.entries(value).filter(([, entry]) => entry !== void 0)
12030
+ );
12031
+ }
12032
+
12033
+ export { BELIEF_STATUSES, BRANCH_DEPRECATION_MESSAGE, CANONICAL_WORKFLOW_DEFINITIONS, CONFIDENCE_TRIGGERS, CONTRADICTION_SEVERITIES, CONTRADICTION_STATUSES, CONTROL_OBJECT_BLAST_RADII, CONTROL_OBJECT_EDIT_SURFACES, CONTROL_OBJECT_INHERITANCE_RULES, CONTROL_OBJECT_KINDS, CONTROL_OBJECT_OWNERSHIP_CONTRACT, CONTROL_OBJECT_OWNERSHIP_MATRIX, CONTROL_OBJECT_OWNERSHIP_ROWS, CONTROL_OBJECT_OWNER_SCOPES, CustomToolRegistryError, DEFAULT_TIER_APPROVAL_MODE, DEFAULT_WORKFLOW_AUTO_FIX_POLICY, DEFEAT_TYPES, DOMAIN_EVENT_TYPES, DOMAIN_EVENT_VERSION, DeviceAuthorizationError, EDGE_TYPES, EMBEDDINGS_FIELDS, EPISTEMIC_EDGE_TYPES, EPISTEMIC_LAYERS, EVENTING_FIELDS, EVENT_RETENTION_DEFAULT_DAYS, FORK_REASONS, FUNCTION_SURFACE_METHOD_PATHS, GRAPH_ANALYSIS_ANALYSIS_FIELDS, GRAPH_ANALYSIS_COMPUTE_FIELDS, GRAPH_ANALYSIS_SUGGESTION_FIELDS, GRAPH_RECOMMENDATION_FIELDS, GRAPH_STATE_CLASSIFIER_FIELDS, InfisicalRuntimeError, JOBS_FIELDS, JUDGMENT_TYPES, LENS_PERSPECTIVE_TYPES, LENS_STATUSES, LENS_TASK_TEMPLATE_PRIORITIES, LUCERN_SDK_VERSION, LucernApiError, LucernSdkAuthContextError, MAX_ENTITY_LIMIT, MCP_ALWAYS_ALLOWED_TOOL_NAMES, MERGE_OUTCOMES, MODEL_RUNTIME_FIELDS, MORNING_BRIEF_WORKFLOW_ID, NIGHTLY_RECONCILIATION_WORKFLOW_ID, ONTOLOGY_LINK_FIELDS, ORG_GRAPH_SEARCH_FIELDS, REASONING_METHODS, SESSION_AUTH_MODES, SESSION_LIFECYCLE_STATUSES, SESSION_PRINCIPAL_TYPES, STRUCTURAL_EDGE_TYPES, TELEMETRY_FIELDS, TENANT_IDENTITY_FIELDS, TOOL_REGISTRY_FIELDS, 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, applyInfisicalRuntimeEnv, asListItems, assertValidWebhookSecret, assertValidWebhookUrl, buildDeprecatedBranchMetadata, buildDomainEvent, buildMcpToolContracts, buildMcpToolManifest, clearRegisteredCustomTools, compareEventCursor, compileContextPackFromSnapshot, computeWebhookSignature, createAdminClient, createAnswersClient, createAudiencesClient, createAuditClient, createAuthDeviceClient, createBeliefsClient, createCanonicalAuthHeaders, createContextClient, createContextFacade, createDecisionsClient, createEmbeddingsClient, createEventId, createEventingClient, createEventsClientCore, createEvidenceClient, createFunctionSurfaceClient, createGatewayRequestClient, createGraphAnalysisClient, createGraphClient, createGraphRecommendationsClient, createGraphStateClassifierClient, createHarnessClient, createIdentityClient, createJobsClient, createLearningClient, createListResult, createLucernClient, createModelRuntimeClient, createOntologyClient, createOntologyLinksClient, createOrgGraphSearchClient, createPacksClient, createPolicyClient, createReportsClient, createSchemaClient, createSourcesClient, createTelemetryClient, createToolRegistryClient, createTopicsClient, createWebhooksClientCore, createWorkflowClient, decodeEventCursor, emitDomainEvent, encodeEventCursor, eventPatternToRegExp, getControlObjectOwnershipCase, getMcpToolExposure, getRegisteredCustomTool, hydrateInfisicalRuntimeEnv, inferActorType, inferLensPerspectiveTypeFromBranchSchema, inferSessionPrincipalType, invokeRegisteredCustomTool, isAfterCursor, isInfisicalRuntimeDisabled, isLensFilterCriteria, isLucernPrompt, isMcpToolAllowed, isTaxonomyFilterCriteriaV1, lastDelegator, listControlObjectOwnershipCases, listRegisteredCustomTools, mapAliasedList, mapGatewayData, mapOpinionHistoryEntriesFromGatewayData, matchesAnyEventPattern, matchesEventPattern, mcpContractToInputSchema, mcpContractToManifestEntry, migrateBranchToLens, nextDeliveryAttemptAt, normalizeCanonicalLucernAuthContext, normalizeDelegationChain, normalizeNodeVerificationStatus, normalizeNodeWriteInput, normalizeRetentionDays, normalizeTopicQuery, normalizeWebhookPatterns, opinionFromBaseRate, opinionFromDogmatic, opinionFromProjected, planContextPackCompilation, randomIdempotencyKey, readInfisicalRuntimeBootstrap, registerCustomTool, resolveDeliveryFailureStatus, resolveText, resolveTopicId, sanitizeWebhookRecord, sortEventsByCursor, toQueryString, truncateWebhookResponseBody, unregisterCustomTool, validateFilterCriteria, withSdkAliases, withTextAlias, withTopicAlias };
11372
12034
  //# sourceMappingURL=index.js.map
11373
12035
  //# sourceMappingURL=index.js.map