@lucern/sdk 0.3.0-alpha.0 → 0.3.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/README.md +84 -25
  3. package/dist/adminClient.d.ts +10 -8
  4. package/dist/adminClient.js +242 -39
  5. package/dist/adminClient.js.map +1 -1
  6. package/dist/answersClient.d.ts +2 -0
  7. package/dist/answersClient.js +221 -11
  8. package/dist/answersClient.js.map +1 -1
  9. package/dist/audience/index.d.ts +2 -1
  10. package/dist/audience/index.js +1 -3
  11. package/dist/audience/index.js.map +1 -1
  12. package/dist/audiencesClient.d.ts +18 -16
  13. package/dist/audiencesClient.js +297 -90
  14. package/dist/audiencesClient.js.map +1 -1
  15. package/dist/auditClient.d.ts +2 -0
  16. package/dist/auditClient.js +227 -15
  17. package/dist/auditClient.js.map +1 -1
  18. package/dist/authContext.d.ts +56 -0
  19. package/dist/authContext.js +170 -0
  20. package/dist/authContext.js.map +1 -0
  21. package/dist/authDeviceClient.d.ts +49 -0
  22. package/dist/authDeviceClient.js +121 -0
  23. package/dist/authDeviceClient.js.map +1 -0
  24. package/dist/beliefs/index.d.ts +31 -11
  25. package/dist/beliefs/index.js +3347 -1109
  26. package/dist/beliefs/index.js.map +1 -1
  27. package/dist/beliefsClient.d.ts +18 -31
  28. package/dist/beliefsClient.js +264 -97
  29. package/dist/beliefsClient.js.map +1 -1
  30. package/dist/boundaryClientSurface.d.ts +20 -0
  31. package/dist/boundaryClientSurface.js +73 -0
  32. package/dist/boundaryClientSurface.js.map +1 -0
  33. package/dist/client.d.ts +2969 -27
  34. package/dist/client.js +3347 -1109
  35. package/dist/client.js.map +1 -1
  36. package/dist/clientHelpers.d.ts +48 -0
  37. package/dist/clientHelpers.js +137 -0
  38. package/dist/clientHelpers.js.map +1 -0
  39. package/dist/contextClient.d.ts +6 -3
  40. package/dist/contextClient.js +252 -30
  41. package/dist/contextClient.js.map +1 -1
  42. package/dist/contextFacade.js +25 -16
  43. package/dist/contextFacade.js.map +1 -1
  44. package/dist/contextPackCompiler.js +19 -30
  45. package/dist/contextPackCompiler.js.map +1 -1
  46. package/dist/contextPackPolicy.js +7 -17
  47. package/dist/contextPackPolicy.js.map +1 -1
  48. package/dist/contextTypes.d.ts +2 -0
  49. package/dist/contracts/api-enums.contract.d.ts +1 -1
  50. package/dist/contracts/api-enums.contract.js.map +1 -1
  51. package/dist/contracts/index.d.ts +1 -0
  52. package/dist/contracts/index.js +109 -5
  53. package/dist/contracts/index.js.map +1 -1
  54. package/dist/contracts/lens-filter.contract.js +4 -3
  55. package/dist/contracts/lens-filter.contract.js.map +1 -1
  56. package/dist/contracts/lens-workflow.contract.js +4 -3
  57. package/dist/contracts/lens-workflow.contract.js.map +1 -1
  58. package/dist/contracts/lensFilter.js +4 -3
  59. package/dist/contracts/lensFilter.js.map +1 -1
  60. package/dist/contracts/lensWorkflow.js +4 -3
  61. package/dist/contracts/lensWorkflow.js.map +1 -1
  62. package/dist/contracts/mcpTools.d.ts +46 -1
  63. package/dist/contracts/mcpTools.js +102 -0
  64. package/dist/contracts/mcpTools.js.map +1 -1
  65. package/dist/contracts/workflow-runtime.contract.js +1 -1
  66. package/dist/contracts/workflow-runtime.contract.js.map +1 -1
  67. package/dist/contracts/workflowRuntime.js +1 -1
  68. package/dist/contracts/workflowRuntime.js.map +1 -1
  69. package/dist/contradictions/index.d.ts +24 -4
  70. package/dist/contradictions/index.js +3347 -1109
  71. package/dist/contradictions/index.js.map +1 -1
  72. package/dist/coreClient.d.ts +11 -1
  73. package/dist/coreClient.js +222 -14
  74. package/dist/coreClient.js.map +1 -1
  75. package/dist/decisions/index.d.ts +34 -14
  76. package/dist/decisions/index.js +3347 -1109
  77. package/dist/decisions/index.js.map +1 -1
  78. package/dist/decisionsClient.d.ts +6 -12
  79. package/dist/decisionsClient.js +235 -37
  80. package/dist/decisionsClient.js.map +1 -1
  81. package/dist/edges/index.d.ts +47 -87
  82. package/dist/edges/index.js +3347 -1109
  83. package/dist/edges/index.js.map +1 -1
  84. package/dist/embeddingsClient.d.ts +106 -0
  85. package/dist/embeddingsClient.js +731 -0
  86. package/dist/embeddingsClient.js.map +1 -0
  87. package/dist/eventingClient.d.ts +96 -0
  88. package/dist/eventingClient.js +728 -0
  89. package/dist/eventingClient.js.map +1 -0
  90. package/dist/events.js +6 -3
  91. package/dist/events.js.map +1 -1
  92. package/dist/eventsCore.d.ts +3 -1
  93. package/dist/eventsCore.js +222 -14
  94. package/dist/eventsCore.js.map +1 -1
  95. package/dist/evidence/index.d.ts +25 -4
  96. package/dist/evidence/index.js +3347 -1109
  97. package/dist/evidence/index.js.map +1 -1
  98. package/dist/evidenceClient.d.ts +2 -0
  99. package/dist/evidenceClient.js +222 -14
  100. package/dist/evidenceClient.js.map +1 -1
  101. package/dist/facade/context.d.ts +2 -1
  102. package/dist/facade/context.js +25 -16
  103. package/dist/facade/context.js.map +1 -1
  104. package/dist/functionSurface.d.ts +143 -0
  105. package/dist/functionSurface.js +1204 -0
  106. package/dist/functionSurface.js.map +1 -0
  107. package/dist/functionSurfaceClient.d.ts +8 -0
  108. package/dist/functionSurfaceClient.js +1204 -0
  109. package/dist/functionSurfaceClient.js.map +1 -0
  110. package/dist/gatewayFacades.d.ts +81 -52
  111. package/dist/gatewayFacades.js +483 -169
  112. package/dist/gatewayFacades.js.map +1 -1
  113. package/dist/graphAnalysisClient.d.ts +192 -0
  114. package/dist/graphAnalysisClient.js +799 -0
  115. package/dist/graphAnalysisClient.js.map +1 -0
  116. package/dist/graphClient.d.ts +7 -13
  117. package/dist/graphClient.js +244 -45
  118. package/dist/graphClient.js.map +1 -1
  119. package/dist/graphIntel.d.ts +3 -0
  120. package/dist/graphIntel.js +3 -0
  121. package/dist/graphIntel.js.map +1 -0
  122. package/dist/graphIntelligence.d.ts +2 -0
  123. package/dist/graphIntelligence.js +47 -0
  124. package/dist/graphIntelligence.js.map +1 -0
  125. package/dist/graphRecommendationsClient.d.ts +56 -0
  126. package/dist/graphRecommendationsClient.js +664 -0
  127. package/dist/graphRecommendationsClient.js.map +1 -0
  128. package/dist/graphStateClassifierClient.d.ts +73 -0
  129. package/dist/graphStateClassifierClient.js +716 -0
  130. package/dist/graphStateClassifierClient.js.map +1 -0
  131. package/dist/harnessClient.d.ts +15 -24
  132. package/dist/harnessClient.js +235 -42
  133. package/dist/harnessClient.js.map +1 -1
  134. package/dist/identityClient.d.ts +97 -11
  135. package/dist/identityClient.js +409 -33
  136. package/dist/identityClient.js.map +1 -1
  137. package/dist/index.d.ts +29 -6
  138. package/dist/index.js +3936 -1155
  139. package/dist/index.js.map +1 -1
  140. package/dist/infisicalRuntime.d.ts +42 -0
  141. package/dist/infisicalRuntime.js +314 -0
  142. package/dist/infisicalRuntime.js.map +1 -0
  143. package/dist/jobsClient.d.ts +98 -0
  144. package/dist/jobsClient.js +726 -0
  145. package/dist/jobsClient.js.map +1 -0
  146. package/dist/learningClient.d.ts +8 -6
  147. package/dist/learningClient.js +252 -44
  148. package/dist/learningClient.js.map +1 -1
  149. package/dist/lenses/index.d.ts +82 -42
  150. package/dist/lenses/index.js +3347 -1109
  151. package/dist/lenses/index.js.map +1 -1
  152. package/dist/mcpClient.d.ts +28 -0
  153. package/dist/mcpClient.js +668 -0
  154. package/dist/mcpClient.js.map +1 -0
  155. package/dist/modelRuntimeClient.d.ts +72 -0
  156. package/dist/modelRuntimeClient.js +704 -0
  157. package/dist/modelRuntimeClient.js.map +1 -0
  158. package/dist/nodes/index.d.ts +63 -21
  159. package/dist/nodes/index.js +3347 -1109
  160. package/dist/nodes/index.js.map +1 -1
  161. package/dist/ontologies/index.d.ts +53 -32
  162. package/dist/ontologies/index.js +3347 -1109
  163. package/dist/ontologies/index.js.map +1 -1
  164. package/dist/ontologyClient.d.ts +19 -25
  165. package/dist/ontologyClient.js +258 -40
  166. package/dist/ontologyClient.js.map +1 -1
  167. package/dist/ontologyLinksClient.d.ts +71 -0
  168. package/dist/ontologyLinksClient.js +697 -0
  169. package/dist/ontologyLinksClient.js.map +1 -0
  170. package/dist/opinion.d.ts +2 -2
  171. package/dist/opinion.js +4 -4
  172. package/dist/opinion.js.map +1 -1
  173. package/dist/orgGraphSearchClient.d.ts +85 -0
  174. package/dist/orgGraphSearchClient.js +672 -0
  175. package/dist/orgGraphSearchClient.js.map +1 -0
  176. package/dist/packsClient.d.ts +11 -23
  177. package/dist/packsClient.js +234 -46
  178. package/dist/packsClient.js.map +1 -1
  179. package/dist/policyClient.d.ts +13 -10
  180. package/dist/policyClient.js +243 -25
  181. package/dist/policyClient.js.map +1 -1
  182. package/dist/questions/index.d.ts +24 -4
  183. package/dist/questions/index.js +3347 -1109
  184. package/dist/questions/index.js.map +1 -1
  185. package/dist/realtime/index.d.ts +1 -1
  186. package/dist/reportsClient.d.ts +9 -7
  187. package/dist/reportsClient.js +281 -53
  188. package/dist/reportsClient.js.map +1 -1
  189. package/dist/schemaClient.d.ts +5 -3
  190. package/dist/schemaClient.js +235 -29
  191. package/dist/schemaClient.js.map +1 -1
  192. package/dist/sdkSurface.d.ts +8 -3
  193. package/dist/sdkSurface.js +10 -6
  194. package/dist/sdkSurface.js.map +1 -1
  195. package/dist/sourcesClient.d.ts +2 -0
  196. package/dist/sourcesClient.js +222 -14
  197. package/dist/sourcesClient.js.map +1 -1
  198. package/dist/telemetryClient.d.ts +94 -0
  199. package/dist/telemetryClient.js +741 -0
  200. package/dist/telemetryClient.js.map +1 -0
  201. package/dist/toolRegistryClient.d.ts +115 -0
  202. package/dist/toolRegistryClient.js +767 -0
  203. package/dist/toolRegistryClient.js.map +1 -0
  204. package/dist/topics/index.d.ts +35 -9
  205. package/dist/topics/index.js +3349 -1109
  206. package/dist/topics/index.js.map +1 -1
  207. package/dist/topicsClient.d.ts +4 -0
  208. package/dist/topicsClient.js +237 -24
  209. package/dist/topicsClient.js.map +1 -1
  210. package/dist/types.d.ts +12 -7
  211. package/dist/version.d.ts +1 -1
  212. package/dist/version.js +1 -1
  213. package/dist/version.js.map +1 -1
  214. package/dist/workflowClient.d.ts +76 -45
  215. package/dist/workflowClient.js +262 -65
  216. package/dist/workflowClient.js.map +1 -1
  217. package/dist/worktrees/index.d.ts +78 -39
  218. package/dist/worktrees/index.js +3347 -1109
  219. package/dist/worktrees/index.js.map +1 -1
  220. package/package.json +13 -3
  221. package/dist/client-DAuKnDlx.d.ts +0 -2547
@@ -1,3 +1,170 @@
1
+ // src/authContext.ts
2
+ var LucernSdkAuthContextError = class extends Error {
3
+ reason;
4
+ constructor(reason, message) {
5
+ super(message);
6
+ this.name = "LucernSdkAuthContextError";
7
+ this.reason = reason;
8
+ }
9
+ };
10
+ function cleanString(value) {
11
+ const normalized = value?.trim();
12
+ return normalized ? normalized : void 0;
13
+ }
14
+ function cleanStringList(values) {
15
+ if (!values) {
16
+ return [];
17
+ }
18
+ return values.map((value) => value.trim()).filter(
19
+ (value, index, list) => value.length > 0 && list.indexOf(value) === index
20
+ );
21
+ }
22
+ function requireString(value, reason, label) {
23
+ const normalized = cleanString(value);
24
+ if (!normalized) {
25
+ throw new LucernSdkAuthContextError(
26
+ reason,
27
+ `Canonical Lucern SDK auth context is missing ${label}.`
28
+ );
29
+ }
30
+ return normalized;
31
+ }
32
+ function requirePrincipalType(principalType) {
33
+ if (!principalType) {
34
+ throw new LucernSdkAuthContextError(
35
+ "principal_missing",
36
+ "Canonical Lucern SDK auth context is missing principalType."
37
+ );
38
+ }
39
+ return principalType;
40
+ }
41
+ function requireAuthMode(authMode) {
42
+ if (!authMode) {
43
+ throw new LucernSdkAuthContextError(
44
+ "principal_missing",
45
+ "Canonical Lucern SDK auth context is missing authMode."
46
+ );
47
+ }
48
+ return authMode;
49
+ }
50
+ function ensurePermitMatch(args) {
51
+ const actual = cleanString(args.actual);
52
+ if (actual && actual !== args.expected) {
53
+ throw new LucernSdkAuthContextError(
54
+ "policy_denied",
55
+ `Canonical Lucern SDK auth context has conflicting Permit ${args.field}.`
56
+ );
57
+ }
58
+ }
59
+ function normalizeCanonicalLucernAuthContext(input) {
60
+ if (!input) {
61
+ throw new LucernSdkAuthContextError(
62
+ "principal_missing",
63
+ "Canonical Lucern SDK auth context is required."
64
+ );
65
+ }
66
+ if (input.policyDecision === "deny") {
67
+ throw new LucernSdkAuthContextError(
68
+ "policy_denied",
69
+ "Canonical Lucern SDK auth context carries a denied policy decision."
70
+ );
71
+ }
72
+ const principalId = requireString(
73
+ input.principalId,
74
+ "principal_missing",
75
+ "principalId"
76
+ );
77
+ const tenantId = requireString(input.tenantId, "tenant_missing", "tenantId");
78
+ const workspaceId = requireString(
79
+ input.workspaceId,
80
+ "workspace_missing",
81
+ "workspaceId"
82
+ );
83
+ const roles = cleanStringList(input.roles);
84
+ const scopes = cleanStringList(input.scopes);
85
+ const principalType = requirePrincipalType(input.principalType);
86
+ const authMode = requireAuthMode(input.authMode);
87
+ const roleBasedInteractiveAuth = authMode === "interactive_user" && roles.length > 0;
88
+ if (roles.length === 0 || scopes.length === 0 && !roleBasedInteractiveAuth) {
89
+ throw new LucernSdkAuthContextError(
90
+ "membership_missing",
91
+ "Canonical Lucern SDK auth context requires non-empty roles and scopes."
92
+ );
93
+ }
94
+ const subject = cleanString(input.permit?.subject) ?? principalId;
95
+ const tenant = cleanString(input.permit?.tenant) ?? tenantId;
96
+ const workspace = cleanString(input.permit?.workspace) ?? workspaceId;
97
+ ensurePermitMatch({
98
+ field: "subject",
99
+ expected: principalId,
100
+ actual: subject
101
+ });
102
+ ensurePermitMatch({ field: "tenant", expected: tenantId, actual: tenant });
103
+ ensurePermitMatch({
104
+ field: "workspace",
105
+ expected: workspaceId,
106
+ actual: workspace
107
+ });
108
+ const context = input.permit?.context ? { ...input.permit.context } : void 0;
109
+ return {
110
+ clerkId: cleanString(input.clerkId),
111
+ principalId,
112
+ tenantId,
113
+ workspaceId,
114
+ principalType,
115
+ authMode,
116
+ roles,
117
+ scopes,
118
+ delegationChain: input.delegationChain ? [...input.delegationChain] : [],
119
+ policyTraceId: cleanString(input.policyTraceId),
120
+ correlationId: cleanString(input.correlationId),
121
+ membershipId: cleanString(input.membershipId),
122
+ permit: {
123
+ subject,
124
+ tenant,
125
+ workspace,
126
+ resource: cleanString(input.permit?.resource),
127
+ action: cleanString(input.permit?.action),
128
+ relation: cleanString(input.permit?.relation),
129
+ context
130
+ }
131
+ };
132
+ }
133
+ function createCanonicalAuthHeaders(authContext) {
134
+ const headers = {
135
+ "x-lucern-principal-id": authContext.principalId,
136
+ "x-lucern-principal-type": authContext.principalType,
137
+ "x-lucern-tenant": authContext.tenantId,
138
+ "x-lucern-tenant-id": authContext.tenantId,
139
+ "x-lucern-workspace": authContext.workspaceId,
140
+ "x-lucern-workspace-id": authContext.workspaceId,
141
+ "x-lucern-auth-mode": authContext.authMode,
142
+ "x-lucern-roles": authContext.roles.join(","),
143
+ "x-lucern-scopes": authContext.scopes.join(","),
144
+ "x-lucern-permit-context": JSON.stringify(authContext.permit)
145
+ };
146
+ if (authContext.clerkId) {
147
+ headers["x-lucern-clerk-id"] = authContext.clerkId;
148
+ headers["x-lucern-user-id"] = authContext.clerkId;
149
+ }
150
+ if (authContext.delegationChain.length > 0) {
151
+ headers["x-lucern-delegation-chain"] = JSON.stringify(
152
+ authContext.delegationChain
153
+ );
154
+ }
155
+ if (authContext.policyTraceId) {
156
+ headers["x-lucern-policy-trace-id"] = authContext.policyTraceId;
157
+ }
158
+ if (authContext.correlationId) {
159
+ headers["x-correlation-id"] = authContext.correlationId;
160
+ headers["x-lucern-correlation-id"] = authContext.correlationId;
161
+ }
162
+ if (authContext.membershipId) {
163
+ headers["x-lucern-membership-id"] = authContext.membershipId;
164
+ }
165
+ return headers;
166
+ }
167
+
1
168
  // src/coreClient.ts
2
169
  var LucernApiError = class extends Error {
3
170
  code;
@@ -65,9 +232,7 @@ function generatePortableRequestId() {
65
232
  8
66
233
  ).join("")}-${hex.slice(8, 10).join("")}-${hex.slice(10).join("")}`;
67
234
  }
68
- function randomIdempotencyKey() {
69
- return generatePortableRequestId();
70
- }
235
+ var randomIdempotencyKey = generatePortableRequestId;
71
236
  function isRetryableStatus(status) {
72
237
  return status >= 500 || status === 408 || status === 429;
73
238
  }
@@ -132,8 +297,11 @@ function timeoutError(timeoutMs) {
132
297
  error.name = "AbortError";
133
298
  return error;
134
299
  }
300
+ function isRecord(value) {
301
+ return value !== null && typeof value === "object" && !Array.isArray(value);
302
+ }
135
303
  function readPolicySummaryFromDetails(details) {
136
- if (!details || typeof details !== "object" || Array.isArray(details)) {
304
+ if (!isRecord(details)) {
137
305
  return null;
138
306
  }
139
307
  const directSummary = details.summary;
@@ -141,11 +309,11 @@ function readPolicySummaryFromDetails(details) {
141
309
  return directSummary.trim();
142
310
  }
143
311
  const policy = details.policy;
144
- if (!policy || typeof policy !== "object" || Array.isArray(policy)) {
312
+ if (!isRecord(policy)) {
145
313
  return null;
146
314
  }
147
315
  const explanation = policy.explanation;
148
- if (!explanation || typeof explanation !== "object" || Array.isArray(explanation)) {
316
+ if (!isRecord(explanation)) {
149
317
  return null;
150
318
  }
151
319
  const nestedSummary = explanation.summary;
@@ -154,16 +322,41 @@ function readPolicySummaryFromDetails(details) {
154
322
  }
155
323
  return null;
156
324
  }
325
+ async function resolveConfiguredAuthContext(authContext) {
326
+ if (typeof authContext === "function") {
327
+ return await authContext();
328
+ }
329
+ return authContext;
330
+ }
331
+ function mergeHeaderRecord(base, addition) {
332
+ const headers = new Headers(base);
333
+ for (const [key, value] of Object.entries(addition)) {
334
+ const existing = headers.get(key);
335
+ if (existing !== null && existing !== value) {
336
+ throw new LucernSdkAuthContextError(
337
+ "policy_denied",
338
+ `Canonical Lucern SDK auth context conflicts with existing ${key} header.`
339
+ );
340
+ }
341
+ headers.set(key, value);
342
+ }
343
+ return Object.fromEntries(headers.entries());
344
+ }
157
345
  function createGatewayRequestClient(config = {}) {
158
346
  const fetchImpl = config.fetchImpl ?? fetch;
159
347
  const baseUrl = config.baseUrl?.replace(/\/+$/, "") ?? "";
160
348
  const maxRetries = config.maxRetries ?? 2;
161
349
  const requestIdFactory = config.requestIdFactory ?? (() => generatePortableRequestId());
162
350
  async function resolveAuthHeaders() {
163
- if (!config.getAuthHeaders) {
164
- return {};
351
+ const base = config.getAuthHeaders ? await config.getAuthHeaders() : {};
352
+ const authContextInput = await resolveConfiguredAuthContext(
353
+ config.authContext
354
+ );
355
+ if (!authContextInput && !config.requireCanonicalAuthContext) {
356
+ return base;
165
357
  }
166
- return await config.getAuthHeaders();
358
+ const authContext = normalizeCanonicalLucernAuthContext(authContextInput);
359
+ return mergeHeaderRecord(base, createCanonicalAuthHeaders(authContext));
167
360
  }
168
361
  async function fetchWithTimeout(url, init, timeoutMs) {
169
362
  const controller = new AbortController();
@@ -184,11 +377,11 @@ function createGatewayRequestClient(config = {}) {
184
377
  if (!text) {
185
378
  return null;
186
379
  }
187
- try {
188
- return JSON.parse(text);
189
- } catch {
380
+ const parsed = tryParseGatewayEnvelopeJson(text);
381
+ if (!parsed.ok) {
190
382
  return null;
191
383
  }
384
+ return isRecord(parsed.value) ? parsed.value : null;
192
385
  }
193
386
  function resolveTimeoutMs(method, requestTimeoutMs) {
194
387
  if (typeof requestTimeoutMs === "number") {
@@ -200,16 +393,31 @@ function createGatewayRequestClient(config = {}) {
200
393
  }
201
394
  return config.timeoutMs ?? 15e3;
202
395
  }
396
+ function tryParseGatewayEnvelopeJson(text) {
397
+ const trimmed = text.trim();
398
+ if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) {
399
+ return { ok: false, reason: "non-json" };
400
+ }
401
+ try {
402
+ return { ok: true, value: JSON.parse(trimmed) };
403
+ } catch (error) {
404
+ if (error instanceof SyntaxError) {
405
+ return { ok: false, reason: "invalid-json", error };
406
+ }
407
+ throw error;
408
+ }
409
+ }
203
410
  function buildApiError(args) {
204
411
  const failure = args.failure;
205
- const legacyError = failure && typeof failure.error === "object" && failure.error !== null ? failure.error : failure?.legacyError;
412
+ const legacyError = failure && isRecord(failure.error) ? failure.error : failure?.legacyError;
206
413
  const correlationId = failure?.correlationId ?? args.response.headers.get("x-lucern-correlation-id")?.trim() ?? args.requestId;
207
414
  const policyTraceId = failure?.policyTraceId ?? args.response.headers.get("x-lucern-policy-trace-id")?.trim() ?? null;
208
415
  const details = failure?.details ?? legacyError?.details;
209
416
  const policySummary = readPolicySummaryFromDetails(details);
417
+ const failureMessage = typeof failure?.error === "string" ? failure.error : legacyError?.message;
210
418
  return new LucernApiError({
211
419
  code: failure?.code ?? legacyError?.code ?? fallbackErrorCode(args.response.status),
212
- message: policySummary ?? (typeof failure?.error === "string" ? failure.error : legacyError?.message ?? (args.response.ok ? "Platform API returned an invalid success payload." : "Platform API request failed.")),
420
+ message: policySummary ?? failureMessage ?? (args.response.ok ? "Platform API returned an invalid success payload." : "Platform API request failed."),
213
421
  status: args.response.status,
214
422
  invariant: failure?.invariant,
215
423
  suggestion: failure?.suggestion,
@@ -334,47 +542,18 @@ function createGatewayRequestClient(config = {}) {
334
542
  };
335
543
  }
336
544
 
337
- // src/opinion.ts
338
- function clamp01(value) {
339
- if (!Number.isFinite(value)) {
340
- return 0;
341
- }
342
- return Math.max(0, Math.min(1, value));
343
- }
344
- function vacuous(baseRate = 0.5) {
345
- return { b: 0, d: 0, u: 1, a: clamp01(baseRate) };
346
- }
347
- function dogmatic(probability, baseRate = 0.5) {
348
- const p = clamp01(probability);
349
- return { b: p, d: 1 - p, u: 0, a: clamp01(baseRate) };
350
- }
351
- function opinionFromBaseRate(probability) {
352
- return vacuous(clamp01(probability));
353
- }
354
- function opinionFromDogmatic(probability, baseRate = 0.5) {
355
- return dogmatic(clamp01(probability), clamp01(baseRate));
356
- }
357
- function opinionFromProjected(probability, uncertainty, baseRate = 0.5) {
358
- const p = clamp01(probability);
359
- const u = clamp01(uncertainty);
360
- const remainingMass = 1 - u;
361
- return {
362
- b: p * remainingMass,
363
- d: (1 - p) * remainingMass,
364
- u,
365
- a: clamp01(baseRate)
366
- };
367
- }
368
-
369
545
  // src/sdkSurface.ts
546
+ function isRecord2(value) {
547
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
548
+ }
370
549
  function asRecord(value) {
371
- return value && typeof value === "object" ? value : {};
550
+ return isRecord2(value) ? value : {};
372
551
  }
373
- function cleanString(value) {
552
+ function cleanString2(value) {
374
553
  return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
375
554
  }
376
555
  function normalizeVerificationStatus(value) {
377
- const status = cleanString(value);
556
+ const status = cleanString2(value);
378
557
  if (!status) {
379
558
  return void 0;
380
559
  }
@@ -390,20 +569,20 @@ function cloneWith(value, patch) {
390
569
  return { ...value, ...patch };
391
570
  }
392
571
  function resolveTopicId(value) {
393
- return cleanString(value.topicId);
572
+ return cleanString2(value.topicId);
394
573
  }
395
574
  function resolveText(value) {
396
- return cleanString(value.text) ?? cleanString(value.canonicalText);
575
+ return cleanString2(value.text) ?? cleanString2(value.canonicalText);
397
576
  }
398
577
  function withTopicAlias(value) {
399
- const topicId = cleanString(value.topicId) ?? void 0;
578
+ const topicId = cleanString2(value.topicId) ?? void 0;
400
579
  if (!topicId) {
401
580
  return value;
402
581
  }
403
582
  return cloneWith(value, { topicId });
404
583
  }
405
584
  function withTextAlias(value) {
406
- const text = cleanString(value.text) ?? cleanString(value.canonicalText) ?? void 0;
585
+ const text = cleanString2(value.text) ?? cleanString2(value.canonicalText) ?? void 0;
407
586
  if (!text) {
408
587
  return value;
409
588
  }
@@ -429,11 +608,9 @@ function normalizeNodeWriteInput(value) {
429
608
  }
430
609
  return next;
431
610
  }
432
- function normalizeNodeVerificationStatus(value) {
433
- return normalizeVerificationStatus(value);
434
- }
611
+ var normalizeNodeVerificationStatus = normalizeVerificationStatus;
435
612
  function normalizeTopicQuery(value) {
436
- const topicId = cleanString(value.topicId);
613
+ const topicId = cleanString2(value.topicId);
437
614
  if (!topicId) {
438
615
  return value;
439
616
  }
@@ -458,7 +635,10 @@ function createListResult(items, legacyKey) {
458
635
  total: items.length
459
636
  };
460
637
  if (legacyKey) {
461
- result[legacyKey] = items;
638
+ return {
639
+ ...result,
640
+ [legacyKey]: items
641
+ };
462
642
  }
463
643
  return result;
464
644
  }
@@ -478,7 +658,7 @@ function mapAliasedList(data, legacyKey) {
478
658
  // src/ontologyClient.ts
479
659
  function createOntologyClient(config = {}) {
480
660
  const gateway = createGatewayRequestClient(config);
481
- return {
661
+ const client = {
482
662
  /**
483
663
  * List ontology definitions matching optional filters.
484
664
  */
@@ -487,13 +667,14 @@ function createOntologyClient(config = {}) {
487
667
  path: `/api/platform/v1/ontologies${toQueryString(filters)}`
488
668
  }).then(
489
669
  (response) => mapGatewayData(response, (data) => {
490
- const record = data && typeof data === "object" && !Array.isArray(data) ? data : {};
491
- const ontologies = Array.isArray(record.ontologies) ? record.ontologies : Array.isArray(record.definitions) ? record.definitions : Array.isArray(data) ? data : [];
492
- const total = typeof record.total === "number" && Number.isFinite(record.total) ? record.total : ontologies.length;
670
+ const record = asRecord(data);
671
+ const ontologies = asListItems(data, "ontologies");
672
+ const definitions = ontologies.length > 0 ? ontologies : asListItems(data, "definitions");
673
+ const total = typeof record.total === "number" && Number.isFinite(record.total) ? record.total : definitions.length;
493
674
  return {
494
675
  ...record,
495
- ...createListResult(ontologies, "definitions"),
496
- ontologies,
676
+ ...createListResult(definitions, "definitions"),
677
+ ontologies: definitions,
497
678
  total
498
679
  };
499
680
  })
@@ -520,18 +701,6 @@ function createOntologyClient(config = {}) {
520
701
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
521
702
  });
522
703
  },
523
- /**
524
- * List ontology definitions.
525
- */
526
- async listDefinitions(filters = {}) {
527
- return this.list(filters);
528
- },
529
- /**
530
- * Get an ontology definition.
531
- */
532
- async getDefinition(id) {
533
- return this.get(id);
534
- },
535
704
  /**
536
705
  * Create an ontology definition.
537
706
  */
@@ -573,7 +742,7 @@ function createOntologyClient(config = {}) {
573
742
  }).then(
574
743
  (response) => mapGatewayData(
575
744
  response,
576
- (data) => createListResult(Array.isArray(data) ? data : [], "versions")
745
+ (data) => createListResult(asListItems(data, "versions"), "versions")
577
746
  )
578
747
  );
579
748
  },
@@ -621,20 +790,19 @@ function createOntologyClient(config = {}) {
621
790
  (data) => createListResult(Array.isArray(data) ? data : [], "topics")
622
791
  )
623
792
  );
624
- },
625
- /**
626
- * @deprecated Use listTopics.
627
- */
628
- async listTopicsByOntology(ontologyId) {
629
- return this.listTopics(ontologyId);
630
793
  }
631
794
  };
795
+ return Object.assign(client, {
796
+ listDefinitions: client.list,
797
+ getDefinition: client.get,
798
+ listTopicsByOntology: client.listTopics
799
+ });
632
800
  }
633
801
 
634
802
  // src/graphClient.ts
635
803
  function createGraphClient(config = {}) {
636
804
  const gateway = createGatewayRequestClient(config);
637
- return {
805
+ const client = {
638
806
  /**
639
807
  * List graph nodes matching the provided filters.
640
808
  */
@@ -647,12 +815,6 @@ function createGraphClient(config = {}) {
647
815
  (response) => mapGatewayData(response, (data) => mapAliasedList(data, "nodes"))
648
816
  );
649
817
  },
650
- /**
651
- * @deprecated Use listNodes.
652
- */
653
- async queryNodes(query) {
654
- return this.listNodes(query);
655
- },
656
818
  /**
657
819
  * Retrieve a single graph node by nodeId or globalId.
658
820
  */
@@ -763,12 +925,6 @@ function createGraphClient(config = {}) {
763
925
  )
764
926
  );
765
927
  },
766
- /**
767
- * @deprecated Use listEdges.
768
- */
769
- async queryEdges(query) {
770
- return this.listEdges(query);
771
- },
772
928
  /**
773
929
  * Create a graph edge.
774
930
  */
@@ -856,12 +1012,6 @@ function createGraphClient(config = {}) {
856
1012
  body: normalizeTopicQuery(query)
857
1013
  });
858
1014
  },
859
- /**
860
- * Retrieve a graph neighborhood around a root node.
861
- */
862
- async getNeighborhood(query) {
863
- return this.neighborhood(query);
864
- },
865
1015
  /**
866
1016
  * Retrieve the shortest known path between two graph nodes.
867
1017
  */
@@ -879,6 +1029,48 @@ function createGraphClient(config = {}) {
879
1029
  });
880
1030
  }
881
1031
  };
1032
+ return Object.assign(client, {
1033
+ queryNodes: client.listNodes,
1034
+ queryEdges: client.listEdges,
1035
+ getNeighborhood: client.neighborhood
1036
+ });
1037
+ }
1038
+
1039
+ // src/boundaryClientSurface.ts
1040
+ function cleanOptionalString(value) {
1041
+ const normalized = value?.trim();
1042
+ return normalized ? normalized : void 0;
1043
+ }
1044
+ function isRecord3(value) {
1045
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
1046
+ }
1047
+ function cleanRequiredString(value, label) {
1048
+ const normalized = cleanOptionalString(value);
1049
+ if (!normalized) {
1050
+ throw new Error(`${label} is required`);
1051
+ }
1052
+ return normalized;
1053
+ }
1054
+ function assertKnownKeys(input, allowed, operation) {
1055
+ const allowedSet = new Set(allowed);
1056
+ const unknownKeys = Object.keys(input).filter((key) => !allowedSet.has(key));
1057
+ if (unknownKeys.length > 0) {
1058
+ throw new Error(
1059
+ `${operation} received unsupported field(s): ${unknownKeys.join(", ")}`
1060
+ );
1061
+ }
1062
+ }
1063
+ function knownPayload(input, allowed, operation) {
1064
+ assertKnownKeys(input, allowed, operation);
1065
+ return { ...input };
1066
+ }
1067
+ function listResultFromEnvelope(data, legacyKey) {
1068
+ const record = isRecord3(data) ? data : {};
1069
+ const legacyItems = record[legacyKey];
1070
+ return createListResult(
1071
+ Array.isArray(legacyItems) ? legacyItems : Array.isArray(data) ? data : [],
1072
+ legacyKey
1073
+ );
882
1074
  }
883
1075
 
884
1076
  // src/identityClient.ts
@@ -892,6 +1084,37 @@ function createIdentityWhoamiClient(config = {}) {
892
1084
  }
893
1085
  };
894
1086
  }
1087
+ var TENANT_IDENTITY_FIELDS = [
1088
+ "tenantId",
1089
+ "workspaceId",
1090
+ "principalId",
1091
+ "integrationKey",
1092
+ "secretRef",
1093
+ "policySubject",
1094
+ "policyAction",
1095
+ "policyResource",
1096
+ "decision",
1097
+ "config",
1098
+ "configKey",
1099
+ "configValue",
1100
+ "provider",
1101
+ "status",
1102
+ "metadata",
1103
+ "limit",
1104
+ "cursor"
1105
+ ];
1106
+ function tenantIdentityQuery(input) {
1107
+ return {
1108
+ tenantId: cleanRequiredString(input.tenantId, "tenantId"),
1109
+ workspaceId: input.workspaceId,
1110
+ principalId: input.principalId,
1111
+ limit: input.limit,
1112
+ cursor: input.cursor
1113
+ };
1114
+ }
1115
+ function tenantIdentityBody(input, operation) {
1116
+ return knownPayload(input, TENANT_IDENTITY_FIELDS, operation);
1117
+ }
895
1118
  function createIdentityClient(config = {}) {
896
1119
  const gateway = createGatewayRequestClient(config);
897
1120
  const whoamiClient = createIdentityWhoamiClient(config);
@@ -901,6 +1124,13 @@ function createIdentityClient(config = {}) {
901
1124
  body: input,
902
1125
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
903
1126
  });
1127
+ const updatePrincipal = (input, idempotencyKey) => requestPrincipalWrite("PATCH", input, idempotencyKey);
1128
+ const deleteKey = (keyId, input = {}, idempotencyKey) => gateway.request({
1129
+ path: `/api/platform/v1/identity/keys/${encodeURIComponent(keyId)}/revoke`,
1130
+ method: "POST",
1131
+ body: input,
1132
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1133
+ });
904
1134
  return {
905
1135
  /**
906
1136
  * Resolve the current authenticated identity summary.
@@ -949,15 +1179,11 @@ function createIdentityClient(config = {}) {
949
1179
  /**
950
1180
  * Update a principal.
951
1181
  */
952
- async updatePrincipal(input, idempotencyKey) {
953
- return requestPrincipalWrite("PATCH", input, idempotencyKey);
954
- },
1182
+ updatePrincipal,
955
1183
  /**
956
1184
  * @deprecated Use createPrincipal or updatePrincipal.
957
1185
  */
958
- async upsertPrincipal(input, idempotencyKey) {
959
- return requestPrincipalWrite("PATCH", input, idempotencyKey);
960
- },
1186
+ upsertPrincipal: updatePrincipal,
961
1187
  /**
962
1188
  * List keys in the current identity scope.
963
1189
  */
@@ -996,20 +1222,11 @@ function createIdentityClient(config = {}) {
996
1222
  /**
997
1223
  * Delete an API key by revoking it.
998
1224
  */
999
- async deleteKey(keyId, input = {}, idempotencyKey) {
1000
- return gateway.request({
1001
- path: `/api/platform/v1/identity/keys/${encodeURIComponent(keyId)}/revoke`,
1002
- method: "POST",
1003
- body: input,
1004
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1005
- });
1006
- },
1225
+ deleteKey,
1007
1226
  /**
1008
1227
  * @deprecated Use deleteKey.
1009
1228
  */
1010
- async revokeKey(keyId, input = {}, idempotencyKey) {
1011
- return this.deleteKey(keyId, input, idempotencyKey);
1012
- },
1229
+ revokeKey: deleteKey,
1013
1230
  /**
1014
1231
  * Search Clerk users by email or display attributes.
1015
1232
  */
@@ -1017,20 +1234,120 @@ function createIdentityClient(config = {}) {
1017
1234
  return gateway.request({
1018
1235
  path: `/api/platform/v1/identity/clerk-users${toQueryString({ q })}`
1019
1236
  });
1237
+ },
1238
+ async getTenantConfig(input) {
1239
+ return gateway.request({
1240
+ path: `/api/platform/v1/identity/tenant-config${toQueryString(
1241
+ tenantIdentityQuery(input)
1242
+ )}`
1243
+ });
1244
+ },
1245
+ async updateTenantConfig(input, idempotencyKey) {
1246
+ cleanRequiredString(input.tenantId, "tenantId");
1247
+ return gateway.request({
1248
+ path: "/api/platform/v1/identity/tenant-config",
1249
+ method: "PATCH",
1250
+ body: tenantIdentityBody(
1251
+ input,
1252
+ "identity.updateTenantConfig"
1253
+ ),
1254
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1255
+ });
1256
+ },
1257
+ async listIntegrations(input) {
1258
+ return gateway.request({
1259
+ path: `/api/platform/v1/identity/integrations${toQueryString(
1260
+ tenantIdentityQuery(input)
1261
+ )}`
1262
+ }).then(
1263
+ (response) => mapGatewayData(
1264
+ response,
1265
+ (data) => listResultFromEnvelope(
1266
+ data,
1267
+ "integrations"
1268
+ )
1269
+ )
1270
+ );
1271
+ },
1272
+ async upsertIntegration(input, idempotencyKey) {
1273
+ cleanRequiredString(input.tenantId, "tenantId");
1274
+ cleanRequiredString(input.integrationKey, "integrationKey");
1275
+ return gateway.request({
1276
+ path: "/api/platform/v1/identity/integrations",
1277
+ method: "PUT",
1278
+ body: tenantIdentityBody(
1279
+ input,
1280
+ "identity.upsertIntegration"
1281
+ ),
1282
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1283
+ });
1284
+ },
1285
+ async listSecrets(input) {
1286
+ return gateway.request({
1287
+ path: `/api/platform/v1/identity/secrets${toQueryString(
1288
+ tenantIdentityQuery(input)
1289
+ )}`
1290
+ }).then(
1291
+ (response) => mapGatewayData(
1292
+ response,
1293
+ (data) => listResultFromEnvelope(
1294
+ data,
1295
+ "secrets"
1296
+ )
1297
+ )
1298
+ );
1299
+ },
1300
+ async putSecretReference(input, idempotencyKey) {
1301
+ cleanRequiredString(input.tenantId, "tenantId");
1302
+ cleanRequiredString(input.secretRef, "secretRef");
1303
+ return gateway.request({
1304
+ path: "/api/platform/v1/identity/secrets",
1305
+ method: "PUT",
1306
+ body: tenantIdentityBody(
1307
+ input,
1308
+ "identity.putSecretReference"
1309
+ ),
1310
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1311
+ });
1312
+ },
1313
+ async evaluatePolicy(input, idempotencyKey) {
1314
+ cleanRequiredString(input.tenantId, "tenantId");
1315
+ cleanRequiredString(input.policySubject, "policySubject");
1316
+ cleanRequiredString(input.policyAction, "policyAction");
1317
+ cleanRequiredString(input.policyResource, "policyResource");
1318
+ return gateway.request({
1319
+ path: "/api/platform/v1/identity/policy/evaluate",
1320
+ method: "POST",
1321
+ body: tenantIdentityBody(
1322
+ input,
1323
+ "identity.evaluatePolicy"
1324
+ ),
1325
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1326
+ });
1327
+ },
1328
+ async recordPolicyDecision(input, idempotencyKey) {
1329
+ cleanRequiredString(input.tenantId, "tenantId");
1330
+ cleanRequiredString(input.decision, "decision");
1331
+ return gateway.request({
1332
+ path: "/api/platform/v1/identity/policy/decisions",
1333
+ method: "POST",
1334
+ body: tenantIdentityBody(
1335
+ input,
1336
+ "identity.recordPolicyDecision"
1337
+ ),
1338
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1339
+ });
1020
1340
  }
1021
1341
  };
1022
1342
  }
1023
1343
 
1024
1344
  // src/topicsClient.ts
1025
- function asRecord2(value) {
1026
- return value && typeof value === "object" ? value : {};
1027
- }
1028
- function cleanString2(value) {
1345
+ function cleanString3(value) {
1029
1346
  return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
1030
1347
  }
1031
1348
  function normalizeTopicRecord(value) {
1032
- const record = asRecord2(value);
1033
- const topicId = cleanString2(record.topicId) ?? cleanString2(record.id) ?? cleanString2(record._id);
1349
+ const record = asRecord(value);
1350
+ const topicId = cleanString3(record.topicId) ?? cleanString3(record.id) ?? cleanString3(record._id);
1034
1351
  return withTopicAlias({
1035
1352
  ...record,
1036
1353
  ...topicId ? { topicId } : {}
@@ -1054,7 +1371,7 @@ function createTopicsClient(config = {}) {
1054
1371
  })}`
1055
1372
  }).then(
1056
1373
  (response) => mapGatewayData(response, (data) => {
1057
- const record = asRecord2(data);
1374
+ const record = asRecord(data);
1058
1375
  const items = Array.isArray(record.topics) ? record.topics.map(normalizeTopicRecord) : [];
1059
1376
  return {
1060
1377
  ...createListResult(items, "topics"),
@@ -1071,7 +1388,7 @@ function createTopicsClient(config = {}) {
1071
1388
  }).then(
1072
1389
  (response) => mapGatewayData(
1073
1390
  response,
1074
- (data) => normalizeTopicRecord(asRecord2(data).topic ?? data)
1391
+ (data) => normalizeTopicRecord(asRecord(data).topic ?? data)
1075
1392
  )
1076
1393
  );
1077
1394
  },
@@ -1107,7 +1424,7 @@ function createTopicsClient(config = {}) {
1107
1424
  )}`
1108
1425
  }).then(
1109
1426
  (response) => mapGatewayData(response, (data) => {
1110
- const record = asRecord2(data);
1427
+ const record = asRecord(data);
1111
1428
  return {
1112
1429
  tree: Array.isArray(record.tree) ? record.tree.map(normalizeTopicTreeNode) : []
1113
1430
  };
@@ -1142,11 +1459,7 @@ function createTopicsClient(config = {}) {
1142
1459
 
1143
1460
  // src/gatewayFacades.ts
1144
1461
  function normalizeBeliefConfidenceInput(input) {
1145
- const opinion = "opinion" in input ? input.opinion : input.interpretation === "base_rate" ? opinionFromBaseRate(input.confidence) : input.interpretation === "dogmatic" ? opinionFromDogmatic(input.confidence, input.baseRate) : opinionFromProjected(
1146
- input.confidence,
1147
- input.uncertainty,
1148
- input.baseRate
1149
- );
1462
+ const opinion = input.opinion;
1150
1463
  return {
1151
1464
  belief: opinion.b,
1152
1465
  disbelief: opinion.d,
@@ -1154,6 +1467,11 @@ function normalizeBeliefConfidenceInput(input) {
1154
1467
  baseRate: opinion.a,
1155
1468
  trigger: input.trigger,
1156
1469
  rationale: input.rationale,
1470
+ triggeringEvidenceId: input.triggeringEvidenceId,
1471
+ triggeringQuestionId: input.triggeringQuestionId,
1472
+ triggeringAnswerId: input.triggeringAnswerId,
1473
+ triggeringContradictionId: input.triggeringContradictionId,
1474
+ triggeringWorktreeId: input.triggeringWorktreeId,
1157
1475
  maxInlinePropagationTargets: input.maxInlinePropagationTargets
1158
1476
  };
1159
1477
  }
@@ -1525,7 +1843,7 @@ function createEventsFacade(config = {}) {
1525
1843
  function createGraphFacade(config = {}) {
1526
1844
  const graphClient = createGraphClient(config);
1527
1845
  const gateway = createGatewayRequestClient(config);
1528
- return {
1846
+ const graphFacade = {
1529
1847
  async neighborhood(input) {
1530
1848
  return graphClient.neighborhood({
1531
1849
  globalId: input.globalId,
@@ -1533,18 +1851,6 @@ function createGraphFacade(config = {}) {
1533
1851
  maxDepth: input.maxDepth
1534
1852
  });
1535
1853
  },
1536
- async traverse(input) {
1537
- return graphClient.traverse(input);
1538
- },
1539
- async analyze(input = {}) {
1540
- return graphClient.analyze(input);
1541
- },
1542
- async bias(input = {}) {
1543
- return graphClient.bias(input);
1544
- },
1545
- async gaps(input) {
1546
- return graphClient.gaps(input);
1547
- },
1548
1854
  async falsify(input, idempotencyKey = randomIdempotencyKey()) {
1549
1855
  return gateway.request({
1550
1856
  path: "/api/platform/v1/graph/falsify",
@@ -1554,6 +1860,12 @@ function createGraphFacade(config = {}) {
1554
1860
  });
1555
1861
  }
1556
1862
  };
1863
+ return Object.assign(graphFacade, {
1864
+ traverse: graphClient.traverse,
1865
+ analyze: graphClient.analyze,
1866
+ bias: graphClient.bias,
1867
+ gaps: graphClient.gaps
1868
+ });
1557
1869
  }
1558
1870
  function createIdentityFacade(config = {}) {
1559
1871
  const identityClient = createIdentityClient(config);
@@ -1567,15 +1879,12 @@ function createIdentityFacade(config = {}) {
1567
1879
  function createOntologiesFacade(config = {}) {
1568
1880
  const ontologyClient = createOntologyClient(config);
1569
1881
  const gateway = createGatewayRequestClient(config);
1570
- return {
1882
+ const ontologyFacade = {
1571
1883
  async get(id) {
1572
1884
  return gateway.request({
1573
1885
  path: `/api/platform/v1/ontologies/${encodeURIComponent(id)}`
1574
1886
  });
1575
1887
  },
1576
- async list(query = {}) {
1577
- return ontologyClient.list(query);
1578
- },
1579
1888
  async bind(input, idempotencyKey) {
1580
1889
  return gateway.request({
1581
1890
  path: `/api/platform/v1/ontologies/${encodeURIComponent(input.ontologyId)}/bind`,
@@ -1595,6 +1904,9 @@ function createOntologiesFacade(config = {}) {
1595
1904
  });
1596
1905
  }
1597
1906
  };
1907
+ return Object.assign(ontologyFacade, {
1908
+ list: ontologyClient.list
1909
+ });
1598
1910
  }
1599
1911
  function createQuestionsFacade(config = {}) {
1600
1912
  const gateway = createGatewayRequestClient(config);
@@ -1787,15 +2099,9 @@ function createTasksFacade(config = {}) {
1787
2099
  function createTopicsFacade(config = {}) {
1788
2100
  const topicsClient = createTopicsClient(config);
1789
2101
  return {
1790
- async create(input, idempotencyKey) {
1791
- return topicsClient.create(input, idempotencyKey);
1792
- },
1793
- async get(id) {
1794
- return topicsClient.get(id);
1795
- },
1796
- async list(query = {}) {
1797
- return topicsClient.list(query);
1798
- },
2102
+ create: topicsClient.create,
2103
+ get: topicsClient.get,
2104
+ list: topicsClient.list,
1799
2105
  async update(input, idempotencyKey) {
1800
2106
  const { id, ...rest } = input;
1801
2107
  return topicsClient.update(id, rest, idempotencyKey);
@@ -1811,12 +2117,8 @@ function createTopicsFacade(config = {}) {
1811
2117
  maxDepth: input.maxDepth
1812
2118
  });
1813
2119
  },
1814
- async remove(id, idempotencyKey = randomIdempotencyKey()) {
1815
- return topicsClient.remove(id, idempotencyKey);
1816
- },
1817
- async bulkCreate(input, idempotencyKey = randomIdempotencyKey()) {
1818
- return topicsClient.bulkCreate(input, idempotencyKey);
1819
- }
2120
+ remove: topicsClient.remove,
2121
+ bulkCreate: topicsClient.bulkCreate
1820
2122
  };
1821
2123
  }
1822
2124
  function createWebhooksFacade(config = {}) {
@@ -1893,6 +2195,18 @@ function createWorktreesFacade(config = {}) {
1893
2195
  async list(query) {
1894
2196
  return gateway.request({
1895
2197
  path: `/api/platform/v1/worktrees${toQueryString({
2198
+ topicId: query.topicId,
2199
+ status: query.status,
2200
+ groupBy: query.groupBy,
2201
+ lane: query.lane,
2202
+ campaign: query.campaign,
2203
+ limit: query.limit
2204
+ })}`
2205
+ });
2206
+ },
2207
+ async listCampaigns(query = {}) {
2208
+ return gateway.request({
2209
+ path: `/api/platform/v1/worktrees/campaigns${toQueryString({
1896
2210
  topicId: query.topicId,
1897
2211
  status: query.status,
1898
2212
  limit: query.limit
@@ -1915,10 +2229,10 @@ function createWorktreesFacade(config = {}) {
1915
2229
  objective: input.objective,
1916
2230
  hypothesis: input.hypothesis,
1917
2231
  rationale: input.rationale,
1918
- track: input.track,
1919
- trackPosition: input.trackPosition,
1920
- executionBand: input.executionBand,
1921
- executionOrder: input.executionOrder,
2232
+ campaign: input.campaign,
2233
+ lane: input.lane,
2234
+ laneOrderInCampaign: input.laneOrderInCampaign,
2235
+ orderInLane: input.orderInLane,
1922
2236
  dependsOn: input.dependsOn,
1923
2237
  blocks: input.blocks,
1924
2238
  gate: input.gate,