@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,26 @@
1
- import type { ChatDeliveriesResource, HttpConfig } from "../types.ts";
1
+ import { type ChatDeliveriesResponse, type ChatDeliveryListStatus } from "../contracts/entities/chat-connections.ts";
2
+ import type { HttpConfig, ResourceRequestOptions } from "../types.ts";
3
+ export interface ChatDeliveriesListOptions extends ResourceRequestOptions {
4
+ cursor?: string;
5
+ limit?: number;
6
+ /** ISO 8601 date-time; inclusive lower bound on `createdAt`. */
7
+ since?: string;
8
+ /** `failed` and/or `ambiguous`; omitted means both. */
9
+ status?: readonly ChatDeliveryListStatus[];
10
+ }
11
+ /**
12
+ * `client.chatDeliveries` — the Tenant's deliveries across all Chat
13
+ * Connections behind `GET /v1/chat-deliveries`, newest first.
14
+ */
15
+ export interface ChatDeliveriesResource {
16
+ /**
17
+ * Lists one page of Chat delivery records.
18
+ * @param input - filters and pagination options.
19
+ * @returns The chat deliveries response.
20
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
21
+ */
22
+ list(input?: ChatDeliveriesListOptions): Promise<ChatDeliveriesResponse>;
23
+ }
2
24
  /**
3
25
  * `client.chatDeliveries` — `GET /v1/chat-deliveries`, the Tenant-wide
4
26
  * delivery feed across all Chat Connections, newest first.
@@ -1,4 +1,4 @@
1
- import { chatDeliveriesResponseSchema } from "../contracts/entities/chat-connections.js";
1
+ import { chatDeliveriesResponseSchema, } from "../contracts/entities/chat-connections.js";
2
2
  import { requestJson } from "../http.js";
3
3
  /**
4
4
  * `client.chatDeliveries` — `GET /v1/chat-deliveries`, the Tenant-wide
@@ -8,9 +8,6 @@ import { requestJson } from "../http.js";
8
8
  */
9
9
  export function createChatDeliveriesResource(config) {
10
10
  return {
11
- /**
12
- * Lists one page of chat deliveries.
13
- */
14
11
  async list({ abortSignal, status, ...query } = {}) {
15
12
  return await requestJson(config, "/v1/chat-deliveries", {
16
13
  query: {
@@ -18,6 +15,7 @@ export function createChatDeliveriesResource(config) {
18
15
  // Multi-value filters serialize as one comma-separated parameter.
19
16
  status: status?.length ? status.join(",") : undefined,
20
17
  },
18
+ credentialBearing: true,
21
19
  signal: abortSignal,
22
20
  }, chatDeliveriesResponseSchema);
23
21
  },
@@ -1,4 +1,66 @@
1
- import type { HttpConfig, McpConnectionsResource } from "../types.ts";
1
+ import { type CreateMcpConnectionBody, type McpConnectionReconnectResult, type McpConnectionResponse, type McpConnectionsResponse, type McpConnectionTestResponse, type ReconnectMcpConnectionBody, type UpdateMcpConnectionBody } from "../contracts/entities/mcp-connections.ts";
2
+ import type { HttpConfig, ResourceRequestOptions } from "../types.ts";
3
+ export interface McpConnectionsResource {
4
+ /**
5
+ * Creates the MCP Connection.
6
+ * @param input - creation fields; optional abortSignal.
7
+ * @returns The mcp connection response.
8
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
9
+ */
10
+ create(input: CreateMcpConnectionBody & ResourceRequestOptions): Promise<McpConnectionResponse>;
11
+ /**
12
+ * Deletes the MCP Connection.
13
+ * @param input - `mcpConnectionId`; 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
+ mcpConnectionId: string;
19
+ } & ResourceRequestOptions): Promise<void>;
20
+ /**
21
+ * Retrieves the MCP Connection.
22
+ * @param input - `mcpConnectionId`; optional abortSignal.
23
+ * @returns The mcp connection response.
24
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
25
+ */
26
+ get(input: {
27
+ mcpConnectionId: string;
28
+ } & ResourceRequestOptions): Promise<McpConnectionResponse>;
29
+ /**
30
+ * Lists available MCP Connection records.
31
+ * @param input - optional abortSignal.
32
+ * @returns The mcp connections response.
33
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
34
+ */
35
+ list(input?: ResourceRequestOptions): Promise<McpConnectionsResponse>;
36
+ /**
37
+ * Reconnects the MCP Connection.
38
+ * @param input - `mcpConnectionId`; fields to change; optional abortSignal.
39
+ * @returns The mcp connection reconnect result.
40
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
41
+ */
42
+ reconnect(input: ReconnectMcpConnectionBody & {
43
+ mcpConnectionId: string;
44
+ } & ResourceRequestOptions): Promise<McpConnectionReconnectResult>;
45
+ /**
46
+ * Tests the MCP Connection.
47
+ * @param input - `mcpConnectionId`; optional abortSignal.
48
+ * @returns The mcp connection test response.
49
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
50
+ */
51
+ test(input: {
52
+ mcpConnectionId: string;
53
+ } & ResourceRequestOptions): Promise<McpConnectionTestResponse>;
54
+ /**
55
+ * Updates the MCP Connection.
56
+ * @param input - `mcpConnectionId`; fields to change; optional abortSignal.
57
+ * @returns The mcp connection response.
58
+ * @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
59
+ */
60
+ update(input: UpdateMcpConnectionBody & {
61
+ mcpConnectionId: string;
62
+ } & ResourceRequestOptions): Promise<McpConnectionResponse>;
63
+ }
2
64
  /**
3
65
  * Builds the Mcp Connections operations using the shared HTTP configuration.
4
66
  * @param config - Shared authentication and transport configuration.
@@ -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.
@@ -8,54 +8,40 @@ import { apiPath, requestJson } from "../http.js";
8
8
  export function createMcpConnectionsResource(config) {
9
9
  const create = (async ({ abortSignal, ...body }) => requestJson(config, "/v1/mcp-connections", {
10
10
  json: body,
11
+ credentialBearing: true,
11
12
  signal: abortSignal,
12
13
  method: "POST",
13
14
  }, mcpConnectionResponseSchema));
14
15
  return {
15
16
  create,
16
- /**
17
- * Lists one page of mcp connections.
18
- */
19
17
  async list({ abortSignal } = {}) {
20
- return await requestJson(config, "/v1/mcp-connections", { signal: abortSignal }, mcpConnectionsResponseSchema);
18
+ return await requestJson(config, "/v1/mcp-connections", { credentialBearing: true, signal: abortSignal }, mcpConnectionsResponseSchema);
21
19
  },
22
- /**
23
- * Retrieves mcp connections.
24
- */
25
20
  async get({ mcpConnectionId, abortSignal }) {
26
- return await requestJson(config, apiPath `/v1/mcp-connections/${mcpConnectionId}`, { signal: abortSignal }, mcpConnectionResponseSchema);
21
+ return await requestJson(config, apiPath `/v1/mcp-connections/${mcpConnectionId}`, { credentialBearing: true, signal: abortSignal }, mcpConnectionResponseSchema);
27
22
  },
28
- /**
29
- * Updates mcp connections.
30
- */
31
23
  async update({ mcpConnectionId, abortSignal, ...body }) {
32
24
  return await requestJson(config, apiPath `/v1/mcp-connections/${mcpConnectionId}`, {
33
- json: updateMcpConnectionBodySchema.parse(body),
25
+ json: body,
26
+ credentialBearing: true,
34
27
  signal: abortSignal,
35
28
  method: "PATCH",
36
29
  }, mcpConnectionResponseSchema);
37
30
  },
38
- /**
39
- * Deletes mcp connections.
40
- */
41
31
  async delete({ mcpConnectionId, abortSignal }) {
42
32
  await requestJson(config, apiPath `/v1/mcp-connections/${mcpConnectionId}`, {
43
33
  method: "DELETE",
34
+ credentialBearing: true,
44
35
  signal: abortSignal,
45
36
  });
46
37
  },
47
- /**
48
- * Tests mcp connections.
49
- */
50
38
  async test({ mcpConnectionId, abortSignal }) {
51
- return await requestJson(config, apiPath `/v1/mcp-connections/${mcpConnectionId}/test`, { method: "POST", signal: abortSignal }, mcpConnectionTestResponseSchema);
39
+ return await requestJson(config, apiPath `/v1/mcp-connections/${mcpConnectionId}/test`, { method: "POST", credentialBearing: true, signal: abortSignal }, mcpConnectionTestResponseSchema);
52
40
  },
53
- /**
54
- * Reconnects mcp connections.
55
- */
56
41
  async reconnect({ mcpConnectionId, abortSignal, ...body }) {
57
42
  return await requestJson(config, apiPath `/v1/mcp-connections/${mcpConnectionId}/reconnect`, {
58
- json: reconnectMcpConnectionBodySchema.parse(body),
43
+ json: body,
44
+ credentialBearing: true,
59
45
  signal: abortSignal,
60
46
  method: "POST",
61
47
  }, 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,30 +9,29 @@ 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
- return await requestJson(config, "/v1/merchant-connection", { signal: abortSignal }, merchantConnectionResponseSchema);
13
+ return await requestJson(config, "/v1/merchant-connection", { credentialBearing: true, signal: abortSignal }, merchantConnectionResponseSchema);
17
14
  },
18
- /**
19
- * Creates merchant connection.
20
- */
21
15
  async create({ abortSignal, ...body }) {
22
- return await requestJson(config, "/v1/merchant-connection", { json: body, method: "POST", signal: abortSignal }, merchantConnectionResponseSchema);
16
+ return await requestJson(config, "/v1/merchant-connection", {
17
+ json: body,
18
+ method: "POST",
19
+ credentialBearing: true,
20
+ signal: abortSignal,
21
+ }, merchantConnectionResponseSchema);
23
22
  },
24
- /**
25
- * Updates merchant connection.
26
- */
27
23
  async update({ abortSignal, ...body }) {
28
- return await requestJson(config, "/v1/merchant-connection", { json: body, method: "PATCH", signal: abortSignal }, merchantConnectionResponseSchema);
24
+ return await requestJson(config, "/v1/merchant-connection", {
25
+ json: body,
26
+ method: "PATCH",
27
+ credentialBearing: true,
28
+ signal: abortSignal,
29
+ }, merchantConnectionResponseSchema);
29
30
  },
30
- /**
31
- * Retires merchant connection.
32
- */
33
31
  async retire({ abortSignal } = {}) {
34
32
  await requestJson(config, "/v1/merchant-connection", {
35
33
  method: "DELETE",
34
+ credentialBearing: true,
36
35
  signal: abortSignal,
37
36
  });
38
37
  },
@@ -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",