@lucern/sdk 1.0.28 → 1.0.30

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 (191) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/accessControl.d.ts +31 -31
  3. package/dist/accessControl.js +1 -0
  4. package/dist/adminClient.d.ts +74 -74
  5. package/dist/adminClient.js +38 -30
  6. package/dist/{answersClient.d.ts → answers-client.d.ts} +1 -1
  7. package/dist/{answersClient.js → answers-client.js} +2 -2
  8. package/dist/audience/index.d.ts +12 -12
  9. package/dist/{audiencesClient.d.ts → audiences-client.d.ts} +1 -1
  10. package/dist/audiences-client.js +107 -0
  11. package/dist/{auditClient.d.ts → audit-client.d.ts} +2 -3
  12. package/dist/{auditClient.js → audit-client.js} +8 -7
  13. package/dist/authContext.d.ts +26 -26
  14. package/dist/authDeviceClient.d.ts +11 -11
  15. package/dist/authDeviceClient.js +4 -6
  16. package/dist/beliefs/index.d.ts +56 -28
  17. package/dist/beliefs/index.js +2 -1
  18. package/dist/beliefsClient.d.ts +71 -63
  19. package/dist/beliefsClient.js +90 -67
  20. package/dist/{boundaryClientSurface.d.ts → boundary-client-surface.d.ts} +4 -4
  21. package/dist/{boundaryClientSurface.js → boundary-client-surface.js} +9 -7
  22. package/dist/client-assembly-types.d.ts +219 -0
  23. package/dist/client-assembly-types.js +2 -0
  24. package/dist/{clientConfig.d.ts → client-config.d.ts} +16 -32
  25. package/dist/client-config.js +2 -0
  26. package/dist/{clientEvidenceCompat.d.ts → client-evidence-compat.d.ts} +24 -24
  27. package/dist/{clientEvidenceCompat.js → client-evidence-compat.js} +2 -2
  28. package/dist/client.d.ts +1906 -352
  29. package/dist/client.js +34 -30
  30. package/dist/clientGraphNamespaces.d.ts +35 -25
  31. package/dist/clientGraphNamespaces.js +11 -5
  32. package/dist/clientHelpers.js +8 -5
  33. package/dist/clientKnowledgeNamespaces.d.ts +124 -84
  34. package/dist/clientKnowledgeNamespaces.js +35 -34
  35. package/dist/clientLocalHelpers.d.ts +81 -52
  36. package/dist/clientLocalHelpers.js +193 -43
  37. package/dist/clientPlatformNamespaces.d.ts +1541 -150
  38. package/dist/clientPlatformNamespaces.js +10 -5
  39. package/dist/clientRuntime.d.ts +1 -1
  40. package/dist/clientRuntime.js +1 -1
  41. package/dist/clientWorkflowNamespaces.d.ts +211 -97
  42. package/dist/clientWorkflowNamespaces.js +22 -19
  43. package/dist/contextClient.d.ts +2 -2
  44. package/dist/contextClient.js +79 -50
  45. package/dist/contextFacade.d.ts +1 -1
  46. package/dist/contextFacade.js +2 -0
  47. package/dist/contextPackCompiler.d.ts +52 -52
  48. package/dist/contextPackCompiler.js +192 -122
  49. package/dist/contextPackPolicy.d.ts +22 -22
  50. package/dist/contextPackPolicy.js +21 -9
  51. package/dist/contextPackSchema.d.ts +3 -3
  52. package/dist/contextPackSchema.js +1 -0
  53. package/dist/contextTypes.d.ts +155 -155
  54. package/dist/contracts/api-enums.contract.js +2 -11
  55. package/dist/contracts/auth-session.contract.d.ts +16 -16
  56. package/dist/contracts/auth-session.contract.js +3 -2
  57. package/dist/contracts/context-pack.contract.d.ts +216 -216
  58. package/dist/contracts/contextPack.js +2 -0
  59. package/dist/contracts/index.d.ts +1 -1
  60. package/dist/contracts/index.js +2 -1
  61. package/dist/contracts/lens-filter.contract.d.ts +8 -8
  62. package/dist/contracts/lens-filter.contract.js +10 -10
  63. package/dist/contracts/lens-workflow.contract.d.ts +32 -32
  64. package/dist/contracts/lens-workflow.contract.js +2 -1
  65. package/dist/contracts/lensFilter.js +2 -0
  66. package/dist/contracts/lensWorkflow.js +2 -0
  67. package/dist/contracts/mcpTools.d.ts +19 -19
  68. package/dist/contracts/mcpTools.js +3 -1
  69. package/dist/contracts/prompt.contract.d.ts +12 -12
  70. package/dist/contracts/prompt.js +1 -0
  71. package/dist/contracts/sdk-tools.contract.js +1 -0
  72. package/dist/contracts/sdkTools.js +2 -0
  73. package/dist/contracts/tool-contracts.js +1 -0
  74. package/dist/contracts/workflow-runtime.contract.d.ts +45 -45
  75. package/dist/contracts/workflow-runtime.contract.js +1 -5
  76. package/dist/contracts/workflowRuntime.js +2 -0
  77. package/dist/contradictions/index.d.ts +8 -8
  78. package/dist/contradictions/index.js +1 -0
  79. package/dist/control-plane.d.ts +10 -10
  80. package/dist/control-plane.js +2 -2
  81. package/dist/controlObjectOwnership.d.ts +11 -11
  82. package/dist/controlObjectOwnership.js +1 -0
  83. package/dist/coreClient.d.ts +51 -51
  84. package/dist/coreClient.js +269 -101
  85. package/dist/customTools.d.ts +19 -19
  86. package/dist/customTools.js +4 -2
  87. package/dist/decisions/index.d.ts +18 -18
  88. package/dist/decisions/index.js +1 -0
  89. package/dist/decisionsClient.d.ts +4 -4
  90. package/dist/decisionsClient.js +36 -27
  91. package/dist/edges/index.d.ts +20 -18
  92. package/dist/edges/index.js +1 -0
  93. package/dist/embeddingsClient.d.ts +29 -29
  94. package/dist/embeddingsClient.js +15 -8
  95. package/dist/eventingClient.d.ts +27 -27
  96. package/dist/eventingClient.js +10 -5
  97. package/dist/events.d.ts +83 -83
  98. package/dist/events.js +19 -15
  99. package/dist/eventsCore.d.ts +7 -7
  100. package/dist/eventsCore.js +11 -10
  101. package/dist/evidence/index.d.ts +23 -21
  102. package/dist/evidence/index.js +1 -0
  103. package/dist/evidenceClient.d.ts +23 -23
  104. package/dist/evidenceClient.js +10 -6
  105. package/dist/facade/context.d.ts +9 -9
  106. package/dist/facade/context.js +67 -41
  107. package/dist/functionSurface.js +2 -0
  108. package/dist/functionSurfaceClient.js +2 -0
  109. package/dist/gatewayFacades.d.ts +215 -215
  110. package/dist/gatewayFacades.factories.d.ts +23 -44
  111. package/dist/gatewayFacades.factories.js +63 -62
  112. package/dist/gatewayFacades.js +31 -32
  113. package/dist/graphAnalysisClient.d.ts +60 -60
  114. package/dist/graphAnalysisClient.js +19 -18
  115. package/dist/graphClient.d.ts +34 -34
  116. package/dist/graphClient.js +56 -35
  117. package/dist/graphIntel.js +2 -0
  118. package/dist/graphIntelligence.d.ts +2 -2
  119. package/dist/graphIntelligence.js +1 -1
  120. package/dist/graphRecommendationsClient.d.ts +24 -24
  121. package/dist/graphRecommendationsClient.js +12 -7
  122. package/dist/graphStateClassifierClient.d.ts +13 -13
  123. package/dist/graphStateClassifierClient.js +10 -5
  124. package/dist/harnessClient.d.ts +61 -61
  125. package/dist/harnessClient.js +44 -31
  126. package/dist/identityClient.d.ts +33 -59
  127. package/dist/identityClient.js +126 -98
  128. package/dist/index.d.ts +20 -20
  129. package/dist/index.js +20 -19
  130. package/dist/infisicalRuntime.d.ts +11 -11
  131. package/dist/infisicalRuntime.js +20 -14
  132. package/dist/jobsClient.d.ts +28 -28
  133. package/dist/jobsClient.js +6 -3
  134. package/dist/learningClient.js +13 -8
  135. package/dist/lenses/index.d.ts +124 -28
  136. package/dist/lenses/index.js +1 -0
  137. package/dist/mcpClient.d.ts +1 -1
  138. package/dist/mcpClient.js +3 -3
  139. package/dist/modelRuntimeClient.d.ts +27 -27
  140. package/dist/modelRuntimeClient.js +10 -5
  141. package/dist/nodes/index.d.ts +9 -9
  142. package/dist/nodes/index.js +1 -0
  143. package/dist/ontologies/index.d.ts +68 -22
  144. package/dist/ontologies/index.js +1 -0
  145. package/dist/ontologyClient.js +24 -17
  146. package/dist/ontologyLinksClient.d.ts +35 -35
  147. package/dist/ontologyLinksClient.js +9 -6
  148. package/dist/opinion.d.ts +3 -3
  149. package/dist/opinion.js +12 -5
  150. package/dist/orgGraphSearchClient.d.ts +39 -39
  151. package/dist/orgGraphSearchClient.js +22 -13
  152. package/dist/packsClient.d.ts +1 -1
  153. package/dist/packsClient.js +28 -19
  154. package/dist/policyClient.d.ts +79 -68
  155. package/dist/policyClient.js +18 -12
  156. package/dist/proof-attestation.json +1 -1
  157. package/dist/questions/index.d.ts +38 -27
  158. package/dist/questions/index.js +1 -0
  159. package/dist/realtime/index.d.ts +3 -3
  160. package/dist/realtime/index.js +1 -0
  161. package/dist/realtime/refs.d.ts +2 -2
  162. package/dist/{reportsClient.d.ts → reports-client.d.ts} +2 -2
  163. package/dist/{reportsClient.js → reports-client.js} +19 -13
  164. package/dist/{schemaClient.d.ts → schema-client.d.ts} +2 -3
  165. package/dist/{schemaClient.js → schema-client.js} +14 -11
  166. package/dist/sdkSurface.d.ts +12 -12
  167. package/dist/sdkSurface.js +14 -10
  168. package/dist/secrets.d.ts +1 -1
  169. package/dist/secrets.js +2 -1
  170. package/dist/{sourcesClient.d.ts → sources-client.d.ts} +8 -9
  171. package/dist/{sourcesClient.js → sources-client.js} +4 -5
  172. package/dist/{telemetryClient.d.ts → telemetry-client.d.ts} +14 -14
  173. package/dist/{telemetryClient.js → telemetry-client.js} +6 -4
  174. package/dist/toolRegistryClient.d.ts +46 -46
  175. package/dist/toolRegistryClient.js +22 -11
  176. package/dist/topics/index.d.ts +23 -23
  177. package/dist/topics/index.js +2 -1
  178. package/dist/topicsClient.d.ts +6 -6
  179. package/dist/topicsClient.js +29 -18
  180. package/dist/types.d.ts +356 -355
  181. package/dist/version.d.ts +1 -1
  182. package/dist/version.js +1 -1
  183. package/dist/workflowClient.d.ts +36 -35
  184. package/dist/workflowClient.js +88 -60
  185. package/dist/worktrees/index.d.ts +118 -32
  186. package/dist/worktrees/index.js +2 -1
  187. package/package.json +45 -5
  188. package/dist/audiencesClient.js +0 -115
  189. package/dist/clientAssemblyTypes.d.ts +0 -33
  190. package/dist/clientAssemblyTypes.js +0 -2
  191. package/dist/clientConfig.js +0 -2
@@ -1,22 +1,24 @@
1
1
  import { type LucernTelemetryExporter } from "@lucern/transport-core";
2
2
  import { type LucernSdkAuthContextInput } from "./authContext";
3
- import type { JsonObject, JsonValue } from "./types";
3
+ import type { JsonValue } from "./types";
4
4
  /** Tenant and workspace identifiers used to scope gateway requests. */
5
- export type GatewayScope = {
5
+ export interface GatewayScope {
6
6
  tenantId?: string;
7
7
  workspaceId?: string;
8
- };
8
+ }
9
9
  /** Successful response envelope from the platform gateway with correlation metadata. */
10
- export type PlatformGatewaySuccess<T> = {
11
- success: true;
12
- data: T;
10
+ export interface PlatformGatewaySuccess<T> {
13
11
  correlationId: string;
14
- policyTraceId: string | null;
12
+ data: T;
15
13
  idempotentReplay: boolean;
16
- };
14
+ policyTraceId: string | null;
15
+ success: true;
16
+ }
17
17
  /** Failed response envelope with structured error codes and optional invariant references. */
18
- export type PlatformGatewayFailure = {
19
- success: false;
18
+ export interface PlatformGatewayFailure {
19
+ code?: string;
20
+ correlationId: string;
21
+ details?: JsonValue;
20
22
  /**
21
23
  * Error string is the canonical envelope field.
22
24
  * Object form is legacy-only compatibility for older gateway responses.
@@ -26,18 +28,16 @@ export type PlatformGatewayFailure = {
26
28
  message: string;
27
29
  details?: JsonValue;
28
30
  };
29
- code?: string;
30
31
  invariant?: string | null;
31
- suggestion?: string | null;
32
- details?: JsonValue;
33
32
  legacyError?: {
34
33
  code: string;
35
34
  message: string;
36
35
  details?: JsonValue;
37
36
  };
38
- correlationId: string;
39
37
  policyTraceId: string | null;
40
- };
38
+ success: false;
39
+ suggestion?: string | null;
40
+ }
41
41
  /** Discriminated union of success and failure gateway responses. */
42
42
  export type PlatformGatewayEnvelope<T> = PlatformGatewaySuccess<T> | PlatformGatewayFailure;
43
43
  export declare class GatewayTimeoutError extends Error {
@@ -87,17 +87,17 @@ export declare class LucernApiError extends Error {
87
87
  export type GatewayHttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
88
88
  type FetchLike = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
89
89
  /** Context passed to the `onRequest` hook before each gateway request attempt. */
90
- export type GatewayRequestHookContext = {
91
- requestId: string;
90
+ export interface GatewayRequestHookContext {
92
91
  attempt: number;
92
+ body?: string;
93
+ headers: Headers;
93
94
  maxRetries: number;
94
95
  method: GatewayHttpMethod;
95
96
  path: string;
96
- url: string;
97
- headers: Headers;
98
- body?: string;
97
+ requestId: string;
99
98
  timeoutMs: number;
100
- };
99
+ url: string;
100
+ }
101
101
  /** Context passed to the `onResponse` hook after each gateway request attempt (including retries and failures). */
102
102
  export type GatewayResponseHookContext = GatewayRequestHookContext & {
103
103
  durationMs: number;
@@ -117,56 +117,56 @@ export type GatewayClientEnvironment = "sandbox" | "production";
117
117
  * Most developers should use {@link createLucernClient} instead, which wraps
118
118
  * this config with higher-level conveniences like `apiKey` and `environment`.
119
119
  */
120
- export type GatewayClientConfig = {
121
- baseUrl?: string;
122
- fetchImpl?: FetchLike;
120
+ export interface GatewayClientConfig {
123
121
  /** Lucern tenant API key or service API key. Sent as `x-lucern-key`. */
124
122
  apiKey?: string;
125
123
  /**
126
- * Lucern platform session token. This is not a Clerk JWT.
127
- * Server-side tenant proxies should normally send `apiKey` plus `clerkId`.
124
+ * Canonical Master Control identity tuple applied to every SDK request.
125
+ * Use this for tenant/workspace-scoped graph and identity operations.
128
126
  */
129
- userToken?: string;
130
- /** Gateway environment label for legacy sandbox/production routing. */
131
- environment?: GatewayClientEnvironment;
127
+ authContext?: LucernSdkAuthContextInput | (() => Promise<LucernSdkAuthContextInput | undefined>) | (() => LucernSdkAuthContextInput | undefined);
128
+ baseUrl?: string;
132
129
  /** Clerk subject for the current end user. */
133
130
  clerkId?: string;
134
- /** Optional explicit user subject. Defaults to `clerkId` when omitted. */
135
- userId?: string;
136
131
  /** Optional deployment host hint for front-door routing. */
137
132
  deploymentHost?: string;
133
+ /** Gateway environment label for legacy sandbox/production routing. */
134
+ environment?: GatewayClientEnvironment;
135
+ fetchImpl?: FetchLike;
138
136
  getAuthHeaders?: (() => Promise<Record<string, string>>) | (() => Record<string, string>);
139
- /**
140
- * Canonical Master Control identity tuple applied to every SDK request.
141
- * Use this for tenant/workspace-scoped graph and identity operations.
142
- */
143
- authContext?: LucernSdkAuthContextInput | (() => Promise<LucernSdkAuthContextInput | undefined>) | (() => LucernSdkAuthContextInput | undefined);
144
- /** When true, requests fail before fetch if `authContext` is absent. */
145
- requireCanonicalAuthContext?: boolean;
146
137
  /** Max retries for transient errors (5xx, network). Defaults to 2. */
147
138
  maxRetries?: number;
148
- /** Request timeout in ms. Defaults to 15000. */
149
- timeoutMs?: number;
150
- /** Optional timeout overrides by HTTP method. */
151
- timeoutMsByMethod?: Partial<Record<GatewayHttpMethod, number>>;
139
+ /** Invoked before each request attempt, including retries. */
140
+ onRequest?: ((context: GatewayRequestHookContext) => void) | ((context: GatewayRequestHookContext) => Promise<void>);
141
+ /** Invoked after each request attempt, including retries and failures. */
142
+ onResponse?: ((context: GatewayResponseHookContext) => void) | ((context: GatewayResponseHookContext) => Promise<void>);
152
143
  /** Optional request ID factory used for correlation headers. */
153
144
  requestIdFactory?: () => string;
145
+ /** When true, requests fail before fetch if `authContext` is absent. */
146
+ requireCanonicalAuthContext?: boolean;
147
+ /** Set false to disable SDK operational telemetry even when env is present. */
148
+ telemetryEnabled?: boolean;
154
149
  /**
155
150
  * Optional operational telemetry sink. When omitted, the SDK resolves an
156
151
  * Axiom exporter from Infisical-injected environment variables if present.
157
152
  */
158
153
  telemetryExporter?: LucernTelemetryExporter | null;
159
- /** Set false to disable SDK operational telemetry even when env is present. */
160
- telemetryEnabled?: boolean;
161
- /** Invoked before each request attempt, including retries. */
162
- onRequest?: ((context: GatewayRequestHookContext) => void) | ((context: GatewayRequestHookContext) => Promise<void>);
163
- /** Invoked after each request attempt, including retries and failures. */
164
- onResponse?: ((context: GatewayResponseHookContext) => void) | ((context: GatewayResponseHookContext) => Promise<void>);
165
- };
154
+ /** Request timeout in ms. Defaults to 15000. */
155
+ timeoutMs?: number;
156
+ /** Optional timeout overrides by HTTP method. */
157
+ timeoutMsByMethod?: Partial<Record<GatewayHttpMethod, number>>;
158
+ /** Optional explicit user subject. Defaults to `clerkId` when omitted. */
159
+ userId?: string;
160
+ /**
161
+ * Lucern platform session token. This is not a Clerk JWT.
162
+ * Server-side tenant proxies should normally send `apiKey` plus `clerkId`.
163
+ */
164
+ userToken?: string;
165
+ }
166
166
  /**
167
167
  * Serialize a gateway query object into a URL query string.
168
168
  */
169
- export declare function toQueryString(scope: GatewayScope & Record<string, string | number | boolean | undefined>): string;
169
+ export declare function toQueryString(scope: object): string;
170
170
  declare function generatePortableRequestId(): string;
171
171
  /**
172
172
  * Generate a random idempotency key for retry-safe writes.
@@ -179,7 +179,7 @@ export declare function createGatewayRequestClient(config?: GatewayClientConfig)
179
179
  request: <T>(args: {
180
180
  path: string;
181
181
  method?: GatewayHttpMethod;
182
- body?: JsonObject;
182
+ body?: unknown;
183
183
  idempotencyKey?: string;
184
184
  requestId?: string;
185
185
  timeoutMs?: number;