@lucern/sdk 0.3.0-alpha.5 → 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
@@ -239,9 +239,7 @@ function generatePortableRequestId() {
239
239
  8
240
240
  ).join("")}-${hex.slice(8, 10).join("")}-${hex.slice(10).join("")}`;
241
241
  }
242
- function randomIdempotencyKey() {
243
- return generatePortableRequestId();
244
- }
242
+ var randomIdempotencyKey = generatePortableRequestId;
245
243
  function isRetryableStatus(status) {
246
244
  return status >= 500 || status === 408 || status === 429;
247
245
  }
@@ -306,8 +304,11 @@ function timeoutError(timeoutMs) {
306
304
  error.name = "AbortError";
307
305
  return error;
308
306
  }
307
+ function isRecord(value) {
308
+ return value !== null && typeof value === "object" && !Array.isArray(value);
309
+ }
309
310
  function readPolicySummaryFromDetails(details) {
310
- if (!details || typeof details !== "object" || Array.isArray(details)) {
311
+ if (!isRecord(details)) {
311
312
  return null;
312
313
  }
313
314
  const directSummary = details.summary;
@@ -315,11 +316,11 @@ function readPolicySummaryFromDetails(details) {
315
316
  return directSummary.trim();
316
317
  }
317
318
  const policy = details.policy;
318
- if (!policy || typeof policy !== "object" || Array.isArray(policy)) {
319
+ if (!isRecord(policy)) {
319
320
  return null;
320
321
  }
321
322
  const explanation = policy.explanation;
322
- if (!explanation || typeof explanation !== "object" || Array.isArray(explanation)) {
323
+ if (!isRecord(explanation)) {
323
324
  return null;
324
325
  }
325
326
  const nestedSummary = explanation.summary;
@@ -383,11 +384,11 @@ function createGatewayRequestClient(config = {}) {
383
384
  if (!text) {
384
385
  return null;
385
386
  }
386
- try {
387
- return JSON.parse(text);
388
- } catch {
387
+ const parsed = tryParseGatewayEnvelopeJson(text);
388
+ if (!parsed.ok) {
389
389
  return null;
390
390
  }
391
+ return isRecord(parsed.value) ? parsed.value : null;
391
392
  }
392
393
  function resolveTimeoutMs(method, requestTimeoutMs) {
393
394
  if (typeof requestTimeoutMs === "number") {
@@ -399,16 +400,31 @@ function createGatewayRequestClient(config = {}) {
399
400
  }
400
401
  return config.timeoutMs ?? 15e3;
401
402
  }
403
+ function tryParseGatewayEnvelopeJson(text) {
404
+ const trimmed = text.trim();
405
+ if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) {
406
+ return { ok: false, reason: "non-json" };
407
+ }
408
+ try {
409
+ return { ok: true, value: JSON.parse(trimmed) };
410
+ } catch (error) {
411
+ if (error instanceof SyntaxError) {
412
+ return { ok: false, reason: "invalid-json", error };
413
+ }
414
+ throw error;
415
+ }
416
+ }
402
417
  function buildApiError(args) {
403
418
  const failure = args.failure;
404
- const legacyError = failure && typeof failure.error === "object" && failure.error !== null ? failure.error : failure?.legacyError;
419
+ const legacyError = failure && isRecord(failure.error) ? failure.error : failure?.legacyError;
405
420
  const correlationId = failure?.correlationId ?? args.response.headers.get("x-lucern-correlation-id")?.trim() ?? args.requestId;
406
421
  const policyTraceId = failure?.policyTraceId ?? args.response.headers.get("x-lucern-policy-trace-id")?.trim() ?? null;
407
422
  const details = failure?.details ?? legacyError?.details;
408
423
  const policySummary = readPolicySummaryFromDetails(details);
424
+ const failureMessage = typeof failure?.error === "string" ? failure.error : legacyError?.message;
409
425
  return new LucernApiError({
410
426
  code: failure?.code ?? legacyError?.code ?? fallbackErrorCode(args.response.status),
411
- message: policySummary ?? (typeof failure?.error === "string" ? failure.error : legacyError?.message ?? (args.response.ok ? "Platform API returned an invalid success payload." : "Platform API request failed.")),
427
+ message: policySummary ?? failureMessage ?? (args.response.ok ? "Platform API returned an invalid success payload." : "Platform API request failed."),
412
428
  status: args.response.status,
413
429
  invariant: failure?.invariant,
414
430
  suggestion: failure?.suggestion,
@@ -534,8 +550,11 @@ function createGatewayRequestClient(config = {}) {
534
550
  }
535
551
 
536
552
  // src/sdkSurface.ts
553
+ function isRecord2(value) {
554
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
555
+ }
537
556
  function asRecord(value) {
538
- return value && typeof value === "object" ? value : {};
557
+ return isRecord2(value) ? value : {};
539
558
  }
540
559
  function cleanString2(value) {
541
560
  return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
@@ -596,9 +615,7 @@ function normalizeNodeWriteInput(value) {
596
615
  }
597
616
  return next;
598
617
  }
599
- function normalizeNodeVerificationStatus(value) {
600
- return normalizeVerificationStatus(value);
601
- }
618
+ var normalizeNodeVerificationStatus = normalizeVerificationStatus;
602
619
  function normalizeTopicQuery(value) {
603
620
  const topicId = cleanString2(value.topicId);
604
621
  if (!topicId) {
@@ -625,7 +642,10 @@ function createListResult(items, legacyKey) {
625
642
  total: items.length
626
643
  };
627
644
  if (legacyKey) {
628
- result[legacyKey] = items;
645
+ return {
646
+ ...result,
647
+ [legacyKey]: items
648
+ };
629
649
  }
630
650
  return result;
631
651
  }
@@ -669,6 +689,17 @@ function asTenantVaultSecretArray(data) {
669
689
  }
670
690
  function createAdminClient(config = {}) {
671
691
  const gateway = createGatewayRequestClient(config);
692
+ const getControlObjectOwnership = async () => gateway.request({
693
+ path: "/api/platform/v1/admin/control-ownership"
694
+ });
695
+ const createMembership = async (input, idempotencyKey) => gateway.request({
696
+ path: "/api/platform/v1/memberships",
697
+ method: "POST",
698
+ body: input,
699
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
700
+ });
701
+ const updateMembership = createMembership;
702
+ const upsertMembership = createMembership;
672
703
  return {
673
704
  /**
674
705
  * List tenants visible to the current principal.
@@ -700,19 +731,11 @@ function createAdminClient(config = {}) {
700
731
  /**
701
732
  * Get the control-object ownership contract.
702
733
  */
703
- async getControlObjectOwnership() {
704
- return gateway.request({
705
- path: "/api/platform/v1/admin/control-ownership"
706
- });
707
- },
734
+ getControlObjectOwnership,
708
735
  /**
709
736
  * @deprecated Use getControlObjectOwnership.
710
737
  */
711
- async getControlObjectOwnershipContract() {
712
- return gateway.request({
713
- path: "/api/platform/v1/admin/control-ownership"
714
- });
715
- },
738
+ getControlObjectOwnershipContract: getControlObjectOwnership,
716
739
  /**
717
740
  * List workspaces for the current admin scope.
718
741
  */
@@ -759,26 +782,15 @@ function createAdminClient(config = {}) {
759
782
  /**
760
783
  * Create a membership.
761
784
  */
762
- async createMembership(input, idempotencyKey) {
763
- return gateway.request({
764
- path: "/api/platform/v1/memberships",
765
- method: "POST",
766
- body: input,
767
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
768
- });
769
- },
785
+ createMembership,
770
786
  /**
771
787
  * Update a membership.
772
788
  */
773
- async updateMembership(input, idempotencyKey) {
774
- return this.createMembership(input, idempotencyKey);
775
- },
789
+ updateMembership,
776
790
  /**
777
791
  * @deprecated Use createMembership or updateMembership.
778
792
  */
779
- async upsertMembership(input, idempotencyKey) {
780
- return this.createMembership(input, idempotencyKey);
781
- },
793
+ upsertMembership,
782
794
  /**
783
795
  * List tenant API keys in the current admin scope.
784
796
  */
@@ -1060,115 +1072,111 @@ function createAnswersClient(config = {}) {
1060
1072
  // src/audiencesClient.ts
1061
1073
  function createAudiencesClient(config = {}) {
1062
1074
  const gateway = createGatewayRequestClient(config);
1075
+ const listRegistry = async (query5 = {}) => {
1076
+ return gateway.request({
1077
+ path: `/api/platform/v1/audiences/registry${toQueryString({
1078
+ ...query5,
1079
+ effective: typeof query5.effective === "boolean" ? query5.effective ? "true" : "false" : void 0,
1080
+ status: query5.status
1081
+ })}`
1082
+ }).then(
1083
+ (response) => mapGatewayData(
1084
+ response,
1085
+ (data) => createListResult(Array.isArray(data) ? data : [], "registryEntries")
1086
+ )
1087
+ );
1088
+ };
1089
+ const createRegistryEntry = async (input, idempotencyKey) => {
1090
+ return gateway.request({
1091
+ path: "/api/platform/v1/audiences/registry",
1092
+ method: "POST",
1093
+ body: input,
1094
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1095
+ });
1096
+ };
1097
+ const updateRegistryEntry = createRegistryEntry;
1098
+ const upsertRegistry = createRegistryEntry;
1099
+ const getRegistry = listRegistry;
1100
+ const listGrants = async (query5 = {}) => {
1101
+ return gateway.request({
1102
+ path: `/api/platform/v1/audiences/grants${toQueryString({
1103
+ ...query5,
1104
+ audienceKey: query5.audienceKey,
1105
+ principalId: query5.principalId,
1106
+ groupId: query5.groupId,
1107
+ status: query5.status
1108
+ })}`
1109
+ }).then(
1110
+ (response) => mapGatewayData(
1111
+ response,
1112
+ (data) => createListResult(Array.isArray(data) ? data : [], "grants")
1113
+ )
1114
+ );
1115
+ };
1116
+ const createGrant = async (input, idempotencyKey) => {
1117
+ return gateway.request({
1118
+ path: "/api/platform/v1/audiences/grants",
1119
+ method: "POST",
1120
+ body: input,
1121
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1122
+ });
1123
+ };
1124
+ const getGrants = listGrants;
1125
+ const grant = createGrant;
1126
+ const deleteGrant = async (input, idempotencyKey) => {
1127
+ return gateway.request({
1128
+ path: "/api/platform/v1/audiences/grants/revoke",
1129
+ method: "POST",
1130
+ body: input,
1131
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1132
+ });
1133
+ };
1134
+ const revokeGrant = deleteGrant;
1063
1135
  return {
1064
1136
  /**
1065
1137
  * List audience registry entries.
1066
1138
  */
1067
- async listRegistry(query5 = {}) {
1068
- return gateway.request({
1069
- path: `/api/platform/v1/audiences/registry${toQueryString({
1070
- ...query5,
1071
- effective: typeof query5.effective === "boolean" ? query5.effective ? "true" : "false" : void 0,
1072
- status: query5.status
1073
- })}`
1074
- }).then(
1075
- (response) => mapGatewayData(
1076
- response,
1077
- (data) => createListResult(
1078
- Array.isArray(data) ? data : [],
1079
- "registryEntries"
1080
- )
1081
- )
1082
- );
1083
- },
1139
+ listRegistry,
1084
1140
  /**
1085
1141
  * @deprecated Use listRegistry.
1086
1142
  */
1087
- async getRegistry(query5 = {}) {
1088
- return this.listRegistry(query5);
1089
- },
1143
+ getRegistry,
1090
1144
  /**
1091
1145
  * Create an audience registry entry.
1092
1146
  */
1093
- async createRegistryEntry(input, idempotencyKey) {
1094
- return gateway.request({
1095
- path: "/api/platform/v1/audiences/registry",
1096
- method: "POST",
1097
- body: input,
1098
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1099
- });
1100
- },
1147
+ createRegistryEntry,
1101
1148
  /**
1102
1149
  * Update an audience registry entry.
1103
1150
  */
1104
- async updateRegistryEntry(input, idempotencyKey) {
1105
- return this.createRegistryEntry(input, idempotencyKey);
1106
- },
1151
+ updateRegistryEntry,
1107
1152
  /**
1108
1153
  * @deprecated Use createRegistryEntry or updateRegistryEntry.
1109
1154
  */
1110
- async upsertRegistry(input, idempotencyKey) {
1111
- return this.createRegistryEntry(input, idempotencyKey);
1112
- },
1155
+ upsertRegistry,
1113
1156
  /**
1114
1157
  * List audience grants.
1115
1158
  */
1116
- async listGrants(query5 = {}) {
1117
- return gateway.request({
1118
- path: `/api/platform/v1/audiences/grants${toQueryString({
1119
- ...query5,
1120
- audienceKey: query5.audienceKey,
1121
- principalId: query5.principalId,
1122
- groupId: query5.groupId,
1123
- status: query5.status
1124
- })}`
1125
- }).then(
1126
- (response) => mapGatewayData(
1127
- response,
1128
- (data) => createListResult(Array.isArray(data) ? data : [], "grants")
1129
- )
1130
- );
1131
- },
1159
+ listGrants,
1132
1160
  /**
1133
1161
  * @deprecated Use listGrants.
1134
1162
  */
1135
- async getGrants(query5 = {}) {
1136
- return this.listGrants(query5);
1137
- },
1163
+ getGrants,
1138
1164
  /**
1139
1165
  * Create an audience grant.
1140
1166
  */
1141
- async createGrant(input, idempotencyKey) {
1142
- return gateway.request({
1143
- path: "/api/platform/v1/audiences/grants",
1144
- method: "POST",
1145
- body: input,
1146
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1147
- });
1148
- },
1167
+ createGrant,
1149
1168
  /**
1150
1169
  * @deprecated Use createGrant.
1151
1170
  */
1152
- async grant(input, idempotencyKey) {
1153
- return this.createGrant(input, idempotencyKey);
1154
- },
1171
+ grant,
1155
1172
  /**
1156
1173
  * Delete an audience grant by revoking it.
1157
1174
  */
1158
- async deleteGrant(input, idempotencyKey) {
1159
- return gateway.request({
1160
- path: "/api/platform/v1/audiences/grants/revoke",
1161
- method: "POST",
1162
- body: input,
1163
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1164
- });
1165
- },
1175
+ deleteGrant,
1166
1176
  /**
1167
1177
  * @deprecated Use deleteGrant.
1168
1178
  */
1169
- async revokeGrant(input, idempotencyKey) {
1170
- return this.deleteGrant(input, idempotencyKey);
1171
- }
1179
+ revokeGrant
1172
1180
  };
1173
1181
  }
1174
1182
 
@@ -1209,8 +1217,18 @@ function authBaseUrl(config) {
1209
1217
  return config.baseUrl?.replace(/\/+$/, "") ?? "";
1210
1218
  }
1211
1219
  async function readJson(response) {
1212
- const payload = await response.json().catch(() => ({}));
1213
- return payload && typeof payload === "object" && !Array.isArray(payload) ? payload : {};
1220
+ try {
1221
+ const payload = await response.json();
1222
+ return isRecord3(payload) ? payload : {};
1223
+ } catch (error) {
1224
+ return unreadableJsonBodyFallback();
1225
+ }
1226
+ }
1227
+ function unreadableJsonBodyFallback(_error) {
1228
+ return {};
1229
+ }
1230
+ function isRecord3(value) {
1231
+ return value !== null && typeof value === "object" && !Array.isArray(value);
1214
1232
  }
1215
1233
  function readString(value) {
1216
1234
  const normalized = typeof value === "string" ? value.trim() : "";
@@ -1252,7 +1270,10 @@ function assertDeviceTokenResponse(payload) {
1252
1270
  tenant_id: tenantId,
1253
1271
  workspace_id: readString(payload.workspace_id),
1254
1272
  principal_id: principalId,
1255
- user: payload.user && typeof payload.user === "object" && !Array.isArray(payload.user) ? payload.user : void 0
1273
+ user: isRecord3(payload.user) && typeof payload.user.id === "string" && typeof payload.user.principalId === "string" ? {
1274
+ id: payload.user.id,
1275
+ principalId: payload.user.principalId
1276
+ } : void 0
1256
1277
  };
1257
1278
  }
1258
1279
  function maybeThrowDeviceError(payload) {
@@ -1400,12 +1421,12 @@ function createBeliefsClient(config = {}) {
1400
1421
  body: normalizeModulateConfidenceInput(input),
1401
1422
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1402
1423
  });
1403
- async function getOpinionHistory(beliefId) {
1424
+ const getOpinionHistory = async (beliefId) => {
1404
1425
  const response = await gateway.request({
1405
1426
  path: `/api/platform/v1/beliefs/${encodeURIComponent(beliefId)}/confidence-history`
1406
1427
  });
1407
1428
  return mapOpinionHistoryEntriesFromGatewayData(response.data);
1408
- }
1429
+ };
1409
1430
  return {
1410
1431
  /**
1411
1432
  * Create a belief within a topic scope.
@@ -1450,13 +1471,9 @@ function createBeliefsClient(config = {}) {
1450
1471
  * trigger = cause of the score change
1451
1472
  * triggeringRef = optional pointer to the evidence or worktree that drove the change
1452
1473
  */
1453
- async getOpinionHistory(beliefId) {
1454
- return getOpinionHistory(beliefId);
1455
- },
1474
+ getOpinionHistory,
1456
1475
  /** @deprecated Use getOpinionHistory(). */
1457
- async getConfidenceHistory(beliefId) {
1458
- return getOpinionHistory(beliefId);
1459
- },
1476
+ getConfidenceHistory: getOpinionHistory,
1460
1477
  /**
1461
1478
  * Fork a scored belief into a new formulation.
1462
1479
  */
@@ -1604,6 +1621,9 @@ function cleanOptionalString(value) {
1604
1621
  const normalized = value?.trim();
1605
1622
  return normalized ? normalized : void 0;
1606
1623
  }
1624
+ function isRecord4(value) {
1625
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
1626
+ }
1607
1627
  function cleanRequiredString(value, label) {
1608
1628
  const normalized = cleanOptionalString(value);
1609
1629
  if (!normalized) {
@@ -1643,9 +1663,10 @@ function topicPayload(input, allowed, operation) {
1643
1663
  };
1644
1664
  }
1645
1665
  function listResultFromEnvelope(data, legacyKey) {
1646
- const record = data && typeof data === "object" ? data : {};
1666
+ const record = isRecord4(data) ? data : {};
1667
+ const legacyItems = record[legacyKey];
1647
1668
  return createListResult(
1648
- Array.isArray(record[legacyKey]) ? record[legacyKey] : Array.isArray(data) ? data : [],
1669
+ Array.isArray(legacyItems) ? legacyItems : Array.isArray(data) ? data : [],
1649
1670
  legacyKey
1650
1671
  );
1651
1672
  }
@@ -2017,7 +2038,7 @@ async function invokeRegisteredCustomTool(fullName, params, context) {
2017
2038
  // src/ontologyClient.ts
2018
2039
  function createOntologyClient(config = {}) {
2019
2040
  const gateway = createGatewayRequestClient(config);
2020
- return {
2041
+ const client = {
2021
2042
  /**
2022
2043
  * List ontology definitions matching optional filters.
2023
2044
  */
@@ -2026,13 +2047,14 @@ function createOntologyClient(config = {}) {
2026
2047
  path: `/api/platform/v1/ontologies${toQueryString(filters)}`
2027
2048
  }).then(
2028
2049
  (response) => mapGatewayData(response, (data) => {
2029
- const record = data && typeof data === "object" && !Array.isArray(data) ? data : {};
2030
- const ontologies = Array.isArray(record.ontologies) ? record.ontologies : Array.isArray(record.definitions) ? record.definitions : Array.isArray(data) ? data : [];
2031
- const total = typeof record.total === "number" && Number.isFinite(record.total) ? record.total : ontologies.length;
2050
+ const record = asRecord(data);
2051
+ const ontologies = asListItems(data, "ontologies");
2052
+ const definitions = ontologies.length > 0 ? ontologies : asListItems(data, "definitions");
2053
+ const total = typeof record.total === "number" && Number.isFinite(record.total) ? record.total : definitions.length;
2032
2054
  return {
2033
2055
  ...record,
2034
- ...createListResult(ontologies, "definitions"),
2035
- ontologies,
2056
+ ...createListResult(definitions, "definitions"),
2057
+ ontologies: definitions,
2036
2058
  total
2037
2059
  };
2038
2060
  })
@@ -2059,18 +2081,6 @@ function createOntologyClient(config = {}) {
2059
2081
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
2060
2082
  });
2061
2083
  },
2062
- /**
2063
- * List ontology definitions.
2064
- */
2065
- async listDefinitions(filters = {}) {
2066
- return this.list(filters);
2067
- },
2068
- /**
2069
- * Get an ontology definition.
2070
- */
2071
- async getDefinition(id) {
2072
- return this.get(id);
2073
- },
2074
2084
  /**
2075
2085
  * Create an ontology definition.
2076
2086
  */
@@ -2112,7 +2122,7 @@ function createOntologyClient(config = {}) {
2112
2122
  }).then(
2113
2123
  (response) => mapGatewayData(
2114
2124
  response,
2115
- (data) => createListResult(Array.isArray(data) ? data : [], "versions")
2125
+ (data) => createListResult(asListItems(data, "versions"), "versions")
2116
2126
  )
2117
2127
  );
2118
2128
  },
@@ -2160,20 +2170,19 @@ function createOntologyClient(config = {}) {
2160
2170
  (data) => createListResult(Array.isArray(data) ? data : [], "topics")
2161
2171
  )
2162
2172
  );
2163
- },
2164
- /**
2165
- * @deprecated Use listTopics.
2166
- */
2167
- async listTopicsByOntology(ontologyId) {
2168
- return this.listTopics(ontologyId);
2169
2173
  }
2170
2174
  };
2175
+ return Object.assign(client, {
2176
+ listDefinitions: client.list,
2177
+ getDefinition: client.get,
2178
+ listTopicsByOntology: client.listTopics
2179
+ });
2171
2180
  }
2172
2181
 
2173
2182
  // src/graphClient.ts
2174
2183
  function createGraphClient(config = {}) {
2175
2184
  const gateway = createGatewayRequestClient(config);
2176
- return {
2185
+ const client = {
2177
2186
  /**
2178
2187
  * List graph nodes matching the provided filters.
2179
2188
  */
@@ -2186,12 +2195,6 @@ function createGraphClient(config = {}) {
2186
2195
  (response) => mapGatewayData(response, (data) => mapAliasedList(data, "nodes"))
2187
2196
  );
2188
2197
  },
2189
- /**
2190
- * @deprecated Use listNodes.
2191
- */
2192
- async queryNodes(query5) {
2193
- return this.listNodes(query5);
2194
- },
2195
2198
  /**
2196
2199
  * Retrieve a single graph node by nodeId or globalId.
2197
2200
  */
@@ -2302,12 +2305,6 @@ function createGraphClient(config = {}) {
2302
2305
  )
2303
2306
  );
2304
2307
  },
2305
- /**
2306
- * @deprecated Use listEdges.
2307
- */
2308
- async queryEdges(query5) {
2309
- return this.listEdges(query5);
2310
- },
2311
2308
  /**
2312
2309
  * Create a graph edge.
2313
2310
  */
@@ -2395,12 +2392,6 @@ function createGraphClient(config = {}) {
2395
2392
  body: normalizeTopicQuery(query5)
2396
2393
  });
2397
2394
  },
2398
- /**
2399
- * Retrieve a graph neighborhood around a root node.
2400
- */
2401
- async getNeighborhood(query5) {
2402
- return this.neighborhood(query5);
2403
- },
2404
2395
  /**
2405
2396
  * Retrieve the shortest known path between two graph nodes.
2406
2397
  */
@@ -2418,6 +2409,11 @@ function createGraphClient(config = {}) {
2418
2409
  });
2419
2410
  }
2420
2411
  };
2412
+ return Object.assign(client, {
2413
+ queryNodes: client.listNodes,
2414
+ queryEdges: client.listEdges,
2415
+ getNeighborhood: client.neighborhood
2416
+ });
2421
2417
  }
2422
2418
 
2423
2419
  // src/identityClient.ts
@@ -2471,6 +2467,13 @@ function createIdentityClient(config = {}) {
2471
2467
  body: input,
2472
2468
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
2473
2469
  });
2470
+ const updatePrincipal = (input, idempotencyKey) => requestPrincipalWrite("PATCH", input, idempotencyKey);
2471
+ const deleteKey = (keyId, input = {}, idempotencyKey) => gateway.request({
2472
+ path: `/api/platform/v1/identity/keys/${encodeURIComponent(keyId)}/revoke`,
2473
+ method: "POST",
2474
+ body: input,
2475
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
2476
+ });
2474
2477
  return {
2475
2478
  /**
2476
2479
  * Resolve the current authenticated identity summary.
@@ -2519,15 +2522,11 @@ function createIdentityClient(config = {}) {
2519
2522
  /**
2520
2523
  * Update a principal.
2521
2524
  */
2522
- async updatePrincipal(input, idempotencyKey) {
2523
- return requestPrincipalWrite("PATCH", input, idempotencyKey);
2524
- },
2525
+ updatePrincipal,
2525
2526
  /**
2526
2527
  * @deprecated Use createPrincipal or updatePrincipal.
2527
2528
  */
2528
- async upsertPrincipal(input, idempotencyKey) {
2529
- return requestPrincipalWrite("PATCH", input, idempotencyKey);
2530
- },
2529
+ upsertPrincipal: updatePrincipal,
2531
2530
  /**
2532
2531
  * List keys in the current identity scope.
2533
2532
  */
@@ -2566,20 +2565,11 @@ function createIdentityClient(config = {}) {
2566
2565
  /**
2567
2566
  * Delete an API key by revoking it.
2568
2567
  */
2569
- async deleteKey(keyId, input = {}, idempotencyKey) {
2570
- return gateway.request({
2571
- path: `/api/platform/v1/identity/keys/${encodeURIComponent(keyId)}/revoke`,
2572
- method: "POST",
2573
- body: input,
2574
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
2575
- });
2576
- },
2568
+ deleteKey,
2577
2569
  /**
2578
2570
  * @deprecated Use deleteKey.
2579
2571
  */
2580
- async revokeKey(keyId, input = {}, idempotencyKey) {
2581
- return this.deleteKey(keyId, input, idempotencyKey);
2582
- },
2572
+ revokeKey: deleteKey,
2583
2573
  /**
2584
2574
  * Search Clerk users by email or display attributes.
2585
2575
  */
@@ -2695,14 +2685,11 @@ function createIdentityClient(config = {}) {
2695
2685
  }
2696
2686
 
2697
2687
  // src/topicsClient.ts
2698
- function asRecord3(value) {
2699
- return value && typeof value === "object" ? value : {};
2700
- }
2701
2688
  function cleanString3(value) {
2702
2689
  return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
2703
2690
  }
2704
2691
  function normalizeTopicRecord(value) {
2705
- const record = asRecord3(value);
2692
+ const record = asRecord(value);
2706
2693
  const topicId = cleanString3(record.topicId) ?? cleanString3(record.id) ?? cleanString3(record._id);
2707
2694
  return withTopicAlias({
2708
2695
  ...record,
@@ -2727,7 +2714,7 @@ function createTopicsClient(config = {}) {
2727
2714
  })}`
2728
2715
  }).then(
2729
2716
  (response) => mapGatewayData(response, (data) => {
2730
- const record = asRecord3(data);
2717
+ const record = asRecord(data);
2731
2718
  const items = Array.isArray(record.topics) ? record.topics.map(normalizeTopicRecord) : [];
2732
2719
  return {
2733
2720
  ...createListResult(items, "topics"),
@@ -2744,7 +2731,7 @@ function createTopicsClient(config = {}) {
2744
2731
  }).then(
2745
2732
  (response) => mapGatewayData(
2746
2733
  response,
2747
- (data) => normalizeTopicRecord(asRecord3(data).topic ?? data)
2734
+ (data) => normalizeTopicRecord(asRecord(data).topic ?? data)
2748
2735
  )
2749
2736
  );
2750
2737
  },
@@ -2780,7 +2767,7 @@ function createTopicsClient(config = {}) {
2780
2767
  )}`
2781
2768
  }).then(
2782
2769
  (response) => mapGatewayData(response, (data) => {
2783
- const record = asRecord3(data);
2770
+ const record = asRecord(data);
2784
2771
  return {
2785
2772
  tree: Array.isArray(record.tree) ? record.tree.map(normalizeTopicTreeNode) : []
2786
2773
  };
@@ -3199,7 +3186,7 @@ function createEventsFacade(config = {}) {
3199
3186
  function createGraphFacade(config = {}) {
3200
3187
  const graphClient = createGraphClient(config);
3201
3188
  const gateway = createGatewayRequestClient(config);
3202
- return {
3189
+ const graphFacade = {
3203
3190
  async neighborhood(input) {
3204
3191
  return graphClient.neighborhood({
3205
3192
  globalId: input.globalId,
@@ -3207,18 +3194,6 @@ function createGraphFacade(config = {}) {
3207
3194
  maxDepth: input.maxDepth
3208
3195
  });
3209
3196
  },
3210
- async traverse(input) {
3211
- return graphClient.traverse(input);
3212
- },
3213
- async analyze(input = {}) {
3214
- return graphClient.analyze(input);
3215
- },
3216
- async bias(input = {}) {
3217
- return graphClient.bias(input);
3218
- },
3219
- async gaps(input) {
3220
- return graphClient.gaps(input);
3221
- },
3222
3197
  async falsify(input, idempotencyKey = randomIdempotencyKey()) {
3223
3198
  return gateway.request({
3224
3199
  path: "/api/platform/v1/graph/falsify",
@@ -3228,6 +3203,12 @@ function createGraphFacade(config = {}) {
3228
3203
  });
3229
3204
  }
3230
3205
  };
3206
+ return Object.assign(graphFacade, {
3207
+ traverse: graphClient.traverse,
3208
+ analyze: graphClient.analyze,
3209
+ bias: graphClient.bias,
3210
+ gaps: graphClient.gaps
3211
+ });
3231
3212
  }
3232
3213
  function createIdentityFacade(config = {}) {
3233
3214
  const identityClient = createIdentityClient(config);
@@ -3241,15 +3222,12 @@ function createIdentityFacade(config = {}) {
3241
3222
  function createOntologiesFacade(config = {}) {
3242
3223
  const ontologyClient = createOntologyClient(config);
3243
3224
  const gateway = createGatewayRequestClient(config);
3244
- return {
3225
+ const ontologyFacade = {
3245
3226
  async get(id) {
3246
3227
  return gateway.request({
3247
3228
  path: `/api/platform/v1/ontologies/${encodeURIComponent(id)}`
3248
3229
  });
3249
3230
  },
3250
- async list(query5 = {}) {
3251
- return ontologyClient.list(query5);
3252
- },
3253
3231
  async bind(input, idempotencyKey) {
3254
3232
  return gateway.request({
3255
3233
  path: `/api/platform/v1/ontologies/${encodeURIComponent(input.ontologyId)}/bind`,
@@ -3269,6 +3247,9 @@ function createOntologiesFacade(config = {}) {
3269
3247
  });
3270
3248
  }
3271
3249
  };
3250
+ return Object.assign(ontologyFacade, {
3251
+ list: ontologyClient.list
3252
+ });
3272
3253
  }
3273
3254
  function createQuestionsFacade(config = {}) {
3274
3255
  const gateway = createGatewayRequestClient(config);
@@ -3461,15 +3442,9 @@ function createTasksFacade(config = {}) {
3461
3442
  function createTopicsFacade(config = {}) {
3462
3443
  const topicsClient = createTopicsClient(config);
3463
3444
  return {
3464
- async create(input, idempotencyKey) {
3465
- return topicsClient.create(input, idempotencyKey);
3466
- },
3467
- async get(id) {
3468
- return topicsClient.get(id);
3469
- },
3470
- async list(query5 = {}) {
3471
- return topicsClient.list(query5);
3472
- },
3445
+ create: topicsClient.create,
3446
+ get: topicsClient.get,
3447
+ list: topicsClient.list,
3473
3448
  async update(input, idempotencyKey) {
3474
3449
  const { id, ...rest } = input;
3475
3450
  return topicsClient.update(id, rest, idempotencyKey);
@@ -3485,12 +3460,8 @@ function createTopicsFacade(config = {}) {
3485
3460
  maxDepth: input.maxDepth
3486
3461
  });
3487
3462
  },
3488
- async remove(id, idempotencyKey = randomIdempotencyKey()) {
3489
- return topicsClient.remove(id, idempotencyKey);
3490
- },
3491
- async bulkCreate(input, idempotencyKey = randomIdempotencyKey()) {
3492
- return topicsClient.bulkCreate(input, idempotencyKey);
3493
- }
3463
+ remove: topicsClient.remove,
3464
+ bulkCreate: topicsClient.bulkCreate
3494
3465
  };
3495
3466
  }
3496
3467
  function createWebhooksFacade(config = {}) {
@@ -3690,7 +3661,7 @@ function createWorktreesFacade(config = {}) {
3690
3661
  // src/decisionsClient.ts
3691
3662
  function createDecisionsClient(config = {}) {
3692
3663
  const gateway = createGatewayRequestClient(config);
3693
- return {
3664
+ const client = {
3694
3665
  /**
3695
3666
  * List judgments for a topic scope.
3696
3667
  */
@@ -3768,12 +3739,6 @@ function createDecisionsClient(config = {}) {
3768
3739
  })
3769
3740
  );
3770
3741
  },
3771
- /**
3772
- * @deprecated Use listPendingOutcomeReviews.
3773
- */
3774
- async listPendingJudgmentOutcomeReview(query5) {
3775
- return this.listPendingOutcomeReviews(query5);
3776
- },
3777
3742
  /**
3778
3743
  * Get audit integrity checks for judgment transitions.
3779
3744
  */
@@ -3806,12 +3771,6 @@ function createDecisionsClient(config = {}) {
3806
3771
  )
3807
3772
  );
3808
3773
  },
3809
- /**
3810
- * @deprecated Use createJudgment.
3811
- */
3812
- async recordJudgment(input, idempotencyKey) {
3813
- return this.createJudgment(input, idempotencyKey);
3814
- },
3815
3774
  /**
3816
3775
  * Update the outcome for an existing judgment.
3817
3776
  */
@@ -3822,14 +3781,13 @@ function createDecisionsClient(config = {}) {
3822
3781
  body: input,
3823
3782
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
3824
3783
  });
3825
- },
3826
- /**
3827
- * @deprecated Use updateJudgmentOutcome.
3828
- */
3829
- async recordJudgmentOutcome(judgmentId, input, idempotencyKey) {
3830
- return this.updateJudgmentOutcome(judgmentId, input, idempotencyKey);
3831
3784
  }
3832
3785
  };
3786
+ return Object.assign(client, {
3787
+ listPendingJudgmentOutcomeReview: client.listPendingOutcomeReviews,
3788
+ recordJudgment: client.createJudgment,
3789
+ recordJudgmentOutcome: client.updateJudgmentOutcome
3790
+ });
3833
3791
  }
3834
3792
 
3835
3793
  // src/embeddingsClient.ts
@@ -4453,7 +4411,7 @@ function createGraphStateClassifierClient(config = {}) {
4453
4411
  // src/harnessClient.ts
4454
4412
  function createHarnessClient(config = {}) {
4455
4413
  const gateway = createGatewayRequestClient(config);
4456
- return {
4414
+ const client = {
4457
4415
  /**
4458
4416
  * List agent definitions.
4459
4417
  */
@@ -4486,12 +4444,6 @@ function createHarnessClient(config = {}) {
4486
4444
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4487
4445
  });
4488
4446
  },
4489
- /**
4490
- * @deprecated Use createAgentDefinition.
4491
- */
4492
- async registerAgentDefinition(input, idempotencyKey) {
4493
- return this.createAgentDefinition(input, idempotencyKey);
4494
- },
4495
4447
  /**
4496
4448
  * Update an agent definition.
4497
4449
  */
@@ -4530,12 +4482,6 @@ function createHarnessClient(config = {}) {
4530
4482
  )
4531
4483
  );
4532
4484
  },
4533
- /**
4534
- * @deprecated Use listAgentRuns.
4535
- */
4536
- async listRunsForAgent(agentId, scope = {}) {
4537
- return this.listAgentRuns(agentId, scope);
4538
- },
4539
4485
  /**
4540
4486
  * List tool definitions.
4541
4487
  */
@@ -4568,12 +4514,6 @@ function createHarnessClient(config = {}) {
4568
4514
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4569
4515
  });
4570
4516
  },
4571
- /**
4572
- * @deprecated Use createToolDefinition.
4573
- */
4574
- async registerToolDefinition(input, idempotencyKey) {
4575
- return this.createToolDefinition(input, idempotencyKey);
4576
- },
4577
4517
  /**
4578
4518
  * Update a tool definition.
4579
4519
  */
@@ -4608,12 +4548,6 @@ function createHarnessClient(config = {}) {
4608
4548
  )
4609
4549
  );
4610
4550
  },
4611
- /**
4612
- * @deprecated Use listRunEntries.
4613
- */
4614
- async listRunLedgerEntries(scope = {}) {
4615
- return this.listRunEntries(scope);
4616
- },
4617
4551
  /**
4618
4552
  * Create a harness run.
4619
4553
  */
@@ -4688,6 +4622,12 @@ function createHarnessClient(config = {}) {
4688
4622
  });
4689
4623
  }
4690
4624
  };
4625
+ return Object.assign(client, {
4626
+ registerAgentDefinition: client.createAgentDefinition,
4627
+ listRunsForAgent: client.listAgentRuns,
4628
+ registerToolDefinition: client.createToolDefinition,
4629
+ listRunLedgerEntries: client.listRunEntries
4630
+ });
4691
4631
  }
4692
4632
 
4693
4633
  // src/jobsClient.ts
@@ -4815,45 +4755,41 @@ function createJobsClient(config = {}) {
4815
4755
  // src/learningClient.ts
4816
4756
  function createLearningClient(config = {}) {
4817
4757
  const gateway = createGatewayRequestClient(config);
4758
+ const listRecentExecutions = async (args = {}) => gateway.request({
4759
+ path: `/api/platform/v1/learning/executions/recent${toQueryString({
4760
+ ...normalizeTopicQuery(args),
4761
+ namespace: args.namespace,
4762
+ audienceMode: args.audienceMode,
4763
+ success: typeof args.success === "boolean" ? args.success ? "true" : "false" : void 0,
4764
+ limit: typeof args.limit === "number" && Number.isFinite(args.limit) ? String(args.limit) : void 0
4765
+ })}`
4766
+ }).then(
4767
+ (response) => mapGatewayData(
4768
+ response,
4769
+ (data) => createListResult(Array.isArray(data) ? data : [], "executions")
4770
+ )
4771
+ );
4772
+ const getExecutionStats = async (args = {}) => gateway.request({
4773
+ path: `/api/platform/v1/learning/executions/stats${toQueryString({
4774
+ ...normalizeTopicQuery(args),
4775
+ namespace: args.namespace,
4776
+ audienceMode: args.audienceMode,
4777
+ hours: typeof args.hours === "number" && Number.isFinite(args.hours) ? String(args.hours) : void 0
4778
+ })}`
4779
+ });
4818
4780
  return {
4819
4781
  /**
4820
4782
  * List recent execution records.
4821
4783
  */
4822
- async listRecentExecutions(args = {}) {
4823
- return gateway.request({
4824
- path: `/api/platform/v1/learning/executions/recent${toQueryString({
4825
- ...normalizeTopicQuery(args),
4826
- namespace: args.namespace,
4827
- audienceMode: args.audienceMode,
4828
- success: typeof args.success === "boolean" ? args.success ? "true" : "false" : void 0,
4829
- limit: typeof args.limit === "number" && Number.isFinite(args.limit) ? String(args.limit) : void 0
4830
- })}`
4831
- }).then(
4832
- (response) => mapGatewayData(
4833
- response,
4834
- (data) => createListResult(Array.isArray(data) ? data : [], "executions")
4835
- )
4836
- );
4837
- },
4784
+ listRecentExecutions,
4838
4785
  /**
4839
4786
  * @deprecated Use listRecentExecutions.
4840
4787
  */
4841
- async getRecentExecutions(args = {}) {
4842
- return this.listRecentExecutions(args);
4843
- },
4788
+ getRecentExecutions: listRecentExecutions,
4844
4789
  /**
4845
4790
  * Get aggregate execution statistics.
4846
4791
  */
4847
- async getExecutionStats(args = {}) {
4848
- return gateway.request({
4849
- path: `/api/platform/v1/learning/executions/stats${toQueryString({
4850
- ...normalizeTopicQuery(args),
4851
- namespace: args.namespace,
4852
- audienceMode: args.audienceMode,
4853
- hours: typeof args.hours === "number" && Number.isFinite(args.hours) ? String(args.hours) : void 0
4854
- })}`
4855
- });
4856
- }
4792
+ getExecutionStats
4857
4793
  };
4858
4794
  }
4859
4795
  function toJsonValue(value) {
@@ -5767,7 +5703,7 @@ function createOrgGraphSearchClient(config = {}) {
5767
5703
  // src/packsClient.ts
5768
5704
  function createPacksClient(config = {}) {
5769
5705
  const gateway = createGatewayRequestClient(config);
5770
- return {
5706
+ const client = {
5771
5707
  /**
5772
5708
  * List catalog entries for available packs.
5773
5709
  */
@@ -5781,12 +5717,6 @@ function createPacksClient(config = {}) {
5781
5717
  )
5782
5718
  );
5783
5719
  },
5784
- /**
5785
- * @deprecated Use listCatalog.
5786
- */
5787
- async getCatalog() {
5788
- return this.listCatalog();
5789
- },
5790
5720
  /**
5791
5721
  * Get the discovery catalog for packs.
5792
5722
  */
@@ -5816,12 +5746,6 @@ function createPacksClient(config = {}) {
5816
5746
  )
5817
5747
  );
5818
5748
  },
5819
- /**
5820
- * @deprecated Use listStates.
5821
- */
5822
- async getStates(query5 = {}) {
5823
- return this.listStates(query5);
5824
- },
5825
5749
  /**
5826
5750
  * Get health details for a pack.
5827
5751
  */
@@ -5845,12 +5769,6 @@ function createPacksClient(config = {}) {
5845
5769
  )
5846
5770
  );
5847
5771
  },
5848
- /**
5849
- * @deprecated Use listTelemetry.
5850
- */
5851
- async getTelemetry(query5 = {}) {
5852
- return this.listTelemetry(query5);
5853
- },
5854
5772
  /**
5855
5773
  * Create a pack entitlement.
5856
5774
  */
@@ -5862,18 +5780,6 @@ function createPacksClient(config = {}) {
5862
5780
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
5863
5781
  });
5864
5782
  },
5865
- /**
5866
- * Update a pack entitlement.
5867
- */
5868
- async updateEntitlement(input, idempotencyKey) {
5869
- return this.createEntitlement(input, idempotencyKey);
5870
- },
5871
- /**
5872
- * @deprecated Use createEntitlement or updateEntitlement.
5873
- */
5874
- async upsertEntitlement(input, idempotencyKey) {
5875
- return this.createEntitlement(input, idempotencyKey);
5876
- },
5877
5783
  /**
5878
5784
  * Install a pack.
5879
5785
  */
@@ -5930,6 +5836,13 @@ function createPacksClient(config = {}) {
5930
5836
  });
5931
5837
  }
5932
5838
  };
5839
+ return Object.assign(client, {
5840
+ getCatalog: client.listCatalog,
5841
+ getStates: client.listStates,
5842
+ getTelemetry: client.listTelemetry,
5843
+ updateEntitlement: client.createEntitlement,
5844
+ upsertEntitlement: client.createEntitlement
5845
+ });
5933
5846
  }
5934
5847
 
5935
5848
  // src/policyClient.ts
@@ -5965,6 +5878,14 @@ function asRolePolicyArray(data) {
5965
5878
  }
5966
5879
  return data.map(asRolePolicyRecord).filter((row) => Boolean(row));
5967
5880
  }
5881
+ function buildFilterByPermissionResponse(permission, allowedTopicIds, deniedTopics, count) {
5882
+ const result = {};
5883
+ result.permission = permission;
5884
+ result.allowedTopicIds = allowedTopicIds;
5885
+ result.deniedTopics = deniedTopics;
5886
+ result.count = count;
5887
+ return result;
5888
+ }
5968
5889
  function createPolicyClient(config = {}) {
5969
5890
  const gateway = createGatewayRequestClient(config);
5970
5891
  return {
@@ -6187,15 +6108,15 @@ function createPolicyClient(config = {}) {
6187
6108
  });
6188
6109
  const allowedTopicIds = Array.isArray(response.data?.allowedTopicIds) ? response.data.allowedTopicIds : [];
6189
6110
  const deniedTopics = Array.isArray(response.data?.deniedTopics) ? response.data.deniedTopics : [];
6190
- return {
6191
- success: true,
6192
- data: {
6193
- permission,
6194
- allowedTopicIds,
6195
- deniedTopics,
6196
- count: typeof response.data?.count === "number" ? response.data.count : allowedTopicIds.length
6197
- }
6198
- };
6111
+ const result = {};
6112
+ result.success = true;
6113
+ result.data = buildFilterByPermissionResponse(
6114
+ permission,
6115
+ allowedTopicIds,
6116
+ deniedTopics,
6117
+ typeof response.data?.count === "number" ? response.data.count : allowedTopicIds.length
6118
+ );
6119
+ return result;
6199
6120
  }
6200
6121
  };
6201
6122
  }
@@ -6203,64 +6124,66 @@ function createPolicyClient(config = {}) {
6203
6124
  // src/reportsClient.ts
6204
6125
  function createReportsClient(config = {}) {
6205
6126
  const gateway = createGatewayRequestClient(config);
6127
+ const listTemplates = async (args = {}) => gateway.request({
6128
+ path: `/api/platform/v1/reports/templates${toQueryString({
6129
+ slug: args.slug
6130
+ })}`
6131
+ }).then(
6132
+ (response) => mapGatewayData(response, (data) => {
6133
+ const rows = asListItems(data, "templates");
6134
+ return createListResult(rows, "templates");
6135
+ })
6136
+ );
6137
+ const listReports = async (input, args = {}) => {
6138
+ const topicId = resolveTopicId(input);
6139
+ if (!topicId) {
6140
+ throw new Error("topicId is required");
6141
+ }
6142
+ return gateway.request({
6143
+ path: `/api/platform/v1/reports/topics/${encodeURIComponent(topicId)}${toQueryString(
6144
+ {
6145
+ summary: typeof args.summary === "boolean" ? args.summary ? "true" : "false" : void 0
6146
+ }
6147
+ )}`
6148
+ }).then(
6149
+ (response) => mapGatewayData(
6150
+ response,
6151
+ (data) => createListResult(Array.isArray(data) ? data : [], "reports")
6152
+ )
6153
+ );
6154
+ };
6155
+ const getReport = async (reportId) => gateway.request({
6156
+ path: `/api/platform/v1/reports/${encodeURIComponent(reportId)}`
6157
+ });
6206
6158
  return {
6207
6159
  /**
6208
6160
  * List report templates.
6209
6161
  */
6210
- async listTemplates(args = {}) {
6211
- return gateway.request({
6212
- path: `/api/platform/v1/reports/templates${toQueryString({
6213
- slug: args.slug
6214
- })}`
6215
- }).then(
6216
- (response) => mapGatewayData(response, (data) => {
6217
- const record = data && typeof data === "object" ? data : {};
6218
- const rows = Array.isArray(data) ? data : Array.isArray(record.templates) ? record.templates : [];
6219
- return createListResult(rows, "templates");
6220
- })
6221
- );
6222
- },
6162
+ listTemplates,
6223
6163
  /**
6224
6164
  * @deprecated Use listTemplates.
6225
6165
  */
6226
- async getTemplates(args = {}) {
6227
- return this.listTemplates(args);
6228
- },
6166
+ getTemplates: listTemplates,
6229
6167
  /**
6230
6168
  * List reports for a topic scope.
6231
6169
  */
6232
- async listReports(input, args = {}) {
6233
- const topicId = resolveTopicId(input);
6234
- if (!topicId) {
6235
- throw new Error("topicId is required");
6236
- }
6237
- return gateway.request({
6238
- path: `/api/platform/v1/reports/topics/${encodeURIComponent(topicId)}${toQueryString(
6239
- {
6240
- summary: typeof args.summary === "boolean" ? args.summary ? "true" : "false" : void 0
6241
- }
6242
- )}`
6243
- }).then(
6244
- (response) => mapGatewayData(
6245
- response,
6246
- (data) => createListResult(Array.isArray(data) ? data : [], "reports")
6247
- )
6248
- );
6249
- },
6170
+ listReports,
6250
6171
  /**
6251
6172
  * Get a generated report.
6252
6173
  */
6253
- async getReport(reportId) {
6254
- return gateway.request({
6255
- path: `/api/platform/v1/reports/${encodeURIComponent(reportId)}`
6256
- });
6257
- }
6174
+ getReport
6258
6175
  };
6259
6176
  }
6260
6177
 
6261
6178
  // src/schemaClient.ts
6262
6179
  function createSchemaClient(config = {}) {
6263
6180
  const gateway = createGatewayRequestClient(config);
6181
+ const createEntitlement = (input, idempotencyKey) => gateway.request({
6182
+ path: "/api/platform/v1/schema/entitlements",
6183
+ method: "POST",
6184
+ body: input,
6185
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6186
+ });
6264
6187
  return {
6265
6188
  /**
6266
6189
  * List schema packs.
@@ -6312,29 +6235,95 @@ function createSchemaClient(config = {}) {
6312
6235
  /**
6313
6236
  * Create a schema entitlement.
6314
6237
  */
6315
- async createEntitlement(input, idempotencyKey) {
6316
- return gateway.request({
6317
- path: "/api/platform/v1/schema/entitlements",
6318
- method: "POST",
6319
- body: input,
6320
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
6321
- });
6322
- },
6238
+ createEntitlement,
6323
6239
  /**
6324
6240
  * Update a schema entitlement.
6325
6241
  */
6326
- async updateEntitlement(input, idempotencyKey) {
6327
- return this.createEntitlement(input, idempotencyKey);
6328
- },
6242
+ updateEntitlement: createEntitlement,
6329
6243
  /**
6330
6244
  * @deprecated Use createEntitlement or updateEntitlement.
6331
6245
  */
6332
- async upsertEntitlement(input, idempotencyKey) {
6333
- return this.createEntitlement(input, idempotencyKey);
6334
- }
6246
+ upsertEntitlement: createEntitlement
6335
6247
  };
6336
6248
  }
6337
6249
 
6250
+ // src/clientHelpers.ts
6251
+ function asNodeArray(data) {
6252
+ const rows = asListItems(data, "nodes");
6253
+ if (rows.length > 0) {
6254
+ return rows.filter(
6255
+ (value) => Boolean(value) && typeof value === "object"
6256
+ );
6257
+ }
6258
+ if (data && typeof data === "object") {
6259
+ return [data];
6260
+ }
6261
+ return [];
6262
+ }
6263
+ function requireTopicId4(args) {
6264
+ const topicId = resolveTopicId(args);
6265
+ if (!topicId) {
6266
+ throw new Error("topicId is required");
6267
+ }
6268
+ return topicId;
6269
+ }
6270
+ function requireTopicOrProjectId(args) {
6271
+ const topicId = args.topicId?.trim() || args.projectId?.trim() || void 0;
6272
+ if (!topicId) {
6273
+ throw new Error("topicId is required");
6274
+ }
6275
+ return topicId;
6276
+ }
6277
+ var AUDIT_NODE_REFERENCE_KEY_PATTERN = /(^|_)(id|nodeid|beliefid|resourceid|targetid|sourceid|subjectid|globalid|entityid|recordid|fromnodeid|tonodeid|linkednodeid|linkedbeliefid|nodeids|beliefids|resourceids)$/i;
6278
+ function matchesAuditNodeReference(value, nodeId) {
6279
+ if (Array.isArray(value)) {
6280
+ return value.some((entry) => matchesAuditNodeReference(entry, nodeId));
6281
+ }
6282
+ if (!value || typeof value !== "object") {
6283
+ return false;
6284
+ }
6285
+ return Object.entries(value).some(([key, entry]) => {
6286
+ if (typeof entry === "string" && entry === nodeId && AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key)) {
6287
+ return true;
6288
+ }
6289
+ if (Array.isArray(entry) && AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key) && entry.some((item) => item === nodeId)) {
6290
+ return true;
6291
+ }
6292
+ return matchesAuditNodeReference(entry, nodeId);
6293
+ });
6294
+ }
6295
+ function requireText(args) {
6296
+ const text = resolveText(args);
6297
+ if (!text) {
6298
+ throw new Error("text is required");
6299
+ }
6300
+ return text;
6301
+ }
6302
+ function requireBaseRate(args) {
6303
+ const baseRate = typeof args.baseRate === "number" && Number.isFinite(args.baseRate) ? args.baseRate : 0.5;
6304
+ if (baseRate < 0 || baseRate > 1) {
6305
+ throw new Error("baseRate must be within [0, 1].");
6306
+ }
6307
+ return baseRate;
6308
+ }
6309
+ function sdkQueryString(input) {
6310
+ const params = new URLSearchParams();
6311
+ for (const [key, value] of Object.entries(input)) {
6312
+ if (value === void 0 || value === null) {
6313
+ continue;
6314
+ }
6315
+ if (Array.isArray(value)) {
6316
+ if (value.length > 0) {
6317
+ params.set(key, value.join(","));
6318
+ }
6319
+ continue;
6320
+ }
6321
+ params.set(key, String(value));
6322
+ }
6323
+ const serialized = params.toString();
6324
+ return serialized ? `?${serialized}` : "";
6325
+ }
6326
+
6338
6327
  // src/telemetryClient.ts
6339
6328
  var TELEMETRY_FIELDS = [
6340
6329
  "tenantId",
@@ -6505,6 +6494,16 @@ function query4(input) {
6505
6494
  cursor: input.cursor
6506
6495
  };
6507
6496
  }
6497
+ function effectiveToolsQuery(input) {
6498
+ return {
6499
+ ...query4(input),
6500
+ callerRole: input.callerRole,
6501
+ surface: input.surface,
6502
+ sessionType: input.sessionType,
6503
+ permittedToolNames: input.permittedToolNames ? JSON.stringify(input.permittedToolNames) : void 0,
6504
+ executableOnly: input.executableOnly
6505
+ };
6506
+ }
6508
6507
  function writeBody(input, operation) {
6509
6508
  return knownPayload(input, TOOL_REGISTRY_FIELDS, operation);
6510
6509
  }
@@ -6533,7 +6532,9 @@ function createToolRegistryClient(config = {}) {
6533
6532
  },
6534
6533
  listEffectiveTools(input) {
6535
6534
  return gateway.request({
6536
- path: `/api/platform/v1/tools/effective${toQueryString(query4(input))}`
6535
+ path: `/api/platform/v1/tools/effective${toQueryString(
6536
+ effectiveToolsQuery(input)
6537
+ )}`
6537
6538
  }).then(
6538
6539
  (response) => mapGatewayData(
6539
6540
  response,
@@ -6624,7 +6625,7 @@ function createToolRegistryClient(config = {}) {
6624
6625
  }
6625
6626
 
6626
6627
  // src/version.ts
6627
- var LUCERN_SDK_VERSION = "0.2.0-alpha.1";
6628
+ var LUCERN_SDK_VERSION = "0.3.0-alpha.7";
6628
6629
 
6629
6630
  // src/workflowClient.ts
6630
6631
  function normalizeLensQuery(value) {
@@ -6818,12 +6819,6 @@ function createWorkflowClient(config = {}) {
6818
6819
  )
6819
6820
  );
6820
6821
  },
6821
- /**
6822
- * @deprecated Use createWorktree.
6823
- */
6824
- async addWorktree(input, idempotencyKey) {
6825
- return client.createWorktree(input, idempotencyKey);
6826
- },
6827
6822
  /**
6828
6823
  * Merge a worktree into the main belief line.
6829
6824
  */
@@ -7021,54 +7016,19 @@ function createWorkflowClient(config = {}) {
7021
7016
  body: input,
7022
7017
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
7023
7018
  });
7024
- },
7025
- /**
7026
- * @deprecated Use createBranch.
7027
- */
7028
- async createPillar(input, idempotencyKey) {
7029
- return client.createBranch(input, idempotencyKey);
7030
- },
7031
- /**
7032
- * @deprecated Use addWorktree.
7033
- */
7034
- async createSprint(input, idempotencyKey) {
7035
- return client.createWorktree(input, idempotencyKey);
7036
- },
7037
- /**
7038
- * @deprecated Use merge.
7039
- */
7040
- async completeSprint(worktreeId, input, idempotencyKey) {
7041
- return client.merge(worktreeId, input, idempotencyKey);
7042
- },
7043
- /**
7044
- * @deprecated Use openPullRequest.
7045
- */
7046
- async requestReview(worktreeId, input, idempotencyKey) {
7047
- return client.openPullRequest(worktreeId, input, idempotencyKey);
7048
- },
7049
- /**
7050
- * @deprecated Use push.
7051
- */
7052
- async publishFindings(worktreeId, input, idempotencyKey) {
7053
- return client.push(worktreeId, input, idempotencyKey);
7054
7019
  }
7055
7020
  };
7056
- return client;
7021
+ return Object.assign(client, {
7022
+ addWorktree: client.createWorktree,
7023
+ createPillar: client.createBranch,
7024
+ createSprint: client.createWorktree,
7025
+ completeSprint: client.merge,
7026
+ requestReview: client.openPullRequest,
7027
+ publishFindings: client.push
7028
+ });
7057
7029
  }
7058
7030
 
7059
7031
  // src/client.ts
7060
- function asNodeArray(data) {
7061
- const rows = asListItems(data, "nodes");
7062
- if (rows.length > 0) {
7063
- return rows.filter(
7064
- (value) => Boolean(value) && typeof value === "object"
7065
- );
7066
- }
7067
- if (data && typeof data === "object") {
7068
- return [data];
7069
- }
7070
- return [];
7071
- }
7072
7032
  function toGatewayConfig(config) {
7073
7033
  return {
7074
7034
  baseUrl: config.baseUrl,
@@ -7096,72 +7056,9 @@ function toGatewayConfig(config) {
7096
7056
  }
7097
7057
  };
7098
7058
  }
7099
- function requireTopicId4(args) {
7100
- const topicId = resolveTopicId(args);
7101
- if (!topicId) {
7102
- throw new Error("topicId is required");
7103
- }
7104
- return topicId;
7105
- }
7106
- function requireTopicOrProjectId(args) {
7107
- const topicId = args.topicId?.trim() || args.projectId?.trim() || void 0;
7108
- if (!topicId) {
7109
- throw new Error("topicId is required");
7110
- }
7111
- return topicId;
7112
- }
7113
- var AUDIT_NODE_REFERENCE_KEY_PATTERN = /(^|_)(id|nodeid|beliefid|resourceid|targetid|sourceid|subjectid|globalid|entityid|recordid|fromnodeid|tonodeid|linkednodeid|linkedbeliefid|nodeids|beliefids|resourceids)$/i;
7114
- function matchesAuditNodeReference(value, nodeId) {
7115
- if (Array.isArray(value)) {
7116
- return value.some((entry) => matchesAuditNodeReference(entry, nodeId));
7117
- }
7118
- if (!value || typeof value !== "object") {
7119
- return false;
7120
- }
7121
- return Object.entries(value).some(([key, entry]) => {
7122
- if (typeof entry === "string" && entry === nodeId && AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key)) {
7123
- return true;
7124
- }
7125
- if (Array.isArray(entry) && AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key) && entry.some((item) => item === nodeId)) {
7126
- return true;
7127
- }
7128
- return matchesAuditNodeReference(entry, nodeId);
7129
- });
7130
- }
7131
- function requireText(args) {
7132
- const text = resolveText(args);
7133
- if (!text) {
7134
- throw new Error("text is required");
7135
- }
7136
- return text;
7137
- }
7138
- function requireBaseRate(args) {
7139
- const baseRate = typeof args.baseRate === "number" && Number.isFinite(args.baseRate) ? args.baseRate : 0.5;
7140
- if (baseRate < 0 || baseRate > 1) {
7141
- throw new Error("baseRate must be within [0, 1].");
7142
- }
7143
- return baseRate;
7144
- }
7145
7059
  function exposeGatewayData(response) {
7146
7060
  return Object.assign({}, response, response.data);
7147
7061
  }
7148
- function sdkQueryString(input) {
7149
- const params = new URLSearchParams();
7150
- for (const [key, value] of Object.entries(input)) {
7151
- if (value === void 0 || value === null) {
7152
- continue;
7153
- }
7154
- if (Array.isArray(value)) {
7155
- if (value.length > 0) {
7156
- params.set(key, value.join(","));
7157
- }
7158
- continue;
7159
- }
7160
- params.set(key, String(value));
7161
- }
7162
- const serialized = params.toString();
7163
- return serialized ? `?${serialized}` : "";
7164
- }
7165
7062
  function createLucernClient(config = {}) {
7166
7063
  const gatewayConfig = toGatewayConfig(config);
7167
7064
  const beliefsClient = createBeliefsClient(gatewayConfig);
@@ -7385,7 +7282,7 @@ function createLucernClient(config = {}) {
7385
7282
  topicId,
7386
7283
  nodeType: "contradiction",
7387
7284
  limit: 500
7388
- }) : args.nodeId ? await graphClient.queryNodes({ nodeId: args.nodeId }) : { data: [] };
7285
+ }) : args.nodeId ? await graphClient.listNodes({ nodeId: args.nodeId }) : { data: [] };
7389
7286
  const contradictions = asNodeArray(response.data).filter((node) => {
7390
7287
  const status = typeof node.metadata?.status === "string" ? node.metadata.status : typeof node.status === "string" ? node.status : "unresolved";
7391
7288
  if (args.status && status !== args.status) {
@@ -7565,23 +7462,15 @@ function createLucernClient(config = {}) {
7565
7462
  }).then(exposeGatewayData);
7566
7463
  }
7567
7464
  const nodesNamespace = {
7568
- list(query5) {
7569
- return graphClient.listNodes(query5);
7570
- },
7465
+ list: graphClient.listNodes,
7571
7466
  get(input) {
7572
7467
  return graphClient.getNode(
7573
7468
  typeof input === "string" ? { nodeId: input } : input
7574
7469
  );
7575
7470
  },
7576
- create(input, idempotencyKey) {
7577
- return graphClient.createNode(input, idempotencyKey);
7578
- },
7579
- update(input, idempotencyKey) {
7580
- return graphClient.updateNode(input, idempotencyKey);
7581
- },
7582
- batchCreate(input, idempotencyKey) {
7583
- return graphClient.batchCreateNodes(input, idempotencyKey);
7584
- },
7471
+ create: graphClient.createNode,
7472
+ update: graphClient.updateNode,
7473
+ batchCreate: graphClient.batchCreateNodes,
7585
7474
  listByTopicAndType(input) {
7586
7475
  return gateway.request({
7587
7476
  path: `/api/platform/v1/nodes${sdkQueryString({
@@ -7606,15 +7495,9 @@ function createLucernClient(config = {}) {
7606
7495
  })}`
7607
7496
  }).then(exposeGatewayData);
7608
7497
  },
7609
- supersede(input, idempotencyKey) {
7610
- return graphClient.supersedeNode(input, idempotencyKey);
7611
- },
7612
- verify(input, idempotencyKey) {
7613
- return graphClient.verifyNode(input, idempotencyKey);
7614
- },
7615
- hardDelete(input, idempotencyKey) {
7616
- return graphClient.hardDeleteNode(input, idempotencyKey);
7617
- }
7498
+ supersede: graphClient.supersedeNode,
7499
+ verify: graphClient.verifyNode,
7500
+ hardDelete: graphClient.hardDeleteNode
7618
7501
  };
7619
7502
  const publicationNamespace = {
7620
7503
  create(input, idempotencyKey) {
@@ -7691,9 +7574,7 @@ function createLucernClient(config = {}) {
7691
7574
  return {
7692
7575
  config,
7693
7576
  version: LUCERN_SDK_VERSION,
7694
- search(query5, options) {
7695
- return searchResources(query5, options);
7696
- },
7577
+ search: searchResources,
7697
7578
  events: {
7698
7579
  list(query5 = {}) {
7699
7580
  return eventsFacade.list(query5).then(exposeGatewayData);
@@ -7790,9 +7671,7 @@ function createLucernClient(config = {}) {
7790
7671
  confidenceHistory(nodeId) {
7791
7672
  return beliefsFacade.confidenceHistory(nodeId).then(exposeGatewayData);
7792
7673
  },
7793
- opinionHistory(nodeId) {
7794
- return getOpinionHistory(nodeId);
7795
- },
7674
+ opinionHistory: getOpinionHistory,
7796
7675
  createContract(nodeId, input) {
7797
7676
  return beliefsFacade.createContract(nodeId, input).then(exposeGatewayData);
7798
7677
  },
@@ -8046,10 +7925,10 @@ function createLucernClient(config = {}) {
8046
7925
  }));
8047
7926
  },
8048
7927
  getHighPriority(args) {
8049
- return this.list({
7928
+ return questionsFacade.list({
8050
7929
  topicId: requireTopicId4(args),
8051
7930
  status: args.includeAnswered ? void 0 : "open"
8052
- }).then((data) => {
7931
+ }).then(exposeGatewayData).then((data) => {
8053
7932
  const questions = Array.isArray(data.questions) ? data.questions : [];
8054
7933
  const rank = (priority) => {
8055
7934
  switch (priority) {
@@ -8079,9 +7958,7 @@ function createLucernClient(config = {}) {
8079
7958
  },
8080
7959
  graph: {
8081
7960
  nodes: nodesNamespace,
8082
- createEdge(input) {
8083
- return graphClient.createEdge(input);
8084
- },
7961
+ createEdge: graphClient.createEdge,
8085
7962
  neighborhood(args) {
8086
7963
  return graphFacade.neighborhood({
8087
7964
  globalId: args.globalId,
@@ -8140,7 +8017,7 @@ function createLucernClient(config = {}) {
8140
8017
  bisectConfidence,
8141
8018
  listBeliefs,
8142
8019
  detectConfirmationBias(topicId, threshold) {
8143
- return this.bias({
8020
+ return graphFacade.bias({
8144
8021
  topicId,
8145
8022
  threshold,
8146
8023
  limit: 200
@@ -8151,7 +8028,7 @@ function createLucernClient(config = {}) {
8151
8028
  }));
8152
8029
  },
8153
8030
  getStructureAnalysis(topicId) {
8154
- return this.analyze({
8031
+ return graphFacade.analyze({
8155
8032
  topicId,
8156
8033
  limit: 200
8157
8034
  }).then((response) => ({
@@ -8218,38 +8095,20 @@ function createLucernClient(config = {}) {
8218
8095
  }
8219
8096
  },
8220
8097
  judgments: {
8221
- create(input) {
8222
- return decisionsClient.createJudgment(input);
8223
- },
8224
- record(input) {
8225
- return decisionsClient.recordJudgment(input);
8226
- },
8227
- list(query5) {
8228
- return decisionsClient.listJudgments(query5);
8229
- },
8230
- get(judgmentId) {
8231
- return decisionsClient.getJudgment(judgmentId);
8232
- },
8233
- recordOutcome(judgmentId, input) {
8234
- return decisionsClient.recordJudgmentOutcome(judgmentId, input);
8235
- },
8236
- updateOutcome(judgmentId, input) {
8237
- return decisionsClient.updateJudgmentOutcome(judgmentId, input);
8238
- },
8098
+ create: decisionsClient.createJudgment,
8099
+ record: decisionsClient.recordJudgment,
8100
+ list: decisionsClient.listJudgments,
8101
+ get: decisionsClient.getJudgment,
8102
+ recordOutcome: decisionsClient.recordJudgmentOutcome,
8103
+ updateOutcome: decisionsClient.updateJudgmentOutcome,
8239
8104
  readiness(topicId) {
8240
- return decisionsClient.getJudgmentReadiness({
8241
- topicId
8242
- });
8105
+ return decisionsClient.getJudgmentReadiness({ topicId });
8243
8106
  },
8244
8107
  calibration(topicId) {
8245
- return decisionsClient.getJudgmentCalibration({
8246
- topicId
8247
- });
8108
+ return decisionsClient.getJudgmentCalibration({ topicId });
8248
8109
  },
8249
8110
  pendingOutcomeReview(topicId) {
8250
- return decisionsClient.listPendingJudgmentOutcomeReview({
8251
- topicId
8252
- });
8111
+ return decisionsClient.listPendingJudgmentOutcomeReview({ topicId });
8253
8112
  },
8254
8113
  transitionAuditIntegrity(args) {
8255
8114
  return decisionsClient.getJudgmentTransitionAuditIntegrity({
@@ -8259,21 +8118,11 @@ function createLucernClient(config = {}) {
8259
8118
  }
8260
8119
  },
8261
8120
  decisions: {
8262
- create(input) {
8263
- return decisionsClient.createJudgment(input);
8264
- },
8265
- record(input) {
8266
- return decisionsClient.recordJudgment(input);
8267
- },
8268
- list(query5) {
8269
- return decisionsClient.listJudgments(query5);
8270
- },
8271
- get(decisionId) {
8272
- return decisionsClient.getJudgment(decisionId);
8273
- },
8274
- recordOutcome(decisionId, input) {
8275
- return decisionsClient.recordJudgmentOutcome(decisionId, input);
8276
- },
8121
+ create: decisionsClient.createJudgment,
8122
+ record: decisionsClient.recordJudgment,
8123
+ list: decisionsClient.listJudgments,
8124
+ get: decisionsClient.getJudgment,
8125
+ recordOutcome: decisionsClient.recordJudgmentOutcome,
8277
8126
  lessons(decisionId, input, idempotencyKey) {
8278
8127
  return gateway.request({
8279
8128
  path: `/api/platform/v1/decisions/${encodeURIComponent(
@@ -8305,21 +8154,11 @@ function createLucernClient(config = {}) {
8305
8154
  }
8306
8155
  },
8307
8156
  worktrees: {
8308
- createBranch(input) {
8309
- return workflowClient.createBranch(input);
8310
- },
8311
- createLens(input) {
8312
- return workflowClient.createLens(input);
8313
- },
8314
- listLenses(query5) {
8315
- return workflowClient.listLenses(query5);
8316
- },
8317
- applyLensToTopic(input) {
8318
- return workflowClient.applyLensToTopic(input);
8319
- },
8320
- removeLensFromTopic(input) {
8321
- return workflowClient.removeLensFromTopic(input);
8322
- },
8157
+ createBranch: workflowClient.createBranch,
8158
+ createLens: workflowClient.createLens,
8159
+ listLenses: workflowClient.listLenses,
8160
+ applyLensToTopic: workflowClient.applyLensToTopic,
8161
+ removeLensFromTopic: workflowClient.removeLensFromTopic,
8323
8162
  create(input) {
8324
8163
  return worktreesFacade.create({
8325
8164
  title: input.title,
@@ -8424,7 +8263,9 @@ function createLucernClient(config = {}) {
8424
8263
  const dependsOn = Array.isArray(input.dependsOn) ? input.dependsOn.filter(
8425
8264
  (value) => typeof value === "string"
8426
8265
  ) : void 0;
8427
- const blocks = Array.isArray(input.blocks) ? input.blocks.filter((value) => typeof value === "string") : void 0;
8266
+ const blocks = Array.isArray(input.blocks) ? input.blocks.filter(
8267
+ (value) => typeof value === "string"
8268
+ ) : void 0;
8428
8269
  return worktreesFacade.update({
8429
8270
  id: typeof input.worktreeId === "string" ? input.worktreeId : "",
8430
8271
  hypothesis: typeof input.hypothesis === "string" ? input.hypothesis : void 0,
@@ -8438,7 +8279,23 @@ function createLucernClient(config = {}) {
8438
8279
  });
8439
8280
  },
8440
8281
  update(input) {
8441
- return this.updateMetadata(input);
8282
+ const dependsOn = Array.isArray(input.dependsOn) ? input.dependsOn.filter(
8283
+ (value) => typeof value === "string"
8284
+ ) : void 0;
8285
+ const blocks = Array.isArray(input.blocks) ? input.blocks.filter(
8286
+ (value) => typeof value === "string"
8287
+ ) : void 0;
8288
+ return worktreesFacade.update({
8289
+ id: typeof input.worktreeId === "string" ? input.worktreeId : "",
8290
+ hypothesis: typeof input.hypothesis === "string" ? input.hypothesis : void 0,
8291
+ campaign: typeof input.campaign === "number" ? input.campaign : void 0,
8292
+ lane: typeof input.lane === "string" ? input.lane : void 0,
8293
+ laneOrderInCampaign: typeof input.laneOrderInCampaign === "number" ? input.laneOrderInCampaign : void 0,
8294
+ orderInLane: typeof input.orderInLane === "number" ? input.orderInLane : void 0,
8295
+ dependsOn,
8296
+ blocks,
8297
+ gate: typeof input.gate === "string" ? input.gate : void 0
8298
+ });
8442
8299
  },
8443
8300
  updateTargets(input) {
8444
8301
  return worktreesFacade.updateTargets({
@@ -8449,9 +8306,7 @@ function createLucernClient(config = {}) {
8449
8306
  removeQuestionIds: input.removeQuestionIds
8450
8307
  });
8451
8308
  },
8452
- listAll(query5 = {}) {
8453
- return workflowClient.listAllWorktrees(query5);
8454
- },
8309
+ listAll: workflowClient.listAllWorktrees,
8455
8310
  merge(worktreeId, input) {
8456
8311
  return worktreesFacade.merge({
8457
8312
  id: worktreeId,
@@ -8459,18 +8314,12 @@ function createLucernClient(config = {}) {
8459
8314
  summary: input.summary
8460
8315
  });
8461
8316
  },
8462
- push(worktreeId, input) {
8463
- return workflowClient.push(worktreeId, input);
8464
- },
8465
- openPullRequest(worktreeId, input) {
8466
- return workflowClient.openPullRequest(worktreeId, input);
8467
- },
8317
+ push: workflowClient.push,
8318
+ openPullRequest: workflowClient.openPullRequest,
8468
8319
  pipelineSnapshot(topicId) {
8469
8320
  return functionSurfaceClient.pipelineSnapshot({ topicId });
8470
8321
  },
8471
- complete(input, idempotencyKey) {
8472
- return worktreesFacade.complete(input, idempotencyKey);
8473
- },
8322
+ complete: worktreesFacade.complete,
8474
8323
  advancePhase(worktreeId, idempotencyKey) {
8475
8324
  return worktreesFacade.advancePhase(
8476
8325
  { worktreeId },
@@ -8483,12 +8332,8 @@ function createLucernClient(config = {}) {
8483
8332
  idempotencyKey
8484
8333
  );
8485
8334
  },
8486
- patchState(input, idempotencyKey) {
8487
- return worktreesFacade.patchState(input, idempotencyKey);
8488
- },
8489
- bulkCreate(input, idempotencyKey) {
8490
- return worktreesFacade.bulkCreate(input, idempotencyKey);
8491
- }
8335
+ patchState: worktreesFacade.patchState,
8336
+ bulkCreate: worktreesFacade.bulkCreate
8492
8337
  },
8493
8338
  context: {
8494
8339
  listTopics(query5 = {}) {
@@ -8499,27 +8344,15 @@ function createLucernClient(config = {}) {
8499
8344
  type: query5.type
8500
8345
  });
8501
8346
  },
8502
- compile(topicId, input = {}) {
8503
- return contextClient.compile(topicId, input);
8504
- },
8505
- recordScopeLearning(input, idempotencyKey) {
8506
- return functionSurfaceClient.recordScopeLearning(input, idempotencyKey);
8507
- },
8347
+ compile: contextClient.compile,
8348
+ recordScopeLearning: functionSurfaceClient.recordScopeLearning,
8508
8349
  discover(input) {
8509
8350
  return discoverTopics(input);
8510
8351
  },
8511
- analyzeTopicDensity(input) {
8512
- return functionSurfaceClient.analyzeTopicDensity(input);
8513
- },
8514
- applyAutoBranching(input, idempotencyKey) {
8515
- return functionSurfaceClient.applyAutoBranching(input, idempotencyKey);
8516
- },
8517
- seedBeliefLattice(input = {}, idempotencyKey) {
8518
- return functionSurfaceClient.seedBeliefLattice(input, idempotencyKey);
8519
- },
8520
- getLatticeCoverage(input = {}) {
8521
- return functionSurfaceClient.getLatticeCoverage(input);
8522
- },
8352
+ analyzeTopicDensity: functionSurfaceClient.analyzeTopicDensity,
8353
+ applyAutoBranching: functionSurfaceClient.applyAutoBranching,
8354
+ seedBeliefLattice: functionSurfaceClient.seedBeliefLattice,
8355
+ getLatticeCoverage: functionSurfaceClient.getLatticeCoverage,
8523
8356
  matchEntityType(input) {
8524
8357
  return ontologiesFacade.match(input).then(exposeGatewayData);
8525
8358
  },
@@ -8604,9 +8437,7 @@ function createLucernClient(config = {}) {
8604
8437
  type: input.type
8605
8438
  });
8606
8439
  },
8607
- get(topicId) {
8608
- return topicsFacade.get(topicId);
8609
- },
8440
+ get: topicsFacade.get,
8610
8441
  create(input) {
8611
8442
  return topicsFacade.create({
8612
8443
  name: input.name,
@@ -8651,12 +8482,8 @@ function createLucernClient(config = {}) {
8651
8482
  maxDepth: query5.maxDepth
8652
8483
  });
8653
8484
  },
8654
- remove(topicId, idempotencyKey) {
8655
- return topicsFacade.remove(topicId, idempotencyKey);
8656
- },
8657
- bulkCreate(input, idempotencyKey) {
8658
- return topicsFacade.bulkCreate(input, idempotencyKey);
8659
- }
8485
+ remove: topicsFacade.remove,
8486
+ bulkCreate: topicsFacade.bulkCreate
8660
8487
  },
8661
8488
  answers: {
8662
8489
  create(input) {
@@ -8755,33 +8582,15 @@ function createLucernClient(config = {}) {
8755
8582
  raw: ontologyClient
8756
8583
  },
8757
8584
  coordination: {
8758
- registerSession(input = {}, idempotencyKey) {
8759
- return functionSurfaceClient.registerSession(input, idempotencyKey);
8760
- },
8761
- heartbeatSession(input = {}, idempotencyKey) {
8762
- return functionSurfaceClient.heartbeatSession(input, idempotencyKey);
8763
- },
8764
- endSession(input = {}, idempotencyKey) {
8765
- return functionSurfaceClient.endSession(input, idempotencyKey);
8766
- },
8767
- listActiveSessions(input = {}) {
8768
- return functionSurfaceClient.listActiveSessions(input);
8769
- },
8770
- sendAgentMessage(input, idempotencyKey) {
8771
- return functionSurfaceClient.sendAgentMessage(input, idempotencyKey);
8772
- },
8773
- broadcastMessage(input, idempotencyKey) {
8774
- return functionSurfaceClient.broadcastMessage(input, idempotencyKey);
8775
- },
8776
- getInbox(input = {}) {
8777
- return functionSurfaceClient.getAgentInbox(input);
8778
- },
8779
- getAgentInbox(input = {}) {
8780
- return functionSurfaceClient.getAgentInbox(input);
8781
- },
8782
- claimFiles(input, idempotencyKey) {
8783
- return functionSurfaceClient.claimFiles(input, idempotencyKey);
8784
- }
8585
+ registerSession: functionSurfaceClient.registerSession,
8586
+ heartbeatSession: functionSurfaceClient.heartbeatSession,
8587
+ endSession: functionSurfaceClient.endSession,
8588
+ listActiveSessions: functionSurfaceClient.listActiveSessions,
8589
+ sendAgentMessage: functionSurfaceClient.sendAgentMessage,
8590
+ broadcastMessage: functionSurfaceClient.broadcastMessage,
8591
+ getInbox: functionSurfaceClient.getAgentInbox,
8592
+ getAgentInbox: functionSurfaceClient.getAgentInbox,
8593
+ claimFiles: functionSurfaceClient.claimFiles
8785
8594
  },
8786
8595
  policy: {
8787
8596
  checkPermission(input) {
@@ -8812,38 +8621,24 @@ function createLucernClient(config = {}) {
8812
8621
  principalId: typeof input.principalId === "string" ? input.principalId : void 0
8813
8622
  });
8814
8623
  },
8624
+ // Backward compatibility shim: keep the policy namespace exposing the
8625
+ // historical manageWritePolicy entry point.
8815
8626
  manageWritePolicy(input, idempotencyKey) {
8816
8627
  return functionSurfaceClient.manageWritePolicy(input, idempotencyKey);
8817
8628
  },
8818
8629
  raw: policyClient
8819
8630
  },
8820
8631
  observations: {
8821
- ingest(input, idempotencyKey) {
8822
- return functionSurfaceClient.ingestObservation(input, idempotencyKey);
8823
- },
8824
- ingestObservation(input, idempotencyKey) {
8825
- return functionSurfaceClient.ingestObservation(input, idempotencyKey);
8826
- },
8827
- getContext(input) {
8828
- return functionSurfaceClient.getObservationContext(input);
8829
- },
8830
- getObservationContext(input) {
8831
- return functionSurfaceClient.getObservationContext(input);
8832
- }
8632
+ ingest: functionSurfaceClient.ingestObservation,
8633
+ ingestObservation: functionSurfaceClient.ingestObservation,
8634
+ getContext: functionSurfaceClient.getObservationContext,
8635
+ getObservationContext: functionSurfaceClient.getObservationContext
8833
8636
  },
8834
8637
  coding: {
8835
- getCodeContext(input) {
8836
- return functionSurfaceClient.getCodeContext(input);
8837
- },
8838
- getChangeHistory(input) {
8839
- return functionSurfaceClient.getChangeHistory(input);
8840
- },
8841
- recordAttempt(input, idempotencyKey) {
8842
- return functionSurfaceClient.recordAttempt(input, idempotencyKey);
8843
- },
8844
- getFailureLog(input) {
8845
- return functionSurfaceClient.getFailureLog(input);
8846
- }
8638
+ getCodeContext: functionSurfaceClient.getCodeContext,
8639
+ getChangeHistory: functionSurfaceClient.getChangeHistory,
8640
+ recordAttempt: functionSurfaceClient.recordAttempt,
8641
+ getFailureLog: functionSurfaceClient.getFailureLog
8847
8642
  },
8848
8643
  contracts: {
8849
8644
  create(input) {
@@ -8869,9 +8664,7 @@ function createLucernClient(config = {}) {
8869
8664
  }
8870
8665
  },
8871
8666
  bootstrap: {
8872
- generateSessionHandoff(input) {
8873
- return functionSurfaceClient.generateSessionHandoff(input);
8874
- }
8667
+ generateSessionHandoff: functionSurfaceClient.generateSessionHandoff
8875
8668
  },
8876
8669
  embeddings: embeddingsClient,
8877
8670
  graphAnalysis: graphAnalysisClient,
@@ -8893,25 +8686,15 @@ function createLucernClient(config = {}) {
8893
8686
  createAcl: toolRegistryClient.createAcl,
8894
8687
  deleteAcl: toolRegistryClient.deleteAcl,
8895
8688
  registerCustomTool: toolRegistryClient.registerCustomTool,
8896
- register(registration) {
8897
- return registerCustomTool(registration);
8898
- },
8899
- unregister(fullName) {
8900
- return unregisterCustomTool(fullName);
8901
- },
8902
- list() {
8903
- return listRegisteredCustomTools();
8904
- },
8905
- clear() {
8906
- clearRegisteredCustomTools();
8907
- },
8689
+ register: registerCustomTool,
8690
+ unregister: unregisterCustomTool,
8691
+ list: listRegisteredCustomTools,
8692
+ clear: clearRegisteredCustomTools,
8908
8693
  invoke(name, input = {}) {
8909
8694
  const fullName = name.includes(".") ? name : `custom.${name}`;
8910
8695
  return invokeCustomTool(fullName, input);
8911
8696
  },
8912
- namespace(namespace) {
8913
- return getCustomNamespace(namespace);
8914
- }
8697
+ namespace: getCustomNamespace
8915
8698
  },
8916
8699
  packs: {
8917
8700
  /**
@@ -8926,27 +8709,13 @@ function createLucernClient(config = {}) {
8926
8709
  get isInstalled() {
8927
8710
  return _packInstalled;
8928
8711
  },
8929
- listCatalog() {
8930
- return packsClient.listCatalog();
8931
- },
8932
- catalog() {
8933
- return packsClient.getCatalog();
8934
- },
8935
- listStates(scope) {
8936
- return packsClient.listStates(scope);
8937
- },
8938
- states(scope) {
8939
- return packsClient.getStates(scope);
8940
- },
8941
- install(input) {
8942
- return packsClient.install(input);
8943
- },
8944
- enable(input) {
8945
- return packsClient.enable(input);
8946
- },
8947
- disable(input) {
8948
- return packsClient.disable(input);
8949
- }
8712
+ listCatalog: packsClient.listCatalog,
8713
+ catalog: packsClient.listCatalog,
8714
+ listStates: packsClient.listStates,
8715
+ states: packsClient.getStates,
8716
+ install: packsClient.install,
8717
+ enable: packsClient.enable,
8718
+ disable: packsClient.disable
8950
8719
  },
8951
8720
  nodes: nodesNamespace,
8952
8721
  identity: {
@@ -8959,30 +8728,16 @@ function createLucernClient(config = {}) {
8959
8728
  raw: identityClient
8960
8729
  },
8961
8730
  mcp: {
8962
- bootstrapSession(input) {
8963
- return mcpClient.bootstrapSession(input);
8964
- },
8965
- checkWritePolicy(input) {
8966
- return mcpClient.checkWritePolicy(input);
8967
- },
8968
- beginBuildSession(input) {
8969
- return mcpClient.beginBuildSession(input);
8970
- },
8971
- evaluateEngineeringContract(input) {
8972
- return mcpClient.evaluateEngineeringContract(input);
8973
- },
8974
- evaluateResearchContract(input) {
8975
- return mcpClient.evaluateResearchContract(input);
8976
- }
8731
+ bootstrapSession: mcpClient.bootstrapSession,
8732
+ checkWritePolicy: mcpClient.checkWritePolicy,
8733
+ beginBuildSession: mcpClient.beginBuildSession,
8734
+ evaluateEngineeringContract: mcpClient.evaluateEngineeringContract,
8735
+ evaluateResearchContract: mcpClient.evaluateResearchContract
8977
8736
  },
8978
8737
  auth: {
8979
8738
  device: {
8980
- createCode(input) {
8981
- return authDeviceClient.createDeviceCode(input);
8982
- },
8983
- pollToken(deviceCode) {
8984
- return authDeviceClient.pollDeviceToken(deviceCode);
8985
- }
8739
+ createCode: authDeviceClient.createDeviceCode,
8740
+ pollToken: authDeviceClient.pollDeviceToken
8986
8741
  }
8987
8742
  },
8988
8743
  custom: getCustomNamespace("custom"),