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