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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/dist/adminClient.d.ts +8 -8
  3. package/dist/adminClient.js +47 -36
  4. package/dist/adminClient.js.map +1 -1
  5. package/dist/answersClient.js +26 -8
  6. package/dist/answersClient.js.map +1 -1
  7. package/dist/audience/index.d.ts +2 -1
  8. package/dist/audience/index.js +1 -3
  9. package/dist/audience/index.js.map +1 -1
  10. package/dist/audiencesClient.d.ts +16 -16
  11. package/dist/audiencesClient.js +102 -87
  12. package/dist/audiencesClient.js.map +1 -1
  13. package/dist/auditClient.js +30 -10
  14. package/dist/auditClient.js.map +1 -1
  15. package/dist/authDeviceClient.js +16 -3
  16. package/dist/authDeviceClient.js.map +1 -1
  17. package/dist/beliefs/index.d.ts +3 -3
  18. package/dist/beliefs/index.js +513 -758
  19. package/dist/beliefs/index.js.map +1 -1
  20. package/dist/beliefsClient.d.ts +2 -2
  21. package/dist/beliefsClient.js +31 -19
  22. package/dist/beliefsClient.js.map +1 -1
  23. package/dist/boundaryClientSurface.js +10 -3
  24. package/dist/boundaryClientSurface.js.map +1 -1
  25. package/dist/client.d.ts +247 -270
  26. package/dist/client.js +513 -758
  27. package/dist/client.js.map +1 -1
  28. package/dist/clientHelpers.d.ts +29 -0
  29. package/dist/clientHelpers.js +122 -0
  30. package/dist/clientHelpers.js.map +1 -0
  31. package/dist/contextClient.js +26 -8
  32. package/dist/contextClient.js.map +1 -1
  33. package/dist/contextPackCompiler.js +19 -30
  34. package/dist/contextPackCompiler.js.map +1 -1
  35. package/dist/contextPackPolicy.js +7 -17
  36. package/dist/contextPackPolicy.js.map +1 -1
  37. package/dist/contracts/index.js +4 -3
  38. package/dist/contracts/index.js.map +1 -1
  39. package/dist/contracts/lens-filter.contract.js +4 -3
  40. package/dist/contracts/lens-filter.contract.js.map +1 -1
  41. package/dist/contracts/lens-workflow.contract.js +4 -3
  42. package/dist/contracts/lens-workflow.contract.js.map +1 -1
  43. package/dist/contracts/lensFilter.js +4 -3
  44. package/dist/contracts/lensFilter.js.map +1 -1
  45. package/dist/contracts/lensWorkflow.js +4 -3
  46. package/dist/contracts/lensWorkflow.js.map +1 -1
  47. package/dist/contradictions/index.d.ts +2 -2
  48. package/dist/contradictions/index.js +513 -758
  49. package/dist/contradictions/index.js.map +1 -1
  50. package/dist/coreClient.d.ts +2 -1
  51. package/dist/coreClient.js +27 -11
  52. package/dist/coreClient.js.map +1 -1
  53. package/dist/decisions/index.d.ts +12 -12
  54. package/dist/decisions/index.js +513 -758
  55. package/dist/decisions/index.js.map +1 -1
  56. package/dist/decisionsClient.d.ts +4 -12
  57. package/dist/decisionsClient.js +37 -31
  58. package/dist/decisionsClient.js.map +1 -1
  59. package/dist/edges/index.d.ts +2 -2
  60. package/dist/edges/index.js +513 -758
  61. package/dist/edges/index.js.map +1 -1
  62. package/dist/embeddingsClient.js +37 -14
  63. package/dist/embeddingsClient.js.map +1 -1
  64. package/dist/eventingClient.js +37 -14
  65. package/dist/eventingClient.js.map +1 -1
  66. package/dist/events.js +6 -3
  67. package/dist/events.js.map +1 -1
  68. package/dist/eventsCore.d.ts +1 -1
  69. package/dist/eventsCore.js +27 -11
  70. package/dist/eventsCore.js.map +1 -1
  71. package/dist/evidence/index.d.ts +2 -2
  72. package/dist/evidence/index.js +513 -758
  73. package/dist/evidence/index.js.map +1 -1
  74. package/dist/evidenceClient.js +27 -11
  75. package/dist/evidenceClient.js.map +1 -1
  76. package/dist/functionSurface.js +27 -11
  77. package/dist/functionSurface.js.map +1 -1
  78. package/dist/functionSurfaceClient.js +27 -11
  79. package/dist/functionSurfaceClient.js.map +1 -1
  80. package/dist/gatewayFacades.d.ts +27 -45
  81. package/dist/gatewayFacades.js +92 -118
  82. package/dist/gatewayFacades.js.map +1 -1
  83. package/dist/graphAnalysisClient.js +31 -12
  84. package/dist/graphAnalysisClient.js.map +1 -1
  85. package/dist/graphClient.d.ts +5 -13
  86. package/dist/graphClient.js +42 -35
  87. package/dist/graphClient.js.map +1 -1
  88. package/dist/graphRecommendationsClient.js +31 -13
  89. package/dist/graphRecommendationsClient.js.map +1 -1
  90. package/dist/graphStateClassifierClient.js +37 -15
  91. package/dist/graphStateClassifierClient.js.map +1 -1
  92. package/dist/harnessClient.d.ts +13 -24
  93. package/dist/harnessClient.js +38 -37
  94. package/dist/harnessClient.js.map +1 -1
  95. package/dist/identityClient.d.ts +8 -8
  96. package/dist/identityClient.js +48 -31
  97. package/dist/identityClient.js.map +1 -1
  98. package/dist/index.d.ts +2 -2
  99. package/dist/index.js +592 -819
  100. package/dist/index.js.map +1 -1
  101. package/dist/infisicalRuntime.js +47 -24
  102. package/dist/infisicalRuntime.js.map +1 -1
  103. package/dist/jobsClient.js +37 -15
  104. package/dist/jobsClient.js.map +1 -1
  105. package/dist/learningClient.d.ts +6 -6
  106. package/dist/learningClient.js +55 -39
  107. package/dist/learningClient.js.map +1 -1
  108. package/dist/lenses/index.d.ts +29 -35
  109. package/dist/lenses/index.js +513 -758
  110. package/dist/lenses/index.js.map +1 -1
  111. package/dist/mcpClient.js +26 -8
  112. package/dist/mcpClient.js.map +1 -1
  113. package/dist/modelRuntimeClient.js +37 -14
  114. package/dist/modelRuntimeClient.js.map +1 -1
  115. package/dist/nodes/index.d.ts +17 -17
  116. package/dist/nodes/index.js +513 -758
  117. package/dist/nodes/index.js.map +1 -1
  118. package/dist/ontologies/index.d.ts +31 -30
  119. package/dist/ontologies/index.js +513 -758
  120. package/dist/ontologies/index.js.map +1 -1
  121. package/dist/ontologyClient.d.ts +17 -25
  122. package/dist/ontologyClient.js +63 -37
  123. package/dist/ontologyClient.js.map +1 -1
  124. package/dist/ontologyLinksClient.js +37 -15
  125. package/dist/ontologyLinksClient.js.map +1 -1
  126. package/dist/orgGraphSearchClient.js +30 -10
  127. package/dist/orgGraphSearchClient.js.map +1 -1
  128. package/dist/packsClient.d.ts +9 -23
  129. package/dist/packsClient.js +39 -43
  130. package/dist/packsClient.js.map +1 -1
  131. package/dist/policyClient.d.ts +11 -10
  132. package/dist/policyClient.js +48 -22
  133. package/dist/policyClient.js.map +1 -1
  134. package/dist/questions/index.d.ts +2 -2
  135. package/dist/questions/index.js +513 -758
  136. package/dist/questions/index.js.map +1 -1
  137. package/dist/realtime/index.d.ts +1 -1
  138. package/dist/reportsClient.d.ts +7 -7
  139. package/dist/reportsClient.js +84 -48
  140. package/dist/reportsClient.js.map +1 -1
  141. package/dist/schemaClient.d.ts +3 -3
  142. package/dist/schemaClient.js +40 -26
  143. package/dist/schemaClient.js.map +1 -1
  144. package/dist/sdkSurface.d.ts +6 -3
  145. package/dist/sdkSurface.js +10 -6
  146. package/dist/sdkSurface.js.map +1 -1
  147. package/dist/sourcesClient.js +27 -11
  148. package/dist/sourcesClient.js.map +1 -1
  149. package/dist/telemetryClient.js +37 -15
  150. package/dist/telemetryClient.js.map +1 -1
  151. package/dist/toolRegistryClient.d.ts +10 -2
  152. package/dist/toolRegistryClient.js +50 -16
  153. package/dist/toolRegistryClient.js.map +1 -1
  154. package/dist/topics/index.d.ts +5 -5
  155. package/dist/topics/index.js +513 -758
  156. package/dist/topics/index.js.map +1 -1
  157. package/dist/topicsClient.js +37 -16
  158. package/dist/topicsClient.js.map +1 -1
  159. package/dist/version.d.ts +1 -1
  160. package/dist/version.js +1 -1
  161. package/dist/version.js.map +1 -1
  162. package/dist/workflowClient.d.ts +15 -33
  163. package/dist/workflowClient.js +43 -50
  164. package/dist/workflowClient.js.map +1 -1
  165. package/dist/worktrees/index.d.ts +22 -30
  166. package/dist/worktrees/index.js +513 -758
  167. package/dist/worktrees/index.js.map +1 -1
  168. 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
@@ -4455,7 +4413,7 @@ function createGraphStateClassifierClient(config = {}) {
4455
4413
  // src/harnessClient.ts
4456
4414
  function createHarnessClient(config = {}) {
4457
4415
  const gateway = createGatewayRequestClient(config);
4458
- return {
4416
+ const client = {
4459
4417
  /**
4460
4418
  * List agent definitions.
4461
4419
  */
@@ -4488,12 +4446,6 @@ function createHarnessClient(config = {}) {
4488
4446
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4489
4447
  });
4490
4448
  },
4491
- /**
4492
- * @deprecated Use createAgentDefinition.
4493
- */
4494
- async registerAgentDefinition(input, idempotencyKey) {
4495
- return this.createAgentDefinition(input, idempotencyKey);
4496
- },
4497
4449
  /**
4498
4450
  * Update an agent definition.
4499
4451
  */
@@ -4532,12 +4484,6 @@ function createHarnessClient(config = {}) {
4532
4484
  )
4533
4485
  );
4534
4486
  },
4535
- /**
4536
- * @deprecated Use listAgentRuns.
4537
- */
4538
- async listRunsForAgent(agentId, scope = {}) {
4539
- return this.listAgentRuns(agentId, scope);
4540
- },
4541
4487
  /**
4542
4488
  * List tool definitions.
4543
4489
  */
@@ -4570,12 +4516,6 @@ function createHarnessClient(config = {}) {
4570
4516
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4571
4517
  });
4572
4518
  },
4573
- /**
4574
- * @deprecated Use createToolDefinition.
4575
- */
4576
- async registerToolDefinition(input, idempotencyKey) {
4577
- return this.createToolDefinition(input, idempotencyKey);
4578
- },
4579
4519
  /**
4580
4520
  * Update a tool definition.
4581
4521
  */
@@ -4610,12 +4550,6 @@ function createHarnessClient(config = {}) {
4610
4550
  )
4611
4551
  );
4612
4552
  },
4613
- /**
4614
- * @deprecated Use listRunEntries.
4615
- */
4616
- async listRunLedgerEntries(scope = {}) {
4617
- return this.listRunEntries(scope);
4618
- },
4619
4553
  /**
4620
4554
  * Create a harness run.
4621
4555
  */
@@ -4690,6 +4624,12 @@ function createHarnessClient(config = {}) {
4690
4624
  });
4691
4625
  }
4692
4626
  };
4627
+ return Object.assign(client, {
4628
+ registerAgentDefinition: client.createAgentDefinition,
4629
+ listRunsForAgent: client.listAgentRuns,
4630
+ registerToolDefinition: client.createToolDefinition,
4631
+ listRunLedgerEntries: client.listRunEntries
4632
+ });
4693
4633
  }
4694
4634
 
4695
4635
  // src/jobsClient.ts
@@ -4817,45 +4757,41 @@ function createJobsClient(config = {}) {
4817
4757
  // src/learningClient.ts
4818
4758
  function createLearningClient(config = {}) {
4819
4759
  const gateway = createGatewayRequestClient(config);
4760
+ const listRecentExecutions = async (args = {}) => gateway.request({
4761
+ path: `/api/platform/v1/learning/executions/recent${toQueryString({
4762
+ ...normalizeTopicQuery(args),
4763
+ namespace: args.namespace,
4764
+ audienceMode: args.audienceMode,
4765
+ success: typeof args.success === "boolean" ? args.success ? "true" : "false" : void 0,
4766
+ limit: typeof args.limit === "number" && Number.isFinite(args.limit) ? String(args.limit) : void 0
4767
+ })}`
4768
+ }).then(
4769
+ (response) => mapGatewayData(
4770
+ response,
4771
+ (data) => createListResult(Array.isArray(data) ? data : [], "executions")
4772
+ )
4773
+ );
4774
+ const getExecutionStats = async (args = {}) => gateway.request({
4775
+ path: `/api/platform/v1/learning/executions/stats${toQueryString({
4776
+ ...normalizeTopicQuery(args),
4777
+ namespace: args.namespace,
4778
+ audienceMode: args.audienceMode,
4779
+ hours: typeof args.hours === "number" && Number.isFinite(args.hours) ? String(args.hours) : void 0
4780
+ })}`
4781
+ });
4820
4782
  return {
4821
4783
  /**
4822
4784
  * List recent execution records.
4823
4785
  */
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
- },
4786
+ listRecentExecutions,
4840
4787
  /**
4841
4788
  * @deprecated Use listRecentExecutions.
4842
4789
  */
4843
- async getRecentExecutions(args = {}) {
4844
- return this.listRecentExecutions(args);
4845
- },
4790
+ getRecentExecutions: listRecentExecutions,
4846
4791
  /**
4847
4792
  * Get aggregate execution statistics.
4848
4793
  */
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
- }
4794
+ getExecutionStats
4859
4795
  };
4860
4796
  }
4861
4797
  function toJsonValue(value) {
@@ -5769,7 +5705,7 @@ function createOrgGraphSearchClient(config = {}) {
5769
5705
  // src/packsClient.ts
5770
5706
  function createPacksClient(config = {}) {
5771
5707
  const gateway = createGatewayRequestClient(config);
5772
- return {
5708
+ const client = {
5773
5709
  /**
5774
5710
  * List catalog entries for available packs.
5775
5711
  */
@@ -5783,12 +5719,6 @@ function createPacksClient(config = {}) {
5783
5719
  )
5784
5720
  );
5785
5721
  },
5786
- /**
5787
- * @deprecated Use listCatalog.
5788
- */
5789
- async getCatalog() {
5790
- return this.listCatalog();
5791
- },
5792
5722
  /**
5793
5723
  * Get the discovery catalog for packs.
5794
5724
  */
@@ -5818,12 +5748,6 @@ function createPacksClient(config = {}) {
5818
5748
  )
5819
5749
  );
5820
5750
  },
5821
- /**
5822
- * @deprecated Use listStates.
5823
- */
5824
- async getStates(query5 = {}) {
5825
- return this.listStates(query5);
5826
- },
5827
5751
  /**
5828
5752
  * Get health details for a pack.
5829
5753
  */
@@ -5847,12 +5771,6 @@ function createPacksClient(config = {}) {
5847
5771
  )
5848
5772
  );
5849
5773
  },
5850
- /**
5851
- * @deprecated Use listTelemetry.
5852
- */
5853
- async getTelemetry(query5 = {}) {
5854
- return this.listTelemetry(query5);
5855
- },
5856
5774
  /**
5857
5775
  * Create a pack entitlement.
5858
5776
  */
@@ -5864,18 +5782,6 @@ function createPacksClient(config = {}) {
5864
5782
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
5865
5783
  });
5866
5784
  },
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
5785
  /**
5880
5786
  * Install a pack.
5881
5787
  */
@@ -5932,6 +5838,13 @@ function createPacksClient(config = {}) {
5932
5838
  });
5933
5839
  }
5934
5840
  };
5841
+ return Object.assign(client, {
5842
+ getCatalog: client.listCatalog,
5843
+ getStates: client.listStates,
5844
+ getTelemetry: client.listTelemetry,
5845
+ updateEntitlement: client.createEntitlement,
5846
+ upsertEntitlement: client.createEntitlement
5847
+ });
5935
5848
  }
5936
5849
 
5937
5850
  // src/policyClient.ts
@@ -5967,6 +5880,14 @@ function asRolePolicyArray(data) {
5967
5880
  }
5968
5881
  return data.map(asRolePolicyRecord).filter((row) => Boolean(row));
5969
5882
  }
5883
+ function buildFilterByPermissionResponse(permission, allowedTopicIds, deniedTopics, count) {
5884
+ const result = {};
5885
+ result.permission = permission;
5886
+ result.allowedTopicIds = allowedTopicIds;
5887
+ result.deniedTopics = deniedTopics;
5888
+ result.count = count;
5889
+ return result;
5890
+ }
5970
5891
  function createPolicyClient(config = {}) {
5971
5892
  const gateway = createGatewayRequestClient(config);
5972
5893
  return {
@@ -6189,15 +6110,15 @@ function createPolicyClient(config = {}) {
6189
6110
  });
6190
6111
  const allowedTopicIds = Array.isArray(response.data?.allowedTopicIds) ? response.data.allowedTopicIds : [];
6191
6112
  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
- };
6113
+ const result = {};
6114
+ result.success = true;
6115
+ result.data = buildFilterByPermissionResponse(
6116
+ permission,
6117
+ allowedTopicIds,
6118
+ deniedTopics,
6119
+ typeof response.data?.count === "number" ? response.data.count : allowedTopicIds.length
6120
+ );
6121
+ return result;
6201
6122
  }
6202
6123
  };
6203
6124
  }
@@ -6205,64 +6126,66 @@ function createPolicyClient(config = {}) {
6205
6126
  // src/reportsClient.ts
6206
6127
  function createReportsClient(config = {}) {
6207
6128
  const gateway = createGatewayRequestClient(config);
6129
+ const listTemplates = async (args = {}) => gateway.request({
6130
+ path: `/api/platform/v1/reports/templates${toQueryString({
6131
+ slug: args.slug
6132
+ })}`
6133
+ }).then(
6134
+ (response) => mapGatewayData(response, (data) => {
6135
+ const rows = asListItems(data, "templates");
6136
+ return createListResult(rows, "templates");
6137
+ })
6138
+ );
6139
+ const listReports = async (input, args = {}) => {
6140
+ const topicId = resolveTopicId(input);
6141
+ if (!topicId) {
6142
+ throw new Error("topicId is required");
6143
+ }
6144
+ return gateway.request({
6145
+ path: `/api/platform/v1/reports/topics/${encodeURIComponent(topicId)}${toQueryString(
6146
+ {
6147
+ summary: typeof args.summary === "boolean" ? args.summary ? "true" : "false" : void 0
6148
+ }
6149
+ )}`
6150
+ }).then(
6151
+ (response) => mapGatewayData(
6152
+ response,
6153
+ (data) => createListResult(Array.isArray(data) ? data : [], "reports")
6154
+ )
6155
+ );
6156
+ };
6157
+ const getReport = async (reportId) => gateway.request({
6158
+ path: `/api/platform/v1/reports/${encodeURIComponent(reportId)}`
6159
+ });
6208
6160
  return {
6209
6161
  /**
6210
6162
  * List report templates.
6211
6163
  */
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
- },
6164
+ listTemplates,
6225
6165
  /**
6226
6166
  * @deprecated Use listTemplates.
6227
6167
  */
6228
- async getTemplates(args = {}) {
6229
- return this.listTemplates(args);
6230
- },
6168
+ getTemplates: listTemplates,
6231
6169
  /**
6232
6170
  * List reports for a topic scope.
6233
6171
  */
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
- },
6172
+ listReports,
6252
6173
  /**
6253
6174
  * Get a generated report.
6254
6175
  */
6255
- async getReport(reportId) {
6256
- return gateway.request({
6257
- path: `/api/platform/v1/reports/${encodeURIComponent(reportId)}`
6258
- });
6259
- }
6176
+ getReport
6260
6177
  };
6261
6178
  }
6262
6179
 
6263
6180
  // src/schemaClient.ts
6264
6181
  function createSchemaClient(config = {}) {
6265
6182
  const gateway = createGatewayRequestClient(config);
6183
+ const createEntitlement = (input, idempotencyKey) => gateway.request({
6184
+ path: "/api/platform/v1/schema/entitlements",
6185
+ method: "POST",
6186
+ body: input,
6187
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6188
+ });
6266
6189
  return {
6267
6190
  /**
6268
6191
  * List schema packs.
@@ -6314,29 +6237,95 @@ function createSchemaClient(config = {}) {
6314
6237
  /**
6315
6238
  * Create a schema entitlement.
6316
6239
  */
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
- },
6240
+ createEntitlement,
6325
6241
  /**
6326
6242
  * Update a schema entitlement.
6327
6243
  */
6328
- async updateEntitlement(input, idempotencyKey) {
6329
- return this.createEntitlement(input, idempotencyKey);
6330
- },
6244
+ updateEntitlement: createEntitlement,
6331
6245
  /**
6332
6246
  * @deprecated Use createEntitlement or updateEntitlement.
6333
6247
  */
6334
- async upsertEntitlement(input, idempotencyKey) {
6335
- return this.createEntitlement(input, idempotencyKey);
6336
- }
6248
+ upsertEntitlement: createEntitlement
6337
6249
  };
6338
6250
  }
6339
6251
 
6252
+ // src/clientHelpers.ts
6253
+ function asNodeArray(data) {
6254
+ const rows = asListItems(data, "nodes");
6255
+ if (rows.length > 0) {
6256
+ return rows.filter(
6257
+ (value) => Boolean(value) && typeof value === "object"
6258
+ );
6259
+ }
6260
+ if (data && typeof data === "object") {
6261
+ return [data];
6262
+ }
6263
+ return [];
6264
+ }
6265
+ function requireTopicId4(args) {
6266
+ const topicId = resolveTopicId(args);
6267
+ if (!topicId) {
6268
+ throw new Error("topicId is required");
6269
+ }
6270
+ return topicId;
6271
+ }
6272
+ function requireTopicOrProjectId(args) {
6273
+ const topicId = args.topicId?.trim() || args.projectId?.trim() || void 0;
6274
+ if (!topicId) {
6275
+ throw new Error("topicId is required");
6276
+ }
6277
+ return topicId;
6278
+ }
6279
+ var AUDIT_NODE_REFERENCE_KEY_PATTERN = /(^|_)(id|nodeid|beliefid|resourceid|targetid|sourceid|subjectid|globalid|entityid|recordid|fromnodeid|tonodeid|linkednodeid|linkedbeliefid|nodeids|beliefids|resourceids)$/i;
6280
+ function matchesAuditNodeReference(value, nodeId) {
6281
+ if (Array.isArray(value)) {
6282
+ return value.some((entry) => matchesAuditNodeReference(entry, nodeId));
6283
+ }
6284
+ if (!value || typeof value !== "object") {
6285
+ return false;
6286
+ }
6287
+ return Object.entries(value).some(([key, entry]) => {
6288
+ if (typeof entry === "string" && entry === nodeId && AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key)) {
6289
+ return true;
6290
+ }
6291
+ if (Array.isArray(entry) && AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key) && entry.some((item) => item === nodeId)) {
6292
+ return true;
6293
+ }
6294
+ return matchesAuditNodeReference(entry, nodeId);
6295
+ });
6296
+ }
6297
+ function requireText(args) {
6298
+ const text = resolveText(args);
6299
+ if (!text) {
6300
+ throw new Error("text is required");
6301
+ }
6302
+ return text;
6303
+ }
6304
+ function requireBaseRate(args) {
6305
+ const baseRate = typeof args.baseRate === "number" && Number.isFinite(args.baseRate) ? args.baseRate : 0.5;
6306
+ if (baseRate < 0 || baseRate > 1) {
6307
+ throw new Error("baseRate must be within [0, 1].");
6308
+ }
6309
+ return baseRate;
6310
+ }
6311
+ function sdkQueryString(input) {
6312
+ const params = new URLSearchParams();
6313
+ for (const [key, value] of Object.entries(input)) {
6314
+ if (value === void 0 || value === null) {
6315
+ continue;
6316
+ }
6317
+ if (Array.isArray(value)) {
6318
+ if (value.length > 0) {
6319
+ params.set(key, value.join(","));
6320
+ }
6321
+ continue;
6322
+ }
6323
+ params.set(key, String(value));
6324
+ }
6325
+ const serialized = params.toString();
6326
+ return serialized ? `?${serialized}` : "";
6327
+ }
6328
+
6340
6329
  // src/telemetryClient.ts
6341
6330
  var TELEMETRY_FIELDS = [
6342
6331
  "tenantId",
@@ -6507,6 +6496,16 @@ function query4(input) {
6507
6496
  cursor: input.cursor
6508
6497
  };
6509
6498
  }
6499
+ function effectiveToolsQuery(input) {
6500
+ return {
6501
+ ...query4(input),
6502
+ callerRole: input.callerRole,
6503
+ surface: input.surface,
6504
+ sessionType: input.sessionType,
6505
+ permittedToolNames: input.permittedToolNames ? JSON.stringify(input.permittedToolNames) : void 0,
6506
+ executableOnly: input.executableOnly
6507
+ };
6508
+ }
6510
6509
  function writeBody(input, operation) {
6511
6510
  return knownPayload(input, TOOL_REGISTRY_FIELDS, operation);
6512
6511
  }
@@ -6535,7 +6534,9 @@ function createToolRegistryClient(config = {}) {
6535
6534
  },
6536
6535
  listEffectiveTools(input) {
6537
6536
  return gateway.request({
6538
- path: `/api/platform/v1/tools/effective${toQueryString(query4(input))}`
6537
+ path: `/api/platform/v1/tools/effective${toQueryString(
6538
+ effectiveToolsQuery(input)
6539
+ )}`
6539
6540
  }).then(
6540
6541
  (response) => mapGatewayData(
6541
6542
  response,
@@ -6626,7 +6627,7 @@ function createToolRegistryClient(config = {}) {
6626
6627
  }
6627
6628
 
6628
6629
  // src/version.ts
6629
- var LUCERN_SDK_VERSION = "0.2.0-alpha.1";
6630
+ var LUCERN_SDK_VERSION = "0.3.0-alpha.7";
6630
6631
 
6631
6632
  // src/workflowClient.ts
6632
6633
  function normalizeLensQuery(value) {
@@ -6820,12 +6821,6 @@ function createWorkflowClient(config = {}) {
6820
6821
  )
6821
6822
  );
6822
6823
  },
6823
- /**
6824
- * @deprecated Use createWorktree.
6825
- */
6826
- async addWorktree(input, idempotencyKey) {
6827
- return client.createWorktree(input, idempotencyKey);
6828
- },
6829
6824
  /**
6830
6825
  * Merge a worktree into the main belief line.
6831
6826
  */
@@ -7023,54 +7018,19 @@ function createWorkflowClient(config = {}) {
7023
7018
  body: input,
7024
7019
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
7025
7020
  });
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
7021
  }
7057
7022
  };
7058
- return client;
7023
+ return Object.assign(client, {
7024
+ addWorktree: client.createWorktree,
7025
+ createPillar: client.createBranch,
7026
+ createSprint: client.createWorktree,
7027
+ completeSprint: client.merge,
7028
+ requestReview: client.openPullRequest,
7029
+ publishFindings: client.push
7030
+ });
7059
7031
  }
7060
7032
 
7061
7033
  // 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
7034
  function toGatewayConfig(config) {
7075
7035
  return {
7076
7036
  baseUrl: config.baseUrl,
@@ -7098,72 +7058,9 @@ function toGatewayConfig(config) {
7098
7058
  }
7099
7059
  };
7100
7060
  }
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
7061
  function exposeGatewayData(response) {
7148
7062
  return Object.assign({}, response, response.data);
7149
7063
  }
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
7064
  function createLucernClient(config = {}) {
7168
7065
  const gatewayConfig = toGatewayConfig(config);
7169
7066
  const beliefsClient = createBeliefsClient(gatewayConfig);
@@ -7387,7 +7284,7 @@ function createLucernClient(config = {}) {
7387
7284
  topicId,
7388
7285
  nodeType: "contradiction",
7389
7286
  limit: 500
7390
- }) : args.nodeId ? await graphClient.queryNodes({ nodeId: args.nodeId }) : { data: [] };
7287
+ }) : args.nodeId ? await graphClient.listNodes({ nodeId: args.nodeId }) : { data: [] };
7391
7288
  const contradictions = asNodeArray(response.data).filter((node) => {
7392
7289
  const status = typeof node.metadata?.status === "string" ? node.metadata.status : typeof node.status === "string" ? node.status : "unresolved";
7393
7290
  if (args.status && status !== args.status) {
@@ -7567,23 +7464,15 @@ function createLucernClient(config = {}) {
7567
7464
  }).then(exposeGatewayData);
7568
7465
  }
7569
7466
  const nodesNamespace = {
7570
- list(query5) {
7571
- return graphClient.listNodes(query5);
7572
- },
7467
+ list: graphClient.listNodes,
7573
7468
  get(input) {
7574
7469
  return graphClient.getNode(
7575
7470
  typeof input === "string" ? { nodeId: input } : input
7576
7471
  );
7577
7472
  },
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
- },
7473
+ create: graphClient.createNode,
7474
+ update: graphClient.updateNode,
7475
+ batchCreate: graphClient.batchCreateNodes,
7587
7476
  listByTopicAndType(input) {
7588
7477
  return gateway.request({
7589
7478
  path: `/api/platform/v1/nodes${sdkQueryString({
@@ -7608,15 +7497,9 @@ function createLucernClient(config = {}) {
7608
7497
  })}`
7609
7498
  }).then(exposeGatewayData);
7610
7499
  },
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
- }
7500
+ supersede: graphClient.supersedeNode,
7501
+ verify: graphClient.verifyNode,
7502
+ hardDelete: graphClient.hardDeleteNode
7620
7503
  };
7621
7504
  const publicationNamespace = {
7622
7505
  create(input, idempotencyKey) {
@@ -7693,9 +7576,7 @@ function createLucernClient(config = {}) {
7693
7576
  return {
7694
7577
  config,
7695
7578
  version: LUCERN_SDK_VERSION,
7696
- search(query5, options) {
7697
- return searchResources(query5, options);
7698
- },
7579
+ search: searchResources,
7699
7580
  events: {
7700
7581
  list(query5 = {}) {
7701
7582
  return eventsFacade.list(query5).then(exposeGatewayData);
@@ -7792,9 +7673,7 @@ function createLucernClient(config = {}) {
7792
7673
  confidenceHistory(nodeId) {
7793
7674
  return beliefsFacade.confidenceHistory(nodeId).then(exposeGatewayData);
7794
7675
  },
7795
- opinionHistory(nodeId) {
7796
- return getOpinionHistory(nodeId);
7797
- },
7676
+ opinionHistory: getOpinionHistory,
7798
7677
  createContract(nodeId, input) {
7799
7678
  return beliefsFacade.createContract(nodeId, input).then(exposeGatewayData);
7800
7679
  },
@@ -8048,10 +7927,10 @@ function createLucernClient(config = {}) {
8048
7927
  }));
8049
7928
  },
8050
7929
  getHighPriority(args) {
8051
- return this.list({
7930
+ return questionsFacade.list({
8052
7931
  topicId: requireTopicId4(args),
8053
7932
  status: args.includeAnswered ? void 0 : "open"
8054
- }).then((data) => {
7933
+ }).then(exposeGatewayData).then((data) => {
8055
7934
  const questions = Array.isArray(data.questions) ? data.questions : [];
8056
7935
  const rank = (priority) => {
8057
7936
  switch (priority) {
@@ -8081,9 +7960,7 @@ function createLucernClient(config = {}) {
8081
7960
  },
8082
7961
  graph: {
8083
7962
  nodes: nodesNamespace,
8084
- createEdge(input) {
8085
- return graphClient.createEdge(input);
8086
- },
7963
+ createEdge: graphClient.createEdge,
8087
7964
  neighborhood(args) {
8088
7965
  return graphFacade.neighborhood({
8089
7966
  globalId: args.globalId,
@@ -8142,7 +8019,7 @@ function createLucernClient(config = {}) {
8142
8019
  bisectConfidence,
8143
8020
  listBeliefs,
8144
8021
  detectConfirmationBias(topicId, threshold) {
8145
- return this.bias({
8022
+ return graphFacade.bias({
8146
8023
  topicId,
8147
8024
  threshold,
8148
8025
  limit: 200
@@ -8153,7 +8030,7 @@ function createLucernClient(config = {}) {
8153
8030
  }));
8154
8031
  },
8155
8032
  getStructureAnalysis(topicId) {
8156
- return this.analyze({
8033
+ return graphFacade.analyze({
8157
8034
  topicId,
8158
8035
  limit: 200
8159
8036
  }).then((response) => ({
@@ -8220,38 +8097,20 @@ function createLucernClient(config = {}) {
8220
8097
  }
8221
8098
  },
8222
8099
  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
- },
8100
+ create: decisionsClient.createJudgment,
8101
+ record: decisionsClient.recordJudgment,
8102
+ list: decisionsClient.listJudgments,
8103
+ get: decisionsClient.getJudgment,
8104
+ recordOutcome: decisionsClient.recordJudgmentOutcome,
8105
+ updateOutcome: decisionsClient.updateJudgmentOutcome,
8241
8106
  readiness(topicId) {
8242
- return decisionsClient.getJudgmentReadiness({
8243
- topicId
8244
- });
8107
+ return decisionsClient.getJudgmentReadiness({ topicId });
8245
8108
  },
8246
8109
  calibration(topicId) {
8247
- return decisionsClient.getJudgmentCalibration({
8248
- topicId
8249
- });
8110
+ return decisionsClient.getJudgmentCalibration({ topicId });
8250
8111
  },
8251
8112
  pendingOutcomeReview(topicId) {
8252
- return decisionsClient.listPendingJudgmentOutcomeReview({
8253
- topicId
8254
- });
8113
+ return decisionsClient.listPendingJudgmentOutcomeReview({ topicId });
8255
8114
  },
8256
8115
  transitionAuditIntegrity(args) {
8257
8116
  return decisionsClient.getJudgmentTransitionAuditIntegrity({
@@ -8261,21 +8120,11 @@ function createLucernClient(config = {}) {
8261
8120
  }
8262
8121
  },
8263
8122
  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
- },
8123
+ create: decisionsClient.createJudgment,
8124
+ record: decisionsClient.recordJudgment,
8125
+ list: decisionsClient.listJudgments,
8126
+ get: decisionsClient.getJudgment,
8127
+ recordOutcome: decisionsClient.recordJudgmentOutcome,
8279
8128
  lessons(decisionId, input, idempotencyKey) {
8280
8129
  return gateway.request({
8281
8130
  path: `/api/platform/v1/decisions/${encodeURIComponent(
@@ -8307,21 +8156,11 @@ function createLucernClient(config = {}) {
8307
8156
  }
8308
8157
  },
8309
8158
  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
- },
8159
+ createBranch: workflowClient.createBranch,
8160
+ createLens: workflowClient.createLens,
8161
+ listLenses: workflowClient.listLenses,
8162
+ applyLensToTopic: workflowClient.applyLensToTopic,
8163
+ removeLensFromTopic: workflowClient.removeLensFromTopic,
8325
8164
  create(input) {
8326
8165
  return worktreesFacade.create({
8327
8166
  title: input.title,
@@ -8426,7 +8265,9 @@ function createLucernClient(config = {}) {
8426
8265
  const dependsOn = Array.isArray(input.dependsOn) ? input.dependsOn.filter(
8427
8266
  (value) => typeof value === "string"
8428
8267
  ) : void 0;
8429
- const blocks = Array.isArray(input.blocks) ? input.blocks.filter((value) => typeof value === "string") : void 0;
8268
+ const blocks = Array.isArray(input.blocks) ? input.blocks.filter(
8269
+ (value) => typeof value === "string"
8270
+ ) : void 0;
8430
8271
  return worktreesFacade.update({
8431
8272
  id: typeof input.worktreeId === "string" ? input.worktreeId : "",
8432
8273
  hypothesis: typeof input.hypothesis === "string" ? input.hypothesis : void 0,
@@ -8440,7 +8281,23 @@ function createLucernClient(config = {}) {
8440
8281
  });
8441
8282
  },
8442
8283
  update(input) {
8443
- return this.updateMetadata(input);
8284
+ const dependsOn = Array.isArray(input.dependsOn) ? input.dependsOn.filter(
8285
+ (value) => typeof value === "string"
8286
+ ) : void 0;
8287
+ const blocks = Array.isArray(input.blocks) ? input.blocks.filter(
8288
+ (value) => typeof value === "string"
8289
+ ) : void 0;
8290
+ return worktreesFacade.update({
8291
+ id: typeof input.worktreeId === "string" ? input.worktreeId : "",
8292
+ hypothesis: typeof input.hypothesis === "string" ? input.hypothesis : void 0,
8293
+ campaign: typeof input.campaign === "number" ? input.campaign : void 0,
8294
+ lane: typeof input.lane === "string" ? input.lane : void 0,
8295
+ laneOrderInCampaign: typeof input.laneOrderInCampaign === "number" ? input.laneOrderInCampaign : void 0,
8296
+ orderInLane: typeof input.orderInLane === "number" ? input.orderInLane : void 0,
8297
+ dependsOn,
8298
+ blocks,
8299
+ gate: typeof input.gate === "string" ? input.gate : void 0
8300
+ });
8444
8301
  },
8445
8302
  updateTargets(input) {
8446
8303
  return worktreesFacade.updateTargets({
@@ -8451,9 +8308,7 @@ function createLucernClient(config = {}) {
8451
8308
  removeQuestionIds: input.removeQuestionIds
8452
8309
  });
8453
8310
  },
8454
- listAll(query5 = {}) {
8455
- return workflowClient.listAllWorktrees(query5);
8456
- },
8311
+ listAll: workflowClient.listAllWorktrees,
8457
8312
  merge(worktreeId, input) {
8458
8313
  return worktreesFacade.merge({
8459
8314
  id: worktreeId,
@@ -8461,18 +8316,12 @@ function createLucernClient(config = {}) {
8461
8316
  summary: input.summary
8462
8317
  });
8463
8318
  },
8464
- push(worktreeId, input) {
8465
- return workflowClient.push(worktreeId, input);
8466
- },
8467
- openPullRequest(worktreeId, input) {
8468
- return workflowClient.openPullRequest(worktreeId, input);
8469
- },
8319
+ push: workflowClient.push,
8320
+ openPullRequest: workflowClient.openPullRequest,
8470
8321
  pipelineSnapshot(topicId) {
8471
8322
  return functionSurfaceClient.pipelineSnapshot({ topicId });
8472
8323
  },
8473
- complete(input, idempotencyKey) {
8474
- return worktreesFacade.complete(input, idempotencyKey);
8475
- },
8324
+ complete: worktreesFacade.complete,
8476
8325
  advancePhase(worktreeId, idempotencyKey) {
8477
8326
  return worktreesFacade.advancePhase(
8478
8327
  { worktreeId },
@@ -8485,12 +8334,8 @@ function createLucernClient(config = {}) {
8485
8334
  idempotencyKey
8486
8335
  );
8487
8336
  },
8488
- patchState(input, idempotencyKey) {
8489
- return worktreesFacade.patchState(input, idempotencyKey);
8490
- },
8491
- bulkCreate(input, idempotencyKey) {
8492
- return worktreesFacade.bulkCreate(input, idempotencyKey);
8493
- }
8337
+ patchState: worktreesFacade.patchState,
8338
+ bulkCreate: worktreesFacade.bulkCreate
8494
8339
  },
8495
8340
  context: {
8496
8341
  listTopics(query5 = {}) {
@@ -8501,27 +8346,15 @@ function createLucernClient(config = {}) {
8501
8346
  type: query5.type
8502
8347
  });
8503
8348
  },
8504
- compile(topicId, input = {}) {
8505
- return contextClient.compile(topicId, input);
8506
- },
8507
- recordScopeLearning(input, idempotencyKey) {
8508
- return functionSurfaceClient.recordScopeLearning(input, idempotencyKey);
8509
- },
8349
+ compile: contextClient.compile,
8350
+ recordScopeLearning: functionSurfaceClient.recordScopeLearning,
8510
8351
  discover(input) {
8511
8352
  return discoverTopics(input);
8512
8353
  },
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
- },
8354
+ analyzeTopicDensity: functionSurfaceClient.analyzeTopicDensity,
8355
+ applyAutoBranching: functionSurfaceClient.applyAutoBranching,
8356
+ seedBeliefLattice: functionSurfaceClient.seedBeliefLattice,
8357
+ getLatticeCoverage: functionSurfaceClient.getLatticeCoverage,
8525
8358
  matchEntityType(input) {
8526
8359
  return ontologiesFacade.match(input).then(exposeGatewayData);
8527
8360
  },
@@ -8606,9 +8439,7 @@ function createLucernClient(config = {}) {
8606
8439
  type: input.type
8607
8440
  });
8608
8441
  },
8609
- get(topicId) {
8610
- return topicsFacade.get(topicId);
8611
- },
8442
+ get: topicsFacade.get,
8612
8443
  create(input) {
8613
8444
  return topicsFacade.create({
8614
8445
  name: input.name,
@@ -8653,12 +8484,8 @@ function createLucernClient(config = {}) {
8653
8484
  maxDepth: query5.maxDepth
8654
8485
  });
8655
8486
  },
8656
- remove(topicId, idempotencyKey) {
8657
- return topicsFacade.remove(topicId, idempotencyKey);
8658
- },
8659
- bulkCreate(input, idempotencyKey) {
8660
- return topicsFacade.bulkCreate(input, idempotencyKey);
8661
- }
8487
+ remove: topicsFacade.remove,
8488
+ bulkCreate: topicsFacade.bulkCreate
8662
8489
  },
8663
8490
  answers: {
8664
8491
  create(input) {
@@ -8757,33 +8584,15 @@ function createLucernClient(config = {}) {
8757
8584
  raw: ontologyClient
8758
8585
  },
8759
8586
  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
- }
8587
+ registerSession: functionSurfaceClient.registerSession,
8588
+ heartbeatSession: functionSurfaceClient.heartbeatSession,
8589
+ endSession: functionSurfaceClient.endSession,
8590
+ listActiveSessions: functionSurfaceClient.listActiveSessions,
8591
+ sendAgentMessage: functionSurfaceClient.sendAgentMessage,
8592
+ broadcastMessage: functionSurfaceClient.broadcastMessage,
8593
+ getInbox: functionSurfaceClient.getAgentInbox,
8594
+ getAgentInbox: functionSurfaceClient.getAgentInbox,
8595
+ claimFiles: functionSurfaceClient.claimFiles
8787
8596
  },
8788
8597
  policy: {
8789
8598
  checkPermission(input) {
@@ -8814,38 +8623,24 @@ function createLucernClient(config = {}) {
8814
8623
  principalId: typeof input.principalId === "string" ? input.principalId : void 0
8815
8624
  });
8816
8625
  },
8626
+ // Backward compatibility shim: keep the policy namespace exposing the
8627
+ // historical manageWritePolicy entry point.
8817
8628
  manageWritePolicy(input, idempotencyKey) {
8818
8629
  return functionSurfaceClient.manageWritePolicy(input, idempotencyKey);
8819
8630
  },
8820
8631
  raw: policyClient
8821
8632
  },
8822
8633
  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
- }
8634
+ ingest: functionSurfaceClient.ingestObservation,
8635
+ ingestObservation: functionSurfaceClient.ingestObservation,
8636
+ getContext: functionSurfaceClient.getObservationContext,
8637
+ getObservationContext: functionSurfaceClient.getObservationContext
8835
8638
  },
8836
8639
  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
- }
8640
+ getCodeContext: functionSurfaceClient.getCodeContext,
8641
+ getChangeHistory: functionSurfaceClient.getChangeHistory,
8642
+ recordAttempt: functionSurfaceClient.recordAttempt,
8643
+ getFailureLog: functionSurfaceClient.getFailureLog
8849
8644
  },
8850
8645
  contracts: {
8851
8646
  create(input) {
@@ -8871,9 +8666,7 @@ function createLucernClient(config = {}) {
8871
8666
  }
8872
8667
  },
8873
8668
  bootstrap: {
8874
- generateSessionHandoff(input) {
8875
- return functionSurfaceClient.generateSessionHandoff(input);
8876
- }
8669
+ generateSessionHandoff: functionSurfaceClient.generateSessionHandoff
8877
8670
  },
8878
8671
  embeddings: embeddingsClient,
8879
8672
  graphAnalysis: graphAnalysisClient,
@@ -8895,25 +8688,15 @@ function createLucernClient(config = {}) {
8895
8688
  createAcl: toolRegistryClient.createAcl,
8896
8689
  deleteAcl: toolRegistryClient.deleteAcl,
8897
8690
  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
- },
8691
+ register: registerCustomTool,
8692
+ unregister: unregisterCustomTool,
8693
+ list: listRegisteredCustomTools,
8694
+ clear: clearRegisteredCustomTools,
8910
8695
  invoke(name, input = {}) {
8911
8696
  const fullName = name.includes(".") ? name : `custom.${name}`;
8912
8697
  return invokeCustomTool(fullName, input);
8913
8698
  },
8914
- namespace(namespace) {
8915
- return getCustomNamespace(namespace);
8916
- }
8699
+ namespace: getCustomNamespace
8917
8700
  },
8918
8701
  packs: {
8919
8702
  /**
@@ -8928,27 +8711,13 @@ function createLucernClient(config = {}) {
8928
8711
  get isInstalled() {
8929
8712
  return _packInstalled;
8930
8713
  },
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
- }
8714
+ listCatalog: packsClient.listCatalog,
8715
+ catalog: packsClient.listCatalog,
8716
+ listStates: packsClient.listStates,
8717
+ states: packsClient.getStates,
8718
+ install: packsClient.install,
8719
+ enable: packsClient.enable,
8720
+ disable: packsClient.disable
8952
8721
  },
8953
8722
  nodes: nodesNamespace,
8954
8723
  identity: {
@@ -8961,30 +8730,16 @@ function createLucernClient(config = {}) {
8961
8730
  raw: identityClient
8962
8731
  },
8963
8732
  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
- }
8733
+ bootstrapSession: mcpClient.bootstrapSession,
8734
+ checkWritePolicy: mcpClient.checkWritePolicy,
8735
+ beginBuildSession: mcpClient.beginBuildSession,
8736
+ evaluateEngineeringContract: mcpClient.evaluateEngineeringContract,
8737
+ evaluateResearchContract: mcpClient.evaluateResearchContract
8979
8738
  },
8980
8739
  auth: {
8981
8740
  device: {
8982
- createCode(input) {
8983
- return authDeviceClient.createDeviceCode(input);
8984
- },
8985
- pollToken(deviceCode) {
8986
- return authDeviceClient.pollDeviceToken(deviceCode);
8987
- }
8741
+ createCode: authDeviceClient.createDeviceCode,
8742
+ pollToken: authDeviceClient.pollDeviceToken
8988
8743
  }
8989
8744
  },
8990
8745
  custom: getCustomNamespace("custom"),