@lucern/sdk 1.0.29 → 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 +8 -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,5 +1,8 @@
1
- import { createGatewayRequestClient, LucernApiError, randomIdempotencyKey, toQueryString, } from "./coreClient.js";
2
- import { createListResult, mapGatewayData, normalizeTopicQuery } from "./sdkSurface.js";
1
+ // biome-ignore-all lint/style/useFilenamingConvention: This file is an @lucern/sdk public import ABI / package subpath compatibility surface; the camelCase filename is intentional.
2
+ import { createGatewayRequestClient,
3
+ // biome-ignore lint/style/noExportedImports: harnessClient preserves this legacy compatibility re-export while package root also exports coreClient.
4
+ LucernApiError, randomIdempotencyKey, toQueryString, } from "./coreClient.js";
5
+ import { createListResult, mapGatewayData, normalizeTopicQuery, } from "./sdkSurface.js";
3
6
  export { LucernApiError };
4
7
  /**
5
8
  * Create the harness client for agent and tool registry operations.
@@ -10,15 +13,17 @@ export function createHarnessClient(config = {}) {
10
13
  /**
11
14
  * List agent definitions.
12
15
  */
13
- async listAgentDefinitions(scope = {}) {
14
- return gateway.request({
16
+ listAgentDefinitions(scope = {}) {
17
+ return gateway
18
+ .request({
15
19
  path: `/api/platform/v1/harness/agents${toQueryString(scope)}`,
16
- }).then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "agents")));
20
+ })
21
+ .then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "agents")));
17
22
  },
18
23
  /**
19
24
  * Get an agent definition.
20
25
  */
21
- async getAgentDefinition(agentId, scope = {}) {
26
+ getAgentDefinition(agentId, scope = {}) {
22
27
  return gateway.request({
23
28
  path: `/api/platform/v1/harness/agents/${encodeURIComponent(agentId)}${toQueryString(scope)}`,
24
29
  });
@@ -26,7 +31,7 @@ export function createHarnessClient(config = {}) {
26
31
  /**
27
32
  * Create an agent definition.
28
33
  */
29
- async createAgentDefinition(input, idempotencyKey) {
34
+ createAgentDefinition(input, idempotencyKey) {
30
35
  return gateway.request({
31
36
  path: "/api/platform/v1/harness/agents",
32
37
  method: "POST",
@@ -37,7 +42,7 @@ export function createHarnessClient(config = {}) {
37
42
  /**
38
43
  * Update an agent definition.
39
44
  */
40
- async updateAgentDefinition(agentId, input, idempotencyKey) {
45
+ updateAgentDefinition(agentId, input, idempotencyKey) {
41
46
  return gateway.request({
42
47
  path: `/api/platform/v1/harness/agents/${encodeURIComponent(agentId)}`,
43
48
  method: "PUT",
@@ -48,7 +53,7 @@ export function createHarnessClient(config = {}) {
48
53
  /**
49
54
  * Invoke a managed agent definition.
50
55
  */
51
- async invokeManagedAgentDefinition(agentId, input, idempotencyKey) {
56
+ invokeManagedAgentDefinition(agentId, input, idempotencyKey) {
52
57
  return gateway.request({
53
58
  path: `/api/platform/v1/harness/agents/${encodeURIComponent(agentId)}/runs`,
54
59
  method: "POST",
@@ -62,23 +67,27 @@ export function createHarnessClient(config = {}) {
62
67
  /**
63
68
  * List runs for an agent definition.
64
69
  */
65
- async listAgentRuns(agentId, scope = {}) {
66
- return gateway.request({
70
+ listAgentRuns(agentId, scope = {}) {
71
+ return gateway
72
+ .request({
67
73
  path: `/api/platform/v1/harness/agents/${encodeURIComponent(agentId)}/runs${toQueryString(scope)}`,
68
- }).then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "runs")));
74
+ })
75
+ .then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "runs")));
69
76
  },
70
77
  /**
71
78
  * List tool definitions.
72
79
  */
73
- async listToolDefinitions(scope = {}) {
74
- return gateway.request({
80
+ listToolDefinitions(scope = {}) {
81
+ return gateway
82
+ .request({
75
83
  path: `/api/platform/v1/harness/tools${toQueryString(scope)}`,
76
- }).then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "tools")));
84
+ })
85
+ .then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "tools")));
77
86
  },
78
87
  /**
79
88
  * Get a tool definition.
80
89
  */
81
- async getToolDefinition(toolId, scope = {}) {
90
+ getToolDefinition(toolId, scope = {}) {
82
91
  return gateway.request({
83
92
  path: `/api/platform/v1/harness/tools/${encodeURIComponent(toolId)}${toQueryString(scope)}`,
84
93
  });
@@ -86,7 +95,7 @@ export function createHarnessClient(config = {}) {
86
95
  /**
87
96
  * Create a tool definition.
88
97
  */
89
- async createToolDefinition(input, idempotencyKey) {
98
+ createToolDefinition(input, idempotencyKey) {
90
99
  return gateway.request({
91
100
  path: "/api/platform/v1/harness/tools",
92
101
  method: "POST",
@@ -97,7 +106,7 @@ export function createHarnessClient(config = {}) {
97
106
  /**
98
107
  * Update a tool definition.
99
108
  */
100
- async updateToolDefinition(toolId, input, idempotencyKey) {
109
+ updateToolDefinition(toolId, input, idempotencyKey) {
101
110
  return gateway.request({
102
111
  path: `/api/platform/v1/harness/tools/${encodeURIComponent(toolId)}`,
103
112
  method: "PUT",
@@ -108,7 +117,7 @@ export function createHarnessClient(config = {}) {
108
117
  /**
109
118
  * Execute a tool definition.
110
119
  */
111
- async executeToolDefinition(toolId, input = {}) {
120
+ executeToolDefinition(toolId, input = {}) {
112
121
  return gateway.request({
113
122
  path: `/api/platform/v1/harness/tools/${encodeURIComponent(toolId)}/execute`,
114
123
  method: "POST",
@@ -118,15 +127,17 @@ export function createHarnessClient(config = {}) {
118
127
  /**
119
128
  * List run ledger entries.
120
129
  */
121
- async listRunEntries(scope = {}) {
122
- return gateway.request({
130
+ listRunEntries(scope = {}) {
131
+ return gateway
132
+ .request({
123
133
  path: `/api/platform/v1/harness/runs${toQueryString(scope)}`,
124
- }).then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "runs")));
134
+ })
135
+ .then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "runs")));
125
136
  },
126
137
  /**
127
138
  * Create a harness run.
128
139
  */
129
- async startHarnessRun(input, idempotencyKey) {
140
+ startHarnessRun(input, idempotencyKey) {
130
141
  return gateway.request({
131
142
  path: "/api/platform/v1/harness/runs",
132
143
  method: "POST",
@@ -137,7 +148,7 @@ export function createHarnessClient(config = {}) {
137
148
  /**
138
149
  * Get a run ledger entry.
139
150
  */
140
- async getRunLedgerEntry(runId) {
151
+ getRunLedgerEntry(runId) {
141
152
  return gateway.request({
142
153
  path: `/api/platform/v1/harness/runs/${encodeURIComponent(runId)}`,
143
154
  });
@@ -145,7 +156,7 @@ export function createHarnessClient(config = {}) {
145
156
  /**
146
157
  * Update a harness run with a ledger event.
147
158
  */
148
- async reportHarnessRunEvent(runId, input, idempotencyKey) {
159
+ reportHarnessRunEvent(runId, input, idempotencyKey) {
149
160
  return gateway.request({
150
161
  path: `/api/platform/v1/harness/runs/${encodeURIComponent(runId)}/report`,
151
162
  method: "POST",
@@ -156,7 +167,7 @@ export function createHarnessClient(config = {}) {
156
167
  /**
157
168
  * Update a harness run heartbeat.
158
169
  */
159
- async heartbeatHarnessRun(runId, input, idempotencyKey) {
170
+ heartbeatHarnessRun(runId, input, idempotencyKey) {
160
171
  return gateway.request({
161
172
  path: `/api/platform/v1/harness/runs/${encodeURIComponent(runId)}/heartbeat`,
162
173
  method: "POST",
@@ -167,7 +178,7 @@ export function createHarnessClient(config = {}) {
167
178
  /**
168
179
  * Complete a harness run.
169
180
  */
170
- async completeHarnessRun(runId, input, idempotencyKey) {
181
+ completeHarnessRun(runId, input, idempotencyKey) {
171
182
  return gateway.request({
172
183
  path: `/api/platform/v1/harness/runs/${encodeURIComponent(runId)}/complete`,
173
184
  method: "POST",
@@ -178,15 +189,17 @@ export function createHarnessClient(config = {}) {
178
189
  /**
179
190
  * List prompt resolutions.
180
191
  */
181
- async listPromptResolutions(query = {}) {
182
- return gateway.request({
192
+ listPromptResolutions(query = {}) {
193
+ return gateway
194
+ .request({
183
195
  path: `/api/platform/v1/harness/prompts${toQueryString(query)}`,
184
- }).then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "prompts")));
196
+ })
197
+ .then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "prompts")));
185
198
  },
186
199
  /**
187
200
  * Get the harness scope taxonomy.
188
201
  */
189
- async getScopeTaxonomy() {
202
+ getScopeTaxonomy() {
190
203
  return gateway.request({
191
204
  path: "/api/platform/v1/harness/scopes",
192
205
  });
@@ -1,69 +1,69 @@
1
- import { type GatewayClientConfig, type GatewayScope, type PlatformGatewaySuccess, LucernApiError } from "./coreClient";
1
+ import { type ResolvedInteractivePrincipalContext, type ResolveInteractivePrincipalInput } from "./control-plane";
2
+ import { type GatewayClientConfig, type GatewayScope, LucernApiError, type PlatformGatewaySuccess } from "./coreClient";
2
3
  import type { JsonObject, ListResult, SdkPrincipalContext } from "./types";
3
- import { type ResolveInteractivePrincipalInput, type ResolvedInteractivePrincipalContext } from "./control-plane";
4
4
  /** Summary of the currently authenticated principal and their scopes. */
5
5
  export type IdentitySummary = SdkPrincipalContext;
6
6
  /** Gateway response wrapping an identity summary payload. */
7
7
  export type IdentityWhoamiResponse = PlatformGatewaySuccess<IdentitySummary>;
8
- export { LucernApiError };
9
8
  export type { GatewayScope, PlatformGatewaySuccess } from "./coreClient";
9
+ export { LucernApiError };
10
10
  /** Configuration for the identity client. */
11
11
  export type IdentityClientConfig = GatewayClientConfig;
12
- export type ClerkUserSearchResult = {
12
+ export interface ClerkUserSearchResult {
13
13
  clerkId: string;
14
+ displayName: string | null;
14
15
  email: string | null;
15
16
  firstName: string | null;
16
- lastName: string | null;
17
- displayName: string | null;
18
17
  imageUrl: string | null;
19
- };
18
+ lastName: string | null;
19
+ }
20
20
  export declare const TENANT_IDENTITY_FIELDS: readonly ["tenantId", "workspaceId", "principalId", "integrationKey", "secretRef", "policySubject", "policyAction", "policyResource", "decision", "config", "configKey", "configValue", "provider", "status", "metadata", "limit", "cursor"];
21
- export type TenantIdentityConfigRecord = {
22
- tenantId: string;
23
- workspaceId?: string;
21
+ export interface TenantIdentityConfigRecord {
24
22
  config?: JsonObject | null;
25
23
  metadata?: JsonObject | null;
24
+ tenantId: string;
26
25
  updatedAt?: number;
27
26
  updatedBy?: string;
28
- };
29
- export type TenantIntegrationRecord = {
30
- tenantId: string;
31
27
  workspaceId?: string;
28
+ }
29
+ export interface TenantIntegrationRecord {
30
+ createdAt?: number;
32
31
  integrationKey: string;
32
+ metadata?: JsonObject | null;
33
33
  provider?: string;
34
34
  status?: string;
35
- metadata?: JsonObject | null;
36
- createdAt?: number;
37
- updatedAt?: number;
38
- };
39
- export type TenantSecretReference = {
40
35
  tenantId: string;
36
+ updatedAt?: number;
41
37
  workspaceId?: string;
38
+ }
39
+ export interface TenantSecretReference {
42
40
  integrationKey?: string;
41
+ metadata?: JsonObject | null;
43
42
  secretRef: string;
44
43
  status?: string;
45
- metadata?: JsonObject | null;
46
- updatedAt?: number;
47
- };
48
- export type PolicyDecisionRecord = {
49
44
  tenantId: string;
45
+ updatedAt?: number;
50
46
  workspaceId?: string;
51
- principalId?: string;
52
- policySubject: string;
47
+ }
48
+ export interface PolicyDecisionRecord {
49
+ createdAt?: number;
50
+ decision: "allow" | "deny" | string;
51
+ metadata?: JsonObject | null;
53
52
  policyAction: string;
54
53
  policyResource: string;
55
- decision: "allow" | "deny" | string;
54
+ policySubject: string;
55
+ principalId?: string;
56
56
  reason?: string;
57
- metadata?: JsonObject | null;
58
- createdAt?: number;
59
- };
60
- export type TenantIdentityScope = {
61
57
  tenantId: string;
62
58
  workspaceId?: string;
63
- principalId?: string;
64
- limit?: number;
59
+ }
60
+ export interface TenantIdentityScope {
65
61
  cursor?: string;
66
- };
62
+ limit?: number;
63
+ principalId?: string;
64
+ tenantId: string;
65
+ workspaceId?: string;
66
+ }
67
67
  export type UpdateTenantConfigInput = TenantIdentityScope & {
68
68
  config?: JsonObject;
69
69
  configKey?: string;
@@ -102,33 +102,7 @@ export declare function createIdentityClient(config?: IdentityClientConfig): {
102
102
  /**
103
103
  * Resolve the current authenticated identity summary.
104
104
  */
105
- whoami(): Promise<PlatformGatewaySuccess<{
106
- principalId: string;
107
- principalType: "user" | "group" | "human" | "service" | "agent" | "external_viewer";
108
- clerkId: string | undefined;
109
- tenantId: string | null;
110
- workspaceId: string | null;
111
- scopes: string[];
112
- roles: string[];
113
- groupIds: string[];
114
- permittedToolNames: string[];
115
- permittedPackKeys: string[];
116
- principalStatus: string | undefined;
117
- tenantStatus: string | undefined;
118
- workspaceStatus: string | undefined;
119
- isPlatformAdmin: boolean;
120
- isTenantAdmin: boolean;
121
- isWorkspaceAdmin: boolean;
122
- permit: {
123
- subject: string;
124
- tenant: string;
125
- workspace?: string;
126
- } | undefined;
127
- authMode: string | undefined;
128
- sessionId: string | undefined;
129
- delegatedBy: string | undefined;
130
- expiresAt: number | undefined;
131
- }>>;
105
+ whoami(): Promise<PlatformGatewaySuccess<SdkPrincipalContext>>;
132
106
  /**
133
107
  * Resolve a Clerk subject through the tenant control-plane Permit projection.
134
108
  * @deprecated Prefer lucern.controlPlane.identity.resolveInteractivePrincipal().
@@ -1,11 +1,14 @@
1
- import { createGatewayRequestClient, LucernApiError, randomIdempotencyKey, toQueryString, } from "./coreClient.js";
2
- import { cleanRequiredString, knownPayload, listResultFromEnvelope, } from "./boundaryClientSurface.js";
3
- import { createListResult, mapGatewayData } from "./sdkSurface.js";
1
+ // biome-ignore-all lint/style/useFilenamingConvention: This file is an @lucern/sdk public import ABI / package subpath compatibility surface; the camelCase filename is intentional.
2
+ import { cleanRequiredString, knownPayload, listResultFromEnvelope, } from "./boundary-client-surface.js";
4
3
  import { normalizeResolvedInteractivePrincipal, } from "./control-plane.js";
4
+ import { createGatewayRequestClient,
5
+ // biome-ignore lint/style/noExportedImports: identityClient preserves this legacy compatibility re-export while package root also exports coreClient.
6
+ LucernApiError, randomIdempotencyKey, toQueryString, } from "./coreClient.js";
7
+ import { createListResult, mapGatewayData } from "./sdkSurface.js";
5
8
  function createIdentityWhoamiClient(config = {}) {
6
9
  const gateway = createGatewayRequestClient(config);
7
10
  return {
8
- async whoami() {
11
+ whoami() {
9
12
  return gateway.request({
10
13
  path: "/api/platform/v1/identity/whoami",
11
14
  });
@@ -44,6 +47,44 @@ function tenantIdentityQuery(input) {
44
47
  function tenantIdentityBody(input, operation) {
45
48
  return knownPayload(input, TENANT_IDENTITY_FIELDS, operation);
46
49
  }
50
+ function identityStringList(value) {
51
+ return Array.isArray(value) ? value : [];
52
+ }
53
+ function fallbackPermit(data) {
54
+ if (!data.tenantId) {
55
+ return;
56
+ }
57
+ return {
58
+ subject: data.principalId,
59
+ tenant: data.tenantId,
60
+ ...(data.workspaceId ? { workspace: data.workspaceId } : {}),
61
+ };
62
+ }
63
+ function normalizeIdentitySummary(data) {
64
+ return {
65
+ principalId: data.principalId,
66
+ principalType: data.principalType,
67
+ clerkId: data.clerkId,
68
+ tenantId: data.tenantId ?? null,
69
+ workspaceId: data.workspaceId ?? null,
70
+ scopes: identityStringList(data.scopes),
71
+ roles: identityStringList(data.roles),
72
+ groupIds: identityStringList(data.groupIds),
73
+ permittedToolNames: identityStringList(data.permittedToolNames),
74
+ permittedPackKeys: identityStringList(data.permittedPackKeys),
75
+ principalStatus: data.principalStatus,
76
+ tenantStatus: data.tenantStatus,
77
+ workspaceStatus: data.workspaceStatus,
78
+ isPlatformAdmin: data.isPlatformAdmin === true,
79
+ isTenantAdmin: data.isTenantAdmin === true,
80
+ isWorkspaceAdmin: data.isWorkspaceAdmin === true,
81
+ permit: data.permit ?? fallbackPermit(data),
82
+ authMode: data.authMode,
83
+ sessionId: data.sessionId,
84
+ delegatedBy: data.delegatedBy,
85
+ expiresAt: data.expiresAt,
86
+ };
87
+ }
47
88
  /**
48
89
  * Create the identity client for principals and API keys.
49
90
  * @param config - Gateway transport configuration.
@@ -69,47 +110,16 @@ export function createIdentityClient(config = {}) {
69
110
  /**
70
111
  * Resolve the current authenticated identity summary.
71
112
  */
72
- async whoami() {
73
- return whoamiClient.whoami().then((response) => mapGatewayData(response, (data) => ({
74
- principalId: data.principalId,
75
- principalType: data.principalType,
76
- clerkId: data.clerkId,
77
- tenantId: data.tenantId ?? null,
78
- workspaceId: data.workspaceId ?? null,
79
- scopes: Array.isArray(data.scopes) ? data.scopes : [],
80
- roles: Array.isArray(data.roles) ? data.roles : [],
81
- groupIds: Array.isArray(data.groupIds) ? data.groupIds : [],
82
- permittedToolNames: Array.isArray(data.permittedToolNames)
83
- ? data.permittedToolNames
84
- : [],
85
- permittedPackKeys: Array.isArray(data.permittedPackKeys)
86
- ? data.permittedPackKeys
87
- : [],
88
- principalStatus: data.principalStatus,
89
- tenantStatus: data.tenantStatus,
90
- workspaceStatus: data.workspaceStatus,
91
- isPlatformAdmin: data.isPlatformAdmin === true,
92
- isTenantAdmin: data.isTenantAdmin === true,
93
- isWorkspaceAdmin: data.isWorkspaceAdmin === true,
94
- permit: data.permit ??
95
- (data.tenantId
96
- ? {
97
- subject: data.principalId,
98
- tenant: data.tenantId,
99
- ...(data.workspaceId ? { workspace: data.workspaceId } : {}),
100
- }
101
- : undefined),
102
- authMode: data.authMode,
103
- sessionId: data.sessionId,
104
- delegatedBy: data.delegatedBy,
105
- expiresAt: data.expiresAt,
106
- })));
113
+ whoami() {
114
+ return whoamiClient
115
+ .whoami()
116
+ .then((response) => mapGatewayData(response, normalizeIdentitySummary));
107
117
  },
108
118
  /**
109
119
  * Resolve a Clerk subject through the tenant control-plane Permit projection.
110
120
  * @deprecated Prefer lucern.controlPlane.identity.resolveInteractivePrincipal().
111
121
  */
112
- async resolveInteractivePrincipal(input) {
122
+ resolveInteractivePrincipal(input) {
113
123
  return gateway
114
124
  .request({
115
125
  path: "/api/platform/v1/control-plane/identity/resolve-interactive-principal",
@@ -121,15 +131,17 @@ export function createIdentityClient(config = {}) {
121
131
  /**
122
132
  * List principals in the current identity scope.
123
133
  */
124
- async listPrincipals(query = {}) {
125
- return gateway.request({
134
+ listPrincipals(query = {}) {
135
+ return gateway
136
+ .request({
126
137
  path: `/api/platform/v1/identity/principals${toQueryString(query)}`,
127
- }).then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "principals")));
138
+ })
139
+ .then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "principals")));
128
140
  },
129
141
  /**
130
142
  * Create a principal.
131
143
  */
132
- async createPrincipal(input, idempotencyKey) {
144
+ createPrincipal(input, idempotencyKey) {
133
145
  return requestPrincipalWrite("POST", input, idempotencyKey);
134
146
  },
135
147
  /**
@@ -143,15 +155,17 @@ export function createIdentityClient(config = {}) {
143
155
  /**
144
156
  * List keys in the current identity scope.
145
157
  */
146
- async listKeys(query = {}) {
147
- return gateway.request({
158
+ listKeys(query = {}) {
159
+ return gateway
160
+ .request({
148
161
  path: `/api/platform/v1/identity/keys${toQueryString(query)}`,
149
- }).then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "keys")));
162
+ })
163
+ .then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "keys")));
150
164
  },
151
165
  /**
152
166
  * Create an API key.
153
167
  */
154
- async createKey(input, idempotencyKey) {
168
+ createKey(input, idempotencyKey) {
155
169
  return gateway.request({
156
170
  path: "/api/platform/v1/identity/keys",
157
171
  method: "POST",
@@ -162,7 +176,7 @@ export function createIdentityClient(config = {}) {
162
176
  /**
163
177
  * Rotate an API key.
164
178
  */
165
- async rotateKey(keyId, input = {}, idempotencyKey) {
179
+ rotateKey(keyId, input = {}, idempotencyKey) {
166
180
  return gateway.request({
167
181
  path: `/api/platform/v1/identity/keys/${encodeURIComponent(keyId)}/rotate`,
168
182
  method: "POST",
@@ -181,75 +195,89 @@ export function createIdentityClient(config = {}) {
181
195
  /**
182
196
  * Search Clerk users by email or display attributes.
183
197
  */
184
- async searchClerkUsers(q) {
198
+ searchClerkUsers(q) {
185
199
  return gateway.request({
186
200
  path: `/api/platform/v1/identity/clerk-users${toQueryString({ q })}`,
187
201
  });
188
202
  },
189
- async getTenantConfig(input) {
203
+ getTenantConfig(input) {
190
204
  return gateway.request({
191
205
  path: `/api/platform/v1/identity/tenant-config${toQueryString(tenantIdentityQuery(input))}`,
192
206
  });
193
207
  },
194
- async updateTenantConfig(input, idempotencyKey) {
195
- cleanRequiredString(input.tenantId, "tenantId");
196
- return gateway.request({
197
- path: "/api/platform/v1/identity/tenant-config",
198
- method: "PATCH",
199
- body: tenantIdentityBody(input, "identity.updateTenantConfig"),
200
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
208
+ updateTenantConfig(input, idempotencyKey) {
209
+ return Promise.resolve().then(() => {
210
+ cleanRequiredString(input.tenantId, "tenantId");
211
+ return gateway.request({
212
+ path: "/api/platform/v1/identity/tenant-config",
213
+ method: "PATCH",
214
+ body: tenantIdentityBody(input, "identity.updateTenantConfig"),
215
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
216
+ });
201
217
  });
202
218
  },
203
- async listIntegrations(input) {
204
- return gateway.request({
219
+ listIntegrations(input) {
220
+ return gateway
221
+ .request({
205
222
  path: `/api/platform/v1/identity/integrations${toQueryString(tenantIdentityQuery(input))}`,
206
- }).then((response) => mapGatewayData(response, (data) => listResultFromEnvelope(data, "integrations")));
223
+ })
224
+ .then((response) => mapGatewayData(response, (data) => listResultFromEnvelope(data, "integrations")));
207
225
  },
208
- async upsertIntegration(input, idempotencyKey) {
209
- cleanRequiredString(input.tenantId, "tenantId");
210
- cleanRequiredString(input.integrationKey, "integrationKey");
211
- return gateway.request({
212
- path: "/api/platform/v1/identity/integrations",
213
- method: "PUT",
214
- body: tenantIdentityBody(input, "identity.upsertIntegration"),
215
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
226
+ upsertIntegration(input, idempotencyKey) {
227
+ return Promise.resolve().then(() => {
228
+ cleanRequiredString(input.tenantId, "tenantId");
229
+ cleanRequiredString(input.integrationKey, "integrationKey");
230
+ return gateway.request({
231
+ path: "/api/platform/v1/identity/integrations",
232
+ method: "PUT",
233
+ body: tenantIdentityBody(input, "identity.upsertIntegration"),
234
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
235
+ });
216
236
  });
217
237
  },
218
- async listSecrets(input) {
219
- return gateway.request({
238
+ listSecrets(input) {
239
+ return gateway
240
+ .request({
220
241
  path: `/api/platform/v1/identity/secrets${toQueryString(tenantIdentityQuery(input))}`,
221
- }).then((response) => mapGatewayData(response, (data) => listResultFromEnvelope(data, "secrets")));
242
+ })
243
+ .then((response) => mapGatewayData(response, (data) => listResultFromEnvelope(data, "secrets")));
222
244
  },
223
- async putSecretReference(input, idempotencyKey) {
224
- cleanRequiredString(input.tenantId, "tenantId");
225
- cleanRequiredString(input.secretRef, "secretRef");
226
- return gateway.request({
227
- path: "/api/platform/v1/identity/secrets",
228
- method: "PUT",
229
- body: tenantIdentityBody(input, "identity.putSecretReference"),
230
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
245
+ putSecretReference(input, idempotencyKey) {
246
+ return Promise.resolve().then(() => {
247
+ cleanRequiredString(input.tenantId, "tenantId");
248
+ cleanRequiredString(input.secretRef, "secretRef");
249
+ return gateway.request({
250
+ path: "/api/platform/v1/identity/secrets",
251
+ method: "PUT",
252
+ body: tenantIdentityBody(input, "identity.putSecretReference"),
253
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
254
+ });
231
255
  });
232
256
  },
233
- async evaluatePolicy(input, idempotencyKey) {
234
- cleanRequiredString(input.tenantId, "tenantId");
235
- cleanRequiredString(input.policySubject, "policySubject");
236
- cleanRequiredString(input.policyAction, "policyAction");
237
- cleanRequiredString(input.policyResource, "policyResource");
238
- return gateway.request({
239
- path: "/api/platform/v1/identity/policy/evaluate",
240
- method: "POST",
241
- body: tenantIdentityBody(input, "identity.evaluatePolicy"),
242
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
257
+ evaluatePolicy(input, idempotencyKey) {
258
+ return Promise.resolve().then(() => {
259
+ cleanRequiredString(input.tenantId, "tenantId");
260
+ cleanRequiredString(input.policySubject, "policySubject");
261
+ cleanRequiredString(input.policyAction, "policyAction");
262
+ cleanRequiredString(input.policyResource, "policyResource");
263
+ return gateway.request({
264
+ path: "/api/platform/v1/identity/policy/evaluate",
265
+ method: "POST",
266
+ body: tenantIdentityBody(input, "identity.evaluatePolicy"),
267
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
268
+ });
243
269
  });
244
270
  },
245
- async recordPolicyDecision(input, idempotencyKey) {
246
- cleanRequiredString(input.tenantId, "tenantId");
247
- cleanRequiredString(input.decision, "decision");
248
- return gateway.request({
249
- path: "/api/platform/v1/identity/policy/decisions",
250
- method: "POST",
251
- body: tenantIdentityBody(input, "identity.recordPolicyDecision"),
252
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
271
+ recordPolicyDecision(input, idempotencyKey) {
272
+ return Promise.resolve().then(() => {
273
+ cleanRequiredString(input.tenantId, "tenantId");
274
+ cleanRequiredString(input.decision, "decision");
275
+ return gateway.request({
276
+ path: "/api/platform/v1/identity/policy/decisions",
277
+ method: "POST",
278
+ body: tenantIdentityBody(input, "identity.recordPolicyDecision"),
279
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
280
+ });
253
281
  });
254
282
  },
255
283
  };