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