@lucern/sdk 1.0.10 → 1.0.12

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 (331) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +35 -0
  3. package/dist/.generated +2 -0
  4. package/dist/accessControl.d.ts +19 -26
  5. package/dist/accessControl.js +195 -1423
  6. package/dist/adminClient.d.ts +52 -59
  7. package/dist/adminClient.js +364 -1142
  8. package/dist/answersClient.d.ts +5 -14
  9. package/dist/answersClient.js +19 -737
  10. package/dist/audience/index.d.ts +18 -18
  11. package/dist/audience/index.js +87 -90
  12. package/dist/audiencesClient.d.ts +19 -27
  13. package/dist/audiencesClient.js +107 -868
  14. package/dist/auditClient.d.ts +8 -15
  15. package/dist/auditClient.js +18 -791
  16. package/dist/authContext.d.ts +11 -16
  17. package/dist/authContext.js +122 -154
  18. package/dist/authDeviceClient.d.ts +8 -17
  19. package/dist/authDeviceClient.js +113 -102
  20. package/dist/beliefs/index.d.ts +15 -67
  21. package/dist/beliefs/index.js +17 -10172
  22. package/dist/beliefs/lifecycle.d.ts +10 -11
  23. package/dist/beliefs/lifecycle.js +78 -80
  24. package/dist/beliefsClient.d.ts +26 -32
  25. package/dist/beliefsClient.js +250 -990
  26. package/dist/boundaryClientSurface.d.ts +11 -16
  27. package/dist/boundaryClientSurface.js +49 -68
  28. package/dist/client.d.ts +73 -112
  29. package/dist/client.js +232 -10146
  30. package/dist/clientAssemblyTypes.d.ts +3 -3
  31. package/dist/clientAssemblyTypes.js +1 -2
  32. package/dist/clientConfig.d.ts +45 -59
  33. package/dist/clientConfig.js +1 -2
  34. package/dist/clientEvidenceCompat.d.ts +7 -14
  35. package/dist/clientEvidenceCompat.js +50 -64
  36. package/dist/clientGraphNamespaces.d.ts +3 -5
  37. package/dist/clientGraphNamespaces.js +170 -245
  38. package/dist/clientHelpers.d.ts +20 -25
  39. package/dist/clientHelpers.js +104 -127
  40. package/dist/clientKnowledgeNamespaces.d.ts +6 -53
  41. package/dist/clientKnowledgeNamespaces.js +502 -506
  42. package/dist/clientLocalHelpers.d.ts +11 -56
  43. package/dist/clientLocalHelpers.js +503 -732
  44. package/dist/clientPlatformNamespaces.d.ts +14 -53
  45. package/dist/clientPlatformNamespaces.js +229 -314
  46. package/dist/clientRuntime.d.ts +5 -53
  47. package/dist/clientRuntime.js +26 -30
  48. package/dist/clientWorkflowNamespaces.d.ts +6 -15
  49. package/dist/clientWorkflowNamespaces.js +529 -596
  50. package/dist/contextClient.d.ts +9 -17
  51. package/dist/contextClient.js +92 -805
  52. package/dist/contextFacade.d.ts +11 -2
  53. package/dist/contextFacade.js +10 -81
  54. package/dist/contextPackCompiler.d.ts +10 -11
  55. package/dist/contextPackCompiler.js +494 -1040
  56. package/dist/contextPackPolicy.d.ts +14 -15
  57. package/dist/contextPackPolicy.js +227 -305
  58. package/dist/contextPackSchema.d.ts +3 -3
  59. package/dist/contextPackSchema.js +169 -176
  60. package/dist/contextTypes.d.ts +14 -15
  61. package/dist/contextTypes.js +1 -2
  62. package/dist/contracts/api-enums.contract.d.ts +29 -30
  63. package/dist/contracts/api-enums.contract.js +162 -88
  64. package/dist/contracts/auth-session.contract.d.ts +13 -14
  65. package/dist/contracts/auth-session.contract.js +55 -52
  66. package/dist/contracts/context-pack.contract.d.ts +54 -55
  67. package/dist/contracts/context-pack.contract.js +160 -88
  68. package/dist/contracts/contextPack.d.ts +2 -1
  69. package/dist/contracts/contextPack.js +1 -97
  70. package/dist/contracts/index.d.ts +11 -12
  71. package/dist/contracts/index.js +10 -854
  72. package/dist/contracts/lens-filter.contract.d.ts +9 -10
  73. package/dist/contracts/lens-filter.contract.js +82 -58
  74. package/dist/contracts/lens-workflow.contract.d.ts +21 -23
  75. package/dist/contracts/lens-workflow.contract.js +48 -117
  76. package/dist/contracts/lensFilter.d.ts +2 -1
  77. package/dist/contracts/lensFilter.js +1 -71
  78. package/dist/contracts/lensWorkflow.d.ts +2 -2
  79. package/dist/contracts/lensWorkflow.js +1 -123
  80. package/dist/contracts/mcpTools.d.ts +16 -18
  81. package/dist/contracts/mcpTools.js +89 -123
  82. package/dist/contracts/prompt.contract.d.ts +4 -5
  83. package/dist/contracts/prompt.contract.js +23 -10
  84. package/dist/contracts/prompt.d.ts +2 -1
  85. package/dist/contracts/prompt.js +1 -11
  86. package/dist/contracts/sdk-tools.contract.d.ts +2 -1
  87. package/dist/contracts/sdk-tools.contract.js +1 -2
  88. package/dist/contracts/sdkTools.d.ts +2 -1
  89. package/dist/contracts/sdkTools.js +1 -26
  90. package/dist/contracts/tool-contracts.d.ts +2 -1
  91. package/dist/contracts/tool-contracts.js +1 -2
  92. package/dist/contracts/workflow-runtime.contract.d.ts +45 -46
  93. package/dist/contracts/workflow-runtime.contract.js +241 -228
  94. package/dist/contracts/workflowRuntime.d.ts +2 -1
  95. package/dist/contracts/workflowRuntime.js +1 -244
  96. package/dist/contradictions/index.d.ts +8 -60
  97. package/dist/contradictions/index.js +11 -10166
  98. package/dist/control-plane.d.ts +17 -24
  99. package/dist/control-plane.js +124 -840
  100. package/dist/controlObjectOwnership.d.ts +19 -20
  101. package/dist/controlObjectOwnership.js +207 -201
  102. package/dist/coreClient.d.ts +23 -28
  103. package/dist/coreClient.js +567 -692
  104. package/dist/customTools.d.ts +17 -21
  105. package/dist/customTools.js +221 -221
  106. package/dist/decisions/index.d.ts +7 -58
  107. package/dist/decisions/index.js +14 -10168
  108. package/dist/decisionsClient.d.ts +25 -32
  109. package/dist/decisionsClient.js +113 -913
  110. package/dist/domainContext.d.ts +2 -1
  111. package/dist/domainContext.js +1 -2
  112. package/dist/edges/index.d.ts +21 -73
  113. package/dist/edges/index.js +12 -10167
  114. package/dist/embeddingsClient.d.ts +22 -30
  115. package/dist/embeddingsClient.js +73 -922
  116. package/dist/eventingClient.d.ts +23 -31
  117. package/dist/eventingClient.js +89 -918
  118. package/dist/events.d.ts +48 -49
  119. package/dist/events.js +257 -241
  120. package/dist/eventsCore.d.ts +20 -29
  121. package/dist/eventsCore.js +86 -830
  122. package/dist/evidence/index.d.ts +9 -60
  123. package/dist/evidence/index.js +13 -10167
  124. package/dist/evidenceClient.d.ts +13 -22
  125. package/dist/evidenceClient.js +34 -751
  126. package/dist/facade/context.d.ts +7 -8
  127. package/dist/facade/context.js +73 -72
  128. package/dist/functionSurface.d.ts +2 -156
  129. package/dist/functionSurface.js +1 -1460
  130. package/dist/functionSurfaceClient.d.ts +2 -9
  131. package/dist/functionSurfaceClient.js +1 -1460
  132. package/dist/gatewayFacades.d.ts +79 -296
  133. package/dist/gatewayFacades.factories.d.ts +209 -14
  134. package/dist/gatewayFacades.factories.js +561 -2227
  135. package/dist/gatewayFacades.js +284 -2627
  136. package/dist/generated/functionSurface.d.ts +149 -0
  137. package/dist/generated/functionSurface.js +749 -0
  138. package/dist/graphAnalysisClient.d.ts +41 -49
  139. package/dist/graphAnalysisClient.js +185 -974
  140. package/dist/graphClient.d.ts +53 -60
  141. package/dist/graphClient.js +219 -1090
  142. package/dist/graphIntel.d.ts +2 -4
  143. package/dist/graphIntel.js +1 -2
  144. package/dist/graphIntelligence.d.ts +4 -2
  145. package/dist/graphIntelligence.js +2 -46
  146. package/dist/graphRecommendationsClient.d.ts +15 -23
  147. package/dist/graphRecommendationsClient.js +70 -849
  148. package/dist/graphStateClassifierClient.d.ts +17 -25
  149. package/dist/graphStateClassifierClient.js +67 -908
  150. package/dist/harnessClient.d.ts +40 -47
  151. package/dist/harnessClient.js +198 -993
  152. package/dist/identityClient.d.ts +25 -33
  153. package/dist/identityClient.js +245 -1186
  154. package/dist/index.d.ts +73 -69
  155. package/dist/index.js +72 -13304
  156. package/dist/infisicalRuntime.d.ts +12 -14
  157. package/dist/infisicalRuntime.js +290 -297
  158. package/dist/jobsClient.d.ts +24 -32
  159. package/dist/jobsClient.js +101 -916
  160. package/dist/learningClient.d.ts +8 -16
  161. package/dist/learningClient.js +45 -809
  162. package/dist/lenses/index.d.ts +13 -65
  163. package/dist/lenses/index.js +11 -10166
  164. package/dist/mcpClient.d.ts +14 -23
  165. package/dist/mcpClient.js +115 -856
  166. package/dist/modelRuntimeClient.d.ts +18 -26
  167. package/dist/modelRuntimeClient.js +74 -894
  168. package/dist/nodes/index.d.ts +7 -58
  169. package/dist/nodes/index.js +14 -10168
  170. package/dist/ontologies/index.d.ts +21 -73
  171. package/dist/ontologies/index.js +14 -10169
  172. package/dist/ontologyClient.d.ts +23 -31
  173. package/dist/ontologyClient.js +138 -924
  174. package/dist/ontologyLinksClient.d.ts +16 -24
  175. package/dist/ontologyLinksClient.js +76 -886
  176. package/dist/opinion.d.ts +5 -6
  177. package/dist/opinion.js +21 -25
  178. package/dist/orgGraphSearchClient.d.ts +19 -27
  179. package/dist/orgGraphSearchClient.js +89 -857
  180. package/dist/packRuntime.d.ts +2 -2
  181. package/dist/packRuntime.js +1 -2
  182. package/dist/packsClient.d.ts +30 -37
  183. package/dist/packsClient.js +131 -906
  184. package/dist/policyClient.d.ts +21 -29
  185. package/dist/policyClient.js +267 -1026
  186. package/dist/proof-attestation.json +1 -1
  187. package/dist/questions/index.d.ts +9 -60
  188. package/dist/questions/index.js +15 -10169
  189. package/dist/realtime/index.d.ts +20 -16
  190. package/dist/realtime/index.js +30 -19
  191. package/dist/realtime/refs.d.ts +4 -6
  192. package/dist/realtime/refs.js +12 -7
  193. package/dist/realtime-refs.d.ts +1 -0
  194. package/dist/realtime-refs.js +1 -0
  195. package/dist/realtime.d.ts +1 -0
  196. package/dist/realtime.js +1 -0
  197. package/dist/reportsClient.d.ts +10 -19
  198. package/dist/reportsClient.js +48 -836
  199. package/dist/schemaClient.d.ts +16 -23
  200. package/dist/schemaClient.js +62 -832
  201. package/dist/sdkSurface.d.ts +18 -25
  202. package/dist/sdkSurface.js +135 -106
  203. package/dist/secrets.d.ts +2 -1
  204. package/dist/secrets.js +1 -2
  205. package/dist/sourcesClient.d.ts +11 -18
  206. package/dist/sourcesClient.js +18 -741
  207. package/dist/telemetryClient.d.ts +22 -30
  208. package/dist/telemetryClient.js +107 -931
  209. package/dist/toolRegistryClient.d.ts +27 -35
  210. package/dist/toolRegistryClient.js +116 -954
  211. package/dist/topics/index.d.ts +13 -64
  212. package/dist/topics/index.js +15 -10169
  213. package/dist/topicsClient.d.ts +19 -27
  214. package/dist/topicsClient.js +106 -894
  215. package/dist/types.d.ts +84 -87
  216. package/dist/types.js +1 -2
  217. package/dist/version.d.ts +2 -3
  218. package/dist/version.js +2 -5
  219. package/dist/workflowClient.d.ts +60 -65
  220. package/dist/workflowClient.js +343 -1219
  221. package/dist/worktrees/index.d.ts +16 -68
  222. package/dist/worktrees/index.js +14 -10169
  223. package/package.json +6 -6
  224. package/dist/accessControl.js.map +0 -1
  225. package/dist/adminClient.js.map +0 -1
  226. package/dist/answersClient.js.map +0 -1
  227. package/dist/audience/index.js.map +0 -1
  228. package/dist/audiencesClient.js.map +0 -1
  229. package/dist/auditClient.js.map +0 -1
  230. package/dist/authContext.js.map +0 -1
  231. package/dist/authDeviceClient.js.map +0 -1
  232. package/dist/beliefs/index.js.map +0 -1
  233. package/dist/beliefs/lifecycle.js.map +0 -1
  234. package/dist/beliefsClient.js.map +0 -1
  235. package/dist/boundaryClientSurface.js.map +0 -1
  236. package/dist/client.js.map +0 -1
  237. package/dist/clientAssemblyTypes.js.map +0 -1
  238. package/dist/clientConfig.js.map +0 -1
  239. package/dist/clientEvidenceCompat.js.map +0 -1
  240. package/dist/clientGraphNamespaces.js.map +0 -1
  241. package/dist/clientHelpers.js.map +0 -1
  242. package/dist/clientKnowledgeNamespaces.js.map +0 -1
  243. package/dist/clientLocalHelpers.js.map +0 -1
  244. package/dist/clientPlatformNamespaces.js.map +0 -1
  245. package/dist/clientRuntime.js.map +0 -1
  246. package/dist/clientWorkflowNamespaces.js.map +0 -1
  247. package/dist/contextClient.js.map +0 -1
  248. package/dist/contextFacade.js.map +0 -1
  249. package/dist/contextPackCompiler.js.map +0 -1
  250. package/dist/contextPackPolicy.js.map +0 -1
  251. package/dist/contextPackSchema.js.map +0 -1
  252. package/dist/contextTypes.js.map +0 -1
  253. package/dist/contracts/api-enums.contract.js.map +0 -1
  254. package/dist/contracts/auth-session.contract.js.map +0 -1
  255. package/dist/contracts/context-pack.contract.js.map +0 -1
  256. package/dist/contracts/contextPack.js.map +0 -1
  257. package/dist/contracts/index.js.map +0 -1
  258. package/dist/contracts/lens-filter.contract.js.map +0 -1
  259. package/dist/contracts/lens-workflow.contract.js.map +0 -1
  260. package/dist/contracts/lensFilter.js.map +0 -1
  261. package/dist/contracts/lensWorkflow.js.map +0 -1
  262. package/dist/contracts/mcpTools.js.map +0 -1
  263. package/dist/contracts/prompt.contract.js.map +0 -1
  264. package/dist/contracts/prompt.js.map +0 -1
  265. package/dist/contracts/sdk-tools.contract.js.map +0 -1
  266. package/dist/contracts/sdkTools.js.map +0 -1
  267. package/dist/contracts/tool-contracts.js.map +0 -1
  268. package/dist/contracts/workflow-runtime.contract.js.map +0 -1
  269. package/dist/contracts/workflowRuntime.js.map +0 -1
  270. package/dist/contradictions/index.js.map +0 -1
  271. package/dist/control-plane.js.map +0 -1
  272. package/dist/controlObjectOwnership.js.map +0 -1
  273. package/dist/coreClient.js.map +0 -1
  274. package/dist/customTools.js.map +0 -1
  275. package/dist/decisions/index.js.map +0 -1
  276. package/dist/decisionsClient.js.map +0 -1
  277. package/dist/domainContext.js.map +0 -1
  278. package/dist/edges/index.js.map +0 -1
  279. package/dist/embeddingsClient.js.map +0 -1
  280. package/dist/eventingClient.js.map +0 -1
  281. package/dist/events.js.map +0 -1
  282. package/dist/eventsCore.js.map +0 -1
  283. package/dist/evidence/index.js.map +0 -1
  284. package/dist/evidenceClient.js.map +0 -1
  285. package/dist/facade/context.js.map +0 -1
  286. package/dist/functionSurface.js.map +0 -1
  287. package/dist/functionSurfaceClient.js.map +0 -1
  288. package/dist/gatewayFacades.factories.js.map +0 -1
  289. package/dist/gatewayFacades.js.map +0 -1
  290. package/dist/graphAnalysisClient.js.map +0 -1
  291. package/dist/graphClient.js.map +0 -1
  292. package/dist/graphIntel.js.map +0 -1
  293. package/dist/graphIntelligence.js.map +0 -1
  294. package/dist/graphRecommendationsClient.js.map +0 -1
  295. package/dist/graphStateClassifierClient.js.map +0 -1
  296. package/dist/harnessClient.js.map +0 -1
  297. package/dist/identityClient.js.map +0 -1
  298. package/dist/index.js.map +0 -1
  299. package/dist/infisicalRuntime.js.map +0 -1
  300. package/dist/jobsClient.js.map +0 -1
  301. package/dist/learningClient.js.map +0 -1
  302. package/dist/lenses/index.js.map +0 -1
  303. package/dist/mcpClient.js.map +0 -1
  304. package/dist/modelRuntimeClient.js.map +0 -1
  305. package/dist/nodes/index.js.map +0 -1
  306. package/dist/ontologies/index.js.map +0 -1
  307. package/dist/ontologyClient.js.map +0 -1
  308. package/dist/ontologyLinksClient.js.map +0 -1
  309. package/dist/opinion.js.map +0 -1
  310. package/dist/orgGraphSearchClient.js.map +0 -1
  311. package/dist/packRuntime.js.map +0 -1
  312. package/dist/packsClient.js.map +0 -1
  313. package/dist/policyClient.js.map +0 -1
  314. package/dist/questions/index.js.map +0 -1
  315. package/dist/realtime/index.js.map +0 -1
  316. package/dist/realtime/refs.js.map +0 -1
  317. package/dist/reportsClient.js.map +0 -1
  318. package/dist/schemaClient.js.map +0 -1
  319. package/dist/sdk-tools.contract-B4c1Zr1o.d.ts +0 -22
  320. package/dist/sdkSurface.js.map +0 -1
  321. package/dist/secrets.js.map +0 -1
  322. package/dist/sourcesClient.js.map +0 -1
  323. package/dist/telemetryClient.js.map +0 -1
  324. package/dist/tool-contracts-BUiL9P6z.d.ts +0 -22
  325. package/dist/toolRegistryClient.js.map +0 -1
  326. package/dist/topics/index.js.map +0 -1
  327. package/dist/topicsClient.js.map +0 -1
  328. package/dist/types.js.map +0 -1
  329. package/dist/version.js.map +0 -1
  330. package/dist/workflowClient.js.map +0 -1
  331. package/dist/worktrees/index.js.map +0 -1
@@ -1,1461 +1,2 @@
1
- import { createTelemetryExporterFromEnv, emitTelemetrySignal } from '@lucern/transport-core';
2
- import { redactDiagnosticValue } from '@lucern/transport-core/redaction';
3
- import { classifyRetry } from '@lucern/transport-core/transport';
4
- import { Effect, Exit, Cause } from 'effect';
5
-
6
- // src/coreClient.ts
7
-
8
- // src/authContext.ts
9
- var LucernSdkAuthContextError = class extends Error {
10
- reason;
11
- constructor(reason, message) {
12
- super(message);
13
- this.name = "LucernSdkAuthContextError";
14
- this.reason = reason;
15
- }
16
- };
17
- function cleanString(value) {
18
- const normalized = value?.trim();
19
- return normalized ? normalized : void 0;
20
- }
21
- function cleanStringList(values) {
22
- if (!values) {
23
- return [];
24
- }
25
- return values.map((value) => value.trim()).filter(
26
- (value, index, list) => value.length > 0 && list.indexOf(value) === index
27
- );
28
- }
29
- function requireString(value, reason, label) {
30
- const normalized = cleanString(value);
31
- if (!normalized) {
32
- throw new LucernSdkAuthContextError(
33
- reason,
34
- `Canonical Lucern SDK auth context is missing ${label}.`
35
- );
36
- }
37
- return normalized;
38
- }
39
- function requirePrincipalType(principalType) {
40
- if (!principalType) {
41
- throw new LucernSdkAuthContextError(
42
- "principal_missing",
43
- "Canonical Lucern SDK auth context is missing principalType."
44
- );
45
- }
46
- return principalType;
47
- }
48
- function requireAuthMode(authMode) {
49
- if (!authMode) {
50
- throw new LucernSdkAuthContextError(
51
- "principal_missing",
52
- "Canonical Lucern SDK auth context is missing authMode."
53
- );
54
- }
55
- return authMode;
56
- }
57
- function ensurePermitMatch(args) {
58
- const actual = cleanString(args.actual);
59
- if (actual && actual !== args.expected) {
60
- throw new LucernSdkAuthContextError(
61
- "policy_denied",
62
- `Canonical Lucern SDK auth context has conflicting Permit ${args.field}.`
63
- );
64
- }
65
- }
66
- function normalizeCanonicalLucernAuthContext(input) {
67
- if (!input) {
68
- throw new LucernSdkAuthContextError(
69
- "principal_missing",
70
- "Canonical Lucern SDK auth context is required."
71
- );
72
- }
73
- if (input.policyDecision === "deny") {
74
- throw new LucernSdkAuthContextError(
75
- "policy_denied",
76
- "Canonical Lucern SDK auth context carries a denied policy decision."
77
- );
78
- }
79
- const principalId = requireString(
80
- input.principalId,
81
- "principal_missing",
82
- "principalId"
83
- );
84
- const tenantId = requireString(input.tenantId, "tenant_missing", "tenantId");
85
- const workspaceId = requireString(
86
- input.workspaceId,
87
- "workspace_missing",
88
- "workspaceId"
89
- );
90
- const roles = cleanStringList(input.roles);
91
- const scopes = cleanStringList(input.scopes);
92
- const principalType = requirePrincipalType(input.principalType);
93
- const authMode = requireAuthMode(input.authMode);
94
- const roleBasedInteractiveAuth = authMode === "interactive_user" && roles.length > 0;
95
- if (roles.length === 0 || scopes.length === 0 && !roleBasedInteractiveAuth) {
96
- throw new LucernSdkAuthContextError(
97
- "membership_missing",
98
- "Canonical Lucern SDK auth context requires non-empty roles and scopes."
99
- );
100
- }
101
- const subject = cleanString(input.permit?.subject) ?? principalId;
102
- const tenant = cleanString(input.permit?.tenant) ?? tenantId;
103
- const workspace = cleanString(input.permit?.workspace) ?? workspaceId;
104
- ensurePermitMatch({
105
- field: "subject",
106
- expected: principalId,
107
- actual: subject
108
- });
109
- ensurePermitMatch({ field: "tenant", expected: tenantId, actual: tenant });
110
- ensurePermitMatch({
111
- field: "workspace",
112
- expected: workspaceId,
113
- actual: workspace
114
- });
115
- const context = input.permit?.context ? { ...input.permit.context } : void 0;
116
- return {
117
- clerkId: cleanString(input.clerkId),
118
- principalId,
119
- tenantId,
120
- workspaceId,
121
- principalType,
122
- authMode,
123
- roles,
124
- scopes,
125
- delegationChain: input.delegationChain ? [...input.delegationChain] : [],
126
- policyTraceId: cleanString(input.policyTraceId),
127
- correlationId: cleanString(input.correlationId),
128
- membershipId: cleanString(input.membershipId),
129
- permit: {
130
- subject,
131
- tenant,
132
- workspace,
133
- resource: cleanString(input.permit?.resource),
134
- action: cleanString(input.permit?.action),
135
- relation: cleanString(input.permit?.relation),
136
- context
137
- }
138
- };
139
- }
140
- function createCanonicalAuthHeaders(authContext) {
141
- const headers = {
142
- "x-lucern-principal-id": authContext.principalId,
143
- "x-lucern-principal-type": authContext.principalType,
144
- "x-lucern-tenant": authContext.tenantId,
145
- "x-lucern-tenant-id": authContext.tenantId,
146
- "x-lucern-workspace": authContext.workspaceId,
147
- "x-lucern-workspace-id": authContext.workspaceId,
148
- "x-lucern-auth-mode": authContext.authMode,
149
- "x-lucern-roles": authContext.roles.join(","),
150
- "x-lucern-scopes": authContext.scopes.join(","),
151
- "x-lucern-permit-context": JSON.stringify(authContext.permit)
152
- };
153
- if (authContext.clerkId) {
154
- headers["x-lucern-clerk-id"] = authContext.clerkId;
155
- headers["x-lucern-user-id"] = authContext.clerkId;
156
- }
157
- if (authContext.delegationChain.length > 0) {
158
- headers["x-lucern-delegation-chain"] = JSON.stringify(
159
- authContext.delegationChain
160
- );
161
- }
162
- if (authContext.policyTraceId) {
163
- headers["x-lucern-policy-trace-id"] = authContext.policyTraceId;
164
- }
165
- if (authContext.correlationId) {
166
- headers["x-correlation-id"] = authContext.correlationId;
167
- headers["x-lucern-correlation-id"] = authContext.correlationId;
168
- }
169
- if (authContext.membershipId) {
170
- headers["x-lucern-membership-id"] = authContext.membershipId;
171
- }
172
- return headers;
173
- }
174
-
175
- // src/coreClient.ts
176
- var DEFAULT_GATEWAY_TIMEOUT_MS = 15e3;
177
- var DEFAULT_GATEWAY_MAX_RETRIES = 2;
178
- var DEFAULT_ENV_TIMEOUT_MS = "LUCERN_REQUEST_TIMEOUT_MS";
179
- var DEFAULT_ENV_MAX_RETRIES = "LUCERN_GATEWAY_MAX_RETRIES";
180
- var ENV_TIMEOUT_BY_METHOD_PREFIX = "LUCERN_REQUEST_TIMEOUT_MS_";
181
- var GatewayTimeoutError = class extends Error {
182
- retryable = true;
183
- timeoutMs;
184
- constructor(timeoutMs) {
185
- super(`Request timed out after ${timeoutMs}ms`);
186
- this.name = "AbortError";
187
- this.timeoutMs = timeoutMs;
188
- }
189
- };
190
- var GatewayTransportError = class extends Error {
191
- retryable;
192
- cause;
193
- constructor(message, options) {
194
- super(message);
195
- this.name = "GatewayTransportError";
196
- this.retryable = options?.retryable ?? true;
197
- this.cause = options?.cause;
198
- }
199
- };
200
- function isGatewayRetryableError(error) {
201
- return error instanceof GatewayTimeoutError && error.retryable || error instanceof GatewayTransportError && error.retryable || false;
202
- }
203
- var LucernApiError = class extends Error {
204
- code;
205
- status;
206
- invariant;
207
- suggestion;
208
- details;
209
- requestId;
210
- correlationId;
211
- policyTraceId;
212
- constructor(args) {
213
- super(args.message);
214
- this.name = "LucernApiError";
215
- this.code = args.code;
216
- this.status = args.status;
217
- this.invariant = args.invariant;
218
- this.suggestion = args.suggestion;
219
- this.details = args.details;
220
- this.requestId = args.requestId;
221
- this.correlationId = args.correlationId;
222
- this.policyTraceId = args.policyTraceId;
223
- }
224
- };
225
- function fillRandomBytes(length) {
226
- const bytes = new Uint8Array(length);
227
- if (typeof globalThis.crypto?.getRandomValues === "function") {
228
- globalThis.crypto.getRandomValues(bytes);
229
- return bytes;
230
- }
231
- for (let index = 0; index < length; index += 1) {
232
- bytes[index] = Math.floor(Math.random() * 256);
233
- }
234
- return bytes;
235
- }
236
- function generatePortableRequestId() {
237
- if (typeof globalThis.crypto?.randomUUID === "function") {
238
- return globalThis.crypto.randomUUID();
239
- }
240
- const bytes = fillRandomBytes(16);
241
- bytes[6] = bytes[6] & 15 | 64;
242
- bytes[8] = bytes[8] & 63 | 128;
243
- const hex = Array.from(bytes, (value) => value.toString(16).padStart(2, "0"));
244
- return `${hex.slice(0, 4).join("")}-${hex.slice(4, 6).join("")}-${hex.slice(
245
- 6,
246
- 8
247
- ).join("")}-${hex.slice(8, 10).join("")}-${hex.slice(10).join("")}`;
248
- }
249
- function resolveEnvironment() {
250
- const processEnv = typeof globalThis === "object" && globalThis !== null && "process" in globalThis ? globalThis.process : void 0;
251
- const env = processEnv !== void 0 && typeof processEnv === "object" && processEnv !== null && typeof processEnv.env === "object" ? processEnv.env : void 0;
252
- return {
253
- get: (name) => {
254
- const value = env?.[name];
255
- return typeof value === "string" && value.length > 0 ? value : void 0;
256
- }
257
- };
258
- }
259
- function telemetryEnvironmentRecord(environment) {
260
- const names = [
261
- "LUCERN_TELEMETRY_ENABLED",
262
- "AXIOM_TELEMETRY_ENABLED",
263
- "LUCERN_AXIOM_TOKEN",
264
- "AXIOM_TOKEN",
265
- "LUCERN_AXIOM_EVENTS_DATASET",
266
- "LUCERN_AXIOM_DATASET",
267
- "AXIOM_EVENTS_DATASET",
268
- "AXIOM_DATASET",
269
- "LUCERN_AXIOM_API_URL",
270
- "AXIOM_URL",
271
- "LUCERN_ENVIRONMENT",
272
- "NODE_ENV",
273
- "LUCERN_RELEASE",
274
- "SENTRY_RELEASE",
275
- "VERCEL_GIT_COMMIT_SHA"
276
- ];
277
- return Object.fromEntries(
278
- names.map((name) => [name, environment.get(name)])
279
- );
280
- }
281
- function resolveRequestProfile(config, environment) {
282
- const requestIdFactory = config.requestIdFactory ?? (() => generatePortableRequestId());
283
- const parsedMaxRetries = parseIntegerFromString(
284
- config.maxRetries,
285
- environment.get(DEFAULT_ENV_MAX_RETRIES)
286
- );
287
- const parsedTimeoutMs = parseIntegerFromString(
288
- config.timeoutMs,
289
- environment.get(DEFAULT_ENV_TIMEOUT_MS)
290
- );
291
- const methodTimeouts = {
292
- ...config.timeoutMsByMethod
293
- };
294
- for (const method of ["GET", "POST", "PUT", "PATCH", "DELETE"]) {
295
- const envKey = `${ENV_TIMEOUT_BY_METHOD_PREFIX}${method}`;
296
- const raw = environment.get(envKey);
297
- if (!raw || methodTimeouts[method] !== void 0) {
298
- continue;
299
- }
300
- const parsed = parseIntegerFromString(void 0, raw);
301
- if (typeof parsed === "number") {
302
- methodTimeouts[method] = parsed;
303
- }
304
- }
305
- return {
306
- maxRetries: parsedMaxRetries ?? DEFAULT_GATEWAY_MAX_RETRIES,
307
- timeoutMs: parsedTimeoutMs ?? DEFAULT_GATEWAY_TIMEOUT_MS,
308
- timeoutMsByMethod: methodTimeouts,
309
- requestIdFactory
310
- };
311
- }
312
- function createGatewayRuntime(config, environment) {
313
- return {
314
- fetch: config.fetchImpl ?? fetch,
315
- now: () => Date.now(),
316
- sleep: (ms) => delay(ms),
317
- env: environment,
318
- redaction: resolveRequestRedactionValue,
319
- profile: resolveRequestProfile(config, environment)
320
- };
321
- }
322
- function parseIntegerFromString(value, rawValue) {
323
- if (typeof value === "number" && Number.isInteger(value) && value >= 0) {
324
- return value;
325
- }
326
- if (typeof rawValue !== "string" || !rawValue.trim()) {
327
- return void 0;
328
- }
329
- const parsed = Number.parseInt(rawValue, 10);
330
- return Number.isInteger(parsed) && parsed >= 0 ? parsed : void 0;
331
- }
332
- function resolveRequestRedactionValue(value) {
333
- return redactDiagnosticValue(value);
334
- }
335
- function resolveGatewayBaseUrl(configBaseUrl, environment) {
336
- const envBaseUrl = environment.get("LUCERN_API_URL") ?? environment.get("LUCERN_BASE_URL") ?? environment.get("LUCERN_GATEWAY_BASE_URL");
337
- return (configBaseUrl ?? envBaseUrl ?? "").replace(/\/+$/, "");
338
- }
339
- function normalizeGatewayEnvironment(value) {
340
- return value === "sandbox" || value === "production" ? value : void 0;
341
- }
342
- var randomIdempotencyKey = generatePortableRequestId;
343
- function fallbackErrorCode(status) {
344
- if (status === 401) {
345
- return "AUTHENTICATION_REQUIRED";
346
- }
347
- if (status === 403) {
348
- return "FORBIDDEN";
349
- }
350
- if (status === 404) {
351
- return "NOT_FOUND";
352
- }
353
- if (status === 408) {
354
- return "UPSTREAM_ERROR";
355
- }
356
- if (status === 409) {
357
- return "CONFLICT";
358
- }
359
- if (status === 429) {
360
- return "RATE_LIMIT_EXCEEDED";
361
- }
362
- if (status >= 500) {
363
- return "UPSTREAM_ERROR";
364
- }
365
- return "INTERNAL_ERROR";
366
- }
367
- function delay(ms) {
368
- return new Promise((resolve) => setTimeout(resolve, ms));
369
- }
370
- function computeRetryDelayMs(args) {
371
- const baseDelay = args.status === 429 ? Math.max(
372
- args.retryAfterMs ?? 0,
373
- Math.min(1e3 * 2 ** args.attempt, 1e4)
374
- ) : Math.min(1e3 * 2 ** args.attempt, 4e3);
375
- if (args.status !== 429) {
376
- return baseDelay;
377
- }
378
- const jitterWindow = Math.max(250, Math.round(baseDelay * 0.25));
379
- return baseDelay + Math.round(Math.random() * jitterWindow);
380
- }
381
- function classifyGatewayErrorForRetry(error) {
382
- return isGatewayRetryableError(error) || classifyRetry({ error }).retryable;
383
- }
384
- function isRecord(value) {
385
- return value !== null && typeof value === "object" && !Array.isArray(value);
386
- }
387
- function readPolicySummaryFromDetails(details) {
388
- if (!isRecord(details)) {
389
- return null;
390
- }
391
- const directSummary = details.summary;
392
- if (typeof directSummary === "string" && directSummary.trim().length > 0) {
393
- return directSummary.trim();
394
- }
395
- const policy = details.policy;
396
- if (!isRecord(policy)) {
397
- return null;
398
- }
399
- const explanation = policy.explanation;
400
- if (!isRecord(explanation)) {
401
- return null;
402
- }
403
- const nestedSummary = explanation.summary;
404
- if (typeof nestedSummary === "string" && nestedSummary.trim().length > 0) {
405
- return nestedSummary.trim();
406
- }
407
- return null;
408
- }
409
- function redactJsonDiagnosticValue(value) {
410
- return value === void 0 ? void 0 : redactDiagnosticValue(value);
411
- }
412
- async function resolveConfiguredAuthContext(authContext) {
413
- if (typeof authContext === "function") {
414
- return await authContext();
415
- }
416
- return authContext;
417
- }
418
- function mergeHeaderRecord(base, addition) {
419
- const headers = new Headers(base);
420
- for (const [key, value] of Object.entries(addition)) {
421
- const existing = headers.get(key);
422
- if (existing !== null && existing !== value) {
423
- throw new LucernSdkAuthContextError(
424
- "policy_denied",
425
- `Canonical Lucern SDK auth context conflicts with existing ${key} header.`
426
- );
427
- }
428
- headers.set(key, value);
429
- }
430
- return Object.fromEntries(headers.entries());
431
- }
432
- function cleanHeaderValue(value) {
433
- const normalized = value?.trim();
434
- return normalized ? normalized : void 0;
435
- }
436
- function createGatewayRequestClient(config = {}) {
437
- const env = resolveEnvironment();
438
- const runtime = createGatewayRuntime(config, env);
439
- const baseUrl = resolveGatewayBaseUrl(config.baseUrl, env);
440
- const maxRetries = runtime.profile.maxRetries;
441
- const requestIdFactory = runtime.profile.requestIdFactory;
442
- const requestTimeoutByMethod = runtime.profile.timeoutMsByMethod;
443
- const defaultRequestTimeoutMs = runtime.profile.timeoutMs;
444
- const normalizedEnvironment = normalizeGatewayEnvironment(config.environment);
445
- const telemetryExporter = config.telemetryEnabled === false ? null : config.telemetryExporter ?? createTelemetryExporterFromEnv(telemetryEnvironmentRecord(env), {
446
- service: "lucern-sdk",
447
- environment: normalizedEnvironment
448
- });
449
- async function resolveAuthHeaders() {
450
- const provided = config.getAuthHeaders ? await config.getAuthHeaders() : {};
451
- const headers = new Headers(provided);
452
- const setIfAbsent = (name, value) => {
453
- const normalized = cleanHeaderValue(value);
454
- if (normalized && !headers.has(name)) {
455
- headers.set(name, normalized);
456
- }
457
- };
458
- setIfAbsent("x-lucern-key", config.apiKey);
459
- setIfAbsent("x-lucern-session-token", config.userToken);
460
- setIfAbsent("x-lucern-environment", normalizedEnvironment);
461
- setIfAbsent("x-lucern-clerk-id", config.clerkId);
462
- setIfAbsent("x-lucern-user-id", config.userId ?? config.clerkId);
463
- setIfAbsent("x-lucern-deployment-host", config.deploymentHost);
464
- const base = Object.fromEntries(headers.entries());
465
- const authContextInput = await resolveConfiguredAuthContext(
466
- config.authContext
467
- );
468
- if (!authContextInput && !config.requireCanonicalAuthContext) {
469
- return base;
470
- }
471
- const authContext = normalizeCanonicalLucernAuthContext(authContextInput);
472
- return mergeHeaderRecord(base, createCanonicalAuthHeaders(authContext));
473
- }
474
- async function fetchWithTimeout(url, init, timeoutMs) {
475
- const normalizeTransportError = (error, isTimeout) => {
476
- if (isTimeout) {
477
- return new GatewayTimeoutError(timeoutMs);
478
- }
479
- return error instanceof GatewayTimeoutError || error instanceof GatewayTransportError ? error : new GatewayTransportError(
480
- error instanceof Error ? error.message : "Gateway transport error",
481
- {
482
- cause: error,
483
- retryable: classifyGatewayErrorForRetry(error)
484
- }
485
- );
486
- };
487
- const controller = new AbortController();
488
- const timer = setTimeout(() => controller.abort(), timeoutMs);
489
- const requestEffect = Effect.tryPromise({
490
- try: () => runtime.fetch(url, { ...init, signal: controller.signal }),
491
- catch: (error) => normalizeTransportError(error, controller.signal.aborted)
492
- });
493
- try {
494
- const exit = await Effect.runPromiseExit(requestEffect);
495
- if (Exit.isSuccess(exit)) {
496
- return exit.value;
497
- }
498
- const failure = Array.from(Cause.failures(exit.cause))[0];
499
- if (failure !== void 0) {
500
- throw failure;
501
- }
502
- throw Cause.squash(exit.cause);
503
- } finally {
504
- clearTimeout(timer);
505
- }
506
- }
507
- async function emitSdkResponseTelemetry(context) {
508
- const retry = classifyRetry({
509
- status: context.status,
510
- error: context.error,
511
- retryAfter: context.retryAfterMs !== null && context.retryAfterMs !== void 0 ? String(context.retryAfterMs / 1e3) : void 0
512
- });
513
- await emitTelemetrySignal(telemetryExporter, {
514
- signalType: "trace",
515
- surface: "sdk-retry",
516
- eventName: context.willRetry ? "sdk.retry" : context.error ? "sdk.request.error" : "sdk.request.complete",
517
- severity: context.error ? context.willRetry ? "warn" : "error" : "info",
518
- durationMs: context.durationMs,
519
- metricName: "sdk.request.duration_ms",
520
- metricValue: context.durationMs,
521
- correlationId: context.correlationId ?? context.requestId,
522
- policyTraceId: context.policyTraceId ?? null,
523
- tenantId: context.headers.get("x-lucern-tenant-id") ?? context.headers.get("x-lucern-tenant") ?? void 0,
524
- workspaceId: context.headers.get("x-lucern-workspace-id") ?? context.headers.get("x-lucern-workspace") ?? void 0,
525
- attributes: {
526
- service: "lucern-sdk",
527
- operation: "gateway.request",
528
- path: context.path,
529
- httpMethod: context.method,
530
- httpStatus: context.status,
531
- attempt: context.attempt,
532
- maxRetries: context.maxRetries,
533
- retryReason: retry.reason,
534
- retryAfterMs: context.retryAfterMs ?? retry.retryAfterMs,
535
- willRetry: context.willRetry,
536
- retryable: retry.retryable,
537
- errorName: context.error instanceof Error ? context.error.name : void 0,
538
- errorMessage: context.error instanceof Error ? context.error.message : void 0
539
- }
540
- });
541
- }
542
- async function parsePayload(response) {
543
- const text = await response.text();
544
- if (!text) {
545
- return null;
546
- }
547
- const parsed = tryParseGatewayEnvelopeJson(text);
548
- if (!parsed.ok) {
549
- return null;
550
- }
551
- return isRecord(parsed.value) ? parsed.value : null;
552
- }
553
- function resolveTimeoutMs(method, requestTimeoutMs) {
554
- if (typeof requestTimeoutMs === "number") {
555
- return requestTimeoutMs;
556
- }
557
- const methodTimeoutMs = requestTimeoutByMethod?.[method];
558
- if (typeof methodTimeoutMs === "number") {
559
- return methodTimeoutMs;
560
- }
561
- return defaultRequestTimeoutMs;
562
- }
563
- function tryParseGatewayEnvelopeJson(text) {
564
- const trimmed = text.trim();
565
- if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) {
566
- return { ok: false, reason: "non-json" };
567
- }
568
- try {
569
- return { ok: true, value: JSON.parse(trimmed) };
570
- } catch (error) {
571
- if (error instanceof SyntaxError) {
572
- return { ok: false, reason: "invalid-json", error };
573
- }
574
- throw error;
575
- }
576
- }
577
- function buildApiError(args) {
578
- const failure = args.failure;
579
- const legacyError = failure && isRecord(failure.error) ? failure.error : failure?.legacyError;
580
- const correlationId = failure?.correlationId ?? args.response.headers.get("x-lucern-correlation-id")?.trim() ?? args.requestId;
581
- const policyTraceId = failure?.policyTraceId ?? args.response.headers.get("x-lucern-policy-trace-id")?.trim() ?? null;
582
- const details = runtime.redaction(
583
- redactJsonDiagnosticValue(failure?.details ?? legacyError?.details)
584
- );
585
- const policySummary = readPolicySummaryFromDetails(details);
586
- const failureMessage = typeof failure?.error === "string" ? failure.error : legacyError?.message;
587
- return new LucernApiError({
588
- code: failure?.code ?? legacyError?.code ?? fallbackErrorCode(args.response.status),
589
- message: policySummary ?? failureMessage ?? (args.response.ok ? "Platform API returned an invalid success payload." : "Platform API request failed."),
590
- status: args.response.status,
591
- invariant: failure?.invariant,
592
- suggestion: failure?.suggestion,
593
- details,
594
- requestId: args.requestId,
595
- correlationId,
596
- policyTraceId
597
- });
598
- }
599
- async function request(args) {
600
- const authHeaders = await resolveAuthHeaders();
601
- const method = args.method ?? "GET";
602
- const timeoutMs = resolveTimeoutMs(method, args.timeoutMs);
603
- const headers = new Headers({
604
- "content-type": "application/json",
605
- ...authHeaders
606
- });
607
- if (args.idempotencyKey) {
608
- headers.set("idempotency-key", args.idempotencyKey);
609
- }
610
- const requestId = headers.get("x-correlation-id")?.trim() || headers.get("x-request-id")?.trim() || args.requestId || requestIdFactory();
611
- if (!headers.has("x-correlation-id") && !headers.has("x-request-id")) {
612
- headers.set("x-correlation-id", requestId);
613
- }
614
- const url = `${baseUrl}${args.path}`;
615
- const serializedBody = args.body ? JSON.stringify(args.body) : void 0;
616
- const init = {
617
- method,
618
- headers,
619
- body: serializedBody
620
- };
621
- let lastError;
622
- for (let attempt = 0; attempt <= maxRetries; attempt++) {
623
- const hookRequestContext = {
624
- requestId,
625
- attempt,
626
- maxRetries,
627
- method,
628
- path: args.path,
629
- url,
630
- headers: new Headers(headers),
631
- body: serializedBody,
632
- timeoutMs
633
- };
634
- await config.onRequest?.(hookRequestContext);
635
- const startedAt = Date.now();
636
- try {
637
- const response = await fetchWithTimeout(url, init, timeoutMs);
638
- const responseClone = response.clone();
639
- const payload = await parsePayload(response);
640
- const retry = classifyRetry({
641
- status: response.status,
642
- retryAfter: response.headers.get("Retry-After")
643
- });
644
- const retryAfterMs = retry.retryAfterMs ?? null;
645
- if (!response.ok || !payload?.success) {
646
- const failure = payload && !payload.success ? payload : null;
647
- const apiError = buildApiError({
648
- requestId,
649
- response,
650
- failure
651
- });
652
- const willRetry = attempt < maxRetries && retry.retryable;
653
- const responseContext2 = {
654
- ...hookRequestContext,
655
- durationMs: Date.now() - startedAt,
656
- status: response.status,
657
- response: responseClone,
658
- error: apiError,
659
- correlationId: apiError.correlationId ?? requestId,
660
- policyTraceId: apiError.policyTraceId ?? null,
661
- retryAfterMs,
662
- willRetry
663
- };
664
- await config.onResponse?.(responseContext2);
665
- await emitSdkResponseTelemetry(responseContext2);
666
- if (willRetry) {
667
- lastError = apiError;
668
- await delay(
669
- computeRetryDelayMs({
670
- attempt,
671
- status: response.status,
672
- retryAfterMs
673
- })
674
- );
675
- continue;
676
- }
677
- throw apiError;
678
- }
679
- const successPayload = payload;
680
- const responseContext = {
681
- ...hookRequestContext,
682
- durationMs: Date.now() - startedAt,
683
- status: response.status,
684
- response: responseClone,
685
- correlationId: successPayload.correlationId ?? response.headers.get("x-lucern-correlation-id")?.trim() ?? requestId,
686
- policyTraceId: successPayload.policyTraceId ?? response.headers.get("x-lucern-policy-trace-id")?.trim() ?? null,
687
- idempotentReplay: successPayload.idempotentReplay,
688
- retryAfterMs,
689
- willRetry: false
690
- };
691
- await config.onResponse?.(responseContext);
692
- await emitSdkResponseTelemetry(responseContext);
693
- return successPayload;
694
- } catch (fetchError) {
695
- if (fetchError instanceof LucernApiError) {
696
- throw fetchError;
697
- }
698
- const willRetry = attempt < maxRetries && classifyGatewayErrorForRetry(fetchError);
699
- const responseContext = {
700
- ...hookRequestContext,
701
- durationMs: Date.now() - startedAt,
702
- error: fetchError,
703
- correlationId: requestId,
704
- policyTraceId: null,
705
- willRetry
706
- };
707
- await config.onResponse?.(responseContext);
708
- await emitSdkResponseTelemetry(responseContext);
709
- lastError = fetchError;
710
- if (willRetry) {
711
- await delay(computeRetryDelayMs({ attempt }));
712
- }
713
- }
714
- }
715
- throw lastError instanceof Error ? lastError : new Error("Platform API request failed after retries.");
716
- }
717
- return {
718
- request
719
- };
720
- }
721
-
722
- // src/generated/functionSurface.ts
723
- var FUNCTION_SURFACE_METHOD_PATHS = [
724
- "answers.answerQuestion",
725
- "answers.createAnswer",
726
- "answers.getAnswer",
727
- "beliefs.archiveBelief",
728
- "beliefs.bisectConfidence",
729
- "beliefs.createBelief",
730
- "beliefs.forkBelief",
731
- "beliefs.getBelief",
732
- "beliefs.getConfidenceHistory",
733
- "beliefs.listBeliefs",
734
- "beliefs.modulateConfidence",
735
- "beliefs.refineBelief",
736
- "beliefs.searchBeliefs",
737
- "bootstrap.generateSessionHandoff",
738
- "coding.getChangeHistory",
739
- "coding.getCodeContext",
740
- "coding.getFailureLog",
741
- "coding.recordAttempt",
742
- "context.analyzeTopicDensity",
743
- "context.applyAutoBranching",
744
- "context.compileContext",
745
- "context.discover",
746
- "context.discoverEntityConnections",
747
- "context.getLatticeCoverage",
748
- "context.recordScopeLearning",
749
- "context.seedBeliefLattice",
750
- "context.triggerBeliefReview",
751
- "contracts.createEpistemicContract",
752
- "contracts.evaluateContract",
753
- "contracts.getContractStatus",
754
- "contradictions.flagContradiction",
755
- "controlPlane.identity.resolveInteractivePrincipal",
756
- "coordination.broadcastMessage",
757
- "coordination.claimFiles",
758
- "coordination.endSession",
759
- "coordination.getAgentInbox",
760
- "coordination.heartbeatSession",
761
- "coordination.listActiveSessions",
762
- "coordination.registerSession",
763
- "coordination.sendAgentMessage",
764
- "edges.batchCreateEdges",
765
- "edges.createEdge",
766
- "edges.queryLineage",
767
- "edges.removeEdge",
768
- "edges.removeEdgesBetween",
769
- "edges.updateEdge",
770
- "embeddings.getByNodeIds",
771
- "embeddings.listMissingForTopic",
772
- "embeddings.markEmbeddingBackfillQueued",
773
- "embeddings.vectorSearchByTopic",
774
- "evidence.addEvidence",
775
- "evidence.createEvidence",
776
- "evidence.getEvidence",
777
- "evidence.linkEvidence",
778
- "evidence.linkEvidenceToBelief",
779
- "evidence.linkEvidenceToQuestion",
780
- "evidence.listEvidence",
781
- "evidence.searchEvidence",
782
- "graph.detectConfirmationBias",
783
- "graph.findContradictions",
784
- "graph.getGraphGaps",
785
- "graph.getGraphNeighborhood",
786
- "graph.getGraphStructureAnalysis",
787
- "graph.getTopicCoverage",
788
- "graph.traceEntityImpact",
789
- "graph.traverseGraph",
790
- "graphAnalysis.listGraphIntelligenceQueries",
791
- "graphAnalysis.runGraphIntelligenceQuery",
792
- "hybrid.analyzeGraphImpact",
793
- "hybrid.detectGraphDrift",
794
- "hybrid.expandGraphNeighborhood",
795
- "hybrid.findRelatedNodes",
796
- "hybrid.hybridDiscover",
797
- "hybrid.resolveTopicSemantic",
798
- "identity.checkPermission",
799
- "identity.filterByPermission",
800
- "identity.whoami",
801
- "judgments.getAuditTrail",
802
- "judgments.recordJudgment",
803
- "lenses.applyLensToTopic",
804
- "lenses.createLens",
805
- "lenses.listLenses",
806
- "lenses.removeLensFromTopic",
807
- "nodes.archiveEpistemicNode",
808
- "nodes.batchCreateEpistemicNodes",
809
- "nodes.createEpistemicNode",
810
- "nodes.getEpistemicNode",
811
- "nodes.listEpistemicNodes",
812
- "nodes.supersedeEpistemicNode",
813
- "nodes.updateEpistemicNode",
814
- "nodes.verifyEpistemicNode",
815
- "observations.getObservationContext",
816
- "observations.ingestObservation",
817
- "ontologies.applyOntology",
818
- "ontologies.archiveOntology",
819
- "ontologies.createOntology",
820
- "ontologies.createOntologyVersion",
821
- "ontologies.deprecateOntologyVersion",
822
- "ontologies.getOntology",
823
- "ontologies.listOntologies",
824
- "ontologies.matchEntityType",
825
- "ontologies.publishOntologyVersion",
826
- "ontologies.resolveEffectiveOntology",
827
- "ontologies.updateOntology",
828
- "policy.manageWritePolicy",
829
- "questions.archiveQuestion",
830
- "questions.createQuestion",
831
- "questions.findMissingQuestions",
832
- "questions.getFalsificationQuestions",
833
- "questions.getHighPriorityQuestions",
834
- "questions.getQuestion",
835
- "questions.listQuestions",
836
- "questions.refineQuestion",
837
- "questions.updateQuestionStatus",
838
- "tasks.completeTask",
839
- "tasks.createTask",
840
- "tasks.listTasks",
841
- "tasks.updateTask",
842
- "topics.createTopic",
843
- "topics.getTopic",
844
- "topics.getTopicGraphSpine",
845
- "topics.getTopicTree",
846
- "topics.listTopics",
847
- "topics.materializeTopicGraph",
848
- "topics.updateTopic",
849
- "worktrees.activateWorktree",
850
- "worktrees.addWorktree",
851
- "worktrees.beginBuildSession",
852
- "worktrees.getWorktree",
853
- "worktrees.listAllWorktrees",
854
- "worktrees.listCampaigns",
855
- "worktrees.listWorktrees",
856
- "worktrees.merge",
857
- "worktrees.openPullRequest",
858
- "worktrees.pipelineSnapshot",
859
- "worktrees.push",
860
- "worktrees.updateWorktreeMetadata",
861
- "worktrees.updateWorktreeTargets"
862
- ];
863
- var CONTRACTS = {
864
- "activate_worktree": { method: "POST", path: "/worktrees/activate", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
865
- "add_evidence": { method: "POST", path: "/evidence/add", kind: "mutation", idempotent: true, surfaceIntent: "compatibility" },
866
- "add_worktree": { method: "POST", path: "/worktrees", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
867
- "analyze_graph_impact": { method: "POST", path: "/hybrid/impact", kind: "action", idempotent: false, surfaceIntent: "mcp_analysis" },
868
- "analyze_topic_density": { method: "POST", path: "/scope/topic-density", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
869
- "answer_question": { method: "POST", path: "/questions/answer", kind: "mutation", idempotent: true, surfaceIntent: "compatibility" },
870
- "apply_auto_branching": { method: "POST", path: "/scope/auto-branching", kind: "mutation", idempotent: true, surfaceIntent: "mcp_analysis" },
871
- "apply_lens_to_topic": { method: "POST", path: "/lenses/apply", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
872
- "apply_ontology": { method: "POST", path: "/ontologies/apply", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
873
- "archive_belief": { method: "DELETE", path: "/beliefs", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
874
- "archive_epistemic_node": { method: "POST", path: "/nodes/archive", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
875
- "archive_ontology": { method: "DELETE", path: "/ontologies", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
876
- "archive_question": { method: "DELETE", path: "/questions", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
877
- "batch_create_edges": { method: "POST", path: "/edges/batch", kind: "mutation", idempotent: true, surfaceIntent: "mcp_analysis" },
878
- "batch_create_epistemic_nodes": { method: "POST", path: "/nodes/batch", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
879
- "begin_build_session": { method: "POST", path: "/mcp/build-session/begin", kind: "mutation", idempotent: true, surfaceIntent: "system" },
880
- "bisect_confidence": { method: "POST", path: "/beliefs/confidence/bisect", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
881
- "broadcast_message": { method: "POST", path: "/coordination/messages/broadcast", kind: "mutation", idempotent: true, surfaceIntent: "system" },
882
- "check_permission": { method: "POST", path: "/identity/check-permission", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
883
- "claim_files": { method: "POST", path: "/coordination/file-claims", kind: "mutation", idempotent: true, surfaceIntent: "system" },
884
- "compile_context": { method: "POST", path: "/context/compile", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
885
- "complete_task": { method: "POST", path: "/tasks/complete", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
886
- "create_answer": { method: "POST", path: "/answers", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
887
- "create_belief": { method: "POST", path: "/beliefs", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
888
- "create_edge": { method: "POST", path: "/edges", kind: "mutation", idempotent: true, surfaceIntent: "mcp_analysis" },
889
- "create_epistemic_contract": { method: "POST", path: "/contracts", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
890
- "create_epistemic_node": { method: "POST", path: "/nodes", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
891
- "create_evidence": { method: "POST", path: "/evidence", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
892
- "create_lens": { method: "POST", path: "/lenses", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
893
- "create_ontology": { method: "POST", path: "/ontologies", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
894
- "create_ontology_version": { method: "POST", path: "/ontologies/versions", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
895
- "create_question": { method: "POST", path: "/questions", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
896
- "create_task": { method: "POST", path: "/tasks", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
897
- "create_topic": { method: "POST", path: "/topics", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
898
- "deprecate_ontology_version": { method: "POST", path: "/ontologies/versions/deprecate", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
899
- "detect_confirmation_bias": { method: "POST", path: "/graph/confirmation-bias", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
900
- "detect_graph_drift": { method: "POST", path: "/hybrid/drift", kind: "action", idempotent: false, surfaceIntent: "mcp_analysis" },
901
- "discover": { method: "POST", path: "/context/discover", kind: "query", idempotent: false, surfaceIntent: "compatibility" },
902
- "discover_entity_connections": { method: "POST", path: "/context/entity-connections", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
903
- "end_session": { method: "POST", path: "/coordination/end-session", kind: "mutation", idempotent: true, surfaceIntent: "system" },
904
- "evaluate_contract": { method: "POST", path: "/contracts/evaluate", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
905
- "expand_graph_neighborhood": { method: "POST", path: "/hybrid/neighborhood", kind: "action", idempotent: false, surfaceIntent: "mcp_analysis" },
906
- "filter_by_permission": { method: "POST", path: "/identity/filter-by-permission", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
907
- "find_contradictions": { method: "POST", path: "/graph/contradictions", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
908
- "find_missing_questions": { method: "POST", path: "/questions/missing", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
909
- "find_related_nodes": { method: "POST", path: "/hybrid/related-nodes", kind: "action", idempotent: false, surfaceIntent: "mcp_analysis" },
910
- "flag_contradiction": { method: "POST", path: "/contradictions", kind: "mutation", idempotent: true, surfaceIntent: "mcp_analysis" },
911
- "fork_belief": { method: "POST", path: "/beliefs/fork", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
912
- "generate_session_handoff": { method: "POST", path: "/bootstrap/session-handoff", kind: "query", idempotent: false, surfaceIntent: "system" },
913
- "get_agent_inbox": { method: "POST", path: "/coordination/messages/inbox", kind: "query", idempotent: false, surfaceIntent: "system" },
914
- "get_answer": { method: "GET", path: "/answers/get", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
915
- "get_audit_trail": { method: "POST", path: "/judgments/audit-trail", kind: "query", idempotent: false, surfaceIntent: "system" },
916
- "get_belief": { method: "GET", path: "/beliefs/get", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
917
- "get_change_history": { method: "POST", path: "/coding/change-history", kind: "query", idempotent: false, surfaceIntent: "system" },
918
- "get_code_context": { method: "POST", path: "/coding/context", kind: "query", idempotent: false, surfaceIntent: "system" },
919
- "get_confidence_history": { method: "POST", path: "/beliefs/confidence-history", kind: "query", idempotent: false, surfaceIntent: "compatibility" },
920
- "get_contract_status": { method: "POST", path: "/contracts/status", kind: "query", idempotent: false, surfaceIntent: "mcp_governance" },
921
- "get_embeddings_by_node_ids": { method: "POST", path: "/embeddings/by-node-ids", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
922
- "get_epistemic_node": { method: "GET", path: "/nodes/get", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
923
- "get_evidence": { method: "GET", path: "/evidence/get", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
924
- "get_failure_log": { method: "POST", path: "/coding/failure-log", kind: "query", idempotent: false, surfaceIntent: "system" },
925
- "get_falsification_questions": { method: "POST", path: "/questions/falsification", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
926
- "get_graph_gaps": { method: "POST", path: "/graph/gaps", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
927
- "get_graph_neighborhood": { method: "POST", path: "/graph/neighborhood", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
928
- "get_graph_structure_analysis": { method: "POST", path: "/graph/structure-analysis", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
929
- "get_high_priority_questions": { method: "POST", path: "/questions/high-priority", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
930
- "get_lattice_coverage": { method: "POST", path: "/scope/belief-lattice/coverage", kind: "query", idempotent: false, surfaceIntent: "system" },
931
- "get_observation_context": { method: "POST", path: "/observations/context", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
932
- "get_ontology": { method: "GET", path: "/ontologies/get", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
933
- "get_question": { method: "GET", path: "/questions/get", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
934
- "get_topic": { method: "GET", path: "/topics/get", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
935
- "get_topic_coverage": { method: "POST", path: "/graph/topic-coverage", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
936
- "get_topic_graph_spine": { method: "GET", path: "/topics/graph-spine", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
937
- "get_topic_tree": { method: "GET", path: "/topics/tree", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
938
- "get_worktree": { method: "GET", path: "/worktrees/get", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
939
- "heartbeat_session": { method: "POST", path: "/coordination/heartbeat-session", kind: "mutation", idempotent: true, surfaceIntent: "system" },
940
- "hybrid_discover": { method: "POST", path: "/hybrid/discover", kind: "action", idempotent: false, surfaceIntent: "mcp_analysis" },
941
- "identity_whoami": { method: "GET", path: "/identity/whoami", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
942
- "ingest_observation": { method: "POST", path: "/observations/ingest", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
943
- "link_evidence": { method: "POST", path: "/evidence/link", kind: "mutation", idempotent: true, surfaceIntent: "compatibility" },
944
- "link_evidence_to_belief": { method: "POST", path: "/evidence/link-belief", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
945
- "link_evidence_to_question": { method: "POST", path: "/evidence/link-question", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
946
- "list_active_sessions": { method: "POST", path: "/coordination/active-sessions", kind: "query", idempotent: false, surfaceIntent: "system" },
947
- "list_all_worktrees": { method: "GET", path: "/worktrees/all", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
948
- "list_beliefs": { method: "GET", path: "/beliefs", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
949
- "list_campaigns": { method: "GET", path: "/worktrees/campaigns", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
950
- "list_epistemic_nodes": { method: "GET", path: "/nodes", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
951
- "list_evidence": { method: "GET", path: "/evidence", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
952
- "list_graph_intelligence_queries": { method: "POST", path: "/graph-intelligence/queries", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
953
- "list_lenses": { method: "GET", path: "/lenses", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
954
- "list_missing_embeddings": { method: "GET", path: "/embeddings/missing", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
955
- "list_ontologies": { method: "GET", path: "/ontologies", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
956
- "list_questions": { method: "GET", path: "/questions", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
957
- "list_tasks": { method: "GET", path: "/tasks", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
958
- "list_topics": { method: "GET", path: "/topics", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
959
- "list_worktrees": { method: "GET", path: "/worktrees", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
960
- "manage_write_policy": { method: "POST", path: "/policy/write-policy/manage", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
961
- "match_entity_type": { method: "POST", path: "/ontologies/match-entity-type", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
962
- "materialize_topic_graph": { method: "POST", path: "/topics/materialize-graph", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
963
- "merge": { method: "POST", path: "/worktrees/merge", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
964
- "modulate_confidence": { method: "POST", path: "/beliefs/confidence", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
965
- "open_pull_request": { method: "POST", path: "/worktrees/open-pull-request", kind: "mutation", idempotent: true, surfaceIntent: "system" },
966
- "pipeline_snapshot": { method: "POST", path: "/worktrees/pipeline-snapshot", kind: "query", idempotent: false, surfaceIntent: "system" },
967
- "publish_ontology_version": { method: "POST", path: "/ontologies/versions/publish", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
968
- "push": { method: "POST", path: "/worktrees/push", kind: "mutation", idempotent: true, surfaceIntent: "system" },
969
- "query_lineage": { method: "POST", path: "/edges/lineage", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
970
- "queue_embedding_backfill": { method: "POST", path: "/embeddings/backfill-queued", kind: "mutation", idempotent: true, surfaceIntent: "mcp_analysis" },
971
- "record_attempt": { method: "POST", path: "/coding/attempts", kind: "mutation", idempotent: true, surfaceIntent: "system" },
972
- "record_judgment": { method: "POST", path: "/judgments", kind: "mutation", idempotent: true, surfaceIntent: "system" },
973
- "record_scope_learning": { method: "POST", path: "/scope/learnings", kind: "mutation", idempotent: true, surfaceIntent: "system" },
974
- "refine_belief": { method: "PATCH", path: "/beliefs/refine", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
975
- "refine_question": { method: "PATCH", path: "/questions/refine", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
976
- "register_session": { method: "POST", path: "/coordination/register-session", kind: "mutation", idempotent: true, surfaceIntent: "system" },
977
- "remove_edge": { method: "DELETE", path: "/edges", kind: "mutation", idempotent: true, surfaceIntent: "mcp_analysis" },
978
- "remove_edges_between": { method: "DELETE", path: "/edges/between", kind: "mutation", idempotent: true, surfaceIntent: "mcp_analysis" },
979
- "remove_lens_from_topic": { method: "DELETE", path: "/lenses/apply", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
980
- "resolve_effective_ontology": { method: "POST", path: "/ontologies/effective", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
981
- "resolve_interactive_principal": { method: "POST", path: "/control-plane/identity/resolve-interactive-principal", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
982
- "resolve_topic_semantic": { method: "POST", path: "/hybrid/topics/resolve", kind: "action", idempotent: false, surfaceIntent: "mcp_analysis" },
983
- "run_graph_intelligence_query": { method: "POST", path: "/graph-intelligence/run", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
984
- "search_beliefs": { method: "POST", path: "/beliefs/search", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
985
- "search_embeddings": { method: "POST", path: "/embeddings/vector-search", kind: "action", idempotent: false, surfaceIntent: "mcp_analysis" },
986
- "search_evidence": { method: "POST", path: "/evidence/search", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
987
- "seed_belief_lattice": { method: "POST", path: "/scope/belief-lattice/seed", kind: "mutation", idempotent: true, surfaceIntent: "system" },
988
- "send_agent_message": { method: "POST", path: "/coordination/messages/send", kind: "mutation", idempotent: true, surfaceIntent: "system" },
989
- "supersede_epistemic_node": { method: "POST", path: "/nodes/supersede", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
990
- "trace_entity_impact": { method: "POST", path: "/graph/trace-entity-impact", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
991
- "traverse_graph": { method: "POST", path: "/graph/traverse", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
992
- "trigger_belief_review": { method: "POST", path: "/context/belief-review", kind: "mutation", idempotent: true, surfaceIntent: "mcp_analysis" },
993
- "update_edge": { method: "PATCH", path: "/edges", kind: "mutation", idempotent: true, surfaceIntent: "mcp_analysis" },
994
- "update_epistemic_node": { method: "PATCH", path: "/nodes", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
995
- "update_ontology": { method: "PATCH", path: "/ontologies", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
996
- "update_question_status": { method: "PATCH", path: "/questions/status", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
997
- "update_task": { method: "PATCH", path: "/tasks", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
998
- "update_topic": { method: "PATCH", path: "/topics", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
999
- "update_worktree_metadata": { method: "PATCH", path: "/worktrees/metadata", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
1000
- "update_worktree_targets": { method: "PATCH", path: "/worktrees/targets", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
1001
- "verify_epistemic_node": { method: "POST", path: "/nodes/verify", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" }
1002
- };
1003
- function createSessionId() {
1004
- return typeof crypto !== "undefined" && typeof crypto.randomUUID === "function" ? crypto.randomUUID() : randomIdempotencyKey();
1005
- }
1006
- function withSdkSessionId(input, sessionId) {
1007
- return {
1008
- ...input,
1009
- __sdkSessionId: typeof input.__sdkSessionId === "string" ? input.__sdkSessionId : sessionId
1010
- };
1011
- }
1012
- function toFunctionSurfaceQuery(input) {
1013
- const params = new URLSearchParams();
1014
- for (const [key, value] of Object.entries(input)) {
1015
- if (value === void 0) {
1016
- continue;
1017
- }
1018
- const serialized2 = typeof value === "string" ? value : JSON.stringify(value);
1019
- if (serialized2 !== void 0) {
1020
- params.set(key, serialized2);
1021
- }
1022
- }
1023
- const serialized = params.toString();
1024
- return serialized ? `?${serialized}` : "";
1025
- }
1026
- function createFunctionSurfaceClient(config = {}) {
1027
- const gateway = createGatewayRequestClient(config);
1028
- const sessionId = createSessionId();
1029
- function execute(name, input, idempotencyKey) {
1030
- const contract = CONTRACTS[name];
1031
- const payload = withSdkSessionId(input, sessionId);
1032
- const path = contract.method === "GET" ? `${contract.path}${toFunctionSurfaceQuery(payload)}` : contract.path;
1033
- return gateway.request({
1034
- path: `/api/platform/v1${path}`,
1035
- method: contract.method,
1036
- body: contract.method === "GET" ? void 0 : payload,
1037
- idempotencyKey: contract.kind !== "query" && Boolean(contract.idempotent) ? idempotencyKey ?? randomIdempotencyKey() : void 0
1038
- });
1039
- }
1040
- return {
1041
- sessionId,
1042
- activateWorktree(input = {}, idempotencyKey) {
1043
- return execute("activate_worktree", input, idempotencyKey);
1044
- },
1045
- addEvidence(input = {}, idempotencyKey) {
1046
- return execute("add_evidence", input, idempotencyKey);
1047
- },
1048
- addWorktree(input = {}, idempotencyKey) {
1049
- return execute("add_worktree", input, idempotencyKey);
1050
- },
1051
- analyzeGraphImpact(input = {}, idempotencyKey) {
1052
- return execute("analyze_graph_impact", input, idempotencyKey);
1053
- },
1054
- analyzeTopicDensity(input = {}, idempotencyKey) {
1055
- return execute("analyze_topic_density", input, idempotencyKey);
1056
- },
1057
- answerQuestion(input = {}, idempotencyKey) {
1058
- return execute("answer_question", input, idempotencyKey);
1059
- },
1060
- applyAutoBranching(input = {}, idempotencyKey) {
1061
- return execute("apply_auto_branching", input, idempotencyKey);
1062
- },
1063
- applyLensToTopic(input = {}, idempotencyKey) {
1064
- return execute("apply_lens_to_topic", input, idempotencyKey);
1065
- },
1066
- applyOntology(input = {}, idempotencyKey) {
1067
- return execute("apply_ontology", input, idempotencyKey);
1068
- },
1069
- archiveBelief(input = {}, idempotencyKey) {
1070
- return execute("archive_belief", input, idempotencyKey);
1071
- },
1072
- archiveEpistemicNode(input = {}, idempotencyKey) {
1073
- return execute("archive_epistemic_node", input, idempotencyKey);
1074
- },
1075
- archiveOntology(input = {}, idempotencyKey) {
1076
- return execute("archive_ontology", input, idempotencyKey);
1077
- },
1078
- archiveQuestion(input = {}, idempotencyKey) {
1079
- return execute("archive_question", input, idempotencyKey);
1080
- },
1081
- batchCreateEdges(input = {}, idempotencyKey) {
1082
- return execute("batch_create_edges", input, idempotencyKey);
1083
- },
1084
- batchCreateEpistemicNodes(input = {}, idempotencyKey) {
1085
- return execute("batch_create_epistemic_nodes", input, idempotencyKey);
1086
- },
1087
- beginBuildSession(input = {}, idempotencyKey) {
1088
- return execute("begin_build_session", input, idempotencyKey);
1089
- },
1090
- bisectConfidence(input = {}, idempotencyKey) {
1091
- return execute("bisect_confidence", input, idempotencyKey);
1092
- },
1093
- broadcastMessage(input = {}, idempotencyKey) {
1094
- return execute("broadcast_message", input, idempotencyKey);
1095
- },
1096
- checkPermission(input = {}, idempotencyKey) {
1097
- return execute("check_permission", input, idempotencyKey);
1098
- },
1099
- claimFiles(input = {}, idempotencyKey) {
1100
- return execute("claim_files", input, idempotencyKey);
1101
- },
1102
- compileContext(input = {}, idempotencyKey) {
1103
- return execute("compile_context", input, idempotencyKey);
1104
- },
1105
- completeTask(input = {}, idempotencyKey) {
1106
- return execute("complete_task", input, idempotencyKey);
1107
- },
1108
- createAnswer(input = {}, idempotencyKey) {
1109
- return execute("create_answer", input, idempotencyKey);
1110
- },
1111
- createBelief(input = {}, idempotencyKey) {
1112
- return execute("create_belief", input, idempotencyKey);
1113
- },
1114
- createEdge(input = {}, idempotencyKey) {
1115
- return execute("create_edge", input, idempotencyKey);
1116
- },
1117
- createEpistemicContract(input = {}, idempotencyKey) {
1118
- return execute("create_epistemic_contract", input, idempotencyKey);
1119
- },
1120
- createEpistemicNode(input = {}, idempotencyKey) {
1121
- return execute("create_epistemic_node", input, idempotencyKey);
1122
- },
1123
- createEvidence(input = {}, idempotencyKey) {
1124
- return execute("create_evidence", input, idempotencyKey);
1125
- },
1126
- createLens(input = {}, idempotencyKey) {
1127
- return execute("create_lens", input, idempotencyKey);
1128
- },
1129
- createOntology(input = {}, idempotencyKey) {
1130
- return execute("create_ontology", input, idempotencyKey);
1131
- },
1132
- createOntologyVersion(input = {}, idempotencyKey) {
1133
- return execute("create_ontology_version", input, idempotencyKey);
1134
- },
1135
- createQuestion(input = {}, idempotencyKey) {
1136
- return execute("create_question", input, idempotencyKey);
1137
- },
1138
- createTask(input = {}, idempotencyKey) {
1139
- return execute("create_task", input, idempotencyKey);
1140
- },
1141
- createTopic(input = {}, idempotencyKey) {
1142
- return execute("create_topic", input, idempotencyKey);
1143
- },
1144
- deprecateOntologyVersion(input = {}, idempotencyKey) {
1145
- return execute("deprecate_ontology_version", input, idempotencyKey);
1146
- },
1147
- detectConfirmationBias(input = {}, idempotencyKey) {
1148
- return execute("detect_confirmation_bias", input, idempotencyKey);
1149
- },
1150
- detectGraphDrift(input = {}, idempotencyKey) {
1151
- return execute("detect_graph_drift", input, idempotencyKey);
1152
- },
1153
- discover(input = {}, idempotencyKey) {
1154
- return execute("discover", input, idempotencyKey);
1155
- },
1156
- discoverEntityConnections(input = {}, idempotencyKey) {
1157
- return execute("discover_entity_connections", input, idempotencyKey);
1158
- },
1159
- endSession(input = {}, idempotencyKey) {
1160
- return execute("end_session", input, idempotencyKey);
1161
- },
1162
- evaluateContract(input = {}, idempotencyKey) {
1163
- return execute("evaluate_contract", input, idempotencyKey);
1164
- },
1165
- expandGraphNeighborhood(input = {}, idempotencyKey) {
1166
- return execute("expand_graph_neighborhood", input, idempotencyKey);
1167
- },
1168
- filterByPermission(input = {}, idempotencyKey) {
1169
- return execute("filter_by_permission", input, idempotencyKey);
1170
- },
1171
- findContradictions(input = {}, idempotencyKey) {
1172
- return execute("find_contradictions", input, idempotencyKey);
1173
- },
1174
- findMissingQuestions(input = {}, idempotencyKey) {
1175
- return execute("find_missing_questions", input, idempotencyKey);
1176
- },
1177
- findRelatedNodes(input = {}, idempotencyKey) {
1178
- return execute("find_related_nodes", input, idempotencyKey);
1179
- },
1180
- flagContradiction(input = {}, idempotencyKey) {
1181
- return execute("flag_contradiction", input, idempotencyKey);
1182
- },
1183
- forkBelief(input = {}, idempotencyKey) {
1184
- return execute("fork_belief", input, idempotencyKey);
1185
- },
1186
- generateSessionHandoff(input = {}, idempotencyKey) {
1187
- return execute("generate_session_handoff", input, idempotencyKey);
1188
- },
1189
- getAgentInbox(input = {}, idempotencyKey) {
1190
- return execute("get_agent_inbox", input, idempotencyKey);
1191
- },
1192
- getAnswer(input = {}, idempotencyKey) {
1193
- return execute("get_answer", input, idempotencyKey);
1194
- },
1195
- getAuditTrail(input = {}, idempotencyKey) {
1196
- return execute("get_audit_trail", input, idempotencyKey);
1197
- },
1198
- getBelief(input = {}, idempotencyKey) {
1199
- return execute("get_belief", input, idempotencyKey);
1200
- },
1201
- getChangeHistory(input = {}, idempotencyKey) {
1202
- return execute("get_change_history", input, idempotencyKey);
1203
- },
1204
- getCodeContext(input = {}, idempotencyKey) {
1205
- return execute("get_code_context", input, idempotencyKey);
1206
- },
1207
- getConfidenceHistory(input = {}, idempotencyKey) {
1208
- return execute("get_confidence_history", input, idempotencyKey);
1209
- },
1210
- getContractStatus(input = {}, idempotencyKey) {
1211
- return execute("get_contract_status", input, idempotencyKey);
1212
- },
1213
- getByNodeIds(input = {}, idempotencyKey) {
1214
- return execute("get_embeddings_by_node_ids", input, idempotencyKey);
1215
- },
1216
- getEpistemicNode(input = {}, idempotencyKey) {
1217
- return execute("get_epistemic_node", input, idempotencyKey);
1218
- },
1219
- getEvidence(input = {}, idempotencyKey) {
1220
- return execute("get_evidence", input, idempotencyKey);
1221
- },
1222
- getFailureLog(input = {}, idempotencyKey) {
1223
- return execute("get_failure_log", input, idempotencyKey);
1224
- },
1225
- getFalsificationQuestions(input = {}, idempotencyKey) {
1226
- return execute("get_falsification_questions", input, idempotencyKey);
1227
- },
1228
- getGraphGaps(input = {}, idempotencyKey) {
1229
- return execute("get_graph_gaps", input, idempotencyKey);
1230
- },
1231
- getGraphNeighborhood(input = {}, idempotencyKey) {
1232
- return execute("get_graph_neighborhood", input, idempotencyKey);
1233
- },
1234
- getGraphStructureAnalysis(input = {}, idempotencyKey) {
1235
- return execute("get_graph_structure_analysis", input, idempotencyKey);
1236
- },
1237
- getHighPriorityQuestions(input = {}, idempotencyKey) {
1238
- return execute("get_high_priority_questions", input, idempotencyKey);
1239
- },
1240
- getLatticeCoverage(input = {}, idempotencyKey) {
1241
- return execute("get_lattice_coverage", input, idempotencyKey);
1242
- },
1243
- getObservationContext(input = {}, idempotencyKey) {
1244
- return execute("get_observation_context", input, idempotencyKey);
1245
- },
1246
- getOntology(input = {}, idempotencyKey) {
1247
- return execute("get_ontology", input, idempotencyKey);
1248
- },
1249
- getQuestion(input = {}, idempotencyKey) {
1250
- return execute("get_question", input, idempotencyKey);
1251
- },
1252
- getTopic(input = {}, idempotencyKey) {
1253
- return execute("get_topic", input, idempotencyKey);
1254
- },
1255
- getTopicCoverage(input = {}, idempotencyKey) {
1256
- return execute("get_topic_coverage", input, idempotencyKey);
1257
- },
1258
- getTopicGraphSpine(input = {}, idempotencyKey) {
1259
- return execute("get_topic_graph_spine", input, idempotencyKey);
1260
- },
1261
- getTopicTree(input = {}, idempotencyKey) {
1262
- return execute("get_topic_tree", input, idempotencyKey);
1263
- },
1264
- getWorktree(input = {}, idempotencyKey) {
1265
- return execute("get_worktree", input, idempotencyKey);
1266
- },
1267
- heartbeatSession(input = {}, idempotencyKey) {
1268
- return execute("heartbeat_session", input, idempotencyKey);
1269
- },
1270
- hybridDiscover(input = {}, idempotencyKey) {
1271
- return execute("hybrid_discover", input, idempotencyKey);
1272
- },
1273
- whoami(input = {}, idempotencyKey) {
1274
- return execute("identity_whoami", input, idempotencyKey);
1275
- },
1276
- ingestObservation(input = {}, idempotencyKey) {
1277
- return execute("ingest_observation", input, idempotencyKey);
1278
- },
1279
- linkEvidence(input = {}, idempotencyKey) {
1280
- return execute("link_evidence", input, idempotencyKey);
1281
- },
1282
- linkEvidenceToBelief(input = {}, idempotencyKey) {
1283
- return execute("link_evidence_to_belief", input, idempotencyKey);
1284
- },
1285
- linkEvidenceToQuestion(input = {}, idempotencyKey) {
1286
- return execute("link_evidence_to_question", input, idempotencyKey);
1287
- },
1288
- listActiveSessions(input = {}, idempotencyKey) {
1289
- return execute("list_active_sessions", input, idempotencyKey);
1290
- },
1291
- listAllWorktrees(input = {}, idempotencyKey) {
1292
- return execute("list_all_worktrees", input, idempotencyKey);
1293
- },
1294
- listBeliefs(input = {}, idempotencyKey) {
1295
- return execute("list_beliefs", input, idempotencyKey);
1296
- },
1297
- listCampaigns(input = {}, idempotencyKey) {
1298
- return execute("list_campaigns", input, idempotencyKey);
1299
- },
1300
- listEpistemicNodes(input = {}, idempotencyKey) {
1301
- return execute("list_epistemic_nodes", input, idempotencyKey);
1302
- },
1303
- listEvidence(input = {}, idempotencyKey) {
1304
- return execute("list_evidence", input, idempotencyKey);
1305
- },
1306
- listGraphIntelligenceQueries(input = {}, idempotencyKey) {
1307
- return execute("list_graph_intelligence_queries", input, idempotencyKey);
1308
- },
1309
- listLenses(input = {}, idempotencyKey) {
1310
- return execute("list_lenses", input, idempotencyKey);
1311
- },
1312
- listMissingForTopic(input = {}, idempotencyKey) {
1313
- return execute("list_missing_embeddings", input, idempotencyKey);
1314
- },
1315
- listOntologies(input = {}, idempotencyKey) {
1316
- return execute("list_ontologies", input, idempotencyKey);
1317
- },
1318
- listQuestions(input = {}, idempotencyKey) {
1319
- return execute("list_questions", input, idempotencyKey);
1320
- },
1321
- listTasks(input = {}, idempotencyKey) {
1322
- return execute("list_tasks", input, idempotencyKey);
1323
- },
1324
- listTopics(input = {}, idempotencyKey) {
1325
- return execute("list_topics", input, idempotencyKey);
1326
- },
1327
- listWorktrees(input = {}, idempotencyKey) {
1328
- return execute("list_worktrees", input, idempotencyKey);
1329
- },
1330
- manageWritePolicy(input = {}, idempotencyKey) {
1331
- return execute("manage_write_policy", input, idempotencyKey);
1332
- },
1333
- matchEntityType(input = {}, idempotencyKey) {
1334
- return execute("match_entity_type", input, idempotencyKey);
1335
- },
1336
- materializeTopicGraph(input = {}, idempotencyKey) {
1337
- return execute("materialize_topic_graph", input, idempotencyKey);
1338
- },
1339
- merge(input = {}, idempotencyKey) {
1340
- return execute("merge", input, idempotencyKey);
1341
- },
1342
- modulateConfidence(input = {}, idempotencyKey) {
1343
- return execute("modulate_confidence", input, idempotencyKey);
1344
- },
1345
- openPullRequest(input = {}, idempotencyKey) {
1346
- return execute("open_pull_request", input, idempotencyKey);
1347
- },
1348
- pipelineSnapshot(input = {}, idempotencyKey) {
1349
- return execute("pipeline_snapshot", input, idempotencyKey);
1350
- },
1351
- publishOntologyVersion(input = {}, idempotencyKey) {
1352
- return execute("publish_ontology_version", input, idempotencyKey);
1353
- },
1354
- push(input = {}, idempotencyKey) {
1355
- return execute("push", input, idempotencyKey);
1356
- },
1357
- queryLineage(input = {}, idempotencyKey) {
1358
- return execute("query_lineage", input, idempotencyKey);
1359
- },
1360
- markEmbeddingBackfillQueued(input = {}, idempotencyKey) {
1361
- return execute("queue_embedding_backfill", input, idempotencyKey);
1362
- },
1363
- recordAttempt(input = {}, idempotencyKey) {
1364
- return execute("record_attempt", input, idempotencyKey);
1365
- },
1366
- recordJudgment(input = {}, idempotencyKey) {
1367
- return execute("record_judgment", input, idempotencyKey);
1368
- },
1369
- recordScopeLearning(input = {}, idempotencyKey) {
1370
- return execute("record_scope_learning", input, idempotencyKey);
1371
- },
1372
- refineBelief(input = {}, idempotencyKey) {
1373
- return execute("refine_belief", input, idempotencyKey);
1374
- },
1375
- refineQuestion(input = {}, idempotencyKey) {
1376
- return execute("refine_question", input, idempotencyKey);
1377
- },
1378
- registerSession(input = {}, idempotencyKey) {
1379
- return execute("register_session", input, idempotencyKey);
1380
- },
1381
- removeEdge(input = {}, idempotencyKey) {
1382
- return execute("remove_edge", input, idempotencyKey);
1383
- },
1384
- removeEdgesBetween(input = {}, idempotencyKey) {
1385
- return execute("remove_edges_between", input, idempotencyKey);
1386
- },
1387
- removeLensFromTopic(input = {}, idempotencyKey) {
1388
- return execute("remove_lens_from_topic", input, idempotencyKey);
1389
- },
1390
- resolveEffectiveOntology(input = {}, idempotencyKey) {
1391
- return execute("resolve_effective_ontology", input, idempotencyKey);
1392
- },
1393
- resolveInteractivePrincipal(input = {}, idempotencyKey) {
1394
- return execute("resolve_interactive_principal", input, idempotencyKey);
1395
- },
1396
- resolveTopicSemantic(input = {}, idempotencyKey) {
1397
- return execute("resolve_topic_semantic", input, idempotencyKey);
1398
- },
1399
- runGraphIntelligenceQuery(input = {}, idempotencyKey) {
1400
- return execute("run_graph_intelligence_query", input, idempotencyKey);
1401
- },
1402
- searchBeliefs(input = {}, idempotencyKey) {
1403
- return execute("search_beliefs", input, idempotencyKey);
1404
- },
1405
- vectorSearchByTopic(input = {}, idempotencyKey) {
1406
- return execute("search_embeddings", input, idempotencyKey);
1407
- },
1408
- searchEvidence(input = {}, idempotencyKey) {
1409
- return execute("search_evidence", input, idempotencyKey);
1410
- },
1411
- seedBeliefLattice(input = {}, idempotencyKey) {
1412
- return execute("seed_belief_lattice", input, idempotencyKey);
1413
- },
1414
- sendAgentMessage(input = {}, idempotencyKey) {
1415
- return execute("send_agent_message", input, idempotencyKey);
1416
- },
1417
- supersedeEpistemicNode(input = {}, idempotencyKey) {
1418
- return execute("supersede_epistemic_node", input, idempotencyKey);
1419
- },
1420
- traceEntityImpact(input = {}, idempotencyKey) {
1421
- return execute("trace_entity_impact", input, idempotencyKey);
1422
- },
1423
- traverseGraph(input = {}, idempotencyKey) {
1424
- return execute("traverse_graph", input, idempotencyKey);
1425
- },
1426
- triggerBeliefReview(input = {}, idempotencyKey) {
1427
- return execute("trigger_belief_review", input, idempotencyKey);
1428
- },
1429
- updateEdge(input = {}, idempotencyKey) {
1430
- return execute("update_edge", input, idempotencyKey);
1431
- },
1432
- updateEpistemicNode(input = {}, idempotencyKey) {
1433
- return execute("update_epistemic_node", input, idempotencyKey);
1434
- },
1435
- updateOntology(input = {}, idempotencyKey) {
1436
- return execute("update_ontology", input, idempotencyKey);
1437
- },
1438
- updateQuestionStatus(input = {}, idempotencyKey) {
1439
- return execute("update_question_status", input, idempotencyKey);
1440
- },
1441
- updateTask(input = {}, idempotencyKey) {
1442
- return execute("update_task", input, idempotencyKey);
1443
- },
1444
- updateTopic(input = {}, idempotencyKey) {
1445
- return execute("update_topic", input, idempotencyKey);
1446
- },
1447
- updateWorktreeMetadata(input = {}, idempotencyKey) {
1448
- return execute("update_worktree_metadata", input, idempotencyKey);
1449
- },
1450
- updateWorktreeTargets(input = {}, idempotencyKey) {
1451
- return execute("update_worktree_targets", input, idempotencyKey);
1452
- },
1453
- verifyEpistemicNode(input = {}, idempotencyKey) {
1454
- return execute("verify_epistemic_node", input, idempotencyKey);
1455
- }
1456
- };
1457
- }
1458
-
1459
- export { FUNCTION_SURFACE_METHOD_PATHS, createFunctionSurfaceClient };
1460
- //# sourceMappingURL=functionSurface.js.map
1
+ export * from "./generated/functionSurface.js";
1461
2
  //# sourceMappingURL=functionSurface.js.map