@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
package/dist/client.js CHANGED
@@ -1,4 +1,172 @@
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';
3
+
4
+ // src/authContext.ts
5
+ var LucernSdkAuthContextError = class extends Error {
6
+ reason;
7
+ constructor(reason, message) {
8
+ super(message);
9
+ this.name = "LucernSdkAuthContextError";
10
+ this.reason = reason;
11
+ }
12
+ };
13
+ function cleanString(value) {
14
+ const normalized = value?.trim();
15
+ return normalized ? normalized : void 0;
16
+ }
17
+ function cleanStringList(values) {
18
+ if (!values) {
19
+ return [];
20
+ }
21
+ return values.map((value) => value.trim()).filter(
22
+ (value, index, list) => value.length > 0 && list.indexOf(value) === index
23
+ );
24
+ }
25
+ function requireString(value, reason, label) {
26
+ const normalized = cleanString(value);
27
+ if (!normalized) {
28
+ throw new LucernSdkAuthContextError(
29
+ reason,
30
+ `Canonical Lucern SDK auth context is missing ${label}.`
31
+ );
32
+ }
33
+ return normalized;
34
+ }
35
+ function requirePrincipalType(principalType) {
36
+ if (!principalType) {
37
+ throw new LucernSdkAuthContextError(
38
+ "principal_missing",
39
+ "Canonical Lucern SDK auth context is missing principalType."
40
+ );
41
+ }
42
+ return principalType;
43
+ }
44
+ function requireAuthMode(authMode) {
45
+ if (!authMode) {
46
+ throw new LucernSdkAuthContextError(
47
+ "principal_missing",
48
+ "Canonical Lucern SDK auth context is missing authMode."
49
+ );
50
+ }
51
+ return authMode;
52
+ }
53
+ function ensurePermitMatch(args) {
54
+ const actual = cleanString(args.actual);
55
+ if (actual && actual !== args.expected) {
56
+ throw new LucernSdkAuthContextError(
57
+ "policy_denied",
58
+ `Canonical Lucern SDK auth context has conflicting Permit ${args.field}.`
59
+ );
60
+ }
61
+ }
62
+ function normalizeCanonicalLucernAuthContext(input) {
63
+ if (!input) {
64
+ throw new LucernSdkAuthContextError(
65
+ "principal_missing",
66
+ "Canonical Lucern SDK auth context is required."
67
+ );
68
+ }
69
+ if (input.policyDecision === "deny") {
70
+ throw new LucernSdkAuthContextError(
71
+ "policy_denied",
72
+ "Canonical Lucern SDK auth context carries a denied policy decision."
73
+ );
74
+ }
75
+ const principalId = requireString(
76
+ input.principalId,
77
+ "principal_missing",
78
+ "principalId"
79
+ );
80
+ const tenantId = requireString(input.tenantId, "tenant_missing", "tenantId");
81
+ const workspaceId = requireString(
82
+ input.workspaceId,
83
+ "workspace_missing",
84
+ "workspaceId"
85
+ );
86
+ const roles = cleanStringList(input.roles);
87
+ const scopes = cleanStringList(input.scopes);
88
+ const principalType = requirePrincipalType(input.principalType);
89
+ const authMode = requireAuthMode(input.authMode);
90
+ const roleBasedInteractiveAuth = authMode === "interactive_user" && roles.length > 0;
91
+ if (roles.length === 0 || scopes.length === 0 && !roleBasedInteractiveAuth) {
92
+ throw new LucernSdkAuthContextError(
93
+ "membership_missing",
94
+ "Canonical Lucern SDK auth context requires non-empty roles and scopes."
95
+ );
96
+ }
97
+ const subject = cleanString(input.permit?.subject) ?? principalId;
98
+ const tenant = cleanString(input.permit?.tenant) ?? tenantId;
99
+ const workspace = cleanString(input.permit?.workspace) ?? workspaceId;
100
+ ensurePermitMatch({
101
+ field: "subject",
102
+ expected: principalId,
103
+ actual: subject
104
+ });
105
+ ensurePermitMatch({ field: "tenant", expected: tenantId, actual: tenant });
106
+ ensurePermitMatch({
107
+ field: "workspace",
108
+ expected: workspaceId,
109
+ actual: workspace
110
+ });
111
+ const context = input.permit?.context ? { ...input.permit.context } : void 0;
112
+ return {
113
+ clerkId: cleanString(input.clerkId),
114
+ principalId,
115
+ tenantId,
116
+ workspaceId,
117
+ principalType,
118
+ authMode,
119
+ roles,
120
+ scopes,
121
+ delegationChain: input.delegationChain ? [...input.delegationChain] : [],
122
+ policyTraceId: cleanString(input.policyTraceId),
123
+ correlationId: cleanString(input.correlationId),
124
+ membershipId: cleanString(input.membershipId),
125
+ permit: {
126
+ subject,
127
+ tenant,
128
+ workspace,
129
+ resource: cleanString(input.permit?.resource),
130
+ action: cleanString(input.permit?.action),
131
+ relation: cleanString(input.permit?.relation),
132
+ context
133
+ }
134
+ };
135
+ }
136
+ function createCanonicalAuthHeaders(authContext) {
137
+ const headers = {
138
+ "x-lucern-principal-id": authContext.principalId,
139
+ "x-lucern-principal-type": authContext.principalType,
140
+ "x-lucern-tenant": authContext.tenantId,
141
+ "x-lucern-tenant-id": authContext.tenantId,
142
+ "x-lucern-workspace": authContext.workspaceId,
143
+ "x-lucern-workspace-id": authContext.workspaceId,
144
+ "x-lucern-auth-mode": authContext.authMode,
145
+ "x-lucern-roles": authContext.roles.join(","),
146
+ "x-lucern-scopes": authContext.scopes.join(","),
147
+ "x-lucern-permit-context": JSON.stringify(authContext.permit)
148
+ };
149
+ if (authContext.clerkId) {
150
+ headers["x-lucern-clerk-id"] = authContext.clerkId;
151
+ headers["x-lucern-user-id"] = authContext.clerkId;
152
+ }
153
+ if (authContext.delegationChain.length > 0) {
154
+ headers["x-lucern-delegation-chain"] = JSON.stringify(
155
+ authContext.delegationChain
156
+ );
157
+ }
158
+ if (authContext.policyTraceId) {
159
+ headers["x-lucern-policy-trace-id"] = authContext.policyTraceId;
160
+ }
161
+ if (authContext.correlationId) {
162
+ headers["x-correlation-id"] = authContext.correlationId;
163
+ headers["x-lucern-correlation-id"] = authContext.correlationId;
164
+ }
165
+ if (authContext.membershipId) {
166
+ headers["x-lucern-membership-id"] = authContext.membershipId;
167
+ }
168
+ return headers;
169
+ }
2
170
 
3
171
  // src/coreClient.ts
4
172
  var LucernApiError = class extends Error {
@@ -156,16 +324,41 @@ function readPolicySummaryFromDetails(details) {
156
324
  }
157
325
  return null;
158
326
  }
327
+ async function resolveConfiguredAuthContext(authContext) {
328
+ if (typeof authContext === "function") {
329
+ return await authContext();
330
+ }
331
+ return authContext;
332
+ }
333
+ function mergeHeaderRecord(base, addition) {
334
+ const headers = new Headers(base);
335
+ for (const [key, value] of Object.entries(addition)) {
336
+ const existing = headers.get(key);
337
+ if (existing !== null && existing !== value) {
338
+ throw new LucernSdkAuthContextError(
339
+ "policy_denied",
340
+ `Canonical Lucern SDK auth context conflicts with existing ${key} header.`
341
+ );
342
+ }
343
+ headers.set(key, value);
344
+ }
345
+ return Object.fromEntries(headers.entries());
346
+ }
159
347
  function createGatewayRequestClient(config = {}) {
160
348
  const fetchImpl = config.fetchImpl ?? fetch;
161
349
  const baseUrl = config.baseUrl?.replace(/\/+$/, "") ?? "";
162
350
  const maxRetries = config.maxRetries ?? 2;
163
351
  const requestIdFactory = config.requestIdFactory ?? (() => generatePortableRequestId());
164
352
  async function resolveAuthHeaders() {
165
- if (!config.getAuthHeaders) {
166
- return {};
353
+ const base = config.getAuthHeaders ? await config.getAuthHeaders() : {};
354
+ const authContextInput = await resolveConfiguredAuthContext(
355
+ config.authContext
356
+ );
357
+ if (!authContextInput && !config.requireCanonicalAuthContext) {
358
+ return base;
167
359
  }
168
- return await config.getAuthHeaders();
360
+ const authContext = normalizeCanonicalLucernAuthContext(authContextInput);
361
+ return mergeHeaderRecord(base, createCanonicalAuthHeaders(authContext));
169
362
  }
170
363
  async function fetchWithTimeout(url, init, timeoutMs) {
171
364
  const controller = new AbortController();
@@ -340,11 +533,11 @@ function createGatewayRequestClient(config = {}) {
340
533
  function asRecord(value) {
341
534
  return value && typeof value === "object" ? value : {};
342
535
  }
343
- function cleanString(value) {
536
+ function cleanString2(value) {
344
537
  return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
345
538
  }
346
539
  function normalizeVerificationStatus(value) {
347
- const status = cleanString(value);
540
+ const status = cleanString2(value);
348
541
  if (!status) {
349
542
  return void 0;
350
543
  }
@@ -360,20 +553,20 @@ function cloneWith(value, patch) {
360
553
  return { ...value, ...patch };
361
554
  }
362
555
  function resolveTopicId(value) {
363
- return cleanString(value.topicId);
556
+ return cleanString2(value.topicId);
364
557
  }
365
558
  function resolveText(value) {
366
- return cleanString(value.text) ?? cleanString(value.canonicalText);
559
+ return cleanString2(value.text) ?? cleanString2(value.canonicalText);
367
560
  }
368
561
  function withTopicAlias(value) {
369
- const topicId = cleanString(value.topicId) ?? void 0;
562
+ const topicId = cleanString2(value.topicId) ?? void 0;
370
563
  if (!topicId) {
371
564
  return value;
372
565
  }
373
566
  return cloneWith(value, { topicId });
374
567
  }
375
568
  function withTextAlias(value) {
376
- const text = cleanString(value.text) ?? cleanString(value.canonicalText) ?? void 0;
569
+ const text = cleanString2(value.text) ?? cleanString2(value.canonicalText) ?? void 0;
377
570
  if (!text) {
378
571
  return value;
379
572
  }
@@ -403,7 +596,7 @@ function normalizeNodeVerificationStatus(value) {
403
596
  return normalizeVerificationStatus(value);
404
597
  }
405
598
  function normalizeTopicQuery(value) {
406
- const topicId = cleanString(value.topicId);
599
+ const topicId = cleanString2(value.topicId);
407
600
  if (!topicId) {
408
601
  return value;
409
602
  }
@@ -476,9 +669,9 @@ function createAdminClient(config = {}) {
476
669
  /**
477
670
  * List tenants visible to the current principal.
478
671
  */
479
- async listTenants(query = {}) {
672
+ async listTenants(query5 = {}) {
480
673
  return gateway.request({
481
- path: `/api/platform/v1/tenants${toQueryString(query)}`
674
+ path: `/api/platform/v1/tenants${toQueryString(query5)}`
482
675
  }).then(
483
676
  (response) => mapGatewayData(
484
677
  response,
@@ -519,9 +712,9 @@ function createAdminClient(config = {}) {
519
712
  /**
520
713
  * List workspaces for the current admin scope.
521
714
  */
522
- async listWorkspaces(query = {}) {
715
+ async listWorkspaces(query5 = {}) {
523
716
  return gateway.request({
524
- path: `/api/platform/v1/workspaces${toQueryString(query)}`
717
+ path: `/api/platform/v1/workspaces${toQueryString(query5)}`
525
718
  }).then(
526
719
  (response) => mapGatewayData(
527
720
  response,
@@ -546,9 +739,9 @@ function createAdminClient(config = {}) {
546
739
  /**
547
740
  * List memberships for the current admin scope.
548
741
  */
549
- async listMemberships(query = {}) {
742
+ async listMemberships(query5 = {}) {
550
743
  return gateway.request({
551
- path: `/api/platform/v1/memberships${toQueryString(query)}`
744
+ path: `/api/platform/v1/memberships${toQueryString(query5)}`
552
745
  }).then(
553
746
  (response) => mapGatewayData(
554
747
  response,
@@ -785,9 +978,9 @@ function createAdminClient(config = {}) {
785
978
  /**
786
979
  * List group members.
787
980
  */
788
- async listGroupMembers(query) {
981
+ async listGroupMembers(query5) {
789
982
  return gateway.request({
790
- path: `/api/platform/v1/groups/members${toQueryString(query)}`
983
+ path: `/api/platform/v1/groups/members${toQueryString(query5)}`
791
984
  });
792
985
  },
793
986
  /**
@@ -814,9 +1007,9 @@ function createAdminClient(config = {}) {
814
1007
  /**
815
1008
  * List pack-to-group assignments.
816
1009
  */
817
- async listPackGroupAssignments(query = {}) {
1010
+ async listPackGroupAssignments(query5 = {}) {
818
1011
  return gateway.request({
819
- path: `/api/platform/v1/groups/packs${toQueryString(query)}`
1012
+ path: `/api/platform/v1/groups/packs${toQueryString(query5)}`
820
1013
  });
821
1014
  },
822
1015
  /**
@@ -867,12 +1060,12 @@ function createAudiencesClient(config = {}) {
867
1060
  /**
868
1061
  * List audience registry entries.
869
1062
  */
870
- async listRegistry(query = {}) {
1063
+ async listRegistry(query5 = {}) {
871
1064
  return gateway.request({
872
1065
  path: `/api/platform/v1/audiences/registry${toQueryString({
873
- ...query,
874
- effective: typeof query.effective === "boolean" ? query.effective ? "true" : "false" : void 0,
875
- status: query.status
1066
+ ...query5,
1067
+ effective: typeof query5.effective === "boolean" ? query5.effective ? "true" : "false" : void 0,
1068
+ status: query5.status
876
1069
  })}`
877
1070
  }).then(
878
1071
  (response) => mapGatewayData(
@@ -887,8 +1080,8 @@ function createAudiencesClient(config = {}) {
887
1080
  /**
888
1081
  * @deprecated Use listRegistry.
889
1082
  */
890
- async getRegistry(query = {}) {
891
- return this.listRegistry(query);
1083
+ async getRegistry(query5 = {}) {
1084
+ return this.listRegistry(query5);
892
1085
  },
893
1086
  /**
894
1087
  * Create an audience registry entry.
@@ -916,14 +1109,14 @@ function createAudiencesClient(config = {}) {
916
1109
  /**
917
1110
  * List audience grants.
918
1111
  */
919
- async listGrants(query = {}) {
1112
+ async listGrants(query5 = {}) {
920
1113
  return gateway.request({
921
1114
  path: `/api/platform/v1/audiences/grants${toQueryString({
922
- ...query,
923
- audienceKey: query.audienceKey,
924
- principalId: query.principalId,
925
- groupId: query.groupId,
926
- status: query.status
1115
+ ...query5,
1116
+ audienceKey: query5.audienceKey,
1117
+ principalId: query5.principalId,
1118
+ groupId: query5.groupId,
1119
+ status: query5.status
927
1120
  })}`
928
1121
  }).then(
929
1122
  (response) => mapGatewayData(
@@ -935,8 +1128,8 @@ function createAudiencesClient(config = {}) {
935
1128
  /**
936
1129
  * @deprecated Use listGrants.
937
1130
  */
938
- async getGrants(query = {}) {
939
- return this.listGrants(query);
1131
+ async getGrants(query5 = {}) {
1132
+ return this.listGrants(query5);
940
1133
  },
941
1134
  /**
942
1135
  * Create an audience grant.
@@ -982,10 +1175,10 @@ function createAuditClient(config = {}) {
982
1175
  /**
983
1176
  * List audit events for the current scope.
984
1177
  */
985
- async listEvents(query = {}) {
1178
+ async listEvents(query5 = {}) {
986
1179
  return gateway.request({
987
1180
  path: `/api/platform/v1/audit/events${toQueryString(
988
- normalizeTopicQuery(query)
1181
+ normalizeTopicQuery(query5)
989
1182
  )}`
990
1183
  }).then(
991
1184
  (response) => mapGatewayData(
@@ -997,11 +1190,116 @@ function createAuditClient(config = {}) {
997
1190
  };
998
1191
  }
999
1192
 
1193
+ // src/authDeviceClient.ts
1194
+ var DeviceAuthorizationError = class extends Error {
1195
+ error;
1196
+ interval;
1197
+ constructor(args) {
1198
+ super(args.description ?? args.error);
1199
+ this.name = "DeviceAuthorizationError";
1200
+ this.error = args.error;
1201
+ this.interval = args.interval;
1202
+ }
1203
+ };
1204
+ function authBaseUrl(config) {
1205
+ return config.baseUrl?.replace(/\/+$/, "") ?? "";
1206
+ }
1207
+ async function readJson(response) {
1208
+ const payload = await response.json().catch(() => ({}));
1209
+ return payload && typeof payload === "object" && !Array.isArray(payload) ? payload : {};
1210
+ }
1211
+ function readString(value) {
1212
+ const normalized = typeof value === "string" ? value.trim() : "";
1213
+ return normalized || void 0;
1214
+ }
1215
+ function assertDeviceCodeResponse(payload) {
1216
+ const deviceCode = readString(payload.device_code);
1217
+ const userCode = readString(payload.user_code);
1218
+ const verificationUri = readString(payload.verification_uri);
1219
+ const verificationUriComplete = readString(payload.verification_uri_complete);
1220
+ const expiresIn = payload.expires_in;
1221
+ const interval = payload.interval;
1222
+ if (!deviceCode || !userCode || !verificationUri || !verificationUriComplete || typeof expiresIn !== "number" || typeof interval !== "number") {
1223
+ throw new Error("Gateway returned an invalid device-code response.");
1224
+ }
1225
+ return {
1226
+ device_code: deviceCode,
1227
+ user_code: userCode,
1228
+ verification_uri: verificationUri,
1229
+ verification_uri_complete: verificationUriComplete,
1230
+ expires_in: expiresIn,
1231
+ interval
1232
+ };
1233
+ }
1234
+ function assertDeviceTokenResponse(payload) {
1235
+ const accessToken = readString(payload.access_token);
1236
+ const tokenType = readString(payload.token_type);
1237
+ const scope = readString(payload.scope);
1238
+ const tenantId = readString(payload.tenant_id);
1239
+ const principalId = readString(payload.principal_id);
1240
+ if (!accessToken || tokenType !== "Bearer" || typeof payload.expires_in !== "number" || !scope || !tenantId || !principalId) {
1241
+ throw new Error("Gateway returned an invalid device token response.");
1242
+ }
1243
+ return {
1244
+ access_token: accessToken,
1245
+ token_type: "Bearer",
1246
+ expires_in: payload.expires_in,
1247
+ scope,
1248
+ tenant_id: tenantId,
1249
+ workspace_id: readString(payload.workspace_id),
1250
+ principal_id: principalId,
1251
+ user: payload.user && typeof payload.user === "object" && !Array.isArray(payload.user) ? payload.user : void 0
1252
+ };
1253
+ }
1254
+ function maybeThrowDeviceError(payload) {
1255
+ const error = readString(payload.error);
1256
+ throw new DeviceAuthorizationError({
1257
+ error: error ?? "invalid_request",
1258
+ description: readString(payload.error_description),
1259
+ interval: typeof payload.interval === "number" ? payload.interval : void 0
1260
+ });
1261
+ }
1262
+ function createAuthDeviceClient(config = {}) {
1263
+ const fetchImpl = config.fetchImpl ?? fetch;
1264
+ const baseUrl = authBaseUrl(config);
1265
+ async function post(path, body4) {
1266
+ return fetchImpl(`${baseUrl}${path}`, {
1267
+ method: "POST",
1268
+ headers: { "content-type": "application/json" },
1269
+ body: JSON.stringify(body4)
1270
+ });
1271
+ }
1272
+ return {
1273
+ async createDeviceCode(input = {}) {
1274
+ const response = await post("/api/platform/v1/auth/device/code", {
1275
+ client_id: input.clientId ?? "lucern-cli",
1276
+ scope: input.scope ?? "graph.read graph.write"
1277
+ });
1278
+ const payload = await readJson(response);
1279
+ if (!response.ok) {
1280
+ maybeThrowDeviceError(payload);
1281
+ }
1282
+ return assertDeviceCodeResponse(payload);
1283
+ },
1284
+ async pollDeviceToken(deviceCode) {
1285
+ const response = await post("/api/platform/v1/auth/device/token", {
1286
+ grant_type: "urn:ietf:params:oauth:grant-type:device_code",
1287
+ device_code: deviceCode
1288
+ });
1289
+ const payload = await readJson(response);
1290
+ if (!response.ok) {
1291
+ maybeThrowDeviceError(payload);
1292
+ }
1293
+ return assertDeviceTokenResponse(payload);
1294
+ }
1295
+ };
1296
+ }
1297
+
1000
1298
  // src/beliefsClient.ts
1001
1299
  function asRecord2(value) {
1002
1300
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
1003
1301
  }
1004
- function readString(value) {
1302
+ function readString2(value) {
1005
1303
  if (typeof value !== "string") {
1006
1304
  return void 0;
1007
1305
  }
@@ -1038,15 +1336,15 @@ function mapOpinionHistoryEntriesFromGatewayData(payload) {
1038
1336
  const record = asRecord2(value);
1039
1337
  const tuple = normalizeOpinionTuple(record);
1040
1338
  const projected = readNumber(record.confidence) ?? clamp01(tuple.b + tuple.a * tuple.u);
1041
- const triggeringEvidenceId = readString(record.triggeringEvidenceId);
1042
- const triggeringQuestionId = readString(record.triggeringQuestionId);
1043
- const triggeringAnswerId = readString(record.triggeringAnswerId);
1044
- const triggeringContradictionId = readString(
1339
+ const triggeringEvidenceId = readString2(record.triggeringEvidenceId);
1340
+ const triggeringQuestionId = readString2(record.triggeringQuestionId);
1341
+ const triggeringAnswerId = readString2(record.triggeringAnswerId);
1342
+ const triggeringContradictionId = readString2(
1045
1343
  record.triggeringContradictionId
1046
1344
  );
1047
- const triggeringWorktreeId = readString(record.triggeringWorktreeId);
1345
+ const triggeringWorktreeId = readString2(record.triggeringWorktreeId);
1048
1346
  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;
1049
- const trigger = readString(record.trigger);
1347
+ const trigger = readString2(record.trigger);
1050
1348
  if (!trigger) {
1051
1349
  throw new Error("Gateway opinion history entries must include trigger.");
1052
1350
  }
@@ -1059,9 +1357,9 @@ function mapOpinionHistoryEntriesFromGatewayData(payload) {
1059
1357
  P: clamp01(projected),
1060
1358
  trigger,
1061
1359
  ...triggeringRef ? { triggeringRef } : {},
1062
- ...readString(record.rationale) ? { rationale: readString(record.rationale) } : {},
1063
- ...readString(record.userId) ? { userId: readString(record.userId) } : {},
1064
- ...readString(record.slOperator) ? { slOperator: readString(record.slOperator) } : {}
1360
+ ...readString2(record.rationale) ? { rationale: readString2(record.rationale) } : {},
1361
+ ...readString2(record.userId) ? { userId: readString2(record.userId) } : {},
1362
+ ...readString2(record.slOperator) ? { slOperator: readString2(record.slOperator) } : {}
1065
1363
  };
1066
1364
  }).sort((left, right) => left.t - right.t);
1067
1365
  }
@@ -1296,6 +1594,180 @@ function createEvidenceClient(config = {}) {
1296
1594
  }
1297
1595
  };
1298
1596
  }
1597
+
1598
+ // src/boundaryClientSurface.ts
1599
+ function cleanOptionalString(value) {
1600
+ const normalized = value?.trim();
1601
+ return normalized ? normalized : void 0;
1602
+ }
1603
+ function cleanRequiredString(value, label) {
1604
+ const normalized = cleanOptionalString(value);
1605
+ if (!normalized) {
1606
+ throw new Error(`${label} is required`);
1607
+ }
1608
+ return normalized;
1609
+ }
1610
+ function readTopicId(input) {
1611
+ return cleanOptionalString(input.topicId) ?? cleanOptionalString(input.projectId);
1612
+ }
1613
+ function requireTopicId(input) {
1614
+ const topicId = readTopicId(input);
1615
+ if (!topicId) {
1616
+ throw new Error("topicId is required");
1617
+ }
1618
+ return topicId;
1619
+ }
1620
+ function assertKnownKeys(input, allowed, operation) {
1621
+ const allowedSet = new Set(allowed);
1622
+ const unknownKeys = Object.keys(input).filter((key) => !allowedSet.has(key));
1623
+ if (unknownKeys.length > 0) {
1624
+ throw new Error(
1625
+ `${operation} received unsupported field(s): ${unknownKeys.join(", ")}`
1626
+ );
1627
+ }
1628
+ }
1629
+ function knownPayload(input, allowed, operation) {
1630
+ assertKnownKeys(input, allowed, operation);
1631
+ return { ...input };
1632
+ }
1633
+ function topicPayload(input, allowed, operation) {
1634
+ assertKnownKeys(input, allowed, operation);
1635
+ return {
1636
+ ...input,
1637
+ topicId: requireTopicId(input),
1638
+ projectId: void 0
1639
+ };
1640
+ }
1641
+ function listResultFromEnvelope(data, legacyKey) {
1642
+ const record = data && typeof data === "object" ? data : {};
1643
+ return createListResult(
1644
+ Array.isArray(record[legacyKey]) ? record[legacyKey] : Array.isArray(data) ? data : [],
1645
+ legacyKey
1646
+ );
1647
+ }
1648
+
1649
+ // src/eventingClient.ts
1650
+ var EVENTING_FIELDS = [
1651
+ "tenantId",
1652
+ "workspaceId",
1653
+ "principalId",
1654
+ "topicId",
1655
+ "eventId",
1656
+ "eventType",
1657
+ "eventPayload",
1658
+ "webhookId",
1659
+ "deliveryId",
1660
+ "status",
1661
+ "attempt",
1662
+ "statusCode",
1663
+ "error",
1664
+ "responseBody",
1665
+ "durationMs",
1666
+ "metadata",
1667
+ "limit",
1668
+ "cursor"
1669
+ ];
1670
+ function query(input) {
1671
+ return {
1672
+ tenantId: cleanRequiredString(input.tenantId, "tenantId"),
1673
+ workspaceId: input.workspaceId,
1674
+ principalId: input.principalId,
1675
+ topicId: input.topicId,
1676
+ eventType: input.eventType,
1677
+ webhookId: input.webhookId,
1678
+ status: input.status,
1679
+ limit: input.limit,
1680
+ cursor: input.cursor
1681
+ };
1682
+ }
1683
+ function body(input, operation) {
1684
+ return knownPayload(input, EVENTING_FIELDS, operation);
1685
+ }
1686
+ function createEventingClient(config = {}) {
1687
+ const gateway = createGatewayRequestClient(config);
1688
+ return {
1689
+ recordEvent(input, idempotencyKey) {
1690
+ cleanRequiredString(input.tenantId, "tenantId");
1691
+ cleanRequiredString(input.eventType, "eventType");
1692
+ return gateway.request({
1693
+ path: "/api/platform/v1/events",
1694
+ method: "POST",
1695
+ body: body(
1696
+ input,
1697
+ "events.recordEvent"
1698
+ ),
1699
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1700
+ });
1701
+ },
1702
+ listEvents(input) {
1703
+ return gateway.request({
1704
+ path: `/api/platform/v1/events${toQueryString(query(input))}`
1705
+ }).then(
1706
+ (response) => mapGatewayData(
1707
+ response,
1708
+ (data) => listResultFromEnvelope(data, "events")
1709
+ )
1710
+ );
1711
+ },
1712
+ listWebhooks(input) {
1713
+ return gateway.request({
1714
+ path: `/api/platform/v1/webhooks${toQueryString(query(input))}`
1715
+ }).then(
1716
+ (response) => mapGatewayData(
1717
+ response,
1718
+ (data) => listResultFromEnvelope(
1719
+ data,
1720
+ "webhooks"
1721
+ )
1722
+ )
1723
+ );
1724
+ },
1725
+ enqueueDelivery(input, idempotencyKey) {
1726
+ cleanRequiredString(input.tenantId, "tenantId");
1727
+ cleanRequiredString(input.eventId, "eventId");
1728
+ cleanRequiredString(input.webhookId, "webhookId");
1729
+ return gateway.request({
1730
+ path: "/api/platform/v1/events/deliveries",
1731
+ method: "POST",
1732
+ body: body(
1733
+ input,
1734
+ "events.enqueueDelivery"
1735
+ ),
1736
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1737
+ });
1738
+ },
1739
+ recordDeliveryAttempt(input, idempotencyKey) {
1740
+ cleanRequiredString(input.tenantId, "tenantId");
1741
+ cleanRequiredString(input.deliveryId, "deliveryId");
1742
+ return gateway.request({
1743
+ path: `/api/platform/v1/events/deliveries/${encodeURIComponent(
1744
+ input.deliveryId
1745
+ )}/attempts`,
1746
+ method: "POST",
1747
+ body: body(
1748
+ input,
1749
+ "events.recordDeliveryAttempt"
1750
+ ),
1751
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1752
+ });
1753
+ },
1754
+ updateDeliveryStatus(input, idempotencyKey) {
1755
+ cleanRequiredString(input.tenantId, "tenantId");
1756
+ cleanRequiredString(input.deliveryId, "deliveryId");
1757
+ return gateway.request({
1758
+ path: `/api/platform/v1/events/deliveries/${encodeURIComponent(
1759
+ input.deliveryId
1760
+ )}/status`,
1761
+ method: "PATCH",
1762
+ body: body(
1763
+ input,
1764
+ "events.updateDeliveryStatus"
1765
+ ),
1766
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1767
+ });
1768
+ }
1769
+ };
1770
+ }
1299
1771
  var DEFAULT_CUSTOM_NAMESPACE = "custom";
1300
1772
  var RESERVED_NAMESPACES = /* @__PURE__ */ new Set(["lucern"]);
1301
1773
  var CustomToolRegistryError = class extends Error {
@@ -1701,10 +2173,10 @@ function createGraphClient(config = {}) {
1701
2173
  /**
1702
2174
  * List graph nodes matching the provided filters.
1703
2175
  */
1704
- async listNodes(query) {
2176
+ async listNodes(query5) {
1705
2177
  return gateway.request({
1706
2178
  path: `/api/platform/v1/graph/nodes${toQueryString(
1707
- normalizeTopicQuery(query)
2179
+ normalizeTopicQuery(query5)
1708
2180
  )}`
1709
2181
  }).then(
1710
2182
  (response) => mapGatewayData(response, (data) => mapAliasedList(data, "nodes"))
@@ -1713,15 +2185,15 @@ function createGraphClient(config = {}) {
1713
2185
  /**
1714
2186
  * @deprecated Use listNodes.
1715
2187
  */
1716
- async queryNodes(query) {
1717
- return this.listNodes(query);
2188
+ async queryNodes(query5) {
2189
+ return this.listNodes(query5);
1718
2190
  },
1719
2191
  /**
1720
2192
  * Retrieve a single graph node by nodeId or globalId.
1721
2193
  */
1722
- async getNode(query) {
2194
+ async getNode(query5) {
1723
2195
  return gateway.request({
1724
- path: `/api/platform/v1/graph/nodes${toQueryString(query)}`
2196
+ path: `/api/platform/v1/graph/nodes${toQueryString(query5)}`
1725
2197
  }).then(
1726
2198
  (response) => mapGatewayData(
1727
2199
  response,
@@ -1814,10 +2286,10 @@ function createGraphClient(config = {}) {
1814
2286
  /**
1815
2287
  * List graph edges matching the provided filters.
1816
2288
  */
1817
- async listEdges(query) {
2289
+ async listEdges(query5) {
1818
2290
  return gateway.request({
1819
2291
  path: `/api/platform/v1/graph/edges${toQueryString(
1820
- normalizeTopicQuery(query)
2292
+ normalizeTopicQuery(query5)
1821
2293
  )}`
1822
2294
  }).then(
1823
2295
  (response) => mapGatewayData(
@@ -1829,8 +2301,8 @@ function createGraphClient(config = {}) {
1829
2301
  /**
1830
2302
  * @deprecated Use listEdges.
1831
2303
  */
1832
- async queryEdges(query) {
1833
- return this.listEdges(query);
2304
+ async queryEdges(query5) {
2305
+ return this.listEdges(query5);
1834
2306
  },
1835
2307
  /**
1836
2308
  * Create a graph edge.
@@ -1846,9 +2318,9 @@ function createGraphClient(config = {}) {
1846
2318
  /**
1847
2319
  * Delete one or more edges matching the provided filter.
1848
2320
  */
1849
- async deleteEdge(query, idempotencyKey) {
2321
+ async deleteEdge(query5, idempotencyKey) {
1850
2322
  return gateway.request({
1851
- path: `/api/platform/v1/graph/edges${toQueryString(query)}`,
2323
+ path: `/api/platform/v1/graph/edges${toQueryString(query5)}`,
1852
2324
  method: "DELETE",
1853
2325
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1854
2326
  });
@@ -1856,26 +2328,26 @@ function createGraphClient(config = {}) {
1856
2328
  /**
1857
2329
  * Retrieve a graph neighborhood around a root node.
1858
2330
  */
1859
- async neighborhood(query) {
2331
+ async neighborhood(query5) {
1860
2332
  return gateway.request({
1861
- path: `/api/platform/v1/graph/neighborhood${toQueryString(query)}`
2333
+ path: `/api/platform/v1/graph/neighborhood${toQueryString(query5)}`
1862
2334
  });
1863
2335
  },
1864
2336
  /**
1865
2337
  * Traverse the graph from a starting node.
1866
2338
  */
1867
- async traverse(query) {
2339
+ async traverse(query5) {
1868
2340
  return gateway.request({
1869
2341
  path: "/api/platform/v1/graph/traverse",
1870
2342
  method: "POST",
1871
- body: normalizeTopicQuery(query)
2343
+ body: normalizeTopicQuery(query5)
1872
2344
  });
1873
2345
  },
1874
2346
  /**
1875
2347
  * Analyze graph structure for a topic.
1876
2348
  */
1877
- async analyze(query = {}) {
1878
- const normalized = normalizeTopicQuery(query);
2349
+ async analyze(query5 = {}) {
2350
+ const normalized = normalizeTopicQuery(query5);
1879
2351
  return gateway.request({
1880
2352
  path: `/api/platform/v1/graph/analyze${toQueryString({
1881
2353
  topicId: typeof normalized.topicId === "string" ? normalized.topicId : void 0,
@@ -1887,8 +2359,8 @@ function createGraphClient(config = {}) {
1887
2359
  /**
1888
2360
  * Detect confirmation-bias patterns for a topic graph.
1889
2361
  */
1890
- async bias(query = {}) {
1891
- const normalized = normalizeTopicQuery(query);
2362
+ async bias(query5 = {}) {
2363
+ const normalized = normalizeTopicQuery(query5);
1892
2364
  return gateway.request({
1893
2365
  path: `/api/platform/v1/graph/bias${toQueryString({
1894
2366
  topicId: typeof normalized.topicId === "string" ? normalized.topicId : void 0,
@@ -1900,8 +2372,8 @@ function createGraphClient(config = {}) {
1900
2372
  /**
1901
2373
  * Find graph gaps for beliefs that still need testing.
1902
2374
  */
1903
- async gaps(query) {
1904
- const normalized = normalizeTopicQuery(query);
2375
+ async gaps(query5) {
2376
+ const normalized = normalizeTopicQuery(query5);
1905
2377
  return gateway.request({
1906
2378
  path: `/api/platform/v1/graph/gaps${toQueryString({
1907
2379
  topicId: typeof normalized.topicId === "string" ? normalized.topicId : void 0,
@@ -1912,33 +2384,33 @@ function createGraphClient(config = {}) {
1912
2384
  /**
1913
2385
  * Search across graph resources within a topic.
1914
2386
  */
1915
- async search(query) {
2387
+ async search(query5) {
1916
2388
  return gateway.request({
1917
2389
  path: "/api/platform/v1/search",
1918
2390
  method: "POST",
1919
- body: normalizeTopicQuery(query)
2391
+ body: normalizeTopicQuery(query5)
1920
2392
  });
1921
2393
  },
1922
2394
  /**
1923
2395
  * Retrieve a graph neighborhood around a root node.
1924
2396
  */
1925
- async getNeighborhood(query) {
1926
- return this.neighborhood(query);
2397
+ async getNeighborhood(query5) {
2398
+ return this.neighborhood(query5);
1927
2399
  },
1928
2400
  /**
1929
2401
  * Retrieve the shortest known path between two graph nodes.
1930
2402
  */
1931
- async getPath(query) {
2403
+ async getPath(query5) {
1932
2404
  return gateway.request({
1933
- path: `/api/platform/v1/graph/path${toQueryString(query)}`
2405
+ path: `/api/platform/v1/graph/path${toQueryString(query5)}`
1934
2406
  });
1935
2407
  },
1936
2408
  /**
1937
2409
  * Retrieve graph analytics for the requested metric.
1938
2410
  */
1939
- async getAnalytics(query = {}) {
2411
+ async getAnalytics(query5 = {}) {
1940
2412
  return gateway.request({
1941
- path: `/api/platform/v1/graph/analytics${toQueryString(query)}`
2413
+ path: `/api/platform/v1/graph/analytics${toQueryString(query5)}`
1942
2414
  });
1943
2415
  }
1944
2416
  };
@@ -1955,6 +2427,37 @@ function createIdentityWhoamiClient(config = {}) {
1955
2427
  }
1956
2428
  };
1957
2429
  }
2430
+ var TENANT_IDENTITY_FIELDS = [
2431
+ "tenantId",
2432
+ "workspaceId",
2433
+ "principalId",
2434
+ "integrationKey",
2435
+ "secretRef",
2436
+ "policySubject",
2437
+ "policyAction",
2438
+ "policyResource",
2439
+ "decision",
2440
+ "config",
2441
+ "configKey",
2442
+ "configValue",
2443
+ "provider",
2444
+ "status",
2445
+ "metadata",
2446
+ "limit",
2447
+ "cursor"
2448
+ ];
2449
+ function tenantIdentityQuery(input) {
2450
+ return {
2451
+ tenantId: cleanRequiredString(input.tenantId, "tenantId"),
2452
+ workspaceId: input.workspaceId,
2453
+ principalId: input.principalId,
2454
+ limit: input.limit,
2455
+ cursor: input.cursor
2456
+ };
2457
+ }
2458
+ function tenantIdentityBody(input, operation) {
2459
+ return knownPayload(input, TENANT_IDENTITY_FIELDS, operation);
2460
+ }
1958
2461
  function createIdentityClient(config = {}) {
1959
2462
  const gateway = createGatewayRequestClient(config);
1960
2463
  const whoamiClient = createIdentityWhoamiClient(config);
@@ -1990,9 +2493,9 @@ function createIdentityClient(config = {}) {
1990
2493
  /**
1991
2494
  * List principals in the current identity scope.
1992
2495
  */
1993
- async listPrincipals(query = {}) {
2496
+ async listPrincipals(query5 = {}) {
1994
2497
  return gateway.request({
1995
- path: `/api/platform/v1/identity/principals${toQueryString(query)}`
2498
+ path: `/api/platform/v1/identity/principals${toQueryString(query5)}`
1996
2499
  }).then(
1997
2500
  (response) => mapGatewayData(
1998
2501
  response,
@@ -2024,9 +2527,9 @@ function createIdentityClient(config = {}) {
2024
2527
  /**
2025
2528
  * List keys in the current identity scope.
2026
2529
  */
2027
- async listKeys(query = {}) {
2530
+ async listKeys(query5 = {}) {
2028
2531
  return gateway.request({
2029
- path: `/api/platform/v1/identity/keys${toQueryString(query)}`
2532
+ path: `/api/platform/v1/identity/keys${toQueryString(query5)}`
2030
2533
  }).then(
2031
2534
  (response) => mapGatewayData(
2032
2535
  response,
@@ -2080,6 +2583,109 @@ function createIdentityClient(config = {}) {
2080
2583
  return gateway.request({
2081
2584
  path: `/api/platform/v1/identity/clerk-users${toQueryString({ q })}`
2082
2585
  });
2586
+ },
2587
+ async getTenantConfig(input) {
2588
+ return gateway.request({
2589
+ path: `/api/platform/v1/identity/tenant-config${toQueryString(
2590
+ tenantIdentityQuery(input)
2591
+ )}`
2592
+ });
2593
+ },
2594
+ async updateTenantConfig(input, idempotencyKey) {
2595
+ cleanRequiredString(input.tenantId, "tenantId");
2596
+ return gateway.request({
2597
+ path: "/api/platform/v1/identity/tenant-config",
2598
+ method: "PATCH",
2599
+ body: tenantIdentityBody(
2600
+ input,
2601
+ "identity.updateTenantConfig"
2602
+ ),
2603
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
2604
+ });
2605
+ },
2606
+ async listIntegrations(input) {
2607
+ return gateway.request({
2608
+ path: `/api/platform/v1/identity/integrations${toQueryString(
2609
+ tenantIdentityQuery(input)
2610
+ )}`
2611
+ }).then(
2612
+ (response) => mapGatewayData(
2613
+ response,
2614
+ (data) => listResultFromEnvelope(
2615
+ data,
2616
+ "integrations"
2617
+ )
2618
+ )
2619
+ );
2620
+ },
2621
+ async upsertIntegration(input, idempotencyKey) {
2622
+ cleanRequiredString(input.tenantId, "tenantId");
2623
+ cleanRequiredString(input.integrationKey, "integrationKey");
2624
+ return gateway.request({
2625
+ path: "/api/platform/v1/identity/integrations",
2626
+ method: "PUT",
2627
+ body: tenantIdentityBody(
2628
+ input,
2629
+ "identity.upsertIntegration"
2630
+ ),
2631
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
2632
+ });
2633
+ },
2634
+ async listSecrets(input) {
2635
+ return gateway.request({
2636
+ path: `/api/platform/v1/identity/secrets${toQueryString(
2637
+ tenantIdentityQuery(input)
2638
+ )}`
2639
+ }).then(
2640
+ (response) => mapGatewayData(
2641
+ response,
2642
+ (data) => listResultFromEnvelope(
2643
+ data,
2644
+ "secrets"
2645
+ )
2646
+ )
2647
+ );
2648
+ },
2649
+ async putSecretReference(input, idempotencyKey) {
2650
+ cleanRequiredString(input.tenantId, "tenantId");
2651
+ cleanRequiredString(input.secretRef, "secretRef");
2652
+ return gateway.request({
2653
+ path: "/api/platform/v1/identity/secrets",
2654
+ method: "PUT",
2655
+ body: tenantIdentityBody(
2656
+ input,
2657
+ "identity.putSecretReference"
2658
+ ),
2659
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
2660
+ });
2661
+ },
2662
+ async evaluatePolicy(input, idempotencyKey) {
2663
+ cleanRequiredString(input.tenantId, "tenantId");
2664
+ cleanRequiredString(input.policySubject, "policySubject");
2665
+ cleanRequiredString(input.policyAction, "policyAction");
2666
+ cleanRequiredString(input.policyResource, "policyResource");
2667
+ return gateway.request({
2668
+ path: "/api/platform/v1/identity/policy/evaluate",
2669
+ method: "POST",
2670
+ body: tenantIdentityBody(
2671
+ input,
2672
+ "identity.evaluatePolicy"
2673
+ ),
2674
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
2675
+ });
2676
+ },
2677
+ async recordPolicyDecision(input, idempotencyKey) {
2678
+ cleanRequiredString(input.tenantId, "tenantId");
2679
+ cleanRequiredString(input.decision, "decision");
2680
+ return gateway.request({
2681
+ path: "/api/platform/v1/identity/policy/decisions",
2682
+ method: "POST",
2683
+ body: tenantIdentityBody(
2684
+ input,
2685
+ "identity.recordPolicyDecision"
2686
+ ),
2687
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
2688
+ });
2083
2689
  }
2084
2690
  };
2085
2691
  }
@@ -2088,12 +2694,12 @@ function createIdentityClient(config = {}) {
2088
2694
  function asRecord3(value) {
2089
2695
  return value && typeof value === "object" ? value : {};
2090
2696
  }
2091
- function cleanString2(value) {
2697
+ function cleanString3(value) {
2092
2698
  return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
2093
2699
  }
2094
2700
  function normalizeTopicRecord(value) {
2095
2701
  const record = asRecord3(value);
2096
- const topicId = cleanString2(record.topicId) ?? cleanString2(record.id) ?? cleanString2(record._id);
2702
+ const topicId = cleanString3(record.topicId) ?? cleanString3(record.id) ?? cleanString3(record._id);
2097
2703
  return withTopicAlias({
2098
2704
  ...record,
2099
2705
  ...topicId ? { topicId } : {}
@@ -2105,15 +2711,15 @@ function normalizeTopicTreeNode(value) {
2105
2711
  function createTopicsClient(config = {}) {
2106
2712
  const gateway = createGatewayRequestClient(config);
2107
2713
  return {
2108
- async list(query = {}) {
2109
- const topicId = resolveTopicId(query);
2714
+ async list(query5 = {}) {
2715
+ const topicId = resolveTopicId(query5);
2110
2716
  return gateway.request({
2111
2717
  path: `/api/platform/v1/topics${toQueryString({
2112
2718
  ...topicId ? { topicId } : {},
2113
- ontologyId: query.ontologyId,
2114
- parentTopicId: query.parentTopicId,
2115
- status: query.status,
2116
- type: query.type
2719
+ ontologyId: query5.ontologyId,
2720
+ parentTopicId: query5.parentTopicId,
2721
+ status: query5.status,
2722
+ type: query5.type
2117
2723
  })}`
2118
2724
  }).then(
2119
2725
  (response) => mapGatewayData(response, (data) => {
@@ -2163,10 +2769,10 @@ function createTopicsClient(config = {}) {
2163
2769
  (response) => mapGatewayData(response, (data) => normalizeTopicRecord(data))
2164
2770
  );
2165
2771
  },
2166
- async getTree(topicId, query = {}) {
2772
+ async getTree(topicId, query5 = {}) {
2167
2773
  return gateway.request({
2168
2774
  path: `/api/platform/v1/topics/${encodeURIComponent(topicId)}/tree${toQueryString(
2169
- query
2775
+ query5
2170
2776
  )}`
2171
2777
  }).then(
2172
2778
  (response) => mapGatewayData(response, (data) => {
@@ -2177,10 +2783,10 @@ function createTopicsClient(config = {}) {
2177
2783
  })
2178
2784
  );
2179
2785
  },
2180
- async getCoverage(topicId, query = {}) {
2786
+ async getCoverage(topicId, query5 = {}) {
2181
2787
  return gateway.request({
2182
2788
  path: `/api/platform/v1/topics/${encodeURIComponent(topicId)}/coverage${toQueryString(
2183
- query
2789
+ query5
2184
2790
  )}`
2185
2791
  });
2186
2792
  },
@@ -2240,15 +2846,15 @@ function createBeliefsFacade(config = {}) {
2240
2846
  path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}`
2241
2847
  });
2242
2848
  },
2243
- async list(query) {
2849
+ async list(query5) {
2244
2850
  return gateway.request({
2245
2851
  path: `/api/platform/v1/beliefs${toQueryString({
2246
- topicId: query.topicId,
2247
- status: query.status,
2248
- worktreeId: query.worktreeId,
2249
- minConfidence: query.minConfidence,
2250
- limit: query.limit,
2251
- cursor: query.cursor
2852
+ topicId: query5.topicId,
2853
+ status: query5.status,
2854
+ worktreeId: query5.worktreeId,
2855
+ minConfidence: query5.minConfidence,
2856
+ limit: query5.limit,
2857
+ cursor: query5.cursor
2252
2858
  })}`
2253
2859
  });
2254
2860
  },
@@ -2384,13 +2990,13 @@ function createContradictionsFacade(config = {}) {
2384
2990
  idempotencyKey
2385
2991
  });
2386
2992
  },
2387
- async list(query) {
2993
+ async list(query5) {
2388
2994
  return gateway.request({
2389
2995
  path: `/api/platform/v1/contradictions${toQueryString({
2390
- topicId: query.topicId,
2391
- status: query.status,
2392
- limit: query.limit,
2393
- cursor: query.cursor
2996
+ topicId: query5.topicId,
2997
+ status: query5.status,
2998
+ limit: query5.limit,
2999
+ cursor: query5.cursor
2394
3000
  })}`
2395
3001
  });
2396
3002
  },
@@ -2412,13 +3018,13 @@ function createEdgesFacade(config = {}) {
2412
3018
  idempotencyKey
2413
3019
  });
2414
3020
  },
2415
- async list(query) {
3021
+ async list(query5) {
2416
3022
  return gateway.request({
2417
3023
  path: `/api/platform/v1/edges${toQueryString({
2418
- sourceId: query.sourceId,
2419
- edgeType: query.edgeType,
2420
- limit: query.limit,
2421
- cursor: query.cursor
3024
+ sourceId: query5.sourceId,
3025
+ edgeType: query5.edgeType,
3026
+ limit: query5.limit,
3027
+ cursor: query5.cursor
2422
3028
  })}`
2423
3029
  });
2424
3030
  },
@@ -2488,13 +3094,13 @@ function createEvidenceFacade(config = {}) {
2488
3094
  path: `/api/platform/v1/evidence/${encodeURIComponent(id)}`
2489
3095
  });
2490
3096
  },
2491
- async list(query) {
3097
+ async list(query5) {
2492
3098
  return gateway.request({
2493
3099
  path: `/api/platform/v1/evidence${toQueryString({
2494
- topicId: query.topicId,
2495
- targetId: query.targetId,
2496
- limit: query.limit,
2497
- cursor: query.cursor
3100
+ topicId: query5.topicId,
3101
+ targetId: query5.targetId,
3102
+ limit: query5.limit,
3103
+ cursor: query5.cursor
2498
3104
  })}`
2499
3105
  });
2500
3106
  },
@@ -2511,11 +3117,11 @@ function createEvidenceFacade(config = {}) {
2511
3117
  idempotencyKey
2512
3118
  });
2513
3119
  },
2514
- async search(query, idempotencyKey = randomIdempotencyKey()) {
3120
+ async search(query5, idempotencyKey = randomIdempotencyKey()) {
2515
3121
  return gateway.request({
2516
3122
  path: "/api/platform/v1/evidence/search",
2517
3123
  method: "POST",
2518
- body: query,
3124
+ body: query5,
2519
3125
  idempotencyKey
2520
3126
  });
2521
3127
  },
@@ -2564,15 +3170,15 @@ function createEvidenceFacade(config = {}) {
2564
3170
  function createEventsFacade(config = {}) {
2565
3171
  const gateway = createGatewayRequestClient(config);
2566
3172
  return {
2567
- async list(query = {}) {
3173
+ async list(query5 = {}) {
2568
3174
  return gateway.request({
2569
3175
  path: `/api/platform/v1/events${toQueryString({
2570
- topicId: query.topicId,
2571
- after: query.after,
2572
- types: serializeTypes(query.types),
2573
- startTime: query.startTime,
2574
- endTime: query.endTime,
2575
- limit: query.limit
3176
+ topicId: query5.topicId,
3177
+ after: query5.after,
3178
+ types: serializeTypes(query5.types),
3179
+ startTime: query5.startTime,
3180
+ endTime: query5.endTime,
3181
+ limit: query5.limit
2576
3182
  })}`
2577
3183
  });
2578
3184
  },
@@ -2637,8 +3243,8 @@ function createOntologiesFacade(config = {}) {
2637
3243
  path: `/api/platform/v1/ontologies/${encodeURIComponent(id)}`
2638
3244
  });
2639
3245
  },
2640
- async list(query = {}) {
2641
- return ontologyClient.list(query);
3246
+ async list(query5 = {}) {
3247
+ return ontologyClient.list(query5);
2642
3248
  },
2643
3249
  async bind(input, idempotencyKey) {
2644
3250
  return gateway.request({
@@ -2676,15 +3282,15 @@ function createQuestionsFacade(config = {}) {
2676
3282
  path: `/api/platform/v1/questions/${encodeURIComponent(id)}`
2677
3283
  });
2678
3284
  },
2679
- async list(query) {
3285
+ async list(query5) {
2680
3286
  return gateway.request({
2681
3287
  path: `/api/platform/v1/questions${toQueryString({
2682
- topicId: query.topicId,
2683
- status: query.status,
2684
- priority: query.priority,
2685
- worktreeId: query.worktreeId,
2686
- limit: query.limit,
2687
- cursor: query.cursor
3288
+ topicId: query5.topicId,
3289
+ status: query5.status,
3290
+ priority: query5.priority,
3291
+ worktreeId: query5.worktreeId,
3292
+ limit: query5.limit,
3293
+ cursor: query5.cursor
2688
3294
  })}`
2689
3295
  });
2690
3296
  },
@@ -2836,13 +3442,13 @@ function createTasksFacade(config = {}) {
2836
3442
  idempotencyKey
2837
3443
  });
2838
3444
  },
2839
- async list(query) {
3445
+ async list(query5) {
2840
3446
  return gateway.request({
2841
3447
  path: `/api/platform/v1/tasks${toQueryString({
2842
- topicId: query.topicId,
2843
- worktreeId: query.worktreeId,
2844
- status: query.status,
2845
- limit: query.limit
3448
+ topicId: query5.topicId,
3449
+ worktreeId: query5.worktreeId,
3450
+ status: query5.status,
3451
+ limit: query5.limit
2846
3452
  })}`
2847
3453
  });
2848
3454
  }
@@ -2857,8 +3463,8 @@ function createTopicsFacade(config = {}) {
2857
3463
  async get(id) {
2858
3464
  return topicsClient.get(id);
2859
3465
  },
2860
- async list(query = {}) {
2861
- return topicsClient.list(query);
3466
+ async list(query5 = {}) {
3467
+ return topicsClient.list(query5);
2862
3468
  },
2863
3469
  async update(input, idempotencyKey) {
2864
3470
  const { id, ...rest } = input;
@@ -2894,10 +3500,10 @@ function createWebhooksFacade(config = {}) {
2894
3500
  idempotencyKey
2895
3501
  });
2896
3502
  },
2897
- async list(query = {}) {
3503
+ async list(query5 = {}) {
2898
3504
  return gateway.request({
2899
3505
  path: `/api/platform/v1/webhooks${toQueryString({
2900
- topicId: query.topicId
3506
+ topicId: query5.topicId
2901
3507
  })}`
2902
3508
  });
2903
3509
  },
@@ -2929,10 +3535,10 @@ function createWebhooksFacade(config = {}) {
2929
3535
  idempotencyKey
2930
3536
  });
2931
3537
  },
2932
- async deliveries(id, query = {}) {
3538
+ async deliveries(id, query5 = {}) {
2933
3539
  return gateway.request({
2934
3540
  path: `/api/platform/v1/webhooks/${encodeURIComponent(id)}/deliveries${toQueryString({
2935
- limit: query.limit
3541
+ limit: query5.limit
2936
3542
  })}`
2937
3543
  });
2938
3544
  },
@@ -2954,24 +3560,24 @@ function createWorktreesFacade(config = {}) {
2954
3560
  idempotencyKey
2955
3561
  });
2956
3562
  },
2957
- async list(query) {
3563
+ async list(query5) {
2958
3564
  return gateway.request({
2959
3565
  path: `/api/platform/v1/worktrees${toQueryString({
2960
- topicId: query.topicId,
2961
- status: query.status,
2962
- groupBy: query.groupBy,
2963
- lane: query.lane,
2964
- campaign: query.campaign,
2965
- limit: query.limit
3566
+ topicId: query5.topicId,
3567
+ status: query5.status,
3568
+ groupBy: query5.groupBy,
3569
+ lane: query5.lane,
3570
+ campaign: query5.campaign,
3571
+ limit: query5.limit
2966
3572
  })}`
2967
3573
  });
2968
3574
  },
2969
- async listCampaigns(query = {}) {
3575
+ async listCampaigns(query5 = {}) {
2970
3576
  return gateway.request({
2971
3577
  path: `/api/platform/v1/worktrees/campaigns${toQueryString({
2972
- topicId: query.topicId,
2973
- status: query.status,
2974
- limit: query.limit
3578
+ topicId: query5.topicId,
3579
+ status: query5.status,
3580
+ limit: query5.limit
2975
3581
  })}`
2976
3582
  });
2977
3583
  },
@@ -3084,12 +3690,12 @@ function createDecisionsClient(config = {}) {
3084
3690
  /**
3085
3691
  * List judgments for a topic scope.
3086
3692
  */
3087
- async listJudgments(query) {
3693
+ async listJudgments(query5) {
3088
3694
  return gateway.request({
3089
3695
  path: `/api/platform/v1/graph/judgments${toQueryString({
3090
- ...normalizeTopicQuery(query),
3091
- includeArchived: typeof query.includeArchived === "boolean" ? query.includeArchived ? "true" : "false" : void 0,
3092
- limit: query.limit
3696
+ ...normalizeTopicQuery(query5),
3697
+ includeArchived: typeof query5.includeArchived === "boolean" ? query5.includeArchived ? "true" : "false" : void 0,
3698
+ limit: query5.limit
3093
3699
  })}`
3094
3700
  }).then(
3095
3701
  (response) => mapGatewayData(response, (data) => {
@@ -3121,30 +3727,30 @@ function createDecisionsClient(config = {}) {
3121
3727
  /**
3122
3728
  * Get readiness signals for creating a judgment.
3123
3729
  */
3124
- async getJudgmentReadiness(query) {
3730
+ async getJudgmentReadiness(query5) {
3125
3731
  return gateway.request({
3126
3732
  path: `/api/platform/v1/graph/judgments/readiness${toQueryString(
3127
- normalizeTopicQuery(query)
3733
+ normalizeTopicQuery(query5)
3128
3734
  )}`
3129
3735
  });
3130
3736
  },
3131
3737
  /**
3132
3738
  * Get calibration analytics for judgment outcomes.
3133
3739
  */
3134
- async getJudgmentCalibration(query) {
3740
+ async getJudgmentCalibration(query5) {
3135
3741
  return gateway.request({
3136
3742
  path: `/api/platform/v1/graph/judgments/calibration${toQueryString(
3137
- normalizeTopicQuery(query)
3743
+ normalizeTopicQuery(query5)
3138
3744
  )}`
3139
3745
  });
3140
3746
  },
3141
3747
  /**
3142
3748
  * List judgments still awaiting outcome review.
3143
3749
  */
3144
- async listPendingOutcomeReviews(query) {
3750
+ async listPendingOutcomeReviews(query5) {
3145
3751
  return gateway.request({
3146
3752
  path: `/api/platform/v1/graph/judgments/pending-outcome-review${toQueryString(
3147
- normalizeTopicQuery(query)
3753
+ normalizeTopicQuery(query5)
3148
3754
  )}`
3149
3755
  }).then(
3150
3756
  (response) => mapGatewayData(response, (data) => {
@@ -3161,19 +3767,19 @@ function createDecisionsClient(config = {}) {
3161
3767
  /**
3162
3768
  * @deprecated Use listPendingOutcomeReviews.
3163
3769
  */
3164
- async listPendingJudgmentOutcomeReview(query) {
3165
- return this.listPendingOutcomeReviews(query);
3770
+ async listPendingJudgmentOutcomeReview(query5) {
3771
+ return this.listPendingOutcomeReviews(query5);
3166
3772
  },
3167
3773
  /**
3168
3774
  * Get audit integrity checks for judgment transitions.
3169
3775
  */
3170
- async getJudgmentTransitionAuditIntegrity(query) {
3776
+ async getJudgmentTransitionAuditIntegrity(query5) {
3171
3777
  return gateway.request({
3172
3778
  path: `/api/platform/v1/graph/judgments/transition-audit-integrity${toQueryString(
3173
3779
  {
3174
- ...normalizeTopicQuery(query),
3175
- judgmentId: query.judgmentId,
3176
- includePassing: typeof query.includePassing === "boolean" ? query.includePassing ? "true" : "false" : void 0
3780
+ ...normalizeTopicQuery(query5),
3781
+ judgmentId: query5.judgmentId,
3782
+ includePassing: typeof query5.includePassing === "boolean" ? query5.includePassing ? "true" : "false" : void 0
3177
3783
  }
3178
3784
  )}`
3179
3785
  });
@@ -3222,58 +3828,170 @@ function createDecisionsClient(config = {}) {
3222
3828
  };
3223
3829
  }
3224
3830
 
3225
- // src/contextClient.ts
3226
- function cleanString3(value) {
3227
- return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
3228
- }
3229
- function cleanNumber(value) {
3230
- return typeof value === "number" && Number.isFinite(value) ? value : void 0;
3831
+ // src/embeddingsClient.ts
3832
+ var EMBEDDINGS_FIELDS = [
3833
+ "topicId",
3834
+ "projectId",
3835
+ "workspaceId",
3836
+ "nodeIds",
3837
+ "nodeType",
3838
+ "embeddingModel",
3839
+ "queryText",
3840
+ "queryVector",
3841
+ "minScore",
3842
+ "limit",
3843
+ "cursor",
3844
+ "metadata"
3845
+ ];
3846
+ function assertNodeIds(nodeIds) {
3847
+ if (!Array.isArray(nodeIds) || nodeIds.length === 0) {
3848
+ throw new Error("nodeIds is required");
3849
+ }
3231
3850
  }
3232
- function cleanBoolean(value) {
3233
- return typeof value === "boolean" ? value : void 0;
3851
+ function missingQuery(input) {
3852
+ return {
3853
+ topicId: requireTopicId(input),
3854
+ workspaceId: cleanRequiredString(input.workspaceId, "workspaceId"),
3855
+ nodeType: input.nodeType,
3856
+ embeddingModel: input.embeddingModel,
3857
+ limit: input.limit,
3858
+ cursor: input.cursor
3859
+ };
3234
3860
  }
3235
- function buildCompileContextRequest(topicId, input = {}) {
3236
- const payload = { topicId };
3237
- const query = cleanString3(input.query);
3238
- if (query) {
3239
- payload.query = query;
3240
- }
3241
- const budget = cleanNumber(input.budget) ?? cleanNumber(input.tokenBudget);
3242
- if (budget !== void 0) {
3243
- payload.budget = budget;
3244
- }
3245
- const ranking = cleanString3(input.ranking) ?? cleanString3(input.rankingProfile);
3246
- if (ranking) {
3247
- payload.ranking = ranking;
3248
- }
3249
- const limit = cleanNumber(input.limit);
3250
- if (limit !== void 0) {
3251
- payload.limit = limit;
3252
- }
3253
- const maxDepth = cleanNumber(input.maxDepth);
3254
- if (maxDepth !== void 0) {
3255
- payload.maxDepth = maxDepth;
3256
- }
3257
- const includeEntities = cleanBoolean(input.includeEntities);
3258
- if (includeEntities !== void 0) {
3259
- payload.includeEntities = includeEntities;
3260
- }
3261
- const mode = cleanString3(input.mode);
3262
- if (mode) {
3263
- payload.mode = mode;
3264
- }
3265
- const includeFailures = cleanBoolean(input.includeFailures);
3266
- if (includeFailures !== void 0) {
3267
- payload.includeFailures = includeFailures;
3268
- }
3269
- const worktreeId = cleanString3(input.worktreeId);
3270
- if (worktreeId) {
3271
- payload.worktreeId = worktreeId;
3272
- }
3273
- const sessionId = cleanString3(input.sessionId);
3274
- if (sessionId) {
3275
- payload.sessionId = sessionId;
3276
- }
3861
+ function createEmbeddingsClient(config = {}) {
3862
+ const gateway = createGatewayRequestClient(config);
3863
+ return {
3864
+ getByNodeIds(input) {
3865
+ assertNodeIds(input.nodeIds);
3866
+ return gateway.request({
3867
+ path: "/api/platform/v1/embeddings/by-node-ids",
3868
+ method: "POST",
3869
+ body: topicPayload(
3870
+ {
3871
+ ...input,
3872
+ workspaceId: cleanRequiredString(input.workspaceId, "workspaceId")
3873
+ },
3874
+ EMBEDDINGS_FIELDS,
3875
+ "embeddings.getByNodeIds"
3876
+ )
3877
+ }).then(
3878
+ (response) => mapGatewayData(
3879
+ response,
3880
+ (data) => listResultFromEnvelope(
3881
+ data,
3882
+ "embeddings"
3883
+ )
3884
+ )
3885
+ );
3886
+ },
3887
+ listMissingForTopic(input) {
3888
+ return gateway.request({
3889
+ path: `/api/platform/v1/embeddings/missing${toQueryString(
3890
+ missingQuery(input)
3891
+ )}`
3892
+ }).then(
3893
+ (response) => mapGatewayData(
3894
+ response,
3895
+ (data) => listResultFromEnvelope(
3896
+ data,
3897
+ "nodes"
3898
+ )
3899
+ )
3900
+ );
3901
+ },
3902
+ vectorSearchByTopic(input) {
3903
+ if (!input.queryText && !input.queryVector) {
3904
+ throw new Error("queryText or queryVector is required");
3905
+ }
3906
+ return gateway.request({
3907
+ path: "/api/platform/v1/embeddings/vector-search",
3908
+ method: "POST",
3909
+ body: topicPayload(
3910
+ {
3911
+ ...input,
3912
+ workspaceId: cleanRequiredString(input.workspaceId, "workspaceId")
3913
+ },
3914
+ EMBEDDINGS_FIELDS,
3915
+ "embeddings.vectorSearchByTopic"
3916
+ )
3917
+ }).then(
3918
+ (response) => mapGatewayData(
3919
+ response,
3920
+ (data) => listResultFromEnvelope(data, "results")
3921
+ )
3922
+ );
3923
+ },
3924
+ markEmbeddingBackfillQueued(input, idempotencyKey) {
3925
+ assertNodeIds(input.nodeIds);
3926
+ return gateway.request({
3927
+ path: "/api/platform/v1/embeddings/backfill-queued",
3928
+ method: "POST",
3929
+ body: topicPayload(
3930
+ {
3931
+ ...input,
3932
+ workspaceId: cleanRequiredString(input.workspaceId, "workspaceId")
3933
+ },
3934
+ EMBEDDINGS_FIELDS,
3935
+ "embeddings.markEmbeddingBackfillQueued"
3936
+ ),
3937
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
3938
+ });
3939
+ }
3940
+ };
3941
+ }
3942
+
3943
+ // src/contextClient.ts
3944
+ function cleanString4(value) {
3945
+ return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
3946
+ }
3947
+ function cleanNumber(value) {
3948
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
3949
+ }
3950
+ function cleanBoolean(value) {
3951
+ return typeof value === "boolean" ? value : void 0;
3952
+ }
3953
+ function buildCompileContextRequest(topicId, input = {}) {
3954
+ const payload = { topicId };
3955
+ const query5 = cleanString4(input.query);
3956
+ if (query5) {
3957
+ payload.query = query5;
3958
+ }
3959
+ const budget = cleanNumber(input.budget) ?? cleanNumber(input.tokenBudget);
3960
+ if (budget !== void 0) {
3961
+ payload.budget = budget;
3962
+ }
3963
+ const ranking = cleanString4(input.ranking) ?? cleanString4(input.rankingProfile);
3964
+ if (ranking) {
3965
+ payload.ranking = ranking;
3966
+ }
3967
+ const limit = cleanNumber(input.limit);
3968
+ if (limit !== void 0) {
3969
+ payload.limit = limit;
3970
+ }
3971
+ const maxDepth = cleanNumber(input.maxDepth);
3972
+ if (maxDepth !== void 0) {
3973
+ payload.maxDepth = maxDepth;
3974
+ }
3975
+ const includeEntities = cleanBoolean(input.includeEntities);
3976
+ if (includeEntities !== void 0) {
3977
+ payload.includeEntities = includeEntities;
3978
+ }
3979
+ const mode = cleanString4(input.mode);
3980
+ if (mode) {
3981
+ payload.mode = mode;
3982
+ }
3983
+ const includeFailures = cleanBoolean(input.includeFailures);
3984
+ if (includeFailures !== void 0) {
3985
+ payload.includeFailures = includeFailures;
3986
+ }
3987
+ const worktreeId = cleanString4(input.worktreeId);
3988
+ if (worktreeId) {
3989
+ payload.worktreeId = worktreeId;
3990
+ }
3991
+ const sessionId = cleanString4(input.sessionId);
3992
+ if (sessionId) {
3993
+ payload.sessionId = sessionId;
3994
+ }
3277
3995
  if (Array.isArray(input.packWeightOverrides) && input.packWeightOverrides.length > 0) {
3278
3996
  payload.packWeightOverrides = input.packWeightOverrides;
3279
3997
  }
@@ -3302,6 +4020,408 @@ function createContextClient(config = {}) {
3302
4020
  };
3303
4021
  }
3304
4022
 
4023
+ // src/graphAnalysisClient.ts
4024
+ var GRAPH_ANALYSIS_ANALYSIS_FIELDS = [
4025
+ "topicId",
4026
+ "projectId",
4027
+ "workspaceId",
4028
+ "analysisType",
4029
+ "healthScore",
4030
+ "findings",
4031
+ "suggestions",
4032
+ "sourceNodeIds",
4033
+ "sourceEdgeIds",
4034
+ "detectorVersions",
4035
+ "metadata"
4036
+ ];
4037
+ var GRAPH_ANALYSIS_SUGGESTION_FIELDS = [
4038
+ "topicId",
4039
+ "projectId",
4040
+ "workspaceId",
4041
+ "analysisId",
4042
+ "suggestions",
4043
+ "metadata"
4044
+ ];
4045
+ var GRAPH_ANALYSIS_COMPUTE_FIELDS = [
4046
+ "topicId",
4047
+ "projectId",
4048
+ "workspaceId",
4049
+ "analysisType",
4050
+ "sourceNodeIds",
4051
+ "sourceEdgeIds",
4052
+ "detectorVersions",
4053
+ "metadata"
4054
+ ];
4055
+ function readTopicId2(input) {
4056
+ return input.topicId?.trim() || input.projectId?.trim() || void 0;
4057
+ }
4058
+ function requireTopicId2(input) {
4059
+ const topicId = readTopicId2(input);
4060
+ if (!topicId) {
4061
+ throw new Error("topicId is required");
4062
+ }
4063
+ return topicId;
4064
+ }
4065
+ function assertKnownKeys2(input, allowed, operation) {
4066
+ const allowedSet = new Set(allowed);
4067
+ const unknownKeys = Object.keys(input).filter((key) => !allowedSet.has(key));
4068
+ if (unknownKeys.length > 0) {
4069
+ throw new Error(
4070
+ `${operation} received unsupported field(s): ${unknownKeys.join(", ")}`
4071
+ );
4072
+ }
4073
+ }
4074
+ function normalizeAnalysisPayload(input) {
4075
+ assertKnownKeys2(
4076
+ input,
4077
+ GRAPH_ANALYSIS_ANALYSIS_FIELDS,
4078
+ "graphAnalysis.saveAnalysis"
4079
+ );
4080
+ return {
4081
+ ...input,
4082
+ topicId: requireTopicId2(input),
4083
+ projectId: void 0
4084
+ };
4085
+ }
4086
+ function normalizeSuggestionPayload(input) {
4087
+ assertKnownKeys2(
4088
+ input,
4089
+ GRAPH_ANALYSIS_SUGGESTION_FIELDS,
4090
+ "graphAnalysis.saveSuggestions"
4091
+ );
4092
+ return {
4093
+ ...input,
4094
+ topicId: requireTopicId2(input),
4095
+ projectId: void 0
4096
+ };
4097
+ }
4098
+ function normalizeComputePayload(input) {
4099
+ assertKnownKeys2(
4100
+ input,
4101
+ GRAPH_ANALYSIS_COMPUTE_FIELDS,
4102
+ "graphAnalysis.computeOrRequestAnalysis"
4103
+ );
4104
+ return {
4105
+ ...input,
4106
+ topicId: requireTopicId2(input),
4107
+ projectId: void 0
4108
+ };
4109
+ }
4110
+ function graphAnalysisQuery(input) {
4111
+ return {
4112
+ topicId: requireTopicId2(input),
4113
+ workspaceId: input.workspaceId,
4114
+ analysisType: input.analysisType,
4115
+ limit: input.limit,
4116
+ cursor: input.cursor
4117
+ };
4118
+ }
4119
+ function createGraphAnalysisClient(config = {}) {
4120
+ const gateway = createGatewayRequestClient(config);
4121
+ return {
4122
+ saveAnalysis(input, idempotencyKey) {
4123
+ return gateway.request({
4124
+ path: "/api/platform/v1/graph-analysis/analyses",
4125
+ method: "POST",
4126
+ body: normalizeAnalysisPayload(input),
4127
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4128
+ });
4129
+ },
4130
+ listAnalyses(input) {
4131
+ return gateway.request({
4132
+ path: `/api/platform/v1/graph-analysis/analyses${toQueryString(
4133
+ graphAnalysisQuery(input)
4134
+ )}`
4135
+ }).then(
4136
+ (response) => mapGatewayData(
4137
+ response,
4138
+ (data) => createListResult(
4139
+ Array.isArray(data.analyses) ? data.analyses : Array.isArray(data) ? data : [],
4140
+ "analyses"
4141
+ )
4142
+ )
4143
+ );
4144
+ },
4145
+ getLatestAnalysis(input) {
4146
+ return gateway.request({
4147
+ path: `/api/platform/v1/graph-analysis/analyses/latest${toQueryString({
4148
+ topicId: requireTopicId2(input),
4149
+ workspaceId: input.workspaceId,
4150
+ analysisType: input.analysisType
4151
+ })}`
4152
+ });
4153
+ },
4154
+ saveSuggestions(input, idempotencyKey) {
4155
+ return gateway.request({
4156
+ path: "/api/platform/v1/graph-analysis/suggestions",
4157
+ method: "POST",
4158
+ body: normalizeSuggestionPayload(input),
4159
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4160
+ });
4161
+ },
4162
+ updateSuggestionStatus(input, idempotencyKey) {
4163
+ return gateway.request({
4164
+ path: `/api/platform/v1/graph-analysis/suggestions/${encodeURIComponent(
4165
+ input.suggestionId
4166
+ )}`,
4167
+ method: "PATCH",
4168
+ body: {
4169
+ status: input.status,
4170
+ rationale: input.rationale,
4171
+ metadata: input.metadata
4172
+ },
4173
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4174
+ });
4175
+ },
4176
+ listSuggestions(input) {
4177
+ return gateway.request({
4178
+ path: `/api/platform/v1/graph-analysis/suggestions${toQueryString({
4179
+ topicId: requireTopicId2(input),
4180
+ workspaceId: input.workspaceId,
4181
+ analysisId: input.analysisId,
4182
+ findingId: input.findingId,
4183
+ status: input.status,
4184
+ limit: input.limit,
4185
+ cursor: input.cursor
4186
+ })}`
4187
+ }).then(
4188
+ (response) => mapGatewayData(
4189
+ response,
4190
+ (data) => createListResult(
4191
+ Array.isArray(data.suggestions) ? data.suggestions : Array.isArray(data) ? data : [],
4192
+ "suggestions"
4193
+ )
4194
+ )
4195
+ );
4196
+ },
4197
+ listGraphChanges(input) {
4198
+ return gateway.request({
4199
+ path: `/api/platform/v1/graph-analysis/changes${toQueryString({
4200
+ topicId: requireTopicId2(input),
4201
+ workspaceId: input.workspaceId,
4202
+ analysisId: input.analysisId,
4203
+ minimumCreatedAt: input.minimumCreatedAt ?? input.since ?? input.createdAt ?? input.analysisCreatedAt,
4204
+ sourceNodeIds: input.sourceNodeIds?.join(",") ?? (input.nodeId ? input.nodeId : void 0),
4205
+ sourceEdgeIds: input.sourceEdgeIds?.join(",") ?? (input.edgeId ? input.edgeId : void 0),
4206
+ limit: input.limit,
4207
+ cursor: input.cursor
4208
+ })}`
4209
+ }).then(
4210
+ (response) => mapGatewayData(
4211
+ response,
4212
+ (data) => createListResult(
4213
+ Array.isArray(data.changes) ? data.changes : Array.isArray(data) ? data : [],
4214
+ "changes"
4215
+ )
4216
+ )
4217
+ );
4218
+ },
4219
+ computeOrRequestAnalysis(input, idempotencyKey) {
4220
+ return gateway.request({
4221
+ path: "/api/platform/v1/graph-analysis/compute",
4222
+ method: "POST",
4223
+ body: normalizeComputePayload(input),
4224
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4225
+ });
4226
+ }
4227
+ };
4228
+ }
4229
+
4230
+ // src/graphRecommendationsClient.ts
4231
+ var GRAPH_RECOMMENDATION_FIELDS = [
4232
+ "topicId",
4233
+ "projectId",
4234
+ "workspaceId",
4235
+ "limit",
4236
+ "cursor",
4237
+ "status",
4238
+ "findingId",
4239
+ "actionType",
4240
+ "targetNodeIds",
4241
+ "priority",
4242
+ "rationale",
4243
+ "healthScore",
4244
+ "metadata"
4245
+ ];
4246
+ function readTopicId3(input) {
4247
+ return input.topicId?.trim() || input.projectId?.trim() || void 0;
4248
+ }
4249
+ function requireTopicId3(input) {
4250
+ const topicId = readTopicId3(input);
4251
+ if (!topicId) {
4252
+ throw new Error("topicId is required");
4253
+ }
4254
+ return topicId;
4255
+ }
4256
+ function assertKnownKeys3(input, operation) {
4257
+ const allowed = new Set(GRAPH_RECOMMENDATION_FIELDS);
4258
+ const unknownKeys = Object.keys(input).filter((key) => !allowed.has(key));
4259
+ if (unknownKeys.length > 0) {
4260
+ throw new Error(
4261
+ `${operation} received unsupported field(s): ${unknownKeys.join(", ")}`
4262
+ );
4263
+ }
4264
+ }
4265
+ function listQuery(input) {
4266
+ assertKnownKeys3(
4267
+ input,
4268
+ "graphRecommendations.listForTopic"
4269
+ );
4270
+ return {
4271
+ workspaceId: input.workspaceId,
4272
+ topicId: requireTopicId3(input),
4273
+ limit: input.limit,
4274
+ cursor: input.cursor,
4275
+ status: input.status,
4276
+ findingId: input.findingId,
4277
+ actionType: input.actionType,
4278
+ priority: input.priority,
4279
+ targetNodeIds: input.targetNodeIds?.join(","),
4280
+ healthScore: input.healthScore
4281
+ };
4282
+ }
4283
+ function createGraphRecommendationsClient(config = {}) {
4284
+ const gateway = createGatewayRequestClient(config);
4285
+ return {
4286
+ listForTopic(input) {
4287
+ return gateway.request({
4288
+ path: `/api/platform/v1/graph-recommendations${toQueryString(
4289
+ listQuery(input)
4290
+ )}`
4291
+ }).then(
4292
+ (response) => mapGatewayData(
4293
+ response,
4294
+ (data) => createListResult(
4295
+ Array.isArray(
4296
+ data.recommendations
4297
+ ) ? data.recommendations : Array.isArray(data) ? data : [],
4298
+ "recommendations"
4299
+ )
4300
+ )
4301
+ );
4302
+ },
4303
+ getRecommendation(recommendationId) {
4304
+ return gateway.request({
4305
+ path: `/api/platform/v1/graph-recommendations/${encodeURIComponent(
4306
+ recommendationId
4307
+ )}`
4308
+ });
4309
+ },
4310
+ markRecommendationStatus(input, idempotencyKey) {
4311
+ return gateway.request({
4312
+ path: `/api/platform/v1/graph-recommendations/${encodeURIComponent(
4313
+ input.recommendationId
4314
+ )}/status`,
4315
+ method: "PATCH",
4316
+ body: {
4317
+ status: input.status,
4318
+ rationale: input.rationale,
4319
+ metadata: input.metadata
4320
+ },
4321
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4322
+ });
4323
+ }
4324
+ };
4325
+ }
4326
+
4327
+ // src/graphStateClassifierClient.ts
4328
+ var GRAPH_STATE_CLASSIFIER_FIELDS = [
4329
+ "topicId",
4330
+ "projectId",
4331
+ "workspaceId",
4332
+ "nodeId",
4333
+ "epistemicStatus",
4334
+ "beliefMaturity",
4335
+ "answerQuality",
4336
+ "evidenceNetwork",
4337
+ "logicalRole",
4338
+ "questionPriority",
4339
+ "layer",
4340
+ "modelVersion",
4341
+ "limit",
4342
+ "cursor",
4343
+ "metadata"
4344
+ ];
4345
+ function normalizeRecordPayload(input) {
4346
+ cleanRequiredString(input.workspaceId, "workspaceId");
4347
+ cleanRequiredString(input.nodeId, "nodeId");
4348
+ return topicPayload(
4349
+ input,
4350
+ GRAPH_STATE_CLASSIFIER_FIELDS,
4351
+ "graphStateClassifier.recordClassification"
4352
+ );
4353
+ }
4354
+ function createGraphStateClassifierClient(config = {}) {
4355
+ const gateway = createGatewayRequestClient(config);
4356
+ return {
4357
+ classifyNode(input, idempotencyKey) {
4358
+ cleanRequiredString(input.workspaceId, "workspaceId");
4359
+ cleanRequiredString(input.nodeId, "nodeId");
4360
+ return gateway.request({
4361
+ path: "/api/platform/v1/graph-state-classifier/classify-node",
4362
+ method: "POST",
4363
+ body: topicPayload(
4364
+ input,
4365
+ GRAPH_STATE_CLASSIFIER_FIELDS,
4366
+ "graphStateClassifier.classifyNode"
4367
+ ),
4368
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4369
+ });
4370
+ },
4371
+ classifyTopic(input, idempotencyKey) {
4372
+ cleanRequiredString(input.workspaceId, "workspaceId");
4373
+ return gateway.request({
4374
+ path: "/api/platform/v1/graph-state-classifier/classify-topic",
4375
+ method: "POST",
4376
+ body: topicPayload(
4377
+ input,
4378
+ GRAPH_STATE_CLASSIFIER_FIELDS,
4379
+ "graphStateClassifier.classifyTopic"
4380
+ ),
4381
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4382
+ }).then(
4383
+ (response) => mapGatewayData(
4384
+ response,
4385
+ (data) => listResultFromEnvelope(
4386
+ data,
4387
+ "classifications"
4388
+ )
4389
+ )
4390
+ );
4391
+ },
4392
+ listClassifications(input) {
4393
+ return gateway.request({
4394
+ path: `/api/platform/v1/graph-state-classifier/classifications${toQueryString({
4395
+ topicId: requireTopicId(input),
4396
+ workspaceId: input.workspaceId,
4397
+ nodeId: input.nodeId,
4398
+ modelVersion: input.modelVersion,
4399
+ layer: input.layer,
4400
+ epistemicStatus: input.epistemicStatus,
4401
+ limit: input.limit,
4402
+ cursor: input.cursor
4403
+ })}`
4404
+ }).then(
4405
+ (response) => mapGatewayData(
4406
+ response,
4407
+ (data) => listResultFromEnvelope(
4408
+ data,
4409
+ "classifications"
4410
+ )
4411
+ )
4412
+ );
4413
+ },
4414
+ recordClassification(input, idempotencyKey) {
4415
+ return gateway.request({
4416
+ path: "/api/platform/v1/graph-state-classifier/classifications",
4417
+ method: "POST",
4418
+ body: normalizeRecordPayload(input),
4419
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4420
+ });
4421
+ }
4422
+ };
4423
+ }
4424
+
3305
4425
  // src/harnessClient.ts
3306
4426
  function createHarnessClient(config = {}) {
3307
4427
  const gateway = createGatewayRequestClient(config);
@@ -3521,9 +4641,9 @@ function createHarnessClient(config = {}) {
3521
4641
  /**
3522
4642
  * List prompt resolutions.
3523
4643
  */
3524
- async listPromptResolutions(query = {}) {
4644
+ async listPromptResolutions(query5 = {}) {
3525
4645
  return gateway.request({
3526
- path: `/api/platform/v1/harness/prompts${toQueryString(query)}`
4646
+ path: `/api/platform/v1/harness/prompts${toQueryString(query5)}`
3527
4647
  }).then(
3528
4648
  (response) => mapGatewayData(
3529
4649
  response,
@@ -3542,6 +4662,128 @@ function createHarnessClient(config = {}) {
3542
4662
  };
3543
4663
  }
3544
4664
 
4665
+ // src/jobsClient.ts
4666
+ var JOBS_FIELDS = [
4667
+ "tenantId",
4668
+ "workspaceId",
4669
+ "principalId",
4670
+ "topicId",
4671
+ "worktreeId",
4672
+ "jobId",
4673
+ "jobType",
4674
+ "payload",
4675
+ "status",
4676
+ "attempt",
4677
+ "runId",
4678
+ "queue",
4679
+ "priority",
4680
+ "error",
4681
+ "metadata",
4682
+ "limit",
4683
+ "cursor"
4684
+ ];
4685
+ function query2(input) {
4686
+ return {
4687
+ tenantId: cleanRequiredString(input.tenantId, "tenantId"),
4688
+ workspaceId: input.workspaceId,
4689
+ principalId: input.principalId,
4690
+ topicId: input.topicId,
4691
+ worktreeId: input.worktreeId,
4692
+ jobType: input.jobType,
4693
+ status: input.status,
4694
+ queue: input.queue,
4695
+ limit: input.limit,
4696
+ cursor: input.cursor
4697
+ };
4698
+ }
4699
+ function body2(input, operation) {
4700
+ return knownPayload(input, JOBS_FIELDS, operation);
4701
+ }
4702
+ function createJobsClient(config = {}) {
4703
+ const gateway = createGatewayRequestClient(config);
4704
+ return {
4705
+ enqueue(input, idempotencyKey) {
4706
+ cleanRequiredString(input.tenantId, "tenantId");
4707
+ cleanRequiredString(input.jobType, "jobType");
4708
+ return gateway.request({
4709
+ path: "/api/platform/v1/jobs",
4710
+ method: "POST",
4711
+ body: body2(input, "jobs.enqueue"),
4712
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4713
+ });
4714
+ },
4715
+ list(input) {
4716
+ return gateway.request({
4717
+ path: `/api/platform/v1/jobs${toQueryString(query2(input))}`
4718
+ }).then(
4719
+ (response) => mapGatewayData(
4720
+ response,
4721
+ (data) => listResultFromEnvelope(data, "jobs")
4722
+ )
4723
+ );
4724
+ },
4725
+ claim(input, idempotencyKey) {
4726
+ cleanRequiredString(input.tenantId, "tenantId");
4727
+ return gateway.request({
4728
+ path: "/api/platform/v1/jobs/claim",
4729
+ method: "POST",
4730
+ body: body2(input, "jobs.claim"),
4731
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4732
+ });
4733
+ },
4734
+ updateStatus(input, idempotencyKey) {
4735
+ cleanRequiredString(input.tenantId, "tenantId");
4736
+ cleanRequiredString(input.jobId, "jobId");
4737
+ return gateway.request({
4738
+ path: `/api/platform/v1/jobs/${encodeURIComponent(input.jobId)}/status`,
4739
+ method: "PATCH",
4740
+ body: body2(
4741
+ input,
4742
+ "jobs.updateStatus"
4743
+ ),
4744
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4745
+ });
4746
+ },
4747
+ retry(input, idempotencyKey) {
4748
+ cleanRequiredString(input.tenantId, "tenantId");
4749
+ cleanRequiredString(input.jobId, "jobId");
4750
+ return gateway.request({
4751
+ path: `/api/platform/v1/jobs/${encodeURIComponent(input.jobId)}/retry`,
4752
+ method: "POST",
4753
+ body: body2(input, "jobs.retry"),
4754
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4755
+ });
4756
+ },
4757
+ recordRunStart(input, idempotencyKey) {
4758
+ cleanRequiredString(input.tenantId, "tenantId");
4759
+ return gateway.request({
4760
+ path: "/api/platform/v1/jobs/runs/start",
4761
+ method: "POST",
4762
+ body: body2(
4763
+ input,
4764
+ "jobs.recordRunStart"
4765
+ ),
4766
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4767
+ });
4768
+ },
4769
+ recordRunFinish(input, idempotencyKey) {
4770
+ cleanRequiredString(input.tenantId, "tenantId");
4771
+ cleanRequiredString(input.runId, "runId");
4772
+ return gateway.request({
4773
+ path: `/api/platform/v1/jobs/runs/${encodeURIComponent(
4774
+ input.runId
4775
+ )}/finish`,
4776
+ method: "POST",
4777
+ body: body2(
4778
+ input,
4779
+ "jobs.recordRunFinish"
4780
+ ),
4781
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4782
+ });
4783
+ }
4784
+ };
4785
+ }
4786
+
3545
4787
  // src/learningClient.ts
3546
4788
  function createLearningClient(config = {}) {
3547
4789
  const gateway = createGatewayRequestClient(config);
@@ -3586,6 +4828,122 @@ function createLearningClient(config = {}) {
3586
4828
  }
3587
4829
  };
3588
4830
  }
4831
+ function toJsonValue(value) {
4832
+ if (value === void 0) {
4833
+ return void 0;
4834
+ }
4835
+ const seen = /* @__PURE__ */ new WeakSet();
4836
+ const json = JSON.stringify(value, (_key, candidate) => {
4837
+ if (typeof candidate === "bigint") {
4838
+ return candidate.toString();
4839
+ }
4840
+ if (typeof candidate === "function" || typeof candidate === "symbol" || typeof candidate === "undefined") {
4841
+ return void 0;
4842
+ }
4843
+ if (candidate && typeof candidate === "object") {
4844
+ if (seen.has(candidate)) {
4845
+ return "[Circular]";
4846
+ }
4847
+ seen.add(candidate);
4848
+ }
4849
+ return candidate;
4850
+ });
4851
+ if (json === void 0) {
4852
+ return void 0;
4853
+ }
4854
+ return JSON.parse(json);
4855
+ }
4856
+ function createMcpClient(config = {}) {
4857
+ const gateway = createGatewayRequestClient(config);
4858
+ return {
4859
+ bootstrapSession(input = {}) {
4860
+ const scope = {
4861
+ tenantId: input.tenantId,
4862
+ workspaceId: input.workspaceId
4863
+ };
4864
+ const body4 = {
4865
+ transportKind: input.transportKind,
4866
+ sessionId: input.sessionId,
4867
+ agentIdentity: input.agentIdentity,
4868
+ workspaceId: input.workspaceId
4869
+ };
4870
+ return gateway.request({
4871
+ path: `${MCP_GATEWAY_BOOTSTRAP_ENDPOINT}${toQueryString(scope)}`,
4872
+ method: "POST",
4873
+ body: body4
4874
+ });
4875
+ },
4876
+ checkWritePolicy(input) {
4877
+ const scope = {
4878
+ tenantId: input.tenantId,
4879
+ workspaceId: input.workspaceId
4880
+ };
4881
+ return gateway.request({
4882
+ path: `${MCP_GATEWAY_WRITE_POLICY_CHECK_ENDPOINT}${toQueryString(scope)}`,
4883
+ method: "POST",
4884
+ body: {
4885
+ topicId: input.topicId,
4886
+ role: input.role,
4887
+ toolName: input.toolName
4888
+ }
4889
+ });
4890
+ },
4891
+ beginBuildSession(input) {
4892
+ const scope = {
4893
+ tenantId: input.tenantId,
4894
+ workspaceId: input.workspaceId
4895
+ };
4896
+ return gateway.request({
4897
+ path: `${MCP_GATEWAY_BEGIN_BUILD_SESSION_ENDPOINT}${toQueryString(scope)}`,
4898
+ method: "POST",
4899
+ body: {
4900
+ worktreeId: input.worktreeId,
4901
+ branch: input.branch,
4902
+ branchBase: input.branchBase,
4903
+ prBase: input.prBase,
4904
+ sessionMode: input.sessionMode,
4905
+ activateIfPlanning: input.activateIfPlanning
4906
+ }
4907
+ });
4908
+ },
4909
+ evaluateEngineeringContract(input) {
4910
+ const scope = {
4911
+ tenantId: input.tenantId,
4912
+ workspaceId: input.workspaceId
4913
+ };
4914
+ return gateway.request({
4915
+ path: `${MCP_GATEWAY_EVALUATE_ENGINEERING_CONTRACT_ENDPOINT}${toQueryString(scope)}`,
4916
+ method: "POST",
4917
+ body: {
4918
+ beliefNodeId: toJsonValue(input.beliefNodeId),
4919
+ trigger: toJsonValue(input.trigger),
4920
+ testOutput: toJsonValue(input.testOutput),
4921
+ tscOutput: toJsonValue(input.tscOutput),
4922
+ lintOutput: toJsonValue(input.lintOutput),
4923
+ sentryData: toJsonValue(input.sentryData)
4924
+ }
4925
+ });
4926
+ },
4927
+ evaluateResearchContract(input) {
4928
+ const scope = {
4929
+ tenantId: input.tenantId,
4930
+ workspaceId: input.workspaceId
4931
+ };
4932
+ return gateway.request({
4933
+ path: `${MCP_GATEWAY_EVALUATE_RESEARCH_CONTRACT_ENDPOINT}${toQueryString(scope)}`,
4934
+ method: "POST",
4935
+ body: {
4936
+ beliefNodeId: toJsonValue(input.beliefNodeId),
4937
+ trigger: toJsonValue(input.trigger),
4938
+ metricData: toJsonValue(input.metricData),
4939
+ referenceCheckData: toJsonValue(input.referenceCheckData),
4940
+ marketIndexData: toJsonValue(input.marketIndexData),
4941
+ temporalData: toJsonValue(input.temporalData)
4942
+ }
4943
+ });
4944
+ }
4945
+ };
4946
+ }
3589
4947
 
3590
4948
  // src/generated/functionSurface.ts
3591
4949
  var CONTRACTS = {
@@ -3600,6 +4958,7 @@ var CONTRACTS = {
3600
4958
  "archive_belief": { method: "DELETE", path: "/beliefs", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3601
4959
  "archive_ontology": { method: "DELETE", path: "/ontologies", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3602
4960
  "archive_question": { method: "DELETE", path: "/questions", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
4961
+ "begin_build_session": { method: "POST", path: "/mcp/build-session/begin", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3603
4962
  "bisect_confidence": { method: "POST", path: "/beliefs/confidence/bisect", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3604
4963
  "broadcast_message": { method: "POST", path: "/coordination/messages/broadcast", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3605
4964
  "check_permission": { method: "POST", path: "/identity/check-permission", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
@@ -3771,6 +5130,9 @@ function createFunctionSurfaceClient(config = {}) {
3771
5130
  archiveQuestion(input = {}, idempotencyKey) {
3772
5131
  return execute("archive_question", input, idempotencyKey);
3773
5132
  },
5133
+ beginBuildSession(input = {}, idempotencyKey) {
5134
+ return execute("begin_build_session", input, idempotencyKey);
5135
+ },
3774
5136
  bisectConfidence(input = {}, idempotencyKey) {
3775
5137
  return execute("bisect_confidence", input, idempotencyKey);
3776
5138
  },
@@ -4056,14 +5418,312 @@ function createFunctionSurfaceClient(config = {}) {
4056
5418
  updateTask(input = {}, idempotencyKey) {
4057
5419
  return execute("update_task", input, idempotencyKey);
4058
5420
  },
4059
- updateTopic(input = {}, idempotencyKey) {
4060
- return execute("update_topic", input, idempotencyKey);
5421
+ updateTopic(input = {}, idempotencyKey) {
5422
+ return execute("update_topic", input, idempotencyKey);
5423
+ },
5424
+ updateWorktreeMetadata(input = {}, idempotencyKey) {
5425
+ return execute("update_worktree_metadata", input, idempotencyKey);
5426
+ },
5427
+ updateWorktreeTargets(input = {}, idempotencyKey) {
5428
+ return execute("update_worktree_targets", input, idempotencyKey);
5429
+ }
5430
+ };
5431
+ }
5432
+
5433
+ // src/modelRuntimeClient.ts
5434
+ var MODEL_RUNTIME_FIELDS = [
5435
+ "tenantId",
5436
+ "workspaceId",
5437
+ "principalId",
5438
+ "functionName",
5439
+ "slotKey",
5440
+ "modelId",
5441
+ "provider",
5442
+ "routingPolicy",
5443
+ "metadata",
5444
+ "limit",
5445
+ "cursor"
5446
+ ];
5447
+ function scopeQuery(input) {
5448
+ return {
5449
+ tenantId: cleanRequiredString(input.tenantId, "tenantId"),
5450
+ workspaceId: input.workspaceId,
5451
+ principalId: input.principalId,
5452
+ provider: input.provider,
5453
+ limit: input.limit,
5454
+ cursor: input.cursor
5455
+ };
5456
+ }
5457
+ function modelRuntimeBody(input, operation) {
5458
+ return knownPayload(input, MODEL_RUNTIME_FIELDS, operation);
5459
+ }
5460
+ function createModelRuntimeClient(config = {}) {
5461
+ const gateway = createGatewayRequestClient(config);
5462
+ return {
5463
+ listModels(input) {
5464
+ return gateway.request({
5465
+ path: `/api/platform/v1/model-runtime/models${toQueryString(
5466
+ scopeQuery(input)
5467
+ )}`
5468
+ }).then(
5469
+ (response) => mapGatewayData(
5470
+ response,
5471
+ (data) => listResultFromEnvelope(data, "models")
5472
+ )
5473
+ );
5474
+ },
5475
+ getModel(input) {
5476
+ cleanRequiredString(input.tenantId, "tenantId");
5477
+ cleanRequiredString(input.modelId, "modelId");
5478
+ return gateway.request({
5479
+ path: `/api/platform/v1/model-runtime/models/${encodeURIComponent(
5480
+ input.modelId
5481
+ )}${toQueryString({
5482
+ tenantId: input.tenantId,
5483
+ workspaceId: input.workspaceId,
5484
+ principalId: input.principalId
5485
+ })}`
5486
+ });
5487
+ },
5488
+ listFunctionSlots(input) {
5489
+ return gateway.request({
5490
+ path: `/api/platform/v1/model-runtime/function-slots${toQueryString({
5491
+ ...scopeQuery(input),
5492
+ functionName: input.functionName
5493
+ })}`
5494
+ }).then(
5495
+ (response) => mapGatewayData(
5496
+ response,
5497
+ (data) => listResultFromEnvelope(data, "slots")
5498
+ )
5499
+ );
5500
+ },
5501
+ resolveSlot(input, idempotencyKey) {
5502
+ cleanRequiredString(input.tenantId, "tenantId");
5503
+ cleanRequiredString(input.functionName, "functionName");
5504
+ return gateway.request({
5505
+ path: "/api/platform/v1/model-runtime/function-slots/resolve",
5506
+ method: "POST",
5507
+ body: modelRuntimeBody(
5508
+ input,
5509
+ "modelRuntime.resolveSlot"
5510
+ ),
5511
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
5512
+ });
5513
+ },
5514
+ updateSlotConfig(input, idempotencyKey) {
5515
+ cleanRequiredString(input.tenantId, "tenantId");
5516
+ cleanRequiredString(input.functionName, "functionName");
5517
+ cleanRequiredString(input.slotKey, "slotKey");
5518
+ cleanRequiredString(input.modelId, "modelId");
5519
+ return gateway.request({
5520
+ path: "/api/platform/v1/model-runtime/slot-configs",
5521
+ method: "PUT",
5522
+ body: modelRuntimeBody(
5523
+ input,
5524
+ "modelRuntime.updateSlotConfig"
5525
+ ),
5526
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
5527
+ });
5528
+ }
5529
+ };
5530
+ }
5531
+
5532
+ // src/ontologyLinksClient.ts
5533
+ var ONTOLOGY_LINK_FIELDS = [
5534
+ "topicId",
5535
+ "workspaceId",
5536
+ "linkId",
5537
+ "sourceNodeId",
5538
+ "sourceGlobalId",
5539
+ "targetNodeId",
5540
+ "targetGlobalId",
5541
+ "ontologyId",
5542
+ "ontologyType",
5543
+ "edgeType",
5544
+ "weight",
5545
+ "confidence",
5546
+ "status",
5547
+ "metadata"
5548
+ ];
5549
+ function assertEndpoints(input) {
5550
+ if (!input.sourceNodeId && !input.sourceGlobalId) {
5551
+ throw new Error("sourceNodeId or sourceGlobalId is required");
5552
+ }
5553
+ if (!input.targetNodeId && !input.targetGlobalId) {
5554
+ throw new Error("targetNodeId or targetGlobalId is required");
5555
+ }
5556
+ }
5557
+ function normalizeLinkPayload(input, operation) {
5558
+ assertEndpoints(input);
5559
+ cleanRequiredString(input.ontologyId, "ontologyId");
5560
+ cleanRequiredString(input.edgeType, "edgeType");
5561
+ return knownPayload(input, ONTOLOGY_LINK_FIELDS, operation);
5562
+ }
5563
+ function createOntologyLinksClient(config = {}) {
5564
+ const gateway = createGatewayRequestClient(config);
5565
+ return {
5566
+ createLink(input, idempotencyKey) {
5567
+ return gateway.request({
5568
+ path: "/api/platform/v1/ontology-links",
5569
+ method: "POST",
5570
+ body: normalizeLinkPayload(input, "ontologyLinks.createLink"),
5571
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
5572
+ });
5573
+ },
5574
+ upsertLink(input, idempotencyKey) {
5575
+ return gateway.request({
5576
+ path: "/api/platform/v1/ontology-links",
5577
+ method: "PUT",
5578
+ body: normalizeLinkPayload(input, "ontologyLinks.upsertLink"),
5579
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
5580
+ });
5581
+ },
5582
+ listLinksForNode(input) {
5583
+ const nodeId = cleanOptionalString(input.nodeId);
5584
+ const globalId = cleanOptionalString(input.globalId);
5585
+ if (!nodeId && !globalId) {
5586
+ throw new Error("nodeId or globalId is required");
5587
+ }
5588
+ const pathId = encodeURIComponent(nodeId ?? globalId ?? "");
5589
+ return gateway.request({
5590
+ path: `/api/platform/v1/ontology-links/nodes/${pathId}${toQueryString({
5591
+ topicId: input.topicId,
5592
+ workspaceId: input.workspaceId,
5593
+ globalId: nodeId ? void 0 : globalId,
5594
+ ontologyId: input.ontologyId,
5595
+ ontologyType: input.ontologyType,
5596
+ edgeType: input.edgeType,
5597
+ status: input.status,
5598
+ limit: input.limit,
5599
+ cursor: input.cursor
5600
+ })}`
5601
+ }).then(
5602
+ (response) => mapGatewayData(
5603
+ response,
5604
+ (data) => listResultFromEnvelope(data, "links")
5605
+ )
5606
+ );
5607
+ },
5608
+ updateLinkStatus(input, idempotencyKey) {
5609
+ return gateway.request({
5610
+ path: `/api/platform/v1/ontology-links/${encodeURIComponent(
5611
+ input.linkId
5612
+ )}/status`,
5613
+ method: "PATCH",
5614
+ body: knownPayload(
5615
+ input,
5616
+ ONTOLOGY_LINK_FIELDS,
5617
+ "ontologyLinks.updateLinkStatus"
5618
+ ),
5619
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
5620
+ });
5621
+ }
5622
+ };
5623
+ }
5624
+
5625
+ // src/orgGraphSearchClient.ts
5626
+ var ORG_GRAPH_SEARCH_FIELDS = [
5627
+ "tenantId",
5628
+ "workspaceId",
5629
+ "query",
5630
+ "nodeTypes",
5631
+ "minConfidence",
5632
+ "limit",
5633
+ "cursor",
5634
+ "provenanceScope"
5635
+ ];
5636
+ function cleanString5(value, label) {
5637
+ const normalized = value?.trim();
5638
+ if (!normalized) {
5639
+ throw new Error(`${label} is required`);
5640
+ }
5641
+ return normalized;
5642
+ }
5643
+ function assertKnownSearchKeys(input, operation) {
5644
+ const allowed = new Set(ORG_GRAPH_SEARCH_FIELDS);
5645
+ const unknownKeys = Object.keys(input).filter((key) => !allowed.has(key));
5646
+ if (unknownKeys.length > 0) {
5647
+ throw new Error(
5648
+ `${operation} received unsupported field(s): ${unknownKeys.join(", ")}`
5649
+ );
5650
+ }
5651
+ }
5652
+ function searchBody(input) {
5653
+ assertKnownSearchKeys(
5654
+ input,
5655
+ "orgGraphSearch.search"
5656
+ );
5657
+ return {
5658
+ tenantId: cleanString5(input.tenantId, "tenantId"),
5659
+ workspaceId: cleanString5(input.workspaceId, "workspaceId"),
5660
+ query: cleanString5(input.query, "query"),
5661
+ nodeTypes: input.nodeTypes,
5662
+ minConfidence: input.minConfidence,
5663
+ limit: input.limit,
5664
+ cursor: input.cursor,
5665
+ provenanceScope: input.provenanceScope
5666
+ };
5667
+ }
5668
+ function listQuery2(input) {
5669
+ return {
5670
+ tenantId: cleanString5(input.tenantId, "tenantId"),
5671
+ workspaceId: cleanString5(input.workspaceId, "workspaceId"),
5672
+ nodeTypes: input.nodeTypes?.join(","),
5673
+ minConfidence: input.minConfidence,
5674
+ limit: input.limit,
5675
+ cursor: input.cursor
5676
+ };
5677
+ }
5678
+ function mapResults(data) {
5679
+ const record = data && typeof data === "object" ? data : {};
5680
+ return createListResult(
5681
+ Array.isArray(record.results) ? record.results : Array.isArray(data) ? data : [],
5682
+ "results"
5683
+ );
5684
+ }
5685
+ function createOrgGraphSearchClient(config = {}) {
5686
+ const gateway = createGatewayRequestClient(config);
5687
+ return {
5688
+ search(input) {
5689
+ return gateway.request({
5690
+ path: "/api/platform/v1/org-graph-search/search",
5691
+ method: "POST",
5692
+ body: searchBody(input)
5693
+ }).then((response) => mapGatewayData(response, mapResults));
5694
+ },
5695
+ getNode(input) {
5696
+ const nodeId = input.nodeId?.trim();
5697
+ const globalId = input.globalId?.trim();
5698
+ if (!nodeId && !globalId) {
5699
+ throw new Error("nodeId or globalId is required");
5700
+ }
5701
+ const nodePath = encodeURIComponent(nodeId ?? globalId ?? "");
5702
+ return gateway.request({
5703
+ path: `/api/platform/v1/org-graph-search/nodes/${nodePath}${toQueryString(
5704
+ {
5705
+ tenantId: cleanString5(input.tenantId, "tenantId"),
5706
+ workspaceId: cleanString5(input.workspaceId, "workspaceId"),
5707
+ globalId: nodeId ? void 0 : globalId
5708
+ }
5709
+ )}`
5710
+ });
4061
5711
  },
4062
- updateWorktreeMetadata(input = {}, idempotencyKey) {
4063
- return execute("update_worktree_metadata", input, idempotencyKey);
5712
+ listByProvenance(input) {
5713
+ return gateway.request({
5714
+ path: `/api/platform/v1/org-graph-search/provenance${toQueryString({
5715
+ ...listQuery2(input),
5716
+ provenanceScope: input.provenanceScope
5717
+ })}`
5718
+ }).then((response) => mapGatewayData(response, mapResults));
4064
5719
  },
4065
- updateWorktreeTargets(input = {}, idempotencyKey) {
4066
- return execute("update_worktree_targets", input, idempotencyKey);
5720
+ listPublishedFromWorkspace(input) {
5721
+ return gateway.request({
5722
+ path: `/api/platform/v1/org-graph-search/published${toQueryString({
5723
+ ...listQuery2(input),
5724
+ sourceWorkspaceId: input.sourceWorkspaceId
5725
+ })}`
5726
+ }).then((response) => mapGatewayData(response, mapResults));
4067
5727
  }
4068
5728
  };
4069
5729
  }
@@ -4110,9 +5770,9 @@ function createPacksClient(config = {}) {
4110
5770
  /**
4111
5771
  * List pack states for the current scope.
4112
5772
  */
4113
- async listStates(query = {}) {
5773
+ async listStates(query5 = {}) {
4114
5774
  return gateway.request({
4115
- path: `/api/platform/v1/packs/states${toQueryString(query)}`
5775
+ path: `/api/platform/v1/packs/states${toQueryString(query5)}`
4116
5776
  }).then(
4117
5777
  (response) => mapGatewayData(
4118
5778
  response,
@@ -4123,25 +5783,25 @@ function createPacksClient(config = {}) {
4123
5783
  /**
4124
5784
  * @deprecated Use listStates.
4125
5785
  */
4126
- async getStates(query = {}) {
4127
- return this.listStates(query);
5786
+ async getStates(query5 = {}) {
5787
+ return this.listStates(query5);
4128
5788
  },
4129
5789
  /**
4130
5790
  * Get health details for a pack.
4131
5791
  */
4132
- async getHealth(packKey, query = {}) {
5792
+ async getHealth(packKey, query5 = {}) {
4133
5793
  return gateway.request({
4134
5794
  path: `/api/platform/v1/packs/${encodeURIComponent(packKey)}/health${toQueryString(
4135
- query
5795
+ query5
4136
5796
  )}`
4137
5797
  });
4138
5798
  },
4139
5799
  /**
4140
5800
  * List pack telemetry entries.
4141
5801
  */
4142
- async listTelemetry(query = {}) {
5802
+ async listTelemetry(query5 = {}) {
4143
5803
  return gateway.request({
4144
- path: `/api/platform/v1/packs/telemetry${toQueryString(query)}`
5804
+ path: `/api/platform/v1/packs/telemetry${toQueryString(query5)}`
4145
5805
  }).then(
4146
5806
  (response) => mapGatewayData(
4147
5807
  response,
@@ -4152,8 +5812,8 @@ function createPacksClient(config = {}) {
4152
5812
  /**
4153
5813
  * @deprecated Use listTelemetry.
4154
5814
  */
4155
- async getTelemetry(query = {}) {
4156
- return this.listTelemetry(query);
5815
+ async getTelemetry(query5 = {}) {
5816
+ return this.listTelemetry(query5);
4157
5817
  },
4158
5818
  /**
4159
5819
  * Create a pack entitlement.
@@ -4275,9 +5935,9 @@ function createPolicyClient(config = {}) {
4275
5935
  /**
4276
5936
  * List policy decisions in the current scope.
4277
5937
  */
4278
- async listDecisions(query = {}) {
5938
+ async listDecisions(query5 = {}) {
4279
5939
  return gateway.request({
4280
- path: `/api/platform/v1/policy/decisions${toQueryString(query)}`
5940
+ path: `/api/platform/v1/policy/decisions${toQueryString(query5)}`
4281
5941
  }).then(
4282
5942
  (response) => mapGatewayData(
4283
5943
  response,
@@ -4310,9 +5970,9 @@ function createPolicyClient(config = {}) {
4310
5970
  /**
4311
5971
  * List write policy rules for the current scope.
4312
5972
  */
4313
- async listWritePolicies(query = {}) {
5973
+ async listWritePolicies(query5 = {}) {
4314
5974
  const response = await gateway.request({
4315
- path: `/api/platform/v1/policy/write-policies${toQueryString(query)}`
5975
+ path: `/api/platform/v1/policy/write-policies${toQueryString(query5)}`
4316
5976
  });
4317
5977
  const rawPolicies = response.data && typeof response.data === "object" ? response.data.policies : response.data;
4318
5978
  return {
@@ -4375,9 +6035,9 @@ function createPolicyClient(config = {}) {
4375
6035
  /**
4376
6036
  * List tenant role policies for the current scope.
4377
6037
  */
4378
- async listRolePolicies(query = {}) {
6038
+ async listRolePolicies(query5 = {}) {
4379
6039
  const response = await gateway.request({
4380
- path: `/api/platform/v1/policy/roles${toQueryString(query)}`
6040
+ path: `/api/platform/v1/policy/roles${toQueryString(query5)}`
4381
6041
  });
4382
6042
  return {
4383
6043
  ...response,
@@ -4435,28 +6095,28 @@ function createPolicyClient(config = {}) {
4435
6095
  /**
4436
6096
  * Check a permission decision for a topic or project scope.
4437
6097
  */
4438
- async checkPermission(query) {
4439
- if (!query.topicId) {
6098
+ async checkPermission(query5) {
6099
+ if (!query5.topicId) {
4440
6100
  throw new Error("topicId is required");
4441
6101
  }
4442
6102
  return gateway.request({
4443
- path: `/api/platform/v1/policy/check${toQueryString(query)}`
6103
+ path: `/api/platform/v1/policy/check${toQueryString(query5)}`
4444
6104
  });
4445
6105
  },
4446
6106
  /**
4447
6107
  * List accessible topics for a principal.
4448
6108
  */
4449
- async listAccessibleTopics(query = {}) {
4450
- const permission = query.permission ?? "read";
4451
- const principal = query.principal ?? query.principalId;
6109
+ async listAccessibleTopics(query5 = {}) {
6110
+ const permission = query5.permission ?? "read";
6111
+ const principal = query5.principal ?? query5.principalId;
4452
6112
  const response = await gateway.request({
4453
6113
  path: `/api/platform/v1/policy/topics${toQueryString({
4454
- tenantId: query.tenantId,
4455
- workspaceId: query.workspaceId,
6114
+ tenantId: query5.tenantId,
6115
+ workspaceId: query5.workspaceId,
4456
6116
  permission,
4457
- includeShared: query.includeShared,
6117
+ includeShared: query5.includeShared,
4458
6118
  principal,
4459
- limit: query.limit
6119
+ limit: query5.limit
4460
6120
  })}`
4461
6121
  });
4462
6122
  return {
@@ -4639,6 +6299,294 @@ function createSchemaClient(config = {}) {
4639
6299
  };
4640
6300
  }
4641
6301
 
6302
+ // src/telemetryClient.ts
6303
+ var TELEMETRY_FIELDS = [
6304
+ "tenantId",
6305
+ "workspaceId",
6306
+ "principalId",
6307
+ "topicId",
6308
+ "worktreeId",
6309
+ "eventLevel",
6310
+ "eventType",
6311
+ "message",
6312
+ "toolName",
6313
+ "toolCalls",
6314
+ "decision",
6315
+ "policySubject",
6316
+ "policyAction",
6317
+ "policyResource",
6318
+ "runId",
6319
+ "runType",
6320
+ "status",
6321
+ "durationMs",
6322
+ "error",
6323
+ "metadata",
6324
+ "limit",
6325
+ "cursor"
6326
+ ];
6327
+ function query3(input) {
6328
+ return {
6329
+ tenantId: cleanRequiredString(input.tenantId, "tenantId"),
6330
+ workspaceId: input.workspaceId,
6331
+ principalId: input.principalId,
6332
+ topicId: input.topicId,
6333
+ worktreeId: input.worktreeId,
6334
+ runType: input.runType,
6335
+ status: input.status,
6336
+ limit: input.limit,
6337
+ cursor: input.cursor
6338
+ };
6339
+ }
6340
+ function body3(input, operation) {
6341
+ return knownPayload(input, TELEMETRY_FIELDS, operation);
6342
+ }
6343
+ function createTelemetryClient(config = {}) {
6344
+ const gateway = createGatewayRequestClient(config);
6345
+ return {
6346
+ logSystemEvent(input, idempotencyKey) {
6347
+ cleanRequiredString(input.tenantId, "tenantId");
6348
+ cleanRequiredString(input.eventType, "eventType");
6349
+ cleanRequiredString(input.message, "message");
6350
+ return gateway.request({
6351
+ path: "/api/platform/v1/telemetry/system-events",
6352
+ method: "POST",
6353
+ body: body3(
6354
+ input,
6355
+ "telemetry.logSystemEvent"
6356
+ ),
6357
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6358
+ });
6359
+ },
6360
+ logToolCallsBatch(input, idempotencyKey) {
6361
+ cleanRequiredString(input.tenantId, "tenantId");
6362
+ return gateway.request({
6363
+ path: "/api/platform/v1/telemetry/tool-calls/batch",
6364
+ method: "POST",
6365
+ body: body3(
6366
+ input,
6367
+ "telemetry.logToolCallsBatch"
6368
+ ),
6369
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6370
+ });
6371
+ },
6372
+ recordEpistemicAudit(input, idempotencyKey) {
6373
+ cleanRequiredString(input.tenantId, "tenantId");
6374
+ cleanRequiredString(input.eventType, "eventType");
6375
+ return gateway.request({
6376
+ path: "/api/platform/v1/telemetry/epistemic-audits",
6377
+ method: "POST",
6378
+ body: body3(
6379
+ input,
6380
+ "telemetry.recordEpistemicAudit"
6381
+ ),
6382
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6383
+ });
6384
+ },
6385
+ recordPolicyDecision(input, idempotencyKey) {
6386
+ cleanRequiredString(input.tenantId, "tenantId");
6387
+ cleanRequiredString(input.decision, "decision");
6388
+ return gateway.request({
6389
+ path: "/api/platform/v1/telemetry/policy-decisions",
6390
+ method: "POST",
6391
+ body: body3(
6392
+ input,
6393
+ "telemetry.recordPolicyDecision"
6394
+ ),
6395
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6396
+ });
6397
+ },
6398
+ startRun(input, idempotencyKey) {
6399
+ cleanRequiredString(input.tenantId, "tenantId");
6400
+ cleanRequiredString(input.runType, "runType");
6401
+ return gateway.request({
6402
+ path: "/api/platform/v1/telemetry/runs/start",
6403
+ method: "POST",
6404
+ body: body3(
6405
+ input,
6406
+ "telemetry.startRun"
6407
+ ),
6408
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6409
+ });
6410
+ },
6411
+ finishRun(input, idempotencyKey) {
6412
+ cleanRequiredString(input.tenantId, "tenantId");
6413
+ cleanRequiredString(input.runId, "runId");
6414
+ return gateway.request({
6415
+ path: `/api/platform/v1/telemetry/runs/${encodeURIComponent(
6416
+ input.runId
6417
+ )}/finish`,
6418
+ method: "POST",
6419
+ body: body3(
6420
+ input,
6421
+ "telemetry.finishRun"
6422
+ ),
6423
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6424
+ });
6425
+ },
6426
+ listRuns(input) {
6427
+ return gateway.request({
6428
+ path: `/api/platform/v1/telemetry/runs${toQueryString(query3(input))}`
6429
+ }).then(
6430
+ (response) => mapGatewayData(
6431
+ response,
6432
+ (data) => listResultFromEnvelope(data, "runs")
6433
+ )
6434
+ );
6435
+ }
6436
+ };
6437
+ }
6438
+
6439
+ // src/toolRegistryClient.ts
6440
+ var TOOL_REGISTRY_FIELDS = [
6441
+ "tenantId",
6442
+ "workspaceId",
6443
+ "principalId",
6444
+ "toolName",
6445
+ "packKey",
6446
+ "packVersion",
6447
+ "status",
6448
+ "permissions",
6449
+ "role",
6450
+ "surface",
6451
+ "parameterSchema",
6452
+ "returnSchema",
6453
+ "handlerRef",
6454
+ "executionAdapter",
6455
+ "safetyMetadata",
6456
+ "aclId",
6457
+ "metadata",
6458
+ "limit",
6459
+ "cursor"
6460
+ ];
6461
+ function query4(input) {
6462
+ return {
6463
+ tenantId: cleanRequiredString(input.tenantId, "tenantId"),
6464
+ workspaceId: input.workspaceId,
6465
+ principalId: input.principalId,
6466
+ packKey: input.packKey,
6467
+ status: input.status,
6468
+ limit: input.limit,
6469
+ cursor: input.cursor
6470
+ };
6471
+ }
6472
+ function writeBody(input, operation) {
6473
+ return knownPayload(input, TOOL_REGISTRY_FIELDS, operation);
6474
+ }
6475
+ function createToolRegistryClient(config = {}) {
6476
+ const gateway = createGatewayRequestClient(config);
6477
+ return {
6478
+ listCatalog(input) {
6479
+ return gateway.request({
6480
+ path: `/api/platform/v1/tools/catalog${toQueryString(query4(input))}`
6481
+ }).then(
6482
+ (response) => mapGatewayData(
6483
+ response,
6484
+ (data) => listResultFromEnvelope(data, "tools")
6485
+ )
6486
+ );
6487
+ },
6488
+ listExecutable(input) {
6489
+ return gateway.request({
6490
+ path: `/api/platform/v1/tools/executable${toQueryString(query4(input))}`
6491
+ }).then(
6492
+ (response) => mapGatewayData(
6493
+ response,
6494
+ (data) => listResultFromEnvelope(data, "tools")
6495
+ )
6496
+ );
6497
+ },
6498
+ listEffectiveTools(input) {
6499
+ return gateway.request({
6500
+ path: `/api/platform/v1/tools/effective${toQueryString(query4(input))}`
6501
+ }).then(
6502
+ (response) => mapGatewayData(
6503
+ response,
6504
+ (data) => listResultFromEnvelope(data, "tools")
6505
+ )
6506
+ );
6507
+ },
6508
+ upsertCoreTools(input, idempotencyKey) {
6509
+ cleanRequiredString(input.tenantId, "tenantId");
6510
+ return gateway.request({
6511
+ path: "/api/platform/v1/tools/core",
6512
+ method: "PUT",
6513
+ body: {
6514
+ tenantId: input.tenantId,
6515
+ workspaceId: input.workspaceId,
6516
+ metadata: input.metadata,
6517
+ tools: input.tools
6518
+ },
6519
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6520
+ }).then(
6521
+ (response) => mapGatewayData(
6522
+ response,
6523
+ (data) => listResultFromEnvelope(data, "tools")
6524
+ )
6525
+ );
6526
+ },
6527
+ setPackToolsStatus(input, idempotencyKey) {
6528
+ cleanRequiredString(input.tenantId, "tenantId");
6529
+ cleanRequiredString(input.packKey, "packKey");
6530
+ return gateway.request({
6531
+ path: `/api/platform/v1/tools/packs/${encodeURIComponent(
6532
+ input.packKey
6533
+ )}/status`,
6534
+ method: "PATCH",
6535
+ body: writeBody(
6536
+ input,
6537
+ "tools.setPackToolsStatus"
6538
+ ),
6539
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6540
+ }).then(
6541
+ (response) => mapGatewayData(
6542
+ response,
6543
+ (data) => listResultFromEnvelope(data, "tools")
6544
+ )
6545
+ );
6546
+ },
6547
+ createAcl(input, idempotencyKey) {
6548
+ cleanRequiredString(input.tenantId, "tenantId");
6549
+ cleanRequiredString(input.principalId, "principalId");
6550
+ cleanRequiredString(input.toolName, "toolName");
6551
+ return gateway.request({
6552
+ path: "/api/platform/v1/tools/acls",
6553
+ method: "POST",
6554
+ body: writeBody(
6555
+ input,
6556
+ "tools.createAcl"
6557
+ ),
6558
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6559
+ });
6560
+ },
6561
+ deleteAcl(input, idempotencyKey) {
6562
+ cleanRequiredString(input.tenantId, "tenantId");
6563
+ cleanRequiredString(input.aclId, "aclId");
6564
+ return gateway.request({
6565
+ path: `/api/platform/v1/tools/acls/${encodeURIComponent(input.aclId)}`,
6566
+ method: "DELETE",
6567
+ body: writeBody(
6568
+ input,
6569
+ "tools.deleteAcl"
6570
+ ),
6571
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6572
+ });
6573
+ },
6574
+ registerCustomTool(input, idempotencyKey) {
6575
+ cleanRequiredString(input.tenantId, "tenantId");
6576
+ cleanRequiredString(input.toolName, "toolName");
6577
+ return gateway.request({
6578
+ path: "/api/platform/v1/tools/custom",
6579
+ method: "POST",
6580
+ body: writeBody(
6581
+ input,
6582
+ "tools.registerCustomTool"
6583
+ ),
6584
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6585
+ });
6586
+ }
6587
+ };
6588
+ }
6589
+
4642
6590
  // src/version.ts
4643
6591
  var LUCERN_SDK_VERSION = "0.2.0-alpha.1";
4644
6592
 
@@ -4656,10 +6604,10 @@ function createWorkflowClient(config = {}) {
4656
6604
  /**
4657
6605
  * List workflow branches for a topic scope.
4658
6606
  */
4659
- async listBranches(query) {
6607
+ async listBranches(query5) {
4660
6608
  return gateway.request({
4661
6609
  path: `/api/platform/v1/workflow/branches${toQueryString(
4662
- normalizeTopicQuery(query)
6610
+ normalizeTopicQuery(query5)
4663
6611
  )}`
4664
6612
  }).then(
4665
6613
  (response) => mapGatewayData(
@@ -4687,10 +6635,10 @@ function createWorkflowClient(config = {}) {
4687
6635
  /**
4688
6636
  * List reusable lenses for a workspace or topic scope.
4689
6637
  */
4690
- async listLenses(query) {
6638
+ async listLenses(query5) {
4691
6639
  return gateway.request({
4692
6640
  path: `/api/platform/v1/workflow/lenses${toQueryString(
4693
- normalizeLensQuery(query)
6641
+ normalizeLensQuery(query5)
4694
6642
  )}`
4695
6643
  }).then(
4696
6644
  (response) => mapGatewayData(
@@ -4762,14 +6710,14 @@ function createWorkflowClient(config = {}) {
4762
6710
  /**
4763
6711
  * List worktrees for a topic scope.
4764
6712
  */
4765
- async listWorktrees(query) {
4766
- const normalized = normalizeTopicQuery(query);
6713
+ async listWorktrees(query5) {
6714
+ const normalized = normalizeTopicQuery(query5);
4767
6715
  return gateway.request({
4768
6716
  path: `/api/platform/v1/worktrees/all${toQueryString({
4769
6717
  ...normalized,
4770
- groupBy: query.groupBy,
4771
- lane: query.lane,
4772
- campaign: query.campaign
6718
+ groupBy: query5.groupBy,
6719
+ lane: query5.lane,
6720
+ campaign: query5.campaign
4773
6721
  })}`
4774
6722
  }).then(
4775
6723
  (response) => mapGatewayData(
@@ -4784,14 +6732,14 @@ function createWorkflowClient(config = {}) {
4784
6732
  /**
4785
6733
  * List all worktrees across accessible topics.
4786
6734
  */
4787
- async listAllWorktrees(query = {}) {
6735
+ async listAllWorktrees(query5 = {}) {
4788
6736
  return gateway.request({
4789
6737
  path: `/api/platform/v1/worktrees${toQueryString({
4790
- status: query.status,
4791
- groupBy: query.groupBy,
4792
- lane: query.lane,
4793
- campaign: query.campaign,
4794
- limit: query.limit
6738
+ status: query5.status,
6739
+ groupBy: query5.groupBy,
6740
+ lane: query5.lane,
6741
+ campaign: query5.campaign,
6742
+ limit: query5.limit
4795
6743
  })}`
4796
6744
  }).then(
4797
6745
  (response) => mapGatewayData(response, (data) => {
@@ -4811,10 +6759,10 @@ function createWorkflowClient(config = {}) {
4811
6759
  /**
4812
6760
  * List compact pipeline campaigns with nested lanes.
4813
6761
  */
4814
- async listCampaigns(query = {}) {
6762
+ async listCampaigns(query5 = {}) {
4815
6763
  return gateway.request({
4816
6764
  path: `/api/platform/v1/worktrees/campaigns${toQueryString(
4817
- normalizeTopicQuery(query)
6765
+ normalizeTopicQuery(query5)
4818
6766
  )}`
4819
6767
  });
4820
6768
  },
@@ -4870,11 +6818,11 @@ function createWorkflowClient(config = {}) {
4870
6818
  * Update targeted beliefs/questions for a worktree.
4871
6819
  */
4872
6820
  async updateWorktreeTargets(input, idempotencyKey) {
4873
- const { worktreeId, ...body } = input;
6821
+ const { worktreeId, ...body4 } = input;
4874
6822
  return gateway.request({
4875
6823
  path: `/api/platform/v1/worktrees/${encodeURIComponent(worktreeId)}/targets`,
4876
6824
  method: "POST",
4877
- body,
6825
+ body: body4,
4878
6826
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4879
6827
  }).then(
4880
6828
  (response) => mapGatewayData(
@@ -4963,11 +6911,11 @@ function createWorkflowClient(config = {}) {
4963
6911
  /**
4964
6912
  * List accessible topic contexts.
4965
6913
  */
4966
- async listTopics(query = {}) {
6914
+ async listTopics(query5 = {}) {
4967
6915
  return gateway.request({
4968
6916
  path: `/api/platform/v1/workflow/topics${toQueryString({
4969
- includeShared: typeof query.includeShared === "boolean" ? query.includeShared ? "true" : "false" : void 0,
4970
- limit: query.limit
6917
+ includeShared: typeof query5.includeShared === "boolean" ? query5.includeShared ? "true" : "false" : void 0,
6918
+ limit: query5.limit
4971
6919
  })}`
4972
6920
  }).then(
4973
6921
  (response) => mapGatewayData(response, (data) => {
@@ -5095,13 +7043,15 @@ function toGatewayConfig(config) {
5095
7043
  requestIdFactory: config.requestIdFactory,
5096
7044
  onRequest: config.onRequest,
5097
7045
  onResponse: config.onResponse,
7046
+ authContext: config.authContext,
7047
+ requireCanonicalAuthContext: config.requireCanonicalAuthContext,
5098
7048
  getAuthHeaders: async () => {
5099
7049
  const base = config.getAuthHeaders ? await config.getAuthHeaders() : {};
5100
7050
  if (config.apiKey && !base["x-lucern-key"] && !base.Authorization) {
5101
7051
  base["x-lucern-key"] = config.apiKey;
5102
7052
  }
5103
- if (config.userToken && !base["x-lucern-user-token"]) {
5104
- base["x-lucern-user-token"] = config.userToken;
7053
+ if (config.userToken && !base["x-lucern-session-token"]) {
7054
+ base["x-lucern-session-token"] = config.userToken;
5105
7055
  }
5106
7056
  if (config.environment && !base["x-lucern-environment"]) {
5107
7057
  base["x-lucern-environment"] = config.environment;
@@ -5110,13 +7060,20 @@ function toGatewayConfig(config) {
5110
7060
  }
5111
7061
  };
5112
7062
  }
5113
- function requireTopicId(args) {
7063
+ function requireTopicId4(args) {
5114
7064
  const topicId = resolveTopicId(args);
5115
7065
  if (!topicId) {
5116
7066
  throw new Error("topicId is required");
5117
7067
  }
5118
7068
  return topicId;
5119
7069
  }
7070
+ function requireTopicOrProjectId(args) {
7071
+ const topicId = args.topicId?.trim() || args.projectId?.trim() || void 0;
7072
+ if (!topicId) {
7073
+ throw new Error("topicId is required");
7074
+ }
7075
+ return topicId;
7076
+ }
5120
7077
  var AUDIT_NODE_REFERENCE_KEY_PATTERN = /(^|_)(id|nodeid|beliefid|resourceid|targetid|sourceid|subjectid|globalid|entityid|recordid|fromnodeid|tonodeid|linkednodeid|linkedbeliefid|nodeids|beliefids|resourceids)$/i;
5121
7078
  function matchesAuditNodeReference(value, nodeId) {
5122
7079
  if (Array.isArray(value)) {
@@ -5152,18 +7109,41 @@ function requireBaseRate(args) {
5152
7109
  function exposeGatewayData(response) {
5153
7110
  return Object.assign({}, response, response.data);
5154
7111
  }
7112
+ function sdkQueryString(input) {
7113
+ const params = new URLSearchParams();
7114
+ for (const [key, value] of Object.entries(input)) {
7115
+ if (value === void 0 || value === null) {
7116
+ continue;
7117
+ }
7118
+ if (Array.isArray(value)) {
7119
+ if (value.length > 0) {
7120
+ params.set(key, value.join(","));
7121
+ }
7122
+ continue;
7123
+ }
7124
+ params.set(key, String(value));
7125
+ }
7126
+ const serialized = params.toString();
7127
+ return serialized ? `?${serialized}` : "";
7128
+ }
5155
7129
  function createLucernClient(config = {}) {
5156
7130
  const gatewayConfig = toGatewayConfig(config);
5157
7131
  const beliefsClient = createBeliefsClient(gatewayConfig);
5158
7132
  const sourcesClient = createSourcesClient(gatewayConfig);
5159
7133
  const beliefsFacade = createBeliefsFacade(gatewayConfig);
5160
7134
  const evidenceClient = createEvidenceClient(gatewayConfig);
7135
+ const embeddingsClient = createEmbeddingsClient(gatewayConfig);
7136
+ const eventingClient = createEventingClient(gatewayConfig);
5161
7137
  const graphClient = createGraphClient(gatewayConfig);
7138
+ const graphAnalysisClient = createGraphAnalysisClient(gatewayConfig);
7139
+ const graphRecommendationsClient = createGraphRecommendationsClient(gatewayConfig);
7140
+ const graphStateClassifierClient = createGraphStateClassifierClient(gatewayConfig);
5162
7141
  const graphFacade = createGraphFacade(gatewayConfig);
5163
7142
  const decisionsClient = createDecisionsClient(gatewayConfig);
5164
7143
  const contextClient = createContextClient(gatewayConfig);
5165
7144
  const workflowClient = createWorkflowClient(gatewayConfig);
5166
7145
  const auditClient = createAuditClient(gatewayConfig);
7146
+ const authDeviceClient = createAuthDeviceClient(gatewayConfig);
5167
7147
  const adminClient = createAdminClient(gatewayConfig);
5168
7148
  const answersClient = createAnswersClient(gatewayConfig);
5169
7149
  const contradictionsFacade = createContradictionsFacade(gatewayConfig);
@@ -5181,10 +7161,17 @@ function createLucernClient(config = {}) {
5181
7161
  const worktreesFacade = createWorktreesFacade(gatewayConfig);
5182
7162
  const policyClient = createPolicyClient(gatewayConfig);
5183
7163
  const ontologyClient = createOntologyClient(gatewayConfig);
7164
+ const ontologyLinksClient = createOntologyLinksClient(gatewayConfig);
7165
+ const orgGraphSearchClient = createOrgGraphSearchClient(gatewayConfig);
5184
7166
  const functionSurfaceClient = createFunctionSurfaceClient(gatewayConfig);
7167
+ const toolRegistryClient = createToolRegistryClient(gatewayConfig);
7168
+ const modelRuntimeClient = createModelRuntimeClient(gatewayConfig);
5185
7169
  const packsClient = createPacksClient(gatewayConfig);
5186
7170
  const reportsClient = createReportsClient(gatewayConfig);
5187
7171
  const learningClient = createLearningClient(gatewayConfig);
7172
+ const mcpClient = createMcpClient(gatewayConfig);
7173
+ const jobsClient = createJobsClient(gatewayConfig);
7174
+ const telemetryClient = createTelemetryClient(gatewayConfig);
5188
7175
  const harnessClient = createHarnessClient(gatewayConfig);
5189
7176
  const schemaClient = createSchemaClient(gatewayConfig);
5190
7177
  const audiencesClient = createAudiencesClient(gatewayConfig);
@@ -5313,7 +7300,7 @@ function createLucernClient(config = {}) {
5313
7300
  }
5314
7301
  async function listBeliefs(args) {
5315
7302
  const response = await beliefsFacade.list({
5316
- topicId: requireTopicId(args),
7303
+ topicId: requireTopicId4(args),
5317
7304
  status: args.status,
5318
7305
  worktreeId: args.worktreeId,
5319
7306
  minConfidence: args.minConfidence,
@@ -5341,13 +7328,13 @@ function createLucernClient(config = {}) {
5341
7328
  const results = groupedBeliefs.length > 0 ? groupedBeliefs : mergedResults.filter((result) => result.type === "belief");
5342
7329
  return { results };
5343
7330
  }
5344
- async function searchResources(query, options = {}) {
7331
+ async function searchResources(query5, options = {}) {
5345
7332
  const topicId = resolveTopicId(options);
5346
7333
  if (!topicId) {
5347
7334
  throw new Error("topicId is required");
5348
7335
  }
5349
7336
  return searchFacade.query({
5350
- q: query,
7337
+ q: query5,
5351
7338
  topicId,
5352
7339
  types: options.types,
5353
7340
  status: options.status,
@@ -5542,8 +7529,8 @@ function createLucernClient(config = {}) {
5542
7529
  }).then(exposeGatewayData);
5543
7530
  }
5544
7531
  const nodesNamespace = {
5545
- list(query) {
5546
- return graphClient.listNodes(query);
7532
+ list(query5) {
7533
+ return graphClient.listNodes(query5);
5547
7534
  },
5548
7535
  get(input) {
5549
7536
  return graphClient.getNode(
@@ -5559,6 +7546,30 @@ function createLucernClient(config = {}) {
5559
7546
  batchCreate(input, idempotencyKey) {
5560
7547
  return graphClient.batchCreateNodes(input, idempotencyKey);
5561
7548
  },
7549
+ listByTopicAndType(input) {
7550
+ return gateway.request({
7551
+ path: `/api/platform/v1/nodes${sdkQueryString({
7552
+ topicId: requireTopicOrProjectId(input),
7553
+ nodeType: input.nodeType,
7554
+ nodeTypes: input.nodeTypes,
7555
+ query: input.query,
7556
+ sourceText: input.sourceText,
7557
+ limit: input.limit,
7558
+ cursor: input.cursor
7559
+ })}`
7560
+ }).then(exposeGatewayData);
7561
+ },
7562
+ countByTopicAndType(input) {
7563
+ return gateway.request({
7564
+ path: `/api/platform/v1/nodes/count${sdkQueryString({
7565
+ topicId: requireTopicOrProjectId(input),
7566
+ nodeType: input.nodeType,
7567
+ nodeTypes: input.nodeTypes,
7568
+ query: input.query,
7569
+ limit: input.limit
7570
+ })}`
7571
+ }).then(exposeGatewayData);
7572
+ },
5562
7573
  supersede(input, idempotencyKey) {
5563
7574
  return graphClient.supersedeNode(input, idempotencyKey);
5564
7575
  },
@@ -5569,19 +7580,97 @@ function createLucernClient(config = {}) {
5569
7580
  return graphClient.hardDeleteNode(input, idempotencyKey);
5570
7581
  }
5571
7582
  };
7583
+ const publicationNamespace = {
7584
+ create(input, idempotencyKey) {
7585
+ return gateway.request({
7586
+ path: "/api/platform/v1/publication",
7587
+ method: "POST",
7588
+ body: input,
7589
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
7590
+ }).then(exposeGatewayData);
7591
+ },
7592
+ update(publicationId, input, idempotencyKey) {
7593
+ return gateway.request({
7594
+ path: `/api/platform/v1/publication/${encodeURIComponent(
7595
+ publicationId
7596
+ )}`,
7597
+ method: "PATCH",
7598
+ body: input,
7599
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
7600
+ }).then(exposeGatewayData);
7601
+ },
7602
+ list(input = {}) {
7603
+ return gateway.request({
7604
+ path: `/api/platform/v1/publication${sdkQueryString(input)}`
7605
+ }).then(exposeGatewayData);
7606
+ },
7607
+ getByTopic(input) {
7608
+ const topicId = typeof input === "string" ? input : input.topicId;
7609
+ const workspaceId = typeof input === "string" ? void 0 : input.workspaceId;
7610
+ return gateway.request({
7611
+ path: `/api/platform/v1/publication/by-topic/${encodeURIComponent(
7612
+ topicId
7613
+ )}${sdkQueryString({ workspaceId })}`
7614
+ }).then(exposeGatewayData);
7615
+ },
7616
+ publish(publicationId, input = {}, idempotencyKey) {
7617
+ return gateway.request({
7618
+ path: `/api/platform/v1/publication/${encodeURIComponent(
7619
+ publicationId
7620
+ )}/publish`,
7621
+ method: "POST",
7622
+ body: input,
7623
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
7624
+ }).then(exposeGatewayData);
7625
+ },
7626
+ unpublish(publicationId, input = {}, idempotencyKey) {
7627
+ return gateway.request({
7628
+ path: `/api/platform/v1/publication/${encodeURIComponent(
7629
+ publicationId
7630
+ )}/unpublish`,
7631
+ method: "POST",
7632
+ body: input,
7633
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
7634
+ }).then(exposeGatewayData);
7635
+ },
7636
+ remove(publicationId, input = {}) {
7637
+ return gateway.request({
7638
+ path: `/api/platform/v1/publication/${encodeURIComponent(
7639
+ publicationId
7640
+ )}${sdkQueryString(input)}`,
7641
+ method: "DELETE"
7642
+ }).then(exposeGatewayData);
7643
+ }
7644
+ };
7645
+ const ontologyLinksNamespace = {
7646
+ ...ontologyLinksClient,
7647
+ resolveThemeSource(input) {
7648
+ return gateway.request({
7649
+ path: "/api/platform/v1/ontology-links/theme-source",
7650
+ method: "POST",
7651
+ body: input
7652
+ }).then(exposeGatewayData);
7653
+ }
7654
+ };
5572
7655
  return {
5573
7656
  config,
5574
7657
  version: LUCERN_SDK_VERSION,
5575
- search(query, options) {
5576
- return searchResources(query, options);
7658
+ search(query5, options) {
7659
+ return searchResources(query5, options);
5577
7660
  },
5578
7661
  events: {
5579
- list(query = {}) {
5580
- return eventsFacade.list(query).then(exposeGatewayData);
7662
+ list(query5 = {}) {
7663
+ return eventsFacade.list(query5).then(exposeGatewayData);
5581
7664
  },
5582
7665
  replay(input) {
5583
7666
  return eventsFacade.replay(input).then(exposeGatewayData);
5584
- }
7667
+ },
7668
+ recordEvent: eventingClient.recordEvent,
7669
+ listEvents: eventingClient.listEvents,
7670
+ listWebhooks: eventingClient.listWebhooks,
7671
+ enqueueDelivery: eventingClient.enqueueDelivery,
7672
+ recordDeliveryAttempt: eventingClient.recordDeliveryAttempt,
7673
+ updateDeliveryStatus: eventingClient.updateDeliveryStatus
5585
7674
  },
5586
7675
  beliefs: {
5587
7676
  create(input) {
@@ -5650,7 +7739,7 @@ function createLucernClient(config = {}) {
5650
7739
  },
5651
7740
  list(args) {
5652
7741
  return beliefsFacade.list({
5653
- topicId: requireTopicId(args),
7742
+ topicId: requireTopicId4(args),
5654
7743
  worktreeId: args.worktreeId,
5655
7744
  status: args.status,
5656
7745
  minConfidence: args.minConfidence,
@@ -5679,8 +7768,8 @@ function createLucernClient(config = {}) {
5679
7768
  create(input) {
5680
7769
  return webhooksFacade.create(input).then(exposeGatewayData);
5681
7770
  },
5682
- list(query) {
5683
- return webhooksFacade.list(query).then(exposeGatewayData);
7771
+ list(query5) {
7772
+ return webhooksFacade.list(query5).then(exposeGatewayData);
5684
7773
  },
5685
7774
  get(id) {
5686
7775
  return webhooksFacade.get(id).then(exposeGatewayData);
@@ -5694,8 +7783,8 @@ function createLucernClient(config = {}) {
5694
7783
  test(id, input) {
5695
7784
  return webhooksFacade.test(id, input).then(exposeGatewayData);
5696
7785
  },
5697
- deliveries(id, query) {
5698
- return webhooksFacade.deliveries(id, query).then(exposeGatewayData);
7786
+ deliveries(id, query5) {
7787
+ return webhooksFacade.deliveries(id, query5).then(exposeGatewayData);
5699
7788
  },
5700
7789
  health(id) {
5701
7790
  return webhooksFacade.health(id).then(exposeGatewayData);
@@ -5850,7 +7939,7 @@ function createLucernClient(config = {}) {
5850
7939
  },
5851
7940
  list(args) {
5852
7941
  return questionsFacade.list({
5853
- topicId: requireTopicId(args),
7942
+ topicId: requireTopicId4(args),
5854
7943
  status: args.status,
5855
7944
  priority: args.priority,
5856
7945
  worktreeId: args.worktreeId,
@@ -5922,7 +8011,7 @@ function createLucernClient(config = {}) {
5922
8011
  },
5923
8012
  getHighPriority(args) {
5924
8013
  return this.list({
5925
- topicId: requireTopicId(args),
8014
+ topicId: requireTopicId4(args),
5926
8015
  status: args.includeAnswered ? void 0 : "open"
5927
8016
  }).then((data) => {
5928
8017
  const questions = Array.isArray(data.questions) ? data.questions : [];
@@ -5947,7 +8036,7 @@ function createLucernClient(config = {}) {
5947
8036
  },
5948
8037
  async findMissing(args) {
5949
8038
  return graphFacade.gaps({
5950
- topicId: requireTopicId(args),
8039
+ topicId: requireTopicId4(args),
5951
8040
  minConfidence: args.minConfidence
5952
8041
  }).then(exposeGatewayData);
5953
8042
  }
@@ -5978,21 +8067,21 @@ function createLucernClient(config = {}) {
5978
8067
  },
5979
8068
  analyze(args) {
5980
8069
  return graphFacade.analyze({
5981
- topicId: requireTopicId(args),
8070
+ topicId: requireTopicId4(args),
5982
8071
  limit: args.limit,
5983
8072
  metric: args.metric
5984
8073
  }).then(exposeGatewayData);
5985
8074
  },
5986
8075
  bias(args) {
5987
8076
  return graphFacade.bias({
5988
- topicId: requireTopicId(args),
8077
+ topicId: requireTopicId4(args),
5989
8078
  threshold: args.threshold,
5990
8079
  limit: args.limit
5991
8080
  }).then(exposeGatewayData);
5992
8081
  },
5993
8082
  gaps(args) {
5994
8083
  return graphFacade.gaps({
5995
- topicId: requireTopicId(args),
8084
+ topicId: requireTopicId4(args),
5996
8085
  minConfidence: args.minConfidence
5997
8086
  }).then(exposeGatewayData);
5998
8087
  },
@@ -6044,6 +8133,54 @@ function createLucernClient(config = {}) {
6044
8133
  }));
6045
8134
  }
6046
8135
  },
8136
+ themes: {
8137
+ listByTopic(input) {
8138
+ return gateway.request({
8139
+ path: `/api/platform/v1/themes${sdkQueryString({
8140
+ topicId: requireTopicOrProjectId(input),
8141
+ query: input.query,
8142
+ limit: input.limit,
8143
+ cursor: input.cursor
8144
+ })}`
8145
+ }).then(exposeGatewayData);
8146
+ }
8147
+ },
8148
+ graphSearch: {
8149
+ keywordSearchNodes(input) {
8150
+ return gateway.request({
8151
+ path: "/api/platform/v1/graph-search/keyword-nodes",
8152
+ method: "POST",
8153
+ body: {
8154
+ ...input,
8155
+ topicId: requireTopicOrProjectId(input),
8156
+ projectId: void 0
8157
+ }
8158
+ }).then(exposeGatewayData);
8159
+ }
8160
+ },
8161
+ classifiers: {
8162
+ listBeliefCandidates(input) {
8163
+ return gateway.request({
8164
+ path: `/api/platform/v1/classifiers/belief-candidates${sdkQueryString({
8165
+ topicId: requireTopicOrProjectId(input),
8166
+ classifierKey: input.classifierKey,
8167
+ query: input.query,
8168
+ limit: input.limit,
8169
+ cursor: input.cursor
8170
+ })}`
8171
+ }).then(exposeGatewayData);
8172
+ }
8173
+ },
8174
+ archetypes: {
8175
+ getJudgmentSignature(input) {
8176
+ return gateway.request({
8177
+ path: `/api/platform/v1/archetypes/judgment-signature${sdkQueryString({
8178
+ topicId: requireTopicOrProjectId(input),
8179
+ principalId: input.principalId
8180
+ })}`
8181
+ }).then(exposeGatewayData);
8182
+ }
8183
+ },
6047
8184
  judgments: {
6048
8185
  create(input) {
6049
8186
  return decisionsClient.createJudgment(input);
@@ -6051,8 +8188,8 @@ function createLucernClient(config = {}) {
6051
8188
  record(input) {
6052
8189
  return decisionsClient.recordJudgment(input);
6053
8190
  },
6054
- list(query) {
6055
- return decisionsClient.listJudgments(query);
8191
+ list(query5) {
8192
+ return decisionsClient.listJudgments(query5);
6056
8193
  },
6057
8194
  get(judgmentId) {
6058
8195
  return decisionsClient.getJudgment(judgmentId);
@@ -6081,10 +8218,56 @@ function createLucernClient(config = {}) {
6081
8218
  transitionAuditIntegrity(args) {
6082
8219
  return decisionsClient.getJudgmentTransitionAuditIntegrity({
6083
8220
  ...args,
6084
- topicId: requireTopicId(args)
8221
+ topicId: requireTopicId4(args)
6085
8222
  });
6086
8223
  }
6087
8224
  },
8225
+ decisions: {
8226
+ create(input) {
8227
+ return decisionsClient.createJudgment(input);
8228
+ },
8229
+ record(input) {
8230
+ return decisionsClient.recordJudgment(input);
8231
+ },
8232
+ list(query5) {
8233
+ return decisionsClient.listJudgments(query5);
8234
+ },
8235
+ get(decisionId) {
8236
+ return decisionsClient.getJudgment(decisionId);
8237
+ },
8238
+ recordOutcome(decisionId, input) {
8239
+ return decisionsClient.recordJudgmentOutcome(decisionId, input);
8240
+ },
8241
+ lessons(decisionId, input, idempotencyKey) {
8242
+ return gateway.request({
8243
+ path: `/api/platform/v1/decisions/${encodeURIComponent(
8244
+ decisionId
8245
+ )}/lessons`,
8246
+ method: "POST",
8247
+ body: input,
8248
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
8249
+ }).then(exposeGatewayData);
8250
+ },
8251
+ archive(decisionId, input = {}, idempotencyKey) {
8252
+ return gateway.request({
8253
+ path: `/api/platform/v1/decisions/${encodeURIComponent(
8254
+ decisionId
8255
+ )}/archive`,
8256
+ method: "POST",
8257
+ body: input,
8258
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
8259
+ }).then(exposeGatewayData);
8260
+ },
8261
+ readiness(topicId) {
8262
+ return decisionsClient.getJudgmentReadiness({ topicId });
8263
+ },
8264
+ calibration(topicId) {
8265
+ return decisionsClient.getJudgmentCalibration({ topicId });
8266
+ },
8267
+ pendingOutcomeReview(topicId) {
8268
+ return decisionsClient.listPendingJudgmentOutcomeReview({ topicId });
8269
+ }
8270
+ },
6088
8271
  worktrees: {
6089
8272
  createBranch(input) {
6090
8273
  return workflowClient.createBranch(input);
@@ -6092,8 +8275,8 @@ function createLucernClient(config = {}) {
6092
8275
  createLens(input) {
6093
8276
  return workflowClient.createLens(input);
6094
8277
  },
6095
- listLenses(query) {
6096
- return workflowClient.listLenses(query);
8278
+ listLenses(query5) {
8279
+ return workflowClient.listLenses(query5);
6097
8280
  },
6098
8281
  applyLensToTopic(input) {
6099
8282
  return workflowClient.applyLensToTopic(input);
@@ -6104,10 +8287,24 @@ function createLucernClient(config = {}) {
6104
8287
  create(input) {
6105
8288
  return worktreesFacade.create({
6106
8289
  title: input.title,
6107
- topicId: requireTopicId(input),
8290
+ topicId: requireTopicId4(input),
6108
8291
  objective: input.objective,
6109
8292
  hypothesis: input.hypothesis,
8293
+ rationale: input.rationale,
8294
+ worktreeType: input.worktreeType,
8295
+ startDate: input.startDate,
8296
+ endDate: input.endDate,
8297
+ durationWeeks: input.durationWeeks,
8298
+ confidenceImpact: input.confidenceImpact,
8299
+ beliefFocus: input.beliefFocus,
6110
8300
  beliefIds: input.beliefIds,
8301
+ targetBeliefIds: input.targetBeliefIds,
8302
+ targetQuestionIds: input.targetQuestionIds,
8303
+ keyQuestions: input.keyQuestions,
8304
+ evidenceSignals: input.evidenceSignals,
8305
+ decisionGate: input.decisionGate,
8306
+ goCriteria: input.goCriteria,
8307
+ noGoSignals: input.noGoSignals,
6111
8308
  autoShape: input.autoShape,
6112
8309
  domainPackId: input.domainPackId,
6113
8310
  campaign: input.campaign,
@@ -6120,16 +8317,31 @@ function createLucernClient(config = {}) {
6120
8317
  proofArtifacts: input.proofArtifacts,
6121
8318
  staffingHint: typeof input.staffingHint === "string" ? input.staffingHint : void 0,
6122
8319
  lastReconciledAt: input.lastReconciledAt,
6123
- autoFixPolicy: input.autoFixPolicy
8320
+ autoFixPolicy: input.autoFixPolicy,
8321
+ lensId: input.lensId
6124
8322
  });
6125
8323
  },
6126
8324
  add(input) {
6127
8325
  return worktreesFacade.create({
6128
8326
  title: input.title,
6129
- topicId: requireTopicId(input),
8327
+ topicId: requireTopicId4(input),
6130
8328
  objective: input.objective,
6131
8329
  hypothesis: input.hypothesis,
8330
+ rationale: input.rationale,
8331
+ worktreeType: input.worktreeType,
8332
+ startDate: input.startDate,
8333
+ endDate: input.endDate,
8334
+ durationWeeks: input.durationWeeks,
8335
+ confidenceImpact: input.confidenceImpact,
8336
+ beliefFocus: input.beliefFocus,
6132
8337
  beliefIds: input.beliefIds,
8338
+ targetBeliefIds: input.targetBeliefIds,
8339
+ targetQuestionIds: input.targetQuestionIds,
8340
+ keyQuestions: input.keyQuestions,
8341
+ evidenceSignals: input.evidenceSignals,
8342
+ decisionGate: input.decisionGate,
8343
+ goCriteria: input.goCriteria,
8344
+ noGoSignals: input.noGoSignals,
6133
8345
  autoShape: input.autoShape,
6134
8346
  domainPackId: input.domainPackId,
6135
8347
  campaign: input.campaign,
@@ -6142,16 +8354,33 @@ function createLucernClient(config = {}) {
6142
8354
  proofArtifacts: input.proofArtifacts,
6143
8355
  staffingHint: typeof input.staffingHint === "string" ? input.staffingHint : void 0,
6144
8356
  lastReconciledAt: input.lastReconciledAt,
6145
- autoFixPolicy: input.autoFixPolicy
8357
+ autoFixPolicy: input.autoFixPolicy,
8358
+ lensId: input.lensId
8359
+ });
8360
+ },
8361
+ list(query5) {
8362
+ return worktreesFacade.list({
8363
+ topicId: requireTopicId4(query5),
8364
+ status: query5.status,
8365
+ limit: query5.limit
6146
8366
  });
6147
8367
  },
6148
- list(query) {
8368
+ listByTopic(query5) {
6149
8369
  return worktreesFacade.list({
6150
- topicId: requireTopicId(query),
6151
- status: query.status,
6152
- limit: query.limit
8370
+ topicId: requireTopicId4(query5),
8371
+ status: query5.status,
8372
+ limit: query5.limit
6153
8373
  });
6154
8374
  },
8375
+ findByPairedSprint(input) {
8376
+ return gateway.request({
8377
+ path: `/api/platform/v1/worktrees/paired-sprint${sdkQueryString({
8378
+ sprintId: input.sprintId,
8379
+ topicId: input.topicId ?? input.projectId,
8380
+ limit: input.limit
8381
+ })}`
8382
+ }).then(exposeGatewayData);
8383
+ },
6155
8384
  activate(worktreeId) {
6156
8385
  return worktreesFacade.activate({ id: worktreeId });
6157
8386
  },
@@ -6184,8 +8413,8 @@ function createLucernClient(config = {}) {
6184
8413
  removeQuestionIds: input.removeQuestionIds
6185
8414
  });
6186
8415
  },
6187
- listAll(query = {}) {
6188
- return workflowClient.listAllWorktrees(query);
8416
+ listAll(query5 = {}) {
8417
+ return workflowClient.listAllWorktrees(query5);
6189
8418
  },
6190
8419
  merge(worktreeId, input) {
6191
8420
  return worktreesFacade.merge({
@@ -6226,12 +8455,12 @@ function createLucernClient(config = {}) {
6226
8455
  }
6227
8456
  },
6228
8457
  context: {
6229
- listTopics(query = {}) {
8458
+ listTopics(query5 = {}) {
6230
8459
  return topicsFacade.list({
6231
- ontologyId: query.ontologyId,
6232
- parentTopicId: query.parentTopicId,
6233
- status: query.status,
6234
- type: query.type
8460
+ ontologyId: query5.ontologyId,
8461
+ parentTopicId: query5.parentTopicId,
8462
+ status: query5.status,
8463
+ type: query5.type
6235
8464
  });
6236
8465
  },
6237
8466
  compile(topicId, input = {}) {
@@ -6303,6 +8532,31 @@ function createLucernClient(config = {}) {
6303
8532
  status: typeof input.status === "string" ? input.status : void 0,
6304
8533
  limit: typeof input.limit === "number" ? input.limit : void 0
6305
8534
  });
8535
+ },
8536
+ listByTopic(input) {
8537
+ return tasksFacade.list({
8538
+ topicId: requireTopicId4(input),
8539
+ status: typeof input.status === "string" ? input.status : void 0,
8540
+ limit: typeof input.limit === "number" ? input.limit : void 0
8541
+ });
8542
+ },
8543
+ listByWorktree(input) {
8544
+ return tasksFacade.list({
8545
+ topicId: typeof input.topicId === "string" ? input.topicId : void 0,
8546
+ worktreeId: input.worktreeId,
8547
+ status: typeof input.status === "string" ? input.status : void 0,
8548
+ limit: typeof input.limit === "number" ? input.limit : void 0
8549
+ });
8550
+ },
8551
+ linkChat(taskId, input, idempotencyKey) {
8552
+ return gateway.request({
8553
+ path: `/api/platform/v1/tasks/${encodeURIComponent(
8554
+ taskId
8555
+ )}/link-chat`,
8556
+ method: "POST",
8557
+ body: input,
8558
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
8559
+ }).then(exposeGatewayData);
6306
8560
  }
6307
8561
  },
6308
8562
  topics: {
@@ -6342,10 +8596,10 @@ function createLucernClient(config = {}) {
6342
8596
  visibility: input.visibility
6343
8597
  });
6344
8598
  },
6345
- tree(topicId, query = {}) {
8599
+ tree(topicId, query5 = {}) {
6346
8600
  return topicsFacade.tree({
6347
8601
  id: topicId,
6348
- maxDepth: query.maxDepth
8602
+ maxDepth: query5.maxDepth
6349
8603
  });
6350
8604
  },
6351
8605
  getTree(input) {
@@ -6354,11 +8608,11 @@ function createLucernClient(config = {}) {
6354
8608
  maxDepth: input.maxDepth
6355
8609
  });
6356
8610
  },
6357
- coverage(topicId, query = {}) {
8611
+ coverage(topicId, query5 = {}) {
6358
8612
  return topicsFacade.coverage({
6359
8613
  id: topicId,
6360
- includeDescendants: query.includeDescendants,
6361
- maxDepth: query.maxDepth
8614
+ includeDescendants: query5.includeDescendants,
8615
+ maxDepth: query5.maxDepth
6362
8616
  });
6363
8617
  },
6364
8618
  remove(topicId, idempotencyKey) {
@@ -6408,7 +8662,7 @@ function createLucernClient(config = {}) {
6408
8662
  },
6409
8663
  list(args) {
6410
8664
  return contradictionsFacade.list({
6411
- topicId: requireTopicId(args),
8665
+ topicId: requireTopicId4(args),
6412
8666
  status: args.status,
6413
8667
  limit: args.limit,
6414
8668
  cursor: args.cursor
@@ -6583,7 +8837,26 @@ function createLucernClient(config = {}) {
6583
8837
  return functionSurfaceClient.generateSessionHandoff(input);
6584
8838
  }
6585
8839
  },
8840
+ embeddings: embeddingsClient,
8841
+ graphAnalysis: graphAnalysisClient,
8842
+ graphRecommendations: graphRecommendationsClient,
8843
+ orgGraphSearch: orgGraphSearchClient,
8844
+ ontologyLinks: ontologyLinksNamespace,
8845
+ graphStateClassifier: graphStateClassifierClient,
8846
+ modelRuntime: modelRuntimeClient,
8847
+ jobs: jobsClient,
8848
+ telemetry: telemetryClient,
8849
+ publication: publicationNamespace,
8850
+ contentPublication: publicationNamespace,
6586
8851
  tools: {
8852
+ listCatalog: toolRegistryClient.listCatalog,
8853
+ listExecutable: toolRegistryClient.listExecutable,
8854
+ listEffectiveTools: toolRegistryClient.listEffectiveTools,
8855
+ upsertCoreTools: toolRegistryClient.upsertCoreTools,
8856
+ setPackToolsStatus: toolRegistryClient.setPackToolsStatus,
8857
+ createAcl: toolRegistryClient.createAcl,
8858
+ deleteAcl: toolRegistryClient.deleteAcl,
8859
+ registerCustomTool: toolRegistryClient.registerCustomTool,
6587
8860
  register(registration) {
6588
8861
  return registerCustomTool(registration);
6589
8862
  },
@@ -6640,26 +8913,74 @@ function createLucernClient(config = {}) {
6640
8913
  }
6641
8914
  },
6642
8915
  nodes: nodesNamespace,
6643
- identity: identityFacade,
8916
+ identity: {
8917
+ ...identityFacade,
8918
+ evaluatePolicy: identityClient.evaluatePolicy,
8919
+ recordPolicyDecision: identityClient.recordPolicyDecision,
8920
+ putSecretReference: identityClient.putSecretReference,
8921
+ createPrincipal: identityClient.createPrincipal,
8922
+ updatePrincipal: identityClient.updatePrincipal,
8923
+ raw: identityClient
8924
+ },
8925
+ mcp: {
8926
+ bootstrapSession(input) {
8927
+ return mcpClient.bootstrapSession(input);
8928
+ },
8929
+ checkWritePolicy(input) {
8930
+ return mcpClient.checkWritePolicy(input);
8931
+ },
8932
+ beginBuildSession(input) {
8933
+ return mcpClient.beginBuildSession(input);
8934
+ },
8935
+ evaluateEngineeringContract(input) {
8936
+ return mcpClient.evaluateEngineeringContract(input);
8937
+ },
8938
+ evaluateResearchContract(input) {
8939
+ return mcpClient.evaluateResearchContract(input);
8940
+ }
8941
+ },
8942
+ auth: {
8943
+ device: {
8944
+ createCode(input) {
8945
+ return authDeviceClient.createDeviceCode(input);
8946
+ },
8947
+ pollToken(deviceCode) {
8948
+ return authDeviceClient.pollDeviceToken(deviceCode);
8949
+ }
8950
+ }
8951
+ },
6644
8952
  custom: getCustomNamespace("custom"),
6645
8953
  extensions: extensionNamespaces,
6646
8954
  raw: {
6647
8955
  beliefs: beliefsClient,
6648
8956
  sources: sourcesClient,
6649
8957
  evidence: evidenceClient,
8958
+ embeddings: embeddingsClient,
8959
+ eventing: eventingClient,
6650
8960
  graph: graphClient,
8961
+ graphAnalysis: graphAnalysisClient,
8962
+ graphRecommendations: graphRecommendationsClient,
8963
+ graphStateClassifier: graphStateClassifierClient,
6651
8964
  decisions: decisionsClient,
6652
8965
  workflow: workflowClient,
6653
8966
  audit: auditClient,
8967
+ authDevice: authDeviceClient,
6654
8968
  admin: adminClient,
6655
8969
  identity: identityClient,
6656
8970
  policy: policyClient,
6657
8971
  answers: answersClient,
6658
8972
  ontology: ontologyClient,
8973
+ ontologyLinks: ontologyLinksClient,
8974
+ orgGraphSearch: orgGraphSearchClient,
6659
8975
  functionSurface: functionSurfaceClient,
8976
+ toolRegistry: toolRegistryClient,
8977
+ modelRuntime: modelRuntimeClient,
6660
8978
  packs: packsClient,
6661
8979
  reports: reportsClient,
6662
8980
  learning: learningClient,
8981
+ mcp: mcpClient,
8982
+ jobs: jobsClient,
8983
+ telemetry: telemetryClient,
6663
8984
  harness: harnessClient,
6664
8985
  schema: schemaClient,
6665
8986
  audiences: audiencesClient,