@lucern/sdk 0.3.0-alpha.2 → 0.3.0-alpha.4

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 (168) hide show
  1. package/dist/adminClient.d.ts +2 -0
  2. package/dist/adminClient.js +195 -3
  3. package/dist/adminClient.js.map +1 -1
  4. package/dist/answersClient.d.ts +2 -0
  5. package/dist/answersClient.js +195 -3
  6. package/dist/answersClient.js.map +1 -1
  7. package/dist/audiencesClient.d.ts +2 -0
  8. package/dist/audiencesClient.js +195 -3
  9. package/dist/audiencesClient.js.map +1 -1
  10. package/dist/auditClient.d.ts +2 -0
  11. package/dist/auditClient.js +197 -5
  12. package/dist/auditClient.js.map +1 -1
  13. package/dist/authContext.d.ts +56 -0
  14. package/dist/authContext.js +170 -0
  15. package/dist/authContext.js.map +1 -0
  16. package/dist/authDeviceClient.d.ts +49 -0
  17. package/dist/authDeviceClient.js +108 -0
  18. package/dist/authDeviceClient.js.map +1 -0
  19. package/dist/beliefs/index.d.ts +19 -2
  20. package/dist/beliefs/index.js +2648 -327
  21. package/dist/beliefs/index.js.map +1 -1
  22. package/dist/beliefsClient.d.ts +2 -0
  23. package/dist/beliefsClient.js +199 -7
  24. package/dist/beliefsClient.js.map +1 -1
  25. package/dist/boundaryClientSurface.d.ts +20 -0
  26. package/dist/boundaryClientSurface.js +66 -0
  27. package/dist/boundaryClientSurface.js.map +1 -0
  28. package/dist/{client-B6aWUUwp.d.ts → client-DOLqClbU.d.ts} +548 -9
  29. package/dist/client.d.ts +20 -3
  30. package/dist/client.js +2648 -327
  31. package/dist/client.js.map +1 -1
  32. package/dist/contextClient.d.ts +2 -0
  33. package/dist/contextClient.js +201 -9
  34. package/dist/contextClient.js.map +1 -1
  35. package/dist/contracts/api-enums.contract.d.ts +1 -1
  36. package/dist/contracts/api-enums.contract.js.map +1 -1
  37. package/dist/contracts/index.d.ts +1 -0
  38. package/dist/contracts/index.js +104 -1
  39. package/dist/contracts/index.js.map +1 -1
  40. package/dist/contracts/mcpTools.d.ts +46 -1
  41. package/dist/contracts/mcpTools.js +102 -0
  42. package/dist/contracts/mcpTools.js.map +1 -1
  43. package/dist/contradictions/index.d.ts +19 -2
  44. package/dist/contradictions/index.js +2648 -327
  45. package/dist/contradictions/index.js.map +1 -1
  46. package/dist/coreClient.d.ts +9 -0
  47. package/dist/coreClient.js +195 -3
  48. package/dist/coreClient.js.map +1 -1
  49. package/dist/decisions/index.d.ts +19 -2
  50. package/dist/decisions/index.js +2648 -327
  51. package/dist/decisions/index.js.map +1 -1
  52. package/dist/decisionsClient.d.ts +2 -0
  53. package/dist/decisionsClient.js +198 -6
  54. package/dist/decisionsClient.js.map +1 -1
  55. package/dist/edges/index.d.ts +19 -2
  56. package/dist/edges/index.js +2648 -327
  57. package/dist/edges/index.js.map +1 -1
  58. package/dist/embeddingsClient.d.ts +106 -0
  59. package/dist/embeddingsClient.js +708 -0
  60. package/dist/embeddingsClient.js.map +1 -0
  61. package/dist/eventingClient.d.ts +96 -0
  62. package/dist/eventingClient.js +705 -0
  63. package/dist/eventingClient.js.map +1 -0
  64. package/dist/eventsCore.d.ts +2 -0
  65. package/dist/eventsCore.js +195 -3
  66. package/dist/eventsCore.js.map +1 -1
  67. package/dist/evidence/index.d.ts +19 -2
  68. package/dist/evidence/index.js +2648 -327
  69. package/dist/evidence/index.js.map +1 -1
  70. package/dist/evidenceClient.d.ts +2 -0
  71. package/dist/evidenceClient.js +195 -3
  72. package/dist/evidenceClient.js.map +1 -1
  73. package/dist/gatewayFacades.d.ts +38 -3
  74. package/dist/gatewayFacades.js +371 -12
  75. package/dist/gatewayFacades.js.map +1 -1
  76. package/dist/graphAnalysisClient.d.ts +147 -0
  77. package/dist/graphAnalysisClient.js +756 -0
  78. package/dist/graphAnalysisClient.js.map +1 -0
  79. package/dist/graphClient.d.ts +2 -0
  80. package/dist/graphClient.js +202 -10
  81. package/dist/graphClient.js.map +1 -1
  82. package/dist/graphRecommendationsClient.d.ts +56 -0
  83. package/dist/graphRecommendationsClient.js +646 -0
  84. package/dist/graphRecommendationsClient.js.map +1 -0
  85. package/dist/graphStateClassifierClient.d.ts +73 -0
  86. package/dist/graphStateClassifierClient.js +694 -0
  87. package/dist/graphStateClassifierClient.js.map +1 -0
  88. package/dist/harnessClient.d.ts +2 -0
  89. package/dist/harnessClient.js +197 -5
  90. package/dist/harnessClient.js.map +1 -1
  91. package/dist/identityClient.d.ts +89 -3
  92. package/dist/identityClient.js +363 -4
  93. package/dist/identityClient.js.map +1 -1
  94. package/dist/index.d.ts +23 -4
  95. package/dist/index.js +3098 -353
  96. package/dist/index.js.map +1 -1
  97. package/dist/infisicalRuntime.d.ts +42 -0
  98. package/dist/infisicalRuntime.js +291 -0
  99. package/dist/infisicalRuntime.js.map +1 -0
  100. package/dist/jobsClient.d.ts +98 -0
  101. package/dist/jobsClient.js +704 -0
  102. package/dist/jobsClient.js.map +1 -0
  103. package/dist/learningClient.d.ts +2 -0
  104. package/dist/learningClient.js +197 -5
  105. package/dist/learningClient.js.map +1 -1
  106. package/dist/lenses/index.d.ts +43 -2
  107. package/dist/lenses/index.js +2648 -327
  108. package/dist/lenses/index.js.map +1 -1
  109. package/dist/mcpClient.d.ts +28 -0
  110. package/dist/mcpClient.js +650 -0
  111. package/dist/mcpClient.js.map +1 -0
  112. package/dist/modelRuntimeClient.d.ts +72 -0
  113. package/dist/modelRuntimeClient.js +681 -0
  114. package/dist/modelRuntimeClient.js.map +1 -0
  115. package/dist/nodes/index.d.ts +37 -2
  116. package/dist/nodes/index.js +2648 -327
  117. package/dist/nodes/index.js.map +1 -1
  118. package/dist/ontologies/index.d.ts +19 -2
  119. package/dist/ontologies/index.js +2648 -327
  120. package/dist/ontologies/index.js.map +1 -1
  121. package/dist/ontologyClient.d.ts +2 -0
  122. package/dist/ontologyClient.js +195 -3
  123. package/dist/ontologyClient.js.map +1 -1
  124. package/dist/ontologyLinksClient.d.ts +71 -0
  125. package/dist/ontologyLinksClient.js +675 -0
  126. package/dist/ontologyLinksClient.js.map +1 -0
  127. package/dist/orgGraphSearchClient.d.ts +85 -0
  128. package/dist/orgGraphSearchClient.js +652 -0
  129. package/dist/orgGraphSearchClient.js.map +1 -0
  130. package/dist/packRuntime.d.ts +1 -2
  131. package/dist/packsClient.d.ts +2 -0
  132. package/dist/packsClient.js +195 -3
  133. package/dist/packsClient.js.map +1 -1
  134. package/dist/policyClient.d.ts +2 -0
  135. package/dist/policyClient.js +195 -3
  136. package/dist/policyClient.js.map +1 -1
  137. package/dist/questions/index.d.ts +19 -2
  138. package/dist/questions/index.js +2648 -327
  139. package/dist/questions/index.js.map +1 -1
  140. package/dist/reportsClient.d.ts +2 -0
  141. package/dist/reportsClient.js +197 -5
  142. package/dist/reportsClient.js.map +1 -1
  143. package/dist/schemaClient.d.ts +2 -0
  144. package/dist/schemaClient.js +195 -3
  145. package/dist/schemaClient.js.map +1 -1
  146. package/dist/sdkSurface.d.ts +2 -0
  147. package/dist/sourcesClient.d.ts +2 -0
  148. package/dist/sourcesClient.js +195 -3
  149. package/dist/sourcesClient.js.map +1 -1
  150. package/dist/telemetryClient.d.ts +94 -0
  151. package/dist/telemetryClient.js +719 -0
  152. package/dist/telemetryClient.js.map +1 -0
  153. package/dist/toolRegistryClient.d.ts +107 -0
  154. package/dist/toolRegistryClient.js +733 -0
  155. package/dist/toolRegistryClient.js.map +1 -0
  156. package/dist/topics/index.d.ts +19 -2
  157. package/dist/topics/index.js +2648 -327
  158. package/dist/topics/index.js.map +1 -1
  159. package/dist/topicsClient.d.ts +2 -0
  160. package/dist/topicsClient.js +200 -8
  161. package/dist/topicsClient.js.map +1 -1
  162. package/dist/workflowClient.d.ts +43 -7
  163. package/dist/workflowClient.js +200 -8
  164. package/dist/workflowClient.js.map +1 -1
  165. package/dist/worktrees/index.d.ts +43 -2
  166. package/dist/worktrees/index.js +2648 -327
  167. package/dist/worktrees/index.js.map +1 -1
  168. package/package.json +3 -3
@@ -1,9 +1,177 @@
1
1
  import { z } from 'zod';
2
+ import { MCP_GATEWAY_EVALUATE_RESEARCH_CONTRACT_ENDPOINT, MCP_GATEWAY_EVALUATE_ENGINEERING_CONTRACT_ENDPOINT, MCP_GATEWAY_BEGIN_BUILD_SESSION_ENDPOINT, MCP_GATEWAY_WRITE_POLICY_CHECK_ENDPOINT, MCP_GATEWAY_BOOTSTRAP_ENDPOINT } from '@lucern/contracts/mcp-gateway-boundary.contract';
2
3
  import * as sdkMethods_contract from '@lucern/contracts/sdk-methods.contract';
3
4
  export { sdkMethods_contract as methodSchemas };
4
5
  import * as toolContracts from '@lucern/contracts/tool-contracts';
5
6
  export { toolContracts as toolSchemas };
6
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
+
7
175
  // src/coreClient.ts
8
176
  var LucernApiError = class extends Error {
9
177
  code;
@@ -160,16 +328,41 @@ function readPolicySummaryFromDetails(details) {
160
328
  }
161
329
  return null;
162
330
  }
331
+ async function resolveConfiguredAuthContext(authContext) {
332
+ if (typeof authContext === "function") {
333
+ return await authContext();
334
+ }
335
+ return authContext;
336
+ }
337
+ function mergeHeaderRecord(base, addition) {
338
+ const headers = new Headers(base);
339
+ for (const [key, value] of Object.entries(addition)) {
340
+ const existing = headers.get(key);
341
+ if (existing !== null && existing !== value) {
342
+ throw new LucernSdkAuthContextError(
343
+ "policy_denied",
344
+ `Canonical Lucern SDK auth context conflicts with existing ${key} header.`
345
+ );
346
+ }
347
+ headers.set(key, value);
348
+ }
349
+ return Object.fromEntries(headers.entries());
350
+ }
163
351
  function createGatewayRequestClient(config = {}) {
164
352
  const fetchImpl = config.fetchImpl ?? fetch;
165
353
  const baseUrl = config.baseUrl?.replace(/\/+$/, "") ?? "";
166
354
  const maxRetries = config.maxRetries ?? 2;
167
355
  const requestIdFactory = config.requestIdFactory ?? (() => generatePortableRequestId());
168
356
  async function resolveAuthHeaders() {
169
- if (!config.getAuthHeaders) {
170
- return {};
357
+ const base = config.getAuthHeaders ? await config.getAuthHeaders() : {};
358
+ const authContextInput = await resolveConfiguredAuthContext(
359
+ config.authContext
360
+ );
361
+ if (!authContextInput && !config.requireCanonicalAuthContext) {
362
+ return base;
171
363
  }
172
- return await config.getAuthHeaders();
364
+ const authContext = normalizeCanonicalLucernAuthContext(authContextInput);
365
+ return mergeHeaderRecord(base, createCanonicalAuthHeaders(authContext));
173
366
  }
174
367
  async function fetchWithTimeout(url, init, timeoutMs) {
175
368
  const controller = new AbortController();
@@ -344,11 +537,11 @@ function createGatewayRequestClient(config = {}) {
344
537
  function asRecord(value) {
345
538
  return value && typeof value === "object" ? value : {};
346
539
  }
347
- function cleanString(value) {
540
+ function cleanString2(value) {
348
541
  return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
349
542
  }
350
543
  function normalizeVerificationStatus(value) {
351
- const status = cleanString(value);
544
+ const status = cleanString2(value);
352
545
  if (!status) {
353
546
  return void 0;
354
547
  }
@@ -364,20 +557,20 @@ function cloneWith(value, patch) {
364
557
  return { ...value, ...patch };
365
558
  }
366
559
  function resolveTopicId(value) {
367
- return cleanString(value.topicId);
560
+ return cleanString2(value.topicId);
368
561
  }
369
562
  function resolveText(value) {
370
- return cleanString(value.text) ?? cleanString(value.canonicalText);
563
+ return cleanString2(value.text) ?? cleanString2(value.canonicalText);
371
564
  }
372
565
  function withTopicAlias(value) {
373
- const topicId = cleanString(value.topicId) ?? void 0;
566
+ const topicId = cleanString2(value.topicId) ?? void 0;
374
567
  if (!topicId) {
375
568
  return value;
376
569
  }
377
570
  return cloneWith(value, { topicId });
378
571
  }
379
572
  function withTextAlias(value) {
380
- const text = cleanString(value.text) ?? cleanString(value.canonicalText) ?? void 0;
573
+ const text = cleanString2(value.text) ?? cleanString2(value.canonicalText) ?? void 0;
381
574
  if (!text) {
382
575
  return value;
383
576
  }
@@ -407,7 +600,7 @@ function normalizeNodeVerificationStatus(value) {
407
600
  return normalizeVerificationStatus(value);
408
601
  }
409
602
  function normalizeTopicQuery(value) {
410
- const topicId = cleanString(value.topicId);
603
+ const topicId = cleanString2(value.topicId);
411
604
  if (!topicId) {
412
605
  return value;
413
606
  }
@@ -480,9 +673,9 @@ function createAdminClient(config = {}) {
480
673
  /**
481
674
  * List tenants visible to the current principal.
482
675
  */
483
- async listTenants(query = {}) {
676
+ async listTenants(query5 = {}) {
484
677
  return gateway.request({
485
- path: `/api/platform/v1/tenants${toQueryString(query)}`
678
+ path: `/api/platform/v1/tenants${toQueryString(query5)}`
486
679
  }).then(
487
680
  (response) => mapGatewayData(
488
681
  response,
@@ -523,9 +716,9 @@ function createAdminClient(config = {}) {
523
716
  /**
524
717
  * List workspaces for the current admin scope.
525
718
  */
526
- async listWorkspaces(query = {}) {
719
+ async listWorkspaces(query5 = {}) {
527
720
  return gateway.request({
528
- path: `/api/platform/v1/workspaces${toQueryString(query)}`
721
+ path: `/api/platform/v1/workspaces${toQueryString(query5)}`
529
722
  }).then(
530
723
  (response) => mapGatewayData(
531
724
  response,
@@ -550,9 +743,9 @@ function createAdminClient(config = {}) {
550
743
  /**
551
744
  * List memberships for the current admin scope.
552
745
  */
553
- async listMemberships(query = {}) {
746
+ async listMemberships(query5 = {}) {
554
747
  return gateway.request({
555
- path: `/api/platform/v1/memberships${toQueryString(query)}`
748
+ path: `/api/platform/v1/memberships${toQueryString(query5)}`
556
749
  }).then(
557
750
  (response) => mapGatewayData(
558
751
  response,
@@ -789,9 +982,9 @@ function createAdminClient(config = {}) {
789
982
  /**
790
983
  * List group members.
791
984
  */
792
- async listGroupMembers(query) {
985
+ async listGroupMembers(query5) {
793
986
  return gateway.request({
794
- path: `/api/platform/v1/groups/members${toQueryString(query)}`
987
+ path: `/api/platform/v1/groups/members${toQueryString(query5)}`
795
988
  });
796
989
  },
797
990
  /**
@@ -818,9 +1011,9 @@ function createAdminClient(config = {}) {
818
1011
  /**
819
1012
  * List pack-to-group assignments.
820
1013
  */
821
- async listPackGroupAssignments(query = {}) {
1014
+ async listPackGroupAssignments(query5 = {}) {
822
1015
  return gateway.request({
823
- path: `/api/platform/v1/groups/packs${toQueryString(query)}`
1016
+ path: `/api/platform/v1/groups/packs${toQueryString(query5)}`
824
1017
  });
825
1018
  },
826
1019
  /**
@@ -871,12 +1064,12 @@ function createAudiencesClient(config = {}) {
871
1064
  /**
872
1065
  * List audience registry entries.
873
1066
  */
874
- async listRegistry(query = {}) {
1067
+ async listRegistry(query5 = {}) {
875
1068
  return gateway.request({
876
1069
  path: `/api/platform/v1/audiences/registry${toQueryString({
877
- ...query,
878
- effective: typeof query.effective === "boolean" ? query.effective ? "true" : "false" : void 0,
879
- status: query.status
1070
+ ...query5,
1071
+ effective: typeof query5.effective === "boolean" ? query5.effective ? "true" : "false" : void 0,
1072
+ status: query5.status
880
1073
  })}`
881
1074
  }).then(
882
1075
  (response) => mapGatewayData(
@@ -891,8 +1084,8 @@ function createAudiencesClient(config = {}) {
891
1084
  /**
892
1085
  * @deprecated Use listRegistry.
893
1086
  */
894
- async getRegistry(query = {}) {
895
- return this.listRegistry(query);
1087
+ async getRegistry(query5 = {}) {
1088
+ return this.listRegistry(query5);
896
1089
  },
897
1090
  /**
898
1091
  * Create an audience registry entry.
@@ -920,14 +1113,14 @@ function createAudiencesClient(config = {}) {
920
1113
  /**
921
1114
  * List audience grants.
922
1115
  */
923
- async listGrants(query = {}) {
1116
+ async listGrants(query5 = {}) {
924
1117
  return gateway.request({
925
1118
  path: `/api/platform/v1/audiences/grants${toQueryString({
926
- ...query,
927
- audienceKey: query.audienceKey,
928
- principalId: query.principalId,
929
- groupId: query.groupId,
930
- status: query.status
1119
+ ...query5,
1120
+ audienceKey: query5.audienceKey,
1121
+ principalId: query5.principalId,
1122
+ groupId: query5.groupId,
1123
+ status: query5.status
931
1124
  })}`
932
1125
  }).then(
933
1126
  (response) => mapGatewayData(
@@ -939,8 +1132,8 @@ function createAudiencesClient(config = {}) {
939
1132
  /**
940
1133
  * @deprecated Use listGrants.
941
1134
  */
942
- async getGrants(query = {}) {
943
- return this.listGrants(query);
1135
+ async getGrants(query5 = {}) {
1136
+ return this.listGrants(query5);
944
1137
  },
945
1138
  /**
946
1139
  * Create an audience grant.
@@ -986,10 +1179,10 @@ function createAuditClient(config = {}) {
986
1179
  /**
987
1180
  * List audit events for the current scope.
988
1181
  */
989
- async listEvents(query = {}) {
1182
+ async listEvents(query5 = {}) {
990
1183
  return gateway.request({
991
1184
  path: `/api/platform/v1/audit/events${toQueryString(
992
- normalizeTopicQuery(query)
1185
+ normalizeTopicQuery(query5)
993
1186
  )}`
994
1187
  }).then(
995
1188
  (response) => mapGatewayData(
@@ -1001,11 +1194,116 @@ function createAuditClient(config = {}) {
1001
1194
  };
1002
1195
  }
1003
1196
 
1197
+ // src/authDeviceClient.ts
1198
+ var DeviceAuthorizationError = class extends Error {
1199
+ error;
1200
+ interval;
1201
+ constructor(args) {
1202
+ super(args.description ?? args.error);
1203
+ this.name = "DeviceAuthorizationError";
1204
+ this.error = args.error;
1205
+ this.interval = args.interval;
1206
+ }
1207
+ };
1208
+ function authBaseUrl(config) {
1209
+ return config.baseUrl?.replace(/\/+$/, "") ?? "";
1210
+ }
1211
+ async function readJson(response) {
1212
+ const payload = await response.json().catch(() => ({}));
1213
+ return payload && typeof payload === "object" && !Array.isArray(payload) ? payload : {};
1214
+ }
1215
+ function readString(value) {
1216
+ const normalized = typeof value === "string" ? value.trim() : "";
1217
+ return normalized || void 0;
1218
+ }
1219
+ function assertDeviceCodeResponse(payload) {
1220
+ const deviceCode = readString(payload.device_code);
1221
+ const userCode = readString(payload.user_code);
1222
+ const verificationUri = readString(payload.verification_uri);
1223
+ const verificationUriComplete = readString(payload.verification_uri_complete);
1224
+ const expiresIn = payload.expires_in;
1225
+ const interval = payload.interval;
1226
+ if (!deviceCode || !userCode || !verificationUri || !verificationUriComplete || typeof expiresIn !== "number" || typeof interval !== "number") {
1227
+ throw new Error("Gateway returned an invalid device-code response.");
1228
+ }
1229
+ return {
1230
+ device_code: deviceCode,
1231
+ user_code: userCode,
1232
+ verification_uri: verificationUri,
1233
+ verification_uri_complete: verificationUriComplete,
1234
+ expires_in: expiresIn,
1235
+ interval
1236
+ };
1237
+ }
1238
+ function assertDeviceTokenResponse(payload) {
1239
+ const accessToken = readString(payload.access_token);
1240
+ const tokenType = readString(payload.token_type);
1241
+ const scope = readString(payload.scope);
1242
+ const tenantId = readString(payload.tenant_id);
1243
+ const principalId = readString(payload.principal_id);
1244
+ if (!accessToken || tokenType !== "Bearer" || typeof payload.expires_in !== "number" || !scope || !tenantId || !principalId) {
1245
+ throw new Error("Gateway returned an invalid device token response.");
1246
+ }
1247
+ return {
1248
+ access_token: accessToken,
1249
+ token_type: "Bearer",
1250
+ expires_in: payload.expires_in,
1251
+ scope,
1252
+ tenant_id: tenantId,
1253
+ workspace_id: readString(payload.workspace_id),
1254
+ principal_id: principalId,
1255
+ user: payload.user && typeof payload.user === "object" && !Array.isArray(payload.user) ? payload.user : void 0
1256
+ };
1257
+ }
1258
+ function maybeThrowDeviceError(payload) {
1259
+ const error = readString(payload.error);
1260
+ throw new DeviceAuthorizationError({
1261
+ error: error ?? "invalid_request",
1262
+ description: readString(payload.error_description),
1263
+ interval: typeof payload.interval === "number" ? payload.interval : void 0
1264
+ });
1265
+ }
1266
+ function createAuthDeviceClient(config = {}) {
1267
+ const fetchImpl = config.fetchImpl ?? fetch;
1268
+ const baseUrl = authBaseUrl(config);
1269
+ async function post(path, body4) {
1270
+ return fetchImpl(`${baseUrl}${path}`, {
1271
+ method: "POST",
1272
+ headers: { "content-type": "application/json" },
1273
+ body: JSON.stringify(body4)
1274
+ });
1275
+ }
1276
+ return {
1277
+ async createDeviceCode(input = {}) {
1278
+ const response = await post("/api/platform/v1/auth/device/code", {
1279
+ client_id: input.clientId ?? "lucern-cli",
1280
+ scope: input.scope ?? "graph.read graph.write"
1281
+ });
1282
+ const payload = await readJson(response);
1283
+ if (!response.ok) {
1284
+ maybeThrowDeviceError(payload);
1285
+ }
1286
+ return assertDeviceCodeResponse(payload);
1287
+ },
1288
+ async pollDeviceToken(deviceCode) {
1289
+ const response = await post("/api/platform/v1/auth/device/token", {
1290
+ grant_type: "urn:ietf:params:oauth:grant-type:device_code",
1291
+ device_code: deviceCode
1292
+ });
1293
+ const payload = await readJson(response);
1294
+ if (!response.ok) {
1295
+ maybeThrowDeviceError(payload);
1296
+ }
1297
+ return assertDeviceTokenResponse(payload);
1298
+ }
1299
+ };
1300
+ }
1301
+
1004
1302
  // src/beliefsClient.ts
1005
1303
  function asRecord2(value) {
1006
1304
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
1007
1305
  }
1008
- function readString(value) {
1306
+ function readString2(value) {
1009
1307
  if (typeof value !== "string") {
1010
1308
  return void 0;
1011
1309
  }
@@ -1042,15 +1340,15 @@ function mapOpinionHistoryEntriesFromGatewayData(payload) {
1042
1340
  const record = asRecord2(value);
1043
1341
  const tuple = normalizeOpinionTuple(record);
1044
1342
  const projected = readNumber(record.confidence) ?? clamp01(tuple.b + tuple.a * tuple.u);
1045
- const triggeringEvidenceId = readString(record.triggeringEvidenceId);
1046
- const triggeringQuestionId = readString(record.triggeringQuestionId);
1047
- const triggeringAnswerId = readString(record.triggeringAnswerId);
1048
- const triggeringContradictionId = readString(
1343
+ const triggeringEvidenceId = readString2(record.triggeringEvidenceId);
1344
+ const triggeringQuestionId = readString2(record.triggeringQuestionId);
1345
+ const triggeringAnswerId = readString2(record.triggeringAnswerId);
1346
+ const triggeringContradictionId = readString2(
1049
1347
  record.triggeringContradictionId
1050
1348
  );
1051
- const triggeringWorktreeId = readString(record.triggeringWorktreeId);
1349
+ const triggeringWorktreeId = readString2(record.triggeringWorktreeId);
1052
1350
  const triggeringRef = triggeringEvidenceId ? { kind: "evidence", id: triggeringEvidenceId } : triggeringQuestionId ? { kind: "question", id: triggeringQuestionId } : triggeringAnswerId ? { kind: "answer", id: triggeringAnswerId } : triggeringContradictionId ? { kind: "contradiction", id: triggeringContradictionId } : triggeringWorktreeId ? { kind: "worktree", id: triggeringWorktreeId } : void 0;
1053
- const trigger = readString(record.trigger);
1351
+ const trigger = readString2(record.trigger);
1054
1352
  if (!trigger) {
1055
1353
  throw new Error("Gateway opinion history entries must include trigger.");
1056
1354
  }
@@ -1063,9 +1361,9 @@ function mapOpinionHistoryEntriesFromGatewayData(payload) {
1063
1361
  P: clamp01(projected),
1064
1362
  trigger,
1065
1363
  ...triggeringRef ? { triggeringRef } : {},
1066
- ...readString(record.rationale) ? { rationale: readString(record.rationale) } : {},
1067
- ...readString(record.userId) ? { userId: readString(record.userId) } : {},
1068
- ...readString(record.slOperator) ? { slOperator: readString(record.slOperator) } : {}
1364
+ ...readString2(record.rationale) ? { rationale: readString2(record.rationale) } : {},
1365
+ ...readString2(record.userId) ? { userId: readString2(record.userId) } : {},
1366
+ ...readString2(record.slOperator) ? { slOperator: readString2(record.slOperator) } : {}
1069
1367
  };
1070
1368
  }).sort((left, right) => left.t - right.t);
1071
1369
  }
@@ -1300,6 +1598,180 @@ function createEvidenceClient(config = {}) {
1300
1598
  }
1301
1599
  };
1302
1600
  }
1601
+
1602
+ // src/boundaryClientSurface.ts
1603
+ function cleanOptionalString(value) {
1604
+ const normalized = value?.trim();
1605
+ return normalized ? normalized : void 0;
1606
+ }
1607
+ function cleanRequiredString(value, label) {
1608
+ const normalized = cleanOptionalString(value);
1609
+ if (!normalized) {
1610
+ throw new Error(`${label} is required`);
1611
+ }
1612
+ return normalized;
1613
+ }
1614
+ function readTopicId(input) {
1615
+ return cleanOptionalString(input.topicId) ?? cleanOptionalString(input.projectId);
1616
+ }
1617
+ function requireTopicId(input) {
1618
+ const topicId = readTopicId(input);
1619
+ if (!topicId) {
1620
+ throw new Error("topicId is required");
1621
+ }
1622
+ return topicId;
1623
+ }
1624
+ function assertKnownKeys(input, allowed, operation) {
1625
+ const allowedSet = new Set(allowed);
1626
+ const unknownKeys = Object.keys(input).filter((key) => !allowedSet.has(key));
1627
+ if (unknownKeys.length > 0) {
1628
+ throw new Error(
1629
+ `${operation} received unsupported field(s): ${unknownKeys.join(", ")}`
1630
+ );
1631
+ }
1632
+ }
1633
+ function knownPayload(input, allowed, operation) {
1634
+ assertKnownKeys(input, allowed, operation);
1635
+ return { ...input };
1636
+ }
1637
+ function topicPayload(input, allowed, operation) {
1638
+ assertKnownKeys(input, allowed, operation);
1639
+ return {
1640
+ ...input,
1641
+ topicId: requireTopicId(input),
1642
+ projectId: void 0
1643
+ };
1644
+ }
1645
+ function listResultFromEnvelope(data, legacyKey) {
1646
+ const record = data && typeof data === "object" ? data : {};
1647
+ return createListResult(
1648
+ Array.isArray(record[legacyKey]) ? record[legacyKey] : Array.isArray(data) ? data : [],
1649
+ legacyKey
1650
+ );
1651
+ }
1652
+
1653
+ // src/eventingClient.ts
1654
+ var EVENTING_FIELDS = [
1655
+ "tenantId",
1656
+ "workspaceId",
1657
+ "principalId",
1658
+ "topicId",
1659
+ "eventId",
1660
+ "eventType",
1661
+ "eventPayload",
1662
+ "webhookId",
1663
+ "deliveryId",
1664
+ "status",
1665
+ "attempt",
1666
+ "statusCode",
1667
+ "error",
1668
+ "responseBody",
1669
+ "durationMs",
1670
+ "metadata",
1671
+ "limit",
1672
+ "cursor"
1673
+ ];
1674
+ function query(input) {
1675
+ return {
1676
+ tenantId: cleanRequiredString(input.tenantId, "tenantId"),
1677
+ workspaceId: input.workspaceId,
1678
+ principalId: input.principalId,
1679
+ topicId: input.topicId,
1680
+ eventType: input.eventType,
1681
+ webhookId: input.webhookId,
1682
+ status: input.status,
1683
+ limit: input.limit,
1684
+ cursor: input.cursor
1685
+ };
1686
+ }
1687
+ function body(input, operation) {
1688
+ return knownPayload(input, EVENTING_FIELDS, operation);
1689
+ }
1690
+ function createEventingClient(config = {}) {
1691
+ const gateway = createGatewayRequestClient(config);
1692
+ return {
1693
+ recordEvent(input, idempotencyKey) {
1694
+ cleanRequiredString(input.tenantId, "tenantId");
1695
+ cleanRequiredString(input.eventType, "eventType");
1696
+ return gateway.request({
1697
+ path: "/api/platform/v1/events",
1698
+ method: "POST",
1699
+ body: body(
1700
+ input,
1701
+ "events.recordEvent"
1702
+ ),
1703
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1704
+ });
1705
+ },
1706
+ listEvents(input) {
1707
+ return gateway.request({
1708
+ path: `/api/platform/v1/events${toQueryString(query(input))}`
1709
+ }).then(
1710
+ (response) => mapGatewayData(
1711
+ response,
1712
+ (data) => listResultFromEnvelope(data, "events")
1713
+ )
1714
+ );
1715
+ },
1716
+ listWebhooks(input) {
1717
+ return gateway.request({
1718
+ path: `/api/platform/v1/webhooks${toQueryString(query(input))}`
1719
+ }).then(
1720
+ (response) => mapGatewayData(
1721
+ response,
1722
+ (data) => listResultFromEnvelope(
1723
+ data,
1724
+ "webhooks"
1725
+ )
1726
+ )
1727
+ );
1728
+ },
1729
+ enqueueDelivery(input, idempotencyKey) {
1730
+ cleanRequiredString(input.tenantId, "tenantId");
1731
+ cleanRequiredString(input.eventId, "eventId");
1732
+ cleanRequiredString(input.webhookId, "webhookId");
1733
+ return gateway.request({
1734
+ path: "/api/platform/v1/events/deliveries",
1735
+ method: "POST",
1736
+ body: body(
1737
+ input,
1738
+ "events.enqueueDelivery"
1739
+ ),
1740
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1741
+ });
1742
+ },
1743
+ recordDeliveryAttempt(input, idempotencyKey) {
1744
+ cleanRequiredString(input.tenantId, "tenantId");
1745
+ cleanRequiredString(input.deliveryId, "deliveryId");
1746
+ return gateway.request({
1747
+ path: `/api/platform/v1/events/deliveries/${encodeURIComponent(
1748
+ input.deliveryId
1749
+ )}/attempts`,
1750
+ method: "POST",
1751
+ body: body(
1752
+ input,
1753
+ "events.recordDeliveryAttempt"
1754
+ ),
1755
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1756
+ });
1757
+ },
1758
+ updateDeliveryStatus(input, idempotencyKey) {
1759
+ cleanRequiredString(input.tenantId, "tenantId");
1760
+ cleanRequiredString(input.deliveryId, "deliveryId");
1761
+ return gateway.request({
1762
+ path: `/api/platform/v1/events/deliveries/${encodeURIComponent(
1763
+ input.deliveryId
1764
+ )}/status`,
1765
+ method: "PATCH",
1766
+ body: body(
1767
+ input,
1768
+ "events.updateDeliveryStatus"
1769
+ ),
1770
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1771
+ });
1772
+ }
1773
+ };
1774
+ }
1303
1775
  var DEFAULT_CUSTOM_NAMESPACE = "custom";
1304
1776
  var RESERVED_NAMESPACES = /* @__PURE__ */ new Set(["lucern"]);
1305
1777
  var CustomToolRegistryError = class extends Error {
@@ -1705,10 +2177,10 @@ function createGraphClient(config = {}) {
1705
2177
  /**
1706
2178
  * List graph nodes matching the provided filters.
1707
2179
  */
1708
- async listNodes(query) {
2180
+ async listNodes(query5) {
1709
2181
  return gateway.request({
1710
2182
  path: `/api/platform/v1/graph/nodes${toQueryString(
1711
- normalizeTopicQuery(query)
2183
+ normalizeTopicQuery(query5)
1712
2184
  )}`
1713
2185
  }).then(
1714
2186
  (response) => mapGatewayData(response, (data) => mapAliasedList(data, "nodes"))
@@ -1717,15 +2189,15 @@ function createGraphClient(config = {}) {
1717
2189
  /**
1718
2190
  * @deprecated Use listNodes.
1719
2191
  */
1720
- async queryNodes(query) {
1721
- return this.listNodes(query);
2192
+ async queryNodes(query5) {
2193
+ return this.listNodes(query5);
1722
2194
  },
1723
2195
  /**
1724
2196
  * Retrieve a single graph node by nodeId or globalId.
1725
2197
  */
1726
- async getNode(query) {
2198
+ async getNode(query5) {
1727
2199
  return gateway.request({
1728
- path: `/api/platform/v1/graph/nodes${toQueryString(query)}`
2200
+ path: `/api/platform/v1/graph/nodes${toQueryString(query5)}`
1729
2201
  }).then(
1730
2202
  (response) => mapGatewayData(
1731
2203
  response,
@@ -1818,10 +2290,10 @@ function createGraphClient(config = {}) {
1818
2290
  /**
1819
2291
  * List graph edges matching the provided filters.
1820
2292
  */
1821
- async listEdges(query) {
2293
+ async listEdges(query5) {
1822
2294
  return gateway.request({
1823
2295
  path: `/api/platform/v1/graph/edges${toQueryString(
1824
- normalizeTopicQuery(query)
2296
+ normalizeTopicQuery(query5)
1825
2297
  )}`
1826
2298
  }).then(
1827
2299
  (response) => mapGatewayData(
@@ -1833,8 +2305,8 @@ function createGraphClient(config = {}) {
1833
2305
  /**
1834
2306
  * @deprecated Use listEdges.
1835
2307
  */
1836
- async queryEdges(query) {
1837
- return this.listEdges(query);
2308
+ async queryEdges(query5) {
2309
+ return this.listEdges(query5);
1838
2310
  },
1839
2311
  /**
1840
2312
  * Create a graph edge.
@@ -1850,9 +2322,9 @@ function createGraphClient(config = {}) {
1850
2322
  /**
1851
2323
  * Delete one or more edges matching the provided filter.
1852
2324
  */
1853
- async deleteEdge(query, idempotencyKey) {
2325
+ async deleteEdge(query5, idempotencyKey) {
1854
2326
  return gateway.request({
1855
- path: `/api/platform/v1/graph/edges${toQueryString(query)}`,
2327
+ path: `/api/platform/v1/graph/edges${toQueryString(query5)}`,
1856
2328
  method: "DELETE",
1857
2329
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1858
2330
  });
@@ -1860,26 +2332,26 @@ function createGraphClient(config = {}) {
1860
2332
  /**
1861
2333
  * Retrieve a graph neighborhood around a root node.
1862
2334
  */
1863
- async neighborhood(query) {
2335
+ async neighborhood(query5) {
1864
2336
  return gateway.request({
1865
- path: `/api/platform/v1/graph/neighborhood${toQueryString(query)}`
2337
+ path: `/api/platform/v1/graph/neighborhood${toQueryString(query5)}`
1866
2338
  });
1867
2339
  },
1868
2340
  /**
1869
2341
  * Traverse the graph from a starting node.
1870
2342
  */
1871
- async traverse(query) {
2343
+ async traverse(query5) {
1872
2344
  return gateway.request({
1873
2345
  path: "/api/platform/v1/graph/traverse",
1874
2346
  method: "POST",
1875
- body: normalizeTopicQuery(query)
2347
+ body: normalizeTopicQuery(query5)
1876
2348
  });
1877
2349
  },
1878
2350
  /**
1879
2351
  * Analyze graph structure for a topic.
1880
2352
  */
1881
- async analyze(query = {}) {
1882
- const normalized = normalizeTopicQuery(query);
2353
+ async analyze(query5 = {}) {
2354
+ const normalized = normalizeTopicQuery(query5);
1883
2355
  return gateway.request({
1884
2356
  path: `/api/platform/v1/graph/analyze${toQueryString({
1885
2357
  topicId: typeof normalized.topicId === "string" ? normalized.topicId : void 0,
@@ -1891,8 +2363,8 @@ function createGraphClient(config = {}) {
1891
2363
  /**
1892
2364
  * Detect confirmation-bias patterns for a topic graph.
1893
2365
  */
1894
- async bias(query = {}) {
1895
- const normalized = normalizeTopicQuery(query);
2366
+ async bias(query5 = {}) {
2367
+ const normalized = normalizeTopicQuery(query5);
1896
2368
  return gateway.request({
1897
2369
  path: `/api/platform/v1/graph/bias${toQueryString({
1898
2370
  topicId: typeof normalized.topicId === "string" ? normalized.topicId : void 0,
@@ -1904,8 +2376,8 @@ function createGraphClient(config = {}) {
1904
2376
  /**
1905
2377
  * Find graph gaps for beliefs that still need testing.
1906
2378
  */
1907
- async gaps(query) {
1908
- const normalized = normalizeTopicQuery(query);
2379
+ async gaps(query5) {
2380
+ const normalized = normalizeTopicQuery(query5);
1909
2381
  return gateway.request({
1910
2382
  path: `/api/platform/v1/graph/gaps${toQueryString({
1911
2383
  topicId: typeof normalized.topicId === "string" ? normalized.topicId : void 0,
@@ -1916,33 +2388,33 @@ function createGraphClient(config = {}) {
1916
2388
  /**
1917
2389
  * Search across graph resources within a topic.
1918
2390
  */
1919
- async search(query) {
2391
+ async search(query5) {
1920
2392
  return gateway.request({
1921
2393
  path: "/api/platform/v1/search",
1922
2394
  method: "POST",
1923
- body: normalizeTopicQuery(query)
2395
+ body: normalizeTopicQuery(query5)
1924
2396
  });
1925
2397
  },
1926
2398
  /**
1927
2399
  * Retrieve a graph neighborhood around a root node.
1928
2400
  */
1929
- async getNeighborhood(query) {
1930
- return this.neighborhood(query);
2401
+ async getNeighborhood(query5) {
2402
+ return this.neighborhood(query5);
1931
2403
  },
1932
2404
  /**
1933
2405
  * Retrieve the shortest known path between two graph nodes.
1934
2406
  */
1935
- async getPath(query) {
2407
+ async getPath(query5) {
1936
2408
  return gateway.request({
1937
- path: `/api/platform/v1/graph/path${toQueryString(query)}`
2409
+ path: `/api/platform/v1/graph/path${toQueryString(query5)}`
1938
2410
  });
1939
2411
  },
1940
2412
  /**
1941
2413
  * Retrieve graph analytics for the requested metric.
1942
2414
  */
1943
- async getAnalytics(query = {}) {
2415
+ async getAnalytics(query5 = {}) {
1944
2416
  return gateway.request({
1945
- path: `/api/platform/v1/graph/analytics${toQueryString(query)}`
2417
+ path: `/api/platform/v1/graph/analytics${toQueryString(query5)}`
1946
2418
  });
1947
2419
  }
1948
2420
  };
@@ -1959,6 +2431,37 @@ function createIdentityWhoamiClient(config = {}) {
1959
2431
  }
1960
2432
  };
1961
2433
  }
2434
+ var TENANT_IDENTITY_FIELDS = [
2435
+ "tenantId",
2436
+ "workspaceId",
2437
+ "principalId",
2438
+ "integrationKey",
2439
+ "secretRef",
2440
+ "policySubject",
2441
+ "policyAction",
2442
+ "policyResource",
2443
+ "decision",
2444
+ "config",
2445
+ "configKey",
2446
+ "configValue",
2447
+ "provider",
2448
+ "status",
2449
+ "metadata",
2450
+ "limit",
2451
+ "cursor"
2452
+ ];
2453
+ function tenantIdentityQuery(input) {
2454
+ return {
2455
+ tenantId: cleanRequiredString(input.tenantId, "tenantId"),
2456
+ workspaceId: input.workspaceId,
2457
+ principalId: input.principalId,
2458
+ limit: input.limit,
2459
+ cursor: input.cursor
2460
+ };
2461
+ }
2462
+ function tenantIdentityBody(input, operation) {
2463
+ return knownPayload(input, TENANT_IDENTITY_FIELDS, operation);
2464
+ }
1962
2465
  function createIdentityClient(config = {}) {
1963
2466
  const gateway = createGatewayRequestClient(config);
1964
2467
  const whoamiClient = createIdentityWhoamiClient(config);
@@ -1994,9 +2497,9 @@ function createIdentityClient(config = {}) {
1994
2497
  /**
1995
2498
  * List principals in the current identity scope.
1996
2499
  */
1997
- async listPrincipals(query = {}) {
2500
+ async listPrincipals(query5 = {}) {
1998
2501
  return gateway.request({
1999
- path: `/api/platform/v1/identity/principals${toQueryString(query)}`
2502
+ path: `/api/platform/v1/identity/principals${toQueryString(query5)}`
2000
2503
  }).then(
2001
2504
  (response) => mapGatewayData(
2002
2505
  response,
@@ -2028,9 +2531,9 @@ function createIdentityClient(config = {}) {
2028
2531
  /**
2029
2532
  * List keys in the current identity scope.
2030
2533
  */
2031
- async listKeys(query = {}) {
2534
+ async listKeys(query5 = {}) {
2032
2535
  return gateway.request({
2033
- path: `/api/platform/v1/identity/keys${toQueryString(query)}`
2536
+ path: `/api/platform/v1/identity/keys${toQueryString(query5)}`
2034
2537
  }).then(
2035
2538
  (response) => mapGatewayData(
2036
2539
  response,
@@ -2084,6 +2587,109 @@ function createIdentityClient(config = {}) {
2084
2587
  return gateway.request({
2085
2588
  path: `/api/platform/v1/identity/clerk-users${toQueryString({ q })}`
2086
2589
  });
2590
+ },
2591
+ async getTenantConfig(input) {
2592
+ return gateway.request({
2593
+ path: `/api/platform/v1/identity/tenant-config${toQueryString(
2594
+ tenantIdentityQuery(input)
2595
+ )}`
2596
+ });
2597
+ },
2598
+ async updateTenantConfig(input, idempotencyKey) {
2599
+ cleanRequiredString(input.tenantId, "tenantId");
2600
+ return gateway.request({
2601
+ path: "/api/platform/v1/identity/tenant-config",
2602
+ method: "PATCH",
2603
+ body: tenantIdentityBody(
2604
+ input,
2605
+ "identity.updateTenantConfig"
2606
+ ),
2607
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
2608
+ });
2609
+ },
2610
+ async listIntegrations(input) {
2611
+ return gateway.request({
2612
+ path: `/api/platform/v1/identity/integrations${toQueryString(
2613
+ tenantIdentityQuery(input)
2614
+ )}`
2615
+ }).then(
2616
+ (response) => mapGatewayData(
2617
+ response,
2618
+ (data) => listResultFromEnvelope(
2619
+ data,
2620
+ "integrations"
2621
+ )
2622
+ )
2623
+ );
2624
+ },
2625
+ async upsertIntegration(input, idempotencyKey) {
2626
+ cleanRequiredString(input.tenantId, "tenantId");
2627
+ cleanRequiredString(input.integrationKey, "integrationKey");
2628
+ return gateway.request({
2629
+ path: "/api/platform/v1/identity/integrations",
2630
+ method: "PUT",
2631
+ body: tenantIdentityBody(
2632
+ input,
2633
+ "identity.upsertIntegration"
2634
+ ),
2635
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
2636
+ });
2637
+ },
2638
+ async listSecrets(input) {
2639
+ return gateway.request({
2640
+ path: `/api/platform/v1/identity/secrets${toQueryString(
2641
+ tenantIdentityQuery(input)
2642
+ )}`
2643
+ }).then(
2644
+ (response) => mapGatewayData(
2645
+ response,
2646
+ (data) => listResultFromEnvelope(
2647
+ data,
2648
+ "secrets"
2649
+ )
2650
+ )
2651
+ );
2652
+ },
2653
+ async putSecretReference(input, idempotencyKey) {
2654
+ cleanRequiredString(input.tenantId, "tenantId");
2655
+ cleanRequiredString(input.secretRef, "secretRef");
2656
+ return gateway.request({
2657
+ path: "/api/platform/v1/identity/secrets",
2658
+ method: "PUT",
2659
+ body: tenantIdentityBody(
2660
+ input,
2661
+ "identity.putSecretReference"
2662
+ ),
2663
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
2664
+ });
2665
+ },
2666
+ async evaluatePolicy(input, idempotencyKey) {
2667
+ cleanRequiredString(input.tenantId, "tenantId");
2668
+ cleanRequiredString(input.policySubject, "policySubject");
2669
+ cleanRequiredString(input.policyAction, "policyAction");
2670
+ cleanRequiredString(input.policyResource, "policyResource");
2671
+ return gateway.request({
2672
+ path: "/api/platform/v1/identity/policy/evaluate",
2673
+ method: "POST",
2674
+ body: tenantIdentityBody(
2675
+ input,
2676
+ "identity.evaluatePolicy"
2677
+ ),
2678
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
2679
+ });
2680
+ },
2681
+ async recordPolicyDecision(input, idempotencyKey) {
2682
+ cleanRequiredString(input.tenantId, "tenantId");
2683
+ cleanRequiredString(input.decision, "decision");
2684
+ return gateway.request({
2685
+ path: "/api/platform/v1/identity/policy/decisions",
2686
+ method: "POST",
2687
+ body: tenantIdentityBody(
2688
+ input,
2689
+ "identity.recordPolicyDecision"
2690
+ ),
2691
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
2692
+ });
2087
2693
  }
2088
2694
  };
2089
2695
  }
@@ -2092,12 +2698,12 @@ function createIdentityClient(config = {}) {
2092
2698
  function asRecord3(value) {
2093
2699
  return value && typeof value === "object" ? value : {};
2094
2700
  }
2095
- function cleanString2(value) {
2701
+ function cleanString3(value) {
2096
2702
  return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
2097
2703
  }
2098
2704
  function normalizeTopicRecord(value) {
2099
2705
  const record = asRecord3(value);
2100
- const topicId = cleanString2(record.topicId) ?? cleanString2(record.id) ?? cleanString2(record._id);
2706
+ const topicId = cleanString3(record.topicId) ?? cleanString3(record.id) ?? cleanString3(record._id);
2101
2707
  return withTopicAlias({
2102
2708
  ...record,
2103
2709
  ...topicId ? { topicId } : {}
@@ -2109,15 +2715,15 @@ function normalizeTopicTreeNode(value) {
2109
2715
  function createTopicsClient(config = {}) {
2110
2716
  const gateway = createGatewayRequestClient(config);
2111
2717
  return {
2112
- async list(query = {}) {
2113
- const topicId = resolveTopicId(query);
2718
+ async list(query5 = {}) {
2719
+ const topicId = resolveTopicId(query5);
2114
2720
  return gateway.request({
2115
2721
  path: `/api/platform/v1/topics${toQueryString({
2116
2722
  ...topicId ? { topicId } : {},
2117
- ontologyId: query.ontologyId,
2118
- parentTopicId: query.parentTopicId,
2119
- status: query.status,
2120
- type: query.type
2723
+ ontologyId: query5.ontologyId,
2724
+ parentTopicId: query5.parentTopicId,
2725
+ status: query5.status,
2726
+ type: query5.type
2121
2727
  })}`
2122
2728
  }).then(
2123
2729
  (response) => mapGatewayData(response, (data) => {
@@ -2167,10 +2773,10 @@ function createTopicsClient(config = {}) {
2167
2773
  (response) => mapGatewayData(response, (data) => normalizeTopicRecord(data))
2168
2774
  );
2169
2775
  },
2170
- async getTree(topicId, query = {}) {
2776
+ async getTree(topicId, query5 = {}) {
2171
2777
  return gateway.request({
2172
2778
  path: `/api/platform/v1/topics/${encodeURIComponent(topicId)}/tree${toQueryString(
2173
- query
2779
+ query5
2174
2780
  )}`
2175
2781
  }).then(
2176
2782
  (response) => mapGatewayData(response, (data) => {
@@ -2181,10 +2787,10 @@ function createTopicsClient(config = {}) {
2181
2787
  })
2182
2788
  );
2183
2789
  },
2184
- async getCoverage(topicId, query = {}) {
2790
+ async getCoverage(topicId, query5 = {}) {
2185
2791
  return gateway.request({
2186
2792
  path: `/api/platform/v1/topics/${encodeURIComponent(topicId)}/coverage${toQueryString(
2187
- query
2793
+ query5
2188
2794
  )}`
2189
2795
  });
2190
2796
  },
@@ -2244,15 +2850,15 @@ function createBeliefsFacade(config = {}) {
2244
2850
  path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}`
2245
2851
  });
2246
2852
  },
2247
- async list(query) {
2853
+ async list(query5) {
2248
2854
  return gateway.request({
2249
2855
  path: `/api/platform/v1/beliefs${toQueryString({
2250
- topicId: query.topicId,
2251
- status: query.status,
2252
- worktreeId: query.worktreeId,
2253
- minConfidence: query.minConfidence,
2254
- limit: query.limit,
2255
- cursor: query.cursor
2856
+ topicId: query5.topicId,
2857
+ status: query5.status,
2858
+ worktreeId: query5.worktreeId,
2859
+ minConfidence: query5.minConfidence,
2860
+ limit: query5.limit,
2861
+ cursor: query5.cursor
2256
2862
  })}`
2257
2863
  });
2258
2864
  },
@@ -2388,13 +2994,13 @@ function createContradictionsFacade(config = {}) {
2388
2994
  idempotencyKey
2389
2995
  });
2390
2996
  },
2391
- async list(query) {
2997
+ async list(query5) {
2392
2998
  return gateway.request({
2393
2999
  path: `/api/platform/v1/contradictions${toQueryString({
2394
- topicId: query.topicId,
2395
- status: query.status,
2396
- limit: query.limit,
2397
- cursor: query.cursor
3000
+ topicId: query5.topicId,
3001
+ status: query5.status,
3002
+ limit: query5.limit,
3003
+ cursor: query5.cursor
2398
3004
  })}`
2399
3005
  });
2400
3006
  },
@@ -2416,13 +3022,13 @@ function createEdgesFacade(config = {}) {
2416
3022
  idempotencyKey
2417
3023
  });
2418
3024
  },
2419
- async list(query) {
3025
+ async list(query5) {
2420
3026
  return gateway.request({
2421
3027
  path: `/api/platform/v1/edges${toQueryString({
2422
- sourceId: query.sourceId,
2423
- edgeType: query.edgeType,
2424
- limit: query.limit,
2425
- cursor: query.cursor
3028
+ sourceId: query5.sourceId,
3029
+ edgeType: query5.edgeType,
3030
+ limit: query5.limit,
3031
+ cursor: query5.cursor
2426
3032
  })}`
2427
3033
  });
2428
3034
  },
@@ -2492,13 +3098,13 @@ function createEvidenceFacade(config = {}) {
2492
3098
  path: `/api/platform/v1/evidence/${encodeURIComponent(id)}`
2493
3099
  });
2494
3100
  },
2495
- async list(query) {
3101
+ async list(query5) {
2496
3102
  return gateway.request({
2497
3103
  path: `/api/platform/v1/evidence${toQueryString({
2498
- topicId: query.topicId,
2499
- targetId: query.targetId,
2500
- limit: query.limit,
2501
- cursor: query.cursor
3104
+ topicId: query5.topicId,
3105
+ targetId: query5.targetId,
3106
+ limit: query5.limit,
3107
+ cursor: query5.cursor
2502
3108
  })}`
2503
3109
  });
2504
3110
  },
@@ -2515,11 +3121,11 @@ function createEvidenceFacade(config = {}) {
2515
3121
  idempotencyKey
2516
3122
  });
2517
3123
  },
2518
- async search(query, idempotencyKey = randomIdempotencyKey()) {
3124
+ async search(query5, idempotencyKey = randomIdempotencyKey()) {
2519
3125
  return gateway.request({
2520
3126
  path: "/api/platform/v1/evidence/search",
2521
3127
  method: "POST",
2522
- body: query,
3128
+ body: query5,
2523
3129
  idempotencyKey
2524
3130
  });
2525
3131
  },
@@ -2568,15 +3174,15 @@ function createEvidenceFacade(config = {}) {
2568
3174
  function createEventsFacade(config = {}) {
2569
3175
  const gateway = createGatewayRequestClient(config);
2570
3176
  return {
2571
- async list(query = {}) {
3177
+ async list(query5 = {}) {
2572
3178
  return gateway.request({
2573
3179
  path: `/api/platform/v1/events${toQueryString({
2574
- topicId: query.topicId,
2575
- after: query.after,
2576
- types: serializeTypes(query.types),
2577
- startTime: query.startTime,
2578
- endTime: query.endTime,
2579
- limit: query.limit
3180
+ topicId: query5.topicId,
3181
+ after: query5.after,
3182
+ types: serializeTypes(query5.types),
3183
+ startTime: query5.startTime,
3184
+ endTime: query5.endTime,
3185
+ limit: query5.limit
2580
3186
  })}`
2581
3187
  });
2582
3188
  },
@@ -2641,8 +3247,8 @@ function createOntologiesFacade(config = {}) {
2641
3247
  path: `/api/platform/v1/ontologies/${encodeURIComponent(id)}`
2642
3248
  });
2643
3249
  },
2644
- async list(query = {}) {
2645
- return ontologyClient.list(query);
3250
+ async list(query5 = {}) {
3251
+ return ontologyClient.list(query5);
2646
3252
  },
2647
3253
  async bind(input, idempotencyKey) {
2648
3254
  return gateway.request({
@@ -2680,15 +3286,15 @@ function createQuestionsFacade(config = {}) {
2680
3286
  path: `/api/platform/v1/questions/${encodeURIComponent(id)}`
2681
3287
  });
2682
3288
  },
2683
- async list(query) {
3289
+ async list(query5) {
2684
3290
  return gateway.request({
2685
3291
  path: `/api/platform/v1/questions${toQueryString({
2686
- topicId: query.topicId,
2687
- status: query.status,
2688
- priority: query.priority,
2689
- worktreeId: query.worktreeId,
2690
- limit: query.limit,
2691
- cursor: query.cursor
3292
+ topicId: query5.topicId,
3293
+ status: query5.status,
3294
+ priority: query5.priority,
3295
+ worktreeId: query5.worktreeId,
3296
+ limit: query5.limit,
3297
+ cursor: query5.cursor
2692
3298
  })}`
2693
3299
  });
2694
3300
  },
@@ -2840,13 +3446,13 @@ function createTasksFacade(config = {}) {
2840
3446
  idempotencyKey
2841
3447
  });
2842
3448
  },
2843
- async list(query) {
3449
+ async list(query5) {
2844
3450
  return gateway.request({
2845
3451
  path: `/api/platform/v1/tasks${toQueryString({
2846
- topicId: query.topicId,
2847
- worktreeId: query.worktreeId,
2848
- status: query.status,
2849
- limit: query.limit
3452
+ topicId: query5.topicId,
3453
+ worktreeId: query5.worktreeId,
3454
+ status: query5.status,
3455
+ limit: query5.limit
2850
3456
  })}`
2851
3457
  });
2852
3458
  }
@@ -2861,8 +3467,8 @@ function createTopicsFacade(config = {}) {
2861
3467
  async get(id) {
2862
3468
  return topicsClient.get(id);
2863
3469
  },
2864
- async list(query = {}) {
2865
- return topicsClient.list(query);
3470
+ async list(query5 = {}) {
3471
+ return topicsClient.list(query5);
2866
3472
  },
2867
3473
  async update(input, idempotencyKey) {
2868
3474
  const { id, ...rest } = input;
@@ -2898,10 +3504,10 @@ function createWebhooksFacade(config = {}) {
2898
3504
  idempotencyKey
2899
3505
  });
2900
3506
  },
2901
- async list(query = {}) {
3507
+ async list(query5 = {}) {
2902
3508
  return gateway.request({
2903
3509
  path: `/api/platform/v1/webhooks${toQueryString({
2904
- topicId: query.topicId
3510
+ topicId: query5.topicId
2905
3511
  })}`
2906
3512
  });
2907
3513
  },
@@ -2933,10 +3539,10 @@ function createWebhooksFacade(config = {}) {
2933
3539
  idempotencyKey
2934
3540
  });
2935
3541
  },
2936
- async deliveries(id, query = {}) {
3542
+ async deliveries(id, query5 = {}) {
2937
3543
  return gateway.request({
2938
3544
  path: `/api/platform/v1/webhooks/${encodeURIComponent(id)}/deliveries${toQueryString({
2939
- limit: query.limit
3545
+ limit: query5.limit
2940
3546
  })}`
2941
3547
  });
2942
3548
  },
@@ -2958,24 +3564,24 @@ function createWorktreesFacade(config = {}) {
2958
3564
  idempotencyKey
2959
3565
  });
2960
3566
  },
2961
- async list(query) {
3567
+ async list(query5) {
2962
3568
  return gateway.request({
2963
3569
  path: `/api/platform/v1/worktrees${toQueryString({
2964
- topicId: query.topicId,
2965
- status: query.status,
2966
- groupBy: query.groupBy,
2967
- lane: query.lane,
2968
- campaign: query.campaign,
2969
- limit: query.limit
3570
+ topicId: query5.topicId,
3571
+ status: query5.status,
3572
+ groupBy: query5.groupBy,
3573
+ lane: query5.lane,
3574
+ campaign: query5.campaign,
3575
+ limit: query5.limit
2970
3576
  })}`
2971
3577
  });
2972
3578
  },
2973
- async listCampaigns(query = {}) {
3579
+ async listCampaigns(query5 = {}) {
2974
3580
  return gateway.request({
2975
3581
  path: `/api/platform/v1/worktrees/campaigns${toQueryString({
2976
- topicId: query.topicId,
2977
- status: query.status,
2978
- limit: query.limit
3582
+ topicId: query5.topicId,
3583
+ status: query5.status,
3584
+ limit: query5.limit
2979
3585
  })}`
2980
3586
  });
2981
3587
  },
@@ -3088,12 +3694,12 @@ function createDecisionsClient(config = {}) {
3088
3694
  /**
3089
3695
  * List judgments for a topic scope.
3090
3696
  */
3091
- async listJudgments(query) {
3697
+ async listJudgments(query5) {
3092
3698
  return gateway.request({
3093
3699
  path: `/api/platform/v1/graph/judgments${toQueryString({
3094
- ...normalizeTopicQuery(query),
3095
- includeArchived: typeof query.includeArchived === "boolean" ? query.includeArchived ? "true" : "false" : void 0,
3096
- limit: query.limit
3700
+ ...normalizeTopicQuery(query5),
3701
+ includeArchived: typeof query5.includeArchived === "boolean" ? query5.includeArchived ? "true" : "false" : void 0,
3702
+ limit: query5.limit
3097
3703
  })}`
3098
3704
  }).then(
3099
3705
  (response) => mapGatewayData(response, (data) => {
@@ -3125,30 +3731,30 @@ function createDecisionsClient(config = {}) {
3125
3731
  /**
3126
3732
  * Get readiness signals for creating a judgment.
3127
3733
  */
3128
- async getJudgmentReadiness(query) {
3734
+ async getJudgmentReadiness(query5) {
3129
3735
  return gateway.request({
3130
3736
  path: `/api/platform/v1/graph/judgments/readiness${toQueryString(
3131
- normalizeTopicQuery(query)
3737
+ normalizeTopicQuery(query5)
3132
3738
  )}`
3133
3739
  });
3134
3740
  },
3135
3741
  /**
3136
3742
  * Get calibration analytics for judgment outcomes.
3137
3743
  */
3138
- async getJudgmentCalibration(query) {
3744
+ async getJudgmentCalibration(query5) {
3139
3745
  return gateway.request({
3140
3746
  path: `/api/platform/v1/graph/judgments/calibration${toQueryString(
3141
- normalizeTopicQuery(query)
3747
+ normalizeTopicQuery(query5)
3142
3748
  )}`
3143
3749
  });
3144
3750
  },
3145
3751
  /**
3146
3752
  * List judgments still awaiting outcome review.
3147
3753
  */
3148
- async listPendingOutcomeReviews(query) {
3754
+ async listPendingOutcomeReviews(query5) {
3149
3755
  return gateway.request({
3150
3756
  path: `/api/platform/v1/graph/judgments/pending-outcome-review${toQueryString(
3151
- normalizeTopicQuery(query)
3757
+ normalizeTopicQuery(query5)
3152
3758
  )}`
3153
3759
  }).then(
3154
3760
  (response) => mapGatewayData(response, (data) => {
@@ -3165,19 +3771,19 @@ function createDecisionsClient(config = {}) {
3165
3771
  /**
3166
3772
  * @deprecated Use listPendingOutcomeReviews.
3167
3773
  */
3168
- async listPendingJudgmentOutcomeReview(query) {
3169
- return this.listPendingOutcomeReviews(query);
3774
+ async listPendingJudgmentOutcomeReview(query5) {
3775
+ return this.listPendingOutcomeReviews(query5);
3170
3776
  },
3171
3777
  /**
3172
3778
  * Get audit integrity checks for judgment transitions.
3173
3779
  */
3174
- async getJudgmentTransitionAuditIntegrity(query) {
3780
+ async getJudgmentTransitionAuditIntegrity(query5) {
3175
3781
  return gateway.request({
3176
3782
  path: `/api/platform/v1/graph/judgments/transition-audit-integrity${toQueryString(
3177
3783
  {
3178
- ...normalizeTopicQuery(query),
3179
- judgmentId: query.judgmentId,
3180
- includePassing: typeof query.includePassing === "boolean" ? query.includePassing ? "true" : "false" : void 0
3784
+ ...normalizeTopicQuery(query5),
3785
+ judgmentId: query5.judgmentId,
3786
+ includePassing: typeof query5.includePassing === "boolean" ? query5.includePassing ? "true" : "false" : void 0
3181
3787
  }
3182
3788
  )}`
3183
3789
  });
@@ -3226,58 +3832,170 @@ function createDecisionsClient(config = {}) {
3226
3832
  };
3227
3833
  }
3228
3834
 
3229
- // src/contextClient.ts
3230
- function cleanString3(value) {
3231
- return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
3232
- }
3233
- function cleanNumber(value) {
3234
- return typeof value === "number" && Number.isFinite(value) ? value : void 0;
3835
+ // src/embeddingsClient.ts
3836
+ var EMBEDDINGS_FIELDS = [
3837
+ "topicId",
3838
+ "projectId",
3839
+ "workspaceId",
3840
+ "nodeIds",
3841
+ "nodeType",
3842
+ "embeddingModel",
3843
+ "queryText",
3844
+ "queryVector",
3845
+ "minScore",
3846
+ "limit",
3847
+ "cursor",
3848
+ "metadata"
3849
+ ];
3850
+ function assertNodeIds(nodeIds) {
3851
+ if (!Array.isArray(nodeIds) || nodeIds.length === 0) {
3852
+ throw new Error("nodeIds is required");
3853
+ }
3235
3854
  }
3236
- function cleanBoolean(value) {
3237
- return typeof value === "boolean" ? value : void 0;
3855
+ function missingQuery(input) {
3856
+ return {
3857
+ topicId: requireTopicId(input),
3858
+ workspaceId: cleanRequiredString(input.workspaceId, "workspaceId"),
3859
+ nodeType: input.nodeType,
3860
+ embeddingModel: input.embeddingModel,
3861
+ limit: input.limit,
3862
+ cursor: input.cursor
3863
+ };
3238
3864
  }
3239
- function buildCompileContextRequest(topicId, input = {}) {
3240
- const payload = { topicId };
3241
- const query = cleanString3(input.query);
3242
- if (query) {
3243
- payload.query = query;
3244
- }
3245
- const budget = cleanNumber(input.budget) ?? cleanNumber(input.tokenBudget);
3246
- if (budget !== void 0) {
3247
- payload.budget = budget;
3248
- }
3249
- const ranking = cleanString3(input.ranking) ?? cleanString3(input.rankingProfile);
3250
- if (ranking) {
3251
- payload.ranking = ranking;
3252
- }
3253
- const limit = cleanNumber(input.limit);
3254
- if (limit !== void 0) {
3255
- payload.limit = limit;
3256
- }
3257
- const maxDepth = cleanNumber(input.maxDepth);
3258
- if (maxDepth !== void 0) {
3259
- payload.maxDepth = maxDepth;
3260
- }
3261
- const includeEntities = cleanBoolean(input.includeEntities);
3262
- if (includeEntities !== void 0) {
3263
- payload.includeEntities = includeEntities;
3264
- }
3265
- const mode = cleanString3(input.mode);
3266
- if (mode) {
3267
- payload.mode = mode;
3268
- }
3269
- const includeFailures = cleanBoolean(input.includeFailures);
3270
- if (includeFailures !== void 0) {
3271
- payload.includeFailures = includeFailures;
3272
- }
3273
- const worktreeId = cleanString3(input.worktreeId);
3274
- if (worktreeId) {
3275
- payload.worktreeId = worktreeId;
3276
- }
3277
- const sessionId = cleanString3(input.sessionId);
3278
- if (sessionId) {
3279
- payload.sessionId = sessionId;
3280
- }
3865
+ function createEmbeddingsClient(config = {}) {
3866
+ const gateway = createGatewayRequestClient(config);
3867
+ return {
3868
+ getByNodeIds(input) {
3869
+ assertNodeIds(input.nodeIds);
3870
+ return gateway.request({
3871
+ path: "/api/platform/v1/embeddings/by-node-ids",
3872
+ method: "POST",
3873
+ body: topicPayload(
3874
+ {
3875
+ ...input,
3876
+ workspaceId: cleanRequiredString(input.workspaceId, "workspaceId")
3877
+ },
3878
+ EMBEDDINGS_FIELDS,
3879
+ "embeddings.getByNodeIds"
3880
+ )
3881
+ }).then(
3882
+ (response) => mapGatewayData(
3883
+ response,
3884
+ (data) => listResultFromEnvelope(
3885
+ data,
3886
+ "embeddings"
3887
+ )
3888
+ )
3889
+ );
3890
+ },
3891
+ listMissingForTopic(input) {
3892
+ return gateway.request({
3893
+ path: `/api/platform/v1/embeddings/missing${toQueryString(
3894
+ missingQuery(input)
3895
+ )}`
3896
+ }).then(
3897
+ (response) => mapGatewayData(
3898
+ response,
3899
+ (data) => listResultFromEnvelope(
3900
+ data,
3901
+ "nodes"
3902
+ )
3903
+ )
3904
+ );
3905
+ },
3906
+ vectorSearchByTopic(input) {
3907
+ if (!input.queryText && !input.queryVector) {
3908
+ throw new Error("queryText or queryVector is required");
3909
+ }
3910
+ return gateway.request({
3911
+ path: "/api/platform/v1/embeddings/vector-search",
3912
+ method: "POST",
3913
+ body: topicPayload(
3914
+ {
3915
+ ...input,
3916
+ workspaceId: cleanRequiredString(input.workspaceId, "workspaceId")
3917
+ },
3918
+ EMBEDDINGS_FIELDS,
3919
+ "embeddings.vectorSearchByTopic"
3920
+ )
3921
+ }).then(
3922
+ (response) => mapGatewayData(
3923
+ response,
3924
+ (data) => listResultFromEnvelope(data, "results")
3925
+ )
3926
+ );
3927
+ },
3928
+ markEmbeddingBackfillQueued(input, idempotencyKey) {
3929
+ assertNodeIds(input.nodeIds);
3930
+ return gateway.request({
3931
+ path: "/api/platform/v1/embeddings/backfill-queued",
3932
+ method: "POST",
3933
+ body: topicPayload(
3934
+ {
3935
+ ...input,
3936
+ workspaceId: cleanRequiredString(input.workspaceId, "workspaceId")
3937
+ },
3938
+ EMBEDDINGS_FIELDS,
3939
+ "embeddings.markEmbeddingBackfillQueued"
3940
+ ),
3941
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
3942
+ });
3943
+ }
3944
+ };
3945
+ }
3946
+
3947
+ // src/contextClient.ts
3948
+ function cleanString4(value) {
3949
+ return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
3950
+ }
3951
+ function cleanNumber(value) {
3952
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
3953
+ }
3954
+ function cleanBoolean(value) {
3955
+ return typeof value === "boolean" ? value : void 0;
3956
+ }
3957
+ function buildCompileContextRequest(topicId, input = {}) {
3958
+ const payload = { topicId };
3959
+ const query5 = cleanString4(input.query);
3960
+ if (query5) {
3961
+ payload.query = query5;
3962
+ }
3963
+ const budget = cleanNumber(input.budget) ?? cleanNumber(input.tokenBudget);
3964
+ if (budget !== void 0) {
3965
+ payload.budget = budget;
3966
+ }
3967
+ const ranking = cleanString4(input.ranking) ?? cleanString4(input.rankingProfile);
3968
+ if (ranking) {
3969
+ payload.ranking = ranking;
3970
+ }
3971
+ const limit = cleanNumber(input.limit);
3972
+ if (limit !== void 0) {
3973
+ payload.limit = limit;
3974
+ }
3975
+ const maxDepth = cleanNumber(input.maxDepth);
3976
+ if (maxDepth !== void 0) {
3977
+ payload.maxDepth = maxDepth;
3978
+ }
3979
+ const includeEntities = cleanBoolean(input.includeEntities);
3980
+ if (includeEntities !== void 0) {
3981
+ payload.includeEntities = includeEntities;
3982
+ }
3983
+ const mode = cleanString4(input.mode);
3984
+ if (mode) {
3985
+ payload.mode = mode;
3986
+ }
3987
+ const includeFailures = cleanBoolean(input.includeFailures);
3988
+ if (includeFailures !== void 0) {
3989
+ payload.includeFailures = includeFailures;
3990
+ }
3991
+ const worktreeId = cleanString4(input.worktreeId);
3992
+ if (worktreeId) {
3993
+ payload.worktreeId = worktreeId;
3994
+ }
3995
+ const sessionId = cleanString4(input.sessionId);
3996
+ if (sessionId) {
3997
+ payload.sessionId = sessionId;
3998
+ }
3281
3999
  if (Array.isArray(input.packWeightOverrides) && input.packWeightOverrides.length > 0) {
3282
4000
  payload.packWeightOverrides = input.packWeightOverrides;
3283
4001
  }
@@ -3306,6 +4024,408 @@ function createContextClient(config = {}) {
3306
4024
  };
3307
4025
  }
3308
4026
 
4027
+ // src/graphAnalysisClient.ts
4028
+ var GRAPH_ANALYSIS_ANALYSIS_FIELDS = [
4029
+ "topicId",
4030
+ "projectId",
4031
+ "workspaceId",
4032
+ "analysisType",
4033
+ "healthScore",
4034
+ "findings",
4035
+ "suggestions",
4036
+ "sourceNodeIds",
4037
+ "sourceEdgeIds",
4038
+ "detectorVersions",
4039
+ "metadata"
4040
+ ];
4041
+ var GRAPH_ANALYSIS_SUGGESTION_FIELDS = [
4042
+ "topicId",
4043
+ "projectId",
4044
+ "workspaceId",
4045
+ "analysisId",
4046
+ "suggestions",
4047
+ "metadata"
4048
+ ];
4049
+ var GRAPH_ANALYSIS_COMPUTE_FIELDS = [
4050
+ "topicId",
4051
+ "projectId",
4052
+ "workspaceId",
4053
+ "analysisType",
4054
+ "sourceNodeIds",
4055
+ "sourceEdgeIds",
4056
+ "detectorVersions",
4057
+ "metadata"
4058
+ ];
4059
+ function readTopicId2(input) {
4060
+ return input.topicId?.trim() || input.projectId?.trim() || void 0;
4061
+ }
4062
+ function requireTopicId2(input) {
4063
+ const topicId = readTopicId2(input);
4064
+ if (!topicId) {
4065
+ throw new Error("topicId is required");
4066
+ }
4067
+ return topicId;
4068
+ }
4069
+ function assertKnownKeys2(input, allowed, operation) {
4070
+ const allowedSet = new Set(allowed);
4071
+ const unknownKeys = Object.keys(input).filter((key) => !allowedSet.has(key));
4072
+ if (unknownKeys.length > 0) {
4073
+ throw new Error(
4074
+ `${operation} received unsupported field(s): ${unknownKeys.join(", ")}`
4075
+ );
4076
+ }
4077
+ }
4078
+ function normalizeAnalysisPayload(input) {
4079
+ assertKnownKeys2(
4080
+ input,
4081
+ GRAPH_ANALYSIS_ANALYSIS_FIELDS,
4082
+ "graphAnalysis.saveAnalysis"
4083
+ );
4084
+ return {
4085
+ ...input,
4086
+ topicId: requireTopicId2(input),
4087
+ projectId: void 0
4088
+ };
4089
+ }
4090
+ function normalizeSuggestionPayload(input) {
4091
+ assertKnownKeys2(
4092
+ input,
4093
+ GRAPH_ANALYSIS_SUGGESTION_FIELDS,
4094
+ "graphAnalysis.saveSuggestions"
4095
+ );
4096
+ return {
4097
+ ...input,
4098
+ topicId: requireTopicId2(input),
4099
+ projectId: void 0
4100
+ };
4101
+ }
4102
+ function normalizeComputePayload(input) {
4103
+ assertKnownKeys2(
4104
+ input,
4105
+ GRAPH_ANALYSIS_COMPUTE_FIELDS,
4106
+ "graphAnalysis.computeOrRequestAnalysis"
4107
+ );
4108
+ return {
4109
+ ...input,
4110
+ topicId: requireTopicId2(input),
4111
+ projectId: void 0
4112
+ };
4113
+ }
4114
+ function graphAnalysisQuery(input) {
4115
+ return {
4116
+ topicId: requireTopicId2(input),
4117
+ workspaceId: input.workspaceId,
4118
+ analysisType: input.analysisType,
4119
+ limit: input.limit,
4120
+ cursor: input.cursor
4121
+ };
4122
+ }
4123
+ function createGraphAnalysisClient(config = {}) {
4124
+ const gateway = createGatewayRequestClient(config);
4125
+ return {
4126
+ saveAnalysis(input, idempotencyKey) {
4127
+ return gateway.request({
4128
+ path: "/api/platform/v1/graph-analysis/analyses",
4129
+ method: "POST",
4130
+ body: normalizeAnalysisPayload(input),
4131
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4132
+ });
4133
+ },
4134
+ listAnalyses(input) {
4135
+ return gateway.request({
4136
+ path: `/api/platform/v1/graph-analysis/analyses${toQueryString(
4137
+ graphAnalysisQuery(input)
4138
+ )}`
4139
+ }).then(
4140
+ (response) => mapGatewayData(
4141
+ response,
4142
+ (data) => createListResult(
4143
+ Array.isArray(data.analyses) ? data.analyses : Array.isArray(data) ? data : [],
4144
+ "analyses"
4145
+ )
4146
+ )
4147
+ );
4148
+ },
4149
+ getLatestAnalysis(input) {
4150
+ return gateway.request({
4151
+ path: `/api/platform/v1/graph-analysis/analyses/latest${toQueryString({
4152
+ topicId: requireTopicId2(input),
4153
+ workspaceId: input.workspaceId,
4154
+ analysisType: input.analysisType
4155
+ })}`
4156
+ });
4157
+ },
4158
+ saveSuggestions(input, idempotencyKey) {
4159
+ return gateway.request({
4160
+ path: "/api/platform/v1/graph-analysis/suggestions",
4161
+ method: "POST",
4162
+ body: normalizeSuggestionPayload(input),
4163
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4164
+ });
4165
+ },
4166
+ updateSuggestionStatus(input, idempotencyKey) {
4167
+ return gateway.request({
4168
+ path: `/api/platform/v1/graph-analysis/suggestions/${encodeURIComponent(
4169
+ input.suggestionId
4170
+ )}`,
4171
+ method: "PATCH",
4172
+ body: {
4173
+ status: input.status,
4174
+ rationale: input.rationale,
4175
+ metadata: input.metadata
4176
+ },
4177
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4178
+ });
4179
+ },
4180
+ listSuggestions(input) {
4181
+ return gateway.request({
4182
+ path: `/api/platform/v1/graph-analysis/suggestions${toQueryString({
4183
+ topicId: requireTopicId2(input),
4184
+ workspaceId: input.workspaceId,
4185
+ analysisId: input.analysisId,
4186
+ findingId: input.findingId,
4187
+ status: input.status,
4188
+ limit: input.limit,
4189
+ cursor: input.cursor
4190
+ })}`
4191
+ }).then(
4192
+ (response) => mapGatewayData(
4193
+ response,
4194
+ (data) => createListResult(
4195
+ Array.isArray(data.suggestions) ? data.suggestions : Array.isArray(data) ? data : [],
4196
+ "suggestions"
4197
+ )
4198
+ )
4199
+ );
4200
+ },
4201
+ listGraphChanges(input) {
4202
+ return gateway.request({
4203
+ path: `/api/platform/v1/graph-analysis/changes${toQueryString({
4204
+ topicId: requireTopicId2(input),
4205
+ workspaceId: input.workspaceId,
4206
+ analysisId: input.analysisId,
4207
+ minimumCreatedAt: input.minimumCreatedAt ?? input.since ?? input.createdAt ?? input.analysisCreatedAt,
4208
+ sourceNodeIds: input.sourceNodeIds?.join(",") ?? (input.nodeId ? input.nodeId : void 0),
4209
+ sourceEdgeIds: input.sourceEdgeIds?.join(",") ?? (input.edgeId ? input.edgeId : void 0),
4210
+ limit: input.limit,
4211
+ cursor: input.cursor
4212
+ })}`
4213
+ }).then(
4214
+ (response) => mapGatewayData(
4215
+ response,
4216
+ (data) => createListResult(
4217
+ Array.isArray(data.changes) ? data.changes : Array.isArray(data) ? data : [],
4218
+ "changes"
4219
+ )
4220
+ )
4221
+ );
4222
+ },
4223
+ computeOrRequestAnalysis(input, idempotencyKey) {
4224
+ return gateway.request({
4225
+ path: "/api/platform/v1/graph-analysis/compute",
4226
+ method: "POST",
4227
+ body: normalizeComputePayload(input),
4228
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4229
+ });
4230
+ }
4231
+ };
4232
+ }
4233
+
4234
+ // src/graphRecommendationsClient.ts
4235
+ var GRAPH_RECOMMENDATION_FIELDS = [
4236
+ "topicId",
4237
+ "projectId",
4238
+ "workspaceId",
4239
+ "limit",
4240
+ "cursor",
4241
+ "status",
4242
+ "findingId",
4243
+ "actionType",
4244
+ "targetNodeIds",
4245
+ "priority",
4246
+ "rationale",
4247
+ "healthScore",
4248
+ "metadata"
4249
+ ];
4250
+ function readTopicId3(input) {
4251
+ return input.topicId?.trim() || input.projectId?.trim() || void 0;
4252
+ }
4253
+ function requireTopicId3(input) {
4254
+ const topicId = readTopicId3(input);
4255
+ if (!topicId) {
4256
+ throw new Error("topicId is required");
4257
+ }
4258
+ return topicId;
4259
+ }
4260
+ function assertKnownKeys3(input, operation) {
4261
+ const allowed = new Set(GRAPH_RECOMMENDATION_FIELDS);
4262
+ const unknownKeys = Object.keys(input).filter((key) => !allowed.has(key));
4263
+ if (unknownKeys.length > 0) {
4264
+ throw new Error(
4265
+ `${operation} received unsupported field(s): ${unknownKeys.join(", ")}`
4266
+ );
4267
+ }
4268
+ }
4269
+ function listQuery(input) {
4270
+ assertKnownKeys3(
4271
+ input,
4272
+ "graphRecommendations.listForTopic"
4273
+ );
4274
+ return {
4275
+ workspaceId: input.workspaceId,
4276
+ topicId: requireTopicId3(input),
4277
+ limit: input.limit,
4278
+ cursor: input.cursor,
4279
+ status: input.status,
4280
+ findingId: input.findingId,
4281
+ actionType: input.actionType,
4282
+ priority: input.priority,
4283
+ targetNodeIds: input.targetNodeIds?.join(","),
4284
+ healthScore: input.healthScore
4285
+ };
4286
+ }
4287
+ function createGraphRecommendationsClient(config = {}) {
4288
+ const gateway = createGatewayRequestClient(config);
4289
+ return {
4290
+ listForTopic(input) {
4291
+ return gateway.request({
4292
+ path: `/api/platform/v1/graph-recommendations${toQueryString(
4293
+ listQuery(input)
4294
+ )}`
4295
+ }).then(
4296
+ (response) => mapGatewayData(
4297
+ response,
4298
+ (data) => createListResult(
4299
+ Array.isArray(
4300
+ data.recommendations
4301
+ ) ? data.recommendations : Array.isArray(data) ? data : [],
4302
+ "recommendations"
4303
+ )
4304
+ )
4305
+ );
4306
+ },
4307
+ getRecommendation(recommendationId) {
4308
+ return gateway.request({
4309
+ path: `/api/platform/v1/graph-recommendations/${encodeURIComponent(
4310
+ recommendationId
4311
+ )}`
4312
+ });
4313
+ },
4314
+ markRecommendationStatus(input, idempotencyKey) {
4315
+ return gateway.request({
4316
+ path: `/api/platform/v1/graph-recommendations/${encodeURIComponent(
4317
+ input.recommendationId
4318
+ )}/status`,
4319
+ method: "PATCH",
4320
+ body: {
4321
+ status: input.status,
4322
+ rationale: input.rationale,
4323
+ metadata: input.metadata
4324
+ },
4325
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4326
+ });
4327
+ }
4328
+ };
4329
+ }
4330
+
4331
+ // src/graphStateClassifierClient.ts
4332
+ var GRAPH_STATE_CLASSIFIER_FIELDS = [
4333
+ "topicId",
4334
+ "projectId",
4335
+ "workspaceId",
4336
+ "nodeId",
4337
+ "epistemicStatus",
4338
+ "beliefMaturity",
4339
+ "answerQuality",
4340
+ "evidenceNetwork",
4341
+ "logicalRole",
4342
+ "questionPriority",
4343
+ "layer",
4344
+ "modelVersion",
4345
+ "limit",
4346
+ "cursor",
4347
+ "metadata"
4348
+ ];
4349
+ function normalizeRecordPayload(input) {
4350
+ cleanRequiredString(input.workspaceId, "workspaceId");
4351
+ cleanRequiredString(input.nodeId, "nodeId");
4352
+ return topicPayload(
4353
+ input,
4354
+ GRAPH_STATE_CLASSIFIER_FIELDS,
4355
+ "graphStateClassifier.recordClassification"
4356
+ );
4357
+ }
4358
+ function createGraphStateClassifierClient(config = {}) {
4359
+ const gateway = createGatewayRequestClient(config);
4360
+ return {
4361
+ classifyNode(input, idempotencyKey) {
4362
+ cleanRequiredString(input.workspaceId, "workspaceId");
4363
+ cleanRequiredString(input.nodeId, "nodeId");
4364
+ return gateway.request({
4365
+ path: "/api/platform/v1/graph-state-classifier/classify-node",
4366
+ method: "POST",
4367
+ body: topicPayload(
4368
+ input,
4369
+ GRAPH_STATE_CLASSIFIER_FIELDS,
4370
+ "graphStateClassifier.classifyNode"
4371
+ ),
4372
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4373
+ });
4374
+ },
4375
+ classifyTopic(input, idempotencyKey) {
4376
+ cleanRequiredString(input.workspaceId, "workspaceId");
4377
+ return gateway.request({
4378
+ path: "/api/platform/v1/graph-state-classifier/classify-topic",
4379
+ method: "POST",
4380
+ body: topicPayload(
4381
+ input,
4382
+ GRAPH_STATE_CLASSIFIER_FIELDS,
4383
+ "graphStateClassifier.classifyTopic"
4384
+ ),
4385
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4386
+ }).then(
4387
+ (response) => mapGatewayData(
4388
+ response,
4389
+ (data) => listResultFromEnvelope(
4390
+ data,
4391
+ "classifications"
4392
+ )
4393
+ )
4394
+ );
4395
+ },
4396
+ listClassifications(input) {
4397
+ return gateway.request({
4398
+ path: `/api/platform/v1/graph-state-classifier/classifications${toQueryString({
4399
+ topicId: requireTopicId(input),
4400
+ workspaceId: input.workspaceId,
4401
+ nodeId: input.nodeId,
4402
+ modelVersion: input.modelVersion,
4403
+ layer: input.layer,
4404
+ epistemicStatus: input.epistemicStatus,
4405
+ limit: input.limit,
4406
+ cursor: input.cursor
4407
+ })}`
4408
+ }).then(
4409
+ (response) => mapGatewayData(
4410
+ response,
4411
+ (data) => listResultFromEnvelope(
4412
+ data,
4413
+ "classifications"
4414
+ )
4415
+ )
4416
+ );
4417
+ },
4418
+ recordClassification(input, idempotencyKey) {
4419
+ return gateway.request({
4420
+ path: "/api/platform/v1/graph-state-classifier/classifications",
4421
+ method: "POST",
4422
+ body: normalizeRecordPayload(input),
4423
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4424
+ });
4425
+ }
4426
+ };
4427
+ }
4428
+
3309
4429
  // src/harnessClient.ts
3310
4430
  function createHarnessClient(config = {}) {
3311
4431
  const gateway = createGatewayRequestClient(config);
@@ -3525,9 +4645,9 @@ function createHarnessClient(config = {}) {
3525
4645
  /**
3526
4646
  * List prompt resolutions.
3527
4647
  */
3528
- async listPromptResolutions(query = {}) {
4648
+ async listPromptResolutions(query5 = {}) {
3529
4649
  return gateway.request({
3530
- path: `/api/platform/v1/harness/prompts${toQueryString(query)}`
4650
+ path: `/api/platform/v1/harness/prompts${toQueryString(query5)}`
3531
4651
  }).then(
3532
4652
  (response) => mapGatewayData(
3533
4653
  response,
@@ -3546,6 +4666,128 @@ function createHarnessClient(config = {}) {
3546
4666
  };
3547
4667
  }
3548
4668
 
4669
+ // src/jobsClient.ts
4670
+ var JOBS_FIELDS = [
4671
+ "tenantId",
4672
+ "workspaceId",
4673
+ "principalId",
4674
+ "topicId",
4675
+ "worktreeId",
4676
+ "jobId",
4677
+ "jobType",
4678
+ "payload",
4679
+ "status",
4680
+ "attempt",
4681
+ "runId",
4682
+ "queue",
4683
+ "priority",
4684
+ "error",
4685
+ "metadata",
4686
+ "limit",
4687
+ "cursor"
4688
+ ];
4689
+ function query2(input) {
4690
+ return {
4691
+ tenantId: cleanRequiredString(input.tenantId, "tenantId"),
4692
+ workspaceId: input.workspaceId,
4693
+ principalId: input.principalId,
4694
+ topicId: input.topicId,
4695
+ worktreeId: input.worktreeId,
4696
+ jobType: input.jobType,
4697
+ status: input.status,
4698
+ queue: input.queue,
4699
+ limit: input.limit,
4700
+ cursor: input.cursor
4701
+ };
4702
+ }
4703
+ function body2(input, operation) {
4704
+ return knownPayload(input, JOBS_FIELDS, operation);
4705
+ }
4706
+ function createJobsClient(config = {}) {
4707
+ const gateway = createGatewayRequestClient(config);
4708
+ return {
4709
+ enqueue(input, idempotencyKey) {
4710
+ cleanRequiredString(input.tenantId, "tenantId");
4711
+ cleanRequiredString(input.jobType, "jobType");
4712
+ return gateway.request({
4713
+ path: "/api/platform/v1/jobs",
4714
+ method: "POST",
4715
+ body: body2(input, "jobs.enqueue"),
4716
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4717
+ });
4718
+ },
4719
+ list(input) {
4720
+ return gateway.request({
4721
+ path: `/api/platform/v1/jobs${toQueryString(query2(input))}`
4722
+ }).then(
4723
+ (response) => mapGatewayData(
4724
+ response,
4725
+ (data) => listResultFromEnvelope(data, "jobs")
4726
+ )
4727
+ );
4728
+ },
4729
+ claim(input, idempotencyKey) {
4730
+ cleanRequiredString(input.tenantId, "tenantId");
4731
+ return gateway.request({
4732
+ path: "/api/platform/v1/jobs/claim",
4733
+ method: "POST",
4734
+ body: body2(input, "jobs.claim"),
4735
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4736
+ });
4737
+ },
4738
+ updateStatus(input, idempotencyKey) {
4739
+ cleanRequiredString(input.tenantId, "tenantId");
4740
+ cleanRequiredString(input.jobId, "jobId");
4741
+ return gateway.request({
4742
+ path: `/api/platform/v1/jobs/${encodeURIComponent(input.jobId)}/status`,
4743
+ method: "PATCH",
4744
+ body: body2(
4745
+ input,
4746
+ "jobs.updateStatus"
4747
+ ),
4748
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4749
+ });
4750
+ },
4751
+ retry(input, idempotencyKey) {
4752
+ cleanRequiredString(input.tenantId, "tenantId");
4753
+ cleanRequiredString(input.jobId, "jobId");
4754
+ return gateway.request({
4755
+ path: `/api/platform/v1/jobs/${encodeURIComponent(input.jobId)}/retry`,
4756
+ method: "POST",
4757
+ body: body2(input, "jobs.retry"),
4758
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4759
+ });
4760
+ },
4761
+ recordRunStart(input, idempotencyKey) {
4762
+ cleanRequiredString(input.tenantId, "tenantId");
4763
+ return gateway.request({
4764
+ path: "/api/platform/v1/jobs/runs/start",
4765
+ method: "POST",
4766
+ body: body2(
4767
+ input,
4768
+ "jobs.recordRunStart"
4769
+ ),
4770
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4771
+ });
4772
+ },
4773
+ recordRunFinish(input, idempotencyKey) {
4774
+ cleanRequiredString(input.tenantId, "tenantId");
4775
+ cleanRequiredString(input.runId, "runId");
4776
+ return gateway.request({
4777
+ path: `/api/platform/v1/jobs/runs/${encodeURIComponent(
4778
+ input.runId
4779
+ )}/finish`,
4780
+ method: "POST",
4781
+ body: body2(
4782
+ input,
4783
+ "jobs.recordRunFinish"
4784
+ ),
4785
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4786
+ });
4787
+ }
4788
+ };
4789
+ }
4790
+
3549
4791
  // src/learningClient.ts
3550
4792
  function createLearningClient(config = {}) {
3551
4793
  const gateway = createGatewayRequestClient(config);
@@ -3590,6 +4832,122 @@ function createLearningClient(config = {}) {
3590
4832
  }
3591
4833
  };
3592
4834
  }
4835
+ function toJsonValue(value) {
4836
+ if (value === void 0) {
4837
+ return void 0;
4838
+ }
4839
+ const seen = /* @__PURE__ */ new WeakSet();
4840
+ const json = JSON.stringify(value, (_key, candidate) => {
4841
+ if (typeof candidate === "bigint") {
4842
+ return candidate.toString();
4843
+ }
4844
+ if (typeof candidate === "function" || typeof candidate === "symbol" || typeof candidate === "undefined") {
4845
+ return void 0;
4846
+ }
4847
+ if (candidate && typeof candidate === "object") {
4848
+ if (seen.has(candidate)) {
4849
+ return "[Circular]";
4850
+ }
4851
+ seen.add(candidate);
4852
+ }
4853
+ return candidate;
4854
+ });
4855
+ if (json === void 0) {
4856
+ return void 0;
4857
+ }
4858
+ return JSON.parse(json);
4859
+ }
4860
+ function createMcpClient(config = {}) {
4861
+ const gateway = createGatewayRequestClient(config);
4862
+ return {
4863
+ bootstrapSession(input = {}) {
4864
+ const scope = {
4865
+ tenantId: input.tenantId,
4866
+ workspaceId: input.workspaceId
4867
+ };
4868
+ const body4 = {
4869
+ transportKind: input.transportKind,
4870
+ sessionId: input.sessionId,
4871
+ agentIdentity: input.agentIdentity,
4872
+ workspaceId: input.workspaceId
4873
+ };
4874
+ return gateway.request({
4875
+ path: `${MCP_GATEWAY_BOOTSTRAP_ENDPOINT}${toQueryString(scope)}`,
4876
+ method: "POST",
4877
+ body: body4
4878
+ });
4879
+ },
4880
+ checkWritePolicy(input) {
4881
+ const scope = {
4882
+ tenantId: input.tenantId,
4883
+ workspaceId: input.workspaceId
4884
+ };
4885
+ return gateway.request({
4886
+ path: `${MCP_GATEWAY_WRITE_POLICY_CHECK_ENDPOINT}${toQueryString(scope)}`,
4887
+ method: "POST",
4888
+ body: {
4889
+ topicId: input.topicId,
4890
+ role: input.role,
4891
+ toolName: input.toolName
4892
+ }
4893
+ });
4894
+ },
4895
+ beginBuildSession(input) {
4896
+ const scope = {
4897
+ tenantId: input.tenantId,
4898
+ workspaceId: input.workspaceId
4899
+ };
4900
+ return gateway.request({
4901
+ path: `${MCP_GATEWAY_BEGIN_BUILD_SESSION_ENDPOINT}${toQueryString(scope)}`,
4902
+ method: "POST",
4903
+ body: {
4904
+ worktreeId: input.worktreeId,
4905
+ branch: input.branch,
4906
+ branchBase: input.branchBase,
4907
+ prBase: input.prBase,
4908
+ sessionMode: input.sessionMode,
4909
+ activateIfPlanning: input.activateIfPlanning
4910
+ }
4911
+ });
4912
+ },
4913
+ evaluateEngineeringContract(input) {
4914
+ const scope = {
4915
+ tenantId: input.tenantId,
4916
+ workspaceId: input.workspaceId
4917
+ };
4918
+ return gateway.request({
4919
+ path: `${MCP_GATEWAY_EVALUATE_ENGINEERING_CONTRACT_ENDPOINT}${toQueryString(scope)}`,
4920
+ method: "POST",
4921
+ body: {
4922
+ beliefNodeId: toJsonValue(input.beliefNodeId),
4923
+ trigger: toJsonValue(input.trigger),
4924
+ testOutput: toJsonValue(input.testOutput),
4925
+ tscOutput: toJsonValue(input.tscOutput),
4926
+ lintOutput: toJsonValue(input.lintOutput),
4927
+ sentryData: toJsonValue(input.sentryData)
4928
+ }
4929
+ });
4930
+ },
4931
+ evaluateResearchContract(input) {
4932
+ const scope = {
4933
+ tenantId: input.tenantId,
4934
+ workspaceId: input.workspaceId
4935
+ };
4936
+ return gateway.request({
4937
+ path: `${MCP_GATEWAY_EVALUATE_RESEARCH_CONTRACT_ENDPOINT}${toQueryString(scope)}`,
4938
+ method: "POST",
4939
+ body: {
4940
+ beliefNodeId: toJsonValue(input.beliefNodeId),
4941
+ trigger: toJsonValue(input.trigger),
4942
+ metricData: toJsonValue(input.metricData),
4943
+ referenceCheckData: toJsonValue(input.referenceCheckData),
4944
+ marketIndexData: toJsonValue(input.marketIndexData),
4945
+ temporalData: toJsonValue(input.temporalData)
4946
+ }
4947
+ });
4948
+ }
4949
+ };
4950
+ }
3593
4951
 
3594
4952
  // src/generated/functionSurface.ts
3595
4953
  var CONTRACTS = {
@@ -3604,6 +4962,7 @@ var CONTRACTS = {
3604
4962
  "archive_belief": { method: "DELETE", path: "/beliefs", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3605
4963
  "archive_ontology": { method: "DELETE", path: "/ontologies", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3606
4964
  "archive_question": { method: "DELETE", path: "/questions", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
4965
+ "begin_build_session": { method: "POST", path: "/mcp/build-session/begin", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3607
4966
  "bisect_confidence": { method: "POST", path: "/beliefs/confidence/bisect", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3608
4967
  "broadcast_message": { method: "POST", path: "/coordination/messages/broadcast", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3609
4968
  "check_permission": { method: "POST", path: "/identity/check-permission", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
@@ -3775,6 +5134,9 @@ function createFunctionSurfaceClient(config = {}) {
3775
5134
  archiveQuestion(input = {}, idempotencyKey) {
3776
5135
  return execute("archive_question", input, idempotencyKey);
3777
5136
  },
5137
+ beginBuildSession(input = {}, idempotencyKey) {
5138
+ return execute("begin_build_session", input, idempotencyKey);
5139
+ },
3778
5140
  bisectConfidence(input = {}, idempotencyKey) {
3779
5141
  return execute("bisect_confidence", input, idempotencyKey);
3780
5142
  },
@@ -4060,14 +5422,312 @@ function createFunctionSurfaceClient(config = {}) {
4060
5422
  updateTask(input = {}, idempotencyKey) {
4061
5423
  return execute("update_task", input, idempotencyKey);
4062
5424
  },
4063
- updateTopic(input = {}, idempotencyKey) {
4064
- return execute("update_topic", input, idempotencyKey);
5425
+ updateTopic(input = {}, idempotencyKey) {
5426
+ return execute("update_topic", input, idempotencyKey);
5427
+ },
5428
+ updateWorktreeMetadata(input = {}, idempotencyKey) {
5429
+ return execute("update_worktree_metadata", input, idempotencyKey);
5430
+ },
5431
+ updateWorktreeTargets(input = {}, idempotencyKey) {
5432
+ return execute("update_worktree_targets", input, idempotencyKey);
5433
+ }
5434
+ };
5435
+ }
5436
+
5437
+ // src/modelRuntimeClient.ts
5438
+ var MODEL_RUNTIME_FIELDS = [
5439
+ "tenantId",
5440
+ "workspaceId",
5441
+ "principalId",
5442
+ "functionName",
5443
+ "slotKey",
5444
+ "modelId",
5445
+ "provider",
5446
+ "routingPolicy",
5447
+ "metadata",
5448
+ "limit",
5449
+ "cursor"
5450
+ ];
5451
+ function scopeQuery(input) {
5452
+ return {
5453
+ tenantId: cleanRequiredString(input.tenantId, "tenantId"),
5454
+ workspaceId: input.workspaceId,
5455
+ principalId: input.principalId,
5456
+ provider: input.provider,
5457
+ limit: input.limit,
5458
+ cursor: input.cursor
5459
+ };
5460
+ }
5461
+ function modelRuntimeBody(input, operation) {
5462
+ return knownPayload(input, MODEL_RUNTIME_FIELDS, operation);
5463
+ }
5464
+ function createModelRuntimeClient(config = {}) {
5465
+ const gateway = createGatewayRequestClient(config);
5466
+ return {
5467
+ listModels(input) {
5468
+ return gateway.request({
5469
+ path: `/api/platform/v1/model-runtime/models${toQueryString(
5470
+ scopeQuery(input)
5471
+ )}`
5472
+ }).then(
5473
+ (response) => mapGatewayData(
5474
+ response,
5475
+ (data) => listResultFromEnvelope(data, "models")
5476
+ )
5477
+ );
5478
+ },
5479
+ getModel(input) {
5480
+ cleanRequiredString(input.tenantId, "tenantId");
5481
+ cleanRequiredString(input.modelId, "modelId");
5482
+ return gateway.request({
5483
+ path: `/api/platform/v1/model-runtime/models/${encodeURIComponent(
5484
+ input.modelId
5485
+ )}${toQueryString({
5486
+ tenantId: input.tenantId,
5487
+ workspaceId: input.workspaceId,
5488
+ principalId: input.principalId
5489
+ })}`
5490
+ });
5491
+ },
5492
+ listFunctionSlots(input) {
5493
+ return gateway.request({
5494
+ path: `/api/platform/v1/model-runtime/function-slots${toQueryString({
5495
+ ...scopeQuery(input),
5496
+ functionName: input.functionName
5497
+ })}`
5498
+ }).then(
5499
+ (response) => mapGatewayData(
5500
+ response,
5501
+ (data) => listResultFromEnvelope(data, "slots")
5502
+ )
5503
+ );
5504
+ },
5505
+ resolveSlot(input, idempotencyKey) {
5506
+ cleanRequiredString(input.tenantId, "tenantId");
5507
+ cleanRequiredString(input.functionName, "functionName");
5508
+ return gateway.request({
5509
+ path: "/api/platform/v1/model-runtime/function-slots/resolve",
5510
+ method: "POST",
5511
+ body: modelRuntimeBody(
5512
+ input,
5513
+ "modelRuntime.resolveSlot"
5514
+ ),
5515
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
5516
+ });
5517
+ },
5518
+ updateSlotConfig(input, idempotencyKey) {
5519
+ cleanRequiredString(input.tenantId, "tenantId");
5520
+ cleanRequiredString(input.functionName, "functionName");
5521
+ cleanRequiredString(input.slotKey, "slotKey");
5522
+ cleanRequiredString(input.modelId, "modelId");
5523
+ return gateway.request({
5524
+ path: "/api/platform/v1/model-runtime/slot-configs",
5525
+ method: "PUT",
5526
+ body: modelRuntimeBody(
5527
+ input,
5528
+ "modelRuntime.updateSlotConfig"
5529
+ ),
5530
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
5531
+ });
5532
+ }
5533
+ };
5534
+ }
5535
+
5536
+ // src/ontologyLinksClient.ts
5537
+ var ONTOLOGY_LINK_FIELDS = [
5538
+ "topicId",
5539
+ "workspaceId",
5540
+ "linkId",
5541
+ "sourceNodeId",
5542
+ "sourceGlobalId",
5543
+ "targetNodeId",
5544
+ "targetGlobalId",
5545
+ "ontologyId",
5546
+ "ontologyType",
5547
+ "edgeType",
5548
+ "weight",
5549
+ "confidence",
5550
+ "status",
5551
+ "metadata"
5552
+ ];
5553
+ function assertEndpoints(input) {
5554
+ if (!input.sourceNodeId && !input.sourceGlobalId) {
5555
+ throw new Error("sourceNodeId or sourceGlobalId is required");
5556
+ }
5557
+ if (!input.targetNodeId && !input.targetGlobalId) {
5558
+ throw new Error("targetNodeId or targetGlobalId is required");
5559
+ }
5560
+ }
5561
+ function normalizeLinkPayload(input, operation) {
5562
+ assertEndpoints(input);
5563
+ cleanRequiredString(input.ontologyId, "ontologyId");
5564
+ cleanRequiredString(input.edgeType, "edgeType");
5565
+ return knownPayload(input, ONTOLOGY_LINK_FIELDS, operation);
5566
+ }
5567
+ function createOntologyLinksClient(config = {}) {
5568
+ const gateway = createGatewayRequestClient(config);
5569
+ return {
5570
+ createLink(input, idempotencyKey) {
5571
+ return gateway.request({
5572
+ path: "/api/platform/v1/ontology-links",
5573
+ method: "POST",
5574
+ body: normalizeLinkPayload(input, "ontologyLinks.createLink"),
5575
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
5576
+ });
5577
+ },
5578
+ upsertLink(input, idempotencyKey) {
5579
+ return gateway.request({
5580
+ path: "/api/platform/v1/ontology-links",
5581
+ method: "PUT",
5582
+ body: normalizeLinkPayload(input, "ontologyLinks.upsertLink"),
5583
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
5584
+ });
5585
+ },
5586
+ listLinksForNode(input) {
5587
+ const nodeId = cleanOptionalString(input.nodeId);
5588
+ const globalId = cleanOptionalString(input.globalId);
5589
+ if (!nodeId && !globalId) {
5590
+ throw new Error("nodeId or globalId is required");
5591
+ }
5592
+ const pathId = encodeURIComponent(nodeId ?? globalId ?? "");
5593
+ return gateway.request({
5594
+ path: `/api/platform/v1/ontology-links/nodes/${pathId}${toQueryString({
5595
+ topicId: input.topicId,
5596
+ workspaceId: input.workspaceId,
5597
+ globalId: nodeId ? void 0 : globalId,
5598
+ ontologyId: input.ontologyId,
5599
+ ontologyType: input.ontologyType,
5600
+ edgeType: input.edgeType,
5601
+ status: input.status,
5602
+ limit: input.limit,
5603
+ cursor: input.cursor
5604
+ })}`
5605
+ }).then(
5606
+ (response) => mapGatewayData(
5607
+ response,
5608
+ (data) => listResultFromEnvelope(data, "links")
5609
+ )
5610
+ );
5611
+ },
5612
+ updateLinkStatus(input, idempotencyKey) {
5613
+ return gateway.request({
5614
+ path: `/api/platform/v1/ontology-links/${encodeURIComponent(
5615
+ input.linkId
5616
+ )}/status`,
5617
+ method: "PATCH",
5618
+ body: knownPayload(
5619
+ input,
5620
+ ONTOLOGY_LINK_FIELDS,
5621
+ "ontologyLinks.updateLinkStatus"
5622
+ ),
5623
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
5624
+ });
5625
+ }
5626
+ };
5627
+ }
5628
+
5629
+ // src/orgGraphSearchClient.ts
5630
+ var ORG_GRAPH_SEARCH_FIELDS = [
5631
+ "tenantId",
5632
+ "workspaceId",
5633
+ "query",
5634
+ "nodeTypes",
5635
+ "minConfidence",
5636
+ "limit",
5637
+ "cursor",
5638
+ "provenanceScope"
5639
+ ];
5640
+ function cleanString5(value, label) {
5641
+ const normalized = value?.trim();
5642
+ if (!normalized) {
5643
+ throw new Error(`${label} is required`);
5644
+ }
5645
+ return normalized;
5646
+ }
5647
+ function assertKnownSearchKeys(input, operation) {
5648
+ const allowed = new Set(ORG_GRAPH_SEARCH_FIELDS);
5649
+ const unknownKeys = Object.keys(input).filter((key) => !allowed.has(key));
5650
+ if (unknownKeys.length > 0) {
5651
+ throw new Error(
5652
+ `${operation} received unsupported field(s): ${unknownKeys.join(", ")}`
5653
+ );
5654
+ }
5655
+ }
5656
+ function searchBody(input) {
5657
+ assertKnownSearchKeys(
5658
+ input,
5659
+ "orgGraphSearch.search"
5660
+ );
5661
+ return {
5662
+ tenantId: cleanString5(input.tenantId, "tenantId"),
5663
+ workspaceId: cleanString5(input.workspaceId, "workspaceId"),
5664
+ query: cleanString5(input.query, "query"),
5665
+ nodeTypes: input.nodeTypes,
5666
+ minConfidence: input.minConfidence,
5667
+ limit: input.limit,
5668
+ cursor: input.cursor,
5669
+ provenanceScope: input.provenanceScope
5670
+ };
5671
+ }
5672
+ function listQuery2(input) {
5673
+ return {
5674
+ tenantId: cleanString5(input.tenantId, "tenantId"),
5675
+ workspaceId: cleanString5(input.workspaceId, "workspaceId"),
5676
+ nodeTypes: input.nodeTypes?.join(","),
5677
+ minConfidence: input.minConfidence,
5678
+ limit: input.limit,
5679
+ cursor: input.cursor
5680
+ };
5681
+ }
5682
+ function mapResults(data) {
5683
+ const record = data && typeof data === "object" ? data : {};
5684
+ return createListResult(
5685
+ Array.isArray(record.results) ? record.results : Array.isArray(data) ? data : [],
5686
+ "results"
5687
+ );
5688
+ }
5689
+ function createOrgGraphSearchClient(config = {}) {
5690
+ const gateway = createGatewayRequestClient(config);
5691
+ return {
5692
+ search(input) {
5693
+ return gateway.request({
5694
+ path: "/api/platform/v1/org-graph-search/search",
5695
+ method: "POST",
5696
+ body: searchBody(input)
5697
+ }).then((response) => mapGatewayData(response, mapResults));
5698
+ },
5699
+ getNode(input) {
5700
+ const nodeId = input.nodeId?.trim();
5701
+ const globalId = input.globalId?.trim();
5702
+ if (!nodeId && !globalId) {
5703
+ throw new Error("nodeId or globalId is required");
5704
+ }
5705
+ const nodePath = encodeURIComponent(nodeId ?? globalId ?? "");
5706
+ return gateway.request({
5707
+ path: `/api/platform/v1/org-graph-search/nodes/${nodePath}${toQueryString(
5708
+ {
5709
+ tenantId: cleanString5(input.tenantId, "tenantId"),
5710
+ workspaceId: cleanString5(input.workspaceId, "workspaceId"),
5711
+ globalId: nodeId ? void 0 : globalId
5712
+ }
5713
+ )}`
5714
+ });
4065
5715
  },
4066
- updateWorktreeMetadata(input = {}, idempotencyKey) {
4067
- return execute("update_worktree_metadata", input, idempotencyKey);
5716
+ listByProvenance(input) {
5717
+ return gateway.request({
5718
+ path: `/api/platform/v1/org-graph-search/provenance${toQueryString({
5719
+ ...listQuery2(input),
5720
+ provenanceScope: input.provenanceScope
5721
+ })}`
5722
+ }).then((response) => mapGatewayData(response, mapResults));
4068
5723
  },
4069
- updateWorktreeTargets(input = {}, idempotencyKey) {
4070
- return execute("update_worktree_targets", input, idempotencyKey);
5724
+ listPublishedFromWorkspace(input) {
5725
+ return gateway.request({
5726
+ path: `/api/platform/v1/org-graph-search/published${toQueryString({
5727
+ ...listQuery2(input),
5728
+ sourceWorkspaceId: input.sourceWorkspaceId
5729
+ })}`
5730
+ }).then((response) => mapGatewayData(response, mapResults));
4071
5731
  }
4072
5732
  };
4073
5733
  }
@@ -4114,9 +5774,9 @@ function createPacksClient(config = {}) {
4114
5774
  /**
4115
5775
  * List pack states for the current scope.
4116
5776
  */
4117
- async listStates(query = {}) {
5777
+ async listStates(query5 = {}) {
4118
5778
  return gateway.request({
4119
- path: `/api/platform/v1/packs/states${toQueryString(query)}`
5779
+ path: `/api/platform/v1/packs/states${toQueryString(query5)}`
4120
5780
  }).then(
4121
5781
  (response) => mapGatewayData(
4122
5782
  response,
@@ -4127,25 +5787,25 @@ function createPacksClient(config = {}) {
4127
5787
  /**
4128
5788
  * @deprecated Use listStates.
4129
5789
  */
4130
- async getStates(query = {}) {
4131
- return this.listStates(query);
5790
+ async getStates(query5 = {}) {
5791
+ return this.listStates(query5);
4132
5792
  },
4133
5793
  /**
4134
5794
  * Get health details for a pack.
4135
5795
  */
4136
- async getHealth(packKey, query = {}) {
5796
+ async getHealth(packKey, query5 = {}) {
4137
5797
  return gateway.request({
4138
5798
  path: `/api/platform/v1/packs/${encodeURIComponent(packKey)}/health${toQueryString(
4139
- query
5799
+ query5
4140
5800
  )}`
4141
5801
  });
4142
5802
  },
4143
5803
  /**
4144
5804
  * List pack telemetry entries.
4145
5805
  */
4146
- async listTelemetry(query = {}) {
5806
+ async listTelemetry(query5 = {}) {
4147
5807
  return gateway.request({
4148
- path: `/api/platform/v1/packs/telemetry${toQueryString(query)}`
5808
+ path: `/api/platform/v1/packs/telemetry${toQueryString(query5)}`
4149
5809
  }).then(
4150
5810
  (response) => mapGatewayData(
4151
5811
  response,
@@ -4156,8 +5816,8 @@ function createPacksClient(config = {}) {
4156
5816
  /**
4157
5817
  * @deprecated Use listTelemetry.
4158
5818
  */
4159
- async getTelemetry(query = {}) {
4160
- return this.listTelemetry(query);
5819
+ async getTelemetry(query5 = {}) {
5820
+ return this.listTelemetry(query5);
4161
5821
  },
4162
5822
  /**
4163
5823
  * Create a pack entitlement.
@@ -4279,9 +5939,9 @@ function createPolicyClient(config = {}) {
4279
5939
  /**
4280
5940
  * List policy decisions in the current scope.
4281
5941
  */
4282
- async listDecisions(query = {}) {
5942
+ async listDecisions(query5 = {}) {
4283
5943
  return gateway.request({
4284
- path: `/api/platform/v1/policy/decisions${toQueryString(query)}`
5944
+ path: `/api/platform/v1/policy/decisions${toQueryString(query5)}`
4285
5945
  }).then(
4286
5946
  (response) => mapGatewayData(
4287
5947
  response,
@@ -4314,9 +5974,9 @@ function createPolicyClient(config = {}) {
4314
5974
  /**
4315
5975
  * List write policy rules for the current scope.
4316
5976
  */
4317
- async listWritePolicies(query = {}) {
5977
+ async listWritePolicies(query5 = {}) {
4318
5978
  const response = await gateway.request({
4319
- path: `/api/platform/v1/policy/write-policies${toQueryString(query)}`
5979
+ path: `/api/platform/v1/policy/write-policies${toQueryString(query5)}`
4320
5980
  });
4321
5981
  const rawPolicies = response.data && typeof response.data === "object" ? response.data.policies : response.data;
4322
5982
  return {
@@ -4379,9 +6039,9 @@ function createPolicyClient(config = {}) {
4379
6039
  /**
4380
6040
  * List tenant role policies for the current scope.
4381
6041
  */
4382
- async listRolePolicies(query = {}) {
6042
+ async listRolePolicies(query5 = {}) {
4383
6043
  const response = await gateway.request({
4384
- path: `/api/platform/v1/policy/roles${toQueryString(query)}`
6044
+ path: `/api/platform/v1/policy/roles${toQueryString(query5)}`
4385
6045
  });
4386
6046
  return {
4387
6047
  ...response,
@@ -4439,28 +6099,28 @@ function createPolicyClient(config = {}) {
4439
6099
  /**
4440
6100
  * Check a permission decision for a topic or project scope.
4441
6101
  */
4442
- async checkPermission(query) {
4443
- if (!query.topicId) {
6102
+ async checkPermission(query5) {
6103
+ if (!query5.topicId) {
4444
6104
  throw new Error("topicId is required");
4445
6105
  }
4446
6106
  return gateway.request({
4447
- path: `/api/platform/v1/policy/check${toQueryString(query)}`
6107
+ path: `/api/platform/v1/policy/check${toQueryString(query5)}`
4448
6108
  });
4449
6109
  },
4450
6110
  /**
4451
6111
  * List accessible topics for a principal.
4452
6112
  */
4453
- async listAccessibleTopics(query = {}) {
4454
- const permission = query.permission ?? "read";
4455
- const principal = query.principal ?? query.principalId;
6113
+ async listAccessibleTopics(query5 = {}) {
6114
+ const permission = query5.permission ?? "read";
6115
+ const principal = query5.principal ?? query5.principalId;
4456
6116
  const response = await gateway.request({
4457
6117
  path: `/api/platform/v1/policy/topics${toQueryString({
4458
- tenantId: query.tenantId,
4459
- workspaceId: query.workspaceId,
6118
+ tenantId: query5.tenantId,
6119
+ workspaceId: query5.workspaceId,
4460
6120
  permission,
4461
- includeShared: query.includeShared,
6121
+ includeShared: query5.includeShared,
4462
6122
  principal,
4463
- limit: query.limit
6123
+ limit: query5.limit
4464
6124
  })}`
4465
6125
  });
4466
6126
  return {
@@ -4643,6 +6303,294 @@ function createSchemaClient(config = {}) {
4643
6303
  };
4644
6304
  }
4645
6305
 
6306
+ // src/telemetryClient.ts
6307
+ var TELEMETRY_FIELDS = [
6308
+ "tenantId",
6309
+ "workspaceId",
6310
+ "principalId",
6311
+ "topicId",
6312
+ "worktreeId",
6313
+ "eventLevel",
6314
+ "eventType",
6315
+ "message",
6316
+ "toolName",
6317
+ "toolCalls",
6318
+ "decision",
6319
+ "policySubject",
6320
+ "policyAction",
6321
+ "policyResource",
6322
+ "runId",
6323
+ "runType",
6324
+ "status",
6325
+ "durationMs",
6326
+ "error",
6327
+ "metadata",
6328
+ "limit",
6329
+ "cursor"
6330
+ ];
6331
+ function query3(input) {
6332
+ return {
6333
+ tenantId: cleanRequiredString(input.tenantId, "tenantId"),
6334
+ workspaceId: input.workspaceId,
6335
+ principalId: input.principalId,
6336
+ topicId: input.topicId,
6337
+ worktreeId: input.worktreeId,
6338
+ runType: input.runType,
6339
+ status: input.status,
6340
+ limit: input.limit,
6341
+ cursor: input.cursor
6342
+ };
6343
+ }
6344
+ function body3(input, operation) {
6345
+ return knownPayload(input, TELEMETRY_FIELDS, operation);
6346
+ }
6347
+ function createTelemetryClient(config = {}) {
6348
+ const gateway = createGatewayRequestClient(config);
6349
+ return {
6350
+ logSystemEvent(input, idempotencyKey) {
6351
+ cleanRequiredString(input.tenantId, "tenantId");
6352
+ cleanRequiredString(input.eventType, "eventType");
6353
+ cleanRequiredString(input.message, "message");
6354
+ return gateway.request({
6355
+ path: "/api/platform/v1/telemetry/system-events",
6356
+ method: "POST",
6357
+ body: body3(
6358
+ input,
6359
+ "telemetry.logSystemEvent"
6360
+ ),
6361
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6362
+ });
6363
+ },
6364
+ logToolCallsBatch(input, idempotencyKey) {
6365
+ cleanRequiredString(input.tenantId, "tenantId");
6366
+ return gateway.request({
6367
+ path: "/api/platform/v1/telemetry/tool-calls/batch",
6368
+ method: "POST",
6369
+ body: body3(
6370
+ input,
6371
+ "telemetry.logToolCallsBatch"
6372
+ ),
6373
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6374
+ });
6375
+ },
6376
+ recordEpistemicAudit(input, idempotencyKey) {
6377
+ cleanRequiredString(input.tenantId, "tenantId");
6378
+ cleanRequiredString(input.eventType, "eventType");
6379
+ return gateway.request({
6380
+ path: "/api/platform/v1/telemetry/epistemic-audits",
6381
+ method: "POST",
6382
+ body: body3(
6383
+ input,
6384
+ "telemetry.recordEpistemicAudit"
6385
+ ),
6386
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6387
+ });
6388
+ },
6389
+ recordPolicyDecision(input, idempotencyKey) {
6390
+ cleanRequiredString(input.tenantId, "tenantId");
6391
+ cleanRequiredString(input.decision, "decision");
6392
+ return gateway.request({
6393
+ path: "/api/platform/v1/telemetry/policy-decisions",
6394
+ method: "POST",
6395
+ body: body3(
6396
+ input,
6397
+ "telemetry.recordPolicyDecision"
6398
+ ),
6399
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6400
+ });
6401
+ },
6402
+ startRun(input, idempotencyKey) {
6403
+ cleanRequiredString(input.tenantId, "tenantId");
6404
+ cleanRequiredString(input.runType, "runType");
6405
+ return gateway.request({
6406
+ path: "/api/platform/v1/telemetry/runs/start",
6407
+ method: "POST",
6408
+ body: body3(
6409
+ input,
6410
+ "telemetry.startRun"
6411
+ ),
6412
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6413
+ });
6414
+ },
6415
+ finishRun(input, idempotencyKey) {
6416
+ cleanRequiredString(input.tenantId, "tenantId");
6417
+ cleanRequiredString(input.runId, "runId");
6418
+ return gateway.request({
6419
+ path: `/api/platform/v1/telemetry/runs/${encodeURIComponent(
6420
+ input.runId
6421
+ )}/finish`,
6422
+ method: "POST",
6423
+ body: body3(
6424
+ input,
6425
+ "telemetry.finishRun"
6426
+ ),
6427
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6428
+ });
6429
+ },
6430
+ listRuns(input) {
6431
+ return gateway.request({
6432
+ path: `/api/platform/v1/telemetry/runs${toQueryString(query3(input))}`
6433
+ }).then(
6434
+ (response) => mapGatewayData(
6435
+ response,
6436
+ (data) => listResultFromEnvelope(data, "runs")
6437
+ )
6438
+ );
6439
+ }
6440
+ };
6441
+ }
6442
+
6443
+ // src/toolRegistryClient.ts
6444
+ var TOOL_REGISTRY_FIELDS = [
6445
+ "tenantId",
6446
+ "workspaceId",
6447
+ "principalId",
6448
+ "toolName",
6449
+ "packKey",
6450
+ "packVersion",
6451
+ "status",
6452
+ "permissions",
6453
+ "role",
6454
+ "surface",
6455
+ "parameterSchema",
6456
+ "returnSchema",
6457
+ "handlerRef",
6458
+ "executionAdapter",
6459
+ "safetyMetadata",
6460
+ "aclId",
6461
+ "metadata",
6462
+ "limit",
6463
+ "cursor"
6464
+ ];
6465
+ function query4(input) {
6466
+ return {
6467
+ tenantId: cleanRequiredString(input.tenantId, "tenantId"),
6468
+ workspaceId: input.workspaceId,
6469
+ principalId: input.principalId,
6470
+ packKey: input.packKey,
6471
+ status: input.status,
6472
+ limit: input.limit,
6473
+ cursor: input.cursor
6474
+ };
6475
+ }
6476
+ function writeBody(input, operation) {
6477
+ return knownPayload(input, TOOL_REGISTRY_FIELDS, operation);
6478
+ }
6479
+ function createToolRegistryClient(config = {}) {
6480
+ const gateway = createGatewayRequestClient(config);
6481
+ return {
6482
+ listCatalog(input) {
6483
+ return gateway.request({
6484
+ path: `/api/platform/v1/tools/catalog${toQueryString(query4(input))}`
6485
+ }).then(
6486
+ (response) => mapGatewayData(
6487
+ response,
6488
+ (data) => listResultFromEnvelope(data, "tools")
6489
+ )
6490
+ );
6491
+ },
6492
+ listExecutable(input) {
6493
+ return gateway.request({
6494
+ path: `/api/platform/v1/tools/executable${toQueryString(query4(input))}`
6495
+ }).then(
6496
+ (response) => mapGatewayData(
6497
+ response,
6498
+ (data) => listResultFromEnvelope(data, "tools")
6499
+ )
6500
+ );
6501
+ },
6502
+ listEffectiveTools(input) {
6503
+ return gateway.request({
6504
+ path: `/api/platform/v1/tools/effective${toQueryString(query4(input))}`
6505
+ }).then(
6506
+ (response) => mapGatewayData(
6507
+ response,
6508
+ (data) => listResultFromEnvelope(data, "tools")
6509
+ )
6510
+ );
6511
+ },
6512
+ upsertCoreTools(input, idempotencyKey) {
6513
+ cleanRequiredString(input.tenantId, "tenantId");
6514
+ return gateway.request({
6515
+ path: "/api/platform/v1/tools/core",
6516
+ method: "PUT",
6517
+ body: {
6518
+ tenantId: input.tenantId,
6519
+ workspaceId: input.workspaceId,
6520
+ metadata: input.metadata,
6521
+ tools: input.tools
6522
+ },
6523
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6524
+ }).then(
6525
+ (response) => mapGatewayData(
6526
+ response,
6527
+ (data) => listResultFromEnvelope(data, "tools")
6528
+ )
6529
+ );
6530
+ },
6531
+ setPackToolsStatus(input, idempotencyKey) {
6532
+ cleanRequiredString(input.tenantId, "tenantId");
6533
+ cleanRequiredString(input.packKey, "packKey");
6534
+ return gateway.request({
6535
+ path: `/api/platform/v1/tools/packs/${encodeURIComponent(
6536
+ input.packKey
6537
+ )}/status`,
6538
+ method: "PATCH",
6539
+ body: writeBody(
6540
+ input,
6541
+ "tools.setPackToolsStatus"
6542
+ ),
6543
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6544
+ }).then(
6545
+ (response) => mapGatewayData(
6546
+ response,
6547
+ (data) => listResultFromEnvelope(data, "tools")
6548
+ )
6549
+ );
6550
+ },
6551
+ createAcl(input, idempotencyKey) {
6552
+ cleanRequiredString(input.tenantId, "tenantId");
6553
+ cleanRequiredString(input.principalId, "principalId");
6554
+ cleanRequiredString(input.toolName, "toolName");
6555
+ return gateway.request({
6556
+ path: "/api/platform/v1/tools/acls",
6557
+ method: "POST",
6558
+ body: writeBody(
6559
+ input,
6560
+ "tools.createAcl"
6561
+ ),
6562
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6563
+ });
6564
+ },
6565
+ deleteAcl(input, idempotencyKey) {
6566
+ cleanRequiredString(input.tenantId, "tenantId");
6567
+ cleanRequiredString(input.aclId, "aclId");
6568
+ return gateway.request({
6569
+ path: `/api/platform/v1/tools/acls/${encodeURIComponent(input.aclId)}`,
6570
+ method: "DELETE",
6571
+ body: writeBody(
6572
+ input,
6573
+ "tools.deleteAcl"
6574
+ ),
6575
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6576
+ });
6577
+ },
6578
+ registerCustomTool(input, idempotencyKey) {
6579
+ cleanRequiredString(input.tenantId, "tenantId");
6580
+ cleanRequiredString(input.toolName, "toolName");
6581
+ return gateway.request({
6582
+ path: "/api/platform/v1/tools/custom",
6583
+ method: "POST",
6584
+ body: writeBody(
6585
+ input,
6586
+ "tools.registerCustomTool"
6587
+ ),
6588
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6589
+ });
6590
+ }
6591
+ };
6592
+ }
6593
+
4646
6594
  // src/version.ts
4647
6595
  var LUCERN_SDK_VERSION = "0.2.0-alpha.1";
4648
6596
 
@@ -4660,10 +6608,10 @@ function createWorkflowClient(config = {}) {
4660
6608
  /**
4661
6609
  * List workflow branches for a topic scope.
4662
6610
  */
4663
- async listBranches(query) {
6611
+ async listBranches(query5) {
4664
6612
  return gateway.request({
4665
6613
  path: `/api/platform/v1/workflow/branches${toQueryString(
4666
- normalizeTopicQuery(query)
6614
+ normalizeTopicQuery(query5)
4667
6615
  )}`
4668
6616
  }).then(
4669
6617
  (response) => mapGatewayData(
@@ -4691,10 +6639,10 @@ function createWorkflowClient(config = {}) {
4691
6639
  /**
4692
6640
  * List reusable lenses for a workspace or topic scope.
4693
6641
  */
4694
- async listLenses(query) {
6642
+ async listLenses(query5) {
4695
6643
  return gateway.request({
4696
6644
  path: `/api/platform/v1/workflow/lenses${toQueryString(
4697
- normalizeLensQuery(query)
6645
+ normalizeLensQuery(query5)
4698
6646
  )}`
4699
6647
  }).then(
4700
6648
  (response) => mapGatewayData(
@@ -4766,14 +6714,14 @@ function createWorkflowClient(config = {}) {
4766
6714
  /**
4767
6715
  * List worktrees for a topic scope.
4768
6716
  */
4769
- async listWorktrees(query) {
4770
- const normalized = normalizeTopicQuery(query);
6717
+ async listWorktrees(query5) {
6718
+ const normalized = normalizeTopicQuery(query5);
4771
6719
  return gateway.request({
4772
6720
  path: `/api/platform/v1/worktrees/all${toQueryString({
4773
6721
  ...normalized,
4774
- groupBy: query.groupBy,
4775
- lane: query.lane,
4776
- campaign: query.campaign
6722
+ groupBy: query5.groupBy,
6723
+ lane: query5.lane,
6724
+ campaign: query5.campaign
4777
6725
  })}`
4778
6726
  }).then(
4779
6727
  (response) => mapGatewayData(
@@ -4788,14 +6736,14 @@ function createWorkflowClient(config = {}) {
4788
6736
  /**
4789
6737
  * List all worktrees across accessible topics.
4790
6738
  */
4791
- async listAllWorktrees(query = {}) {
6739
+ async listAllWorktrees(query5 = {}) {
4792
6740
  return gateway.request({
4793
6741
  path: `/api/platform/v1/worktrees${toQueryString({
4794
- status: query.status,
4795
- groupBy: query.groupBy,
4796
- lane: query.lane,
4797
- campaign: query.campaign,
4798
- limit: query.limit
6742
+ status: query5.status,
6743
+ groupBy: query5.groupBy,
6744
+ lane: query5.lane,
6745
+ campaign: query5.campaign,
6746
+ limit: query5.limit
4799
6747
  })}`
4800
6748
  }).then(
4801
6749
  (response) => mapGatewayData(response, (data) => {
@@ -4815,10 +6763,10 @@ function createWorkflowClient(config = {}) {
4815
6763
  /**
4816
6764
  * List compact pipeline campaigns with nested lanes.
4817
6765
  */
4818
- async listCampaigns(query = {}) {
6766
+ async listCampaigns(query5 = {}) {
4819
6767
  return gateway.request({
4820
6768
  path: `/api/platform/v1/worktrees/campaigns${toQueryString(
4821
- normalizeTopicQuery(query)
6769
+ normalizeTopicQuery(query5)
4822
6770
  )}`
4823
6771
  });
4824
6772
  },
@@ -4874,11 +6822,11 @@ function createWorkflowClient(config = {}) {
4874
6822
  * Update targeted beliefs/questions for a worktree.
4875
6823
  */
4876
6824
  async updateWorktreeTargets(input, idempotencyKey) {
4877
- const { worktreeId, ...body } = input;
6825
+ const { worktreeId, ...body4 } = input;
4878
6826
  return gateway.request({
4879
6827
  path: `/api/platform/v1/worktrees/${encodeURIComponent(worktreeId)}/targets`,
4880
6828
  method: "POST",
4881
- body,
6829
+ body: body4,
4882
6830
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4883
6831
  }).then(
4884
6832
  (response) => mapGatewayData(
@@ -4967,11 +6915,11 @@ function createWorkflowClient(config = {}) {
4967
6915
  /**
4968
6916
  * List accessible topic contexts.
4969
6917
  */
4970
- async listTopics(query = {}) {
6918
+ async listTopics(query5 = {}) {
4971
6919
  return gateway.request({
4972
6920
  path: `/api/platform/v1/workflow/topics${toQueryString({
4973
- includeShared: typeof query.includeShared === "boolean" ? query.includeShared ? "true" : "false" : void 0,
4974
- limit: query.limit
6921
+ includeShared: typeof query5.includeShared === "boolean" ? query5.includeShared ? "true" : "false" : void 0,
6922
+ limit: query5.limit
4975
6923
  })}`
4976
6924
  }).then(
4977
6925
  (response) => mapGatewayData(response, (data) => {
@@ -5099,13 +7047,15 @@ function toGatewayConfig(config) {
5099
7047
  requestIdFactory: config.requestIdFactory,
5100
7048
  onRequest: config.onRequest,
5101
7049
  onResponse: config.onResponse,
7050
+ authContext: config.authContext,
7051
+ requireCanonicalAuthContext: config.requireCanonicalAuthContext,
5102
7052
  getAuthHeaders: async () => {
5103
7053
  const base = config.getAuthHeaders ? await config.getAuthHeaders() : {};
5104
7054
  if (config.apiKey && !base["x-lucern-key"] && !base.Authorization) {
5105
7055
  base["x-lucern-key"] = config.apiKey;
5106
7056
  }
5107
- if (config.userToken && !base["x-lucern-user-token"]) {
5108
- base["x-lucern-user-token"] = config.userToken;
7057
+ if (config.userToken && !base["x-lucern-session-token"]) {
7058
+ base["x-lucern-session-token"] = config.userToken;
5109
7059
  }
5110
7060
  if (config.environment && !base["x-lucern-environment"]) {
5111
7061
  base["x-lucern-environment"] = config.environment;
@@ -5114,13 +7064,20 @@ function toGatewayConfig(config) {
5114
7064
  }
5115
7065
  };
5116
7066
  }
5117
- function requireTopicId(args) {
7067
+ function requireTopicId4(args) {
5118
7068
  const topicId = resolveTopicId(args);
5119
7069
  if (!topicId) {
5120
7070
  throw new Error("topicId is required");
5121
7071
  }
5122
7072
  return topicId;
5123
7073
  }
7074
+ function requireTopicOrProjectId(args) {
7075
+ const topicId = args.topicId?.trim() || args.projectId?.trim() || void 0;
7076
+ if (!topicId) {
7077
+ throw new Error("topicId is required");
7078
+ }
7079
+ return topicId;
7080
+ }
5124
7081
  var AUDIT_NODE_REFERENCE_KEY_PATTERN = /(^|_)(id|nodeid|beliefid|resourceid|targetid|sourceid|subjectid|globalid|entityid|recordid|fromnodeid|tonodeid|linkednodeid|linkedbeliefid|nodeids|beliefids|resourceids)$/i;
5125
7082
  function matchesAuditNodeReference(value, nodeId) {
5126
7083
  if (Array.isArray(value)) {
@@ -5156,18 +7113,41 @@ function requireBaseRate(args) {
5156
7113
  function exposeGatewayData(response) {
5157
7114
  return Object.assign({}, response, response.data);
5158
7115
  }
7116
+ function sdkQueryString(input) {
7117
+ const params = new URLSearchParams();
7118
+ for (const [key, value] of Object.entries(input)) {
7119
+ if (value === void 0 || value === null) {
7120
+ continue;
7121
+ }
7122
+ if (Array.isArray(value)) {
7123
+ if (value.length > 0) {
7124
+ params.set(key, value.join(","));
7125
+ }
7126
+ continue;
7127
+ }
7128
+ params.set(key, String(value));
7129
+ }
7130
+ const serialized = params.toString();
7131
+ return serialized ? `?${serialized}` : "";
7132
+ }
5159
7133
  function createLucernClient(config = {}) {
5160
7134
  const gatewayConfig = toGatewayConfig(config);
5161
7135
  const beliefsClient = createBeliefsClient(gatewayConfig);
5162
7136
  const sourcesClient = createSourcesClient(gatewayConfig);
5163
7137
  const beliefsFacade = createBeliefsFacade(gatewayConfig);
5164
7138
  const evidenceClient = createEvidenceClient(gatewayConfig);
7139
+ const embeddingsClient = createEmbeddingsClient(gatewayConfig);
7140
+ const eventingClient = createEventingClient(gatewayConfig);
5165
7141
  const graphClient = createGraphClient(gatewayConfig);
7142
+ const graphAnalysisClient = createGraphAnalysisClient(gatewayConfig);
7143
+ const graphRecommendationsClient = createGraphRecommendationsClient(gatewayConfig);
7144
+ const graphStateClassifierClient = createGraphStateClassifierClient(gatewayConfig);
5166
7145
  const graphFacade = createGraphFacade(gatewayConfig);
5167
7146
  const decisionsClient = createDecisionsClient(gatewayConfig);
5168
7147
  const contextClient = createContextClient(gatewayConfig);
5169
7148
  const workflowClient = createWorkflowClient(gatewayConfig);
5170
7149
  const auditClient = createAuditClient(gatewayConfig);
7150
+ const authDeviceClient = createAuthDeviceClient(gatewayConfig);
5171
7151
  const adminClient = createAdminClient(gatewayConfig);
5172
7152
  const answersClient = createAnswersClient(gatewayConfig);
5173
7153
  const contradictionsFacade = createContradictionsFacade(gatewayConfig);
@@ -5185,10 +7165,17 @@ function createLucernClient(config = {}) {
5185
7165
  const worktreesFacade = createWorktreesFacade(gatewayConfig);
5186
7166
  const policyClient = createPolicyClient(gatewayConfig);
5187
7167
  const ontologyClient = createOntologyClient(gatewayConfig);
7168
+ const ontologyLinksClient = createOntologyLinksClient(gatewayConfig);
7169
+ const orgGraphSearchClient = createOrgGraphSearchClient(gatewayConfig);
5188
7170
  const functionSurfaceClient = createFunctionSurfaceClient(gatewayConfig);
7171
+ const toolRegistryClient = createToolRegistryClient(gatewayConfig);
7172
+ const modelRuntimeClient = createModelRuntimeClient(gatewayConfig);
5189
7173
  const packsClient = createPacksClient(gatewayConfig);
5190
7174
  const reportsClient = createReportsClient(gatewayConfig);
5191
7175
  const learningClient = createLearningClient(gatewayConfig);
7176
+ const mcpClient = createMcpClient(gatewayConfig);
7177
+ const jobsClient = createJobsClient(gatewayConfig);
7178
+ const telemetryClient = createTelemetryClient(gatewayConfig);
5192
7179
  const harnessClient = createHarnessClient(gatewayConfig);
5193
7180
  const schemaClient = createSchemaClient(gatewayConfig);
5194
7181
  const audiencesClient = createAudiencesClient(gatewayConfig);
@@ -5317,7 +7304,7 @@ function createLucernClient(config = {}) {
5317
7304
  }
5318
7305
  async function listBeliefs(args) {
5319
7306
  const response = await beliefsFacade.list({
5320
- topicId: requireTopicId(args),
7307
+ topicId: requireTopicId4(args),
5321
7308
  status: args.status,
5322
7309
  worktreeId: args.worktreeId,
5323
7310
  minConfidence: args.minConfidence,
@@ -5345,13 +7332,13 @@ function createLucernClient(config = {}) {
5345
7332
  const results = groupedBeliefs.length > 0 ? groupedBeliefs : mergedResults.filter((result) => result.type === "belief");
5346
7333
  return { results };
5347
7334
  }
5348
- async function searchResources(query, options = {}) {
7335
+ async function searchResources(query5, options = {}) {
5349
7336
  const topicId = resolveTopicId(options);
5350
7337
  if (!topicId) {
5351
7338
  throw new Error("topicId is required");
5352
7339
  }
5353
7340
  return searchFacade.query({
5354
- q: query,
7341
+ q: query5,
5355
7342
  topicId,
5356
7343
  types: options.types,
5357
7344
  status: options.status,
@@ -5546,8 +7533,8 @@ function createLucernClient(config = {}) {
5546
7533
  }).then(exposeGatewayData);
5547
7534
  }
5548
7535
  const nodesNamespace = {
5549
- list(query) {
5550
- return graphClient.listNodes(query);
7536
+ list(query5) {
7537
+ return graphClient.listNodes(query5);
5551
7538
  },
5552
7539
  get(input) {
5553
7540
  return graphClient.getNode(
@@ -5563,6 +7550,30 @@ function createLucernClient(config = {}) {
5563
7550
  batchCreate(input, idempotencyKey) {
5564
7551
  return graphClient.batchCreateNodes(input, idempotencyKey);
5565
7552
  },
7553
+ listByTopicAndType(input) {
7554
+ return gateway.request({
7555
+ path: `/api/platform/v1/nodes${sdkQueryString({
7556
+ topicId: requireTopicOrProjectId(input),
7557
+ nodeType: input.nodeType,
7558
+ nodeTypes: input.nodeTypes,
7559
+ query: input.query,
7560
+ sourceText: input.sourceText,
7561
+ limit: input.limit,
7562
+ cursor: input.cursor
7563
+ })}`
7564
+ }).then(exposeGatewayData);
7565
+ },
7566
+ countByTopicAndType(input) {
7567
+ return gateway.request({
7568
+ path: `/api/platform/v1/nodes/count${sdkQueryString({
7569
+ topicId: requireTopicOrProjectId(input),
7570
+ nodeType: input.nodeType,
7571
+ nodeTypes: input.nodeTypes,
7572
+ query: input.query,
7573
+ limit: input.limit
7574
+ })}`
7575
+ }).then(exposeGatewayData);
7576
+ },
5566
7577
  supersede(input, idempotencyKey) {
5567
7578
  return graphClient.supersedeNode(input, idempotencyKey);
5568
7579
  },
@@ -5573,19 +7584,97 @@ function createLucernClient(config = {}) {
5573
7584
  return graphClient.hardDeleteNode(input, idempotencyKey);
5574
7585
  }
5575
7586
  };
7587
+ const publicationNamespace = {
7588
+ create(input, idempotencyKey) {
7589
+ return gateway.request({
7590
+ path: "/api/platform/v1/publication",
7591
+ method: "POST",
7592
+ body: input,
7593
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
7594
+ }).then(exposeGatewayData);
7595
+ },
7596
+ update(publicationId, input, idempotencyKey) {
7597
+ return gateway.request({
7598
+ path: `/api/platform/v1/publication/${encodeURIComponent(
7599
+ publicationId
7600
+ )}`,
7601
+ method: "PATCH",
7602
+ body: input,
7603
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
7604
+ }).then(exposeGatewayData);
7605
+ },
7606
+ list(input = {}) {
7607
+ return gateway.request({
7608
+ path: `/api/platform/v1/publication${sdkQueryString(input)}`
7609
+ }).then(exposeGatewayData);
7610
+ },
7611
+ getByTopic(input) {
7612
+ const topicId = typeof input === "string" ? input : input.topicId;
7613
+ const workspaceId = typeof input === "string" ? void 0 : input.workspaceId;
7614
+ return gateway.request({
7615
+ path: `/api/platform/v1/publication/by-topic/${encodeURIComponent(
7616
+ topicId
7617
+ )}${sdkQueryString({ workspaceId })}`
7618
+ }).then(exposeGatewayData);
7619
+ },
7620
+ publish(publicationId, input = {}, idempotencyKey) {
7621
+ return gateway.request({
7622
+ path: `/api/platform/v1/publication/${encodeURIComponent(
7623
+ publicationId
7624
+ )}/publish`,
7625
+ method: "POST",
7626
+ body: input,
7627
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
7628
+ }).then(exposeGatewayData);
7629
+ },
7630
+ unpublish(publicationId, input = {}, idempotencyKey) {
7631
+ return gateway.request({
7632
+ path: `/api/platform/v1/publication/${encodeURIComponent(
7633
+ publicationId
7634
+ )}/unpublish`,
7635
+ method: "POST",
7636
+ body: input,
7637
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
7638
+ }).then(exposeGatewayData);
7639
+ },
7640
+ remove(publicationId, input = {}) {
7641
+ return gateway.request({
7642
+ path: `/api/platform/v1/publication/${encodeURIComponent(
7643
+ publicationId
7644
+ )}${sdkQueryString(input)}`,
7645
+ method: "DELETE"
7646
+ }).then(exposeGatewayData);
7647
+ }
7648
+ };
7649
+ const ontologyLinksNamespace = {
7650
+ ...ontologyLinksClient,
7651
+ resolveThemeSource(input) {
7652
+ return gateway.request({
7653
+ path: "/api/platform/v1/ontology-links/theme-source",
7654
+ method: "POST",
7655
+ body: input
7656
+ }).then(exposeGatewayData);
7657
+ }
7658
+ };
5576
7659
  return {
5577
7660
  config,
5578
7661
  version: LUCERN_SDK_VERSION,
5579
- search(query, options) {
5580
- return searchResources(query, options);
7662
+ search(query5, options) {
7663
+ return searchResources(query5, options);
5581
7664
  },
5582
7665
  events: {
5583
- list(query = {}) {
5584
- return eventsFacade.list(query).then(exposeGatewayData);
7666
+ list(query5 = {}) {
7667
+ return eventsFacade.list(query5).then(exposeGatewayData);
5585
7668
  },
5586
7669
  replay(input) {
5587
7670
  return eventsFacade.replay(input).then(exposeGatewayData);
5588
- }
7671
+ },
7672
+ recordEvent: eventingClient.recordEvent,
7673
+ listEvents: eventingClient.listEvents,
7674
+ listWebhooks: eventingClient.listWebhooks,
7675
+ enqueueDelivery: eventingClient.enqueueDelivery,
7676
+ recordDeliveryAttempt: eventingClient.recordDeliveryAttempt,
7677
+ updateDeliveryStatus: eventingClient.updateDeliveryStatus
5589
7678
  },
5590
7679
  beliefs: {
5591
7680
  create(input) {
@@ -5654,7 +7743,7 @@ function createLucernClient(config = {}) {
5654
7743
  },
5655
7744
  list(args) {
5656
7745
  return beliefsFacade.list({
5657
- topicId: requireTopicId(args),
7746
+ topicId: requireTopicId4(args),
5658
7747
  worktreeId: args.worktreeId,
5659
7748
  status: args.status,
5660
7749
  minConfidence: args.minConfidence,
@@ -5683,8 +7772,8 @@ function createLucernClient(config = {}) {
5683
7772
  create(input) {
5684
7773
  return webhooksFacade.create(input).then(exposeGatewayData);
5685
7774
  },
5686
- list(query) {
5687
- return webhooksFacade.list(query).then(exposeGatewayData);
7775
+ list(query5) {
7776
+ return webhooksFacade.list(query5).then(exposeGatewayData);
5688
7777
  },
5689
7778
  get(id) {
5690
7779
  return webhooksFacade.get(id).then(exposeGatewayData);
@@ -5698,8 +7787,8 @@ function createLucernClient(config = {}) {
5698
7787
  test(id, input) {
5699
7788
  return webhooksFacade.test(id, input).then(exposeGatewayData);
5700
7789
  },
5701
- deliveries(id, query) {
5702
- return webhooksFacade.deliveries(id, query).then(exposeGatewayData);
7790
+ deliveries(id, query5) {
7791
+ return webhooksFacade.deliveries(id, query5).then(exposeGatewayData);
5703
7792
  },
5704
7793
  health(id) {
5705
7794
  return webhooksFacade.health(id).then(exposeGatewayData);
@@ -5854,7 +7943,7 @@ function createLucernClient(config = {}) {
5854
7943
  },
5855
7944
  list(args) {
5856
7945
  return questionsFacade.list({
5857
- topicId: requireTopicId(args),
7946
+ topicId: requireTopicId4(args),
5858
7947
  status: args.status,
5859
7948
  priority: args.priority,
5860
7949
  worktreeId: args.worktreeId,
@@ -5926,7 +8015,7 @@ function createLucernClient(config = {}) {
5926
8015
  },
5927
8016
  getHighPriority(args) {
5928
8017
  return this.list({
5929
- topicId: requireTopicId(args),
8018
+ topicId: requireTopicId4(args),
5930
8019
  status: args.includeAnswered ? void 0 : "open"
5931
8020
  }).then((data) => {
5932
8021
  const questions = Array.isArray(data.questions) ? data.questions : [];
@@ -5951,7 +8040,7 @@ function createLucernClient(config = {}) {
5951
8040
  },
5952
8041
  async findMissing(args) {
5953
8042
  return graphFacade.gaps({
5954
- topicId: requireTopicId(args),
8043
+ topicId: requireTopicId4(args),
5955
8044
  minConfidence: args.minConfidence
5956
8045
  }).then(exposeGatewayData);
5957
8046
  }
@@ -5982,21 +8071,21 @@ function createLucernClient(config = {}) {
5982
8071
  },
5983
8072
  analyze(args) {
5984
8073
  return graphFacade.analyze({
5985
- topicId: requireTopicId(args),
8074
+ topicId: requireTopicId4(args),
5986
8075
  limit: args.limit,
5987
8076
  metric: args.metric
5988
8077
  }).then(exposeGatewayData);
5989
8078
  },
5990
8079
  bias(args) {
5991
8080
  return graphFacade.bias({
5992
- topicId: requireTopicId(args),
8081
+ topicId: requireTopicId4(args),
5993
8082
  threshold: args.threshold,
5994
8083
  limit: args.limit
5995
8084
  }).then(exposeGatewayData);
5996
8085
  },
5997
8086
  gaps(args) {
5998
8087
  return graphFacade.gaps({
5999
- topicId: requireTopicId(args),
8088
+ topicId: requireTopicId4(args),
6000
8089
  minConfidence: args.minConfidence
6001
8090
  }).then(exposeGatewayData);
6002
8091
  },
@@ -6048,6 +8137,54 @@ function createLucernClient(config = {}) {
6048
8137
  }));
6049
8138
  }
6050
8139
  },
8140
+ themes: {
8141
+ listByTopic(input) {
8142
+ return gateway.request({
8143
+ path: `/api/platform/v1/themes${sdkQueryString({
8144
+ topicId: requireTopicOrProjectId(input),
8145
+ query: input.query,
8146
+ limit: input.limit,
8147
+ cursor: input.cursor
8148
+ })}`
8149
+ }).then(exposeGatewayData);
8150
+ }
8151
+ },
8152
+ graphSearch: {
8153
+ keywordSearchNodes(input) {
8154
+ return gateway.request({
8155
+ path: "/api/platform/v1/graph-search/keyword-nodes",
8156
+ method: "POST",
8157
+ body: {
8158
+ ...input,
8159
+ topicId: requireTopicOrProjectId(input),
8160
+ projectId: void 0
8161
+ }
8162
+ }).then(exposeGatewayData);
8163
+ }
8164
+ },
8165
+ classifiers: {
8166
+ listBeliefCandidates(input) {
8167
+ return gateway.request({
8168
+ path: `/api/platform/v1/classifiers/belief-candidates${sdkQueryString({
8169
+ topicId: requireTopicOrProjectId(input),
8170
+ classifierKey: input.classifierKey,
8171
+ query: input.query,
8172
+ limit: input.limit,
8173
+ cursor: input.cursor
8174
+ })}`
8175
+ }).then(exposeGatewayData);
8176
+ }
8177
+ },
8178
+ archetypes: {
8179
+ getJudgmentSignature(input) {
8180
+ return gateway.request({
8181
+ path: `/api/platform/v1/archetypes/judgment-signature${sdkQueryString({
8182
+ topicId: requireTopicOrProjectId(input),
8183
+ principalId: input.principalId
8184
+ })}`
8185
+ }).then(exposeGatewayData);
8186
+ }
8187
+ },
6051
8188
  judgments: {
6052
8189
  create(input) {
6053
8190
  return decisionsClient.createJudgment(input);
@@ -6055,8 +8192,8 @@ function createLucernClient(config = {}) {
6055
8192
  record(input) {
6056
8193
  return decisionsClient.recordJudgment(input);
6057
8194
  },
6058
- list(query) {
6059
- return decisionsClient.listJudgments(query);
8195
+ list(query5) {
8196
+ return decisionsClient.listJudgments(query5);
6060
8197
  },
6061
8198
  get(judgmentId) {
6062
8199
  return decisionsClient.getJudgment(judgmentId);
@@ -6085,10 +8222,56 @@ function createLucernClient(config = {}) {
6085
8222
  transitionAuditIntegrity(args) {
6086
8223
  return decisionsClient.getJudgmentTransitionAuditIntegrity({
6087
8224
  ...args,
6088
- topicId: requireTopicId(args)
8225
+ topicId: requireTopicId4(args)
6089
8226
  });
6090
8227
  }
6091
8228
  },
8229
+ decisions: {
8230
+ create(input) {
8231
+ return decisionsClient.createJudgment(input);
8232
+ },
8233
+ record(input) {
8234
+ return decisionsClient.recordJudgment(input);
8235
+ },
8236
+ list(query5) {
8237
+ return decisionsClient.listJudgments(query5);
8238
+ },
8239
+ get(decisionId) {
8240
+ return decisionsClient.getJudgment(decisionId);
8241
+ },
8242
+ recordOutcome(decisionId, input) {
8243
+ return decisionsClient.recordJudgmentOutcome(decisionId, input);
8244
+ },
8245
+ lessons(decisionId, input, idempotencyKey) {
8246
+ return gateway.request({
8247
+ path: `/api/platform/v1/decisions/${encodeURIComponent(
8248
+ decisionId
8249
+ )}/lessons`,
8250
+ method: "POST",
8251
+ body: input,
8252
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
8253
+ }).then(exposeGatewayData);
8254
+ },
8255
+ archive(decisionId, input = {}, idempotencyKey) {
8256
+ return gateway.request({
8257
+ path: `/api/platform/v1/decisions/${encodeURIComponent(
8258
+ decisionId
8259
+ )}/archive`,
8260
+ method: "POST",
8261
+ body: input,
8262
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
8263
+ }).then(exposeGatewayData);
8264
+ },
8265
+ readiness(topicId) {
8266
+ return decisionsClient.getJudgmentReadiness({ topicId });
8267
+ },
8268
+ calibration(topicId) {
8269
+ return decisionsClient.getJudgmentCalibration({ topicId });
8270
+ },
8271
+ pendingOutcomeReview(topicId) {
8272
+ return decisionsClient.listPendingJudgmentOutcomeReview({ topicId });
8273
+ }
8274
+ },
6092
8275
  worktrees: {
6093
8276
  createBranch(input) {
6094
8277
  return workflowClient.createBranch(input);
@@ -6096,8 +8279,8 @@ function createLucernClient(config = {}) {
6096
8279
  createLens(input) {
6097
8280
  return workflowClient.createLens(input);
6098
8281
  },
6099
- listLenses(query) {
6100
- return workflowClient.listLenses(query);
8282
+ listLenses(query5) {
8283
+ return workflowClient.listLenses(query5);
6101
8284
  },
6102
8285
  applyLensToTopic(input) {
6103
8286
  return workflowClient.applyLensToTopic(input);
@@ -6108,10 +8291,24 @@ function createLucernClient(config = {}) {
6108
8291
  create(input) {
6109
8292
  return worktreesFacade.create({
6110
8293
  title: input.title,
6111
- topicId: requireTopicId(input),
8294
+ topicId: requireTopicId4(input),
6112
8295
  objective: input.objective,
6113
8296
  hypothesis: input.hypothesis,
8297
+ rationale: input.rationale,
8298
+ worktreeType: input.worktreeType,
8299
+ startDate: input.startDate,
8300
+ endDate: input.endDate,
8301
+ durationWeeks: input.durationWeeks,
8302
+ confidenceImpact: input.confidenceImpact,
8303
+ beliefFocus: input.beliefFocus,
6114
8304
  beliefIds: input.beliefIds,
8305
+ targetBeliefIds: input.targetBeliefIds,
8306
+ targetQuestionIds: input.targetQuestionIds,
8307
+ keyQuestions: input.keyQuestions,
8308
+ evidenceSignals: input.evidenceSignals,
8309
+ decisionGate: input.decisionGate,
8310
+ goCriteria: input.goCriteria,
8311
+ noGoSignals: input.noGoSignals,
6115
8312
  autoShape: input.autoShape,
6116
8313
  domainPackId: input.domainPackId,
6117
8314
  campaign: input.campaign,
@@ -6124,16 +8321,31 @@ function createLucernClient(config = {}) {
6124
8321
  proofArtifacts: input.proofArtifacts,
6125
8322
  staffingHint: typeof input.staffingHint === "string" ? input.staffingHint : void 0,
6126
8323
  lastReconciledAt: input.lastReconciledAt,
6127
- autoFixPolicy: input.autoFixPolicy
8324
+ autoFixPolicy: input.autoFixPolicy,
8325
+ lensId: input.lensId
6128
8326
  });
6129
8327
  },
6130
8328
  add(input) {
6131
8329
  return worktreesFacade.create({
6132
8330
  title: input.title,
6133
- topicId: requireTopicId(input),
8331
+ topicId: requireTopicId4(input),
6134
8332
  objective: input.objective,
6135
8333
  hypothesis: input.hypothesis,
8334
+ rationale: input.rationale,
8335
+ worktreeType: input.worktreeType,
8336
+ startDate: input.startDate,
8337
+ endDate: input.endDate,
8338
+ durationWeeks: input.durationWeeks,
8339
+ confidenceImpact: input.confidenceImpact,
8340
+ beliefFocus: input.beliefFocus,
6136
8341
  beliefIds: input.beliefIds,
8342
+ targetBeliefIds: input.targetBeliefIds,
8343
+ targetQuestionIds: input.targetQuestionIds,
8344
+ keyQuestions: input.keyQuestions,
8345
+ evidenceSignals: input.evidenceSignals,
8346
+ decisionGate: input.decisionGate,
8347
+ goCriteria: input.goCriteria,
8348
+ noGoSignals: input.noGoSignals,
6137
8349
  autoShape: input.autoShape,
6138
8350
  domainPackId: input.domainPackId,
6139
8351
  campaign: input.campaign,
@@ -6146,16 +8358,33 @@ function createLucernClient(config = {}) {
6146
8358
  proofArtifacts: input.proofArtifacts,
6147
8359
  staffingHint: typeof input.staffingHint === "string" ? input.staffingHint : void 0,
6148
8360
  lastReconciledAt: input.lastReconciledAt,
6149
- autoFixPolicy: input.autoFixPolicy
8361
+ autoFixPolicy: input.autoFixPolicy,
8362
+ lensId: input.lensId
8363
+ });
8364
+ },
8365
+ list(query5) {
8366
+ return worktreesFacade.list({
8367
+ topicId: requireTopicId4(query5),
8368
+ status: query5.status,
8369
+ limit: query5.limit
6150
8370
  });
6151
8371
  },
6152
- list(query) {
8372
+ listByTopic(query5) {
6153
8373
  return worktreesFacade.list({
6154
- topicId: requireTopicId(query),
6155
- status: query.status,
6156
- limit: query.limit
8374
+ topicId: requireTopicId4(query5),
8375
+ status: query5.status,
8376
+ limit: query5.limit
6157
8377
  });
6158
8378
  },
8379
+ findByPairedSprint(input) {
8380
+ return gateway.request({
8381
+ path: `/api/platform/v1/worktrees/paired-sprint${sdkQueryString({
8382
+ sprintId: input.sprintId,
8383
+ topicId: input.topicId ?? input.projectId,
8384
+ limit: input.limit
8385
+ })}`
8386
+ }).then(exposeGatewayData);
8387
+ },
6159
8388
  activate(worktreeId) {
6160
8389
  return worktreesFacade.activate({ id: worktreeId });
6161
8390
  },
@@ -6188,8 +8417,8 @@ function createLucernClient(config = {}) {
6188
8417
  removeQuestionIds: input.removeQuestionIds
6189
8418
  });
6190
8419
  },
6191
- listAll(query = {}) {
6192
- return workflowClient.listAllWorktrees(query);
8420
+ listAll(query5 = {}) {
8421
+ return workflowClient.listAllWorktrees(query5);
6193
8422
  },
6194
8423
  merge(worktreeId, input) {
6195
8424
  return worktreesFacade.merge({
@@ -6230,12 +8459,12 @@ function createLucernClient(config = {}) {
6230
8459
  }
6231
8460
  },
6232
8461
  context: {
6233
- listTopics(query = {}) {
8462
+ listTopics(query5 = {}) {
6234
8463
  return topicsFacade.list({
6235
- ontologyId: query.ontologyId,
6236
- parentTopicId: query.parentTopicId,
6237
- status: query.status,
6238
- type: query.type
8464
+ ontologyId: query5.ontologyId,
8465
+ parentTopicId: query5.parentTopicId,
8466
+ status: query5.status,
8467
+ type: query5.type
6239
8468
  });
6240
8469
  },
6241
8470
  compile(topicId, input = {}) {
@@ -6307,6 +8536,31 @@ function createLucernClient(config = {}) {
6307
8536
  status: typeof input.status === "string" ? input.status : void 0,
6308
8537
  limit: typeof input.limit === "number" ? input.limit : void 0
6309
8538
  });
8539
+ },
8540
+ listByTopic(input) {
8541
+ return tasksFacade.list({
8542
+ topicId: requireTopicId4(input),
8543
+ status: typeof input.status === "string" ? input.status : void 0,
8544
+ limit: typeof input.limit === "number" ? input.limit : void 0
8545
+ });
8546
+ },
8547
+ listByWorktree(input) {
8548
+ return tasksFacade.list({
8549
+ topicId: typeof input.topicId === "string" ? input.topicId : void 0,
8550
+ worktreeId: input.worktreeId,
8551
+ status: typeof input.status === "string" ? input.status : void 0,
8552
+ limit: typeof input.limit === "number" ? input.limit : void 0
8553
+ });
8554
+ },
8555
+ linkChat(taskId, input, idempotencyKey) {
8556
+ return gateway.request({
8557
+ path: `/api/platform/v1/tasks/${encodeURIComponent(
8558
+ taskId
8559
+ )}/link-chat`,
8560
+ method: "POST",
8561
+ body: input,
8562
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
8563
+ }).then(exposeGatewayData);
6310
8564
  }
6311
8565
  },
6312
8566
  topics: {
@@ -6346,10 +8600,10 @@ function createLucernClient(config = {}) {
6346
8600
  visibility: input.visibility
6347
8601
  });
6348
8602
  },
6349
- tree(topicId, query = {}) {
8603
+ tree(topicId, query5 = {}) {
6350
8604
  return topicsFacade.tree({
6351
8605
  id: topicId,
6352
- maxDepth: query.maxDepth
8606
+ maxDepth: query5.maxDepth
6353
8607
  });
6354
8608
  },
6355
8609
  getTree(input) {
@@ -6358,11 +8612,11 @@ function createLucernClient(config = {}) {
6358
8612
  maxDepth: input.maxDepth
6359
8613
  });
6360
8614
  },
6361
- coverage(topicId, query = {}) {
8615
+ coverage(topicId, query5 = {}) {
6362
8616
  return topicsFacade.coverage({
6363
8617
  id: topicId,
6364
- includeDescendants: query.includeDescendants,
6365
- maxDepth: query.maxDepth
8618
+ includeDescendants: query5.includeDescendants,
8619
+ maxDepth: query5.maxDepth
6366
8620
  });
6367
8621
  },
6368
8622
  remove(topicId, idempotencyKey) {
@@ -6412,7 +8666,7 @@ function createLucernClient(config = {}) {
6412
8666
  },
6413
8667
  list(args) {
6414
8668
  return contradictionsFacade.list({
6415
- topicId: requireTopicId(args),
8669
+ topicId: requireTopicId4(args),
6416
8670
  status: args.status,
6417
8671
  limit: args.limit,
6418
8672
  cursor: args.cursor
@@ -6587,7 +8841,26 @@ function createLucernClient(config = {}) {
6587
8841
  return functionSurfaceClient.generateSessionHandoff(input);
6588
8842
  }
6589
8843
  },
8844
+ embeddings: embeddingsClient,
8845
+ graphAnalysis: graphAnalysisClient,
8846
+ graphRecommendations: graphRecommendationsClient,
8847
+ orgGraphSearch: orgGraphSearchClient,
8848
+ ontologyLinks: ontologyLinksNamespace,
8849
+ graphStateClassifier: graphStateClassifierClient,
8850
+ modelRuntime: modelRuntimeClient,
8851
+ jobs: jobsClient,
8852
+ telemetry: telemetryClient,
8853
+ publication: publicationNamespace,
8854
+ contentPublication: publicationNamespace,
6590
8855
  tools: {
8856
+ listCatalog: toolRegistryClient.listCatalog,
8857
+ listExecutable: toolRegistryClient.listExecutable,
8858
+ listEffectiveTools: toolRegistryClient.listEffectiveTools,
8859
+ upsertCoreTools: toolRegistryClient.upsertCoreTools,
8860
+ setPackToolsStatus: toolRegistryClient.setPackToolsStatus,
8861
+ createAcl: toolRegistryClient.createAcl,
8862
+ deleteAcl: toolRegistryClient.deleteAcl,
8863
+ registerCustomTool: toolRegistryClient.registerCustomTool,
6591
8864
  register(registration) {
6592
8865
  return registerCustomTool(registration);
6593
8866
  },
@@ -6644,26 +8917,74 @@ function createLucernClient(config = {}) {
6644
8917
  }
6645
8918
  },
6646
8919
  nodes: nodesNamespace,
6647
- identity: identityFacade,
8920
+ identity: {
8921
+ ...identityFacade,
8922
+ evaluatePolicy: identityClient.evaluatePolicy,
8923
+ recordPolicyDecision: identityClient.recordPolicyDecision,
8924
+ putSecretReference: identityClient.putSecretReference,
8925
+ createPrincipal: identityClient.createPrincipal,
8926
+ updatePrincipal: identityClient.updatePrincipal,
8927
+ raw: identityClient
8928
+ },
8929
+ mcp: {
8930
+ bootstrapSession(input) {
8931
+ return mcpClient.bootstrapSession(input);
8932
+ },
8933
+ checkWritePolicy(input) {
8934
+ return mcpClient.checkWritePolicy(input);
8935
+ },
8936
+ beginBuildSession(input) {
8937
+ return mcpClient.beginBuildSession(input);
8938
+ },
8939
+ evaluateEngineeringContract(input) {
8940
+ return mcpClient.evaluateEngineeringContract(input);
8941
+ },
8942
+ evaluateResearchContract(input) {
8943
+ return mcpClient.evaluateResearchContract(input);
8944
+ }
8945
+ },
8946
+ auth: {
8947
+ device: {
8948
+ createCode(input) {
8949
+ return authDeviceClient.createDeviceCode(input);
8950
+ },
8951
+ pollToken(deviceCode) {
8952
+ return authDeviceClient.pollDeviceToken(deviceCode);
8953
+ }
8954
+ }
8955
+ },
6648
8956
  custom: getCustomNamespace("custom"),
6649
8957
  extensions: extensionNamespaces,
6650
8958
  raw: {
6651
8959
  beliefs: beliefsClient,
6652
8960
  sources: sourcesClient,
6653
8961
  evidence: evidenceClient,
8962
+ embeddings: embeddingsClient,
8963
+ eventing: eventingClient,
6654
8964
  graph: graphClient,
8965
+ graphAnalysis: graphAnalysisClient,
8966
+ graphRecommendations: graphRecommendationsClient,
8967
+ graphStateClassifier: graphStateClassifierClient,
6655
8968
  decisions: decisionsClient,
6656
8969
  workflow: workflowClient,
6657
8970
  audit: auditClient,
8971
+ authDevice: authDeviceClient,
6658
8972
  admin: adminClient,
6659
8973
  identity: identityClient,
6660
8974
  policy: policyClient,
6661
8975
  answers: answersClient,
6662
8976
  ontology: ontologyClient,
8977
+ ontologyLinks: ontologyLinksClient,
8978
+ orgGraphSearch: orgGraphSearchClient,
6663
8979
  functionSurface: functionSurfaceClient,
8980
+ toolRegistry: toolRegistryClient,
8981
+ modelRuntime: modelRuntimeClient,
6664
8982
  packs: packsClient,
6665
8983
  reports: reportsClient,
6666
8984
  learning: learningClient,
8985
+ mcp: mcpClient,
8986
+ jobs: jobsClient,
8987
+ telemetry: telemetryClient,
6667
8988
  harness: harnessClient,
6668
8989
  schema: schemaClient,
6669
8990
  audiences: audiencesClient,