@blazingagents/sdk 0.34.0 → 0.35.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.
Files changed (74) hide show
  1. package/dist/chat-transport.js +4 -1
  2. package/dist/client.d.ts +18 -2
  3. package/dist/client.js +16 -15
  4. package/dist/contracts/entities/agents.d.ts +7 -6
  5. package/dist/contracts/entities/agents.js +129 -36
  6. package/dist/contracts/entities/chat-connections.d.ts +9 -8
  7. package/dist/contracts/entities/chat-connections.js +70 -40
  8. package/dist/contracts/entities/chat.d.ts +8 -4
  9. package/dist/contracts/entities/chat.js +102 -28
  10. package/dist/contracts/entities/mcp-connections.d.ts +2 -0
  11. package/dist/contracts/entities/mcp-connections.js +36 -23
  12. package/dist/contracts/entities/memories.d.ts +1 -0
  13. package/dist/contracts/entities/memories.js +5 -3
  14. package/dist/contracts/entities/merchant.js +28 -9
  15. package/dist/contracts/entities/prompts.d.ts +2 -2
  16. package/dist/contracts/entities/prompts.js +42 -15
  17. package/dist/contracts/entities/providers.js +14 -6
  18. package/dist/contracts/entities/sessions.d.ts +10 -4
  19. package/dist/contracts/entities/sessions.js +5 -4
  20. package/dist/contracts/entities/skills.js +6 -3
  21. package/dist/contracts/entities/tasks.d.ts +4 -7
  22. package/dist/contracts/entities/tasks.js +45 -15
  23. package/dist/contracts/entities/tenants.d.ts +2 -28
  24. package/dist/contracts/entities/tenants.js +15 -22
  25. package/dist/contracts/entities/usage.d.ts +1 -1
  26. package/dist/contracts/entities/usage.js +16 -6
  27. package/dist/contracts/entities/workspaces.d.ts +1 -1
  28. package/dist/contracts/entities/workspaces.js +26 -10
  29. package/dist/contracts/index.d.ts +18 -13
  30. package/dist/contracts/index.js +12 -12
  31. package/dist/contracts/limitations.d.ts +2 -4
  32. package/dist/contracts/limitations.js +2 -4
  33. package/dist/direct-chat-transport.js +2 -1
  34. package/dist/errors.d.ts +11 -0
  35. package/dist/errors.js +21 -0
  36. package/dist/http.d.ts +3 -1
  37. package/dist/http.js +12 -1
  38. package/dist/index.d.ts +18 -1
  39. package/dist/resources/agents.d.ts +120 -1
  40. package/dist/resources/agents.js +1 -33
  41. package/dist/resources/artifacts.d.ts +42 -1
  42. package/dist/resources/artifacts.js +0 -12
  43. package/dist/resources/chat-connections.d.ts +110 -1
  44. package/dist/resources/chat-connections.js +0 -33
  45. package/dist/resources/chat-deliveries.d.ts +23 -1
  46. package/dist/resources/chat-deliveries.js +1 -4
  47. package/dist/resources/mcp-connections.d.ts +63 -1
  48. package/dist/resources/mcp-connections.js +3 -21
  49. package/dist/resources/memories.d.ts +58 -1
  50. package/dist/resources/memories.js +0 -15
  51. package/dist/resources/merchant-bindings.d.ts +39 -1
  52. package/dist/resources/merchant-bindings.js +0 -9
  53. package/dist/resources/merchant-connection.d.ts +37 -1
  54. package/dist/resources/merchant-connection.js +1 -13
  55. package/dist/resources/merchant-usage-events.d.ts +66 -1
  56. package/dist/resources/merchant-usage-events.js +0 -18
  57. package/dist/resources/prompts.d.ts +50 -1
  58. package/dist/resources/prompts.js +0 -15
  59. package/dist/resources/providers.d.ts +64 -1
  60. package/dist/resources/providers.js +0 -21
  61. package/dist/resources/sessions.d.ts +124 -1
  62. package/dist/resources/sessions.js +5 -36
  63. package/dist/resources/skills.d.ts +95 -1
  64. package/dist/resources/skills.js +0 -27
  65. package/dist/resources/tasks.d.ts +107 -1
  66. package/dist/resources/tasks.js +0 -30
  67. package/dist/resources/tenant.d.ts +23 -1
  68. package/dist/resources/tenant.js +2 -10
  69. package/dist/resources/usage.d.ts +34 -1
  70. package/dist/resources/usage.js +2 -15
  71. package/dist/resources/workspaces.d.ts +50 -1
  72. package/dist/resources/workspaces.js +0 -15
  73. package/dist/types.d.ts +11 -1082
  74. package/package.json +1 -1
@@ -1,4 +1,37 @@
1
- import type { HttpConfig, UsageResource } from "../types.ts";
1
+ import { type SessionUsageQuery, type SessionUsageResponse, type UsageOverviewQuery, type UsageOverviewResponse, type UsageQuery, type UsageResponse } from "../contracts/entities/usage.ts";
2
+ import type { HttpConfig, ResourceRequestOptions } from "../types.ts";
3
+ export interface UsageResource {
4
+ /**
5
+ * Retrieves usage totals.
6
+ * @param input - query filters; optional abortSignal.
7
+ * @returns The usage response.
8
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
9
+ */
10
+ get(input?: Partial<UsageQuery> & ResourceRequestOptions): Promise<UsageResponse>;
11
+ /**
12
+ * Retrieves usage for one Agent.
13
+ * @param input - `agentId`; query filters; optional abortSignal.
14
+ * @returns The usage response.
15
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
16
+ */
17
+ getForAgent(input: Partial<UsageQuery> & {
18
+ agentId: string;
19
+ } & ResourceRequestOptions): Promise<UsageResponse>;
20
+ /**
21
+ * Returns totals, daily usage, and bounded Agent, user, and model rankings.
22
+ * @param input - query filters; optional abortSignal.
23
+ * @returns The usage overview response.
24
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
25
+ */
26
+ overview(input?: Partial<UsageOverviewQuery> & ResourceRequestOptions): Promise<UsageOverviewResponse>;
27
+ /**
28
+ * Retrieves usage grouped by Session.
29
+ * @param input - query filters; optional abortSignal.
30
+ * @returns The session usage response.
31
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
32
+ */
33
+ sessions(input: SessionUsageQuery & ResourceRequestOptions): Promise<SessionUsageResponse>;
34
+ }
2
35
  /**
3
36
  * `client.usage` — get over `/v1/usage` (tenant-wide) and
4
37
  * `/v1/agents/:agentId/usage` (per-agent). The query shape is `UsageQuery`;
@@ -1,4 +1,4 @@
1
- import { sessionUsageQuerySchema, sessionUsageResponseSchema, usageOverviewResponseSchemaForQuery, usageResponseSchema, } from "../contracts/entities/usage.js";
1
+ import { sessionUsageResponseSchema, usageOverviewResponseSchemaForQuery, usageResponseSchema, } from "../contracts/entities/usage.js";
2
2
  import { apiPath, requestJson } from "../http.js";
3
3
  /**
4
4
  * `client.usage` — get over `/v1/usage` (tenant-wide) and
@@ -9,35 +9,22 @@ import { apiPath, requestJson } from "../http.js";
9
9
  */
10
10
  export function createUsageResource(config) {
11
11
  return {
12
- /**
13
- * Retrieves usage grouped by Session.
14
- */
15
- async sessions({ abortSignal, ...input }) {
16
- const body = sessionUsageQuerySchema.parse(input);
12
+ async sessions({ abortSignal, ...body }) {
17
13
  return await requestJson(config, "/v1/usage/sessions", {
18
14
  method: "POST",
19
15
  json: body,
20
16
  signal: abortSignal,
21
17
  }, sessionUsageResponseSchema);
22
18
  },
23
- /**
24
- * Retrieves usage.
25
- */
26
19
  async get({ abortSignal, ...query } = {}) {
27
20
  return await requestJson(config, "/v1/usage", {
28
21
  query,
29
22
  signal: abortSignal,
30
23
  }, usageResponseSchema);
31
24
  },
32
- /**
33
- * Retrieves usage for one Agent.
34
- */
35
25
  async getForAgent({ agentId, abortSignal, ...query }) {
36
26
  return await requestJson(config, apiPath `/v1/agents/${agentId}/usage`, { query, signal: abortSignal }, usageResponseSchema);
37
27
  },
38
- /**
39
- * Retrieves usage totals, daily usage, and bounded rankings.
40
- */
41
28
  async overview({ abortSignal, ...query } = {}) {
42
29
  return await requestJson(config, "/v1/usage/overview", { query, signal: abortSignal }, usageOverviewResponseSchemaForQuery(query));
43
30
  },
@@ -1,4 +1,53 @@
1
- import type { HttpConfig, WorkspacesResource } from "../types.ts";
1
+ import { type CreateWorkspaceBody, type UpdateWorkspaceBody, type Workspace, type WorkspacesListResponse } from "../contracts/entities/workspaces.ts";
2
+ import type { HttpConfig, ResourceRequestOptions } from "../types.ts";
3
+ export interface WorkspacesResource {
4
+ /**
5
+ * Creates the Workspace.
6
+ * @param input - creation fields; optional abortSignal.
7
+ * @returns The workspace.
8
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
9
+ */
10
+ create(input?: CreateWorkspaceBody & ResourceRequestOptions): Promise<Workspace>;
11
+ /**
12
+ * Deletes the Workspace.
13
+ * @param input - `workspaceId`; optional abortSignal.
14
+ * @returns "pending" while deletion is underway, otherwise "completed".
15
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
16
+ */
17
+ delete(input: {
18
+ workspaceId: string;
19
+ } & ResourceRequestOptions): Promise<"completed" | "pending">;
20
+ /**
21
+ * Retrieves the Workspace.
22
+ * @param input - `workspaceId`; optional abortSignal.
23
+ * @returns The workspace.
24
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
25
+ */
26
+ get(input: {
27
+ workspaceId: string;
28
+ } & ResourceRequestOptions): Promise<Workspace>;
29
+ /**
30
+ * Lists one page of Workspace records.
31
+ * @param input - filters and pagination options.
32
+ * @returns The workspaces list response.
33
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
34
+ */
35
+ list(input?: WorkspacesListOptions): Promise<WorkspacesListResponse>;
36
+ /**
37
+ * Updates the Workspace.
38
+ * @param input - `workspaceId`; fields to change; optional abortSignal.
39
+ * @returns The workspace.
40
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
41
+ */
42
+ update(input: UpdateWorkspaceBody & {
43
+ workspaceId: string;
44
+ } & ResourceRequestOptions): Promise<Workspace>;
45
+ }
46
+ export interface WorkspacesListOptions extends ResourceRequestOptions {
47
+ cursor?: string;
48
+ limit?: number;
49
+ userId?: string;
50
+ }
2
51
  /**
3
52
  * Builds the Workspaces operations using the shared HTTP configuration.
4
53
  * @param config - Shared authentication and transport configuration.
@@ -7,9 +7,6 @@ import { apiPath, requestJson, requestStream } from "../http.js";
7
7
  */
8
8
  export function createWorkspacesResource(config) {
9
9
  return {
10
- /**
11
- * Creates workspaces.
12
- */
13
10
  async create({ abortSignal, ...body } = {}) {
14
11
  return await requestJson(config, "/v1/workspaces", {
15
12
  json: body,
@@ -17,22 +14,13 @@ export function createWorkspacesResource(config) {
17
14
  method: "POST",
18
15
  }, workspaceSchema);
19
16
  },
20
- /**
21
- * Deletes workspaces.
22
- */
23
17
  async delete({ workspaceId, abortSignal }) {
24
18
  const response = await requestStream(config, apiPath `/v1/workspaces/${workspaceId}`, { method: "DELETE", signal: abortSignal });
25
19
  return response.status === 202 ? "pending" : "completed";
26
20
  },
27
- /**
28
- * Retrieves workspaces.
29
- */
30
21
  async get({ workspaceId, abortSignal }) {
31
22
  return await requestJson(config, apiPath `/v1/workspaces/${workspaceId}`, { signal: abortSignal }, workspaceSchema);
32
23
  },
33
- /**
34
- * Lists one page of workspaces.
35
- */
36
24
  async list({ abortSignal, ...options } = {}) {
37
25
  return await requestJson(config, "/v1/workspaces", {
38
26
  signal: abortSignal,
@@ -43,9 +31,6 @@ export function createWorkspacesResource(config) {
43
31
  },
44
32
  }, workspacesListResponseSchema);
45
33
  },
46
- /**
47
- * Updates workspaces.
48
- */
49
34
  async update({ workspaceId, abortSignal, ...body }) {
50
35
  return await requestJson(config, apiPath `/v1/workspaces/${workspaceId}`, { json: body, signal: abortSignal, method: "PUT" }, workspaceSchema);
51
36
  },