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