@axiom-lattice/client-sdk 4.0.0 → 4.1.0
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/README.md +37 -0
- package/dist/__tests__/web-apps.test.d.ts +8 -0
- package/dist/__tests__/web-apps.test.d.ts.map +1 -0
- package/dist/__tests__/web-apps.test.js +166 -0
- package/dist/__tests__/web-apps.test.js.map +1 -0
- package/dist/abstract-client.d.ts +48 -1
- package/dist/abstract-client.d.ts.map +1 -1
- package/dist/abstract-client.js +96 -0
- package/dist/abstract-client.js.map +1 -1
- package/dist/index.d.ts +61 -3
- package/dist/index.js +101 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +101 -0
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +13 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
import { Message, MessageChunk, DatabaseConfigEntry, MetricsServerConfigEntry, DataSource, McpServerConfigEntry, McpTool, LocalA2ATemplateDefinition, TaskItem, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, CreateMetricsServerConfigRequest, UpdateMetricsServerConfigRequest, CreateMcpServerConfigRequest, UpdateMcpServerConfigRequest, ConnectionEntry, CreateTaskRequest, UpdateTaskRequest, TaskWorkItem, LocalA2AProviderState, Skill, CreateSkillRequest, CreateShareRequest, ShareResult, ShareRecord } from '@axiom-lattice/protocols';
|
|
2
|
-
export { LocalA2AProviderId, LocalA2AProviderState, LocalA2AProviderStatus, LocalA2ATemplateDefinition, LocalRuntimeConfig } from '@axiom-lattice/protocols';
|
|
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';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Core types for the Axiom Lattice Client SDK
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
/** Optional filters for listing Agent Web Apps. */
|
|
9
|
+
interface ListAgentWebAppsParams {
|
|
10
|
+
/** Return only publications for this assistant. */
|
|
11
|
+
assistantId?: string;
|
|
12
|
+
}
|
|
13
|
+
/** Agent Web App list data, unwrapped from the gateway response envelope. */
|
|
14
|
+
interface AgentWebAppsListResponse {
|
|
15
|
+
records: AgentWebApp[];
|
|
16
|
+
total: number;
|
|
17
|
+
}
|
|
8
18
|
/**
|
|
9
19
|
* Tool interface for API responses
|
|
10
20
|
* Represents a tool configuration stored in the database
|
|
@@ -774,6 +784,7 @@ interface FileItem {
|
|
|
774
784
|
is_dir?: boolean;
|
|
775
785
|
size?: number;
|
|
776
786
|
modified_at?: string;
|
|
787
|
+
created_at?: string;
|
|
777
788
|
}
|
|
778
789
|
interface ToolsListResponse {
|
|
779
790
|
success: boolean;
|
|
@@ -978,6 +989,7 @@ declare abstract class AbstractClient {
|
|
|
978
989
|
tenantId: string;
|
|
979
990
|
protected registeredTools: Map<string, RegisterToolOptions>;
|
|
980
991
|
private onUnauthorizedHandler?;
|
|
992
|
+
private hydrateAgentWebApp;
|
|
981
993
|
/**
|
|
982
994
|
* Server tools namespace for managing tools via API
|
|
983
995
|
*/
|
|
@@ -1375,6 +1387,52 @@ declare abstract class AbstractClient {
|
|
|
1375
1387
|
*/
|
|
1376
1388
|
rotate: (id: string) => Promise<A2AKeyListItem>;
|
|
1377
1389
|
};
|
|
1390
|
+
/** Agent Web Apps namespace for managing React SDK publications. */
|
|
1391
|
+
webApps: {
|
|
1392
|
+
/**
|
|
1393
|
+
* Lists Agent Web Apps, optionally filtered by assistant.
|
|
1394
|
+
* @param params - Optional assistant filter
|
|
1395
|
+
* @returns A promise that resolves to the publication records and total
|
|
1396
|
+
*/
|
|
1397
|
+
list: (params?: ListAgentWebAppsParams) => Promise<AgentWebAppsListResponse>;
|
|
1398
|
+
/**
|
|
1399
|
+
* Retrieves an Agent Web App by ID.
|
|
1400
|
+
* @param id - Agent Web App identifier
|
|
1401
|
+
* @returns A promise that resolves to the publication
|
|
1402
|
+
*/
|
|
1403
|
+
get: (id: string) => Promise<AgentWebApp>;
|
|
1404
|
+
/**
|
|
1405
|
+
* Creates an Agent Web App.
|
|
1406
|
+
* @param input - Publication configuration
|
|
1407
|
+
* @returns A promise that resolves to the created publication
|
|
1408
|
+
*/
|
|
1409
|
+
create: (input: CreateAgentWebAppInput) => Promise<AgentWebApp>;
|
|
1410
|
+
/**
|
|
1411
|
+
* Updates editable fields on an Agent Web App.
|
|
1412
|
+
* @param id - Agent Web App identifier
|
|
1413
|
+
* @param input - Fields to update
|
|
1414
|
+
* @returns A promise that resolves to the updated publication
|
|
1415
|
+
*/
|
|
1416
|
+
update: (id: string, input: UpdateAgentWebAppInput) => Promise<AgentWebApp>;
|
|
1417
|
+
/**
|
|
1418
|
+
* Enables an Agent Web App.
|
|
1419
|
+
* @param id - Agent Web App identifier
|
|
1420
|
+
* @returns A promise that resolves to the enabled publication
|
|
1421
|
+
*/
|
|
1422
|
+
enable: (id: string) => Promise<AgentWebApp>;
|
|
1423
|
+
/**
|
|
1424
|
+
* Disables an Agent Web App.
|
|
1425
|
+
* @param id - Agent Web App identifier
|
|
1426
|
+
* @returns A promise that resolves to the disabled publication
|
|
1427
|
+
*/
|
|
1428
|
+
disable: (id: string) => Promise<AgentWebApp>;
|
|
1429
|
+
/**
|
|
1430
|
+
* Permanently deletes an Agent Web App.
|
|
1431
|
+
* @param id - Agent Web App identifier
|
|
1432
|
+
* @returns A promise that resolves when the publication is deleted
|
|
1433
|
+
*/
|
|
1434
|
+
delete: (id: string) => Promise<void>;
|
|
1435
|
+
};
|
|
1378
1436
|
/**
|
|
1379
1437
|
* Skills namespace for managing skills
|
|
1380
1438
|
*/
|
|
@@ -1967,4 +2025,4 @@ declare function createSimpleMessageMerger(): {
|
|
|
1967
2025
|
reset: () => void;
|
|
1968
2026
|
};
|
|
1969
2027
|
|
|
1970
|
-
export { A2AKeyListItem, A2AKeysListResponse, AbortAgentParams, AbstractClient, AgentState, 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, 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 };
|
|
2028
|
+
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 };
|
package/dist/index.js
CHANGED
|
@@ -2224,6 +2224,86 @@ var AbstractClient = class {
|
|
|
2224
2224
|
return response.data;
|
|
2225
2225
|
}
|
|
2226
2226
|
};
|
|
2227
|
+
/** Agent Web Apps namespace for managing React SDK publications. */
|
|
2228
|
+
this.webApps = {
|
|
2229
|
+
/**
|
|
2230
|
+
* Lists Agent Web Apps, optionally filtered by assistant.
|
|
2231
|
+
* @param params - Optional assistant filter
|
|
2232
|
+
* @returns A promise that resolves to the publication records and total
|
|
2233
|
+
*/
|
|
2234
|
+
list: async (params) => {
|
|
2235
|
+
const searchParams = new URLSearchParams();
|
|
2236
|
+
if (params?.assistantId) {
|
|
2237
|
+
searchParams.set("assistantId", params.assistantId);
|
|
2238
|
+
}
|
|
2239
|
+
const query = searchParams.toString();
|
|
2240
|
+
const response = await this.makeRequest(`/api/web-apps${query ? `?${query}` : ""}`);
|
|
2241
|
+
return {
|
|
2242
|
+
records: response.data.records.map((record) => this.hydrateAgentWebApp(record)),
|
|
2243
|
+
total: response.data.total
|
|
2244
|
+
};
|
|
2245
|
+
},
|
|
2246
|
+
/**
|
|
2247
|
+
* Retrieves an Agent Web App by ID.
|
|
2248
|
+
* @param id - Agent Web App identifier
|
|
2249
|
+
* @returns A promise that resolves to the publication
|
|
2250
|
+
*/
|
|
2251
|
+
get: async (id) => {
|
|
2252
|
+
const response = await this.makeRequest(`/api/web-apps/${encodeURIComponent(id)}`);
|
|
2253
|
+
return this.hydrateAgentWebApp(response.data);
|
|
2254
|
+
},
|
|
2255
|
+
/**
|
|
2256
|
+
* Creates an Agent Web App.
|
|
2257
|
+
* @param input - Publication configuration
|
|
2258
|
+
* @returns A promise that resolves to the created publication
|
|
2259
|
+
*/
|
|
2260
|
+
create: async (input) => {
|
|
2261
|
+
const response = await this.makeRequest("/api/web-apps", { method: "POST", body: input });
|
|
2262
|
+
return this.hydrateAgentWebApp(response.data);
|
|
2263
|
+
},
|
|
2264
|
+
/**
|
|
2265
|
+
* Updates editable fields on an Agent Web App.
|
|
2266
|
+
* @param id - Agent Web App identifier
|
|
2267
|
+
* @param input - Fields to update
|
|
2268
|
+
* @returns A promise that resolves to the updated publication
|
|
2269
|
+
*/
|
|
2270
|
+
update: async (id, input) => {
|
|
2271
|
+
const response = await this.makeRequest(`/api/web-apps/${encodeURIComponent(id)}`, {
|
|
2272
|
+
method: "PATCH",
|
|
2273
|
+
body: input
|
|
2274
|
+
});
|
|
2275
|
+
return this.hydrateAgentWebApp(response.data);
|
|
2276
|
+
},
|
|
2277
|
+
/**
|
|
2278
|
+
* Enables an Agent Web App.
|
|
2279
|
+
* @param id - Agent Web App identifier
|
|
2280
|
+
* @returns A promise that resolves to the enabled publication
|
|
2281
|
+
*/
|
|
2282
|
+
enable: async (id) => {
|
|
2283
|
+
const response = await this.makeRequest(`/api/web-apps/${encodeURIComponent(id)}/enable`, { method: "POST" });
|
|
2284
|
+
return this.hydrateAgentWebApp(response.data);
|
|
2285
|
+
},
|
|
2286
|
+
/**
|
|
2287
|
+
* Disables an Agent Web App.
|
|
2288
|
+
* @param id - Agent Web App identifier
|
|
2289
|
+
* @returns A promise that resolves to the disabled publication
|
|
2290
|
+
*/
|
|
2291
|
+
disable: async (id) => {
|
|
2292
|
+
const response = await this.makeRequest(`/api/web-apps/${encodeURIComponent(id)}/disable`, { method: "POST" });
|
|
2293
|
+
return this.hydrateAgentWebApp(response.data);
|
|
2294
|
+
},
|
|
2295
|
+
/**
|
|
2296
|
+
* Permanently deletes an Agent Web App.
|
|
2297
|
+
* @param id - Agent Web App identifier
|
|
2298
|
+
* @returns A promise that resolves when the publication is deleted
|
|
2299
|
+
*/
|
|
2300
|
+
delete: async (id) => {
|
|
2301
|
+
await this.makeRequest(
|
|
2302
|
+
`/api/web-apps/${encodeURIComponent(id)}`,
|
|
2303
|
+
{ method: "DELETE" }
|
|
2304
|
+
);
|
|
2305
|
+
}
|
|
2306
|
+
};
|
|
2227
2307
|
/**
|
|
2228
2308
|
* Skills namespace for managing skills
|
|
2229
2309
|
*/
|
|
@@ -2796,6 +2876,27 @@ var AbstractClient = class {
|
|
|
2796
2876
|
}
|
|
2797
2877
|
};
|
|
2798
2878
|
}
|
|
2879
|
+
hydrateAgentWebApp(value) {
|
|
2880
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
2881
|
+
throw new ApiError("Invalid Agent Web App response", 500, value);
|
|
2882
|
+
}
|
|
2883
|
+
const record = value;
|
|
2884
|
+
const hydrateDate = (field) => {
|
|
2885
|
+
const raw = record[field];
|
|
2886
|
+
const date = raw instanceof Date ? new Date(raw.getTime()) : new Date(
|
|
2887
|
+
typeof raw === "string" || typeof raw === "number" ? raw : Number.NaN
|
|
2888
|
+
);
|
|
2889
|
+
if (Number.isNaN(date.getTime())) {
|
|
2890
|
+
throw new ApiError(`Invalid Agent Web App ${field}`, 500, value);
|
|
2891
|
+
}
|
|
2892
|
+
return date;
|
|
2893
|
+
};
|
|
2894
|
+
return {
|
|
2895
|
+
...record,
|
|
2896
|
+
createdAt: hydrateDate("createdAt"),
|
|
2897
|
+
updatedAt: hydrateDate("updatedAt")
|
|
2898
|
+
};
|
|
2899
|
+
}
|
|
2799
2900
|
/**
|
|
2800
2901
|
* Set handler for 401 unauthorized errors
|
|
2801
2902
|
* @param handler - Callback function to handle unauthorized errors
|