@blazingagents/sdk 0.56.1 → 0.57.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contracts/api-error-codes.d.ts +1 -1
- package/dist/contracts/api-error-codes.js +1 -5
- package/dist/contracts/api.d.ts +8 -5
- package/dist/contracts/api.js +7 -0
- package/dist/contracts/entities/artifacts.d.ts +2 -2
- package/dist/contracts/entities/artifacts.js +1 -1
- package/dist/contracts/entities/attribution.d.ts +1 -1
- package/dist/contracts/entities/attribution.js +1 -1
- package/dist/contracts/entities/chat-connections.d.ts +1 -1
- package/dist/contracts/entities/chat-connections.js +2 -3
- package/dist/contracts/entities/mcp-connections.d.ts +6 -2
- package/dist/contracts/entities/mcp-connections.js +5 -11
- package/dist/contracts/entities/memories.d.ts +0 -13
- package/dist/contracts/entities/memories.js +0 -5
- package/dist/contracts/entities/merchant.d.ts +7 -88
- package/dist/contracts/entities/merchant.js +7 -22
- package/dist/contracts/entities/providers.d.ts +8 -5
- package/dist/contracts/entities/providers.js +7 -18
- package/dist/contracts/entities/session-inputs.d.ts +1 -1
- package/dist/contracts/entities/session-inputs.js +1 -1
- package/dist/contracts/entities/sessions.d.ts +8 -3
- package/dist/contracts/entities/sessions.js +4 -3
- package/dist/contracts/entities/skills.d.ts +27 -25
- package/dist/contracts/entities/skills.js +2 -2
- package/dist/contracts/entities/tasks.d.ts +0 -5
- package/dist/contracts/entities/tasks.js +5 -22
- package/dist/contracts/index.d.ts +4 -4
- package/dist/contracts/index.js +4 -4
- package/dist/contracts/utils.d.ts +9 -0
- package/dist/contracts/utils.js +16 -0
- package/dist/http.d.ts +6 -0
- package/dist/http.js +10 -0
- package/dist/index.d.ts +1 -1
- package/dist/relay.js +1 -1
- package/dist/resources/agents.d.ts +2 -2
- package/dist/resources/agents.js +3 -3
- package/dist/resources/artifacts.d.ts +1 -0
- package/dist/resources/artifacts.js +1 -0
- package/dist/resources/memories.d.ts +7 -7
- package/dist/resources/memories.js +4 -4
- package/dist/resources/merchant-bindings.d.ts +3 -3
- package/dist/resources/merchant-bindings.js +2 -2
- package/dist/resources/merchant-connection.d.ts +5 -5
- package/dist/resources/merchant-connection.js +3 -3
- package/dist/resources/merchant-usage-events.d.ts +9 -9
- package/dist/resources/merchant-usage-events.js +5 -5
- package/dist/resources/skills.js +1 -9
- package/dist/resources/tasks.d.ts +10 -7
- package/dist/resources/tasks.js +9 -4
- package/dist/resources/workspaces.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CreateMerchantConnectionBody, type MerchantConnectionResponse, type UpdateMerchantConnectionBody } from "../contracts/entities/merchant.ts";
|
|
1
|
+
import { type CreateMerchantConnectionBody, type MerchantConnection, type MerchantConnectionResponse, type UpdateMerchantConnectionBody } from "../contracts/entities/merchant.ts";
|
|
2
2
|
import type { HttpConfig, ResourceRequestOptions } from "../types.ts";
|
|
3
3
|
/**
|
|
4
4
|
* `client.merchantConnection` — the tenant's own Polar/Dodo merchant
|
|
@@ -9,10 +9,10 @@ export interface MerchantConnectionResource {
|
|
|
9
9
|
/**
|
|
10
10
|
* Creates the merchant connection.
|
|
11
11
|
* @param input - creation fields; optional abortSignal.
|
|
12
|
-
* @returns The merchant connection
|
|
12
|
+
* @returns The merchant connection.
|
|
13
13
|
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
14
14
|
*/
|
|
15
|
-
create(input: CreateMerchantConnectionBody & ResourceRequestOptions): Promise<
|
|
15
|
+
create(input: CreateMerchantConnectionBody & ResourceRequestOptions): Promise<MerchantConnection>;
|
|
16
16
|
/**
|
|
17
17
|
* Retrieves the merchant connection.
|
|
18
18
|
* @param input - optional abortSignal.
|
|
@@ -30,10 +30,10 @@ export interface MerchantConnectionResource {
|
|
|
30
30
|
/**
|
|
31
31
|
* Updates the merchant connection.
|
|
32
32
|
* @param input - fields to change; optional abortSignal.
|
|
33
|
-
* @returns The merchant connection
|
|
33
|
+
* @returns The merchant connection.
|
|
34
34
|
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
35
35
|
*/
|
|
36
|
-
update(input: UpdateMerchantConnectionBody & ResourceRequestOptions): Promise<
|
|
36
|
+
update(input: UpdateMerchantConnectionBody & ResourceRequestOptions): Promise<MerchantConnection>;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
39
|
* `client.merchantConnection` — get/create/update/retire over
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { merchantConnectionResponseSchema, } from "../contracts/entities/merchant.js";
|
|
1
|
+
import { merchantConnectionResponseSchema, merchantConnectionSchema, } from "../contracts/entities/merchant.js";
|
|
2
2
|
import { requestJson } from "../http.js";
|
|
3
3
|
/**
|
|
4
4
|
* `client.merchantConnection` — get/create/update/retire over
|
|
@@ -18,7 +18,7 @@ export function createMerchantConnectionResource(config) {
|
|
|
18
18
|
method: "POST",
|
|
19
19
|
credentialBearing: true,
|
|
20
20
|
signal: abortSignal,
|
|
21
|
-
},
|
|
21
|
+
}, merchantConnectionSchema);
|
|
22
22
|
},
|
|
23
23
|
async update({ abortSignal, ...body }) {
|
|
24
24
|
return await requestJson(config, "/v1/merchant-connection", {
|
|
@@ -26,7 +26,7 @@ export function createMerchantConnectionResource(config) {
|
|
|
26
26
|
method: "PATCH",
|
|
27
27
|
credentialBearing: true,
|
|
28
28
|
signal: abortSignal,
|
|
29
|
-
},
|
|
29
|
+
}, merchantConnectionSchema);
|
|
30
30
|
},
|
|
31
31
|
async retire({ abortSignal } = {}) {
|
|
32
32
|
await requestJson(config, "/v1/merchant-connection", {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type MerchantUsageEvent, type MerchantUsageEventStatus, type MerchantUsageEventsResponse, type MerchantUsageSummary } from "../contracts/entities/merchant.ts";
|
|
2
2
|
import type { HttpConfig, ResourceRequestOptions } from "../types.ts";
|
|
3
3
|
export interface MerchantUsageEventsListOptions extends ResourceRequestOptions {
|
|
4
4
|
cursor?: string;
|
|
@@ -14,21 +14,21 @@ export interface MerchantUsageEventsResource {
|
|
|
14
14
|
/**
|
|
15
15
|
* Discards the merchant usage event.
|
|
16
16
|
* @param input - `eventId`; optional abortSignal.
|
|
17
|
-
* @returns The merchant usage event
|
|
17
|
+
* @returns The merchant usage event.
|
|
18
18
|
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
19
19
|
*/
|
|
20
20
|
discard(input: {
|
|
21
21
|
eventId: string;
|
|
22
|
-
} & ResourceRequestOptions): Promise<
|
|
22
|
+
} & ResourceRequestOptions): Promise<MerchantUsageEvent>;
|
|
23
23
|
/**
|
|
24
24
|
* Retrieves the merchant usage event.
|
|
25
25
|
* @param input - `eventId`; optional abortSignal.
|
|
26
|
-
* @returns The merchant usage event
|
|
26
|
+
* @returns The merchant usage event.
|
|
27
27
|
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
28
28
|
*/
|
|
29
29
|
get(input: {
|
|
30
30
|
eventId: string;
|
|
31
|
-
} & ResourceRequestOptions): Promise<
|
|
31
|
+
} & ResourceRequestOptions): Promise<MerchantUsageEvent>;
|
|
32
32
|
/**
|
|
33
33
|
* Lists one page of merchant usage event records.
|
|
34
34
|
* @param input - filters and pagination options.
|
|
@@ -39,21 +39,21 @@ export interface MerchantUsageEventsResource {
|
|
|
39
39
|
/**
|
|
40
40
|
* Sends a `failed` event, or a `pending` event whose delivery stopped, to the provider again. Blazing Agents retries a stopped delivery on its own after 5, 10, 20 and 40 minutes; after the fourth automatic retry the event stays `pending` until you retry it. Retrying is safe: the provider drops duplicates by the event ID.
|
|
41
41
|
* @param input - `eventId`; optional abortSignal.
|
|
42
|
-
* @returns The merchant usage event
|
|
42
|
+
* @returns The merchant usage event.
|
|
43
43
|
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
44
44
|
*/
|
|
45
45
|
retry(input: {
|
|
46
46
|
eventId: string;
|
|
47
|
-
} & ResourceRequestOptions): Promise<
|
|
47
|
+
} & ResourceRequestOptions): Promise<MerchantUsageEvent>;
|
|
48
48
|
/**
|
|
49
49
|
* Retrieves merchant usage delivery totals for the selected day range.
|
|
50
50
|
* @param input - Lookback window in `days` and optional abortSignal.
|
|
51
|
-
* @returns The merchant usage summary
|
|
51
|
+
* @returns The merchant usage summary.
|
|
52
52
|
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
53
53
|
*/
|
|
54
54
|
summary(input?: {
|
|
55
55
|
days?: number;
|
|
56
|
-
} & ResourceRequestOptions): Promise<
|
|
56
|
+
} & ResourceRequestOptions): Promise<MerchantUsageSummary>;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* `client.merchantUsageEvents` — the immutable usage-event ledger over
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { merchantUsageEventSchema, merchantUsageEventsResponseSchema, merchantUsageSummarySchema, } from "../contracts/entities/merchant.js";
|
|
2
2
|
import { apiPath, requestJson } from "../http.js";
|
|
3
3
|
/**
|
|
4
4
|
* `client.merchantUsageEvents` — the immutable usage-event ledger over
|
|
@@ -13,16 +13,16 @@ export function createMerchantUsageEventsResource(config) {
|
|
|
13
13
|
return await requestJson(config, "/v1/merchant-usage-events", { query, signal: abortSignal }, merchantUsageEventsResponseSchema);
|
|
14
14
|
},
|
|
15
15
|
async get({ eventId, abortSignal }) {
|
|
16
|
-
return await requestJson(config, apiPath `/v1/merchant-usage-events/${eventId}`, { signal: abortSignal },
|
|
16
|
+
return await requestJson(config, apiPath `/v1/merchant-usage-events/${eventId}`, { signal: abortSignal }, merchantUsageEventSchema);
|
|
17
17
|
},
|
|
18
18
|
async summary({ abortSignal, ...query } = {}) {
|
|
19
|
-
return await requestJson(config, "/v1/merchant-usage-events/summary", { query, signal: abortSignal },
|
|
19
|
+
return await requestJson(config, "/v1/merchant-usage-events/summary", { query, signal: abortSignal }, merchantUsageSummarySchema);
|
|
20
20
|
},
|
|
21
21
|
async retry({ eventId, abortSignal }) {
|
|
22
|
-
return await requestJson(config, apiPath `/v1/merchant-usage-events/${eventId}/retry`, { method: "POST", signal: abortSignal },
|
|
22
|
+
return await requestJson(config, apiPath `/v1/merchant-usage-events/${eventId}/retry`, { method: "POST", signal: abortSignal }, merchantUsageEventSchema);
|
|
23
23
|
},
|
|
24
24
|
async discard({ eventId, abortSignal }) {
|
|
25
|
-
return await requestJson(config, apiPath `/v1/merchant-usage-events/${eventId}/discard`, { method: "POST", signal: abortSignal },
|
|
25
|
+
return await requestJson(config, apiPath `/v1/merchant-usage-events/${eventId}/discard`, { method: "POST", signal: abortSignal }, merchantUsageEventSchema);
|
|
26
26
|
},
|
|
27
27
|
};
|
|
28
28
|
}
|
package/dist/resources/skills.js
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import { skillCopyResultsSchema, skillDetailSchema, skillsListResponseSchema, } from "../contracts/entities/skills.js";
|
|
2
|
-
import { apiPath, isRequestAborted, requestAbortedError, requestJson, requestStream, } from "../http.js";
|
|
3
|
-
/**
|
|
4
|
-
* Builds the `Idempotency-Key` header, or none when the caller set no key.
|
|
5
|
-
*/
|
|
6
|
-
function idempotencyHeaders(idempotencyKey) {
|
|
7
|
-
return idempotencyKey === undefined
|
|
8
|
-
? undefined
|
|
9
|
-
: { "Idempotency-Key": idempotencyKey };
|
|
10
|
-
}
|
|
2
|
+
import { apiPath, idempotencyHeaders, isRequestAborted, requestAbortedError, requestJson, requestStream, } from "../http.js";
|
|
11
3
|
/**
|
|
12
4
|
* Builds a Skill file URL with encoded Agent, Skill, and file path values.
|
|
13
5
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CreateTaskBody, type CreateTaskResponse, type
|
|
1
|
+
import { type CreateTaskBody, type CreateTaskResponse, type CreateTaskRunResponse, type TaskResponse, type TaskRunMessagesResponse, type TaskRunResponse, type TaskRunsListResponse, type TasksListResponse, type UpdateTaskBody } from "../contracts/entities/tasks.ts";
|
|
2
2
|
import type { HttpConfig, ResourceRequestOptions } from "../types.ts";
|
|
3
3
|
export interface TasksListOptions extends ResourceRequestOptions {
|
|
4
4
|
agentId?: string;
|
|
@@ -27,18 +27,21 @@ export interface TasksResource {
|
|
|
27
27
|
runId: string;
|
|
28
28
|
} & ResourceRequestOptions): Promise<void>;
|
|
29
29
|
/**
|
|
30
|
-
* Creates the Task.
|
|
31
|
-
* @param input - creation fields; optional abortSignal.
|
|
30
|
+
* Creates the Task. Retry a lost answer with the same `idempotencyKey` and the request returns the current Task and its original initial run.
|
|
31
|
+
* @param input - creation fields; optional `idempotencyKey` and abortSignal.
|
|
32
32
|
* @returns The create task response.
|
|
33
33
|
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
34
34
|
*/
|
|
35
|
-
create(input: CreateTaskBody &
|
|
35
|
+
create(input: CreateTaskBody & {
|
|
36
|
+
idempotencyKey?: string;
|
|
37
|
+
} & ResourceRequestOptions): Promise<CreateTaskResponse>;
|
|
36
38
|
/**
|
|
37
|
-
* Creates a Task run.
|
|
38
|
-
* @param input - `taskId`;
|
|
39
|
+
* Creates a Task run. Retry with the same `idempotencyKey` and the request returns the same run instead of starting another.
|
|
40
|
+
* @param input - `taskId`; optional `idempotencyKey` and abortSignal.
|
|
39
41
|
* @returns The create task run response.
|
|
40
42
|
*/
|
|
41
|
-
createRun(input:
|
|
43
|
+
createRun(input: {
|
|
44
|
+
idempotencyKey?: string;
|
|
42
45
|
taskId: string;
|
|
43
46
|
} & ResourceRequestOptions): Promise<CreateTaskRunResponse>;
|
|
44
47
|
/**
|
package/dist/resources/tasks.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createTaskResponseSchema, createTaskRunResponseSchema, taskResponseSchema, taskRunMessagesResponseSchema, taskRunResponseSchema, taskRunsListResponseSchema, tasksListResponseSchema, } from "../contracts/entities/tasks.js";
|
|
2
|
-
import { apiPath, requestJson } from "../http.js";
|
|
2
|
+
import { apiPath, idempotencyHeaders, requestJson } from "../http.js";
|
|
3
3
|
/**
|
|
4
4
|
* `client.tasks` — CRUD + runs over `/v1/tasks`. Runs are listed/get/
|
|
5
5
|
* canceled/transcripted via `/v1/tasks/:taskId/runs/...`. All lists are
|
|
@@ -9,8 +9,9 @@ import { apiPath, requestJson } from "../http.js";
|
|
|
9
9
|
*/
|
|
10
10
|
export function createTasksResource(config) {
|
|
11
11
|
return {
|
|
12
|
-
async create({ abortSignal, ...body }) {
|
|
12
|
+
async create({ idempotencyKey, abortSignal, ...body }) {
|
|
13
13
|
return await requestJson(config, "/v1/tasks", {
|
|
14
|
+
headers: idempotencyHeaders(idempotencyKey),
|
|
14
15
|
json: body,
|
|
15
16
|
signal: abortSignal,
|
|
16
17
|
method: "POST",
|
|
@@ -43,8 +44,12 @@ export function createTasksResource(config) {
|
|
|
43
44
|
signal: abortSignal,
|
|
44
45
|
});
|
|
45
46
|
},
|
|
46
|
-
async createRun({ taskId,
|
|
47
|
-
return await requestJson(config, apiPath `/v1/tasks/${taskId}/runs`, {
|
|
47
|
+
async createRun({ taskId, idempotencyKey, abortSignal }) {
|
|
48
|
+
return await requestJson(config, apiPath `/v1/tasks/${taskId}/runs`, {
|
|
49
|
+
headers: idempotencyHeaders(idempotencyKey),
|
|
50
|
+
method: "POST",
|
|
51
|
+
signal: abortSignal,
|
|
52
|
+
}, createTaskRunResponseSchema);
|
|
48
53
|
},
|
|
49
54
|
async listRuns({ taskId, ...options }) {
|
|
50
55
|
return await requestJson(config, apiPath `/v1/tasks/${taskId}/runs`, {
|
|
@@ -34,7 +34,7 @@ export function createWorkspacesResource(config) {
|
|
|
34
34
|
}, workspacesListResponseSchema);
|
|
35
35
|
},
|
|
36
36
|
async update({ workspaceId, abortSignal, ...body }) {
|
|
37
|
-
return await requestJson(config, apiPath `/v1/workspaces/${workspaceId}`, { json: body, signal: abortSignal, method: "
|
|
37
|
+
return await requestJson(config, apiPath `/v1/workspaces/${workspaceId}`, { json: body, signal: abortSignal, method: "PATCH" }, workspaceSchema);
|
|
38
38
|
},
|
|
39
39
|
};
|
|
40
40
|
}
|