@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
package/dist/client.js CHANGED
@@ -235,9 +235,7 @@ function generatePortableRequestId() {
235
235
  8
236
236
  ).join("")}-${hex.slice(8, 10).join("")}-${hex.slice(10).join("")}`;
237
237
  }
238
- function randomIdempotencyKey() {
239
- return generatePortableRequestId();
240
- }
238
+ var randomIdempotencyKey = generatePortableRequestId;
241
239
  function isRetryableStatus(status) {
242
240
  return status >= 500 || status === 408 || status === 429;
243
241
  }
@@ -302,8 +300,11 @@ function timeoutError(timeoutMs) {
302
300
  error.name = "AbortError";
303
301
  return error;
304
302
  }
303
+ function isRecord(value) {
304
+ return value !== null && typeof value === "object" && !Array.isArray(value);
305
+ }
305
306
  function readPolicySummaryFromDetails(details) {
306
- if (!details || typeof details !== "object" || Array.isArray(details)) {
307
+ if (!isRecord(details)) {
307
308
  return null;
308
309
  }
309
310
  const directSummary = details.summary;
@@ -311,11 +312,11 @@ function readPolicySummaryFromDetails(details) {
311
312
  return directSummary.trim();
312
313
  }
313
314
  const policy = details.policy;
314
- if (!policy || typeof policy !== "object" || Array.isArray(policy)) {
315
+ if (!isRecord(policy)) {
315
316
  return null;
316
317
  }
317
318
  const explanation = policy.explanation;
318
- if (!explanation || typeof explanation !== "object" || Array.isArray(explanation)) {
319
+ if (!isRecord(explanation)) {
319
320
  return null;
320
321
  }
321
322
  const nestedSummary = explanation.summary;
@@ -379,11 +380,11 @@ function createGatewayRequestClient(config = {}) {
379
380
  if (!text) {
380
381
  return null;
381
382
  }
382
- try {
383
- return JSON.parse(text);
384
- } catch {
383
+ const parsed = tryParseGatewayEnvelopeJson(text);
384
+ if (!parsed.ok) {
385
385
  return null;
386
386
  }
387
+ return isRecord(parsed.value) ? parsed.value : null;
387
388
  }
388
389
  function resolveTimeoutMs(method, requestTimeoutMs) {
389
390
  if (typeof requestTimeoutMs === "number") {
@@ -395,16 +396,31 @@ function createGatewayRequestClient(config = {}) {
395
396
  }
396
397
  return config.timeoutMs ?? 15e3;
397
398
  }
399
+ function tryParseGatewayEnvelopeJson(text) {
400
+ const trimmed = text.trim();
401
+ if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) {
402
+ return { ok: false, reason: "non-json" };
403
+ }
404
+ try {
405
+ return { ok: true, value: JSON.parse(trimmed) };
406
+ } catch (error) {
407
+ if (error instanceof SyntaxError) {
408
+ return { ok: false, reason: "invalid-json", error };
409
+ }
410
+ throw error;
411
+ }
412
+ }
398
413
  function buildApiError(args) {
399
414
  const failure = args.failure;
400
- const legacyError = failure && typeof failure.error === "object" && failure.error !== null ? failure.error : failure?.legacyError;
415
+ const legacyError = failure && isRecord(failure.error) ? failure.error : failure?.legacyError;
401
416
  const correlationId = failure?.correlationId ?? args.response.headers.get("x-lucern-correlation-id")?.trim() ?? args.requestId;
402
417
  const policyTraceId = failure?.policyTraceId ?? args.response.headers.get("x-lucern-policy-trace-id")?.trim() ?? null;
403
418
  const details = failure?.details ?? legacyError?.details;
404
419
  const policySummary = readPolicySummaryFromDetails(details);
420
+ const failureMessage = typeof failure?.error === "string" ? failure.error : legacyError?.message;
405
421
  return new LucernApiError({
406
422
  code: failure?.code ?? legacyError?.code ?? fallbackErrorCode(args.response.status),
407
- message: policySummary ?? (typeof failure?.error === "string" ? failure.error : legacyError?.message ?? (args.response.ok ? "Platform API returned an invalid success payload." : "Platform API request failed.")),
423
+ message: policySummary ?? failureMessage ?? (args.response.ok ? "Platform API returned an invalid success payload." : "Platform API request failed."),
408
424
  status: args.response.status,
409
425
  invariant: failure?.invariant,
410
426
  suggestion: failure?.suggestion,
@@ -530,8 +546,11 @@ function createGatewayRequestClient(config = {}) {
530
546
  }
531
547
 
532
548
  // src/sdkSurface.ts
549
+ function isRecord2(value) {
550
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
551
+ }
533
552
  function asRecord(value) {
534
- return value && typeof value === "object" ? value : {};
553
+ return isRecord2(value) ? value : {};
535
554
  }
536
555
  function cleanString2(value) {
537
556
  return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
@@ -592,9 +611,7 @@ function normalizeNodeWriteInput(value) {
592
611
  }
593
612
  return next;
594
613
  }
595
- function normalizeNodeVerificationStatus(value) {
596
- return normalizeVerificationStatus(value);
597
- }
614
+ var normalizeNodeVerificationStatus = normalizeVerificationStatus;
598
615
  function normalizeTopicQuery(value) {
599
616
  const topicId = cleanString2(value.topicId);
600
617
  if (!topicId) {
@@ -621,7 +638,10 @@ function createListResult(items, legacyKey) {
621
638
  total: items.length
622
639
  };
623
640
  if (legacyKey) {
624
- result[legacyKey] = items;
641
+ return {
642
+ ...result,
643
+ [legacyKey]: items
644
+ };
625
645
  }
626
646
  return result;
627
647
  }
@@ -665,6 +685,17 @@ function asTenantVaultSecretArray(data) {
665
685
  }
666
686
  function createAdminClient(config = {}) {
667
687
  const gateway = createGatewayRequestClient(config);
688
+ const getControlObjectOwnership = async () => gateway.request({
689
+ path: "/api/platform/v1/admin/control-ownership"
690
+ });
691
+ const createMembership = async (input, idempotencyKey) => gateway.request({
692
+ path: "/api/platform/v1/memberships",
693
+ method: "POST",
694
+ body: input,
695
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
696
+ });
697
+ const updateMembership = createMembership;
698
+ const upsertMembership = createMembership;
668
699
  return {
669
700
  /**
670
701
  * List tenants visible to the current principal.
@@ -696,19 +727,11 @@ function createAdminClient(config = {}) {
696
727
  /**
697
728
  * Get the control-object ownership contract.
698
729
  */
699
- async getControlObjectOwnership() {
700
- return gateway.request({
701
- path: "/api/platform/v1/admin/control-ownership"
702
- });
703
- },
730
+ getControlObjectOwnership,
704
731
  /**
705
732
  * @deprecated Use getControlObjectOwnership.
706
733
  */
707
- async getControlObjectOwnershipContract() {
708
- return gateway.request({
709
- path: "/api/platform/v1/admin/control-ownership"
710
- });
711
- },
734
+ getControlObjectOwnershipContract: getControlObjectOwnership,
712
735
  /**
713
736
  * List workspaces for the current admin scope.
714
737
  */
@@ -755,26 +778,15 @@ function createAdminClient(config = {}) {
755
778
  /**
756
779
  * Create a membership.
757
780
  */
758
- async createMembership(input, idempotencyKey) {
759
- return gateway.request({
760
- path: "/api/platform/v1/memberships",
761
- method: "POST",
762
- body: input,
763
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
764
- });
765
- },
781
+ createMembership,
766
782
  /**
767
783
  * Update a membership.
768
784
  */
769
- async updateMembership(input, idempotencyKey) {
770
- return this.createMembership(input, idempotencyKey);
771
- },
785
+ updateMembership,
772
786
  /**
773
787
  * @deprecated Use createMembership or updateMembership.
774
788
  */
775
- async upsertMembership(input, idempotencyKey) {
776
- return this.createMembership(input, idempotencyKey);
777
- },
789
+ upsertMembership,
778
790
  /**
779
791
  * List tenant API keys in the current admin scope.
780
792
  */
@@ -1056,115 +1068,111 @@ function createAnswersClient(config = {}) {
1056
1068
  // src/audiencesClient.ts
1057
1069
  function createAudiencesClient(config = {}) {
1058
1070
  const gateway = createGatewayRequestClient(config);
1071
+ const listRegistry = async (query5 = {}) => {
1072
+ return gateway.request({
1073
+ path: `/api/platform/v1/audiences/registry${toQueryString({
1074
+ ...query5,
1075
+ effective: typeof query5.effective === "boolean" ? query5.effective ? "true" : "false" : void 0,
1076
+ status: query5.status
1077
+ })}`
1078
+ }).then(
1079
+ (response) => mapGatewayData(
1080
+ response,
1081
+ (data) => createListResult(Array.isArray(data) ? data : [], "registryEntries")
1082
+ )
1083
+ );
1084
+ };
1085
+ const createRegistryEntry = async (input, idempotencyKey) => {
1086
+ return gateway.request({
1087
+ path: "/api/platform/v1/audiences/registry",
1088
+ method: "POST",
1089
+ body: input,
1090
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1091
+ });
1092
+ };
1093
+ const updateRegistryEntry = createRegistryEntry;
1094
+ const upsertRegistry = createRegistryEntry;
1095
+ const getRegistry = listRegistry;
1096
+ const listGrants = async (query5 = {}) => {
1097
+ return gateway.request({
1098
+ path: `/api/platform/v1/audiences/grants${toQueryString({
1099
+ ...query5,
1100
+ audienceKey: query5.audienceKey,
1101
+ principalId: query5.principalId,
1102
+ groupId: query5.groupId,
1103
+ status: query5.status
1104
+ })}`
1105
+ }).then(
1106
+ (response) => mapGatewayData(
1107
+ response,
1108
+ (data) => createListResult(Array.isArray(data) ? data : [], "grants")
1109
+ )
1110
+ );
1111
+ };
1112
+ const createGrant = async (input, idempotencyKey) => {
1113
+ return gateway.request({
1114
+ path: "/api/platform/v1/audiences/grants",
1115
+ method: "POST",
1116
+ body: input,
1117
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1118
+ });
1119
+ };
1120
+ const getGrants = listGrants;
1121
+ const grant = createGrant;
1122
+ const deleteGrant = async (input, idempotencyKey) => {
1123
+ return gateway.request({
1124
+ path: "/api/platform/v1/audiences/grants/revoke",
1125
+ method: "POST",
1126
+ body: input,
1127
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1128
+ });
1129
+ };
1130
+ const revokeGrant = deleteGrant;
1059
1131
  return {
1060
1132
  /**
1061
1133
  * List audience registry entries.
1062
1134
  */
1063
- async listRegistry(query5 = {}) {
1064
- return gateway.request({
1065
- path: `/api/platform/v1/audiences/registry${toQueryString({
1066
- ...query5,
1067
- effective: typeof query5.effective === "boolean" ? query5.effective ? "true" : "false" : void 0,
1068
- status: query5.status
1069
- })}`
1070
- }).then(
1071
- (response) => mapGatewayData(
1072
- response,
1073
- (data) => createListResult(
1074
- Array.isArray(data) ? data : [],
1075
- "registryEntries"
1076
- )
1077
- )
1078
- );
1079
- },
1135
+ listRegistry,
1080
1136
  /**
1081
1137
  * @deprecated Use listRegistry.
1082
1138
  */
1083
- async getRegistry(query5 = {}) {
1084
- return this.listRegistry(query5);
1085
- },
1139
+ getRegistry,
1086
1140
  /**
1087
1141
  * Create an audience registry entry.
1088
1142
  */
1089
- async createRegistryEntry(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
- },
1143
+ createRegistryEntry,
1097
1144
  /**
1098
1145
  * Update an audience registry entry.
1099
1146
  */
1100
- async updateRegistryEntry(input, idempotencyKey) {
1101
- return this.createRegistryEntry(input, idempotencyKey);
1102
- },
1147
+ updateRegistryEntry,
1103
1148
  /**
1104
1149
  * @deprecated Use createRegistryEntry or updateRegistryEntry.
1105
1150
  */
1106
- async upsertRegistry(input, idempotencyKey) {
1107
- return this.createRegistryEntry(input, idempotencyKey);
1108
- },
1151
+ upsertRegistry,
1109
1152
  /**
1110
1153
  * List audience grants.
1111
1154
  */
1112
- async listGrants(query5 = {}) {
1113
- return gateway.request({
1114
- path: `/api/platform/v1/audiences/grants${toQueryString({
1115
- ...query5,
1116
- audienceKey: query5.audienceKey,
1117
- principalId: query5.principalId,
1118
- groupId: query5.groupId,
1119
- status: query5.status
1120
- })}`
1121
- }).then(
1122
- (response) => mapGatewayData(
1123
- response,
1124
- (data) => createListResult(Array.isArray(data) ? data : [], "grants")
1125
- )
1126
- );
1127
- },
1155
+ listGrants,
1128
1156
  /**
1129
1157
  * @deprecated Use listGrants.
1130
1158
  */
1131
- async getGrants(query5 = {}) {
1132
- return this.listGrants(query5);
1133
- },
1159
+ getGrants,
1134
1160
  /**
1135
1161
  * Create an audience grant.
1136
1162
  */
1137
- async createGrant(input, idempotencyKey) {
1138
- return gateway.request({
1139
- path: "/api/platform/v1/audiences/grants",
1140
- method: "POST",
1141
- body: input,
1142
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1143
- });
1144
- },
1163
+ createGrant,
1145
1164
  /**
1146
1165
  * @deprecated Use createGrant.
1147
1166
  */
1148
- async grant(input, idempotencyKey) {
1149
- return this.createGrant(input, idempotencyKey);
1150
- },
1167
+ grant,
1151
1168
  /**
1152
1169
  * Delete an audience grant by revoking it.
1153
1170
  */
1154
- async deleteGrant(input, idempotencyKey) {
1155
- return gateway.request({
1156
- path: "/api/platform/v1/audiences/grants/revoke",
1157
- method: "POST",
1158
- body: input,
1159
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1160
- });
1161
- },
1171
+ deleteGrant,
1162
1172
  /**
1163
1173
  * @deprecated Use deleteGrant.
1164
1174
  */
1165
- async revokeGrant(input, idempotencyKey) {
1166
- return this.deleteGrant(input, idempotencyKey);
1167
- }
1175
+ revokeGrant
1168
1176
  };
1169
1177
  }
1170
1178
 
@@ -1205,8 +1213,18 @@ function authBaseUrl(config) {
1205
1213
  return config.baseUrl?.replace(/\/+$/, "") ?? "";
1206
1214
  }
1207
1215
  async function readJson(response) {
1208
- const payload = await response.json().catch(() => ({}));
1209
- return payload && typeof payload === "object" && !Array.isArray(payload) ? payload : {};
1216
+ try {
1217
+ const payload = await response.json();
1218
+ return isRecord3(payload) ? payload : {};
1219
+ } catch (error) {
1220
+ return unreadableJsonBodyFallback();
1221
+ }
1222
+ }
1223
+ function unreadableJsonBodyFallback(_error) {
1224
+ return {};
1225
+ }
1226
+ function isRecord3(value) {
1227
+ return value !== null && typeof value === "object" && !Array.isArray(value);
1210
1228
  }
1211
1229
  function readString(value) {
1212
1230
  const normalized = typeof value === "string" ? value.trim() : "";
@@ -1248,7 +1266,10 @@ function assertDeviceTokenResponse(payload) {
1248
1266
  tenant_id: tenantId,
1249
1267
  workspace_id: readString(payload.workspace_id),
1250
1268
  principal_id: principalId,
1251
- user: payload.user && typeof payload.user === "object" && !Array.isArray(payload.user) ? payload.user : void 0
1269
+ user: isRecord3(payload.user) && typeof payload.user.id === "string" && typeof payload.user.principalId === "string" ? {
1270
+ id: payload.user.id,
1271
+ principalId: payload.user.principalId
1272
+ } : void 0
1252
1273
  };
1253
1274
  }
1254
1275
  function maybeThrowDeviceError(payload) {
@@ -1396,12 +1417,12 @@ function createBeliefsClient(config = {}) {
1396
1417
  body: normalizeModulateConfidenceInput(input),
1397
1418
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1398
1419
  });
1399
- async function getOpinionHistory(beliefId) {
1420
+ const getOpinionHistory = async (beliefId) => {
1400
1421
  const response = await gateway.request({
1401
1422
  path: `/api/platform/v1/beliefs/${encodeURIComponent(beliefId)}/confidence-history`
1402
1423
  });
1403
1424
  return mapOpinionHistoryEntriesFromGatewayData(response.data);
1404
- }
1425
+ };
1405
1426
  return {
1406
1427
  /**
1407
1428
  * Create a belief within a topic scope.
@@ -1446,13 +1467,9 @@ function createBeliefsClient(config = {}) {
1446
1467
  * trigger = cause of the score change
1447
1468
  * triggeringRef = optional pointer to the evidence or worktree that drove the change
1448
1469
  */
1449
- async getOpinionHistory(beliefId) {
1450
- return getOpinionHistory(beliefId);
1451
- },
1470
+ getOpinionHistory,
1452
1471
  /** @deprecated Use getOpinionHistory(). */
1453
- async getConfidenceHistory(beliefId) {
1454
- return getOpinionHistory(beliefId);
1455
- },
1472
+ getConfidenceHistory: getOpinionHistory,
1456
1473
  /**
1457
1474
  * Fork a scored belief into a new formulation.
1458
1475
  */
@@ -1600,6 +1617,9 @@ function cleanOptionalString(value) {
1600
1617
  const normalized = value?.trim();
1601
1618
  return normalized ? normalized : void 0;
1602
1619
  }
1620
+ function isRecord4(value) {
1621
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
1622
+ }
1603
1623
  function cleanRequiredString(value, label) {
1604
1624
  const normalized = cleanOptionalString(value);
1605
1625
  if (!normalized) {
@@ -1639,9 +1659,10 @@ function topicPayload(input, allowed, operation) {
1639
1659
  };
1640
1660
  }
1641
1661
  function listResultFromEnvelope(data, legacyKey) {
1642
- const record = data && typeof data === "object" ? data : {};
1662
+ const record = isRecord4(data) ? data : {};
1663
+ const legacyItems = record[legacyKey];
1643
1664
  return createListResult(
1644
- Array.isArray(record[legacyKey]) ? record[legacyKey] : Array.isArray(data) ? data : [],
1665
+ Array.isArray(legacyItems) ? legacyItems : Array.isArray(data) ? data : [],
1645
1666
  legacyKey
1646
1667
  );
1647
1668
  }
@@ -2013,7 +2034,7 @@ async function invokeRegisteredCustomTool(fullName, params, context) {
2013
2034
  // src/ontologyClient.ts
2014
2035
  function createOntologyClient(config = {}) {
2015
2036
  const gateway = createGatewayRequestClient(config);
2016
- return {
2037
+ const client = {
2017
2038
  /**
2018
2039
  * List ontology definitions matching optional filters.
2019
2040
  */
@@ -2022,13 +2043,14 @@ function createOntologyClient(config = {}) {
2022
2043
  path: `/api/platform/v1/ontologies${toQueryString(filters)}`
2023
2044
  }).then(
2024
2045
  (response) => mapGatewayData(response, (data) => {
2025
- const record = data && typeof data === "object" && !Array.isArray(data) ? data : {};
2026
- const ontologies = Array.isArray(record.ontologies) ? record.ontologies : Array.isArray(record.definitions) ? record.definitions : Array.isArray(data) ? data : [];
2027
- const total = typeof record.total === "number" && Number.isFinite(record.total) ? record.total : ontologies.length;
2046
+ const record = asRecord(data);
2047
+ const ontologies = asListItems(data, "ontologies");
2048
+ const definitions = ontologies.length > 0 ? ontologies : asListItems(data, "definitions");
2049
+ const total = typeof record.total === "number" && Number.isFinite(record.total) ? record.total : definitions.length;
2028
2050
  return {
2029
2051
  ...record,
2030
- ...createListResult(ontologies, "definitions"),
2031
- ontologies,
2052
+ ...createListResult(definitions, "definitions"),
2053
+ ontologies: definitions,
2032
2054
  total
2033
2055
  };
2034
2056
  })
@@ -2055,18 +2077,6 @@ function createOntologyClient(config = {}) {
2055
2077
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
2056
2078
  });
2057
2079
  },
2058
- /**
2059
- * List ontology definitions.
2060
- */
2061
- async listDefinitions(filters = {}) {
2062
- return this.list(filters);
2063
- },
2064
- /**
2065
- * Get an ontology definition.
2066
- */
2067
- async getDefinition(id) {
2068
- return this.get(id);
2069
- },
2070
2080
  /**
2071
2081
  * Create an ontology definition.
2072
2082
  */
@@ -2108,7 +2118,7 @@ function createOntologyClient(config = {}) {
2108
2118
  }).then(
2109
2119
  (response) => mapGatewayData(
2110
2120
  response,
2111
- (data) => createListResult(Array.isArray(data) ? data : [], "versions")
2121
+ (data) => createListResult(asListItems(data, "versions"), "versions")
2112
2122
  )
2113
2123
  );
2114
2124
  },
@@ -2156,20 +2166,19 @@ function createOntologyClient(config = {}) {
2156
2166
  (data) => createListResult(Array.isArray(data) ? data : [], "topics")
2157
2167
  )
2158
2168
  );
2159
- },
2160
- /**
2161
- * @deprecated Use listTopics.
2162
- */
2163
- async listTopicsByOntology(ontologyId) {
2164
- return this.listTopics(ontologyId);
2165
2169
  }
2166
2170
  };
2171
+ return Object.assign(client, {
2172
+ listDefinitions: client.list,
2173
+ getDefinition: client.get,
2174
+ listTopicsByOntology: client.listTopics
2175
+ });
2167
2176
  }
2168
2177
 
2169
2178
  // src/graphClient.ts
2170
2179
  function createGraphClient(config = {}) {
2171
2180
  const gateway = createGatewayRequestClient(config);
2172
- return {
2181
+ const client = {
2173
2182
  /**
2174
2183
  * List graph nodes matching the provided filters.
2175
2184
  */
@@ -2182,12 +2191,6 @@ function createGraphClient(config = {}) {
2182
2191
  (response) => mapGatewayData(response, (data) => mapAliasedList(data, "nodes"))
2183
2192
  );
2184
2193
  },
2185
- /**
2186
- * @deprecated Use listNodes.
2187
- */
2188
- async queryNodes(query5) {
2189
- return this.listNodes(query5);
2190
- },
2191
2194
  /**
2192
2195
  * Retrieve a single graph node by nodeId or globalId.
2193
2196
  */
@@ -2298,12 +2301,6 @@ function createGraphClient(config = {}) {
2298
2301
  )
2299
2302
  );
2300
2303
  },
2301
- /**
2302
- * @deprecated Use listEdges.
2303
- */
2304
- async queryEdges(query5) {
2305
- return this.listEdges(query5);
2306
- },
2307
2304
  /**
2308
2305
  * Create a graph edge.
2309
2306
  */
@@ -2391,12 +2388,6 @@ function createGraphClient(config = {}) {
2391
2388
  body: normalizeTopicQuery(query5)
2392
2389
  });
2393
2390
  },
2394
- /**
2395
- * Retrieve a graph neighborhood around a root node.
2396
- */
2397
- async getNeighborhood(query5) {
2398
- return this.neighborhood(query5);
2399
- },
2400
2391
  /**
2401
2392
  * Retrieve the shortest known path between two graph nodes.
2402
2393
  */
@@ -2414,6 +2405,11 @@ function createGraphClient(config = {}) {
2414
2405
  });
2415
2406
  }
2416
2407
  };
2408
+ return Object.assign(client, {
2409
+ queryNodes: client.listNodes,
2410
+ queryEdges: client.listEdges,
2411
+ getNeighborhood: client.neighborhood
2412
+ });
2417
2413
  }
2418
2414
 
2419
2415
  // src/identityClient.ts
@@ -2467,6 +2463,13 @@ function createIdentityClient(config = {}) {
2467
2463
  body: input,
2468
2464
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
2469
2465
  });
2466
+ const updatePrincipal = (input, idempotencyKey) => requestPrincipalWrite("PATCH", input, idempotencyKey);
2467
+ const deleteKey = (keyId, input = {}, idempotencyKey) => gateway.request({
2468
+ path: `/api/platform/v1/identity/keys/${encodeURIComponent(keyId)}/revoke`,
2469
+ method: "POST",
2470
+ body: input,
2471
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
2472
+ });
2470
2473
  return {
2471
2474
  /**
2472
2475
  * Resolve the current authenticated identity summary.
@@ -2515,15 +2518,11 @@ function createIdentityClient(config = {}) {
2515
2518
  /**
2516
2519
  * Update a principal.
2517
2520
  */
2518
- async updatePrincipal(input, idempotencyKey) {
2519
- return requestPrincipalWrite("PATCH", input, idempotencyKey);
2520
- },
2521
+ updatePrincipal,
2521
2522
  /**
2522
2523
  * @deprecated Use createPrincipal or updatePrincipal.
2523
2524
  */
2524
- async upsertPrincipal(input, idempotencyKey) {
2525
- return requestPrincipalWrite("PATCH", input, idempotencyKey);
2526
- },
2525
+ upsertPrincipal: updatePrincipal,
2527
2526
  /**
2528
2527
  * List keys in the current identity scope.
2529
2528
  */
@@ -2562,20 +2561,11 @@ function createIdentityClient(config = {}) {
2562
2561
  /**
2563
2562
  * Delete an API key by revoking it.
2564
2563
  */
2565
- async deleteKey(keyId, input = {}, idempotencyKey) {
2566
- return gateway.request({
2567
- path: `/api/platform/v1/identity/keys/${encodeURIComponent(keyId)}/revoke`,
2568
- method: "POST",
2569
- body: input,
2570
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
2571
- });
2572
- },
2564
+ deleteKey,
2573
2565
  /**
2574
2566
  * @deprecated Use deleteKey.
2575
2567
  */
2576
- async revokeKey(keyId, input = {}, idempotencyKey) {
2577
- return this.deleteKey(keyId, input, idempotencyKey);
2578
- },
2568
+ revokeKey: deleteKey,
2579
2569
  /**
2580
2570
  * Search Clerk users by email or display attributes.
2581
2571
  */
@@ -2691,14 +2681,11 @@ function createIdentityClient(config = {}) {
2691
2681
  }
2692
2682
 
2693
2683
  // src/topicsClient.ts
2694
- function asRecord3(value) {
2695
- return value && typeof value === "object" ? value : {};
2696
- }
2697
2684
  function cleanString3(value) {
2698
2685
  return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
2699
2686
  }
2700
2687
  function normalizeTopicRecord(value) {
2701
- const record = asRecord3(value);
2688
+ const record = asRecord(value);
2702
2689
  const topicId = cleanString3(record.topicId) ?? cleanString3(record.id) ?? cleanString3(record._id);
2703
2690
  return withTopicAlias({
2704
2691
  ...record,
@@ -2723,7 +2710,7 @@ function createTopicsClient(config = {}) {
2723
2710
  })}`
2724
2711
  }).then(
2725
2712
  (response) => mapGatewayData(response, (data) => {
2726
- const record = asRecord3(data);
2713
+ const record = asRecord(data);
2727
2714
  const items = Array.isArray(record.topics) ? record.topics.map(normalizeTopicRecord) : [];
2728
2715
  return {
2729
2716
  ...createListResult(items, "topics"),
@@ -2740,7 +2727,7 @@ function createTopicsClient(config = {}) {
2740
2727
  }).then(
2741
2728
  (response) => mapGatewayData(
2742
2729
  response,
2743
- (data) => normalizeTopicRecord(asRecord3(data).topic ?? data)
2730
+ (data) => normalizeTopicRecord(asRecord(data).topic ?? data)
2744
2731
  )
2745
2732
  );
2746
2733
  },
@@ -2776,7 +2763,7 @@ function createTopicsClient(config = {}) {
2776
2763
  )}`
2777
2764
  }).then(
2778
2765
  (response) => mapGatewayData(response, (data) => {
2779
- const record = asRecord3(data);
2766
+ const record = asRecord(data);
2780
2767
  return {
2781
2768
  tree: Array.isArray(record.tree) ? record.tree.map(normalizeTopicTreeNode) : []
2782
2769
  };
@@ -3195,7 +3182,7 @@ function createEventsFacade(config = {}) {
3195
3182
  function createGraphFacade(config = {}) {
3196
3183
  const graphClient = createGraphClient(config);
3197
3184
  const gateway = createGatewayRequestClient(config);
3198
- return {
3185
+ const graphFacade = {
3199
3186
  async neighborhood(input) {
3200
3187
  return graphClient.neighborhood({
3201
3188
  globalId: input.globalId,
@@ -3203,18 +3190,6 @@ function createGraphFacade(config = {}) {
3203
3190
  maxDepth: input.maxDepth
3204
3191
  });
3205
3192
  },
3206
- async traverse(input) {
3207
- return graphClient.traverse(input);
3208
- },
3209
- async analyze(input = {}) {
3210
- return graphClient.analyze(input);
3211
- },
3212
- async bias(input = {}) {
3213
- return graphClient.bias(input);
3214
- },
3215
- async gaps(input) {
3216
- return graphClient.gaps(input);
3217
- },
3218
3193
  async falsify(input, idempotencyKey = randomIdempotencyKey()) {
3219
3194
  return gateway.request({
3220
3195
  path: "/api/platform/v1/graph/falsify",
@@ -3224,6 +3199,12 @@ function createGraphFacade(config = {}) {
3224
3199
  });
3225
3200
  }
3226
3201
  };
3202
+ return Object.assign(graphFacade, {
3203
+ traverse: graphClient.traverse,
3204
+ analyze: graphClient.analyze,
3205
+ bias: graphClient.bias,
3206
+ gaps: graphClient.gaps
3207
+ });
3227
3208
  }
3228
3209
  function createIdentityFacade(config = {}) {
3229
3210
  const identityClient = createIdentityClient(config);
@@ -3237,15 +3218,12 @@ function createIdentityFacade(config = {}) {
3237
3218
  function createOntologiesFacade(config = {}) {
3238
3219
  const ontologyClient = createOntologyClient(config);
3239
3220
  const gateway = createGatewayRequestClient(config);
3240
- return {
3221
+ const ontologyFacade = {
3241
3222
  async get(id) {
3242
3223
  return gateway.request({
3243
3224
  path: `/api/platform/v1/ontologies/${encodeURIComponent(id)}`
3244
3225
  });
3245
3226
  },
3246
- async list(query5 = {}) {
3247
- return ontologyClient.list(query5);
3248
- },
3249
3227
  async bind(input, idempotencyKey) {
3250
3228
  return gateway.request({
3251
3229
  path: `/api/platform/v1/ontologies/${encodeURIComponent(input.ontologyId)}/bind`,
@@ -3265,6 +3243,9 @@ function createOntologiesFacade(config = {}) {
3265
3243
  });
3266
3244
  }
3267
3245
  };
3246
+ return Object.assign(ontologyFacade, {
3247
+ list: ontologyClient.list
3248
+ });
3268
3249
  }
3269
3250
  function createQuestionsFacade(config = {}) {
3270
3251
  const gateway = createGatewayRequestClient(config);
@@ -3457,15 +3438,9 @@ function createTasksFacade(config = {}) {
3457
3438
  function createTopicsFacade(config = {}) {
3458
3439
  const topicsClient = createTopicsClient(config);
3459
3440
  return {
3460
- async create(input, idempotencyKey) {
3461
- return topicsClient.create(input, idempotencyKey);
3462
- },
3463
- async get(id) {
3464
- return topicsClient.get(id);
3465
- },
3466
- async list(query5 = {}) {
3467
- return topicsClient.list(query5);
3468
- },
3441
+ create: topicsClient.create,
3442
+ get: topicsClient.get,
3443
+ list: topicsClient.list,
3469
3444
  async update(input, idempotencyKey) {
3470
3445
  const { id, ...rest } = input;
3471
3446
  return topicsClient.update(id, rest, idempotencyKey);
@@ -3481,12 +3456,8 @@ function createTopicsFacade(config = {}) {
3481
3456
  maxDepth: input.maxDepth
3482
3457
  });
3483
3458
  },
3484
- async remove(id, idempotencyKey = randomIdempotencyKey()) {
3485
- return topicsClient.remove(id, idempotencyKey);
3486
- },
3487
- async bulkCreate(input, idempotencyKey = randomIdempotencyKey()) {
3488
- return topicsClient.bulkCreate(input, idempotencyKey);
3489
- }
3459
+ remove: topicsClient.remove,
3460
+ bulkCreate: topicsClient.bulkCreate
3490
3461
  };
3491
3462
  }
3492
3463
  function createWebhooksFacade(config = {}) {
@@ -3686,7 +3657,7 @@ function createWorktreesFacade(config = {}) {
3686
3657
  // src/decisionsClient.ts
3687
3658
  function createDecisionsClient(config = {}) {
3688
3659
  const gateway = createGatewayRequestClient(config);
3689
- return {
3660
+ const client = {
3690
3661
  /**
3691
3662
  * List judgments for a topic scope.
3692
3663
  */
@@ -3764,12 +3735,6 @@ function createDecisionsClient(config = {}) {
3764
3735
  })
3765
3736
  );
3766
3737
  },
3767
- /**
3768
- * @deprecated Use listPendingOutcomeReviews.
3769
- */
3770
- async listPendingJudgmentOutcomeReview(query5) {
3771
- return this.listPendingOutcomeReviews(query5);
3772
- },
3773
3738
  /**
3774
3739
  * Get audit integrity checks for judgment transitions.
3775
3740
  */
@@ -3802,12 +3767,6 @@ function createDecisionsClient(config = {}) {
3802
3767
  )
3803
3768
  );
3804
3769
  },
3805
- /**
3806
- * @deprecated Use createJudgment.
3807
- */
3808
- async recordJudgment(input, idempotencyKey) {
3809
- return this.createJudgment(input, idempotencyKey);
3810
- },
3811
3770
  /**
3812
3771
  * Update the outcome for an existing judgment.
3813
3772
  */
@@ -3818,14 +3777,13 @@ function createDecisionsClient(config = {}) {
3818
3777
  body: input,
3819
3778
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
3820
3779
  });
3821
- },
3822
- /**
3823
- * @deprecated Use updateJudgmentOutcome.
3824
- */
3825
- async recordJudgmentOutcome(judgmentId, input, idempotencyKey) {
3826
- return this.updateJudgmentOutcome(judgmentId, input, idempotencyKey);
3827
3780
  }
3828
3781
  };
3782
+ return Object.assign(client, {
3783
+ listPendingJudgmentOutcomeReview: client.listPendingOutcomeReviews,
3784
+ recordJudgment: client.createJudgment,
3785
+ recordJudgmentOutcome: client.updateJudgmentOutcome
3786
+ });
3829
3787
  }
3830
3788
 
3831
3789
  // src/embeddingsClient.ts
@@ -3950,50 +3908,55 @@ function cleanNumber(value) {
3950
3908
  function cleanBoolean(value) {
3951
3909
  return typeof value === "boolean" ? value : void 0;
3952
3910
  }
3953
- function buildCompileContextRequest(topicId, input = {}) {
3954
- const payload = { topicId };
3955
- const query5 = cleanString4(input.query);
3911
+ function buildCompileContextRequest(topicIdOrInput = {}, input = {}) {
3912
+ const effectiveInput = typeof topicIdOrInput === "string" ? input : topicIdOrInput;
3913
+ const payload = {};
3914
+ const topicId = typeof topicIdOrInput === "string" ? cleanString4(topicIdOrInput) : cleanString4(effectiveInput.topicId);
3915
+ if (topicId) {
3916
+ payload.topicId = topicId;
3917
+ }
3918
+ const query5 = cleanString4(effectiveInput.query);
3956
3919
  if (query5) {
3957
3920
  payload.query = query5;
3958
3921
  }
3959
- const budget = cleanNumber(input.budget) ?? cleanNumber(input.tokenBudget);
3922
+ const budget = cleanNumber(effectiveInput.budget) ?? cleanNumber(effectiveInput.tokenBudget);
3960
3923
  if (budget !== void 0) {
3961
3924
  payload.budget = budget;
3962
3925
  }
3963
- const ranking = cleanString4(input.ranking) ?? cleanString4(input.rankingProfile);
3926
+ const ranking = cleanString4(effectiveInput.ranking) ?? cleanString4(effectiveInput.rankingProfile);
3964
3927
  if (ranking) {
3965
3928
  payload.ranking = ranking;
3966
3929
  }
3967
- const limit = cleanNumber(input.limit);
3930
+ const limit = cleanNumber(effectiveInput.limit);
3968
3931
  if (limit !== void 0) {
3969
3932
  payload.limit = limit;
3970
3933
  }
3971
- const maxDepth = cleanNumber(input.maxDepth);
3934
+ const maxDepth = cleanNumber(effectiveInput.maxDepth);
3972
3935
  if (maxDepth !== void 0) {
3973
3936
  payload.maxDepth = maxDepth;
3974
3937
  }
3975
- const includeEntities = cleanBoolean(input.includeEntities);
3938
+ const includeEntities = cleanBoolean(effectiveInput.includeEntities);
3976
3939
  if (includeEntities !== void 0) {
3977
3940
  payload.includeEntities = includeEntities;
3978
3941
  }
3979
- const mode = cleanString4(input.mode);
3942
+ const mode = cleanString4(effectiveInput.mode);
3980
3943
  if (mode) {
3981
3944
  payload.mode = mode;
3982
3945
  }
3983
- const includeFailures = cleanBoolean(input.includeFailures);
3946
+ const includeFailures = cleanBoolean(effectiveInput.includeFailures);
3984
3947
  if (includeFailures !== void 0) {
3985
3948
  payload.includeFailures = includeFailures;
3986
3949
  }
3987
- const worktreeId = cleanString4(input.worktreeId);
3950
+ const worktreeId = cleanString4(effectiveInput.worktreeId);
3988
3951
  if (worktreeId) {
3989
3952
  payload.worktreeId = worktreeId;
3990
3953
  }
3991
- const sessionId = cleanString4(input.sessionId);
3954
+ const sessionId = cleanString4(effectiveInput.sessionId);
3992
3955
  if (sessionId) {
3993
3956
  payload.sessionId = sessionId;
3994
3957
  }
3995
- if (Array.isArray(input.packWeightOverrides) && input.packWeightOverrides.length > 0) {
3996
- payload.packWeightOverrides = input.packWeightOverrides;
3958
+ if (Array.isArray(effectiveInput.packWeightOverrides) && effectiveInput.packWeightOverrides.length > 0) {
3959
+ payload.packWeightOverrides = effectiveInput.packWeightOverrides;
3997
3960
  }
3998
3961
  return {
3999
3962
  path: "/api/platform/v1/context/compile",
@@ -4005,13 +3968,20 @@ function createContextClient(config = {}) {
4005
3968
  const gateway = createGatewayRequestClient(config);
4006
3969
  return {
4007
3970
  /**
4008
- * Compile a focused reasoning context pack for a topic scope.
4009
- * @param topicId - The topic to compile context for.
3971
+ * Compile a focused reasoning context pack.
3972
+ * @param topicIdOrInput - Optional topic ID, or compile input for query-first resolution.
4010
3973
  * @param input - Optional compile parameters (query, budget, ranking, etc.).
4011
3974
  * @returns The compiled context payload with beliefs, questions, and evidence.
4012
3975
  */
4013
- async compile(topicId, input = {}) {
4014
- const request = buildCompileContextRequest(topicId, input);
3976
+ async compile(topicIdOrInput = {}, input = {}) {
3977
+ const request = buildCompileContextRequest(topicIdOrInput, input);
3978
+ return gateway.request({
3979
+ ...request,
3980
+ body: request.body
3981
+ });
3982
+ },
3983
+ async compileByQuery(input = {}) {
3984
+ const request = buildCompileContextRequest(input);
4015
3985
  return gateway.request({
4016
3986
  ...request,
4017
3987
  body: request.body
@@ -4449,7 +4419,7 @@ function createGraphStateClassifierClient(config = {}) {
4449
4419
  // src/harnessClient.ts
4450
4420
  function createHarnessClient(config = {}) {
4451
4421
  const gateway = createGatewayRequestClient(config);
4452
- return {
4422
+ const client = {
4453
4423
  /**
4454
4424
  * List agent definitions.
4455
4425
  */
@@ -4482,12 +4452,6 @@ function createHarnessClient(config = {}) {
4482
4452
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4483
4453
  });
4484
4454
  },
4485
- /**
4486
- * @deprecated Use createAgentDefinition.
4487
- */
4488
- async registerAgentDefinition(input, idempotencyKey) {
4489
- return this.createAgentDefinition(input, idempotencyKey);
4490
- },
4491
4455
  /**
4492
4456
  * Update an agent definition.
4493
4457
  */
@@ -4526,12 +4490,6 @@ function createHarnessClient(config = {}) {
4526
4490
  )
4527
4491
  );
4528
4492
  },
4529
- /**
4530
- * @deprecated Use listAgentRuns.
4531
- */
4532
- async listRunsForAgent(agentId, scope = {}) {
4533
- return this.listAgentRuns(agentId, scope);
4534
- },
4535
4493
  /**
4536
4494
  * List tool definitions.
4537
4495
  */
@@ -4564,12 +4522,6 @@ function createHarnessClient(config = {}) {
4564
4522
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4565
4523
  });
4566
4524
  },
4567
- /**
4568
- * @deprecated Use createToolDefinition.
4569
- */
4570
- async registerToolDefinition(input, idempotencyKey) {
4571
- return this.createToolDefinition(input, idempotencyKey);
4572
- },
4573
4525
  /**
4574
4526
  * Update a tool definition.
4575
4527
  */
@@ -4604,12 +4556,6 @@ function createHarnessClient(config = {}) {
4604
4556
  )
4605
4557
  );
4606
4558
  },
4607
- /**
4608
- * @deprecated Use listRunEntries.
4609
- */
4610
- async listRunLedgerEntries(scope = {}) {
4611
- return this.listRunEntries(scope);
4612
- },
4613
4559
  /**
4614
4560
  * Create a harness run.
4615
4561
  */
@@ -4684,6 +4630,12 @@ function createHarnessClient(config = {}) {
4684
4630
  });
4685
4631
  }
4686
4632
  };
4633
+ return Object.assign(client, {
4634
+ registerAgentDefinition: client.createAgentDefinition,
4635
+ listRunsForAgent: client.listAgentRuns,
4636
+ registerToolDefinition: client.createToolDefinition,
4637
+ listRunLedgerEntries: client.listRunEntries
4638
+ });
4687
4639
  }
4688
4640
 
4689
4641
  // src/jobsClient.ts
@@ -4811,45 +4763,41 @@ function createJobsClient(config = {}) {
4811
4763
  // src/learningClient.ts
4812
4764
  function createLearningClient(config = {}) {
4813
4765
  const gateway = createGatewayRequestClient(config);
4766
+ const listRecentExecutions = async (args = {}) => gateway.request({
4767
+ path: `/api/platform/v1/learning/executions/recent${toQueryString({
4768
+ ...normalizeTopicQuery(args),
4769
+ namespace: args.namespace,
4770
+ audienceMode: args.audienceMode,
4771
+ success: typeof args.success === "boolean" ? args.success ? "true" : "false" : void 0,
4772
+ limit: typeof args.limit === "number" && Number.isFinite(args.limit) ? String(args.limit) : void 0
4773
+ })}`
4774
+ }).then(
4775
+ (response) => mapGatewayData(
4776
+ response,
4777
+ (data) => createListResult(Array.isArray(data) ? data : [], "executions")
4778
+ )
4779
+ );
4780
+ const getExecutionStats = async (args = {}) => gateway.request({
4781
+ path: `/api/platform/v1/learning/executions/stats${toQueryString({
4782
+ ...normalizeTopicQuery(args),
4783
+ namespace: args.namespace,
4784
+ audienceMode: args.audienceMode,
4785
+ hours: typeof args.hours === "number" && Number.isFinite(args.hours) ? String(args.hours) : void 0
4786
+ })}`
4787
+ });
4814
4788
  return {
4815
4789
  /**
4816
4790
  * List recent execution records.
4817
4791
  */
4818
- async listRecentExecutions(args = {}) {
4819
- return gateway.request({
4820
- path: `/api/platform/v1/learning/executions/recent${toQueryString({
4821
- ...normalizeTopicQuery(args),
4822
- namespace: args.namespace,
4823
- audienceMode: args.audienceMode,
4824
- success: typeof args.success === "boolean" ? args.success ? "true" : "false" : void 0,
4825
- limit: typeof args.limit === "number" && Number.isFinite(args.limit) ? String(args.limit) : void 0
4826
- })}`
4827
- }).then(
4828
- (response) => mapGatewayData(
4829
- response,
4830
- (data) => createListResult(Array.isArray(data) ? data : [], "executions")
4831
- )
4832
- );
4833
- },
4792
+ listRecentExecutions,
4834
4793
  /**
4835
4794
  * @deprecated Use listRecentExecutions.
4836
4795
  */
4837
- async getRecentExecutions(args = {}) {
4838
- return this.listRecentExecutions(args);
4839
- },
4796
+ getRecentExecutions: listRecentExecutions,
4840
4797
  /**
4841
4798
  * Get aggregate execution statistics.
4842
4799
  */
4843
- async getExecutionStats(args = {}) {
4844
- return gateway.request({
4845
- path: `/api/platform/v1/learning/executions/stats${toQueryString({
4846
- ...normalizeTopicQuery(args),
4847
- namespace: args.namespace,
4848
- audienceMode: args.audienceMode,
4849
- hours: typeof args.hours === "number" && Number.isFinite(args.hours) ? String(args.hours) : void 0
4850
- })}`
4851
- });
4852
- }
4800
+ getExecutionStats
4853
4801
  };
4854
4802
  }
4855
4803
  function toJsonValue(value) {
@@ -5763,7 +5711,7 @@ function createOrgGraphSearchClient(config = {}) {
5763
5711
  // src/packsClient.ts
5764
5712
  function createPacksClient(config = {}) {
5765
5713
  const gateway = createGatewayRequestClient(config);
5766
- return {
5714
+ const client = {
5767
5715
  /**
5768
5716
  * List catalog entries for available packs.
5769
5717
  */
@@ -5777,12 +5725,6 @@ function createPacksClient(config = {}) {
5777
5725
  )
5778
5726
  );
5779
5727
  },
5780
- /**
5781
- * @deprecated Use listCatalog.
5782
- */
5783
- async getCatalog() {
5784
- return this.listCatalog();
5785
- },
5786
5728
  /**
5787
5729
  * Get the discovery catalog for packs.
5788
5730
  */
@@ -5812,12 +5754,6 @@ function createPacksClient(config = {}) {
5812
5754
  )
5813
5755
  );
5814
5756
  },
5815
- /**
5816
- * @deprecated Use listStates.
5817
- */
5818
- async getStates(query5 = {}) {
5819
- return this.listStates(query5);
5820
- },
5821
5757
  /**
5822
5758
  * Get health details for a pack.
5823
5759
  */
@@ -5841,12 +5777,6 @@ function createPacksClient(config = {}) {
5841
5777
  )
5842
5778
  );
5843
5779
  },
5844
- /**
5845
- * @deprecated Use listTelemetry.
5846
- */
5847
- async getTelemetry(query5 = {}) {
5848
- return this.listTelemetry(query5);
5849
- },
5850
5780
  /**
5851
5781
  * Create a pack entitlement.
5852
5782
  */
@@ -5858,18 +5788,6 @@ function createPacksClient(config = {}) {
5858
5788
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
5859
5789
  });
5860
5790
  },
5861
- /**
5862
- * Update a pack entitlement.
5863
- */
5864
- async updateEntitlement(input, idempotencyKey) {
5865
- return this.createEntitlement(input, idempotencyKey);
5866
- },
5867
- /**
5868
- * @deprecated Use createEntitlement or updateEntitlement.
5869
- */
5870
- async upsertEntitlement(input, idempotencyKey) {
5871
- return this.createEntitlement(input, idempotencyKey);
5872
- },
5873
5791
  /**
5874
5792
  * Install a pack.
5875
5793
  */
@@ -5926,6 +5844,13 @@ function createPacksClient(config = {}) {
5926
5844
  });
5927
5845
  }
5928
5846
  };
5847
+ return Object.assign(client, {
5848
+ getCatalog: client.listCatalog,
5849
+ getStates: client.listStates,
5850
+ getTelemetry: client.listTelemetry,
5851
+ updateEntitlement: client.createEntitlement,
5852
+ upsertEntitlement: client.createEntitlement
5853
+ });
5929
5854
  }
5930
5855
 
5931
5856
  // src/policyClient.ts
@@ -5961,6 +5886,14 @@ function asRolePolicyArray(data) {
5961
5886
  }
5962
5887
  return data.map(asRolePolicyRecord).filter((row) => Boolean(row));
5963
5888
  }
5889
+ function buildFilterByPermissionResponse(permission, allowedTopicIds, deniedTopics, count) {
5890
+ const result = {};
5891
+ result.permission = permission;
5892
+ result.allowedTopicIds = allowedTopicIds;
5893
+ result.deniedTopics = deniedTopics;
5894
+ result.count = count;
5895
+ return result;
5896
+ }
5964
5897
  function createPolicyClient(config = {}) {
5965
5898
  const gateway = createGatewayRequestClient(config);
5966
5899
  return {
@@ -6183,15 +6116,15 @@ function createPolicyClient(config = {}) {
6183
6116
  });
6184
6117
  const allowedTopicIds = Array.isArray(response.data?.allowedTopicIds) ? response.data.allowedTopicIds : [];
6185
6118
  const deniedTopics = Array.isArray(response.data?.deniedTopics) ? response.data.deniedTopics : [];
6186
- return {
6187
- success: true,
6188
- data: {
6189
- permission,
6190
- allowedTopicIds,
6191
- deniedTopics,
6192
- count: typeof response.data?.count === "number" ? response.data.count : allowedTopicIds.length
6193
- }
6194
- };
6119
+ const result = {};
6120
+ result.success = true;
6121
+ result.data = buildFilterByPermissionResponse(
6122
+ permission,
6123
+ allowedTopicIds,
6124
+ deniedTopics,
6125
+ typeof response.data?.count === "number" ? response.data.count : allowedTopicIds.length
6126
+ );
6127
+ return result;
6195
6128
  }
6196
6129
  };
6197
6130
  }
@@ -6199,64 +6132,66 @@ function createPolicyClient(config = {}) {
6199
6132
  // src/reportsClient.ts
6200
6133
  function createReportsClient(config = {}) {
6201
6134
  const gateway = createGatewayRequestClient(config);
6135
+ const listTemplates = async (args = {}) => gateway.request({
6136
+ path: `/api/platform/v1/reports/templates${toQueryString({
6137
+ slug: args.slug
6138
+ })}`
6139
+ }).then(
6140
+ (response) => mapGatewayData(response, (data) => {
6141
+ const rows = asListItems(data, "templates");
6142
+ return createListResult(rows, "templates");
6143
+ })
6144
+ );
6145
+ const listReports = async (input, args = {}) => {
6146
+ const topicId = resolveTopicId(input);
6147
+ if (!topicId) {
6148
+ throw new Error("topicId is required");
6149
+ }
6150
+ return gateway.request({
6151
+ path: `/api/platform/v1/reports/topics/${encodeURIComponent(topicId)}${toQueryString(
6152
+ {
6153
+ summary: typeof args.summary === "boolean" ? args.summary ? "true" : "false" : void 0
6154
+ }
6155
+ )}`
6156
+ }).then(
6157
+ (response) => mapGatewayData(
6158
+ response,
6159
+ (data) => createListResult(Array.isArray(data) ? data : [], "reports")
6160
+ )
6161
+ );
6162
+ };
6163
+ const getReport = async (reportId) => gateway.request({
6164
+ path: `/api/platform/v1/reports/${encodeURIComponent(reportId)}`
6165
+ });
6202
6166
  return {
6203
6167
  /**
6204
6168
  * List report templates.
6205
6169
  */
6206
- async listTemplates(args = {}) {
6207
- return gateway.request({
6208
- path: `/api/platform/v1/reports/templates${toQueryString({
6209
- slug: args.slug
6210
- })}`
6211
- }).then(
6212
- (response) => mapGatewayData(response, (data) => {
6213
- const record = data && typeof data === "object" ? data : {};
6214
- const rows = Array.isArray(data) ? data : Array.isArray(record.templates) ? record.templates : [];
6215
- return createListResult(rows, "templates");
6216
- })
6217
- );
6218
- },
6170
+ listTemplates,
6219
6171
  /**
6220
6172
  * @deprecated Use listTemplates.
6221
6173
  */
6222
- async getTemplates(args = {}) {
6223
- return this.listTemplates(args);
6224
- },
6174
+ getTemplates: listTemplates,
6225
6175
  /**
6226
6176
  * List reports for a topic scope.
6227
6177
  */
6228
- async listReports(input, args = {}) {
6229
- const topicId = resolveTopicId(input);
6230
- if (!topicId) {
6231
- throw new Error("topicId is required");
6232
- }
6233
- return gateway.request({
6234
- path: `/api/platform/v1/reports/topics/${encodeURIComponent(topicId)}${toQueryString(
6235
- {
6236
- summary: typeof args.summary === "boolean" ? args.summary ? "true" : "false" : void 0
6237
- }
6238
- )}`
6239
- }).then(
6240
- (response) => mapGatewayData(
6241
- response,
6242
- (data) => createListResult(Array.isArray(data) ? data : [], "reports")
6243
- )
6244
- );
6245
- },
6178
+ listReports,
6246
6179
  /**
6247
6180
  * Get a generated report.
6248
6181
  */
6249
- async getReport(reportId) {
6250
- return gateway.request({
6251
- path: `/api/platform/v1/reports/${encodeURIComponent(reportId)}`
6252
- });
6253
- }
6182
+ getReport
6254
6183
  };
6255
6184
  }
6256
6185
 
6257
6186
  // src/schemaClient.ts
6258
6187
  function createSchemaClient(config = {}) {
6259
6188
  const gateway = createGatewayRequestClient(config);
6189
+ const createEntitlement = (input, idempotencyKey) => gateway.request({
6190
+ path: "/api/platform/v1/schema/entitlements",
6191
+ method: "POST",
6192
+ body: input,
6193
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6194
+ });
6260
6195
  return {
6261
6196
  /**
6262
6197
  * List schema packs.
@@ -6308,29 +6243,95 @@ function createSchemaClient(config = {}) {
6308
6243
  /**
6309
6244
  * Create a schema entitlement.
6310
6245
  */
6311
- async createEntitlement(input, idempotencyKey) {
6312
- return gateway.request({
6313
- path: "/api/platform/v1/schema/entitlements",
6314
- method: "POST",
6315
- body: input,
6316
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6317
- });
6318
- },
6246
+ createEntitlement,
6319
6247
  /**
6320
6248
  * Update a schema entitlement.
6321
6249
  */
6322
- async updateEntitlement(input, idempotencyKey) {
6323
- return this.createEntitlement(input, idempotencyKey);
6324
- },
6250
+ updateEntitlement: createEntitlement,
6325
6251
  /**
6326
6252
  * @deprecated Use createEntitlement or updateEntitlement.
6327
6253
  */
6328
- async upsertEntitlement(input, idempotencyKey) {
6329
- return this.createEntitlement(input, idempotencyKey);
6330
- }
6254
+ upsertEntitlement: createEntitlement
6331
6255
  };
6332
6256
  }
6333
6257
 
6258
+ // src/clientHelpers.ts
6259
+ function asNodeArray(data) {
6260
+ const rows = asListItems(data, "nodes");
6261
+ if (rows.length > 0) {
6262
+ return rows.filter(
6263
+ (value) => Boolean(value) && typeof value === "object"
6264
+ );
6265
+ }
6266
+ if (data && typeof data === "object") {
6267
+ return [data];
6268
+ }
6269
+ return [];
6270
+ }
6271
+ function requireTopicId4(args) {
6272
+ const topicId = resolveTopicId(args);
6273
+ if (!topicId) {
6274
+ throw new Error("topicId is required");
6275
+ }
6276
+ return topicId;
6277
+ }
6278
+ function requireTopicOrProjectId(args) {
6279
+ const topicId = args.topicId?.trim() || args.projectId?.trim() || void 0;
6280
+ if (!topicId) {
6281
+ throw new Error("topicId is required");
6282
+ }
6283
+ return topicId;
6284
+ }
6285
+ var AUDIT_NODE_REFERENCE_KEY_PATTERN = /(^|_)(id|nodeid|beliefid|resourceid|targetid|sourceid|subjectid|globalid|entityid|recordid|fromnodeid|tonodeid|linkednodeid|linkedbeliefid|nodeids|beliefids|resourceids)$/i;
6286
+ function matchesAuditNodeReference(value, nodeId) {
6287
+ if (Array.isArray(value)) {
6288
+ return value.some((entry) => matchesAuditNodeReference(entry, nodeId));
6289
+ }
6290
+ if (!value || typeof value !== "object") {
6291
+ return false;
6292
+ }
6293
+ return Object.entries(value).some(([key, entry]) => {
6294
+ if (typeof entry === "string" && entry === nodeId && AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key)) {
6295
+ return true;
6296
+ }
6297
+ if (Array.isArray(entry) && AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key) && entry.some((item) => item === nodeId)) {
6298
+ return true;
6299
+ }
6300
+ return matchesAuditNodeReference(entry, nodeId);
6301
+ });
6302
+ }
6303
+ function requireText(args) {
6304
+ const text = resolveText(args);
6305
+ if (!text) {
6306
+ throw new Error("text is required");
6307
+ }
6308
+ return text;
6309
+ }
6310
+ function requireBaseRate(args) {
6311
+ const baseRate = typeof args.baseRate === "number" && Number.isFinite(args.baseRate) ? args.baseRate : 0.5;
6312
+ if (baseRate < 0 || baseRate > 1) {
6313
+ throw new Error("baseRate must be within [0, 1].");
6314
+ }
6315
+ return baseRate;
6316
+ }
6317
+ function sdkQueryString(input) {
6318
+ const params = new URLSearchParams();
6319
+ for (const [key, value] of Object.entries(input)) {
6320
+ if (value === void 0 || value === null) {
6321
+ continue;
6322
+ }
6323
+ if (Array.isArray(value)) {
6324
+ if (value.length > 0) {
6325
+ params.set(key, value.join(","));
6326
+ }
6327
+ continue;
6328
+ }
6329
+ params.set(key, String(value));
6330
+ }
6331
+ const serialized = params.toString();
6332
+ return serialized ? `?${serialized}` : "";
6333
+ }
6334
+
6334
6335
  // src/telemetryClient.ts
6335
6336
  var TELEMETRY_FIELDS = [
6336
6337
  "tenantId",
@@ -6501,6 +6502,16 @@ function query4(input) {
6501
6502
  cursor: input.cursor
6502
6503
  };
6503
6504
  }
6505
+ function effectiveToolsQuery(input) {
6506
+ return {
6507
+ ...query4(input),
6508
+ callerRole: input.callerRole,
6509
+ surface: input.surface,
6510
+ sessionType: input.sessionType,
6511
+ permittedToolNames: input.permittedToolNames ? JSON.stringify(input.permittedToolNames) : void 0,
6512
+ executableOnly: input.executableOnly
6513
+ };
6514
+ }
6504
6515
  function writeBody(input, operation) {
6505
6516
  return knownPayload(input, TOOL_REGISTRY_FIELDS, operation);
6506
6517
  }
@@ -6529,7 +6540,9 @@ function createToolRegistryClient(config = {}) {
6529
6540
  },
6530
6541
  listEffectiveTools(input) {
6531
6542
  return gateway.request({
6532
- path: `/api/platform/v1/tools/effective${toQueryString(query4(input))}`
6543
+ path: `/api/platform/v1/tools/effective${toQueryString(
6544
+ effectiveToolsQuery(input)
6545
+ )}`
6533
6546
  }).then(
6534
6547
  (response) => mapGatewayData(
6535
6548
  response,
@@ -6620,7 +6633,7 @@ function createToolRegistryClient(config = {}) {
6620
6633
  }
6621
6634
 
6622
6635
  // src/version.ts
6623
- var LUCERN_SDK_VERSION = "0.2.0-alpha.1";
6636
+ var LUCERN_SDK_VERSION = "0.3.0-alpha.8";
6624
6637
 
6625
6638
  // src/workflowClient.ts
6626
6639
  function normalizeLensQuery(value) {
@@ -6814,12 +6827,6 @@ function createWorkflowClient(config = {}) {
6814
6827
  )
6815
6828
  );
6816
6829
  },
6817
- /**
6818
- * @deprecated Use createWorktree.
6819
- */
6820
- async addWorktree(input, idempotencyKey) {
6821
- return client.createWorktree(input, idempotencyKey);
6822
- },
6823
6830
  /**
6824
6831
  * Merge a worktree into the main belief line.
6825
6832
  */
@@ -7017,54 +7024,19 @@ function createWorkflowClient(config = {}) {
7017
7024
  body: input,
7018
7025
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
7019
7026
  });
7020
- },
7021
- /**
7022
- * @deprecated Use createBranch.
7023
- */
7024
- async createPillar(input, idempotencyKey) {
7025
- return client.createBranch(input, idempotencyKey);
7026
- },
7027
- /**
7028
- * @deprecated Use addWorktree.
7029
- */
7030
- async createSprint(input, idempotencyKey) {
7031
- return client.createWorktree(input, idempotencyKey);
7032
- },
7033
- /**
7034
- * @deprecated Use merge.
7035
- */
7036
- async completeSprint(worktreeId, input, idempotencyKey) {
7037
- return client.merge(worktreeId, input, idempotencyKey);
7038
- },
7039
- /**
7040
- * @deprecated Use openPullRequest.
7041
- */
7042
- async requestReview(worktreeId, input, idempotencyKey) {
7043
- return client.openPullRequest(worktreeId, input, idempotencyKey);
7044
- },
7045
- /**
7046
- * @deprecated Use push.
7047
- */
7048
- async publishFindings(worktreeId, input, idempotencyKey) {
7049
- return client.push(worktreeId, input, idempotencyKey);
7050
7027
  }
7051
7028
  };
7052
- return client;
7029
+ return Object.assign(client, {
7030
+ addWorktree: client.createWorktree,
7031
+ createPillar: client.createBranch,
7032
+ createSprint: client.createWorktree,
7033
+ completeSprint: client.merge,
7034
+ requestReview: client.openPullRequest,
7035
+ publishFindings: client.push
7036
+ });
7053
7037
  }
7054
7038
 
7055
7039
  // src/client.ts
7056
- function asNodeArray(data) {
7057
- const rows = asListItems(data, "nodes");
7058
- if (rows.length > 0) {
7059
- return rows.filter(
7060
- (value) => Boolean(value) && typeof value === "object"
7061
- );
7062
- }
7063
- if (data && typeof data === "object") {
7064
- return [data];
7065
- }
7066
- return [];
7067
- }
7068
7040
  function toGatewayConfig(config) {
7069
7041
  return {
7070
7042
  baseUrl: config.baseUrl,
@@ -7092,72 +7064,9 @@ function toGatewayConfig(config) {
7092
7064
  }
7093
7065
  };
7094
7066
  }
7095
- function requireTopicId4(args) {
7096
- const topicId = resolveTopicId(args);
7097
- if (!topicId) {
7098
- throw new Error("topicId is required");
7099
- }
7100
- return topicId;
7101
- }
7102
- function requireTopicOrProjectId(args) {
7103
- const topicId = args.topicId?.trim() || args.projectId?.trim() || void 0;
7104
- if (!topicId) {
7105
- throw new Error("topicId is required");
7106
- }
7107
- return topicId;
7108
- }
7109
- var AUDIT_NODE_REFERENCE_KEY_PATTERN = /(^|_)(id|nodeid|beliefid|resourceid|targetid|sourceid|subjectid|globalid|entityid|recordid|fromnodeid|tonodeid|linkednodeid|linkedbeliefid|nodeids|beliefids|resourceids)$/i;
7110
- function matchesAuditNodeReference(value, nodeId) {
7111
- if (Array.isArray(value)) {
7112
- return value.some((entry) => matchesAuditNodeReference(entry, nodeId));
7113
- }
7114
- if (!value || typeof value !== "object") {
7115
- return false;
7116
- }
7117
- return Object.entries(value).some(([key, entry]) => {
7118
- if (typeof entry === "string" && entry === nodeId && AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key)) {
7119
- return true;
7120
- }
7121
- if (Array.isArray(entry) && AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key) && entry.some((item) => item === nodeId)) {
7122
- return true;
7123
- }
7124
- return matchesAuditNodeReference(entry, nodeId);
7125
- });
7126
- }
7127
- function requireText(args) {
7128
- const text = resolveText(args);
7129
- if (!text) {
7130
- throw new Error("text is required");
7131
- }
7132
- return text;
7133
- }
7134
- function requireBaseRate(args) {
7135
- const baseRate = typeof args.baseRate === "number" && Number.isFinite(args.baseRate) ? args.baseRate : 0.5;
7136
- if (baseRate < 0 || baseRate > 1) {
7137
- throw new Error("baseRate must be within [0, 1].");
7138
- }
7139
- return baseRate;
7140
- }
7141
7067
  function exposeGatewayData(response) {
7142
7068
  return Object.assign({}, response, response.data);
7143
7069
  }
7144
- function sdkQueryString(input) {
7145
- const params = new URLSearchParams();
7146
- for (const [key, value] of Object.entries(input)) {
7147
- if (value === void 0 || value === null) {
7148
- continue;
7149
- }
7150
- if (Array.isArray(value)) {
7151
- if (value.length > 0) {
7152
- params.set(key, value.join(","));
7153
- }
7154
- continue;
7155
- }
7156
- params.set(key, String(value));
7157
- }
7158
- const serialized = params.toString();
7159
- return serialized ? `?${serialized}` : "";
7160
- }
7161
7070
  function createLucernClient(config = {}) {
7162
7071
  const gatewayConfig = toGatewayConfig(config);
7163
7072
  const beliefsClient = createBeliefsClient(gatewayConfig);
@@ -7381,7 +7290,7 @@ function createLucernClient(config = {}) {
7381
7290
  topicId,
7382
7291
  nodeType: "contradiction",
7383
7292
  limit: 500
7384
- }) : args.nodeId ? await graphClient.queryNodes({ nodeId: args.nodeId }) : { data: [] };
7293
+ }) : args.nodeId ? await graphClient.listNodes({ nodeId: args.nodeId }) : { data: [] };
7385
7294
  const contradictions = asNodeArray(response.data).filter((node) => {
7386
7295
  const status = typeof node.metadata?.status === "string" ? node.metadata.status : typeof node.status === "string" ? node.status : "unresolved";
7387
7296
  if (args.status && status !== args.status) {
@@ -7561,23 +7470,15 @@ function createLucernClient(config = {}) {
7561
7470
  }).then(exposeGatewayData);
7562
7471
  }
7563
7472
  const nodesNamespace = {
7564
- list(query5) {
7565
- return graphClient.listNodes(query5);
7566
- },
7473
+ list: graphClient.listNodes,
7567
7474
  get(input) {
7568
7475
  return graphClient.getNode(
7569
7476
  typeof input === "string" ? { nodeId: input } : input
7570
7477
  );
7571
7478
  },
7572
- create(input, idempotencyKey) {
7573
- return graphClient.createNode(input, idempotencyKey);
7574
- },
7575
- update(input, idempotencyKey) {
7576
- return graphClient.updateNode(input, idempotencyKey);
7577
- },
7578
- batchCreate(input, idempotencyKey) {
7579
- return graphClient.batchCreateNodes(input, idempotencyKey);
7580
- },
7479
+ create: graphClient.createNode,
7480
+ update: graphClient.updateNode,
7481
+ batchCreate: graphClient.batchCreateNodes,
7581
7482
  listByTopicAndType(input) {
7582
7483
  return gateway.request({
7583
7484
  path: `/api/platform/v1/nodes${sdkQueryString({
@@ -7602,15 +7503,9 @@ function createLucernClient(config = {}) {
7602
7503
  })}`
7603
7504
  }).then(exposeGatewayData);
7604
7505
  },
7605
- supersede(input, idempotencyKey) {
7606
- return graphClient.supersedeNode(input, idempotencyKey);
7607
- },
7608
- verify(input, idempotencyKey) {
7609
- return graphClient.verifyNode(input, idempotencyKey);
7610
- },
7611
- hardDelete(input, idempotencyKey) {
7612
- return graphClient.hardDeleteNode(input, idempotencyKey);
7613
- }
7506
+ supersede: graphClient.supersedeNode,
7507
+ verify: graphClient.verifyNode,
7508
+ hardDelete: graphClient.hardDeleteNode
7614
7509
  };
7615
7510
  const publicationNamespace = {
7616
7511
  create(input, idempotencyKey) {
@@ -7687,9 +7582,7 @@ function createLucernClient(config = {}) {
7687
7582
  return {
7688
7583
  config,
7689
7584
  version: LUCERN_SDK_VERSION,
7690
- search(query5, options) {
7691
- return searchResources(query5, options);
7692
- },
7585
+ search: searchResources,
7693
7586
  events: {
7694
7587
  list(query5 = {}) {
7695
7588
  return eventsFacade.list(query5).then(exposeGatewayData);
@@ -7786,9 +7679,7 @@ function createLucernClient(config = {}) {
7786
7679
  confidenceHistory(nodeId) {
7787
7680
  return beliefsFacade.confidenceHistory(nodeId).then(exposeGatewayData);
7788
7681
  },
7789
- opinionHistory(nodeId) {
7790
- return getOpinionHistory(nodeId);
7791
- },
7682
+ opinionHistory: getOpinionHistory,
7792
7683
  createContract(nodeId, input) {
7793
7684
  return beliefsFacade.createContract(nodeId, input).then(exposeGatewayData);
7794
7685
  },
@@ -8042,10 +7933,10 @@ function createLucernClient(config = {}) {
8042
7933
  }));
8043
7934
  },
8044
7935
  getHighPriority(args) {
8045
- return this.list({
7936
+ return questionsFacade.list({
8046
7937
  topicId: requireTopicId4(args),
8047
7938
  status: args.includeAnswered ? void 0 : "open"
8048
- }).then((data) => {
7939
+ }).then(exposeGatewayData).then((data) => {
8049
7940
  const questions = Array.isArray(data.questions) ? data.questions : [];
8050
7941
  const rank = (priority) => {
8051
7942
  switch (priority) {
@@ -8075,9 +7966,7 @@ function createLucernClient(config = {}) {
8075
7966
  },
8076
7967
  graph: {
8077
7968
  nodes: nodesNamespace,
8078
- createEdge(input) {
8079
- return graphClient.createEdge(input);
8080
- },
7969
+ createEdge: graphClient.createEdge,
8081
7970
  neighborhood(args) {
8082
7971
  return graphFacade.neighborhood({
8083
7972
  globalId: args.globalId,
@@ -8136,7 +8025,7 @@ function createLucernClient(config = {}) {
8136
8025
  bisectConfidence,
8137
8026
  listBeliefs,
8138
8027
  detectConfirmationBias(topicId, threshold) {
8139
- return this.bias({
8028
+ return graphFacade.bias({
8140
8029
  topicId,
8141
8030
  threshold,
8142
8031
  limit: 200
@@ -8147,7 +8036,7 @@ function createLucernClient(config = {}) {
8147
8036
  }));
8148
8037
  },
8149
8038
  getStructureAnalysis(topicId) {
8150
- return this.analyze({
8039
+ return graphFacade.analyze({
8151
8040
  topicId,
8152
8041
  limit: 200
8153
8042
  }).then((response) => ({
@@ -8214,38 +8103,20 @@ function createLucernClient(config = {}) {
8214
8103
  }
8215
8104
  },
8216
8105
  judgments: {
8217
- create(input) {
8218
- return decisionsClient.createJudgment(input);
8219
- },
8220
- record(input) {
8221
- return decisionsClient.recordJudgment(input);
8222
- },
8223
- list(query5) {
8224
- return decisionsClient.listJudgments(query5);
8225
- },
8226
- get(judgmentId) {
8227
- return decisionsClient.getJudgment(judgmentId);
8228
- },
8229
- recordOutcome(judgmentId, input) {
8230
- return decisionsClient.recordJudgmentOutcome(judgmentId, input);
8231
- },
8232
- updateOutcome(judgmentId, input) {
8233
- return decisionsClient.updateJudgmentOutcome(judgmentId, input);
8234
- },
8106
+ create: decisionsClient.createJudgment,
8107
+ record: decisionsClient.recordJudgment,
8108
+ list: decisionsClient.listJudgments,
8109
+ get: decisionsClient.getJudgment,
8110
+ recordOutcome: decisionsClient.recordJudgmentOutcome,
8111
+ updateOutcome: decisionsClient.updateJudgmentOutcome,
8235
8112
  readiness(topicId) {
8236
- return decisionsClient.getJudgmentReadiness({
8237
- topicId
8238
- });
8113
+ return decisionsClient.getJudgmentReadiness({ topicId });
8239
8114
  },
8240
8115
  calibration(topicId) {
8241
- return decisionsClient.getJudgmentCalibration({
8242
- topicId
8243
- });
8116
+ return decisionsClient.getJudgmentCalibration({ topicId });
8244
8117
  },
8245
8118
  pendingOutcomeReview(topicId) {
8246
- return decisionsClient.listPendingJudgmentOutcomeReview({
8247
- topicId
8248
- });
8119
+ return decisionsClient.listPendingJudgmentOutcomeReview({ topicId });
8249
8120
  },
8250
8121
  transitionAuditIntegrity(args) {
8251
8122
  return decisionsClient.getJudgmentTransitionAuditIntegrity({
@@ -8255,21 +8126,11 @@ function createLucernClient(config = {}) {
8255
8126
  }
8256
8127
  },
8257
8128
  decisions: {
8258
- create(input) {
8259
- return decisionsClient.createJudgment(input);
8260
- },
8261
- record(input) {
8262
- return decisionsClient.recordJudgment(input);
8263
- },
8264
- list(query5) {
8265
- return decisionsClient.listJudgments(query5);
8266
- },
8267
- get(decisionId) {
8268
- return decisionsClient.getJudgment(decisionId);
8269
- },
8270
- recordOutcome(decisionId, input) {
8271
- return decisionsClient.recordJudgmentOutcome(decisionId, input);
8272
- },
8129
+ create: decisionsClient.createJudgment,
8130
+ record: decisionsClient.recordJudgment,
8131
+ list: decisionsClient.listJudgments,
8132
+ get: decisionsClient.getJudgment,
8133
+ recordOutcome: decisionsClient.recordJudgmentOutcome,
8273
8134
  lessons(decisionId, input, idempotencyKey) {
8274
8135
  return gateway.request({
8275
8136
  path: `/api/platform/v1/decisions/${encodeURIComponent(
@@ -8301,21 +8162,11 @@ function createLucernClient(config = {}) {
8301
8162
  }
8302
8163
  },
8303
8164
  worktrees: {
8304
- createBranch(input) {
8305
- return workflowClient.createBranch(input);
8306
- },
8307
- createLens(input) {
8308
- return workflowClient.createLens(input);
8309
- },
8310
- listLenses(query5) {
8311
- return workflowClient.listLenses(query5);
8312
- },
8313
- applyLensToTopic(input) {
8314
- return workflowClient.applyLensToTopic(input);
8315
- },
8316
- removeLensFromTopic(input) {
8317
- return workflowClient.removeLensFromTopic(input);
8318
- },
8165
+ createBranch: workflowClient.createBranch,
8166
+ createLens: workflowClient.createLens,
8167
+ listLenses: workflowClient.listLenses,
8168
+ applyLensToTopic: workflowClient.applyLensToTopic,
8169
+ removeLensFromTopic: workflowClient.removeLensFromTopic,
8319
8170
  create(input) {
8320
8171
  return worktreesFacade.create({
8321
8172
  title: input.title,
@@ -8420,7 +8271,9 @@ function createLucernClient(config = {}) {
8420
8271
  const dependsOn = Array.isArray(input.dependsOn) ? input.dependsOn.filter(
8421
8272
  (value) => typeof value === "string"
8422
8273
  ) : void 0;
8423
- const blocks = Array.isArray(input.blocks) ? input.blocks.filter((value) => typeof value === "string") : void 0;
8274
+ const blocks = Array.isArray(input.blocks) ? input.blocks.filter(
8275
+ (value) => typeof value === "string"
8276
+ ) : void 0;
8424
8277
  return worktreesFacade.update({
8425
8278
  id: typeof input.worktreeId === "string" ? input.worktreeId : "",
8426
8279
  hypothesis: typeof input.hypothesis === "string" ? input.hypothesis : void 0,
@@ -8434,7 +8287,23 @@ function createLucernClient(config = {}) {
8434
8287
  });
8435
8288
  },
8436
8289
  update(input) {
8437
- return this.updateMetadata(input);
8290
+ const dependsOn = Array.isArray(input.dependsOn) ? input.dependsOn.filter(
8291
+ (value) => typeof value === "string"
8292
+ ) : void 0;
8293
+ const blocks = Array.isArray(input.blocks) ? input.blocks.filter(
8294
+ (value) => typeof value === "string"
8295
+ ) : void 0;
8296
+ return worktreesFacade.update({
8297
+ id: typeof input.worktreeId === "string" ? input.worktreeId : "",
8298
+ hypothesis: typeof input.hypothesis === "string" ? input.hypothesis : void 0,
8299
+ campaign: typeof input.campaign === "number" ? input.campaign : void 0,
8300
+ lane: typeof input.lane === "string" ? input.lane : void 0,
8301
+ laneOrderInCampaign: typeof input.laneOrderInCampaign === "number" ? input.laneOrderInCampaign : void 0,
8302
+ orderInLane: typeof input.orderInLane === "number" ? input.orderInLane : void 0,
8303
+ dependsOn,
8304
+ blocks,
8305
+ gate: typeof input.gate === "string" ? input.gate : void 0
8306
+ });
8438
8307
  },
8439
8308
  updateTargets(input) {
8440
8309
  return worktreesFacade.updateTargets({
@@ -8445,9 +8314,7 @@ function createLucernClient(config = {}) {
8445
8314
  removeQuestionIds: input.removeQuestionIds
8446
8315
  });
8447
8316
  },
8448
- listAll(query5 = {}) {
8449
- return workflowClient.listAllWorktrees(query5);
8450
- },
8317
+ listAll: workflowClient.listAllWorktrees,
8451
8318
  merge(worktreeId, input) {
8452
8319
  return worktreesFacade.merge({
8453
8320
  id: worktreeId,
@@ -8455,18 +8322,12 @@ function createLucernClient(config = {}) {
8455
8322
  summary: input.summary
8456
8323
  });
8457
8324
  },
8458
- push(worktreeId, input) {
8459
- return workflowClient.push(worktreeId, input);
8460
- },
8461
- openPullRequest(worktreeId, input) {
8462
- return workflowClient.openPullRequest(worktreeId, input);
8463
- },
8325
+ push: workflowClient.push,
8326
+ openPullRequest: workflowClient.openPullRequest,
8464
8327
  pipelineSnapshot(topicId) {
8465
8328
  return functionSurfaceClient.pipelineSnapshot({ topicId });
8466
8329
  },
8467
- complete(input, idempotencyKey) {
8468
- return worktreesFacade.complete(input, idempotencyKey);
8469
- },
8330
+ complete: worktreesFacade.complete,
8470
8331
  advancePhase(worktreeId, idempotencyKey) {
8471
8332
  return worktreesFacade.advancePhase(
8472
8333
  { worktreeId },
@@ -8479,12 +8340,8 @@ function createLucernClient(config = {}) {
8479
8340
  idempotencyKey
8480
8341
  );
8481
8342
  },
8482
- patchState(input, idempotencyKey) {
8483
- return worktreesFacade.patchState(input, idempotencyKey);
8484
- },
8485
- bulkCreate(input, idempotencyKey) {
8486
- return worktreesFacade.bulkCreate(input, idempotencyKey);
8487
- }
8343
+ patchState: worktreesFacade.patchState,
8344
+ bulkCreate: worktreesFacade.bulkCreate
8488
8345
  },
8489
8346
  context: {
8490
8347
  listTopics(query5 = {}) {
@@ -8495,27 +8352,15 @@ function createLucernClient(config = {}) {
8495
8352
  type: query5.type
8496
8353
  });
8497
8354
  },
8498
- compile(topicId, input = {}) {
8499
- return contextClient.compile(topicId, input);
8500
- },
8501
- recordScopeLearning(input, idempotencyKey) {
8502
- return functionSurfaceClient.recordScopeLearning(input, idempotencyKey);
8503
- },
8355
+ compile: contextClient.compile,
8356
+ recordScopeLearning: functionSurfaceClient.recordScopeLearning,
8504
8357
  discover(input) {
8505
8358
  return discoverTopics(input);
8506
8359
  },
8507
- analyzeTopicDensity(input) {
8508
- return functionSurfaceClient.analyzeTopicDensity(input);
8509
- },
8510
- applyAutoBranching(input, idempotencyKey) {
8511
- return functionSurfaceClient.applyAutoBranching(input, idempotencyKey);
8512
- },
8513
- seedBeliefLattice(input = {}, idempotencyKey) {
8514
- return functionSurfaceClient.seedBeliefLattice(input, idempotencyKey);
8515
- },
8516
- getLatticeCoverage(input = {}) {
8517
- return functionSurfaceClient.getLatticeCoverage(input);
8518
- },
8360
+ analyzeTopicDensity: functionSurfaceClient.analyzeTopicDensity,
8361
+ applyAutoBranching: functionSurfaceClient.applyAutoBranching,
8362
+ seedBeliefLattice: functionSurfaceClient.seedBeliefLattice,
8363
+ getLatticeCoverage: functionSurfaceClient.getLatticeCoverage,
8519
8364
  matchEntityType(input) {
8520
8365
  return ontologiesFacade.match(input).then(exposeGatewayData);
8521
8366
  },
@@ -8600,9 +8445,7 @@ function createLucernClient(config = {}) {
8600
8445
  type: input.type
8601
8446
  });
8602
8447
  },
8603
- get(topicId) {
8604
- return topicsFacade.get(topicId);
8605
- },
8448
+ get: topicsFacade.get,
8606
8449
  create(input) {
8607
8450
  return topicsFacade.create({
8608
8451
  name: input.name,
@@ -8647,12 +8490,8 @@ function createLucernClient(config = {}) {
8647
8490
  maxDepth: query5.maxDepth
8648
8491
  });
8649
8492
  },
8650
- remove(topicId, idempotencyKey) {
8651
- return topicsFacade.remove(topicId, idempotencyKey);
8652
- },
8653
- bulkCreate(input, idempotencyKey) {
8654
- return topicsFacade.bulkCreate(input, idempotencyKey);
8655
- }
8493
+ remove: topicsFacade.remove,
8494
+ bulkCreate: topicsFacade.bulkCreate
8656
8495
  },
8657
8496
  answers: {
8658
8497
  create(input) {
@@ -8751,33 +8590,15 @@ function createLucernClient(config = {}) {
8751
8590
  raw: ontologyClient
8752
8591
  },
8753
8592
  coordination: {
8754
- registerSession(input = {}, idempotencyKey) {
8755
- return functionSurfaceClient.registerSession(input, idempotencyKey);
8756
- },
8757
- heartbeatSession(input = {}, idempotencyKey) {
8758
- return functionSurfaceClient.heartbeatSession(input, idempotencyKey);
8759
- },
8760
- endSession(input = {}, idempotencyKey) {
8761
- return functionSurfaceClient.endSession(input, idempotencyKey);
8762
- },
8763
- listActiveSessions(input = {}) {
8764
- return functionSurfaceClient.listActiveSessions(input);
8765
- },
8766
- sendAgentMessage(input, idempotencyKey) {
8767
- return functionSurfaceClient.sendAgentMessage(input, idempotencyKey);
8768
- },
8769
- broadcastMessage(input, idempotencyKey) {
8770
- return functionSurfaceClient.broadcastMessage(input, idempotencyKey);
8771
- },
8772
- getInbox(input = {}) {
8773
- return functionSurfaceClient.getAgentInbox(input);
8774
- },
8775
- getAgentInbox(input = {}) {
8776
- return functionSurfaceClient.getAgentInbox(input);
8777
- },
8778
- claimFiles(input, idempotencyKey) {
8779
- return functionSurfaceClient.claimFiles(input, idempotencyKey);
8780
- }
8593
+ registerSession: functionSurfaceClient.registerSession,
8594
+ heartbeatSession: functionSurfaceClient.heartbeatSession,
8595
+ endSession: functionSurfaceClient.endSession,
8596
+ listActiveSessions: functionSurfaceClient.listActiveSessions,
8597
+ sendAgentMessage: functionSurfaceClient.sendAgentMessage,
8598
+ broadcastMessage: functionSurfaceClient.broadcastMessage,
8599
+ getInbox: functionSurfaceClient.getAgentInbox,
8600
+ getAgentInbox: functionSurfaceClient.getAgentInbox,
8601
+ claimFiles: functionSurfaceClient.claimFiles
8781
8602
  },
8782
8603
  policy: {
8783
8604
  checkPermission(input) {
@@ -8808,38 +8629,24 @@ function createLucernClient(config = {}) {
8808
8629
  principalId: typeof input.principalId === "string" ? input.principalId : void 0
8809
8630
  });
8810
8631
  },
8632
+ // Backward compatibility shim: keep the policy namespace exposing the
8633
+ // historical manageWritePolicy entry point.
8811
8634
  manageWritePolicy(input, idempotencyKey) {
8812
8635
  return functionSurfaceClient.manageWritePolicy(input, idempotencyKey);
8813
8636
  },
8814
8637
  raw: policyClient
8815
8638
  },
8816
8639
  observations: {
8817
- ingest(input, idempotencyKey) {
8818
- return functionSurfaceClient.ingestObservation(input, idempotencyKey);
8819
- },
8820
- ingestObservation(input, idempotencyKey) {
8821
- return functionSurfaceClient.ingestObservation(input, idempotencyKey);
8822
- },
8823
- getContext(input) {
8824
- return functionSurfaceClient.getObservationContext(input);
8825
- },
8826
- getObservationContext(input) {
8827
- return functionSurfaceClient.getObservationContext(input);
8828
- }
8640
+ ingest: functionSurfaceClient.ingestObservation,
8641
+ ingestObservation: functionSurfaceClient.ingestObservation,
8642
+ getContext: functionSurfaceClient.getObservationContext,
8643
+ getObservationContext: functionSurfaceClient.getObservationContext
8829
8644
  },
8830
8645
  coding: {
8831
- getCodeContext(input) {
8832
- return functionSurfaceClient.getCodeContext(input);
8833
- },
8834
- getChangeHistory(input) {
8835
- return functionSurfaceClient.getChangeHistory(input);
8836
- },
8837
- recordAttempt(input, idempotencyKey) {
8838
- return functionSurfaceClient.recordAttempt(input, idempotencyKey);
8839
- },
8840
- getFailureLog(input) {
8841
- return functionSurfaceClient.getFailureLog(input);
8842
- }
8646
+ getCodeContext: functionSurfaceClient.getCodeContext,
8647
+ getChangeHistory: functionSurfaceClient.getChangeHistory,
8648
+ recordAttempt: functionSurfaceClient.recordAttempt,
8649
+ getFailureLog: functionSurfaceClient.getFailureLog
8843
8650
  },
8844
8651
  contracts: {
8845
8652
  create(input) {
@@ -8865,9 +8672,7 @@ function createLucernClient(config = {}) {
8865
8672
  }
8866
8673
  },
8867
8674
  bootstrap: {
8868
- generateSessionHandoff(input) {
8869
- return functionSurfaceClient.generateSessionHandoff(input);
8870
- }
8675
+ generateSessionHandoff: functionSurfaceClient.generateSessionHandoff
8871
8676
  },
8872
8677
  embeddings: embeddingsClient,
8873
8678
  graphAnalysis: graphAnalysisClient,
@@ -8889,25 +8694,15 @@ function createLucernClient(config = {}) {
8889
8694
  createAcl: toolRegistryClient.createAcl,
8890
8695
  deleteAcl: toolRegistryClient.deleteAcl,
8891
8696
  registerCustomTool: toolRegistryClient.registerCustomTool,
8892
- register(registration) {
8893
- return registerCustomTool(registration);
8894
- },
8895
- unregister(fullName) {
8896
- return unregisterCustomTool(fullName);
8897
- },
8898
- list() {
8899
- return listRegisteredCustomTools();
8900
- },
8901
- clear() {
8902
- clearRegisteredCustomTools();
8903
- },
8697
+ register: registerCustomTool,
8698
+ unregister: unregisterCustomTool,
8699
+ list: listRegisteredCustomTools,
8700
+ clear: clearRegisteredCustomTools,
8904
8701
  invoke(name, input = {}) {
8905
8702
  const fullName = name.includes(".") ? name : `custom.${name}`;
8906
8703
  return invokeCustomTool(fullName, input);
8907
8704
  },
8908
- namespace(namespace) {
8909
- return getCustomNamespace(namespace);
8910
- }
8705
+ namespace: getCustomNamespace
8911
8706
  },
8912
8707
  packs: {
8913
8708
  /**
@@ -8922,27 +8717,13 @@ function createLucernClient(config = {}) {
8922
8717
  get isInstalled() {
8923
8718
  return _packInstalled;
8924
8719
  },
8925
- listCatalog() {
8926
- return packsClient.listCatalog();
8927
- },
8928
- catalog() {
8929
- return packsClient.getCatalog();
8930
- },
8931
- listStates(scope) {
8932
- return packsClient.listStates(scope);
8933
- },
8934
- states(scope) {
8935
- return packsClient.getStates(scope);
8936
- },
8937
- install(input) {
8938
- return packsClient.install(input);
8939
- },
8940
- enable(input) {
8941
- return packsClient.enable(input);
8942
- },
8943
- disable(input) {
8944
- return packsClient.disable(input);
8945
- }
8720
+ listCatalog: packsClient.listCatalog,
8721
+ catalog: packsClient.listCatalog,
8722
+ listStates: packsClient.listStates,
8723
+ states: packsClient.getStates,
8724
+ install: packsClient.install,
8725
+ enable: packsClient.enable,
8726
+ disable: packsClient.disable
8946
8727
  },
8947
8728
  nodes: nodesNamespace,
8948
8729
  identity: {
@@ -8955,30 +8736,16 @@ function createLucernClient(config = {}) {
8955
8736
  raw: identityClient
8956
8737
  },
8957
8738
  mcp: {
8958
- bootstrapSession(input) {
8959
- return mcpClient.bootstrapSession(input);
8960
- },
8961
- checkWritePolicy(input) {
8962
- return mcpClient.checkWritePolicy(input);
8963
- },
8964
- beginBuildSession(input) {
8965
- return mcpClient.beginBuildSession(input);
8966
- },
8967
- evaluateEngineeringContract(input) {
8968
- return mcpClient.evaluateEngineeringContract(input);
8969
- },
8970
- evaluateResearchContract(input) {
8971
- return mcpClient.evaluateResearchContract(input);
8972
- }
8739
+ bootstrapSession: mcpClient.bootstrapSession,
8740
+ checkWritePolicy: mcpClient.checkWritePolicy,
8741
+ beginBuildSession: mcpClient.beginBuildSession,
8742
+ evaluateEngineeringContract: mcpClient.evaluateEngineeringContract,
8743
+ evaluateResearchContract: mcpClient.evaluateResearchContract
8973
8744
  },
8974
8745
  auth: {
8975
8746
  device: {
8976
- createCode(input) {
8977
- return authDeviceClient.createDeviceCode(input);
8978
- },
8979
- pollToken(deviceCode) {
8980
- return authDeviceClient.pollDeviceToken(deviceCode);
8981
- }
8747
+ createCode: authDeviceClient.createDeviceCode,
8748
+ pollToken: authDeviceClient.pollDeviceToken
8982
8749
  }
8983
8750
  },
8984
8751
  custom: getCustomNamespace("custom"),