@blazingagents/sdk 0.9.2 → 0.10.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.
@@ -27,6 +27,17 @@ export declare const tenantResponseSchema: z.ZodObject<{
27
27
  inactive: "inactive";
28
28
  }>;
29
29
  }, z.core.$strip>;
30
+ /**
31
+ * Tenant deletion lifecycle — `requestedAt` marks the tenant deleting and
32
+ * `deletesAt` is the scheduled permanent-deletion time (24 hours after
33
+ * confirmation, cancellable until then). Deletion is dashboard-only; the
34
+ * shape rides `GET /v1/tenant` settings so the dashboard can render it.
35
+ */
36
+ export declare const tenantDeletionSchema: z.ZodObject<{
37
+ deletesAt: z.ZodISODateTime;
38
+ requestedAt: z.ZodISODateTime;
39
+ }, z.core.$strict>;
40
+ export type TenantDeletion = z.infer<typeof tenantDeletionSchema>;
30
41
  /**
31
42
  * Quota — `GET/PATCH /v1/tenant` carries the tenant's self-set quota.
32
43
  * `null` means unlimited (no quota row).
@@ -51,8 +62,14 @@ export declare const tenantSettingsResponseSchema: z.ZodObject<{
51
62
  monthlyRequestLimit: z.ZodNullable<z.ZodNumber>;
52
63
  resetDay: z.ZodNumber;
53
64
  }, z.core.$strip>>;
65
+ deletion: z.ZodNullable<z.ZodObject<{
66
+ deletesAt: z.ZodISODateTime;
67
+ requestedAt: z.ZodISODateTime;
68
+ }, z.core.$strict>>;
69
+ monetizationEnabled: z.ZodBoolean;
54
70
  }, z.core.$strip>;
55
71
  export declare const updateTenantSettingsBodySchema: z.ZodObject<{
72
+ monetizationEnabled: z.ZodOptional<z.ZodBoolean>;
56
73
  name: z.ZodOptional<z.ZodString>;
57
74
  quota: z.ZodOptional<z.ZodNullable<z.ZodObject<{
58
75
  monthlyTokenLimit: z.ZodNullable<z.ZodNumber>;
@@ -20,6 +20,18 @@ export const subscriptionStatusSchema = z.enum(["active", "inactive"]);
20
20
  export const tenantResponseSchema = tenantSchema
21
21
  .extend({ subscriptionStatus: subscriptionStatusSchema })
22
22
  .strip();
23
+ /**
24
+ * Tenant deletion lifecycle — `requestedAt` marks the tenant deleting and
25
+ * `deletesAt` is the scheduled permanent-deletion time (24 hours after
26
+ * confirmation, cancellable until then). Deletion is dashboard-only; the
27
+ * shape rides `GET /v1/tenant` settings so the dashboard can render it.
28
+ */
29
+ export const tenantDeletionSchema = z
30
+ .object({
31
+ deletesAt: z.iso.datetime({ offset: true }),
32
+ requestedAt: z.iso.datetime({ offset: true }),
33
+ })
34
+ .strict();
23
35
  /**
24
36
  * Quota — `GET/PATCH /v1/tenant` carries the tenant's self-set quota.
25
37
  * `null` means unlimited (no quota row).
@@ -42,9 +54,15 @@ export const tenantSettingsSchema = z
42
54
  quota: quotaSchema.strip().nullable(),
43
55
  })
44
56
  .strip();
45
- export const tenantSettingsResponseSchema = tenantSettingsSchema;
57
+ export const tenantSettingsResponseSchema = tenantSettingsSchema
58
+ .extend({
59
+ deletion: tenantDeletionSchema.nullable(),
60
+ monetizationEnabled: z.boolean(),
61
+ })
62
+ .strip();
46
63
  export const updateTenantSettingsBodySchema = z
47
64
  .object({
65
+ monetizationEnabled: z.boolean().optional(),
48
66
  name: z.string().trim().min(1).max(MAX_TENANT_NAME_LENGTH).optional(),
49
67
  quota: quotaSchema.nullable().optional(),
50
68
  })
@@ -35,6 +35,8 @@ export declare const sessionIdSchema: z.ZodString;
35
35
  export declare const apiKeyIdSchema: z.ZodString;
36
36
  export declare const providerIdSchema: z.ZodString;
37
37
  export declare const mcpConnectionIdSchema: z.ZodString;
38
+ export declare const merchantConnectionIdSchema: z.ZodString;
39
+ export declare const merchantUsageEventIdSchema: z.ZodString;
38
40
  export declare const workspaceIdSchema: z.ZodString;
39
41
  export declare const artifactIdSchema: z.ZodString;
40
42
  export declare const taskIdSchema: z.ZodString;
@@ -57,6 +57,12 @@ export const sessionIdSchema = z.string().regex(/^ss_[0-9A-Za-z]{16}$/);
57
57
  export const apiKeyIdSchema = z.string().regex(/^ak_[0-9A-Za-z]{16}$/);
58
58
  export const providerIdSchema = z.string().regex(/^prv_[0-9A-Za-z]{16}$/);
59
59
  export const mcpConnectionIdSchema = z.string().regex(/^mcp_[0-9A-Za-z]{16}$/);
60
+ export const merchantConnectionIdSchema = z
61
+ .string()
62
+ .regex(/^mch_[0-9A-Za-z]{16}$/);
63
+ export const merchantUsageEventIdSchema = z
64
+ .string()
65
+ .regex(/^mev_[0-9A-Za-z]{16}$/);
60
66
  export const workspaceIdSchema = z.string().regex(/^ws_[0-9A-Za-z]{16}$/);
61
67
  export const artifactIdSchema = z.string().regex(/^at_[0-9A-Za-z]{16}$/);
62
68
  export const taskIdSchema = z.string().regex(/^tk_[0-9A-Za-z]{16}$/);
@@ -10,13 +10,14 @@ export { blazingAgentsChatMessageMetadataSchema, chatModeSchema, chatRequestBody
10
10
  export { chatConfigurationSchema, chatConnectionSchema, chatConnectionsResponseSchema, chatCredentialsSchema, chatHealthCheckSchema, chatHealthSchema, chatIdentitySchema, createChatConnectionBodySchema, rotateChatConnectionBodySchema, updateChatConnectionBodySchema, } from "./entities/chat-connections.ts";
11
11
  export { approveMcpOauthAuthorizationBodySchema, createMcpConnectionBodySchema, mcpAttachmentResponseSchema, mcpAttachmentsResponseSchema, mcpConnectionAuthTypeSchema, mcpConnectionOauthConnectResponseSchema, mcpConnectionReconnectResultSchema, mcpConnectionResponseSchema, mcpConnectionStatusSchema, mcpConnectionsResponseSchema, mcpConnectionTestErrorCodeSchema, mcpConnectionTestResponseSchema, mcpOauthAuthorizationLaunchResponseSchema, reconnectMcpConnectionBodySchema, updateMcpAttachmentBodySchema, updateMcpConnectionBodySchema, } from "./entities/mcp-connections.ts";
12
12
  export { createMemoryBodySchema, memoriesListResponseSchema, memoryResponseSchema, memorySchema, updateMemoryBodySchema, } from "./entities/memories.ts";
13
+ export { createMerchantConnectionBodySchema, merchantBindingResponseSchema, merchantBindingsResponseSchema, merchantConnectionResponseSchema, merchantConnectionSchema, merchantConnectionStatusSchema, merchantCustomerBindingSchema, merchantEnvironmentSchema, merchantGuardSchema, merchantProviderSchema, merchantUsageEventNextAction, merchantUsageEventNextActionSchema, merchantUsageEventSchema, merchantUsageEventStatusSchema, merchantUsageEventsResponseSchema, merchantUsageSummaryQuerySchema, merchantUsageSummaryResponseSchema, merchantUsageSummarySchema, merchantWorkflowIssueSchema, updateMerchantConnectionBodySchema, upsertMerchantBindingBodySchema, } from "./entities/merchant.ts";
13
14
  export { createPromptBodySchema, promptResponseSchema, promptSchema, promptsResponseSchema, updatePromptBodySchema, } from "./entities/prompts.ts";
14
15
  export { createProviderBodySchema, providerListItemSchema, providerModelsResponseSchema, providerResponseSchema, providersResponseSchema, providerTypeSchema, thinkingLevelsResponseSchema, updateProviderBodySchema, } from "./entities/providers.ts";
15
16
  export type { ToolApprovalDecisionResponse, ToolApprovalsResponse, } from "./entities/sessions.ts";
16
17
  export { decideToolApprovalBodySchema, latestSessionListItemSchema, latestSessionsListResponseSchema, sessionListItemSchema, sessionMessageSchema, sessionMessagesResponseSchema, sessionsListResponseSchema, toolApprovalContinuationStateSchema, toolApprovalDecisionResponseSchema, toolApprovalStateSchema, toolApprovalsResponseSchema, } from "./entities/sessions.ts";
17
18
  export { copySkillBodySchema, createSkillBodySchema, skillCopyResultsSchema, skillDetailSchema, skillsListResponseSchema, } from "./entities/skills.ts";
18
19
  export { createTaskBodySchema, createTaskResponseSchema, createTaskRunBodySchema, createTaskRunResponseSchema, taskListItemSchema, taskResponseSchema, taskRunMessagesResponseSchema, taskRunResponseSchema, taskRunSchema, taskRunStatusSchema, taskRunsListResponseSchema, taskScheduleKindSchema, taskSchema, tasksListResponseSchema, updateTaskBodySchema, } from "./entities/tasks.ts";
19
- export { quotaSchema, subscriptionStatusSchema, tenantResponseSchema, tenantSchema, tenantSettingsResponseSchema, updateTenantSettingsBodySchema, } from "./entities/tenants.ts";
20
+ export { quotaSchema, subscriptionStatusSchema, tenantDeletionSchema, tenantResponseSchema, tenantSchema, tenantSettingsResponseSchema, updateTenantSettingsBodySchema, } from "./entities/tenants.ts";
20
21
  export type { UsageBucket, UsageOverviewQuery, UsageOverviewResponse, UsageResponse, UsageTotals, } from "./entities/usage.ts";
21
22
  export { usageOverviewQuerySchema, usageOverviewResponseSchema, usageResponseSchema, } from "./entities/usage.ts";
22
23
  export { createWorkspaceBodySchema, updateWorkspaceBodySchema, workspaceSchema, workspacesListResponseSchema, } from "./entities/workspaces.ts";
@@ -9,12 +9,13 @@ export { blazingAgentsChatMessageMetadataSchema, chatModeSchema, chatRequestBody
9
9
  export { chatConfigurationSchema, chatConnectionSchema, chatConnectionsResponseSchema, chatCredentialsSchema, chatHealthCheckSchema, chatHealthSchema, chatIdentitySchema, createChatConnectionBodySchema, rotateChatConnectionBodySchema, updateChatConnectionBodySchema, } from "./entities/chat-connections.js";
10
10
  export { approveMcpOauthAuthorizationBodySchema, createMcpConnectionBodySchema, mcpAttachmentResponseSchema, mcpAttachmentsResponseSchema, mcpConnectionAuthTypeSchema, mcpConnectionOauthConnectResponseSchema, mcpConnectionReconnectResultSchema, mcpConnectionResponseSchema, mcpConnectionStatusSchema, mcpConnectionsResponseSchema, mcpConnectionTestErrorCodeSchema, mcpConnectionTestResponseSchema, mcpOauthAuthorizationLaunchResponseSchema, reconnectMcpConnectionBodySchema, updateMcpAttachmentBodySchema, updateMcpConnectionBodySchema, } from "./entities/mcp-connections.js";
11
11
  export { createMemoryBodySchema, memoriesListResponseSchema, memoryResponseSchema, memorySchema, updateMemoryBodySchema, } from "./entities/memories.js";
12
+ export { createMerchantConnectionBodySchema, merchantBindingResponseSchema, merchantBindingsResponseSchema, merchantConnectionResponseSchema, merchantConnectionSchema, merchantConnectionStatusSchema, merchantCustomerBindingSchema, merchantEnvironmentSchema, merchantGuardSchema, merchantProviderSchema, merchantUsageEventNextAction, merchantUsageEventNextActionSchema, merchantUsageEventSchema, merchantUsageEventStatusSchema, merchantUsageEventsResponseSchema, merchantUsageSummaryQuerySchema, merchantUsageSummaryResponseSchema, merchantUsageSummarySchema, merchantWorkflowIssueSchema, updateMerchantConnectionBodySchema, upsertMerchantBindingBodySchema, } from "./entities/merchant.js";
12
13
  export { createPromptBodySchema, promptResponseSchema, promptSchema, promptsResponseSchema, updatePromptBodySchema, } from "./entities/prompts.js";
13
14
  export { createProviderBodySchema, providerListItemSchema, providerModelsResponseSchema, providerResponseSchema, providersResponseSchema, providerTypeSchema, thinkingLevelsResponseSchema, updateProviderBodySchema, } from "./entities/providers.js";
14
15
  export { decideToolApprovalBodySchema, latestSessionListItemSchema, latestSessionsListResponseSchema, sessionListItemSchema, sessionMessageSchema, sessionMessagesResponseSchema, sessionsListResponseSchema, toolApprovalContinuationStateSchema, toolApprovalDecisionResponseSchema, toolApprovalStateSchema, toolApprovalsResponseSchema, } from "./entities/sessions.js";
15
16
  export { copySkillBodySchema, createSkillBodySchema, skillCopyResultsSchema, skillDetailSchema, skillsListResponseSchema, } from "./entities/skills.js";
16
17
  export { createTaskBodySchema, createTaskResponseSchema, createTaskRunBodySchema, createTaskRunResponseSchema, taskListItemSchema, taskResponseSchema, taskRunMessagesResponseSchema, taskRunResponseSchema, taskRunSchema, taskRunStatusSchema, taskRunsListResponseSchema, taskScheduleKindSchema, taskSchema, tasksListResponseSchema, updateTaskBodySchema, } from "./entities/tasks.js";
17
- export { quotaSchema, subscriptionStatusSchema, tenantResponseSchema, tenantSchema, tenantSettingsResponseSchema, updateTenantSettingsBodySchema, } from "./entities/tenants.js";
18
+ export { quotaSchema, subscriptionStatusSchema, tenantDeletionSchema, tenantResponseSchema, tenantSchema, tenantSettingsResponseSchema, updateTenantSettingsBodySchema, } from "./entities/tenants.js";
18
19
  export { usageOverviewQuerySchema, usageOverviewResponseSchema, usageResponseSchema, } from "./entities/usage.js";
19
20
  export { createWorkspaceBodySchema, updateWorkspaceBodySchema, workspaceSchema, workspacesListResponseSchema, } from "./entities/workspaces.js";
20
21
  export { agentIdSchema, apiKeyTokenSchema, isAdminAgentId, promptIdSchema, sessionIdSchema, } from "./ids.js";
@@ -138,3 +138,12 @@ export declare const TENANT_CREATION_BURST_LIMIT = 60;
138
138
  export declare const TENANT_CREATION_BURST_WINDOW_MS = 60000;
139
139
  export declare const TENANT_CREATION_SUSTAINED_LIMIT = 1000;
140
140
  export declare const TENANT_CREATION_SUSTAINED_WINDOW_MS = 86400000;
141
+ /**
142
+ * Merchant monetization (ADR-0048) — bindings/usage-event list paging, guard
143
+ * rule bounds, and the delivery-health summary window.
144
+ */
145
+ export declare const DEFAULT_MERCHANT_LIST_LIMIT = 50;
146
+ export declare const MAX_MERCHANT_LIST_LIMIT = 200;
147
+ export declare const MAX_MERCHANT_PRODUCT_IDS = 100;
148
+ export declare const DEFAULT_MERCHANT_USAGE_SUMMARY_DAYS = 14;
149
+ export declare const MAX_MERCHANT_USAGE_SUMMARY_DAYS = 90;
@@ -140,3 +140,12 @@ export const TENANT_CREATION_BURST_LIMIT = 60;
140
140
  export const TENANT_CREATION_BURST_WINDOW_MS = 60_000;
141
141
  export const TENANT_CREATION_SUSTAINED_LIMIT = 1000;
142
142
  export const TENANT_CREATION_SUSTAINED_WINDOW_MS = 86_400_000;
143
+ /**
144
+ * Merchant monetization (ADR-0048) — bindings/usage-event list paging, guard
145
+ * rule bounds, and the delivery-health summary window.
146
+ */
147
+ export const DEFAULT_MERCHANT_LIST_LIMIT = 50;
148
+ export const MAX_MERCHANT_LIST_LIMIT = 200;
149
+ export const MAX_MERCHANT_PRODUCT_IDS = 100;
150
+ export const DEFAULT_MERCHANT_USAGE_SUMMARY_DAYS = 14;
151
+ export const MAX_MERCHANT_USAGE_SUMMARY_DAYS = 90;
package/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export type { Agent, AgentResponse, AgentsResponse, AgentVersion, AgentVersionsL
14
14
  export type { ArtifactDownloadUrlResponse, ArtifactListItem, ArtifactsListResponse, } from "./contracts/entities/artifacts.ts";
15
15
  export type { ChatConfiguration, ChatConnection, ChatConnectionsResponse, ChatCredentials, ChatHealth, ChatIdentity, CreateChatConnectionBody, RotateChatConnectionBody, UpdateChatConnectionBody, } from "./contracts/entities/chat-connections.ts";
16
16
  export type { CreateMcpConnectionBody, McpAttachmentResponse, McpAttachmentsResponse, McpConnectionAuthType, McpConnectionOauthConnectResponse, McpConnectionReconnectResult, McpConnectionResponse, McpConnectionStatus, McpConnectionTestResponse, ReconnectMcpConnectionBody, UpdateMcpAttachmentBody, UpdateMcpConnectionBody, } from "./contracts/entities/mcp-connections.ts";
17
+ export type { CreateMerchantConnectionBody, MerchantBindingResponse, MerchantBindingsResponse, MerchantConnection, MerchantConnectionResponse, MerchantCustomerBinding, MerchantGuard, MerchantProviderKind, MerchantUsageEvent, MerchantUsageEventResponse, MerchantUsageEventStatus, MerchantUsageEventsResponse, MerchantUsageSummary, MerchantUsageSummaryResponse, UpdateMerchantConnectionBody, UpsertMerchantBindingBody, } from "./contracts/entities/merchant.ts";
17
18
  export type { CreateProviderBody, ProviderListItem, ProviderModel, ProviderModelsResponse, ProviderResponse, ProvidersResponse, ProviderType, ThinkingLevelsResponse, UpdateProviderBody, } from "./contracts/entities/providers.ts";
18
19
  export type { ToolApprovalDecisionResponse, ToolApprovalState, ToolApprovalsResponse, } from "./contracts/entities/sessions.ts";
19
20
  export type { CreateSkillBody, Skill, SkillArchiveType, SkillCopyResult, SkillCopyResults, SkillDetail, SkillFile, SkillsListResponse, } from "./contracts/entities/skills.ts";
@@ -22,4 +23,4 @@ export type { CreateWorkspaceBody, UpdateWorkspaceBody, Workspace, WorkspaceNetw
22
23
  export { BlazingAgentsDirectChatTransport, type BlazingAgentsDirectChatTransportOptions, } from "./direct-chat-transport.ts";
23
24
  export { BlazingAgentsError } from "./errors.ts";
24
25
  export { createChatRelay, createCompletionRelay, type RelayContext, type SessionOwnershipStore, } from "./relay.ts";
25
- export type { AgentClient, AgentSkillsResource, AgentsListOptions, AgentsResource, AgentVersionsListOptions, ArtifactsResource, AttributionInput, BlazingAgentsErrorCode, BlazingAgentsOptions, BlazingAgentsRequestOptions, BlazingAgentsUIMessage, BlazingAgentsUIMessageChunk, ChatConnectionsResource, ChatInput, ChatMessageInput, ChatPromptInput, ChatResult, ChatTrigger, CompletionInput, CompletionPromptIdInput, CompletionPromptInput, CompletionResult, KnownBlazingAgentsErrorCode, LatestSessionsListOptions, McpConnectionsResource, MemoriesListOptions, MemoriesResource, ObjectInput, ObjectPromptIdInput, ObjectPromptInput, ObjectResult, PromptsResource, ProvidersResource, ResourceRequestOptions, ResponseObservation, SessionsResource, SkillsListOptions, TasksResource, TenantResource, TerminalStreamResult, UsageResource, WorkspacesListOptions, WorkspacesResource, } from "./types.ts";
26
+ export type { AgentClient, AgentSkillsResource, AgentsListOptions, AgentsResource, AgentVersionsListOptions, ArtifactsResource, AttributionInput, BlazingAgentsErrorCode, BlazingAgentsOptions, BlazingAgentsRequestOptions, BlazingAgentsUIMessage, BlazingAgentsUIMessageChunk, ChatConnectionsResource, ChatInput, ChatMessageInput, ChatPromptInput, ChatResult, ChatTrigger, CompletionInput, CompletionPromptIdInput, CompletionPromptInput, CompletionResult, KnownBlazingAgentsErrorCode, LatestSessionsListOptions, McpConnectionsResource, MemoriesListOptions, MemoriesResource, MerchantBindingsListOptions, MerchantBindingsResource, MerchantConnectionResource, MerchantUsageEventsListOptions, MerchantUsageEventsResource, ObjectInput, ObjectPromptIdInput, ObjectPromptInput, ObjectResult, PromptsResource, ProvidersResource, ResourceRequestOptions, ResponseObservation, SessionsResource, SkillsListOptions, TasksResource, TenantResource, TerminalStreamResult, UsageResource, WorkspacesListOptions, WorkspacesResource, } from "./types.ts";
@@ -0,0 +1,8 @@
1
+ import type { HttpConfig, MerchantBindingsResource } from "../types.ts";
2
+ /**
3
+ * `client.merchantBindings` — list/put/delete over
4
+ * `/v1/merchant-connection/bindings`. `put` upserts the end user's provider
5
+ * customer; the server validates the customer with the provider before
6
+ * storing.
7
+ */
8
+ export declare function createMerchantBindingsResource(config: HttpConfig): MerchantBindingsResource;
@@ -0,0 +1,21 @@
1
+ import { merchantBindingResponseSchema, merchantBindingsResponseSchema, } from "../contracts/entities/merchant.js";
2
+ import { requestJson } from "../http.js";
3
+ /**
4
+ * `client.merchantBindings` — list/put/delete over
5
+ * `/v1/merchant-connection/bindings`. `put` upserts the end user's provider
6
+ * customer; the server validates the customer with the provider before
7
+ * storing.
8
+ */
9
+ export function createMerchantBindingsResource(config) {
10
+ return {
11
+ async list({ abortSignal, ...query } = {}) {
12
+ return await requestJson(config, "/v1/merchant-connection/bindings", { query, signal: abortSignal }, merchantBindingsResponseSchema);
13
+ },
14
+ async put({ userId, abortSignal, ...body }) {
15
+ return await requestJson(config, `/v1/merchant-connection/bindings/${encodeURIComponent(userId)}`, { json: body, method: "PUT", signal: abortSignal }, merchantBindingResponseSchema);
16
+ },
17
+ async delete({ userId, abortSignal }) {
18
+ await requestJson(config, `/v1/merchant-connection/bindings/${encodeURIComponent(userId)}`, { method: "DELETE", signal: abortSignal });
19
+ },
20
+ };
21
+ }
@@ -0,0 +1,7 @@
1
+ import type { HttpConfig, MerchantConnectionResource } from "../types.ts";
2
+ /**
3
+ * `client.merchantConnection` — get/create/update/retire over
4
+ * `/v1/merchant-connection`. One connection per tenant; `credential` is
5
+ * write-only and never returned.
6
+ */
7
+ export declare function createMerchantConnectionResource(config: HttpConfig): MerchantConnectionResource;
@@ -0,0 +1,26 @@
1
+ import { merchantConnectionResponseSchema } from "../contracts/entities/merchant.js";
2
+ import { requestJson } from "../http.js";
3
+ /**
4
+ * `client.merchantConnection` — get/create/update/retire over
5
+ * `/v1/merchant-connection`. One connection per tenant; `credential` is
6
+ * write-only and never returned.
7
+ */
8
+ export function createMerchantConnectionResource(config) {
9
+ return {
10
+ async get({ abortSignal } = {}) {
11
+ return await requestJson(config, "/v1/merchant-connection", { signal: abortSignal }, merchantConnectionResponseSchema);
12
+ },
13
+ async create({ abortSignal, ...body }) {
14
+ return await requestJson(config, "/v1/merchant-connection", { json: body, method: "POST", signal: abortSignal }, merchantConnectionResponseSchema);
15
+ },
16
+ async update({ abortSignal, ...body }) {
17
+ return await requestJson(config, "/v1/merchant-connection", { json: body, method: "PATCH", signal: abortSignal }, merchantConnectionResponseSchema);
18
+ },
19
+ async retire({ abortSignal } = {}) {
20
+ await requestJson(config, "/v1/merchant-connection", {
21
+ method: "DELETE",
22
+ signal: abortSignal,
23
+ });
24
+ },
25
+ };
26
+ }
@@ -0,0 +1,7 @@
1
+ import type { HttpConfig, MerchantUsageEventsResource } from "../types.ts";
2
+ /**
3
+ * `client.merchantUsageEvents` — the immutable usage-event ledger over
4
+ * `/v1/merchant-usage-events`, plus the delivery-health `summary` aggregate
5
+ * and the per-event operator actions `retry`/`release`/`discard`.
6
+ */
7
+ export declare function createMerchantUsageEventsResource(config: HttpConfig): MerchantUsageEventsResource;
@@ -0,0 +1,29 @@
1
+ import { merchantUsageEventResponseSchema, merchantUsageEventsResponseSchema, merchantUsageSummaryResponseSchema, } from "../contracts/entities/merchant.js";
2
+ import { requestJson } from "../http.js";
3
+ /**
4
+ * `client.merchantUsageEvents` — the immutable usage-event ledger over
5
+ * `/v1/merchant-usage-events`, plus the delivery-health `summary` aggregate
6
+ * and the per-event operator actions `retry`/`release`/`discard`.
7
+ */
8
+ export function createMerchantUsageEventsResource(config) {
9
+ return {
10
+ async list({ abortSignal, ...query } = {}) {
11
+ return await requestJson(config, "/v1/merchant-usage-events", { query, signal: abortSignal }, merchantUsageEventsResponseSchema);
12
+ },
13
+ async get({ eventId, abortSignal }) {
14
+ return await requestJson(config, `/v1/merchant-usage-events/${encodeURIComponent(eventId)}`, { signal: abortSignal }, merchantUsageEventResponseSchema);
15
+ },
16
+ async summary({ abortSignal, ...query } = {}) {
17
+ return await requestJson(config, "/v1/merchant-usage-events/summary", { query, signal: abortSignal }, merchantUsageSummaryResponseSchema);
18
+ },
19
+ async retry({ eventId, abortSignal }) {
20
+ return await requestJson(config, `/v1/merchant-usage-events/${encodeURIComponent(eventId)}/retry`, { method: "POST", signal: abortSignal }, merchantUsageEventResponseSchema);
21
+ },
22
+ async release({ eventId, abortSignal }) {
23
+ return await requestJson(config, `/v1/merchant-usage-events/${encodeURIComponent(eventId)}/release`, { method: "POST", signal: abortSignal }, merchantUsageEventResponseSchema);
24
+ },
25
+ async discard({ eventId, abortSignal }) {
26
+ return await requestJson(config, `/v1/merchant-usage-events/${encodeURIComponent(eventId)}/discard`, { method: "POST", signal: abortSignal }, merchantUsageEventResponseSchema);
27
+ },
28
+ };
29
+ }
@@ -1,8 +1,7 @@
1
1
  import { skillCopyResultsSchema, skillDetailSchema, skillsListResponseSchema, } from "../contracts/entities/skills.js";
2
2
  import { isRequestAborted, requestAbortedError, requestJson, requestStream, } from "../http.js";
3
3
  function fileUrl(agentId, input) {
4
- const path = input.path.split("/").map(encodeURIComponent).join("/");
5
- return `/v1/agents/${encodeURIComponent(agentId)}/skills/${encodeURIComponent(input.skillId)}/files/${path}`;
4
+ return `/v1/agents/${encodeURIComponent(agentId)}/skills/${encodeURIComponent(input.skillId)}/files?path=${encodeURIComponent(input.path)}`;
6
5
  }
7
6
  export function createAgentSkillsResource(config, agentId) {
8
7
  return {
package/dist/types.d.ts CHANGED
@@ -6,6 +6,7 @@ import type { BlazingAgentsChatMessageMetadata } from "./contracts/entities/chat
6
6
  import type { ChatConnection, ChatConnectionsResponse, CreateChatConnectionBody, RotateChatConnectionBody, UpdateChatConnectionBody } from "./contracts/entities/chat-connections.ts";
7
7
  import type { CreateMcpConnectionBody, McpAttachmentResponse, McpAttachmentsResponse, McpConnectionOauthConnectResponse, McpConnectionReconnectResult, McpConnectionResponse, McpConnectionsResponse, McpConnectionTestResponse, ReconnectMcpConnectionBody, UpdateMcpAttachmentBody, UpdateMcpConnectionBody } from "./contracts/entities/mcp-connections.ts";
8
8
  import type { CreateMemoryBody, MemoriesListResponse, MemoryResponse, UpdateMemoryBody } from "./contracts/entities/memories.ts";
9
+ import type { CreateMerchantConnectionBody, MerchantBindingResponse, MerchantBindingsResponse, MerchantConnectionResponse, MerchantUsageEventResponse, MerchantUsageEventStatus, MerchantUsageEventsResponse, MerchantUsageSummaryResponse, UpdateMerchantConnectionBody, UpsertMerchantBindingBody } from "./contracts/entities/merchant.ts";
9
10
  import type { CreatePromptBody, PromptResponse, PromptsResponse, UpdatePromptBody } from "./contracts/entities/prompts.ts";
10
11
  import type { CreateProviderBody, DeleteProviderOptions, ProviderModelsResponse, ProviderResponse, ProvidersResponse, ThinkingLevelsResponse, UpdateProviderBody } from "./contracts/entities/providers.ts";
11
12
  import type { DecideToolApprovalBody, LatestSessionsListResponse, SessionMessagesResponse, SessionsListResponse, ToolApprovalDecisionResponse, ToolApprovalsResponse } from "./contracts/entities/sessions.ts";
@@ -515,6 +516,65 @@ export interface UsageResource {
515
516
  /** Returns totals, daily usage, and bounded Agent, user, and model rankings. */
516
517
  overview(input?: Partial<UsageOverviewQuery> & ResourceRequestOptions): Promise<UsageOverviewResponse>;
517
518
  }
519
+ /**
520
+ * `client.merchantConnection` — the tenant's own Polar/Dodo merchant
521
+ * connection (ADR-0048). `credential` is write-only: responses expose only
522
+ * `keyFragment`.
523
+ */
524
+ export interface MerchantConnectionResource {
525
+ create(input: CreateMerchantConnectionBody & ResourceRequestOptions): Promise<MerchantConnectionResponse>;
526
+ get(input?: ResourceRequestOptions): Promise<MerchantConnectionResponse>;
527
+ /** Retires the connection; deliveries stop (`DELETE` → 204). */
528
+ retire(input?: ResourceRequestOptions): Promise<void>;
529
+ update(input: UpdateMerchantConnectionBody & ResourceRequestOptions): Promise<MerchantConnectionResponse>;
530
+ }
531
+ export interface MerchantBindingsListOptions extends ResourceRequestOptions {
532
+ cursor?: string;
533
+ limit?: number;
534
+ userId?: string;
535
+ }
536
+ /**
537
+ * `client.merchantBindings` — end-user → provider customer bindings behind
538
+ * `/v1/merchant-connection/bindings`. `put` validates the customer against
539
+ * the provider.
540
+ */
541
+ export interface MerchantBindingsResource {
542
+ delete(input: {
543
+ userId: string;
544
+ } & ResourceRequestOptions): Promise<void>;
545
+ list(input?: MerchantBindingsListOptions): Promise<MerchantBindingsResponse>;
546
+ put(input: UpsertMerchantBindingBody & {
547
+ userId: string;
548
+ } & ResourceRequestOptions): Promise<MerchantBindingResponse>;
549
+ }
550
+ export interface MerchantUsageEventsListOptions extends ResourceRequestOptions {
551
+ cursor?: string;
552
+ limit?: number;
553
+ status?: MerchantUsageEventStatus;
554
+ }
555
+ /**
556
+ * `client.merchantUsageEvents` — the immutable delivery ledger behind
557
+ * `/v1/merchant-usage-events`. `retry`, `release`, and `discard` are the
558
+ * operator actions on unresolved events.
559
+ */
560
+ export interface MerchantUsageEventsResource {
561
+ discard(input: {
562
+ eventId: string;
563
+ } & ResourceRequestOptions): Promise<MerchantUsageEventResponse>;
564
+ get(input: {
565
+ eventId: string;
566
+ } & ResourceRequestOptions): Promise<MerchantUsageEventResponse>;
567
+ list(input?: MerchantUsageEventsListOptions): Promise<MerchantUsageEventsResponse>;
568
+ release(input: {
569
+ eventId: string;
570
+ } & ResourceRequestOptions): Promise<MerchantUsageEventResponse>;
571
+ retry(input: {
572
+ eventId: string;
573
+ } & ResourceRequestOptions): Promise<MerchantUsageEventResponse>;
574
+ summary(input?: {
575
+ days?: number;
576
+ } & ResourceRequestOptions): Promise<MerchantUsageSummaryResponse>;
577
+ }
518
578
  export interface ChatConnectionsResource {
519
579
  checkHealth(input: {
520
580
  chatConnectionId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blazingagents/sdk",
3
- "version": "0.9.2",
3
+ "version": "0.10.0",
4
4
  "description": "TypeScript SDK for the Blazing Agents API",
5
5
  "homepage": "https://docs.blazingagents.com",
6
6
  "bugs": {