@blazingagents/sdk 0.34.0 → 0.36.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 +74 -2
  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 +31 -44
  45. package/dist/resources/chat-deliveries.d.ts +23 -1
  46. package/dist/resources/chat-deliveries.js +2 -4
  47. package/dist/resources/mcp-connections.d.ts +63 -1
  48. package/dist/resources/mcp-connections.js +10 -24
  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 +15 -16
  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 +7 -25
  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 +17 -1083
  74. package/package.json +1 -2
@@ -1,4 +1,67 @@
1
- import type { HttpConfig, ProvidersResource } from "../types.ts";
1
+ import { type CreateProviderBody, type DeleteProviderOptions, type ProviderModelsResponse, type ProviderResponse, type ProvidersResponse, type ThinkingLevelsResponse, type UpdateProviderBody } from "../contracts/entities/providers.ts";
2
+ import type { HttpConfig, ResourceRequestOptions } from "../types.ts";
3
+ export interface ProvidersResource {
4
+ /**
5
+ * Creates the Provider.
6
+ * @param input - creation fields; optional abortSignal.
7
+ * @returns The provider response.
8
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
9
+ */
10
+ create(input: CreateProviderBody & ResourceRequestOptions): Promise<ProviderResponse>;
11
+ /**
12
+ * Deletes the Provider.
13
+ * @param input - `providerId`; optional abortSignal.
14
+ * @returns Resolves when the operation completes.
15
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
16
+ */
17
+ delete(input: DeleteProviderOptions & {
18
+ providerId: string;
19
+ } & ResourceRequestOptions): Promise<void>;
20
+ /**
21
+ * Retrieves the Provider.
22
+ * @param input - `providerId`; optional abortSignal.
23
+ * @returns The provider response.
24
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
25
+ */
26
+ get(input: {
27
+ providerId: string;
28
+ } & ResourceRequestOptions): Promise<ProviderResponse>;
29
+ /**
30
+ * Retrieves supported thinking levels for a Provider model.
31
+ * @param input - `providerId`, provider-specific `model` name, and optional abortSignal.
32
+ * @returns The thinking levels response.
33
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
34
+ */
35
+ getThinkingLevels(input: {
36
+ providerId: string;
37
+ model: string;
38
+ } & ResourceRequestOptions): Promise<ThinkingLevelsResponse>;
39
+ /**
40
+ * Lists available Provider records.
41
+ * @param input - optional abortSignal.
42
+ * @returns The providers response.
43
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
44
+ */
45
+ list(input?: ResourceRequestOptions): Promise<ProvidersResponse>;
46
+ /**
47
+ * Lists models exposed by the Provider.
48
+ * @param input - `providerId`; optional abortSignal.
49
+ * @returns The provider models response.
50
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
51
+ */
52
+ listModels(input: {
53
+ providerId: string;
54
+ } & ResourceRequestOptions): Promise<ProviderModelsResponse>;
55
+ /**
56
+ * Updates the Provider.
57
+ * @param input - `providerId`; fields to change; optional abortSignal.
58
+ * @returns The provider response.
59
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
60
+ */
61
+ update(input: UpdateProviderBody & {
62
+ providerId: string;
63
+ } & ResourceRequestOptions): Promise<ProviderResponse>;
64
+ }
2
65
  /**
3
66
  * `client.providers` — CRUD and cost-free model discovery.
4
67
  * @param config - Shared authentication and transport configuration.
@@ -7,56 +7,38 @@ import { apiPath, requestJson } from "../http.js";
7
7
  */
8
8
  export function createProvidersResource(config) {
9
9
  return {
10
- /**
11
- * Creates providers.
12
- */
13
10
  async create({ abortSignal, ...body }) {
14
11
  return await requestJson(config, "/v1/providers", {
15
12
  json: body,
13
+ credentialBearing: true,
16
14
  signal: abortSignal,
17
15
  method: "POST",
18
16
  }, providerResponseSchema);
19
17
  },
20
- /**
21
- * Lists one page of providers.
22
- */
23
18
  async list({ abortSignal } = {}) {
24
- return await requestJson(config, "/v1/providers", { signal: abortSignal }, providersResponseSchema);
19
+ return await requestJson(config, "/v1/providers", { credentialBearing: true, signal: abortSignal }, providersResponseSchema);
25
20
  },
26
- /**
27
- * Retrieves providers.
28
- */
29
21
  async get({ providerId, abortSignal }) {
30
- return await requestJson(config, apiPath `/v1/providers/${providerId}`, { signal: abortSignal }, providerResponseSchema);
22
+ return await requestJson(config, apiPath `/v1/providers/${providerId}`, { credentialBearing: true, signal: abortSignal }, providerResponseSchema);
31
23
  },
32
- /**
33
- * Lists models exposed by the Provider.
34
- */
35
24
  async listModels({ providerId, abortSignal }) {
36
- return await requestJson(config, apiPath `/v1/providers/${providerId}/models`, { signal: abortSignal }, providerModelsResponseSchema);
25
+ return await requestJson(config, apiPath `/v1/providers/${providerId}/models`, { credentialBearing: true, signal: abortSignal }, providerModelsResponseSchema);
37
26
  },
38
- /**
39
- * Retrieves supported thinking levels for a Provider model.
40
- */
41
27
  async getThinkingLevels({ providerId, model, abortSignal }) {
42
- return await requestJson(config, apiPath `/v1/providers/${providerId}/thinking-levels`, { signal: abortSignal, query: { model } }, thinkingLevelsResponseSchema);
28
+ return await requestJson(config, apiPath `/v1/providers/${providerId}/thinking-levels`, { credentialBearing: true, signal: abortSignal, query: { model } }, thinkingLevelsResponseSchema);
43
29
  },
44
- /**
45
- * Updates providers.
46
- */
47
30
  async update({ providerId, abortSignal, ...body }) {
48
31
  return await requestJson(config, apiPath `/v1/providers/${providerId}`, {
49
32
  json: body,
33
+ credentialBearing: true,
50
34
  signal: abortSignal,
51
35
  method: "PATCH",
52
36
  }, providerResponseSchema);
53
37
  },
54
- /**
55
- * Deletes providers.
56
- */
57
38
  async delete({ providerId, abortSignal, ...options }) {
58
39
  await requestJson(config, apiPath `/v1/providers/${providerId}`, {
59
40
  method: "DELETE",
41
+ credentialBearing: true,
60
42
  signal: abortSignal,
61
43
  query: {
62
44
  confirmSnapshotInvalidation: options.confirmSnapshotInvalidation,
@@ -1,4 +1,127 @@
1
- import type { HttpConfig, SessionsResource } from "../types.ts";
1
+ import type { UIMessage } from "ai";
2
+ import { type SessionInputResponse, type SessionInputsQuery, type SessionInputsResponse, type StopSessionBody, type StopSessionResponse, type SubmitSessionInputBody } from "../contracts/entities/session-inputs.ts";
3
+ import { type LatestSessionsListResponse, type SessionMessagesResponse, type SessionResponse, type SessionsListResponse, type ToolApprovalsResponse } from "../contracts/entities/sessions.ts";
4
+ import type { HttpConfig, ResourceRequestOptions } from "../types.ts";
5
+ export interface SessionsListOptions extends ResourceRequestOptions {
6
+ cursor?: string;
7
+ limit?: number;
8
+ userId?: string;
9
+ }
10
+ export interface LatestSessionsListOptions extends ResourceRequestOptions {
11
+ byAgent?: boolean;
12
+ cursor?: string;
13
+ limit?: number;
14
+ userId?: string;
15
+ }
16
+ export interface SessionMessagesOptions extends ResourceRequestOptions {
17
+ after?: string;
18
+ cursor?: string;
19
+ limit?: number;
20
+ }
21
+ export interface SessionsResource {
22
+ /**
23
+ * Deletes the Session.
24
+ * @param input - `agentId`, `sessionId`; optional abortSignal; deleteArtifacts controls Artifact deletion.
25
+ * @returns Resolves when the operation completes.
26
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
27
+ */
28
+ delete(input: {
29
+ agentId: string;
30
+ sessionId: string;
31
+ deleteArtifacts: boolean;
32
+ } & ResourceRequestOptions): Promise<void>;
33
+ /**
34
+ * Retry an uncertain acknowledgement with the same explicit idempotencyKey.
35
+ * @param input - `agentId`, `sessionId`, `messageId`; optional abortSignal.
36
+ * @returns The session response.
37
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
38
+ */
39
+ fork(input: {
40
+ agentId: string;
41
+ sessionId: string;
42
+ messageId: string;
43
+ idempotencyKey: string;
44
+ } & ResourceRequestOptions): Promise<SessionResponse>;
45
+ /**
46
+ * Retrieves the Session.
47
+ * @param input - `agentId`, `sessionId`; optional abortSignal.
48
+ * @returns The session response.
49
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
50
+ */
51
+ get(input: {
52
+ agentId: string;
53
+ sessionId: string;
54
+ } & ResourceRequestOptions): Promise<SessionResponse>;
55
+ /**
56
+ * Poll from the first page for state changes; cursor only paginates receipts.
57
+ * @param input - `agentId`, `sessionId`; query filters; optional abortSignal.
58
+ * @returns The session inputs response.
59
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
60
+ */
61
+ inputs(input: {
62
+ agentId: string;
63
+ sessionId: string;
64
+ } & SessionInputsQuery & ResourceRequestOptions): Promise<SessionInputsResponse>;
65
+ /**
66
+ * Lists one page of Session records.
67
+ * @param input - `agentId`; filters and pagination options.
68
+ * @returns The sessions list response.
69
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
70
+ */
71
+ list(input: {
72
+ agentId: string;
73
+ } & SessionsListOptions): Promise<SessionsListResponse>;
74
+ /**
75
+ * `GET /v1/sessions/latest` — the Tenant's most recently updated Sessions,
76
+ * newest first. Set `byAgent` to return at most one Session per Agent.
77
+ * `userId` narrows the candidate Sessions to one end user's.
78
+ * @param input - filters and pagination options.
79
+ * @returns The latest sessions list response.
80
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
81
+ */
82
+ listLatest(input?: LatestSessionsListOptions): Promise<LatestSessionsListResponse>;
83
+ /**
84
+ * Lists one page of Session messages.
85
+ * @param input - `agentId`, `sessionId`.
86
+ * @returns The session messages response.
87
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
88
+ */
89
+ messages(input: {
90
+ agentId: string;
91
+ sessionId: string;
92
+ } & SessionMessagesOptions): Promise<SessionMessagesResponse>;
93
+ /**
94
+ * Records cancellation for the named Turn without waiting for settlement.
95
+ * @param input - `agentId`, `sessionId`; fields to change; optional abortSignal.
96
+ * @returns The stop session response.
97
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
98
+ */
99
+ stop(input: {
100
+ agentId: string;
101
+ sessionId: string;
102
+ } & StopSessionBody & ResourceRequestOptions): Promise<StopSessionResponse>;
103
+ /**
104
+ * Retry an uncertain acknowledgement with the same requestId and payload.
105
+ * @param input - `agentId`, `sessionId`; fields to change; optional abortSignal.
106
+ * @returns The session input response.
107
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
108
+ */
109
+ submitInput(input: Omit<SubmitSessionInputBody, "message"> & {
110
+ agentId: string;
111
+ sessionId: string;
112
+ message: UIMessage;
113
+ } & ResourceRequestOptions): Promise<SessionInputResponse>;
114
+ /**
115
+ * Retrieves the pending Tool approval round.
116
+ * @param input - `agentId`, `sessionId`; optional abortSignal.
117
+ * @returns The tool approvals response.
118
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
119
+ */
120
+ toolApprovals(input: {
121
+ agentId: string;
122
+ sessionId: string;
123
+ } & ResourceRequestOptions): Promise<ToolApprovalsResponse>;
124
+ }
2
125
  /**
3
126
  * `client.sessions` reads, paginates, and deletes Sessions under
4
127
  * `/v1/agents/:agentId/sessions`. Pagination is manual: the SDK returns
@@ -1,6 +1,5 @@
1
1
  import { sessionInputResponseSchema, sessionInputsResponseSchema, stopSessionResponseSchema, } from "../contracts/entities/session-inputs.js";
2
2
  import { latestSessionsListResponseSchema, sessionMessagesResponseSchema, sessionResponseSchema, sessionsListResponseSchema, toolApprovalsResponseSchema, } from "../contracts/entities/sessions.js";
3
- import { agentIdSchema, sessionIdSchema, turnIdSchema, } from "../contracts/ids.js";
4
3
  import { apiPath, requestJson } from "../http.js";
5
4
  /**
6
5
  * `client.sessions` reads, paginates, and deletes Sessions under
@@ -12,48 +11,30 @@ import { apiPath, requestJson } from "../http.js";
12
11
  */
13
12
  export function createSessionsResource(config) {
14
13
  return {
15
- /**
16
- * Submits a Session input. Reuse the request ID and payload after an uncertain acknowledgement.
17
- */
18
14
  async submitInput({ agentId, sessionId, abortSignal, ...body }) {
19
- return await requestJson(config, apiPath `/v1/agents/${agentIdSchema.parse(agentId)}/sessions/${sessionIdSchema.parse(sessionId)}/inputs`, { method: "POST", json: body, signal: abortSignal }, sessionInputResponseSchema);
15
+ return await requestJson(config, apiPath `/v1/agents/${agentId}/sessions/${sessionId}/inputs`, { method: "POST", json: body, signal: abortSignal }, sessionInputResponseSchema);
20
16
  },
21
- /**
22
- * Lists input receipts. Poll the first page to observe state changes.
23
- */
24
17
  async inputs({ agentId, sessionId, abortSignal, ...query }) {
25
- return await requestJson(config, apiPath `/v1/agents/${agentIdSchema.parse(agentId)}/sessions/${sessionIdSchema.parse(sessionId)}/inputs`, { query, signal: abortSignal }, sessionInputsResponseSchema);
18
+ return await requestJson(config, apiPath `/v1/agents/${agentId}/sessions/${sessionId}/inputs`, { query, signal: abortSignal }, sessionInputsResponseSchema);
26
19
  },
27
- /**
28
- * Records cancellation for the named Turn without waiting for settlement.
29
- */
30
20
  async stop({ agentId, sessionId, turnId, abortSignal }) {
31
- return await requestJson(config, apiPath `/v1/agents/${agentIdSchema.parse(agentId)}/sessions/${sessionIdSchema.parse(sessionId)}/stop`, {
21
+ return await requestJson(config, apiPath `/v1/agents/${agentId}/sessions/${sessionId}/stop`, {
32
22
  method: "POST",
33
- json: { turnId: turnIdSchema.parse(turnId) },
23
+ json: { turnId },
34
24
  signal: abortSignal,
35
25
  }, stopSessionResponseSchema);
36
26
  },
37
- /**
38
- * Forks a Session at a message. Reuse the idempotency key after an uncertain acknowledgement.
39
- */
40
27
  async fork({ agentId, sessionId, messageId, idempotencyKey, abortSignal }) {
41
- return await requestJson(config, apiPath `/v1/agents/${agentIdSchema.parse(agentId)}/sessions/${sessionIdSchema.parse(sessionId)}/fork`, {
28
+ return await requestJson(config, apiPath `/v1/agents/${agentId}/sessions/${sessionId}/fork`, {
42
29
  method: "POST",
43
30
  json: { messageId },
44
31
  headers: { "Idempotency-Key": idempotencyKey },
45
32
  signal: abortSignal,
46
33
  }, sessionResponseSchema);
47
34
  },
48
- /**
49
- * Retrieves sessions.
50
- */
51
35
  async get({ agentId, sessionId, abortSignal }) {
52
36
  return await requestJson(config, apiPath `/v1/agents/${agentId}/sessions/${sessionId}`, { signal: abortSignal }, sessionResponseSchema);
53
37
  },
54
- /**
55
- * Lists one page of sessions.
56
- */
57
38
  async list({ agentId, ...options }) {
58
39
  return await requestJson(config, apiPath `/v1/agents/${agentId}/sessions`, {
59
40
  signal: options.abortSignal,
@@ -64,9 +45,6 @@ export function createSessionsResource(config) {
64
45
  },
65
46
  }, sessionsListResponseSchema);
66
47
  },
67
- /**
68
- * Lists recently updated Sessions, optionally limited to one per Agent.
69
- */
70
48
  async listLatest(options = {}) {
71
49
  return await requestJson(config, "/v1/sessions/latest", {
72
50
  signal: options.abortSignal,
@@ -78,9 +56,6 @@ export function createSessionsResource(config) {
78
56
  },
79
57
  }, latestSessionsListResponseSchema);
80
58
  },
81
- /**
82
- * Lists one page of Session messages.
83
- */
84
59
  async messages({ agentId, sessionId, ...options }) {
85
60
  return await requestJson(config, apiPath `/v1/agents/${agentId}/sessions/${sessionId}/messages`, {
86
61
  signal: options.abortSignal,
@@ -91,15 +66,9 @@ export function createSessionsResource(config) {
91
66
  },
92
67
  }, sessionMessagesResponseSchema);
93
68
  },
94
- /**
95
- * Retrieves the pending Tool approval round.
96
- */
97
69
  async toolApprovals({ agentId, sessionId, abortSignal }) {
98
70
  return await requestJson(config, apiPath `/v1/agents/${agentId}/sessions/${sessionId}/tool-approvals`, { signal: abortSignal }, toolApprovalsResponseSchema);
99
71
  },
100
- /**
101
- * Deletes sessions.
102
- */
103
72
  async delete({ agentId, sessionId, deleteArtifacts, abortSignal }) {
104
73
  await requestJson(config, apiPath `/v1/agents/${agentId}/sessions/${sessionId}`, { method: "DELETE", query: { deleteArtifacts }, signal: abortSignal });
105
74
  },
@@ -1,4 +1,98 @@
1
- import type { AgentSkillsResource, HttpConfig } from "../types.ts";
1
+ import { type CreateSkillBody, type SkillArchiveType, type SkillCopyResults, type SkillDetail, type SkillsListResponse } from "../contracts/entities/skills.ts";
2
+ import type { HttpConfig, ResourceRequestOptions } from "../types.ts";
3
+ export interface AgentSkillsResource {
4
+ /**
5
+ * Copies the Skill to the selected Agents.
6
+ * @param input - Source `skillId`, destination `to.agentIds`, and optional abortSignal.
7
+ * @returns The skill copy results.
8
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
9
+ */
10
+ copy(input: {
11
+ skillId: string;
12
+ to: {
13
+ agentIds: string[];
14
+ };
15
+ } & ResourceRequestOptions): Promise<SkillCopyResults>;
16
+ /**
17
+ * Creates the Skill.
18
+ * @param input - creation fields; optional abortSignal.
19
+ * @returns The skill detail.
20
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
21
+ */
22
+ create(input: CreateSkillBody & ResourceRequestOptions): Promise<SkillDetail>;
23
+ /**
24
+ * Deletes the Skill.
25
+ * @param input - `skillId`; optional abortSignal.
26
+ * @returns Resolves when the operation completes.
27
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
28
+ */
29
+ delete(input: {
30
+ skillId: string;
31
+ } & ResourceRequestOptions): Promise<void>;
32
+ /**
33
+ * Deletes a Skill file.
34
+ * @param input - `skillId`, relative file `path`, and optional abortSignal.
35
+ * @returns The skill detail.
36
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
37
+ */
38
+ deleteFile(input: {
39
+ path: string;
40
+ skillId: string;
41
+ } & ResourceRequestOptions): Promise<SkillDetail>;
42
+ /**
43
+ * Retrieves the Skill.
44
+ * @param input - `skillId`; optional abortSignal.
45
+ * @returns The skill detail.
46
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
47
+ */
48
+ get(input: {
49
+ skillId: string;
50
+ } & ResourceRequestOptions): Promise<SkillDetail>;
51
+ /**
52
+ * Reads Skill file bytes.
53
+ * @param input - `skillId`, relative file `path`, and optional abortSignal.
54
+ * @returns The requested file bytes.
55
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
56
+ */
57
+ getFile(input: {
58
+ path: string;
59
+ skillId: string;
60
+ } & ResourceRequestOptions): Promise<Uint8Array>;
61
+ /**
62
+ * Lists one page of Skill records.
63
+ * @param input - filters and pagination options.
64
+ * @returns The skills list response.
65
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
66
+ */
67
+ list(input?: SkillsListOptions): Promise<SkillsListResponse>;
68
+ /**
69
+ * Replaces a Skill file with the supplied content.
70
+ * @param input - `skillId`, relative `path`, replacement `content`, and optional abortSignal.
71
+ * @returns The skill detail.
72
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
73
+ */
74
+ putFile(input: {
75
+ content: Blob | string | Uint8Array;
76
+ path: string;
77
+ skillId: string;
78
+ } & ResourceRequestOptions): Promise<SkillDetail>;
79
+ /**
80
+ * Uploads a Skill archive as multipart form data.
81
+ * @param input - Archive bytes in `source.file`, archive format in `source.type`, and optional abortSignal.
82
+ * @returns The skill detail.
83
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
84
+ */
85
+ upload(input: {
86
+ source: {
87
+ file: Blob | Uint8Array;
88
+ type: SkillArchiveType;
89
+ };
90
+ } & ResourceRequestOptions): Promise<SkillDetail>;
91
+ }
92
+ export interface SkillsListOptions extends ResourceRequestOptions {
93
+ cursor?: string;
94
+ limit?: number;
95
+ }
2
96
  /**
3
97
  * Builds the Agent Skills operations using the shared HTTP configuration.
4
98
  * @param config - Shared authentication and transport configuration.
@@ -13,42 +13,24 @@ function fileUrl(agentId, input) {
13
13
  */
14
14
  export function createAgentSkillsResource(config, agentId) {
15
15
  return {
16
- /**
17
- * Copies skills.
18
- */
19
16
  async copy({ skillId, to, abortSignal }) {
20
17
  return await requestJson(config, apiPath `/v1/agents/${agentId}/skills/${skillId}/copies`, { json: to, method: "POST", signal: abortSignal }, skillCopyResultsSchema);
21
18
  },
22
- /**
23
- * Creates skills.
24
- */
25
19
  async create({ abortSignal, ...body }) {
26
20
  return await requestJson(config, apiPath `/v1/agents/${agentId}/skills`, { json: body, method: "POST", signal: abortSignal }, skillDetailSchema);
27
21
  },
28
- /**
29
- * Deletes skills.
30
- */
31
22
  async delete({ skillId, abortSignal }) {
32
23
  await requestJson(config, apiPath `/v1/agents/${agentId}/skills/${skillId}`, { method: "DELETE", signal: abortSignal });
33
24
  },
34
- /**
35
- * Deletes a Skill file.
36
- */
37
25
  async deleteFile({ abortSignal, ...input }) {
38
26
  return await requestJson(config, fileUrl(agentId, input), {
39
27
  method: "DELETE",
40
28
  signal: abortSignal,
41
29
  }, skillDetailSchema);
42
30
  },
43
- /**
44
- * Retrieves skills.
45
- */
46
31
  async get({ skillId, abortSignal }) {
47
32
  return await requestJson(config, apiPath `/v1/agents/${agentId}/skills/${skillId}`, { signal: abortSignal }, skillDetailSchema);
48
33
  },
49
- /**
50
- * Reads Skill file bytes.
51
- */
52
34
  async getFile({ abortSignal, ...input }) {
53
35
  const response = await requestStream(config, fileUrl(agentId, input), {
54
36
  signal: abortSignal,
@@ -63,15 +45,9 @@ export function createAgentSkillsResource(config, agentId) {
63
45
  throw cause;
64
46
  }
65
47
  },
66
- /**
67
- * Lists one page of skills.
68
- */
69
48
  async list({ cursor, limit, abortSignal } = {}) {
70
49
  return await requestJson(config, apiPath `/v1/agents/${agentId}/skills`, { signal: abortSignal, query: { cursor, limit } }, skillsListResponseSchema);
71
50
  },
72
- /**
73
- * Replaces a Skill file with the supplied content.
74
- */
75
51
  async putFile({ content, abortSignal, ...input }) {
76
52
  return await requestJson(config, fileUrl(agentId, input), {
77
53
  body: content,
@@ -80,9 +56,6 @@ export function createAgentSkillsResource(config, agentId) {
80
56
  signal: abortSignal,
81
57
  }, skillDetailSchema);
82
58
  },
83
- /**
84
- * Uploads a Skill archive as multipart form data.
85
- */
86
59
  async upload({ source, abortSignal }) {
87
60
  const form = new FormData();
88
61
  form.set("type", source.type);
@@ -1,4 +1,110 @@
1
- import type { HttpConfig, TasksResource } from "../types.ts";
1
+ import { type CreateTaskBody, type CreateTaskResponse, type CreateTaskRunBody, type CreateTaskRunResponse, type TaskResponse, type TaskRunMessagesResponse, type TaskRunResponse, type TaskRunsListResponse, type TasksListResponse, type UpdateTaskBody } from "../contracts/entities/tasks.ts";
2
+ import type { HttpConfig, ResourceRequestOptions } from "../types.ts";
3
+ export interface TasksListOptions extends ResourceRequestOptions {
4
+ agentId?: string;
5
+ cursor?: string;
6
+ limit?: number;
7
+ userId?: string;
8
+ }
9
+ export interface TaskRunsListOptions extends ResourceRequestOptions {
10
+ cursor?: string;
11
+ limit?: number;
12
+ }
13
+ export interface TaskRunMessagesOptions extends ResourceRequestOptions {
14
+ after?: string;
15
+ cursor?: string;
16
+ limit?: number;
17
+ }
18
+ export interface TasksResource {
19
+ /**
20
+ * Requests cancellation of a Task run.
21
+ * @param input - `taskId`, `runId`; optional abortSignal.
22
+ * @returns Resolves when the operation completes.
23
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
24
+ */
25
+ cancelRun(input: {
26
+ taskId: string;
27
+ runId: string;
28
+ } & ResourceRequestOptions): Promise<void>;
29
+ /**
30
+ * Creates the Task.
31
+ * @param input - creation fields; optional abortSignal.
32
+ * @returns The create task response.
33
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
34
+ */
35
+ create(input: CreateTaskBody & ResourceRequestOptions): Promise<CreateTaskResponse>;
36
+ /**
37
+ * Creates a Task run.
38
+ * @param input - `taskId`; creation fields; optional abortSignal.
39
+ * @returns The create task run response.
40
+ */
41
+ createRun(input: CreateTaskRunBody & {
42
+ taskId: string;
43
+ } & ResourceRequestOptions): Promise<CreateTaskRunResponse>;
44
+ /**
45
+ * Deletes the Task.
46
+ * @param input - `taskId`; optional abortSignal.
47
+ * @returns Resolves when the operation completes.
48
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
49
+ */
50
+ delete(input: {
51
+ taskId: string;
52
+ } & ResourceRequestOptions): Promise<void>;
53
+ /**
54
+ * Retrieves the Task.
55
+ * @param input - `taskId`; optional abortSignal.
56
+ * @returns The task response.
57
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
58
+ */
59
+ get(input: {
60
+ taskId: string;
61
+ } & ResourceRequestOptions): Promise<TaskResponse>;
62
+ /**
63
+ * Retrieves a Task run.
64
+ * @param input - `taskId`, `runId`; optional abortSignal.
65
+ * @returns The task run response.
66
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
67
+ */
68
+ getRun(input: {
69
+ taskId: string;
70
+ runId: string;
71
+ } & ResourceRequestOptions): Promise<TaskRunResponse>;
72
+ /**
73
+ * Lists one page of Task records.
74
+ * @param input - filters and pagination options.
75
+ * @returns The tasks list response.
76
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
77
+ */
78
+ list(input?: TasksListOptions): Promise<TasksListResponse>;
79
+ /**
80
+ * Lists one page of Task runs.
81
+ * @param input - `taskId`; filters and pagination options.
82
+ * @returns The task runs list response.
83
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
84
+ */
85
+ listRuns(input: {
86
+ taskId: string;
87
+ } & TaskRunsListOptions): Promise<TaskRunsListResponse>;
88
+ /**
89
+ * Lists one page of Task run messages.
90
+ * @param input - `taskId`, `runId`.
91
+ * @returns The task run messages response.
92
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
93
+ */
94
+ runMessages(input: {
95
+ taskId: string;
96
+ runId: string;
97
+ } & TaskRunMessagesOptions): Promise<TaskRunMessagesResponse>;
98
+ /**
99
+ * Updates the Task.
100
+ * @param input - `taskId`; fields to change; optional abortSignal.
101
+ * @returns The task response.
102
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
103
+ */
104
+ update(input: UpdateTaskBody & {
105
+ taskId: string;
106
+ } & ResourceRequestOptions): Promise<TaskResponse>;
107
+ }
2
108
  /**
3
109
  * `client.tasks` — CRUD + runs over `/v1/tasks`. Runs are listed/get/
4
110
  * canceled/transcripted via `/v1/tasks/:taskId/runs/...`. All lists are