@axiom-lattice/client-sdk 4.2.0 → 4.2.1

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.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { AgentWebApp, Message, MessageChunk, DatabaseConfigEntry, MetricsServerConfigEntry, DataSource, McpServerConfigEntry, McpTool, LocalA2ATemplateDefinition, TaskItem, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, CreateMetricsServerConfigRequest, UpdateMetricsServerConfigRequest, CreateMcpServerConfigRequest, UpdateMcpServerConfigRequest, ConnectionEntry, CreateTaskRequest, UpdateTaskRequest, TaskWorkItem, LocalA2AProviderState, CreateAgentWebAppInput, UpdateAgentWebAppInput, Skill, CreateSkillRequest, CreateShareRequest, ShareResult, ShareRecord } from '@axiom-lattice/protocols';
2
- export { AgentWebApp, AgentWebAppAppearance, AgentWebAppFeatures, AgentWebAppScope, AgentWebAppStatus, CreateAgentWebAppInput, LocalA2AProviderId, LocalA2AProviderState, LocalA2AProviderStatus, LocalA2ATemplateDefinition, LocalRuntimeConfig, UpdateAgentWebAppInput } from '@axiom-lattice/protocols';
1
+ import { CapabilityBundle, CapabilityPreview, AgentWebApp, Message, MessageChunk, DatabaseConfigEntry, MetricsServerConfigEntry, DataSource, McpServerConfigEntry, McpTool, LocalA2ATemplateDefinition, TaskItem, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, CreateMetricsServerConfigRequest, UpdateMetricsServerConfigRequest, CreateMcpServerConfigRequest, UpdateMcpServerConfigRequest, ConnectionEntry, CreateTaskRequest, UpdateTaskRequest, TaskWorkItem, LocalA2AProviderState, CreateCapabilityBundleInput, UpdateCapabilityBundleInput, CreateAgentWebAppInput, UpdateAgentWebAppInput, Skill, CreateSkillRequest, CreateShareRequest, ShareResult, ShareRecord } from '@axiom-lattice/protocols';
2
+ export { AgentWebApp, AgentWebAppAppearance, AgentWebAppFeatures, AgentWebAppScope, AgentWebAppStatus, CapabilityBundle, CapabilityPreview, CreateAgentWebAppInput, CreateCapabilityBundleInput, LocalA2AProviderId, LocalA2AProviderState, LocalA2AProviderStatus, LocalA2ATemplateDefinition, LocalRuntimeConfig, UpdateAgentWebAppInput, UpdateCapabilityBundleInput } from '@axiom-lattice/protocols';
3
3
 
4
4
  /**
5
5
  * Core types for the Axiom Lattice Client SDK
@@ -10,6 +10,24 @@ interface ListAgentWebAppsParams {
10
10
  /** Return only publications for this assistant. */
11
11
  assistantId?: string;
12
12
  }
13
+ /** Project capability bundle selection and its resolved preview. */
14
+ interface ProjectCapabilitiesResponse {
15
+ project: Project;
16
+ persistedBundleIds?: string[];
17
+ bundles: CapabilityBundle[];
18
+ preview: CapabilityPreview;
19
+ }
20
+ /** Safe status for a persisted capability bundle that cannot be returned. */
21
+ interface InvalidCapabilityBundleSummary {
22
+ bundleId: string;
23
+ code: "INVALID_BUNDLE_CONFIG";
24
+ message: string;
25
+ }
26
+ /** Valid capability bundles plus safe summaries for invalid legacy records. */
27
+ interface CapabilityBundleListResponse {
28
+ bundles: CapabilityBundle[];
29
+ errors: InvalidCapabilityBundleSummary[];
30
+ }
13
31
  /** Agent Web App list data, unwrapped from the gateway response envelope. */
14
32
  interface AgentWebAppsListResponse {
15
33
  records: AgentWebApp[];
@@ -1387,6 +1405,75 @@ declare abstract class AbstractClient {
1387
1405
  */
1388
1406
  rotate: (id: string) => Promise<A2AKeyListItem>;
1389
1407
  };
1408
+ /** Capability bundle namespace for managing tenant-scoped bundles. */
1409
+ capabilityBundles: {
1410
+ /**
1411
+ * List all capability bundles visible to the current tenant.
1412
+ * @returns The tenant's capability bundles, unwrapped from the API response.
1413
+ */
1414
+ list: () => Promise<CapabilityBundle[]>;
1415
+ /**
1416
+ * List valid bundles together with safe invalid-record summaries.
1417
+ * @returns Inventory suitable for management and remediation workflows.
1418
+ */
1419
+ listInventory: () => Promise<CapabilityBundleListResponse>;
1420
+ /**
1421
+ * Get one capability bundle by identifier.
1422
+ * @param bundleId - Capability bundle identifier.
1423
+ * @returns The requested capability bundle.
1424
+ */
1425
+ get: (bundleId: string) => Promise<CapabilityBundle>;
1426
+ /**
1427
+ * Create a capability bundle for the current tenant.
1428
+ * @param input - Bundle name, optional description, and capabilities. The server generates the stable key.
1429
+ * @returns The created capability bundle.
1430
+ */
1431
+ create: (input: CreateCapabilityBundleInput) => Promise<CapabilityBundle>;
1432
+ /**
1433
+ * Update a capability bundle for the current tenant.
1434
+ * @param bundleId - Capability bundle identifier.
1435
+ * @param input - The partial bundle fields and required expected revision to update.
1436
+ * @returns The updated capability bundle.
1437
+ */
1438
+ update: (bundleId: string, input: UpdateCapabilityBundleInput) => Promise<CapabilityBundle>;
1439
+ /**
1440
+ * Delete a capability bundle when the backend permits deletion.
1441
+ * @param bundleId - Capability bundle identifier.
1442
+ * @returns A promise that resolves after the bundle is deleted.
1443
+ * @throws ApiError when the bundle is missing, in use, or the request fails.
1444
+ */
1445
+ delete: (bundleId: string) => Promise<void>;
1446
+ };
1447
+ projects: {
1448
+ capabilities: {
1449
+ /**
1450
+ * Get a project's selected bundles and its persisted capability preview.
1451
+ * @param projectId - Project identifier.
1452
+ * @returns The project, selected bundles, and preview resolved from persisted selections.
1453
+ */
1454
+ get: (projectId: string) => Promise<ProjectCapabilitiesResponse>;
1455
+ /**
1456
+ * Replace a project's selected capability bundles.
1457
+ * @param projectId - Project identifier.
1458
+ * @param bundleIds - Ordered capability bundle identifiers to persist.
1459
+ * @returns The updated project, selected bundles, and persisted-selection preview.
1460
+ */
1461
+ update: (projectId: string, bundleIds: string[], expectedRevisions: Record<string, string>) => Promise<ProjectCapabilitiesResponse>;
1462
+ /**
1463
+ * Preview the capability bundles currently persisted on a project.
1464
+ * @param projectId - Project identifier.
1465
+ * @returns The preview resolved from the project's persisted bundle selections.
1466
+ */
1467
+ preview: (projectId: string) => Promise<CapabilityPreview>;
1468
+ /**
1469
+ * Preview a draft bundle selection without changing the project.
1470
+ * @param projectId - Project identifier.
1471
+ * @param bundleIds - Ordered capability bundle identifiers to preview.
1472
+ * @returns The draft preview resolved from the supplied bundle IDs; no project state is changed.
1473
+ */
1474
+ previewWithBundles: (projectId: string, bundleIds: string[]) => Promise<CapabilityPreview>;
1475
+ };
1476
+ };
1390
1477
  /** Agent Web Apps namespace for managing React SDK publications. */
1391
1478
  webApps: {
1392
1479
  /**
@@ -1894,6 +1981,17 @@ declare class WeChatClient extends AbstractClient {
1894
1981
  * @param tenantId - Tenant identifier
1895
1982
  */
1896
1983
  setTenantId(tenantId: string): void;
1984
+ /**
1985
+ * Set workspace and project headers for requests made by this client.
1986
+ * @param workspaceId - Workspace identifier, or undefined to leave it unchanged
1987
+ * @param projectId - Project identifier, or undefined to leave it unchanged
1988
+ */
1989
+ setWorkspaceContext(workspaceId?: string, projectId?: string): void;
1990
+ /**
1991
+ * Get the workspace and project headers currently applied to this client.
1992
+ * @returns A copy of the current workspace and project header values
1993
+ */
1994
+ getWorkspaceHeaders(): Record<string, string>;
1897
1995
  /**
1898
1996
  * Creates a new instance of the client with the given configuration
1899
1997
  * @param config - Configuration options for the client
@@ -2039,4 +2137,4 @@ declare function createSimpleMessageMerger(): {
2039
2137
  reset: () => void;
2040
2138
  };
2041
2139
 
2042
- export { A2AKeyListItem, A2AKeysListResponse, AbortAgentParams, AbstractClient, AgentState, AgentWebAppsListResponse, ApiError, ArchiveInput, Assistant, AssistantListResponse, AssistantResponse, AuthenticationError, ChatResponse, ChatSendOptions, ChatStreamOptions, Client, ClientConfig, CompleteTaskInput, CompleteTaskResponse, CreateA2AKeyInput, CreateAssistantOptions, CreateProjectRequest, CreateThreadOptions, CreateWorkspaceRequest, DatabaseConfigResponse, DatabaseConfigsListResponse, DatasourcesListResponse, ExportBundle, ExportConfigResult, ExportConfirmationRequired, ExportDownload, ExportEntityIds, ExportEntityPreview, ExportEntityPreviewMap, ExportImportClient, ExportJobResult, ExportableEntity, ExportableTypeInfo, FileItem, GetMessagesOptions, GetScheduledTasksOptions, ImportApplyResult, ImportConflict, ImportEntityResult, ImportInsertion, ImportPreviewError, ImportPreviewResult, ImportResolution, ImportResolutions, ImportSource, ListAgentWebAppsParams, ListThreadsOptions, LocalA2ATemplatesListResponse, McpServerResponse, McpServersListResponse, MetricsConfigResponse, MetricsConfigsListResponse, NetworkError, PendingMessage, Project, ProjectKind, RegisterToolOptions, RemovePendingMessageOptions, ResourcesClient, ResumeStreamOptions, RetryConfig, RunOptions, ScheduleExecutionType, ScheduledTask, ScheduledTaskStatus, ScheduledTasksListResponse, StorageType, StreamCallbacks, StreamEvent, TaskLifecycleWarning, TaskResponse, TasksListResponse, TestConnectionResponse, TestMcpServerResponse, Thread, ThreadListResponse, ThreadResponse, Tool, ToolResponse, ToolsListResponse, Transport, UpdateAssistantOptions, UpdateProjectRequest, UpdateThreadOptions, UpdateWorkspaceRequest, WeChatClient, Workspace, WorkspaceClient, createSimpleMessageMerger };
2140
+ export { A2AKeyListItem, A2AKeysListResponse, AbortAgentParams, AbstractClient, AgentState, AgentWebAppsListResponse, ApiError, ArchiveInput, Assistant, AssistantListResponse, AssistantResponse, AuthenticationError, CapabilityBundleListResponse, ChatResponse, ChatSendOptions, ChatStreamOptions, Client, ClientConfig, CompleteTaskInput, CompleteTaskResponse, CreateA2AKeyInput, CreateAssistantOptions, CreateProjectRequest, CreateThreadOptions, CreateWorkspaceRequest, DatabaseConfigResponse, DatabaseConfigsListResponse, DatasourcesListResponse, ExportBundle, ExportConfigResult, ExportConfirmationRequired, ExportDownload, ExportEntityIds, ExportEntityPreview, ExportEntityPreviewMap, ExportImportClient, ExportJobResult, ExportableEntity, ExportableTypeInfo, FileItem, GetMessagesOptions, GetScheduledTasksOptions, ImportApplyResult, ImportConflict, ImportEntityResult, ImportInsertion, ImportPreviewError, ImportPreviewResult, ImportResolution, ImportResolutions, ImportSource, InvalidCapabilityBundleSummary, ListAgentWebAppsParams, ListThreadsOptions, LocalA2ATemplatesListResponse, McpServerResponse, McpServersListResponse, MetricsConfigResponse, MetricsConfigsListResponse, NetworkError, PendingMessage, Project, ProjectCapabilitiesResponse, ProjectKind, RegisterToolOptions, RemovePendingMessageOptions, ResourcesClient, ResumeStreamOptions, RetryConfig, RunOptions, ScheduleExecutionType, ScheduledTask, ScheduledTaskStatus, ScheduledTasksListResponse, StorageType, StreamCallbacks, StreamEvent, TaskLifecycleWarning, TaskResponse, TasksListResponse, TestConnectionResponse, TestMcpServerResponse, Thread, ThreadListResponse, ThreadResponse, Tool, ToolResponse, ToolsListResponse, Transport, UpdateAssistantOptions, UpdateProjectRequest, UpdateThreadOptions, UpdateWorkspaceRequest, WeChatClient, Workspace, WorkspaceClient, createSimpleMessageMerger };
package/dist/index.js CHANGED
@@ -2224,6 +2224,127 @@ var AbstractClient = class {
2224
2224
  return response.data;
2225
2225
  }
2226
2226
  };
2227
+ /** Capability bundle namespace for managing tenant-scoped bundles. */
2228
+ this.capabilityBundles = {
2229
+ /**
2230
+ * List all capability bundles visible to the current tenant.
2231
+ * @returns The tenant's capability bundles, unwrapped from the API response.
2232
+ */
2233
+ list: async () => {
2234
+ const response = await this.makeRequest(
2235
+ "/api/capability-bundles"
2236
+ );
2237
+ return response.data;
2238
+ },
2239
+ /**
2240
+ * List valid bundles together with safe invalid-record summaries.
2241
+ * @returns Inventory suitable for management and remediation workflows.
2242
+ */
2243
+ listInventory: async () => {
2244
+ const response = await this.makeRequest("/api/capability-bundles");
2245
+ return { bundles: response.data, errors: response.errors ?? [] };
2246
+ },
2247
+ /**
2248
+ * Get one capability bundle by identifier.
2249
+ * @param bundleId - Capability bundle identifier.
2250
+ * @returns The requested capability bundle.
2251
+ */
2252
+ get: async (bundleId) => {
2253
+ const response = await this.makeRequest(
2254
+ `/api/capability-bundles/${encodeURIComponent(bundleId)}`
2255
+ );
2256
+ return response.data;
2257
+ },
2258
+ /**
2259
+ * Create a capability bundle for the current tenant.
2260
+ * @param input - Bundle name, optional description, and capabilities. The server generates the stable key.
2261
+ * @returns The created capability bundle.
2262
+ */
2263
+ create: async (input) => {
2264
+ const response = await this.makeRequest(
2265
+ "/api/capability-bundles",
2266
+ { method: "POST", body: input }
2267
+ );
2268
+ return response.data;
2269
+ },
2270
+ /**
2271
+ * Update a capability bundle for the current tenant.
2272
+ * @param bundleId - Capability bundle identifier.
2273
+ * @param input - The partial bundle fields and required expected revision to update.
2274
+ * @returns The updated capability bundle.
2275
+ */
2276
+ update: async (bundleId, input) => {
2277
+ const response = await this.makeRequest(
2278
+ `/api/capability-bundles/${encodeURIComponent(bundleId)}`,
2279
+ { method: "PUT", body: input }
2280
+ );
2281
+ return response.data;
2282
+ },
2283
+ /**
2284
+ * Delete a capability bundle when the backend permits deletion.
2285
+ * @param bundleId - Capability bundle identifier.
2286
+ * @returns A promise that resolves after the bundle is deleted.
2287
+ * @throws ApiError when the bundle is missing, in use, or the request fails.
2288
+ */
2289
+ delete: async (bundleId) => {
2290
+ await this.makeRequest(
2291
+ `/api/capability-bundles/${encodeURIComponent(bundleId)}`,
2292
+ { method: "DELETE" }
2293
+ );
2294
+ }
2295
+ };
2296
+ this.projects = {
2297
+ capabilities: {
2298
+ /**
2299
+ * Get a project's selected bundles and its persisted capability preview.
2300
+ * @param projectId - Project identifier.
2301
+ * @returns The project, selected bundles, and preview resolved from persisted selections.
2302
+ */
2303
+ get: async (projectId) => {
2304
+ const response = await this.makeRequest(
2305
+ `/api/projects/${encodeURIComponent(projectId)}/capability-bundles`
2306
+ );
2307
+ return response.data;
2308
+ },
2309
+ /**
2310
+ * Replace a project's selected capability bundles.
2311
+ * @param projectId - Project identifier.
2312
+ * @param bundleIds - Ordered capability bundle identifiers to persist.
2313
+ * @returns The updated project, selected bundles, and persisted-selection preview.
2314
+ */
2315
+ update: async (projectId, bundleIds, expectedRevisions) => {
2316
+ const response = await this.makeRequest(
2317
+ `/api/projects/${encodeURIComponent(projectId)}/capability-bundles`,
2318
+ { method: "PUT", body: { bundleIds, expectedRevisions } }
2319
+ );
2320
+ return response.data;
2321
+ },
2322
+ /**
2323
+ * Preview the capability bundles currently persisted on a project.
2324
+ * @param projectId - Project identifier.
2325
+ * @returns The preview resolved from the project's persisted bundle selections.
2326
+ */
2327
+ preview: async (projectId) => {
2328
+ const response = await this.makeRequest(
2329
+ `/api/projects/${encodeURIComponent(projectId)}/capability-preview`
2330
+ );
2331
+ return response.data;
2332
+ },
2333
+ /**
2334
+ * Preview a draft bundle selection without changing the project.
2335
+ * @param projectId - Project identifier.
2336
+ * @param bundleIds - Ordered capability bundle identifiers to preview.
2337
+ * @returns The draft preview resolved from the supplied bundle IDs; no project state is changed.
2338
+ */
2339
+ previewWithBundles: async (projectId, bundleIds) => {
2340
+ const response = await this.makeRequest(
2341
+ `/api/projects/${encodeURIComponent(projectId)}/capability-preview`,
2342
+ { method: "POST", body: { bundleIds } }
2343
+ );
2344
+ return response.data;
2345
+ }
2346
+ }
2347
+ };
2227
2348
  /** Agent Web Apps namespace for managing React SDK publications. */
2228
2349
  this.webApps = {
2229
2350
  /**
@@ -3820,6 +3941,32 @@ var WeChatClient = class extends AbstractClient {
3820
3941
  setTenantId(tenantId) {
3821
3942
  this.tenantId = tenantId;
3822
3943
  }
3944
+ /**
3945
+ * Set workspace and project headers for requests made by this client.
3946
+ * @param workspaceId - Workspace identifier, or undefined to leave it unchanged
3947
+ * @param projectId - Project identifier, or undefined to leave it unchanged
3948
+ */
3949
+ setWorkspaceContext(workspaceId, projectId) {
3950
+ if (workspaceId !== void 0) {
3951
+ if (workspaceId)
3952
+ this.workspaceHeaders["x-workspace-id"] = workspaceId;
3953
+ else
3954
+ delete this.workspaceHeaders["x-workspace-id"];
3955
+ }
3956
+ if (projectId !== void 0) {
3957
+ if (projectId)
3958
+ this.workspaceHeaders["x-project-id"] = projectId;
3959
+ else
3960
+ delete this.workspaceHeaders["x-project-id"];
3961
+ }
3962
+ }
3963
+ /**
3964
+ * Get the workspace and project headers currently applied to this client.
3965
+ * @returns A copy of the current workspace and project header values
3966
+ */
3967
+ getWorkspaceHeaders() {
3968
+ return { ...this.workspaceHeaders };
3969
+ }
3823
3970
  /**
3824
3971
  * Creates a new instance of the client with the given configuration
3825
3972
  * @param config - Configuration options for the client
@@ -3850,7 +3997,8 @@ var WeChatClient = class extends AbstractClient {
3850
3997
  return this.wechatRequest({
3851
3998
  url: fullUrl,
3852
3999
  method,
3853
- data: options?.body
4000
+ data: options?.body,
4001
+ headers: this.getWorkspaceHeaders()
3854
4002
  });
3855
4003
  }
3856
4004
  /**
@@ -3930,11 +4078,12 @@ var WeChatClient = class extends AbstractClient {
3930
4078
  * @private
3931
4079
  */
3932
4080
  async wechatRequest(options) {
3933
- const { url, method, data } = options;
4081
+ const { url, method, data, headers: requestHeaders } = options;
3934
4082
  const headers = {
3935
4083
  "Content-Type": "application/json",
3936
4084
  Authorization: `Bearer ${this.config.apiKey}`,
3937
- ...this.config.headers
4085
+ ...this.config.headers,
4086
+ ...requestHeaders
3938
4087
  };
3939
4088
  if (this.tenantId) {
3940
4089
  headers["x-tenant-id"] = this.tenantId;