@lucern/sdk 0.3.0-alpha.6 → 0.3.0-alpha.8

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 (176) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/README.md +4 -4
  3. package/dist/adminClient.d.ts +8 -8
  4. package/dist/adminClient.js +47 -36
  5. package/dist/adminClient.js.map +1 -1
  6. package/dist/answersClient.js +26 -8
  7. package/dist/answersClient.js.map +1 -1
  8. package/dist/audience/index.d.ts +2 -1
  9. package/dist/audience/index.js +1 -3
  10. package/dist/audience/index.js.map +1 -1
  11. package/dist/audiencesClient.d.ts +16 -16
  12. package/dist/audiencesClient.js +102 -87
  13. package/dist/audiencesClient.js.map +1 -1
  14. package/dist/auditClient.js +30 -10
  15. package/dist/auditClient.js.map +1 -1
  16. package/dist/authDeviceClient.js +16 -3
  17. package/dist/authDeviceClient.js.map +1 -1
  18. package/dist/beliefs/index.d.ts +3 -3
  19. package/dist/beliefs/index.js +543 -776
  20. package/dist/beliefs/index.js.map +1 -1
  21. package/dist/beliefsClient.d.ts +2 -2
  22. package/dist/beliefsClient.js +31 -19
  23. package/dist/beliefsClient.js.map +1 -1
  24. package/dist/boundaryClientSurface.js +10 -3
  25. package/dist/boundaryClientSurface.js.map +1 -1
  26. package/dist/client.d.ts +247 -270
  27. package/dist/client.js +543 -776
  28. package/dist/client.js.map +1 -1
  29. package/dist/clientHelpers.d.ts +29 -0
  30. package/dist/clientHelpers.js +122 -0
  31. package/dist/clientHelpers.js.map +1 -0
  32. package/dist/contextClient.d.ts +4 -3
  33. package/dist/contextClient.js +56 -26
  34. package/dist/contextClient.js.map +1 -1
  35. package/dist/contextFacade.js +25 -16
  36. package/dist/contextFacade.js.map +1 -1
  37. package/dist/contextPackCompiler.js +19 -30
  38. package/dist/contextPackCompiler.js.map +1 -1
  39. package/dist/contextPackPolicy.js +7 -17
  40. package/dist/contextPackPolicy.js.map +1 -1
  41. package/dist/contextTypes.d.ts +2 -0
  42. package/dist/contracts/index.js +4 -3
  43. package/dist/contracts/index.js.map +1 -1
  44. package/dist/contracts/lens-filter.contract.js +4 -3
  45. package/dist/contracts/lens-filter.contract.js.map +1 -1
  46. package/dist/contracts/lens-workflow.contract.js +4 -3
  47. package/dist/contracts/lens-workflow.contract.js.map +1 -1
  48. package/dist/contracts/lensFilter.js +4 -3
  49. package/dist/contracts/lensFilter.js.map +1 -1
  50. package/dist/contracts/lensWorkflow.js +4 -3
  51. package/dist/contracts/lensWorkflow.js.map +1 -1
  52. package/dist/contradictions/index.d.ts +2 -2
  53. package/dist/contradictions/index.js +543 -776
  54. package/dist/contradictions/index.js.map +1 -1
  55. package/dist/coreClient.d.ts +2 -1
  56. package/dist/coreClient.js +27 -11
  57. package/dist/coreClient.js.map +1 -1
  58. package/dist/decisions/index.d.ts +12 -12
  59. package/dist/decisions/index.js +543 -776
  60. package/dist/decisions/index.js.map +1 -1
  61. package/dist/decisionsClient.d.ts +4 -12
  62. package/dist/decisionsClient.js +37 -31
  63. package/dist/decisionsClient.js.map +1 -1
  64. package/dist/edges/index.d.ts +2 -2
  65. package/dist/edges/index.js +543 -776
  66. package/dist/edges/index.js.map +1 -1
  67. package/dist/embeddingsClient.js +37 -14
  68. package/dist/embeddingsClient.js.map +1 -1
  69. package/dist/eventingClient.js +37 -14
  70. package/dist/eventingClient.js.map +1 -1
  71. package/dist/events.js +6 -3
  72. package/dist/events.js.map +1 -1
  73. package/dist/eventsCore.d.ts +1 -1
  74. package/dist/eventsCore.js +27 -11
  75. package/dist/eventsCore.js.map +1 -1
  76. package/dist/evidence/index.d.ts +2 -2
  77. package/dist/evidence/index.js +543 -776
  78. package/dist/evidence/index.js.map +1 -1
  79. package/dist/evidenceClient.js +27 -11
  80. package/dist/evidenceClient.js.map +1 -1
  81. package/dist/facade/context.d.ts +2 -1
  82. package/dist/facade/context.js +25 -16
  83. package/dist/facade/context.js.map +1 -1
  84. package/dist/functionSurface.js +27 -11
  85. package/dist/functionSurface.js.map +1 -1
  86. package/dist/functionSurfaceClient.js +27 -11
  87. package/dist/functionSurfaceClient.js.map +1 -1
  88. package/dist/gatewayFacades.d.ts +27 -45
  89. package/dist/gatewayFacades.js +92 -118
  90. package/dist/gatewayFacades.js.map +1 -1
  91. package/dist/graphAnalysisClient.js +31 -12
  92. package/dist/graphAnalysisClient.js.map +1 -1
  93. package/dist/graphClient.d.ts +5 -13
  94. package/dist/graphClient.js +42 -35
  95. package/dist/graphClient.js.map +1 -1
  96. package/dist/graphRecommendationsClient.js +31 -13
  97. package/dist/graphRecommendationsClient.js.map +1 -1
  98. package/dist/graphStateClassifierClient.js +37 -15
  99. package/dist/graphStateClassifierClient.js.map +1 -1
  100. package/dist/harnessClient.d.ts +13 -24
  101. package/dist/harnessClient.js +38 -37
  102. package/dist/harnessClient.js.map +1 -1
  103. package/dist/identityClient.d.ts +8 -8
  104. package/dist/identityClient.js +48 -31
  105. package/dist/identityClient.js.map +1 -1
  106. package/dist/index.d.ts +2 -2
  107. package/dist/index.js +647 -853
  108. package/dist/index.js.map +1 -1
  109. package/dist/infisicalRuntime.js +47 -24
  110. package/dist/infisicalRuntime.js.map +1 -1
  111. package/dist/jobsClient.js +37 -15
  112. package/dist/jobsClient.js.map +1 -1
  113. package/dist/learningClient.d.ts +6 -6
  114. package/dist/learningClient.js +55 -39
  115. package/dist/learningClient.js.map +1 -1
  116. package/dist/lenses/index.d.ts +29 -35
  117. package/dist/lenses/index.js +543 -776
  118. package/dist/lenses/index.js.map +1 -1
  119. package/dist/mcpClient.js +26 -8
  120. package/dist/mcpClient.js.map +1 -1
  121. package/dist/modelRuntimeClient.js +37 -14
  122. package/dist/modelRuntimeClient.js.map +1 -1
  123. package/dist/nodes/index.d.ts +17 -17
  124. package/dist/nodes/index.js +543 -776
  125. package/dist/nodes/index.js.map +1 -1
  126. package/dist/ontologies/index.d.ts +31 -30
  127. package/dist/ontologies/index.js +543 -776
  128. package/dist/ontologies/index.js.map +1 -1
  129. package/dist/ontologyClient.d.ts +17 -25
  130. package/dist/ontologyClient.js +63 -37
  131. package/dist/ontologyClient.js.map +1 -1
  132. package/dist/ontologyLinksClient.js +37 -15
  133. package/dist/ontologyLinksClient.js.map +1 -1
  134. package/dist/orgGraphSearchClient.js +30 -10
  135. package/dist/orgGraphSearchClient.js.map +1 -1
  136. package/dist/packsClient.d.ts +9 -23
  137. package/dist/packsClient.js +39 -43
  138. package/dist/packsClient.js.map +1 -1
  139. package/dist/policyClient.d.ts +11 -10
  140. package/dist/policyClient.js +48 -22
  141. package/dist/policyClient.js.map +1 -1
  142. package/dist/questions/index.d.ts +2 -2
  143. package/dist/questions/index.js +543 -776
  144. package/dist/questions/index.js.map +1 -1
  145. package/dist/realtime/index.d.ts +1 -1
  146. package/dist/reportsClient.d.ts +7 -7
  147. package/dist/reportsClient.js +84 -48
  148. package/dist/reportsClient.js.map +1 -1
  149. package/dist/schemaClient.d.ts +3 -3
  150. package/dist/schemaClient.js +40 -26
  151. package/dist/schemaClient.js.map +1 -1
  152. package/dist/sdkSurface.d.ts +6 -3
  153. package/dist/sdkSurface.js +10 -6
  154. package/dist/sdkSurface.js.map +1 -1
  155. package/dist/sourcesClient.js +27 -11
  156. package/dist/sourcesClient.js.map +1 -1
  157. package/dist/telemetryClient.js +37 -15
  158. package/dist/telemetryClient.js.map +1 -1
  159. package/dist/toolRegistryClient.d.ts +10 -2
  160. package/dist/toolRegistryClient.js +50 -16
  161. package/dist/toolRegistryClient.js.map +1 -1
  162. package/dist/topics/index.d.ts +5 -5
  163. package/dist/topics/index.js +543 -776
  164. package/dist/topics/index.js.map +1 -1
  165. package/dist/topicsClient.js +37 -16
  166. package/dist/topicsClient.js.map +1 -1
  167. package/dist/version.d.ts +1 -1
  168. package/dist/version.js +1 -1
  169. package/dist/version.js.map +1 -1
  170. package/dist/workflowClient.d.ts +15 -33
  171. package/dist/workflowClient.js +43 -50
  172. package/dist/workflowClient.js.map +1 -1
  173. package/dist/worktrees/index.d.ts +22 -30
  174. package/dist/worktrees/index.js +543 -776
  175. package/dist/worktrees/index.js.map +1 -1
  176. package/package.json +4 -4
@@ -239,9 +239,7 @@ function generatePortableRequestId() {
239
239
  8
240
240
  ).join("")}-${hex.slice(8, 10).join("")}-${hex.slice(10).join("")}`;
241
241
  }
242
- function randomIdempotencyKey() {
243
- return generatePortableRequestId();
244
- }
242
+ var randomIdempotencyKey = generatePortableRequestId;
245
243
  function isRetryableStatus(status) {
246
244
  return status >= 500 || status === 408 || status === 429;
247
245
  }
@@ -306,8 +304,11 @@ function timeoutError(timeoutMs) {
306
304
  error.name = "AbortError";
307
305
  return error;
308
306
  }
307
+ function isRecord(value) {
308
+ return value !== null && typeof value === "object" && !Array.isArray(value);
309
+ }
309
310
  function readPolicySummaryFromDetails(details) {
310
- if (!details || typeof details !== "object" || Array.isArray(details)) {
311
+ if (!isRecord(details)) {
311
312
  return null;
312
313
  }
313
314
  const directSummary = details.summary;
@@ -315,11 +316,11 @@ function readPolicySummaryFromDetails(details) {
315
316
  return directSummary.trim();
316
317
  }
317
318
  const policy = details.policy;
318
- if (!policy || typeof policy !== "object" || Array.isArray(policy)) {
319
+ if (!isRecord(policy)) {
319
320
  return null;
320
321
  }
321
322
  const explanation = policy.explanation;
322
- if (!explanation || typeof explanation !== "object" || Array.isArray(explanation)) {
323
+ if (!isRecord(explanation)) {
323
324
  return null;
324
325
  }
325
326
  const nestedSummary = explanation.summary;
@@ -383,11 +384,11 @@ function createGatewayRequestClient(config = {}) {
383
384
  if (!text) {
384
385
  return null;
385
386
  }
386
- try {
387
- return JSON.parse(text);
388
- } catch {
387
+ const parsed = tryParseGatewayEnvelopeJson(text);
388
+ if (!parsed.ok) {
389
389
  return null;
390
390
  }
391
+ return isRecord(parsed.value) ? parsed.value : null;
391
392
  }
392
393
  function resolveTimeoutMs(method, requestTimeoutMs) {
393
394
  if (typeof requestTimeoutMs === "number") {
@@ -399,16 +400,31 @@ function createGatewayRequestClient(config = {}) {
399
400
  }
400
401
  return config.timeoutMs ?? 15e3;
401
402
  }
403
+ function tryParseGatewayEnvelopeJson(text) {
404
+ const trimmed = text.trim();
405
+ if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) {
406
+ return { ok: false, reason: "non-json" };
407
+ }
408
+ try {
409
+ return { ok: true, value: JSON.parse(trimmed) };
410
+ } catch (error) {
411
+ if (error instanceof SyntaxError) {
412
+ return { ok: false, reason: "invalid-json", error };
413
+ }
414
+ throw error;
415
+ }
416
+ }
402
417
  function buildApiError(args) {
403
418
  const failure = args.failure;
404
- const legacyError = failure && typeof failure.error === "object" && failure.error !== null ? failure.error : failure?.legacyError;
419
+ const legacyError = failure && isRecord(failure.error) ? failure.error : failure?.legacyError;
405
420
  const correlationId = failure?.correlationId ?? args.response.headers.get("x-lucern-correlation-id")?.trim() ?? args.requestId;
406
421
  const policyTraceId = failure?.policyTraceId ?? args.response.headers.get("x-lucern-policy-trace-id")?.trim() ?? null;
407
422
  const details = failure?.details ?? legacyError?.details;
408
423
  const policySummary = readPolicySummaryFromDetails(details);
424
+ const failureMessage = typeof failure?.error === "string" ? failure.error : legacyError?.message;
409
425
  return new LucernApiError({
410
426
  code: failure?.code ?? legacyError?.code ?? fallbackErrorCode(args.response.status),
411
- message: policySummary ?? (typeof failure?.error === "string" ? failure.error : legacyError?.message ?? (args.response.ok ? "Platform API returned an invalid success payload." : "Platform API request failed.")),
427
+ message: policySummary ?? failureMessage ?? (args.response.ok ? "Platform API returned an invalid success payload." : "Platform API request failed."),
412
428
  status: args.response.status,
413
429
  invariant: failure?.invariant,
414
430
  suggestion: failure?.suggestion,
@@ -534,8 +550,11 @@ function createGatewayRequestClient(config = {}) {
534
550
  }
535
551
 
536
552
  // src/sdkSurface.ts
553
+ function isRecord2(value) {
554
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
555
+ }
537
556
  function asRecord(value) {
538
- return value && typeof value === "object" ? value : {};
557
+ return isRecord2(value) ? value : {};
539
558
  }
540
559
  function cleanString2(value) {
541
560
  return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
@@ -596,9 +615,7 @@ function normalizeNodeWriteInput(value) {
596
615
  }
597
616
  return next;
598
617
  }
599
- function normalizeNodeVerificationStatus(value) {
600
- return normalizeVerificationStatus(value);
601
- }
618
+ var normalizeNodeVerificationStatus = normalizeVerificationStatus;
602
619
  function normalizeTopicQuery(value) {
603
620
  const topicId = cleanString2(value.topicId);
604
621
  if (!topicId) {
@@ -625,7 +642,10 @@ function createListResult(items, legacyKey) {
625
642
  total: items.length
626
643
  };
627
644
  if (legacyKey) {
628
- result[legacyKey] = items;
645
+ return {
646
+ ...result,
647
+ [legacyKey]: items
648
+ };
629
649
  }
630
650
  return result;
631
651
  }
@@ -669,6 +689,17 @@ function asTenantVaultSecretArray(data) {
669
689
  }
670
690
  function createAdminClient(config = {}) {
671
691
  const gateway = createGatewayRequestClient(config);
692
+ const getControlObjectOwnership = async () => gateway.request({
693
+ path: "/api/platform/v1/admin/control-ownership"
694
+ });
695
+ const createMembership = async (input, idempotencyKey) => gateway.request({
696
+ path: "/api/platform/v1/memberships",
697
+ method: "POST",
698
+ body: input,
699
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
700
+ });
701
+ const updateMembership = createMembership;
702
+ const upsertMembership = createMembership;
672
703
  return {
673
704
  /**
674
705
  * List tenants visible to the current principal.
@@ -700,19 +731,11 @@ function createAdminClient(config = {}) {
700
731
  /**
701
732
  * Get the control-object ownership contract.
702
733
  */
703
- async getControlObjectOwnership() {
704
- return gateway.request({
705
- path: "/api/platform/v1/admin/control-ownership"
706
- });
707
- },
734
+ getControlObjectOwnership,
708
735
  /**
709
736
  * @deprecated Use getControlObjectOwnership.
710
737
  */
711
- async getControlObjectOwnershipContract() {
712
- return gateway.request({
713
- path: "/api/platform/v1/admin/control-ownership"
714
- });
715
- },
738
+ getControlObjectOwnershipContract: getControlObjectOwnership,
716
739
  /**
717
740
  * List workspaces for the current admin scope.
718
741
  */
@@ -759,26 +782,15 @@ function createAdminClient(config = {}) {
759
782
  /**
760
783
  * Create a membership.
761
784
  */
762
- async createMembership(input, idempotencyKey) {
763
- return gateway.request({
764
- path: "/api/platform/v1/memberships",
765
- method: "POST",
766
- body: input,
767
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
768
- });
769
- },
785
+ createMembership,
770
786
  /**
771
787
  * Update a membership.
772
788
  */
773
- async updateMembership(input, idempotencyKey) {
774
- return this.createMembership(input, idempotencyKey);
775
- },
789
+ updateMembership,
776
790
  /**
777
791
  * @deprecated Use createMembership or updateMembership.
778
792
  */
779
- async upsertMembership(input, idempotencyKey) {
780
- return this.createMembership(input, idempotencyKey);
781
- },
793
+ upsertMembership,
782
794
  /**
783
795
  * List tenant API keys in the current admin scope.
784
796
  */
@@ -1060,115 +1072,111 @@ function createAnswersClient(config = {}) {
1060
1072
  // src/audiencesClient.ts
1061
1073
  function createAudiencesClient(config = {}) {
1062
1074
  const gateway = createGatewayRequestClient(config);
1075
+ const listRegistry = async (query5 = {}) => {
1076
+ return gateway.request({
1077
+ path: `/api/platform/v1/audiences/registry${toQueryString({
1078
+ ...query5,
1079
+ effective: typeof query5.effective === "boolean" ? query5.effective ? "true" : "false" : void 0,
1080
+ status: query5.status
1081
+ })}`
1082
+ }).then(
1083
+ (response) => mapGatewayData(
1084
+ response,
1085
+ (data) => createListResult(Array.isArray(data) ? data : [], "registryEntries")
1086
+ )
1087
+ );
1088
+ };
1089
+ const createRegistryEntry = async (input, idempotencyKey) => {
1090
+ return gateway.request({
1091
+ path: "/api/platform/v1/audiences/registry",
1092
+ method: "POST",
1093
+ body: input,
1094
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1095
+ });
1096
+ };
1097
+ const updateRegistryEntry = createRegistryEntry;
1098
+ const upsertRegistry = createRegistryEntry;
1099
+ const getRegistry = listRegistry;
1100
+ const listGrants = async (query5 = {}) => {
1101
+ return gateway.request({
1102
+ path: `/api/platform/v1/audiences/grants${toQueryString({
1103
+ ...query5,
1104
+ audienceKey: query5.audienceKey,
1105
+ principalId: query5.principalId,
1106
+ groupId: query5.groupId,
1107
+ status: query5.status
1108
+ })}`
1109
+ }).then(
1110
+ (response) => mapGatewayData(
1111
+ response,
1112
+ (data) => createListResult(Array.isArray(data) ? data : [], "grants")
1113
+ )
1114
+ );
1115
+ };
1116
+ const createGrant = async (input, idempotencyKey) => {
1117
+ return gateway.request({
1118
+ path: "/api/platform/v1/audiences/grants",
1119
+ method: "POST",
1120
+ body: input,
1121
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1122
+ });
1123
+ };
1124
+ const getGrants = listGrants;
1125
+ const grant = createGrant;
1126
+ const deleteGrant = async (input, idempotencyKey) => {
1127
+ return gateway.request({
1128
+ path: "/api/platform/v1/audiences/grants/revoke",
1129
+ method: "POST",
1130
+ body: input,
1131
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1132
+ });
1133
+ };
1134
+ const revokeGrant = deleteGrant;
1063
1135
  return {
1064
1136
  /**
1065
1137
  * List audience registry entries.
1066
1138
  */
1067
- async listRegistry(query5 = {}) {
1068
- return gateway.request({
1069
- path: `/api/platform/v1/audiences/registry${toQueryString({
1070
- ...query5,
1071
- effective: typeof query5.effective === "boolean" ? query5.effective ? "true" : "false" : void 0,
1072
- status: query5.status
1073
- })}`
1074
- }).then(
1075
- (response) => mapGatewayData(
1076
- response,
1077
- (data) => createListResult(
1078
- Array.isArray(data) ? data : [],
1079
- "registryEntries"
1080
- )
1081
- )
1082
- );
1083
- },
1139
+ listRegistry,
1084
1140
  /**
1085
1141
  * @deprecated Use listRegistry.
1086
1142
  */
1087
- async getRegistry(query5 = {}) {
1088
- return this.listRegistry(query5);
1089
- },
1143
+ getRegistry,
1090
1144
  /**
1091
1145
  * Create an audience registry entry.
1092
1146
  */
1093
- async createRegistryEntry(input, idempotencyKey) {
1094
- return gateway.request({
1095
- path: "/api/platform/v1/audiences/registry",
1096
- method: "POST",
1097
- body: input,
1098
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1099
- });
1100
- },
1147
+ createRegistryEntry,
1101
1148
  /**
1102
1149
  * Update an audience registry entry.
1103
1150
  */
1104
- async updateRegistryEntry(input, idempotencyKey) {
1105
- return this.createRegistryEntry(input, idempotencyKey);
1106
- },
1151
+ updateRegistryEntry,
1107
1152
  /**
1108
1153
  * @deprecated Use createRegistryEntry or updateRegistryEntry.
1109
1154
  */
1110
- async upsertRegistry(input, idempotencyKey) {
1111
- return this.createRegistryEntry(input, idempotencyKey);
1112
- },
1155
+ upsertRegistry,
1113
1156
  /**
1114
1157
  * List audience grants.
1115
1158
  */
1116
- async listGrants(query5 = {}) {
1117
- return gateway.request({
1118
- path: `/api/platform/v1/audiences/grants${toQueryString({
1119
- ...query5,
1120
- audienceKey: query5.audienceKey,
1121
- principalId: query5.principalId,
1122
- groupId: query5.groupId,
1123
- status: query5.status
1124
- })}`
1125
- }).then(
1126
- (response) => mapGatewayData(
1127
- response,
1128
- (data) => createListResult(Array.isArray(data) ? data : [], "grants")
1129
- )
1130
- );
1131
- },
1159
+ listGrants,
1132
1160
  /**
1133
1161
  * @deprecated Use listGrants.
1134
1162
  */
1135
- async getGrants(query5 = {}) {
1136
- return this.listGrants(query5);
1137
- },
1163
+ getGrants,
1138
1164
  /**
1139
1165
  * Create an audience grant.
1140
1166
  */
1141
- async createGrant(input, idempotencyKey) {
1142
- return gateway.request({
1143
- path: "/api/platform/v1/audiences/grants",
1144
- method: "POST",
1145
- body: input,
1146
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1147
- });
1148
- },
1167
+ createGrant,
1149
1168
  /**
1150
1169
  * @deprecated Use createGrant.
1151
1170
  */
1152
- async grant(input, idempotencyKey) {
1153
- return this.createGrant(input, idempotencyKey);
1154
- },
1171
+ grant,
1155
1172
  /**
1156
1173
  * Delete an audience grant by revoking it.
1157
1174
  */
1158
- async deleteGrant(input, idempotencyKey) {
1159
- return gateway.request({
1160
- path: "/api/platform/v1/audiences/grants/revoke",
1161
- method: "POST",
1162
- body: input,
1163
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1164
- });
1165
- },
1175
+ deleteGrant,
1166
1176
  /**
1167
1177
  * @deprecated Use deleteGrant.
1168
1178
  */
1169
- async revokeGrant(input, idempotencyKey) {
1170
- return this.deleteGrant(input, idempotencyKey);
1171
- }
1179
+ revokeGrant
1172
1180
  };
1173
1181
  }
1174
1182
 
@@ -1209,8 +1217,18 @@ function authBaseUrl(config) {
1209
1217
  return config.baseUrl?.replace(/\/+$/, "") ?? "";
1210
1218
  }
1211
1219
  async function readJson(response) {
1212
- const payload = await response.json().catch(() => ({}));
1213
- return payload && typeof payload === "object" && !Array.isArray(payload) ? payload : {};
1220
+ try {
1221
+ const payload = await response.json();
1222
+ return isRecord3(payload) ? payload : {};
1223
+ } catch (error) {
1224
+ return unreadableJsonBodyFallback();
1225
+ }
1226
+ }
1227
+ function unreadableJsonBodyFallback(_error) {
1228
+ return {};
1229
+ }
1230
+ function isRecord3(value) {
1231
+ return value !== null && typeof value === "object" && !Array.isArray(value);
1214
1232
  }
1215
1233
  function readString(value) {
1216
1234
  const normalized = typeof value === "string" ? value.trim() : "";
@@ -1252,7 +1270,10 @@ function assertDeviceTokenResponse(payload) {
1252
1270
  tenant_id: tenantId,
1253
1271
  workspace_id: readString(payload.workspace_id),
1254
1272
  principal_id: principalId,
1255
- user: payload.user && typeof payload.user === "object" && !Array.isArray(payload.user) ? payload.user : void 0
1273
+ user: isRecord3(payload.user) && typeof payload.user.id === "string" && typeof payload.user.principalId === "string" ? {
1274
+ id: payload.user.id,
1275
+ principalId: payload.user.principalId
1276
+ } : void 0
1256
1277
  };
1257
1278
  }
1258
1279
  function maybeThrowDeviceError(payload) {
@@ -1400,12 +1421,12 @@ function createBeliefsClient(config = {}) {
1400
1421
  body: normalizeModulateConfidenceInput(input),
1401
1422
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1402
1423
  });
1403
- async function getOpinionHistory(beliefId) {
1424
+ const getOpinionHistory = async (beliefId) => {
1404
1425
  const response = await gateway.request({
1405
1426
  path: `/api/platform/v1/beliefs/${encodeURIComponent(beliefId)}/confidence-history`
1406
1427
  });
1407
1428
  return mapOpinionHistoryEntriesFromGatewayData(response.data);
1408
- }
1429
+ };
1409
1430
  return {
1410
1431
  /**
1411
1432
  * Create a belief within a topic scope.
@@ -1450,13 +1471,9 @@ function createBeliefsClient(config = {}) {
1450
1471
  * trigger = cause of the score change
1451
1472
  * triggeringRef = optional pointer to the evidence or worktree that drove the change
1452
1473
  */
1453
- async getOpinionHistory(beliefId) {
1454
- return getOpinionHistory(beliefId);
1455
- },
1474
+ getOpinionHistory,
1456
1475
  /** @deprecated Use getOpinionHistory(). */
1457
- async getConfidenceHistory(beliefId) {
1458
- return getOpinionHistory(beliefId);
1459
- },
1476
+ getConfidenceHistory: getOpinionHistory,
1460
1477
  /**
1461
1478
  * Fork a scored belief into a new formulation.
1462
1479
  */
@@ -1604,6 +1621,9 @@ function cleanOptionalString(value) {
1604
1621
  const normalized = value?.trim();
1605
1622
  return normalized ? normalized : void 0;
1606
1623
  }
1624
+ function isRecord4(value) {
1625
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
1626
+ }
1607
1627
  function cleanRequiredString(value, label) {
1608
1628
  const normalized = cleanOptionalString(value);
1609
1629
  if (!normalized) {
@@ -1643,9 +1663,10 @@ function topicPayload(input, allowed, operation) {
1643
1663
  };
1644
1664
  }
1645
1665
  function listResultFromEnvelope(data, legacyKey) {
1646
- const record = data && typeof data === "object" ? data : {};
1666
+ const record = isRecord4(data) ? data : {};
1667
+ const legacyItems = record[legacyKey];
1647
1668
  return createListResult(
1648
- Array.isArray(record[legacyKey]) ? record[legacyKey] : Array.isArray(data) ? data : [],
1669
+ Array.isArray(legacyItems) ? legacyItems : Array.isArray(data) ? data : [],
1649
1670
  legacyKey
1650
1671
  );
1651
1672
  }
@@ -2017,7 +2038,7 @@ async function invokeRegisteredCustomTool(fullName, params, context) {
2017
2038
  // src/ontologyClient.ts
2018
2039
  function createOntologyClient(config = {}) {
2019
2040
  const gateway = createGatewayRequestClient(config);
2020
- return {
2041
+ const client = {
2021
2042
  /**
2022
2043
  * List ontology definitions matching optional filters.
2023
2044
  */
@@ -2026,13 +2047,14 @@ function createOntologyClient(config = {}) {
2026
2047
  path: `/api/platform/v1/ontologies${toQueryString(filters)}`
2027
2048
  }).then(
2028
2049
  (response) => mapGatewayData(response, (data) => {
2029
- const record = data && typeof data === "object" && !Array.isArray(data) ? data : {};
2030
- const ontologies = Array.isArray(record.ontologies) ? record.ontologies : Array.isArray(record.definitions) ? record.definitions : Array.isArray(data) ? data : [];
2031
- const total = typeof record.total === "number" && Number.isFinite(record.total) ? record.total : ontologies.length;
2050
+ const record = asRecord(data);
2051
+ const ontologies = asListItems(data, "ontologies");
2052
+ const definitions = ontologies.length > 0 ? ontologies : asListItems(data, "definitions");
2053
+ const total = typeof record.total === "number" && Number.isFinite(record.total) ? record.total : definitions.length;
2032
2054
  return {
2033
2055
  ...record,
2034
- ...createListResult(ontologies, "definitions"),
2035
- ontologies,
2056
+ ...createListResult(definitions, "definitions"),
2057
+ ontologies: definitions,
2036
2058
  total
2037
2059
  };
2038
2060
  })
@@ -2059,18 +2081,6 @@ function createOntologyClient(config = {}) {
2059
2081
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
2060
2082
  });
2061
2083
  },
2062
- /**
2063
- * List ontology definitions.
2064
- */
2065
- async listDefinitions(filters = {}) {
2066
- return this.list(filters);
2067
- },
2068
- /**
2069
- * Get an ontology definition.
2070
- */
2071
- async getDefinition(id) {
2072
- return this.get(id);
2073
- },
2074
2084
  /**
2075
2085
  * Create an ontology definition.
2076
2086
  */
@@ -2112,7 +2122,7 @@ function createOntologyClient(config = {}) {
2112
2122
  }).then(
2113
2123
  (response) => mapGatewayData(
2114
2124
  response,
2115
- (data) => createListResult(Array.isArray(data) ? data : [], "versions")
2125
+ (data) => createListResult(asListItems(data, "versions"), "versions")
2116
2126
  )
2117
2127
  );
2118
2128
  },
@@ -2160,20 +2170,19 @@ function createOntologyClient(config = {}) {
2160
2170
  (data) => createListResult(Array.isArray(data) ? data : [], "topics")
2161
2171
  )
2162
2172
  );
2163
- },
2164
- /**
2165
- * @deprecated Use listTopics.
2166
- */
2167
- async listTopicsByOntology(ontologyId) {
2168
- return this.listTopics(ontologyId);
2169
2173
  }
2170
2174
  };
2175
+ return Object.assign(client, {
2176
+ listDefinitions: client.list,
2177
+ getDefinition: client.get,
2178
+ listTopicsByOntology: client.listTopics
2179
+ });
2171
2180
  }
2172
2181
 
2173
2182
  // src/graphClient.ts
2174
2183
  function createGraphClient(config = {}) {
2175
2184
  const gateway = createGatewayRequestClient(config);
2176
- return {
2185
+ const client = {
2177
2186
  /**
2178
2187
  * List graph nodes matching the provided filters.
2179
2188
  */
@@ -2186,12 +2195,6 @@ function createGraphClient(config = {}) {
2186
2195
  (response) => mapGatewayData(response, (data) => mapAliasedList(data, "nodes"))
2187
2196
  );
2188
2197
  },
2189
- /**
2190
- * @deprecated Use listNodes.
2191
- */
2192
- async queryNodes(query5) {
2193
- return this.listNodes(query5);
2194
- },
2195
2198
  /**
2196
2199
  * Retrieve a single graph node by nodeId or globalId.
2197
2200
  */
@@ -2302,12 +2305,6 @@ function createGraphClient(config = {}) {
2302
2305
  )
2303
2306
  );
2304
2307
  },
2305
- /**
2306
- * @deprecated Use listEdges.
2307
- */
2308
- async queryEdges(query5) {
2309
- return this.listEdges(query5);
2310
- },
2311
2308
  /**
2312
2309
  * Create a graph edge.
2313
2310
  */
@@ -2395,12 +2392,6 @@ function createGraphClient(config = {}) {
2395
2392
  body: normalizeTopicQuery(query5)
2396
2393
  });
2397
2394
  },
2398
- /**
2399
- * Retrieve a graph neighborhood around a root node.
2400
- */
2401
- async getNeighborhood(query5) {
2402
- return this.neighborhood(query5);
2403
- },
2404
2395
  /**
2405
2396
  * Retrieve the shortest known path between two graph nodes.
2406
2397
  */
@@ -2418,6 +2409,11 @@ function createGraphClient(config = {}) {
2418
2409
  });
2419
2410
  }
2420
2411
  };
2412
+ return Object.assign(client, {
2413
+ queryNodes: client.listNodes,
2414
+ queryEdges: client.listEdges,
2415
+ getNeighborhood: client.neighborhood
2416
+ });
2421
2417
  }
2422
2418
 
2423
2419
  // src/identityClient.ts
@@ -2471,6 +2467,13 @@ function createIdentityClient(config = {}) {
2471
2467
  body: input,
2472
2468
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
2473
2469
  });
2470
+ const updatePrincipal = (input, idempotencyKey) => requestPrincipalWrite("PATCH", input, idempotencyKey);
2471
+ const deleteKey = (keyId, input = {}, idempotencyKey) => gateway.request({
2472
+ path: `/api/platform/v1/identity/keys/${encodeURIComponent(keyId)}/revoke`,
2473
+ method: "POST",
2474
+ body: input,
2475
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
2476
+ });
2474
2477
  return {
2475
2478
  /**
2476
2479
  * Resolve the current authenticated identity summary.
@@ -2519,15 +2522,11 @@ function createIdentityClient(config = {}) {
2519
2522
  /**
2520
2523
  * Update a principal.
2521
2524
  */
2522
- async updatePrincipal(input, idempotencyKey) {
2523
- return requestPrincipalWrite("PATCH", input, idempotencyKey);
2524
- },
2525
+ updatePrincipal,
2525
2526
  /**
2526
2527
  * @deprecated Use createPrincipal or updatePrincipal.
2527
2528
  */
2528
- async upsertPrincipal(input, idempotencyKey) {
2529
- return requestPrincipalWrite("PATCH", input, idempotencyKey);
2530
- },
2529
+ upsertPrincipal: updatePrincipal,
2531
2530
  /**
2532
2531
  * List keys in the current identity scope.
2533
2532
  */
@@ -2566,20 +2565,11 @@ function createIdentityClient(config = {}) {
2566
2565
  /**
2567
2566
  * Delete an API key by revoking it.
2568
2567
  */
2569
- async deleteKey(keyId, input = {}, idempotencyKey) {
2570
- return gateway.request({
2571
- path: `/api/platform/v1/identity/keys/${encodeURIComponent(keyId)}/revoke`,
2572
- method: "POST",
2573
- body: input,
2574
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
2575
- });
2576
- },
2568
+ deleteKey,
2577
2569
  /**
2578
2570
  * @deprecated Use deleteKey.
2579
2571
  */
2580
- async revokeKey(keyId, input = {}, idempotencyKey) {
2581
- return this.deleteKey(keyId, input, idempotencyKey);
2582
- },
2572
+ revokeKey: deleteKey,
2583
2573
  /**
2584
2574
  * Search Clerk users by email or display attributes.
2585
2575
  */
@@ -2695,14 +2685,11 @@ function createIdentityClient(config = {}) {
2695
2685
  }
2696
2686
 
2697
2687
  // src/topicsClient.ts
2698
- function asRecord3(value) {
2699
- return value && typeof value === "object" ? value : {};
2700
- }
2701
2688
  function cleanString3(value) {
2702
2689
  return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
2703
2690
  }
2704
2691
  function normalizeTopicRecord(value) {
2705
- const record = asRecord3(value);
2692
+ const record = asRecord(value);
2706
2693
  const topicId = cleanString3(record.topicId) ?? cleanString3(record.id) ?? cleanString3(record._id);
2707
2694
  return withTopicAlias({
2708
2695
  ...record,
@@ -2727,7 +2714,7 @@ function createTopicsClient(config = {}) {
2727
2714
  })}`
2728
2715
  }).then(
2729
2716
  (response) => mapGatewayData(response, (data) => {
2730
- const record = asRecord3(data);
2717
+ const record = asRecord(data);
2731
2718
  const items = Array.isArray(record.topics) ? record.topics.map(normalizeTopicRecord) : [];
2732
2719
  return {
2733
2720
  ...createListResult(items, "topics"),
@@ -2744,7 +2731,7 @@ function createTopicsClient(config = {}) {
2744
2731
  }).then(
2745
2732
  (response) => mapGatewayData(
2746
2733
  response,
2747
- (data) => normalizeTopicRecord(asRecord3(data).topic ?? data)
2734
+ (data) => normalizeTopicRecord(asRecord(data).topic ?? data)
2748
2735
  )
2749
2736
  );
2750
2737
  },
@@ -2780,7 +2767,7 @@ function createTopicsClient(config = {}) {
2780
2767
  )}`
2781
2768
  }).then(
2782
2769
  (response) => mapGatewayData(response, (data) => {
2783
- const record = asRecord3(data);
2770
+ const record = asRecord(data);
2784
2771
  return {
2785
2772
  tree: Array.isArray(record.tree) ? record.tree.map(normalizeTopicTreeNode) : []
2786
2773
  };
@@ -3199,7 +3186,7 @@ function createEventsFacade(config = {}) {
3199
3186
  function createGraphFacade(config = {}) {
3200
3187
  const graphClient = createGraphClient(config);
3201
3188
  const gateway = createGatewayRequestClient(config);
3202
- return {
3189
+ const graphFacade = {
3203
3190
  async neighborhood(input) {
3204
3191
  return graphClient.neighborhood({
3205
3192
  globalId: input.globalId,
@@ -3207,18 +3194,6 @@ function createGraphFacade(config = {}) {
3207
3194
  maxDepth: input.maxDepth
3208
3195
  });
3209
3196
  },
3210
- async traverse(input) {
3211
- return graphClient.traverse(input);
3212
- },
3213
- async analyze(input = {}) {
3214
- return graphClient.analyze(input);
3215
- },
3216
- async bias(input = {}) {
3217
- return graphClient.bias(input);
3218
- },
3219
- async gaps(input) {
3220
- return graphClient.gaps(input);
3221
- },
3222
3197
  async falsify(input, idempotencyKey = randomIdempotencyKey()) {
3223
3198
  return gateway.request({
3224
3199
  path: "/api/platform/v1/graph/falsify",
@@ -3228,6 +3203,12 @@ function createGraphFacade(config = {}) {
3228
3203
  });
3229
3204
  }
3230
3205
  };
3206
+ return Object.assign(graphFacade, {
3207
+ traverse: graphClient.traverse,
3208
+ analyze: graphClient.analyze,
3209
+ bias: graphClient.bias,
3210
+ gaps: graphClient.gaps
3211
+ });
3231
3212
  }
3232
3213
  function createIdentityFacade(config = {}) {
3233
3214
  const identityClient = createIdentityClient(config);
@@ -3241,15 +3222,12 @@ function createIdentityFacade(config = {}) {
3241
3222
  function createOntologiesFacade(config = {}) {
3242
3223
  const ontologyClient = createOntologyClient(config);
3243
3224
  const gateway = createGatewayRequestClient(config);
3244
- return {
3225
+ const ontologyFacade = {
3245
3226
  async get(id) {
3246
3227
  return gateway.request({
3247
3228
  path: `/api/platform/v1/ontologies/${encodeURIComponent(id)}`
3248
3229
  });
3249
3230
  },
3250
- async list(query5 = {}) {
3251
- return ontologyClient.list(query5);
3252
- },
3253
3231
  async bind(input, idempotencyKey) {
3254
3232
  return gateway.request({
3255
3233
  path: `/api/platform/v1/ontologies/${encodeURIComponent(input.ontologyId)}/bind`,
@@ -3269,6 +3247,9 @@ function createOntologiesFacade(config = {}) {
3269
3247
  });
3270
3248
  }
3271
3249
  };
3250
+ return Object.assign(ontologyFacade, {
3251
+ list: ontologyClient.list
3252
+ });
3272
3253
  }
3273
3254
  function createQuestionsFacade(config = {}) {
3274
3255
  const gateway = createGatewayRequestClient(config);
@@ -3461,15 +3442,9 @@ function createTasksFacade(config = {}) {
3461
3442
  function createTopicsFacade(config = {}) {
3462
3443
  const topicsClient = createTopicsClient(config);
3463
3444
  return {
3464
- async create(input, idempotencyKey) {
3465
- return topicsClient.create(input, idempotencyKey);
3466
- },
3467
- async get(id) {
3468
- return topicsClient.get(id);
3469
- },
3470
- async list(query5 = {}) {
3471
- return topicsClient.list(query5);
3472
- },
3445
+ create: topicsClient.create,
3446
+ get: topicsClient.get,
3447
+ list: topicsClient.list,
3473
3448
  async update(input, idempotencyKey) {
3474
3449
  const { id, ...rest } = input;
3475
3450
  return topicsClient.update(id, rest, idempotencyKey);
@@ -3485,12 +3460,8 @@ function createTopicsFacade(config = {}) {
3485
3460
  maxDepth: input.maxDepth
3486
3461
  });
3487
3462
  },
3488
- async remove(id, idempotencyKey = randomIdempotencyKey()) {
3489
- return topicsClient.remove(id, idempotencyKey);
3490
- },
3491
- async bulkCreate(input, idempotencyKey = randomIdempotencyKey()) {
3492
- return topicsClient.bulkCreate(input, idempotencyKey);
3493
- }
3463
+ remove: topicsClient.remove,
3464
+ bulkCreate: topicsClient.bulkCreate
3494
3465
  };
3495
3466
  }
3496
3467
  function createWebhooksFacade(config = {}) {
@@ -3690,7 +3661,7 @@ function createWorktreesFacade(config = {}) {
3690
3661
  // src/decisionsClient.ts
3691
3662
  function createDecisionsClient(config = {}) {
3692
3663
  const gateway = createGatewayRequestClient(config);
3693
- return {
3664
+ const client = {
3694
3665
  /**
3695
3666
  * List judgments for a topic scope.
3696
3667
  */
@@ -3768,12 +3739,6 @@ function createDecisionsClient(config = {}) {
3768
3739
  })
3769
3740
  );
3770
3741
  },
3771
- /**
3772
- * @deprecated Use listPendingOutcomeReviews.
3773
- */
3774
- async listPendingJudgmentOutcomeReview(query5) {
3775
- return this.listPendingOutcomeReviews(query5);
3776
- },
3777
3742
  /**
3778
3743
  * Get audit integrity checks for judgment transitions.
3779
3744
  */
@@ -3806,12 +3771,6 @@ function createDecisionsClient(config = {}) {
3806
3771
  )
3807
3772
  );
3808
3773
  },
3809
- /**
3810
- * @deprecated Use createJudgment.
3811
- */
3812
- async recordJudgment(input, idempotencyKey) {
3813
- return this.createJudgment(input, idempotencyKey);
3814
- },
3815
3774
  /**
3816
3775
  * Update the outcome for an existing judgment.
3817
3776
  */
@@ -3822,14 +3781,13 @@ function createDecisionsClient(config = {}) {
3822
3781
  body: input,
3823
3782
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
3824
3783
  });
3825
- },
3826
- /**
3827
- * @deprecated Use updateJudgmentOutcome.
3828
- */
3829
- async recordJudgmentOutcome(judgmentId, input, idempotencyKey) {
3830
- return this.updateJudgmentOutcome(judgmentId, input, idempotencyKey);
3831
3784
  }
3832
3785
  };
3786
+ return Object.assign(client, {
3787
+ listPendingJudgmentOutcomeReview: client.listPendingOutcomeReviews,
3788
+ recordJudgment: client.createJudgment,
3789
+ recordJudgmentOutcome: client.updateJudgmentOutcome
3790
+ });
3833
3791
  }
3834
3792
 
3835
3793
  // src/embeddingsClient.ts
@@ -3954,50 +3912,55 @@ function cleanNumber(value) {
3954
3912
  function cleanBoolean(value) {
3955
3913
  return typeof value === "boolean" ? value : void 0;
3956
3914
  }
3957
- function buildCompileContextRequest(topicId, input = {}) {
3958
- const payload = { topicId };
3959
- const query5 = cleanString4(input.query);
3915
+ function buildCompileContextRequest(topicIdOrInput = {}, input = {}) {
3916
+ const effectiveInput = typeof topicIdOrInput === "string" ? input : topicIdOrInput;
3917
+ const payload = {};
3918
+ const topicId = typeof topicIdOrInput === "string" ? cleanString4(topicIdOrInput) : cleanString4(effectiveInput.topicId);
3919
+ if (topicId) {
3920
+ payload.topicId = topicId;
3921
+ }
3922
+ const query5 = cleanString4(effectiveInput.query);
3960
3923
  if (query5) {
3961
3924
  payload.query = query5;
3962
3925
  }
3963
- const budget = cleanNumber(input.budget) ?? cleanNumber(input.tokenBudget);
3926
+ const budget = cleanNumber(effectiveInput.budget) ?? cleanNumber(effectiveInput.tokenBudget);
3964
3927
  if (budget !== void 0) {
3965
3928
  payload.budget = budget;
3966
3929
  }
3967
- const ranking = cleanString4(input.ranking) ?? cleanString4(input.rankingProfile);
3930
+ const ranking = cleanString4(effectiveInput.ranking) ?? cleanString4(effectiveInput.rankingProfile);
3968
3931
  if (ranking) {
3969
3932
  payload.ranking = ranking;
3970
3933
  }
3971
- const limit = cleanNumber(input.limit);
3934
+ const limit = cleanNumber(effectiveInput.limit);
3972
3935
  if (limit !== void 0) {
3973
3936
  payload.limit = limit;
3974
3937
  }
3975
- const maxDepth = cleanNumber(input.maxDepth);
3938
+ const maxDepth = cleanNumber(effectiveInput.maxDepth);
3976
3939
  if (maxDepth !== void 0) {
3977
3940
  payload.maxDepth = maxDepth;
3978
3941
  }
3979
- const includeEntities = cleanBoolean(input.includeEntities);
3942
+ const includeEntities = cleanBoolean(effectiveInput.includeEntities);
3980
3943
  if (includeEntities !== void 0) {
3981
3944
  payload.includeEntities = includeEntities;
3982
3945
  }
3983
- const mode = cleanString4(input.mode);
3946
+ const mode = cleanString4(effectiveInput.mode);
3984
3947
  if (mode) {
3985
3948
  payload.mode = mode;
3986
3949
  }
3987
- const includeFailures = cleanBoolean(input.includeFailures);
3950
+ const includeFailures = cleanBoolean(effectiveInput.includeFailures);
3988
3951
  if (includeFailures !== void 0) {
3989
3952
  payload.includeFailures = includeFailures;
3990
3953
  }
3991
- const worktreeId = cleanString4(input.worktreeId);
3954
+ const worktreeId = cleanString4(effectiveInput.worktreeId);
3992
3955
  if (worktreeId) {
3993
3956
  payload.worktreeId = worktreeId;
3994
3957
  }
3995
- const sessionId = cleanString4(input.sessionId);
3958
+ const sessionId = cleanString4(effectiveInput.sessionId);
3996
3959
  if (sessionId) {
3997
3960
  payload.sessionId = sessionId;
3998
3961
  }
3999
- if (Array.isArray(input.packWeightOverrides) && input.packWeightOverrides.length > 0) {
4000
- payload.packWeightOverrides = input.packWeightOverrides;
3962
+ if (Array.isArray(effectiveInput.packWeightOverrides) && effectiveInput.packWeightOverrides.length > 0) {
3963
+ payload.packWeightOverrides = effectiveInput.packWeightOverrides;
4001
3964
  }
4002
3965
  return {
4003
3966
  path: "/api/platform/v1/context/compile",
@@ -4009,13 +3972,20 @@ function createContextClient(config = {}) {
4009
3972
  const gateway = createGatewayRequestClient(config);
4010
3973
  return {
4011
3974
  /**
4012
- * Compile a focused reasoning context pack for a topic scope.
4013
- * @param topicId - The topic to compile context for.
3975
+ * Compile a focused reasoning context pack.
3976
+ * @param topicIdOrInput - Optional topic ID, or compile input for query-first resolution.
4014
3977
  * @param input - Optional compile parameters (query, budget, ranking, etc.).
4015
3978
  * @returns The compiled context payload with beliefs, questions, and evidence.
4016
3979
  */
4017
- async compile(topicId, input = {}) {
4018
- const request = buildCompileContextRequest(topicId, input);
3980
+ async compile(topicIdOrInput = {}, input = {}) {
3981
+ const request = buildCompileContextRequest(topicIdOrInput, input);
3982
+ return gateway.request({
3983
+ ...request,
3984
+ body: request.body
3985
+ });
3986
+ },
3987
+ async compileByQuery(input = {}) {
3988
+ const request = buildCompileContextRequest(input);
4019
3989
  return gateway.request({
4020
3990
  ...request,
4021
3991
  body: request.body
@@ -4453,7 +4423,7 @@ function createGraphStateClassifierClient(config = {}) {
4453
4423
  // src/harnessClient.ts
4454
4424
  function createHarnessClient(config = {}) {
4455
4425
  const gateway = createGatewayRequestClient(config);
4456
- return {
4426
+ const client = {
4457
4427
  /**
4458
4428
  * List agent definitions.
4459
4429
  */
@@ -4486,12 +4456,6 @@ function createHarnessClient(config = {}) {
4486
4456
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4487
4457
  });
4488
4458
  },
4489
- /**
4490
- * @deprecated Use createAgentDefinition.
4491
- */
4492
- async registerAgentDefinition(input, idempotencyKey) {
4493
- return this.createAgentDefinition(input, idempotencyKey);
4494
- },
4495
4459
  /**
4496
4460
  * Update an agent definition.
4497
4461
  */
@@ -4530,12 +4494,6 @@ function createHarnessClient(config = {}) {
4530
4494
  )
4531
4495
  );
4532
4496
  },
4533
- /**
4534
- * @deprecated Use listAgentRuns.
4535
- */
4536
- async listRunsForAgent(agentId, scope = {}) {
4537
- return this.listAgentRuns(agentId, scope);
4538
- },
4539
4497
  /**
4540
4498
  * List tool definitions.
4541
4499
  */
@@ -4568,12 +4526,6 @@ function createHarnessClient(config = {}) {
4568
4526
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4569
4527
  });
4570
4528
  },
4571
- /**
4572
- * @deprecated Use createToolDefinition.
4573
- */
4574
- async registerToolDefinition(input, idempotencyKey) {
4575
- return this.createToolDefinition(input, idempotencyKey);
4576
- },
4577
4529
  /**
4578
4530
  * Update a tool definition.
4579
4531
  */
@@ -4608,12 +4560,6 @@ function createHarnessClient(config = {}) {
4608
4560
  )
4609
4561
  );
4610
4562
  },
4611
- /**
4612
- * @deprecated Use listRunEntries.
4613
- */
4614
- async listRunLedgerEntries(scope = {}) {
4615
- return this.listRunEntries(scope);
4616
- },
4617
4563
  /**
4618
4564
  * Create a harness run.
4619
4565
  */
@@ -4688,6 +4634,12 @@ function createHarnessClient(config = {}) {
4688
4634
  });
4689
4635
  }
4690
4636
  };
4637
+ return Object.assign(client, {
4638
+ registerAgentDefinition: client.createAgentDefinition,
4639
+ listRunsForAgent: client.listAgentRuns,
4640
+ registerToolDefinition: client.createToolDefinition,
4641
+ listRunLedgerEntries: client.listRunEntries
4642
+ });
4691
4643
  }
4692
4644
 
4693
4645
  // src/jobsClient.ts
@@ -4815,45 +4767,41 @@ function createJobsClient(config = {}) {
4815
4767
  // src/learningClient.ts
4816
4768
  function createLearningClient(config = {}) {
4817
4769
  const gateway = createGatewayRequestClient(config);
4770
+ const listRecentExecutions = async (args = {}) => gateway.request({
4771
+ path: `/api/platform/v1/learning/executions/recent${toQueryString({
4772
+ ...normalizeTopicQuery(args),
4773
+ namespace: args.namespace,
4774
+ audienceMode: args.audienceMode,
4775
+ success: typeof args.success === "boolean" ? args.success ? "true" : "false" : void 0,
4776
+ limit: typeof args.limit === "number" && Number.isFinite(args.limit) ? String(args.limit) : void 0
4777
+ })}`
4778
+ }).then(
4779
+ (response) => mapGatewayData(
4780
+ response,
4781
+ (data) => createListResult(Array.isArray(data) ? data : [], "executions")
4782
+ )
4783
+ );
4784
+ const getExecutionStats = async (args = {}) => gateway.request({
4785
+ path: `/api/platform/v1/learning/executions/stats${toQueryString({
4786
+ ...normalizeTopicQuery(args),
4787
+ namespace: args.namespace,
4788
+ audienceMode: args.audienceMode,
4789
+ hours: typeof args.hours === "number" && Number.isFinite(args.hours) ? String(args.hours) : void 0
4790
+ })}`
4791
+ });
4818
4792
  return {
4819
4793
  /**
4820
4794
  * List recent execution records.
4821
4795
  */
4822
- async listRecentExecutions(args = {}) {
4823
- return gateway.request({
4824
- path: `/api/platform/v1/learning/executions/recent${toQueryString({
4825
- ...normalizeTopicQuery(args),
4826
- namespace: args.namespace,
4827
- audienceMode: args.audienceMode,
4828
- success: typeof args.success === "boolean" ? args.success ? "true" : "false" : void 0,
4829
- limit: typeof args.limit === "number" && Number.isFinite(args.limit) ? String(args.limit) : void 0
4830
- })}`
4831
- }).then(
4832
- (response) => mapGatewayData(
4833
- response,
4834
- (data) => createListResult(Array.isArray(data) ? data : [], "executions")
4835
- )
4836
- );
4837
- },
4796
+ listRecentExecutions,
4838
4797
  /**
4839
4798
  * @deprecated Use listRecentExecutions.
4840
4799
  */
4841
- async getRecentExecutions(args = {}) {
4842
- return this.listRecentExecutions(args);
4843
- },
4800
+ getRecentExecutions: listRecentExecutions,
4844
4801
  /**
4845
4802
  * Get aggregate execution statistics.
4846
4803
  */
4847
- async getExecutionStats(args = {}) {
4848
- return gateway.request({
4849
- path: `/api/platform/v1/learning/executions/stats${toQueryString({
4850
- ...normalizeTopicQuery(args),
4851
- namespace: args.namespace,
4852
- audienceMode: args.audienceMode,
4853
- hours: typeof args.hours === "number" && Number.isFinite(args.hours) ? String(args.hours) : void 0
4854
- })}`
4855
- });
4856
- }
4804
+ getExecutionStats
4857
4805
  };
4858
4806
  }
4859
4807
  function toJsonValue(value) {
@@ -5767,7 +5715,7 @@ function createOrgGraphSearchClient(config = {}) {
5767
5715
  // src/packsClient.ts
5768
5716
  function createPacksClient(config = {}) {
5769
5717
  const gateway = createGatewayRequestClient(config);
5770
- return {
5718
+ const client = {
5771
5719
  /**
5772
5720
  * List catalog entries for available packs.
5773
5721
  */
@@ -5781,12 +5729,6 @@ function createPacksClient(config = {}) {
5781
5729
  )
5782
5730
  );
5783
5731
  },
5784
- /**
5785
- * @deprecated Use listCatalog.
5786
- */
5787
- async getCatalog() {
5788
- return this.listCatalog();
5789
- },
5790
5732
  /**
5791
5733
  * Get the discovery catalog for packs.
5792
5734
  */
@@ -5816,12 +5758,6 @@ function createPacksClient(config = {}) {
5816
5758
  )
5817
5759
  );
5818
5760
  },
5819
- /**
5820
- * @deprecated Use listStates.
5821
- */
5822
- async getStates(query5 = {}) {
5823
- return this.listStates(query5);
5824
- },
5825
5761
  /**
5826
5762
  * Get health details for a pack.
5827
5763
  */
@@ -5845,12 +5781,6 @@ function createPacksClient(config = {}) {
5845
5781
  )
5846
5782
  );
5847
5783
  },
5848
- /**
5849
- * @deprecated Use listTelemetry.
5850
- */
5851
- async getTelemetry(query5 = {}) {
5852
- return this.listTelemetry(query5);
5853
- },
5854
5784
  /**
5855
5785
  * Create a pack entitlement.
5856
5786
  */
@@ -5862,18 +5792,6 @@ function createPacksClient(config = {}) {
5862
5792
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
5863
5793
  });
5864
5794
  },
5865
- /**
5866
- * Update a pack entitlement.
5867
- */
5868
- async updateEntitlement(input, idempotencyKey) {
5869
- return this.createEntitlement(input, idempotencyKey);
5870
- },
5871
- /**
5872
- * @deprecated Use createEntitlement or updateEntitlement.
5873
- */
5874
- async upsertEntitlement(input, idempotencyKey) {
5875
- return this.createEntitlement(input, idempotencyKey);
5876
- },
5877
5795
  /**
5878
5796
  * Install a pack.
5879
5797
  */
@@ -5930,6 +5848,13 @@ function createPacksClient(config = {}) {
5930
5848
  });
5931
5849
  }
5932
5850
  };
5851
+ return Object.assign(client, {
5852
+ getCatalog: client.listCatalog,
5853
+ getStates: client.listStates,
5854
+ getTelemetry: client.listTelemetry,
5855
+ updateEntitlement: client.createEntitlement,
5856
+ upsertEntitlement: client.createEntitlement
5857
+ });
5933
5858
  }
5934
5859
 
5935
5860
  // src/policyClient.ts
@@ -5965,6 +5890,14 @@ function asRolePolicyArray(data) {
5965
5890
  }
5966
5891
  return data.map(asRolePolicyRecord).filter((row) => Boolean(row));
5967
5892
  }
5893
+ function buildFilterByPermissionResponse(permission, allowedTopicIds, deniedTopics, count) {
5894
+ const result = {};
5895
+ result.permission = permission;
5896
+ result.allowedTopicIds = allowedTopicIds;
5897
+ result.deniedTopics = deniedTopics;
5898
+ result.count = count;
5899
+ return result;
5900
+ }
5968
5901
  function createPolicyClient(config = {}) {
5969
5902
  const gateway = createGatewayRequestClient(config);
5970
5903
  return {
@@ -6187,15 +6120,15 @@ function createPolicyClient(config = {}) {
6187
6120
  });
6188
6121
  const allowedTopicIds = Array.isArray(response.data?.allowedTopicIds) ? response.data.allowedTopicIds : [];
6189
6122
  const deniedTopics = Array.isArray(response.data?.deniedTopics) ? response.data.deniedTopics : [];
6190
- return {
6191
- success: true,
6192
- data: {
6193
- permission,
6194
- allowedTopicIds,
6195
- deniedTopics,
6196
- count: typeof response.data?.count === "number" ? response.data.count : allowedTopicIds.length
6197
- }
6198
- };
6123
+ const result = {};
6124
+ result.success = true;
6125
+ result.data = buildFilterByPermissionResponse(
6126
+ permission,
6127
+ allowedTopicIds,
6128
+ deniedTopics,
6129
+ typeof response.data?.count === "number" ? response.data.count : allowedTopicIds.length
6130
+ );
6131
+ return result;
6199
6132
  }
6200
6133
  };
6201
6134
  }
@@ -6203,64 +6136,66 @@ function createPolicyClient(config = {}) {
6203
6136
  // src/reportsClient.ts
6204
6137
  function createReportsClient(config = {}) {
6205
6138
  const gateway = createGatewayRequestClient(config);
6139
+ const listTemplates = async (args = {}) => gateway.request({
6140
+ path: `/api/platform/v1/reports/templates${toQueryString({
6141
+ slug: args.slug
6142
+ })}`
6143
+ }).then(
6144
+ (response) => mapGatewayData(response, (data) => {
6145
+ const rows = asListItems(data, "templates");
6146
+ return createListResult(rows, "templates");
6147
+ })
6148
+ );
6149
+ const listReports = async (input, args = {}) => {
6150
+ const topicId = resolveTopicId(input);
6151
+ if (!topicId) {
6152
+ throw new Error("topicId is required");
6153
+ }
6154
+ return gateway.request({
6155
+ path: `/api/platform/v1/reports/topics/${encodeURIComponent(topicId)}${toQueryString(
6156
+ {
6157
+ summary: typeof args.summary === "boolean" ? args.summary ? "true" : "false" : void 0
6158
+ }
6159
+ )}`
6160
+ }).then(
6161
+ (response) => mapGatewayData(
6162
+ response,
6163
+ (data) => createListResult(Array.isArray(data) ? data : [], "reports")
6164
+ )
6165
+ );
6166
+ };
6167
+ const getReport = async (reportId) => gateway.request({
6168
+ path: `/api/platform/v1/reports/${encodeURIComponent(reportId)}`
6169
+ });
6206
6170
  return {
6207
6171
  /**
6208
6172
  * List report templates.
6209
6173
  */
6210
- async listTemplates(args = {}) {
6211
- return gateway.request({
6212
- path: `/api/platform/v1/reports/templates${toQueryString({
6213
- slug: args.slug
6214
- })}`
6215
- }).then(
6216
- (response) => mapGatewayData(response, (data) => {
6217
- const record = data && typeof data === "object" ? data : {};
6218
- const rows = Array.isArray(data) ? data : Array.isArray(record.templates) ? record.templates : [];
6219
- return createListResult(rows, "templates");
6220
- })
6221
- );
6222
- },
6174
+ listTemplates,
6223
6175
  /**
6224
6176
  * @deprecated Use listTemplates.
6225
6177
  */
6226
- async getTemplates(args = {}) {
6227
- return this.listTemplates(args);
6228
- },
6178
+ getTemplates: listTemplates,
6229
6179
  /**
6230
6180
  * List reports for a topic scope.
6231
6181
  */
6232
- async listReports(input, args = {}) {
6233
- const topicId = resolveTopicId(input);
6234
- if (!topicId) {
6235
- throw new Error("topicId is required");
6236
- }
6237
- return gateway.request({
6238
- path: `/api/platform/v1/reports/topics/${encodeURIComponent(topicId)}${toQueryString(
6239
- {
6240
- summary: typeof args.summary === "boolean" ? args.summary ? "true" : "false" : void 0
6241
- }
6242
- )}`
6243
- }).then(
6244
- (response) => mapGatewayData(
6245
- response,
6246
- (data) => createListResult(Array.isArray(data) ? data : [], "reports")
6247
- )
6248
- );
6249
- },
6182
+ listReports,
6250
6183
  /**
6251
6184
  * Get a generated report.
6252
6185
  */
6253
- async getReport(reportId) {
6254
- return gateway.request({
6255
- path: `/api/platform/v1/reports/${encodeURIComponent(reportId)}`
6256
- });
6257
- }
6186
+ getReport
6258
6187
  };
6259
6188
  }
6260
6189
 
6261
6190
  // src/schemaClient.ts
6262
6191
  function createSchemaClient(config = {}) {
6263
6192
  const gateway = createGatewayRequestClient(config);
6193
+ const createEntitlement = (input, idempotencyKey) => gateway.request({
6194
+ path: "/api/platform/v1/schema/entitlements",
6195
+ method: "POST",
6196
+ body: input,
6197
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6198
+ });
6264
6199
  return {
6265
6200
  /**
6266
6201
  * List schema packs.
@@ -6312,29 +6247,95 @@ function createSchemaClient(config = {}) {
6312
6247
  /**
6313
6248
  * Create a schema entitlement.
6314
6249
  */
6315
- async createEntitlement(input, idempotencyKey) {
6316
- return gateway.request({
6317
- path: "/api/platform/v1/schema/entitlements",
6318
- method: "POST",
6319
- body: input,
6320
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6321
- });
6322
- },
6250
+ createEntitlement,
6323
6251
  /**
6324
6252
  * Update a schema entitlement.
6325
6253
  */
6326
- async updateEntitlement(input, idempotencyKey) {
6327
- return this.createEntitlement(input, idempotencyKey);
6328
- },
6254
+ updateEntitlement: createEntitlement,
6329
6255
  /**
6330
6256
  * @deprecated Use createEntitlement or updateEntitlement.
6331
6257
  */
6332
- async upsertEntitlement(input, idempotencyKey) {
6333
- return this.createEntitlement(input, idempotencyKey);
6334
- }
6258
+ upsertEntitlement: createEntitlement
6335
6259
  };
6336
6260
  }
6337
6261
 
6262
+ // src/clientHelpers.ts
6263
+ function asNodeArray(data) {
6264
+ const rows = asListItems(data, "nodes");
6265
+ if (rows.length > 0) {
6266
+ return rows.filter(
6267
+ (value) => Boolean(value) && typeof value === "object"
6268
+ );
6269
+ }
6270
+ if (data && typeof data === "object") {
6271
+ return [data];
6272
+ }
6273
+ return [];
6274
+ }
6275
+ function requireTopicId4(args) {
6276
+ const topicId = resolveTopicId(args);
6277
+ if (!topicId) {
6278
+ throw new Error("topicId is required");
6279
+ }
6280
+ return topicId;
6281
+ }
6282
+ function requireTopicOrProjectId(args) {
6283
+ const topicId = args.topicId?.trim() || args.projectId?.trim() || void 0;
6284
+ if (!topicId) {
6285
+ throw new Error("topicId is required");
6286
+ }
6287
+ return topicId;
6288
+ }
6289
+ var AUDIT_NODE_REFERENCE_KEY_PATTERN = /(^|_)(id|nodeid|beliefid|resourceid|targetid|sourceid|subjectid|globalid|entityid|recordid|fromnodeid|tonodeid|linkednodeid|linkedbeliefid|nodeids|beliefids|resourceids)$/i;
6290
+ function matchesAuditNodeReference(value, nodeId) {
6291
+ if (Array.isArray(value)) {
6292
+ return value.some((entry) => matchesAuditNodeReference(entry, nodeId));
6293
+ }
6294
+ if (!value || typeof value !== "object") {
6295
+ return false;
6296
+ }
6297
+ return Object.entries(value).some(([key, entry]) => {
6298
+ if (typeof entry === "string" && entry === nodeId && AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key)) {
6299
+ return true;
6300
+ }
6301
+ if (Array.isArray(entry) && AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key) && entry.some((item) => item === nodeId)) {
6302
+ return true;
6303
+ }
6304
+ return matchesAuditNodeReference(entry, nodeId);
6305
+ });
6306
+ }
6307
+ function requireText(args) {
6308
+ const text = resolveText(args);
6309
+ if (!text) {
6310
+ throw new Error("text is required");
6311
+ }
6312
+ return text;
6313
+ }
6314
+ function requireBaseRate(args) {
6315
+ const baseRate = typeof args.baseRate === "number" && Number.isFinite(args.baseRate) ? args.baseRate : 0.5;
6316
+ if (baseRate < 0 || baseRate > 1) {
6317
+ throw new Error("baseRate must be within [0, 1].");
6318
+ }
6319
+ return baseRate;
6320
+ }
6321
+ function sdkQueryString(input) {
6322
+ const params = new URLSearchParams();
6323
+ for (const [key, value] of Object.entries(input)) {
6324
+ if (value === void 0 || value === null) {
6325
+ continue;
6326
+ }
6327
+ if (Array.isArray(value)) {
6328
+ if (value.length > 0) {
6329
+ params.set(key, value.join(","));
6330
+ }
6331
+ continue;
6332
+ }
6333
+ params.set(key, String(value));
6334
+ }
6335
+ const serialized = params.toString();
6336
+ return serialized ? `?${serialized}` : "";
6337
+ }
6338
+
6338
6339
  // src/telemetryClient.ts
6339
6340
  var TELEMETRY_FIELDS = [
6340
6341
  "tenantId",
@@ -6505,6 +6506,16 @@ function query4(input) {
6505
6506
  cursor: input.cursor
6506
6507
  };
6507
6508
  }
6509
+ function effectiveToolsQuery(input) {
6510
+ return {
6511
+ ...query4(input),
6512
+ callerRole: input.callerRole,
6513
+ surface: input.surface,
6514
+ sessionType: input.sessionType,
6515
+ permittedToolNames: input.permittedToolNames ? JSON.stringify(input.permittedToolNames) : void 0,
6516
+ executableOnly: input.executableOnly
6517
+ };
6518
+ }
6508
6519
  function writeBody(input, operation) {
6509
6520
  return knownPayload(input, TOOL_REGISTRY_FIELDS, operation);
6510
6521
  }
@@ -6533,7 +6544,9 @@ function createToolRegistryClient(config = {}) {
6533
6544
  },
6534
6545
  listEffectiveTools(input) {
6535
6546
  return gateway.request({
6536
- path: `/api/platform/v1/tools/effective${toQueryString(query4(input))}`
6547
+ path: `/api/platform/v1/tools/effective${toQueryString(
6548
+ effectiveToolsQuery(input)
6549
+ )}`
6537
6550
  }).then(
6538
6551
  (response) => mapGatewayData(
6539
6552
  response,
@@ -6624,7 +6637,7 @@ function createToolRegistryClient(config = {}) {
6624
6637
  }
6625
6638
 
6626
6639
  // src/version.ts
6627
- var LUCERN_SDK_VERSION = "0.2.0-alpha.1";
6640
+ var LUCERN_SDK_VERSION = "0.3.0-alpha.8";
6628
6641
 
6629
6642
  // src/workflowClient.ts
6630
6643
  function normalizeLensQuery(value) {
@@ -6818,12 +6831,6 @@ function createWorkflowClient(config = {}) {
6818
6831
  )
6819
6832
  );
6820
6833
  },
6821
- /**
6822
- * @deprecated Use createWorktree.
6823
- */
6824
- async addWorktree(input, idempotencyKey) {
6825
- return client.createWorktree(input, idempotencyKey);
6826
- },
6827
6834
  /**
6828
6835
  * Merge a worktree into the main belief line.
6829
6836
  */
@@ -7021,54 +7028,19 @@ function createWorkflowClient(config = {}) {
7021
7028
  body: input,
7022
7029
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
7023
7030
  });
7024
- },
7025
- /**
7026
- * @deprecated Use createBranch.
7027
- */
7028
- async createPillar(input, idempotencyKey) {
7029
- return client.createBranch(input, idempotencyKey);
7030
- },
7031
- /**
7032
- * @deprecated Use addWorktree.
7033
- */
7034
- async createSprint(input, idempotencyKey) {
7035
- return client.createWorktree(input, idempotencyKey);
7036
- },
7037
- /**
7038
- * @deprecated Use merge.
7039
- */
7040
- async completeSprint(worktreeId, input, idempotencyKey) {
7041
- return client.merge(worktreeId, input, idempotencyKey);
7042
- },
7043
- /**
7044
- * @deprecated Use openPullRequest.
7045
- */
7046
- async requestReview(worktreeId, input, idempotencyKey) {
7047
- return client.openPullRequest(worktreeId, input, idempotencyKey);
7048
- },
7049
- /**
7050
- * @deprecated Use push.
7051
- */
7052
- async publishFindings(worktreeId, input, idempotencyKey) {
7053
- return client.push(worktreeId, input, idempotencyKey);
7054
7031
  }
7055
7032
  };
7056
- return client;
7033
+ return Object.assign(client, {
7034
+ addWorktree: client.createWorktree,
7035
+ createPillar: client.createBranch,
7036
+ createSprint: client.createWorktree,
7037
+ completeSprint: client.merge,
7038
+ requestReview: client.openPullRequest,
7039
+ publishFindings: client.push
7040
+ });
7057
7041
  }
7058
7042
 
7059
7043
  // src/client.ts
7060
- function asNodeArray(data) {
7061
- const rows = asListItems(data, "nodes");
7062
- if (rows.length > 0) {
7063
- return rows.filter(
7064
- (value) => Boolean(value) && typeof value === "object"
7065
- );
7066
- }
7067
- if (data && typeof data === "object") {
7068
- return [data];
7069
- }
7070
- return [];
7071
- }
7072
7044
  function toGatewayConfig(config) {
7073
7045
  return {
7074
7046
  baseUrl: config.baseUrl,
@@ -7096,72 +7068,9 @@ function toGatewayConfig(config) {
7096
7068
  }
7097
7069
  };
7098
7070
  }
7099
- function requireTopicId4(args) {
7100
- const topicId = resolveTopicId(args);
7101
- if (!topicId) {
7102
- throw new Error("topicId is required");
7103
- }
7104
- return topicId;
7105
- }
7106
- function requireTopicOrProjectId(args) {
7107
- const topicId = args.topicId?.trim() || args.projectId?.trim() || void 0;
7108
- if (!topicId) {
7109
- throw new Error("topicId is required");
7110
- }
7111
- return topicId;
7112
- }
7113
- var AUDIT_NODE_REFERENCE_KEY_PATTERN = /(^|_)(id|nodeid|beliefid|resourceid|targetid|sourceid|subjectid|globalid|entityid|recordid|fromnodeid|tonodeid|linkednodeid|linkedbeliefid|nodeids|beliefids|resourceids)$/i;
7114
- function matchesAuditNodeReference(value, nodeId) {
7115
- if (Array.isArray(value)) {
7116
- return value.some((entry) => matchesAuditNodeReference(entry, nodeId));
7117
- }
7118
- if (!value || typeof value !== "object") {
7119
- return false;
7120
- }
7121
- return Object.entries(value).some(([key, entry]) => {
7122
- if (typeof entry === "string" && entry === nodeId && AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key)) {
7123
- return true;
7124
- }
7125
- if (Array.isArray(entry) && AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key) && entry.some((item) => item === nodeId)) {
7126
- return true;
7127
- }
7128
- return matchesAuditNodeReference(entry, nodeId);
7129
- });
7130
- }
7131
- function requireText(args) {
7132
- const text = resolveText(args);
7133
- if (!text) {
7134
- throw new Error("text is required");
7135
- }
7136
- return text;
7137
- }
7138
- function requireBaseRate(args) {
7139
- const baseRate = typeof args.baseRate === "number" && Number.isFinite(args.baseRate) ? args.baseRate : 0.5;
7140
- if (baseRate < 0 || baseRate > 1) {
7141
- throw new Error("baseRate must be within [0, 1].");
7142
- }
7143
- return baseRate;
7144
- }
7145
7071
  function exposeGatewayData(response) {
7146
7072
  return Object.assign({}, response, response.data);
7147
7073
  }
7148
- function sdkQueryString(input) {
7149
- const params = new URLSearchParams();
7150
- for (const [key, value] of Object.entries(input)) {
7151
- if (value === void 0 || value === null) {
7152
- continue;
7153
- }
7154
- if (Array.isArray(value)) {
7155
- if (value.length > 0) {
7156
- params.set(key, value.join(","));
7157
- }
7158
- continue;
7159
- }
7160
- params.set(key, String(value));
7161
- }
7162
- const serialized = params.toString();
7163
- return serialized ? `?${serialized}` : "";
7164
- }
7165
7074
  function createLucernClient(config = {}) {
7166
7075
  const gatewayConfig = toGatewayConfig(config);
7167
7076
  const beliefsClient = createBeliefsClient(gatewayConfig);
@@ -7385,7 +7294,7 @@ function createLucernClient(config = {}) {
7385
7294
  topicId,
7386
7295
  nodeType: "contradiction",
7387
7296
  limit: 500
7388
- }) : args.nodeId ? await graphClient.queryNodes({ nodeId: args.nodeId }) : { data: [] };
7297
+ }) : args.nodeId ? await graphClient.listNodes({ nodeId: args.nodeId }) : { data: [] };
7389
7298
  const contradictions = asNodeArray(response.data).filter((node) => {
7390
7299
  const status = typeof node.metadata?.status === "string" ? node.metadata.status : typeof node.status === "string" ? node.status : "unresolved";
7391
7300
  if (args.status && status !== args.status) {
@@ -7565,23 +7474,15 @@ function createLucernClient(config = {}) {
7565
7474
  }).then(exposeGatewayData);
7566
7475
  }
7567
7476
  const nodesNamespace = {
7568
- list(query5) {
7569
- return graphClient.listNodes(query5);
7570
- },
7477
+ list: graphClient.listNodes,
7571
7478
  get(input) {
7572
7479
  return graphClient.getNode(
7573
7480
  typeof input === "string" ? { nodeId: input } : input
7574
7481
  );
7575
7482
  },
7576
- create(input, idempotencyKey) {
7577
- return graphClient.createNode(input, idempotencyKey);
7578
- },
7579
- update(input, idempotencyKey) {
7580
- return graphClient.updateNode(input, idempotencyKey);
7581
- },
7582
- batchCreate(input, idempotencyKey) {
7583
- return graphClient.batchCreateNodes(input, idempotencyKey);
7584
- },
7483
+ create: graphClient.createNode,
7484
+ update: graphClient.updateNode,
7485
+ batchCreate: graphClient.batchCreateNodes,
7585
7486
  listByTopicAndType(input) {
7586
7487
  return gateway.request({
7587
7488
  path: `/api/platform/v1/nodes${sdkQueryString({
@@ -7606,15 +7507,9 @@ function createLucernClient(config = {}) {
7606
7507
  })}`
7607
7508
  }).then(exposeGatewayData);
7608
7509
  },
7609
- supersede(input, idempotencyKey) {
7610
- return graphClient.supersedeNode(input, idempotencyKey);
7611
- },
7612
- verify(input, idempotencyKey) {
7613
- return graphClient.verifyNode(input, idempotencyKey);
7614
- },
7615
- hardDelete(input, idempotencyKey) {
7616
- return graphClient.hardDeleteNode(input, idempotencyKey);
7617
- }
7510
+ supersede: graphClient.supersedeNode,
7511
+ verify: graphClient.verifyNode,
7512
+ hardDelete: graphClient.hardDeleteNode
7618
7513
  };
7619
7514
  const publicationNamespace = {
7620
7515
  create(input, idempotencyKey) {
@@ -7691,9 +7586,7 @@ function createLucernClient(config = {}) {
7691
7586
  return {
7692
7587
  config,
7693
7588
  version: LUCERN_SDK_VERSION,
7694
- search(query5, options) {
7695
- return searchResources(query5, options);
7696
- },
7589
+ search: searchResources,
7697
7590
  events: {
7698
7591
  list(query5 = {}) {
7699
7592
  return eventsFacade.list(query5).then(exposeGatewayData);
@@ -7790,9 +7683,7 @@ function createLucernClient(config = {}) {
7790
7683
  confidenceHistory(nodeId) {
7791
7684
  return beliefsFacade.confidenceHistory(nodeId).then(exposeGatewayData);
7792
7685
  },
7793
- opinionHistory(nodeId) {
7794
- return getOpinionHistory(nodeId);
7795
- },
7686
+ opinionHistory: getOpinionHistory,
7796
7687
  createContract(nodeId, input) {
7797
7688
  return beliefsFacade.createContract(nodeId, input).then(exposeGatewayData);
7798
7689
  },
@@ -8046,10 +7937,10 @@ function createLucernClient(config = {}) {
8046
7937
  }));
8047
7938
  },
8048
7939
  getHighPriority(args) {
8049
- return this.list({
7940
+ return questionsFacade.list({
8050
7941
  topicId: requireTopicId4(args),
8051
7942
  status: args.includeAnswered ? void 0 : "open"
8052
- }).then((data) => {
7943
+ }).then(exposeGatewayData).then((data) => {
8053
7944
  const questions = Array.isArray(data.questions) ? data.questions : [];
8054
7945
  const rank = (priority) => {
8055
7946
  switch (priority) {
@@ -8079,9 +7970,7 @@ function createLucernClient(config = {}) {
8079
7970
  },
8080
7971
  graph: {
8081
7972
  nodes: nodesNamespace,
8082
- createEdge(input) {
8083
- return graphClient.createEdge(input);
8084
- },
7973
+ createEdge: graphClient.createEdge,
8085
7974
  neighborhood(args) {
8086
7975
  return graphFacade.neighborhood({
8087
7976
  globalId: args.globalId,
@@ -8140,7 +8029,7 @@ function createLucernClient(config = {}) {
8140
8029
  bisectConfidence,
8141
8030
  listBeliefs,
8142
8031
  detectConfirmationBias(topicId, threshold) {
8143
- return this.bias({
8032
+ return graphFacade.bias({
8144
8033
  topicId,
8145
8034
  threshold,
8146
8035
  limit: 200
@@ -8151,7 +8040,7 @@ function createLucernClient(config = {}) {
8151
8040
  }));
8152
8041
  },
8153
8042
  getStructureAnalysis(topicId) {
8154
- return this.analyze({
8043
+ return graphFacade.analyze({
8155
8044
  topicId,
8156
8045
  limit: 200
8157
8046
  }).then((response) => ({
@@ -8218,38 +8107,20 @@ function createLucernClient(config = {}) {
8218
8107
  }
8219
8108
  },
8220
8109
  judgments: {
8221
- create(input) {
8222
- return decisionsClient.createJudgment(input);
8223
- },
8224
- record(input) {
8225
- return decisionsClient.recordJudgment(input);
8226
- },
8227
- list(query5) {
8228
- return decisionsClient.listJudgments(query5);
8229
- },
8230
- get(judgmentId) {
8231
- return decisionsClient.getJudgment(judgmentId);
8232
- },
8233
- recordOutcome(judgmentId, input) {
8234
- return decisionsClient.recordJudgmentOutcome(judgmentId, input);
8235
- },
8236
- updateOutcome(judgmentId, input) {
8237
- return decisionsClient.updateJudgmentOutcome(judgmentId, input);
8238
- },
8110
+ create: decisionsClient.createJudgment,
8111
+ record: decisionsClient.recordJudgment,
8112
+ list: decisionsClient.listJudgments,
8113
+ get: decisionsClient.getJudgment,
8114
+ recordOutcome: decisionsClient.recordJudgmentOutcome,
8115
+ updateOutcome: decisionsClient.updateJudgmentOutcome,
8239
8116
  readiness(topicId) {
8240
- return decisionsClient.getJudgmentReadiness({
8241
- topicId
8242
- });
8117
+ return decisionsClient.getJudgmentReadiness({ topicId });
8243
8118
  },
8244
8119
  calibration(topicId) {
8245
- return decisionsClient.getJudgmentCalibration({
8246
- topicId
8247
- });
8120
+ return decisionsClient.getJudgmentCalibration({ topicId });
8248
8121
  },
8249
8122
  pendingOutcomeReview(topicId) {
8250
- return decisionsClient.listPendingJudgmentOutcomeReview({
8251
- topicId
8252
- });
8123
+ return decisionsClient.listPendingJudgmentOutcomeReview({ topicId });
8253
8124
  },
8254
8125
  transitionAuditIntegrity(args) {
8255
8126
  return decisionsClient.getJudgmentTransitionAuditIntegrity({
@@ -8259,21 +8130,11 @@ function createLucernClient(config = {}) {
8259
8130
  }
8260
8131
  },
8261
8132
  decisions: {
8262
- create(input) {
8263
- return decisionsClient.createJudgment(input);
8264
- },
8265
- record(input) {
8266
- return decisionsClient.recordJudgment(input);
8267
- },
8268
- list(query5) {
8269
- return decisionsClient.listJudgments(query5);
8270
- },
8271
- get(decisionId) {
8272
- return decisionsClient.getJudgment(decisionId);
8273
- },
8274
- recordOutcome(decisionId, input) {
8275
- return decisionsClient.recordJudgmentOutcome(decisionId, input);
8276
- },
8133
+ create: decisionsClient.createJudgment,
8134
+ record: decisionsClient.recordJudgment,
8135
+ list: decisionsClient.listJudgments,
8136
+ get: decisionsClient.getJudgment,
8137
+ recordOutcome: decisionsClient.recordJudgmentOutcome,
8277
8138
  lessons(decisionId, input, idempotencyKey) {
8278
8139
  return gateway.request({
8279
8140
  path: `/api/platform/v1/decisions/${encodeURIComponent(
@@ -8305,21 +8166,11 @@ function createLucernClient(config = {}) {
8305
8166
  }
8306
8167
  },
8307
8168
  worktrees: {
8308
- createBranch(input) {
8309
- return workflowClient.createBranch(input);
8310
- },
8311
- createLens(input) {
8312
- return workflowClient.createLens(input);
8313
- },
8314
- listLenses(query5) {
8315
- return workflowClient.listLenses(query5);
8316
- },
8317
- applyLensToTopic(input) {
8318
- return workflowClient.applyLensToTopic(input);
8319
- },
8320
- removeLensFromTopic(input) {
8321
- return workflowClient.removeLensFromTopic(input);
8322
- },
8169
+ createBranch: workflowClient.createBranch,
8170
+ createLens: workflowClient.createLens,
8171
+ listLenses: workflowClient.listLenses,
8172
+ applyLensToTopic: workflowClient.applyLensToTopic,
8173
+ removeLensFromTopic: workflowClient.removeLensFromTopic,
8323
8174
  create(input) {
8324
8175
  return worktreesFacade.create({
8325
8176
  title: input.title,
@@ -8424,7 +8275,9 @@ function createLucernClient(config = {}) {
8424
8275
  const dependsOn = Array.isArray(input.dependsOn) ? input.dependsOn.filter(
8425
8276
  (value) => typeof value === "string"
8426
8277
  ) : void 0;
8427
- const blocks = Array.isArray(input.blocks) ? input.blocks.filter((value) => typeof value === "string") : void 0;
8278
+ const blocks = Array.isArray(input.blocks) ? input.blocks.filter(
8279
+ (value) => typeof value === "string"
8280
+ ) : void 0;
8428
8281
  return worktreesFacade.update({
8429
8282
  id: typeof input.worktreeId === "string" ? input.worktreeId : "",
8430
8283
  hypothesis: typeof input.hypothesis === "string" ? input.hypothesis : void 0,
@@ -8438,7 +8291,23 @@ function createLucernClient(config = {}) {
8438
8291
  });
8439
8292
  },
8440
8293
  update(input) {
8441
- return this.updateMetadata(input);
8294
+ const dependsOn = Array.isArray(input.dependsOn) ? input.dependsOn.filter(
8295
+ (value) => typeof value === "string"
8296
+ ) : void 0;
8297
+ const blocks = Array.isArray(input.blocks) ? input.blocks.filter(
8298
+ (value) => typeof value === "string"
8299
+ ) : void 0;
8300
+ return worktreesFacade.update({
8301
+ id: typeof input.worktreeId === "string" ? input.worktreeId : "",
8302
+ hypothesis: typeof input.hypothesis === "string" ? input.hypothesis : void 0,
8303
+ campaign: typeof input.campaign === "number" ? input.campaign : void 0,
8304
+ lane: typeof input.lane === "string" ? input.lane : void 0,
8305
+ laneOrderInCampaign: typeof input.laneOrderInCampaign === "number" ? input.laneOrderInCampaign : void 0,
8306
+ orderInLane: typeof input.orderInLane === "number" ? input.orderInLane : void 0,
8307
+ dependsOn,
8308
+ blocks,
8309
+ gate: typeof input.gate === "string" ? input.gate : void 0
8310
+ });
8442
8311
  },
8443
8312
  updateTargets(input) {
8444
8313
  return worktreesFacade.updateTargets({
@@ -8449,9 +8318,7 @@ function createLucernClient(config = {}) {
8449
8318
  removeQuestionIds: input.removeQuestionIds
8450
8319
  });
8451
8320
  },
8452
- listAll(query5 = {}) {
8453
- return workflowClient.listAllWorktrees(query5);
8454
- },
8321
+ listAll: workflowClient.listAllWorktrees,
8455
8322
  merge(worktreeId, input) {
8456
8323
  return worktreesFacade.merge({
8457
8324
  id: worktreeId,
@@ -8459,18 +8326,12 @@ function createLucernClient(config = {}) {
8459
8326
  summary: input.summary
8460
8327
  });
8461
8328
  },
8462
- push(worktreeId, input) {
8463
- return workflowClient.push(worktreeId, input);
8464
- },
8465
- openPullRequest(worktreeId, input) {
8466
- return workflowClient.openPullRequest(worktreeId, input);
8467
- },
8329
+ push: workflowClient.push,
8330
+ openPullRequest: workflowClient.openPullRequest,
8468
8331
  pipelineSnapshot(topicId) {
8469
8332
  return functionSurfaceClient.pipelineSnapshot({ topicId });
8470
8333
  },
8471
- complete(input, idempotencyKey) {
8472
- return worktreesFacade.complete(input, idempotencyKey);
8473
- },
8334
+ complete: worktreesFacade.complete,
8474
8335
  advancePhase(worktreeId, idempotencyKey) {
8475
8336
  return worktreesFacade.advancePhase(
8476
8337
  { worktreeId },
@@ -8483,12 +8344,8 @@ function createLucernClient(config = {}) {
8483
8344
  idempotencyKey
8484
8345
  );
8485
8346
  },
8486
- patchState(input, idempotencyKey) {
8487
- return worktreesFacade.patchState(input, idempotencyKey);
8488
- },
8489
- bulkCreate(input, idempotencyKey) {
8490
- return worktreesFacade.bulkCreate(input, idempotencyKey);
8491
- }
8347
+ patchState: worktreesFacade.patchState,
8348
+ bulkCreate: worktreesFacade.bulkCreate
8492
8349
  },
8493
8350
  context: {
8494
8351
  listTopics(query5 = {}) {
@@ -8499,27 +8356,15 @@ function createLucernClient(config = {}) {
8499
8356
  type: query5.type
8500
8357
  });
8501
8358
  },
8502
- compile(topicId, input = {}) {
8503
- return contextClient.compile(topicId, input);
8504
- },
8505
- recordScopeLearning(input, idempotencyKey) {
8506
- return functionSurfaceClient.recordScopeLearning(input, idempotencyKey);
8507
- },
8359
+ compile: contextClient.compile,
8360
+ recordScopeLearning: functionSurfaceClient.recordScopeLearning,
8508
8361
  discover(input) {
8509
8362
  return discoverTopics(input);
8510
8363
  },
8511
- analyzeTopicDensity(input) {
8512
- return functionSurfaceClient.analyzeTopicDensity(input);
8513
- },
8514
- applyAutoBranching(input, idempotencyKey) {
8515
- return functionSurfaceClient.applyAutoBranching(input, idempotencyKey);
8516
- },
8517
- seedBeliefLattice(input = {}, idempotencyKey) {
8518
- return functionSurfaceClient.seedBeliefLattice(input, idempotencyKey);
8519
- },
8520
- getLatticeCoverage(input = {}) {
8521
- return functionSurfaceClient.getLatticeCoverage(input);
8522
- },
8364
+ analyzeTopicDensity: functionSurfaceClient.analyzeTopicDensity,
8365
+ applyAutoBranching: functionSurfaceClient.applyAutoBranching,
8366
+ seedBeliefLattice: functionSurfaceClient.seedBeliefLattice,
8367
+ getLatticeCoverage: functionSurfaceClient.getLatticeCoverage,
8523
8368
  matchEntityType(input) {
8524
8369
  return ontologiesFacade.match(input).then(exposeGatewayData);
8525
8370
  },
@@ -8604,9 +8449,7 @@ function createLucernClient(config = {}) {
8604
8449
  type: input.type
8605
8450
  });
8606
8451
  },
8607
- get(topicId) {
8608
- return topicsFacade.get(topicId);
8609
- },
8452
+ get: topicsFacade.get,
8610
8453
  create(input) {
8611
8454
  return topicsFacade.create({
8612
8455
  name: input.name,
@@ -8651,12 +8494,8 @@ function createLucernClient(config = {}) {
8651
8494
  maxDepth: query5.maxDepth
8652
8495
  });
8653
8496
  },
8654
- remove(topicId, idempotencyKey) {
8655
- return topicsFacade.remove(topicId, idempotencyKey);
8656
- },
8657
- bulkCreate(input, idempotencyKey) {
8658
- return topicsFacade.bulkCreate(input, idempotencyKey);
8659
- }
8497
+ remove: topicsFacade.remove,
8498
+ bulkCreate: topicsFacade.bulkCreate
8660
8499
  },
8661
8500
  answers: {
8662
8501
  create(input) {
@@ -8755,33 +8594,15 @@ function createLucernClient(config = {}) {
8755
8594
  raw: ontologyClient
8756
8595
  },
8757
8596
  coordination: {
8758
- registerSession(input = {}, idempotencyKey) {
8759
- return functionSurfaceClient.registerSession(input, idempotencyKey);
8760
- },
8761
- heartbeatSession(input = {}, idempotencyKey) {
8762
- return functionSurfaceClient.heartbeatSession(input, idempotencyKey);
8763
- },
8764
- endSession(input = {}, idempotencyKey) {
8765
- return functionSurfaceClient.endSession(input, idempotencyKey);
8766
- },
8767
- listActiveSessions(input = {}) {
8768
- return functionSurfaceClient.listActiveSessions(input);
8769
- },
8770
- sendAgentMessage(input, idempotencyKey) {
8771
- return functionSurfaceClient.sendAgentMessage(input, idempotencyKey);
8772
- },
8773
- broadcastMessage(input, idempotencyKey) {
8774
- return functionSurfaceClient.broadcastMessage(input, idempotencyKey);
8775
- },
8776
- getInbox(input = {}) {
8777
- return functionSurfaceClient.getAgentInbox(input);
8778
- },
8779
- getAgentInbox(input = {}) {
8780
- return functionSurfaceClient.getAgentInbox(input);
8781
- },
8782
- claimFiles(input, idempotencyKey) {
8783
- return functionSurfaceClient.claimFiles(input, idempotencyKey);
8784
- }
8597
+ registerSession: functionSurfaceClient.registerSession,
8598
+ heartbeatSession: functionSurfaceClient.heartbeatSession,
8599
+ endSession: functionSurfaceClient.endSession,
8600
+ listActiveSessions: functionSurfaceClient.listActiveSessions,
8601
+ sendAgentMessage: functionSurfaceClient.sendAgentMessage,
8602
+ broadcastMessage: functionSurfaceClient.broadcastMessage,
8603
+ getInbox: functionSurfaceClient.getAgentInbox,
8604
+ getAgentInbox: functionSurfaceClient.getAgentInbox,
8605
+ claimFiles: functionSurfaceClient.claimFiles
8785
8606
  },
8786
8607
  policy: {
8787
8608
  checkPermission(input) {
@@ -8812,38 +8633,24 @@ function createLucernClient(config = {}) {
8812
8633
  principalId: typeof input.principalId === "string" ? input.principalId : void 0
8813
8634
  });
8814
8635
  },
8636
+ // Backward compatibility shim: keep the policy namespace exposing the
8637
+ // historical manageWritePolicy entry point.
8815
8638
  manageWritePolicy(input, idempotencyKey) {
8816
8639
  return functionSurfaceClient.manageWritePolicy(input, idempotencyKey);
8817
8640
  },
8818
8641
  raw: policyClient
8819
8642
  },
8820
8643
  observations: {
8821
- ingest(input, idempotencyKey) {
8822
- return functionSurfaceClient.ingestObservation(input, idempotencyKey);
8823
- },
8824
- ingestObservation(input, idempotencyKey) {
8825
- return functionSurfaceClient.ingestObservation(input, idempotencyKey);
8826
- },
8827
- getContext(input) {
8828
- return functionSurfaceClient.getObservationContext(input);
8829
- },
8830
- getObservationContext(input) {
8831
- return functionSurfaceClient.getObservationContext(input);
8832
- }
8644
+ ingest: functionSurfaceClient.ingestObservation,
8645
+ ingestObservation: functionSurfaceClient.ingestObservation,
8646
+ getContext: functionSurfaceClient.getObservationContext,
8647
+ getObservationContext: functionSurfaceClient.getObservationContext
8833
8648
  },
8834
8649
  coding: {
8835
- getCodeContext(input) {
8836
- return functionSurfaceClient.getCodeContext(input);
8837
- },
8838
- getChangeHistory(input) {
8839
- return functionSurfaceClient.getChangeHistory(input);
8840
- },
8841
- recordAttempt(input, idempotencyKey) {
8842
- return functionSurfaceClient.recordAttempt(input, idempotencyKey);
8843
- },
8844
- getFailureLog(input) {
8845
- return functionSurfaceClient.getFailureLog(input);
8846
- }
8650
+ getCodeContext: functionSurfaceClient.getCodeContext,
8651
+ getChangeHistory: functionSurfaceClient.getChangeHistory,
8652
+ recordAttempt: functionSurfaceClient.recordAttempt,
8653
+ getFailureLog: functionSurfaceClient.getFailureLog
8847
8654
  },
8848
8655
  contracts: {
8849
8656
  create(input) {
@@ -8869,9 +8676,7 @@ function createLucernClient(config = {}) {
8869
8676
  }
8870
8677
  },
8871
8678
  bootstrap: {
8872
- generateSessionHandoff(input) {
8873
- return functionSurfaceClient.generateSessionHandoff(input);
8874
- }
8679
+ generateSessionHandoff: functionSurfaceClient.generateSessionHandoff
8875
8680
  },
8876
8681
  embeddings: embeddingsClient,
8877
8682
  graphAnalysis: graphAnalysisClient,
@@ -8893,25 +8698,15 @@ function createLucernClient(config = {}) {
8893
8698
  createAcl: toolRegistryClient.createAcl,
8894
8699
  deleteAcl: toolRegistryClient.deleteAcl,
8895
8700
  registerCustomTool: toolRegistryClient.registerCustomTool,
8896
- register(registration) {
8897
- return registerCustomTool(registration);
8898
- },
8899
- unregister(fullName) {
8900
- return unregisterCustomTool(fullName);
8901
- },
8902
- list() {
8903
- return listRegisteredCustomTools();
8904
- },
8905
- clear() {
8906
- clearRegisteredCustomTools();
8907
- },
8701
+ register: registerCustomTool,
8702
+ unregister: unregisterCustomTool,
8703
+ list: listRegisteredCustomTools,
8704
+ clear: clearRegisteredCustomTools,
8908
8705
  invoke(name, input = {}) {
8909
8706
  const fullName = name.includes(".") ? name : `custom.${name}`;
8910
8707
  return invokeCustomTool(fullName, input);
8911
8708
  },
8912
- namespace(namespace) {
8913
- return getCustomNamespace(namespace);
8914
- }
8709
+ namespace: getCustomNamespace
8915
8710
  },
8916
8711
  packs: {
8917
8712
  /**
@@ -8926,27 +8721,13 @@ function createLucernClient(config = {}) {
8926
8721
  get isInstalled() {
8927
8722
  return _packInstalled;
8928
8723
  },
8929
- listCatalog() {
8930
- return packsClient.listCatalog();
8931
- },
8932
- catalog() {
8933
- return packsClient.getCatalog();
8934
- },
8935
- listStates(scope) {
8936
- return packsClient.listStates(scope);
8937
- },
8938
- states(scope) {
8939
- return packsClient.getStates(scope);
8940
- },
8941
- install(input) {
8942
- return packsClient.install(input);
8943
- },
8944
- enable(input) {
8945
- return packsClient.enable(input);
8946
- },
8947
- disable(input) {
8948
- return packsClient.disable(input);
8949
- }
8724
+ listCatalog: packsClient.listCatalog,
8725
+ catalog: packsClient.listCatalog,
8726
+ listStates: packsClient.listStates,
8727
+ states: packsClient.getStates,
8728
+ install: packsClient.install,
8729
+ enable: packsClient.enable,
8730
+ disable: packsClient.disable
8950
8731
  },
8951
8732
  nodes: nodesNamespace,
8952
8733
  identity: {
@@ -8959,30 +8740,16 @@ function createLucernClient(config = {}) {
8959
8740
  raw: identityClient
8960
8741
  },
8961
8742
  mcp: {
8962
- bootstrapSession(input) {
8963
- return mcpClient.bootstrapSession(input);
8964
- },
8965
- checkWritePolicy(input) {
8966
- return mcpClient.checkWritePolicy(input);
8967
- },
8968
- beginBuildSession(input) {
8969
- return mcpClient.beginBuildSession(input);
8970
- },
8971
- evaluateEngineeringContract(input) {
8972
- return mcpClient.evaluateEngineeringContract(input);
8973
- },
8974
- evaluateResearchContract(input) {
8975
- return mcpClient.evaluateResearchContract(input);
8976
- }
8743
+ bootstrapSession: mcpClient.bootstrapSession,
8744
+ checkWritePolicy: mcpClient.checkWritePolicy,
8745
+ beginBuildSession: mcpClient.beginBuildSession,
8746
+ evaluateEngineeringContract: mcpClient.evaluateEngineeringContract,
8747
+ evaluateResearchContract: mcpClient.evaluateResearchContract
8977
8748
  },
8978
8749
  auth: {
8979
8750
  device: {
8980
- createCode(input) {
8981
- return authDeviceClient.createDeviceCode(input);
8982
- },
8983
- pollToken(deviceCode) {
8984
- return authDeviceClient.pollDeviceToken(deviceCode);
8985
- }
8751
+ createCode: authDeviceClient.createDeviceCode,
8752
+ pollToken: authDeviceClient.pollDeviceToken
8986
8753
  }
8987
8754
  },
8988
8755
  custom: getCustomNamespace("custom"),