@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,4 @@
1
- import { mcpConnectionReconnectResultSchema, mcpConnectionResponseSchema, mcpConnectionsResponseSchema, mcpConnectionTestResponseSchema, reconnectMcpConnectionBodySchema, updateMcpConnectionBodySchema, } from "../contracts/entities/mcp-connections.js";
1
+ import { mcpConnectionReconnectResultSchema, mcpConnectionResponseSchema, mcpConnectionsResponseSchema, mcpConnectionTestResponseSchema, } from "../contracts/entities/mcp-connections.js";
2
2
  import { apiPath, requestJson } from "../http.js";
3
3
  /**
4
4
  * Builds the Mcp Connections operations using the shared HTTP configuration.
@@ -13,49 +13,31 @@ export function createMcpConnectionsResource(config) {
13
13
  }, mcpConnectionResponseSchema));
14
14
  return {
15
15
  create,
16
- /**
17
- * Lists one page of mcp connections.
18
- */
19
16
  async list({ abortSignal } = {}) {
20
17
  return await requestJson(config, "/v1/mcp-connections", { signal: abortSignal }, mcpConnectionsResponseSchema);
21
18
  },
22
- /**
23
- * Retrieves mcp connections.
24
- */
25
19
  async get({ mcpConnectionId, abortSignal }) {
26
20
  return await requestJson(config, apiPath `/v1/mcp-connections/${mcpConnectionId}`, { signal: abortSignal }, mcpConnectionResponseSchema);
27
21
  },
28
- /**
29
- * Updates mcp connections.
30
- */
31
22
  async update({ mcpConnectionId, abortSignal, ...body }) {
32
23
  return await requestJson(config, apiPath `/v1/mcp-connections/${mcpConnectionId}`, {
33
- json: updateMcpConnectionBodySchema.parse(body),
24
+ json: body,
34
25
  signal: abortSignal,
35
26
  method: "PATCH",
36
27
  }, mcpConnectionResponseSchema);
37
28
  },
38
- /**
39
- * Deletes mcp connections.
40
- */
41
29
  async delete({ mcpConnectionId, abortSignal }) {
42
30
  await requestJson(config, apiPath `/v1/mcp-connections/${mcpConnectionId}`, {
43
31
  method: "DELETE",
44
32
  signal: abortSignal,
45
33
  });
46
34
  },
47
- /**
48
- * Tests mcp connections.
49
- */
50
35
  async test({ mcpConnectionId, abortSignal }) {
51
36
  return await requestJson(config, apiPath `/v1/mcp-connections/${mcpConnectionId}/test`, { method: "POST", signal: abortSignal }, mcpConnectionTestResponseSchema);
52
37
  },
53
- /**
54
- * Reconnects mcp connections.
55
- */
56
38
  async reconnect({ mcpConnectionId, abortSignal, ...body }) {
57
39
  return await requestJson(config, apiPath `/v1/mcp-connections/${mcpConnectionId}/reconnect`, {
58
- json: reconnectMcpConnectionBodySchema.parse(body),
40
+ json: body,
59
41
  signal: abortSignal,
60
42
  method: "POST",
61
43
  }, mcpConnectionReconnectResultSchema);
@@ -1,4 +1,61 @@
1
- import type { HttpConfig, MemoriesResource } from "../types.ts";
1
+ import { type CreateMemoryBody, type MemoriesListResponse, type MemoryResponse, type UpdateMemoryBody } from "../contracts/entities/memories.ts";
2
+ import type { HttpConfig, ResourceRequestOptions } from "../types.ts";
3
+ export interface MemoriesResource {
4
+ /**
5
+ * Creates the Memory.
6
+ * @param input - `agentId`; creation fields; optional abortSignal.
7
+ * @returns The memory response.
8
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
9
+ */
10
+ create(input: CreateMemoryBody & {
11
+ agentId: string;
12
+ } & ResourceRequestOptions): Promise<MemoryResponse>;
13
+ /**
14
+ * Deletes the Memory.
15
+ * @param input - `agentId`, `memoryId`; optional abortSignal.
16
+ * @returns Resolves when the operation completes.
17
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
18
+ */
19
+ delete(input: {
20
+ agentId: string;
21
+ memoryId: string;
22
+ } & ResourceRequestOptions): Promise<void>;
23
+ /**
24
+ * Retrieves the Memory.
25
+ * @param input - `agentId`, `memoryId`; optional abortSignal.
26
+ * @returns The memory response.
27
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
28
+ */
29
+ get(input: {
30
+ agentId: string;
31
+ memoryId: string;
32
+ } & ResourceRequestOptions): Promise<MemoryResponse>;
33
+ /**
34
+ * Lists one page of Memory records.
35
+ * @param input - `agentId`; filters and pagination options.
36
+ * @returns The memories list response.
37
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
38
+ */
39
+ list(input: {
40
+ agentId: string;
41
+ } & MemoriesListOptions): Promise<MemoriesListResponse>;
42
+ /**
43
+ * Updates the Memory.
44
+ * @param input - `agentId`, `memoryId`; fields to change; optional abortSignal.
45
+ * @returns The memory response.
46
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
47
+ */
48
+ update(input: UpdateMemoryBody & {
49
+ agentId: string;
50
+ memoryId: string;
51
+ } & ResourceRequestOptions): Promise<MemoryResponse>;
52
+ }
53
+ export interface MemoriesListOptions extends ResourceRequestOptions {
54
+ cursor?: string;
55
+ limit?: number;
56
+ search?: string;
57
+ userId?: string;
58
+ }
2
59
  /**
3
60
  * `client.memories` — CRUD and query over `/v1/agents/:agentId/memories`.
4
61
  * Memories are Agent-nested; `userId` is stamped at creation and immutable,
@@ -9,9 +9,6 @@ import { apiPath, requestJson } from "../http.js";
9
9
  */
10
10
  export function createMemoriesResource(config) {
11
11
  return {
12
- /**
13
- * Lists one page of memories.
14
- */
15
12
  async list({ agentId, abortSignal, ...options }) {
16
13
  return await requestJson(config, apiPath `/v1/agents/${agentId}/memories`, {
17
14
  signal: abortSignal,
@@ -23,27 +20,15 @@ export function createMemoriesResource(config) {
23
20
  },
24
21
  }, memoriesListResponseSchema);
25
22
  },
26
- /**
27
- * Creates memories.
28
- */
29
23
  async create({ agentId, abortSignal, ...body }) {
30
24
  return await requestJson(config, apiPath `/v1/agents/${agentId}/memories`, { json: body, signal: abortSignal, method: "POST" }, memoryResponseSchema);
31
25
  },
32
- /**
33
- * Retrieves memories.
34
- */
35
26
  async get({ agentId, memoryId, abortSignal }) {
36
27
  return await requestJson(config, apiPath `/v1/agents/${agentId}/memories/${memoryId}`, { signal: abortSignal }, memoryResponseSchema);
37
28
  },
38
- /**
39
- * Updates memories.
40
- */
41
29
  async update({ agentId, memoryId, abortSignal, ...body }) {
42
30
  return await requestJson(config, apiPath `/v1/agents/${agentId}/memories/${memoryId}`, { json: body, signal: abortSignal, method: "PATCH" }, memoryResponseSchema);
43
31
  },
44
- /**
45
- * Deletes memories.
46
- */
47
32
  async delete({ agentId, memoryId, abortSignal }) {
48
33
  await requestJson(config, apiPath `/v1/agents/${agentId}/memories/${memoryId}`, { method: "DELETE", signal: abortSignal });
49
34
  },
@@ -1,4 +1,42 @@
1
- import type { HttpConfig, MerchantBindingsResource } from "../types.ts";
1
+ import { type MerchantBindingResponse, type MerchantBindingsResponse, type UpsertMerchantBindingBody } from "../contracts/entities/merchant.ts";
2
+ import type { HttpConfig, ResourceRequestOptions } from "../types.ts";
3
+ export interface MerchantBindingsListOptions extends ResourceRequestOptions {
4
+ cursor?: string;
5
+ limit?: number;
6
+ userId?: string;
7
+ }
8
+ /**
9
+ * `client.merchantBindings` — end-user → provider customer bindings behind
10
+ * `/v1/merchant-connection/bindings`. `put` validates the customer against
11
+ * the provider.
12
+ */
13
+ export interface MerchantBindingsResource {
14
+ /**
15
+ * Deletes the end-user merchant binding.
16
+ * @param input - `userId`; optional abortSignal.
17
+ * @returns Resolves when the operation completes.
18
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
19
+ */
20
+ delete(input: {
21
+ userId: string;
22
+ } & ResourceRequestOptions): Promise<void>;
23
+ /**
24
+ * Lists one page of end-user merchant binding records.
25
+ * @param input - filters and pagination options.
26
+ * @returns The merchant bindings response.
27
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
28
+ */
29
+ list(input?: MerchantBindingsListOptions): Promise<MerchantBindingsResponse>;
30
+ /**
31
+ * Validates and saves the end-user merchant binding.
32
+ * @param input - `userId`; fields to change; optional abortSignal.
33
+ * @returns The merchant binding response.
34
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
35
+ */
36
+ put(input: UpsertMerchantBindingBody & {
37
+ userId: string;
38
+ } & ResourceRequestOptions): Promise<MerchantBindingResponse>;
39
+ }
2
40
  /**
3
41
  * `client.merchantBindings` — list/put/delete over
4
42
  * `/v1/merchant-connection/bindings`. `put` upserts the end user's provider
@@ -10,21 +10,12 @@ import { apiPath, requestJson } from "../http.js";
10
10
  */
11
11
  export function createMerchantBindingsResource(config) {
12
12
  return {
13
- /**
14
- * Lists one page of merchant bindings.
15
- */
16
13
  async list({ abortSignal, ...query } = {}) {
17
14
  return await requestJson(config, "/v1/merchant-connection/bindings", { query, signal: abortSignal }, merchantBindingsResponseSchema);
18
15
  },
19
- /**
20
- * Validates and saves merchant bindings.
21
- */
22
16
  async put({ userId, abortSignal, ...body }) {
23
17
  return await requestJson(config, apiPath `/v1/merchant-connection/bindings/${userId}`, { json: body, method: "PUT", signal: abortSignal }, merchantBindingResponseSchema);
24
18
  },
25
- /**
26
- * Deletes merchant bindings.
27
- */
28
19
  async delete({ userId, abortSignal }) {
29
20
  await requestJson(config, apiPath `/v1/merchant-connection/bindings/${userId}`, { method: "DELETE", signal: abortSignal });
30
21
  },
@@ -1,4 +1,40 @@
1
- import type { HttpConfig, MerchantConnectionResource } from "../types.ts";
1
+ import { type CreateMerchantConnectionBody, type MerchantConnectionResponse, type UpdateMerchantConnectionBody } from "../contracts/entities/merchant.ts";
2
+ import type { HttpConfig, ResourceRequestOptions } from "../types.ts";
3
+ /**
4
+ * `client.merchantConnection` — the tenant's own Polar/Dodo merchant
5
+ * connection (ADR-0048). `credential` is write-only: responses expose only
6
+ * `keyFragment`.
7
+ */
8
+ export interface MerchantConnectionResource {
9
+ /**
10
+ * Creates the merchant connection.
11
+ * @param input - creation fields; optional abortSignal.
12
+ * @returns The merchant connection response.
13
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
14
+ */
15
+ create(input: CreateMerchantConnectionBody & ResourceRequestOptions): Promise<MerchantConnectionResponse>;
16
+ /**
17
+ * Retrieves the merchant connection.
18
+ * @param input - optional abortSignal.
19
+ * @returns The merchant connection response.
20
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
21
+ */
22
+ get(input?: ResourceRequestOptions): Promise<MerchantConnectionResponse>;
23
+ /**
24
+ * Retires the merchant connection and stops deliveries.
25
+ * @param input - 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
+ retire(input?: ResourceRequestOptions): Promise<void>;
30
+ /**
31
+ * Updates the merchant connection.
32
+ * @param input - fields to change; optional abortSignal.
33
+ * @returns The merchant connection response.
34
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
35
+ */
36
+ update(input: UpdateMerchantConnectionBody & ResourceRequestOptions): Promise<MerchantConnectionResponse>;
37
+ }
2
38
  /**
3
39
  * `client.merchantConnection` — get/create/update/retire over
4
40
  * `/v1/merchant-connection`. One connection per tenant; `credential` is
@@ -1,4 +1,4 @@
1
- import { merchantConnectionResponseSchema } from "../contracts/entities/merchant.js";
1
+ import { merchantConnectionResponseSchema, } from "../contracts/entities/merchant.js";
2
2
  import { requestJson } from "../http.js";
3
3
  /**
4
4
  * `client.merchantConnection` — get/create/update/retire over
@@ -9,27 +9,15 @@ import { requestJson } from "../http.js";
9
9
  */
10
10
  export function createMerchantConnectionResource(config) {
11
11
  return {
12
- /**
13
- * Retrieves merchant connection.
14
- */
15
12
  async get({ abortSignal } = {}) {
16
13
  return await requestJson(config, "/v1/merchant-connection", { signal: abortSignal }, merchantConnectionResponseSchema);
17
14
  },
18
- /**
19
- * Creates merchant connection.
20
- */
21
15
  async create({ abortSignal, ...body }) {
22
16
  return await requestJson(config, "/v1/merchant-connection", { json: body, method: "POST", signal: abortSignal }, merchantConnectionResponseSchema);
23
17
  },
24
- /**
25
- * Updates merchant connection.
26
- */
27
18
  async update({ abortSignal, ...body }) {
28
19
  return await requestJson(config, "/v1/merchant-connection", { json: body, method: "PATCH", signal: abortSignal }, merchantConnectionResponseSchema);
29
20
  },
30
- /**
31
- * Retires merchant connection.
32
- */
33
21
  async retire({ abortSignal } = {}) {
34
22
  await requestJson(config, "/v1/merchant-connection", {
35
23
  method: "DELETE",
@@ -1,4 +1,69 @@
1
- import type { HttpConfig, MerchantUsageEventsResource } from "../types.ts";
1
+ import { type MerchantUsageEventResponse, type MerchantUsageEventStatus, type MerchantUsageEventsResponse, type MerchantUsageSummaryResponse } from "../contracts/entities/merchant.ts";
2
+ import type { HttpConfig, ResourceRequestOptions } from "../types.ts";
3
+ export interface MerchantUsageEventsListOptions extends ResourceRequestOptions {
4
+ cursor?: string;
5
+ limit?: number;
6
+ status?: MerchantUsageEventStatus;
7
+ }
8
+ /**
9
+ * `client.merchantUsageEvents` — the immutable delivery ledger behind
10
+ * `/v1/merchant-usage-events`. `retry`, `release`, and `discard` are the
11
+ * operator actions on unresolved events.
12
+ */
13
+ export interface MerchantUsageEventsResource {
14
+ /**
15
+ * Discards the merchant usage event.
16
+ * @param input - `eventId`; optional abortSignal.
17
+ * @returns The merchant usage event response.
18
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
19
+ */
20
+ discard(input: {
21
+ eventId: string;
22
+ } & ResourceRequestOptions): Promise<MerchantUsageEventResponse>;
23
+ /**
24
+ * Retrieves the merchant usage event.
25
+ * @param input - `eventId`; optional abortSignal.
26
+ * @returns The merchant usage event response.
27
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
28
+ */
29
+ get(input: {
30
+ eventId: string;
31
+ } & ResourceRequestOptions): Promise<MerchantUsageEventResponse>;
32
+ /**
33
+ * Lists one page of merchant usage event records.
34
+ * @param input - filters and pagination options.
35
+ * @returns The merchant usage events response.
36
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
37
+ */
38
+ list(input?: MerchantUsageEventsListOptions): Promise<MerchantUsageEventsResponse>;
39
+ /**
40
+ * Releases the merchant usage event.
41
+ * @param input - `eventId`; optional abortSignal.
42
+ * @returns The merchant usage event response.
43
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
44
+ */
45
+ release(input: {
46
+ eventId: string;
47
+ } & ResourceRequestOptions): Promise<MerchantUsageEventResponse>;
48
+ /**
49
+ * Retries delivery of the merchant usage event.
50
+ * @param input - `eventId`; optional abortSignal.
51
+ * @returns The merchant usage event response.
52
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
53
+ */
54
+ retry(input: {
55
+ eventId: string;
56
+ } & ResourceRequestOptions): Promise<MerchantUsageEventResponse>;
57
+ /**
58
+ * Retrieves merchant usage delivery totals for the selected day range.
59
+ * @param input - Lookback window in `days` and optional abortSignal.
60
+ * @returns The merchant usage summary response.
61
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
62
+ */
63
+ summary(input?: {
64
+ days?: number;
65
+ } & ResourceRequestOptions): Promise<MerchantUsageSummaryResponse>;
66
+ }
2
67
  /**
3
68
  * `client.merchantUsageEvents` — the immutable usage-event ledger over
4
69
  * `/v1/merchant-usage-events`, plus the delivery-health `summary` aggregate
@@ -9,39 +9,21 @@ import { apiPath, requestJson } from "../http.js";
9
9
  */
10
10
  export function createMerchantUsageEventsResource(config) {
11
11
  return {
12
- /**
13
- * Lists one page of merchant usage events.
14
- */
15
12
  async list({ abortSignal, ...query } = {}) {
16
13
  return await requestJson(config, "/v1/merchant-usage-events", { query, signal: abortSignal }, merchantUsageEventsResponseSchema);
17
14
  },
18
- /**
19
- * Retrieves merchant usage events.
20
- */
21
15
  async get({ eventId, abortSignal }) {
22
16
  return await requestJson(config, apiPath `/v1/merchant-usage-events/${eventId}`, { signal: abortSignal }, merchantUsageEventResponseSchema);
23
17
  },
24
- /**
25
- * Retrieves merchant usage delivery totals for the selected day range.
26
- */
27
18
  async summary({ abortSignal, ...query } = {}) {
28
19
  return await requestJson(config, "/v1/merchant-usage-events/summary", { query, signal: abortSignal }, merchantUsageSummaryResponseSchema);
29
20
  },
30
- /**
31
- * Retries delivery of merchant usage events.
32
- */
33
21
  async retry({ eventId, abortSignal }) {
34
22
  return await requestJson(config, apiPath `/v1/merchant-usage-events/${eventId}/retry`, { method: "POST", signal: abortSignal }, merchantUsageEventResponseSchema);
35
23
  },
36
- /**
37
- * Releases merchant usage events.
38
- */
39
24
  async release({ eventId, abortSignal }) {
40
25
  return await requestJson(config, apiPath `/v1/merchant-usage-events/${eventId}/release`, { method: "POST", signal: abortSignal }, merchantUsageEventResponseSchema);
41
26
  },
42
- /**
43
- * Discards merchant usage events.
44
- */
45
27
  async discard({ eventId, abortSignal }) {
46
28
  return await requestJson(config, apiPath `/v1/merchant-usage-events/${eventId}/discard`, { method: "POST", signal: abortSignal }, merchantUsageEventResponseSchema);
47
29
  },
@@ -1,4 +1,53 @@
1
- import type { HttpConfig, PromptsResource } from "../types.ts";
1
+ import { type CreatePromptBody, type PromptResponse, type PromptsResponse, type UpdatePromptBody } from "../contracts/entities/prompts.ts";
2
+ import type { HttpConfig, ResourceRequestOptions } from "../types.ts";
3
+ export interface PromptsResource {
4
+ /**
5
+ * Creates the Prompt.
6
+ * @param input - creation fields; optional abortSignal.
7
+ * @returns The prompt response.
8
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
9
+ */
10
+ create(input: CreatePromptBody & ResourceRequestOptions): Promise<PromptResponse>;
11
+ /**
12
+ * Deletes the Prompt.
13
+ * @param input - `promptId`; 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: {
18
+ promptId: string;
19
+ } & ResourceRequestOptions): Promise<void>;
20
+ /**
21
+ * Retrieves the Prompt.
22
+ * @param input - `promptId`; optional abortSignal.
23
+ * @returns The prompt response.
24
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
25
+ */
26
+ get(input: {
27
+ promptId: string;
28
+ } & ResourceRequestOptions): Promise<PromptResponse>;
29
+ /**
30
+ * Lists one page of Prompt records.
31
+ * @param input - `userId`, `agentId`; filters and pagination options; optional abortSignal.
32
+ * @returns The prompts response.
33
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
34
+ */
35
+ list(input?: {
36
+ userId?: string;
37
+ agentId?: string;
38
+ cursor?: string;
39
+ limit?: number;
40
+ } & ResourceRequestOptions): Promise<PromptsResponse>;
41
+ /**
42
+ * Updates the Prompt.
43
+ * @param input - `promptId`; fields to change; optional abortSignal.
44
+ * @returns The prompt response.
45
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
46
+ */
47
+ update(input: UpdatePromptBody & {
48
+ promptId: string;
49
+ } & ResourceRequestOptions): Promise<PromptResponse>;
50
+ }
2
51
  /**
3
52
  * Builds the Prompts operations using the shared HTTP configuration.
4
53
  * @param config - Shared authentication and transport configuration.
@@ -7,9 +7,6 @@ import { apiPath, requestJson } from "../http.js";
7
7
  */
8
8
  export function createPromptsResource(config) {
9
9
  return {
10
- /**
11
- * Creates prompts.
12
- */
13
10
  async create({ abortSignal, ...body }) {
14
11
  return await requestJson(config, "/v1/prompts", {
15
12
  json: body,
@@ -17,24 +14,15 @@ export function createPromptsResource(config) {
17
14
  method: "POST",
18
15
  }, promptResponseSchema);
19
16
  },
20
- /**
21
- * Lists one page of prompts.
22
- */
23
17
  async list({ userId, agentId, cursor, limit, abortSignal } = {}) {
24
18
  return await requestJson(config, "/v1/prompts", {
25
19
  signal: abortSignal,
26
20
  query: { userId, agentId, cursor, limit },
27
21
  }, promptsResponseSchema);
28
22
  },
29
- /**
30
- * Retrieves prompts.
31
- */
32
23
  async get({ promptId, abortSignal }) {
33
24
  return await requestJson(config, apiPath `/v1/prompts/${promptId}`, { signal: abortSignal }, promptResponseSchema);
34
25
  },
35
- /**
36
- * Updates prompts.
37
- */
38
26
  async update({ promptId, abortSignal, ...body }) {
39
27
  return await requestJson(config, apiPath `/v1/prompts/${promptId}`, {
40
28
  json: body,
@@ -42,9 +30,6 @@ export function createPromptsResource(config) {
42
30
  method: "PATCH",
43
31
  }, promptResponseSchema);
44
32
  },
45
- /**
46
- * Deletes prompts.
47
- */
48
33
  async delete({ promptId, abortSignal }) {
49
34
  await requestJson(config, apiPath `/v1/prompts/${promptId}`, {
50
35
  method: "DELETE",
@@ -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,9 +7,6 @@ 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,
@@ -17,33 +14,18 @@ export function createProvidersResource(config) {
17
14
  method: "POST",
18
15
  }, providerResponseSchema);
19
16
  },
20
- /**
21
- * Lists one page of providers.
22
- */
23
17
  async list({ abortSignal } = {}) {
24
18
  return await requestJson(config, "/v1/providers", { signal: abortSignal }, providersResponseSchema);
25
19
  },
26
- /**
27
- * Retrieves providers.
28
- */
29
20
  async get({ providerId, abortSignal }) {
30
21
  return await requestJson(config, apiPath `/v1/providers/${providerId}`, { signal: abortSignal }, providerResponseSchema);
31
22
  },
32
- /**
33
- * Lists models exposed by the Provider.
34
- */
35
23
  async listModels({ providerId, abortSignal }) {
36
24
  return await requestJson(config, apiPath `/v1/providers/${providerId}/models`, { signal: abortSignal }, providerModelsResponseSchema);
37
25
  },
38
- /**
39
- * Retrieves supported thinking levels for a Provider model.
40
- */
41
26
  async getThinkingLevels({ providerId, model, abortSignal }) {
42
27
  return await requestJson(config, apiPath `/v1/providers/${providerId}/thinking-levels`, { signal: abortSignal, query: { model } }, thinkingLevelsResponseSchema);
43
28
  },
44
- /**
45
- * Updates providers.
46
- */
47
29
  async update({ providerId, abortSignal, ...body }) {
48
30
  return await requestJson(config, apiPath `/v1/providers/${providerId}`, {
49
31
  json: body,
@@ -51,9 +33,6 @@ export function createProvidersResource(config) {
51
33
  method: "PATCH",
52
34
  }, providerResponseSchema);
53
35
  },
54
- /**
55
- * Deletes providers.
56
- */
57
36
  async delete({ providerId, abortSignal, ...options }) {
58
37
  await requestJson(config, apiPath `/v1/providers/${providerId}`, {
59
38
  method: "DELETE",