@blazingagents/sdk 0.44.0 → 0.45.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.
- package/dist/contracts/api.d.ts +0 -1
- package/dist/contracts/api.js +0 -1
- package/dist/contracts/entities/attribution.d.ts +1 -1
- package/dist/contracts/entities/attribution.js +1 -1
- package/dist/contracts/entities/chat.d.ts +2 -2
- package/dist/contracts/entities/chat.js +2 -1
- package/dist/contracts/entities/mcp-connections.d.ts +0 -18
- package/dist/contracts/entities/mcp-connections.js +4 -20
- package/dist/contracts/entities/sessions.d.ts +1 -1
- package/dist/contracts/entities/tasks.d.ts +3 -3
- package/dist/contracts/entities/tasks.js +4 -4
- package/dist/contracts/entities/tenants.d.ts +0 -25
- package/dist/contracts/entities/tenants.js +1 -22
- package/dist/contracts/index.d.ts +2 -2
- package/dist/contracts/index.js +1 -1
- package/dist/contracts/limitations.d.ts +0 -2
- package/dist/contracts/limitations.js +0 -3
- package/dist/resources/tenant.d.ts +1 -2
- package/dist/resources/tenant.js +1 -2
- package/package.json +1 -1
package/dist/contracts/api.d.ts
CHANGED
|
@@ -60,7 +60,6 @@ export declare const apiErrorCodeSchema: z.ZodEnum<{
|
|
|
60
60
|
provider_name_conflict: "provider_name_conflict";
|
|
61
61
|
provider_not_found: "provider_not_found";
|
|
62
62
|
provider_required: "provider_required";
|
|
63
|
-
quota_exceeded: "quota_exceeded";
|
|
64
63
|
rate_limited: "rate_limited";
|
|
65
64
|
service_unavailable: "service_unavailable";
|
|
66
65
|
session_busy: "session_busy";
|
package/dist/contracts/api.js
CHANGED
|
@@ -4,7 +4,7 @@ import { z } from "zod";
|
|
|
4
4
|
* tenant-owned product resource (ADR-0001). `userId` is an opaque
|
|
5
5
|
* tenant-chosen string (`''` = tenant-level, immutable after creation);
|
|
6
6
|
* `metadata` is a mutable jsonb object. Neither is ever on tenant config
|
|
7
|
-
* (apikeys, providers
|
|
7
|
+
* (apikeys, providers).
|
|
8
8
|
*
|
|
9
9
|
* These are the shared zod primitives every attributed entity reuses so the
|
|
10
10
|
* two fields stay shape-identical across agents, Workspaces, prompts,
|
|
@@ -4,7 +4,7 @@ import { z } from "zod";
|
|
|
4
4
|
* tenant-owned product resource (ADR-0001). `userId` is an opaque
|
|
5
5
|
* tenant-chosen string (`''` = tenant-level, immutable after creation);
|
|
6
6
|
* `metadata` is a mutable jsonb object. Neither is ever on tenant config
|
|
7
|
-
* (apikeys, providers
|
|
7
|
+
* (apikeys, providers).
|
|
8
8
|
*
|
|
9
9
|
* These are the shared zod primitives every attributed entity reuses so the
|
|
10
10
|
* two fields stay shape-identical across agents, Workspaces, prompts,
|
|
@@ -30,7 +30,7 @@ export declare const usageSummarySchema: z.ZodObject<{
|
|
|
30
30
|
outputTokens: z.ZodNumber;
|
|
31
31
|
reasoningTokens: z.ZodNullable<z.ZodNumber>;
|
|
32
32
|
turnId: z.ZodString;
|
|
33
|
-
sessionId: z.
|
|
33
|
+
sessionId: z.ZodNullable<z.ZodString>;
|
|
34
34
|
stepUsages: z.ZodArray<z.ZodObject<{
|
|
35
35
|
inputTokens: z.ZodNumber;
|
|
36
36
|
outputTokens: z.ZodNumber;
|
|
@@ -62,7 +62,7 @@ export declare const blazingAgentsChatMessageMetadataSchema: z.ZodObject<{
|
|
|
62
62
|
outputTokens: z.ZodNumber;
|
|
63
63
|
reasoningTokens: z.ZodNullable<z.ZodNumber>;
|
|
64
64
|
turnId: z.ZodString;
|
|
65
|
-
sessionId: z.
|
|
65
|
+
sessionId: z.ZodNullable<z.ZodString>;
|
|
66
66
|
stepUsages: z.ZodArray<z.ZodObject<{
|
|
67
67
|
inputTokens: z.ZodNumber;
|
|
68
68
|
outputTokens: z.ZodNumber;
|
|
@@ -37,7 +37,8 @@ export const usageSummarySchema = z
|
|
|
37
37
|
outputTokens: z.number().int().min(0),
|
|
38
38
|
reasoningTokens: z.number().int().min(0).nullable(),
|
|
39
39
|
turnId: turnIdSchema,
|
|
40
|
-
|
|
40
|
+
/** Null for a stateless generation, which has no Session. */
|
|
41
|
+
sessionId: sessionIdSchema.nullable(),
|
|
41
42
|
stepUsages: z.array(z
|
|
42
43
|
.object({
|
|
43
44
|
inputTokens: z.number().int().min(0),
|
|
@@ -3,7 +3,6 @@ export declare const mcpConnectionAuthTypeSchema: z.ZodEnum<{
|
|
|
3
3
|
bearer: "bearer";
|
|
4
4
|
none: "none";
|
|
5
5
|
oauth_authorization_code: "oauth_authorization_code";
|
|
6
|
-
oauth_client_credentials: "oauth_client_credentials";
|
|
7
6
|
}>;
|
|
8
7
|
export declare const mcpConnectionStatusSchema: z.ZodEnum<{
|
|
9
8
|
connected: "connected";
|
|
@@ -24,7 +23,6 @@ export declare const mcpConnectionResponseSchema: z.ZodObject<{
|
|
|
24
23
|
bearer: "bearer";
|
|
25
24
|
none: "none";
|
|
26
25
|
oauth_authorization_code: "oauth_authorization_code";
|
|
27
|
-
oauth_client_credentials: "oauth_client_credentials";
|
|
28
26
|
}>;
|
|
29
27
|
status: z.ZodEnum<{
|
|
30
28
|
connected: "connected";
|
|
@@ -53,7 +51,6 @@ export declare const mcpConnectionsResponseSchema: z.ZodObject<{
|
|
|
53
51
|
bearer: "bearer";
|
|
54
52
|
none: "none";
|
|
55
53
|
oauth_authorization_code: "oauth_authorization_code";
|
|
56
|
-
oauth_client_credentials: "oauth_client_credentials";
|
|
57
54
|
}>;
|
|
58
55
|
status: z.ZodEnum<{
|
|
59
56
|
connected: "connected";
|
|
@@ -111,13 +108,6 @@ export declare const createMcpConnectionBodySchema: z.ZodDiscriminatedUnion<[z.Z
|
|
|
111
108
|
scope: z.ZodOptional<z.ZodString>;
|
|
112
109
|
url: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
113
110
|
name: z.ZodString;
|
|
114
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
115
|
-
authType: z.ZodLiteral<"oauth_client_credentials">;
|
|
116
|
-
clientId: z.ZodString;
|
|
117
|
-
clientSecret: z.ZodString;
|
|
118
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
119
|
-
url: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
120
|
-
name: z.ZodString;
|
|
121
111
|
}, z.core.$strict>], "authType">;
|
|
122
112
|
export declare const updateMcpConnectionBodySchema: z.ZodObject<{
|
|
123
113
|
name: z.ZodOptional<z.ZodString>;
|
|
@@ -135,12 +125,6 @@ export declare const reconnectMcpConnectionBodySchema: z.ZodDiscriminatedUnion<[
|
|
|
135
125
|
clientSecret: z.ZodOptional<z.ZodString>;
|
|
136
126
|
scope: z.ZodOptional<z.ZodString>;
|
|
137
127
|
url: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
138
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
139
|
-
authType: z.ZodLiteral<"oauth_client_credentials">;
|
|
140
|
-
clientId: z.ZodString;
|
|
141
|
-
clientSecret: z.ZodString;
|
|
142
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
143
|
-
url: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
144
128
|
}, z.core.$strict>], "authType">;
|
|
145
129
|
export declare const mcpOauthAuthorizationLaunchResponseSchema: z.ZodObject<{
|
|
146
130
|
authorizationUrl: z.ZodString;
|
|
@@ -183,7 +167,6 @@ export declare const mcpConnectionReconnectResultSchema: z.ZodDiscriminatedUnion
|
|
|
183
167
|
bearer: "bearer";
|
|
184
168
|
none: "none";
|
|
185
169
|
oauth_authorization_code: "oauth_authorization_code";
|
|
186
|
-
oauth_client_credentials: "oauth_client_credentials";
|
|
187
170
|
}>;
|
|
188
171
|
status: z.ZodEnum<{
|
|
189
172
|
connected: "connected";
|
|
@@ -213,7 +196,6 @@ export declare const mcpConnectionReconnectResultSchema: z.ZodDiscriminatedUnion
|
|
|
213
196
|
bearer: "bearer";
|
|
214
197
|
none: "none";
|
|
215
198
|
oauth_authorization_code: "oauth_authorization_code";
|
|
216
|
-
oauth_client_credentials: "oauth_client_credentials";
|
|
217
199
|
}>;
|
|
218
200
|
status: z.ZodEnum<{
|
|
219
201
|
connected: "connected";
|
|
@@ -7,7 +7,6 @@ export const mcpConnectionAuthTypeSchema = z.enum([
|
|
|
7
7
|
"none",
|
|
8
8
|
"bearer",
|
|
9
9
|
"oauth_authorization_code",
|
|
10
|
-
"oauth_client_credentials",
|
|
11
10
|
]);
|
|
12
11
|
export const mcpConnectionStatusSchema = z.enum([
|
|
13
12
|
"connected",
|
|
@@ -38,20 +37,20 @@ const oauthClientIdSchema = z
|
|
|
38
37
|
.min(1)
|
|
39
38
|
.max(MAX_MCP_OAUTH_CLIENT_ID_LENGTH)
|
|
40
39
|
.regex(/^[!-~]+$/, "Client ID must contain visible ASCII characters only")
|
|
41
|
-
.describe("OAuth client ID.
|
|
40
|
+
.describe("OAuth client ID. Optional, but send it together with `clientSecret`.");
|
|
42
41
|
const oauthClientSecretSchema = z
|
|
43
42
|
.string()
|
|
44
43
|
.min(1)
|
|
45
44
|
.max(MAX_MCP_OAUTH_CLIENT_SECRET_LENGTH)
|
|
46
45
|
.regex(/^[!-~]+$/, "Client secret must contain visible ASCII characters only")
|
|
47
|
-
.describe("OAuth client secret.
|
|
46
|
+
.describe("OAuth client secret. Optional, but send it together with `clientId`. Never returned.");
|
|
48
47
|
const oauthScopeSchema = z
|
|
49
48
|
.string()
|
|
50
49
|
.trim()
|
|
51
50
|
.min(1)
|
|
52
51
|
.max(MAX_MCP_OAUTH_SCOPE_LENGTH)
|
|
53
52
|
.regex(/^[\x20-\x7e]+$/, "Scope must contain printable ASCII characters only")
|
|
54
|
-
.describe("OAuth scope to request. Optional
|
|
53
|
+
.describe("OAuth scope to request. Optional.");
|
|
55
54
|
const credentialFragmentSchema = z.string().min(1).max(4).nullable();
|
|
56
55
|
const mcpConnectionUrlSchema = z
|
|
57
56
|
.string()
|
|
@@ -75,7 +74,7 @@ const mcpConnectionUrlSchema = z
|
|
|
75
74
|
})
|
|
76
75
|
.transform((value) => new URL(value).toString());
|
|
77
76
|
const mcpConnectionUrlInputSchema = mcpConnectionUrlSchema.describe("Streamable HTTP URL of the MCP server. Use `https`, with no credentials, query, or fragment.");
|
|
78
|
-
const authTypeDescription = "How Blazing Agents authenticates to the MCP server: `none`, `bearer`,
|
|
77
|
+
const authTypeDescription = "How Blazing Agents authenticates to the MCP server: `none`, `bearer`, or `oauth_authorization_code`. The other fields you send depend on it.";
|
|
79
78
|
export const mcpConnectionResponseSchema = z
|
|
80
79
|
.object({
|
|
81
80
|
id: mcpConnectionIdSchema,
|
|
@@ -146,13 +145,6 @@ const createBearerMcpConnectionBodySchema = z
|
|
|
146
145
|
bearerToken: bearerTokenSchema,
|
|
147
146
|
})
|
|
148
147
|
.strict();
|
|
149
|
-
const oauthClientCredentialsFields = {
|
|
150
|
-
authType: z.literal("oauth_client_credentials").describe(authTypeDescription),
|
|
151
|
-
clientId: oauthClientIdSchema,
|
|
152
|
-
clientSecret: oauthClientSecretSchema,
|
|
153
|
-
scope: oauthScopeSchema.optional(),
|
|
154
|
-
url: mcpConnectionUrlInputSchema,
|
|
155
|
-
};
|
|
156
148
|
const oauthAuthorizationCodeFields = {
|
|
157
149
|
authType: z.literal("oauth_authorization_code").describe(authTypeDescription),
|
|
158
150
|
clientId: oauthClientIdSchema.optional(),
|
|
@@ -166,18 +158,11 @@ const createOauthAuthorizationCodeMcpConnectionBodySchema = z
|
|
|
166
158
|
name: mcpConnectionNameInputSchema,
|
|
167
159
|
})
|
|
168
160
|
.strict();
|
|
169
|
-
const createOauthClientCredentialsMcpConnectionBodySchema = z
|
|
170
|
-
.object({
|
|
171
|
-
...oauthClientCredentialsFields,
|
|
172
|
-
name: mcpConnectionNameInputSchema,
|
|
173
|
-
})
|
|
174
|
-
.strict();
|
|
175
161
|
export const createMcpConnectionBodySchema = z
|
|
176
162
|
.discriminatedUnion("authType", [
|
|
177
163
|
createNoneMcpConnectionBodySchema,
|
|
178
164
|
createBearerMcpConnectionBodySchema,
|
|
179
165
|
createOauthAuthorizationCodeMcpConnectionBodySchema,
|
|
180
|
-
createOauthClientCredentialsMcpConnectionBodySchema,
|
|
181
166
|
])
|
|
182
167
|
.superRefine((body, context) => {
|
|
183
168
|
if (body.authType === "oauth_authorization_code" &&
|
|
@@ -213,7 +198,6 @@ export const reconnectMcpConnectionBodySchema = z
|
|
|
213
198
|
})
|
|
214
199
|
.strict(),
|
|
215
200
|
z.object(oauthAuthorizationCodeFields).strict(),
|
|
216
|
-
z.object(oauthClientCredentialsFields).strict(),
|
|
217
201
|
])
|
|
218
202
|
.superRefine((body, context) => {
|
|
219
203
|
if (body.authType === "oauth_authorization_code" &&
|
|
@@ -373,7 +373,7 @@ export declare const turnStreamErrorEventSchema: z.ZodObject<{
|
|
|
373
373
|
type: z.ZodLiteral<"data-ba-error">;
|
|
374
374
|
transient: z.ZodLiteral<true>;
|
|
375
375
|
data: z.ZodObject<{
|
|
376
|
-
code: z.ZodCustom<"admin_agent_managed" | "agent_busy" | "agent_disabled" | "agent_mcp_connection_not_found" | "agent_mcp_connections_invalid" | "api_key_limit_reached" | "artifact_session_cap_reached" | "chat_webhook_conflict" | "chat_webhook_registration_failed" | "forbidden" | "function_call_conflict" | "idempotency_conflict" | "input_idempotency_conflict" | "insufficient_scope" | "internal" | "invalid_cursor" | "invalid_request" | "mcp_connection_authentication_failed" | "mcp_connection_discovery_failed" | "mcp_connection_in_use" | "mcp_connection_invalid" | "mcp_connection_limit_reached" | "mcp_connection_name_conflict" | "mcp_connection_stale_credential_version" | "mcp_connection_unreachable" | "merchant_account_mismatch" | "merchant_balance_required" | "merchant_binding_not_found" | "merchant_connection_in_use" | "merchant_connection_not_found" | "merchant_credential_invalid" | "merchant_customer_not_found" | "merchant_customer_unmapped" | "merchant_eligibility_unavailable" | "merchant_event_not_found" | "merchant_event_state_conflict" | "merchant_provider_unavailable" | "merchant_subscription_required" | "message_id_conflict" | "message_not_found" | "model_discovery_unsupported" | "model_not_found" | "model_spending_limit_exceeded" | "model_validation_unavailable" | "not_found" | "prompt_variable_missing" | "prompt_variable_unknown" | "provider_historical_use" | "provider_in_use" | "provider_limit_reached" | "provider_name_conflict" | "provider_not_found" | "provider_required" | "
|
|
376
|
+
code: z.ZodCustom<"admin_agent_managed" | "agent_busy" | "agent_disabled" | "agent_mcp_connection_not_found" | "agent_mcp_connections_invalid" | "api_key_limit_reached" | "artifact_session_cap_reached" | "chat_webhook_conflict" | "chat_webhook_registration_failed" | "forbidden" | "function_call_conflict" | "idempotency_conflict" | "input_idempotency_conflict" | "insufficient_scope" | "internal" | "invalid_cursor" | "invalid_request" | "mcp_connection_authentication_failed" | "mcp_connection_discovery_failed" | "mcp_connection_in_use" | "mcp_connection_invalid" | "mcp_connection_limit_reached" | "mcp_connection_name_conflict" | "mcp_connection_stale_credential_version" | "mcp_connection_unreachable" | "merchant_account_mismatch" | "merchant_balance_required" | "merchant_binding_not_found" | "merchant_connection_in_use" | "merchant_connection_not_found" | "merchant_credential_invalid" | "merchant_customer_not_found" | "merchant_customer_unmapped" | "merchant_eligibility_unavailable" | "merchant_event_not_found" | "merchant_event_state_conflict" | "merchant_provider_unavailable" | "merchant_subscription_required" | "message_id_conflict" | "message_not_found" | "model_discovery_unsupported" | "model_not_found" | "model_spending_limit_exceeded" | "model_validation_unavailable" | "not_found" | "prompt_variable_missing" | "prompt_variable_unknown" | "provider_historical_use" | "provider_in_use" | "provider_limit_reached" | "provider_name_conflict" | "provider_not_found" | "provider_required" | "rate_limited" | "service_unavailable" | "session_busy" | "session_fork_deleted" | "session_fork_unavailable" | "session_turn_unresponsive" | "session_version_mismatch" | "skill_invalid_archive" | "skill_invalid_markdown" | "skill_limit_reached" | "skill_name_conflict" | "skill_not_found" | "skill_too_many_files" | "skill_uncompressed_too_large" | "steer_not_available" | "subscription_already_paid" | "subscription_not_cancelled" | "subscription_required" | "task_active_run_exists" | "tenant_deleting" | "tenant_deletion_in_progress" | "tenant_deletion_not_ready" | "tenant_not_deleting" | "tool_approval_continuation_settled" | "tool_approval_decision_conflict" | "turn_interrupted" | "unauthorized" | "usage_credit_required" | "validation_failed" | "workspace_busy" | "workspace_in_use" | "workspace_not_found" | (string & {}), "admin_agent_managed" | "agent_busy" | "agent_disabled" | "agent_mcp_connection_not_found" | "agent_mcp_connections_invalid" | "api_key_limit_reached" | "artifact_session_cap_reached" | "chat_webhook_conflict" | "chat_webhook_registration_failed" | "forbidden" | "function_call_conflict" | "idempotency_conflict" | "input_idempotency_conflict" | "insufficient_scope" | "internal" | "invalid_cursor" | "invalid_request" | "mcp_connection_authentication_failed" | "mcp_connection_discovery_failed" | "mcp_connection_in_use" | "mcp_connection_invalid" | "mcp_connection_limit_reached" | "mcp_connection_name_conflict" | "mcp_connection_stale_credential_version" | "mcp_connection_unreachable" | "merchant_account_mismatch" | "merchant_balance_required" | "merchant_binding_not_found" | "merchant_connection_in_use" | "merchant_connection_not_found" | "merchant_credential_invalid" | "merchant_customer_not_found" | "merchant_customer_unmapped" | "merchant_eligibility_unavailable" | "merchant_event_not_found" | "merchant_event_state_conflict" | "merchant_provider_unavailable" | "merchant_subscription_required" | "message_id_conflict" | "message_not_found" | "model_discovery_unsupported" | "model_not_found" | "model_spending_limit_exceeded" | "model_validation_unavailable" | "not_found" | "prompt_variable_missing" | "prompt_variable_unknown" | "provider_historical_use" | "provider_in_use" | "provider_limit_reached" | "provider_name_conflict" | "provider_not_found" | "provider_required" | "rate_limited" | "service_unavailable" | "session_busy" | "session_fork_deleted" | "session_fork_unavailable" | "session_turn_unresponsive" | "session_version_mismatch" | "skill_invalid_archive" | "skill_invalid_markdown" | "skill_limit_reached" | "skill_name_conflict" | "skill_not_found" | "skill_too_many_files" | "skill_uncompressed_too_large" | "steer_not_available" | "subscription_already_paid" | "subscription_not_cancelled" | "subscription_required" | "task_active_run_exists" | "tenant_deleting" | "tenant_deletion_in_progress" | "tenant_deletion_not_ready" | "tenant_not_deleting" | "tool_approval_continuation_settled" | "tool_approval_decision_conflict" | "turn_interrupted" | "unauthorized" | "usage_credit_required" | "validation_failed" | "workspace_busy" | "workspace_in_use" | "workspace_not_found" | (string & {})>;
|
|
377
377
|
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
378
378
|
message: z.ZodString;
|
|
379
379
|
}, z.core.$strict>;
|
|
@@ -98,9 +98,9 @@ export declare const createTaskRunBodySchema: z.ZodObject<{
|
|
|
98
98
|
}, z.core.$strict>;
|
|
99
99
|
/**
|
|
100
100
|
* Task run status. `blocked` is the soft-block terminal state for an expected
|
|
101
|
-
* admission denial, such as
|
|
102
|
-
*
|
|
103
|
-
*
|
|
101
|
+
* admission denial, such as a missing subscription or insufficient Usage
|
|
102
|
+
* credit. Like the other terminal statuses, it sets `finishedAt` and frees the
|
|
103
|
+
* task's active-run slot for the next scheduled fire.
|
|
104
104
|
*/
|
|
105
105
|
export declare const taskRunStatusSchema: z.ZodEnum<{
|
|
106
106
|
blocked: "blocked";
|
|
@@ -174,9 +174,9 @@ export const createTaskRunBodySchema = z
|
|
|
174
174
|
.strict();
|
|
175
175
|
/**
|
|
176
176
|
* Task run status. `blocked` is the soft-block terminal state for an expected
|
|
177
|
-
* admission denial, such as
|
|
178
|
-
*
|
|
179
|
-
*
|
|
177
|
+
* admission denial, such as a missing subscription or insufficient Usage
|
|
178
|
+
* credit. Like the other terminal statuses, it sets `finishedAt` and frees the
|
|
179
|
+
* task's active-run slot for the next scheduled fire.
|
|
180
180
|
*/
|
|
181
181
|
export const taskRunStatusSchema = z.enum([
|
|
182
182
|
"queued",
|
|
@@ -244,7 +244,7 @@ export const taskRunResponseSchema = z
|
|
|
244
244
|
error: z.string().nullable(),
|
|
245
245
|
errorCode: receivedApiErrorCodeSchema
|
|
246
246
|
.nullable()
|
|
247
|
-
.describe("Machine-readable reason a run ended `blocked` or `failed`: one of the API error codes, such as `usage_credit_required
|
|
247
|
+
.describe("Machine-readable reason a run ended `blocked` or `failed`: one of the API error codes, such as `usage_credit_required` or `provider_required`. `null` for every other run, and for a failure without a code; `error` carries the message."),
|
|
248
248
|
userId: userIdSchema,
|
|
249
249
|
metadata: metadataSchema,
|
|
250
250
|
startedAt: z.iso.datetime({ offset: true }).nullable(),
|
|
@@ -9,30 +9,11 @@ export declare const tenantDeletionSchema: z.ZodObject<{
|
|
|
9
9
|
deletesAt: z.ZodISODateTime;
|
|
10
10
|
requestedAt: z.ZodISODateTime;
|
|
11
11
|
}, z.core.$strict>;
|
|
12
|
-
/**
|
|
13
|
-
* Quota — `GET/PATCH /v1/tenant` carries the tenant's self-set quota.
|
|
14
|
-
* `null` means unlimited (no quota row).
|
|
15
|
-
*/
|
|
16
|
-
export declare const quotaSchema: z.ZodObject<{
|
|
17
|
-
monthlyTokenLimit: z.ZodNullable<z.ZodNumber>;
|
|
18
|
-
monthlyRequestLimit: z.ZodNullable<z.ZodNumber>;
|
|
19
|
-
resetDay: z.ZodNumber;
|
|
20
|
-
}, z.core.$strict>;
|
|
21
12
|
export declare const tenantSettingsSchema: z.ZodObject<{
|
|
22
13
|
name: z.ZodString;
|
|
23
|
-
quota: z.ZodNullable<z.ZodObject<{
|
|
24
|
-
monthlyTokenLimit: z.ZodNullable<z.ZodNumber>;
|
|
25
|
-
monthlyRequestLimit: z.ZodNullable<z.ZodNumber>;
|
|
26
|
-
resetDay: z.ZodNumber;
|
|
27
|
-
}, z.core.$strip>>;
|
|
28
14
|
}, z.core.$strip>;
|
|
29
15
|
export declare const tenantSettingsResponseSchema: z.ZodObject<{
|
|
30
16
|
name: z.ZodString;
|
|
31
|
-
quota: z.ZodNullable<z.ZodObject<{
|
|
32
|
-
monthlyTokenLimit: z.ZodNullable<z.ZodNumber>;
|
|
33
|
-
monthlyRequestLimit: z.ZodNullable<z.ZodNumber>;
|
|
34
|
-
resetDay: z.ZodNumber;
|
|
35
|
-
}, z.core.$strip>>;
|
|
36
17
|
deletion: z.ZodNullable<z.ZodObject<{
|
|
37
18
|
deletesAt: z.ZodISODateTime;
|
|
38
19
|
requestedAt: z.ZodISODateTime;
|
|
@@ -42,13 +23,7 @@ export declare const tenantSettingsResponseSchema: z.ZodObject<{
|
|
|
42
23
|
export declare const updateTenantSettingsBodySchema: z.ZodObject<{
|
|
43
24
|
monetizationEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
44
25
|
name: z.ZodOptional<z.ZodString>;
|
|
45
|
-
quota: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
46
|
-
monthlyTokenLimit: z.ZodNullable<z.ZodNumber>;
|
|
47
|
-
monthlyRequestLimit: z.ZodNullable<z.ZodNumber>;
|
|
48
|
-
resetDay: z.ZodNumber;
|
|
49
|
-
}, z.core.$strict>>>;
|
|
50
26
|
}, z.core.$strict>;
|
|
51
|
-
export type Quota = z.infer<typeof quotaSchema>;
|
|
52
27
|
export type TenantDeletion = z.infer<typeof tenantDeletionSchema>;
|
|
53
28
|
export type TenantSettingsResponse = z.infer<typeof tenantSettingsResponseSchema>;
|
|
54
29
|
export type UpdateTenantSettingsBody = z.infer<typeof updateTenantSettingsBodySchema>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { MAX_TENANT_NAME_LENGTH } from "../limitations.js";
|
|
3
3
|
import { atLeastOneFieldMessage, hasObjectKeys } from "../utils.js";
|
|
4
4
|
/**
|
|
5
5
|
* Tenant deletion lifecycle — `requestedAt` marks the tenant deleting and
|
|
@@ -13,26 +13,9 @@ export const tenantDeletionSchema = z
|
|
|
13
13
|
requestedAt: z.iso.datetime({ offset: true }),
|
|
14
14
|
})
|
|
15
15
|
.strict();
|
|
16
|
-
/**
|
|
17
|
-
* Quota — `GET/PATCH /v1/tenant` carries the tenant's self-set quota.
|
|
18
|
-
* `null` means unlimited (no quota row).
|
|
19
|
-
*/
|
|
20
|
-
export const quotaSchema = z
|
|
21
|
-
.object({
|
|
22
|
-
monthlyTokenLimit: z.number().int().positive().nullable(),
|
|
23
|
-
monthlyRequestLimit: z.number().int().positive().nullable(),
|
|
24
|
-
resetDay: z
|
|
25
|
-
.number()
|
|
26
|
-
.int()
|
|
27
|
-
.min(MIN_QUOTA_RESET_DAY)
|
|
28
|
-
.max(MAX_QUOTA_RESET_DAY),
|
|
29
|
-
})
|
|
30
|
-
.strict()
|
|
31
|
-
.refine(({ monthlyRequestLimit, monthlyTokenLimit }) => monthlyRequestLimit !== null || monthlyTokenLimit !== null, { message: "At least one quota limit is required" });
|
|
32
16
|
export const tenantSettingsSchema = z
|
|
33
17
|
.object({
|
|
34
18
|
name: z.string().trim().min(1).max(MAX_TENANT_NAME_LENGTH),
|
|
35
|
-
quota: quotaSchema.strip().nullable(),
|
|
36
19
|
})
|
|
37
20
|
.strip();
|
|
38
21
|
export const tenantSettingsResponseSchema = tenantSettingsSchema
|
|
@@ -54,10 +37,6 @@ export const updateTenantSettingsBodySchema = z
|
|
|
54
37
|
.max(MAX_TENANT_NAME_LENGTH)
|
|
55
38
|
.optional()
|
|
56
39
|
.describe("Display name of your tenant."),
|
|
57
|
-
quota: quotaSchema
|
|
58
|
-
.nullable()
|
|
59
|
-
.optional()
|
|
60
|
-
.describe("The whole monthly quota, replacing the current one, or `null` to remove it. Send `monthlyTokenLimit`, `monthlyRequestLimit`, and `resetDay`, with at least one limit set."),
|
|
61
40
|
})
|
|
62
41
|
.strict()
|
|
63
42
|
.refine(hasObjectKeys, {
|
|
@@ -27,8 +27,8 @@ export type { SpendingLimit, SpendingLimitResponse, SpendingLimitStopDetails, Up
|
|
|
27
27
|
export { nextSpendingLimitReset, spendingLimitPeriodSchema, spendingLimitResetIntervalSchema, spendingLimitResponseSchema, spendingLimitSchema, spendingLimitStopDetailsSchema, updateSpendingLimitBodySchema, } from "./entities/spending-limits.ts";
|
|
28
28
|
export type { CreateTaskBody, TaskListItem, TaskRunStatus, TaskScheduleInput, UpdateTaskBody, } from "./entities/tasks.ts";
|
|
29
29
|
export { createTaskBodySchema, createTaskResponseSchema, createTaskRunBodySchema, createTaskRunResponseSchema, taskCronConfigSchema, taskIntervalConfigSchema, taskLatestRunSchema, taskListItemSchema, taskOnceConfigSchema, taskResponseSchema, taskRunMessagesResponseSchema, taskRunResponseSchema, taskRunStatusSchema, taskRunsListResponseSchema, taskScheduleInputSchema, taskScheduleKindSchema, tasksListResponseSchema, updateTaskBodySchema, } from "./entities/tasks.ts";
|
|
30
|
-
export type {
|
|
31
|
-
export {
|
|
30
|
+
export type { TenantDeletion, UpdateTenantSettingsBody, } from "./entities/tenants.ts";
|
|
31
|
+
export { tenantDeletionSchema, tenantSettingsResponseSchema, updateTenantSettingsBodySchema, } from "./entities/tenants.ts";
|
|
32
32
|
export type { SessionUsageQuery, SessionUsageResponse, UsageBucket, UsageOverviewQuery, UsageOverviewResponse, UsageResponse, UsageTotals, } from "./entities/usage.ts";
|
|
33
33
|
export { sessionUsageQuerySchema, sessionUsageResponseSchema, usageOverviewQuerySchema, usageOverviewResponseSchema, usageResponseSchema, } from "./entities/usage.ts";
|
|
34
34
|
export type { WorkspaceTier } from "./entities/workspaces.ts";
|
package/dist/contracts/index.js
CHANGED
|
@@ -18,7 +18,7 @@ export { continueToolApprovalsBodySchema, latestSessionListItemSchema, latestSes
|
|
|
18
18
|
export { copySkillBodySchema, createSkillBodySchema, skillArchiveTypeSchema, skillCopyResultsSchema, skillDescriptionSchema, skillDetailSchema, skillFilePathSchema, skillMetadataSchema, skillNameSchema, skillSchema, skillsListResponseSchema, } from "./entities/skills.js";
|
|
19
19
|
export { nextSpendingLimitReset, spendingLimitPeriodSchema, spendingLimitResetIntervalSchema, spendingLimitResponseSchema, spendingLimitSchema, spendingLimitStopDetailsSchema, updateSpendingLimitBodySchema, } from "./entities/spending-limits.js";
|
|
20
20
|
export { createTaskBodySchema, createTaskResponseSchema, createTaskRunBodySchema, createTaskRunResponseSchema, taskCronConfigSchema, taskIntervalConfigSchema, taskLatestRunSchema, taskListItemSchema, taskOnceConfigSchema, taskResponseSchema, taskRunMessagesResponseSchema, taskRunResponseSchema, taskRunStatusSchema, taskRunsListResponseSchema, taskScheduleInputSchema, taskScheduleKindSchema, tasksListResponseSchema, updateTaskBodySchema, } from "./entities/tasks.js";
|
|
21
|
-
export {
|
|
21
|
+
export { tenantDeletionSchema, tenantSettingsResponseSchema, updateTenantSettingsBodySchema, } from "./entities/tenants.js";
|
|
22
22
|
export { sessionUsageQuerySchema, sessionUsageResponseSchema, usageOverviewQuerySchema, usageOverviewResponseSchema, usageResponseSchema, } from "./entities/usage.js";
|
|
23
23
|
export { createWorkspaceBodySchema, updateWorkspaceBodySchema, workspaceNetworkPolicySchema, workspaceSchema, workspacesListResponseSchema, workspaceTierSchema, } from "./entities/workspaces.js";
|
|
24
24
|
export { agentIdSchema, apiKeyTokenSchema, functionCallIdSchema, isAdminAgentId, merchantUsageEventIdSchema, promptIdSchema, sessionIdSchema, } from "./ids.js";
|
|
@@ -47,8 +47,6 @@ export declare const MAX_USAGE_RANGE_DAYS = 31;
|
|
|
47
47
|
export declare const DEFAULT_USAGE_RANGE_DAYS = 30;
|
|
48
48
|
export declare const DEFAULT_USAGE_OVERVIEW_TOP_N = 5;
|
|
49
49
|
export declare const MAX_USAGE_OVERVIEW_TOP_N = 20;
|
|
50
|
-
export declare const MIN_QUOTA_RESET_DAY = 1;
|
|
51
|
-
export declare const MAX_QUOTA_RESET_DAY = 28;
|
|
52
50
|
/**
|
|
53
51
|
* Tenant (workspace) — display name ≤ 80, set via `PATCH /v1/tenant`.
|
|
54
52
|
*/
|
|
@@ -48,9 +48,6 @@ export const MAX_USAGE_RANGE_DAYS = 31;
|
|
|
48
48
|
export const DEFAULT_USAGE_RANGE_DAYS = 30;
|
|
49
49
|
export const DEFAULT_USAGE_OVERVIEW_TOP_N = 5;
|
|
50
50
|
export const MAX_USAGE_OVERVIEW_TOP_N = 20;
|
|
51
|
-
// Quota — reset day between 1 and 28.
|
|
52
|
-
export const MIN_QUOTA_RESET_DAY = 1;
|
|
53
|
-
export const MAX_QUOTA_RESET_DAY = 28;
|
|
54
51
|
/**
|
|
55
52
|
* Tenant (workspace) — display name ≤ 80, set via `PATCH /v1/tenant`.
|
|
56
53
|
*/
|
|
@@ -22,8 +22,7 @@ export interface TenantResource {
|
|
|
22
22
|
updateSpendingLimit(input: UpdateSpendingLimitBody & ResourceRequestOptions): Promise<SpendingLimitResponse>;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
* `client.tenant` — get/patch over `/v1/tenant` (the tenant
|
|
26
|
-
* quota row). `quota: null` means unlimited (no row).
|
|
25
|
+
* `client.tenant` — get/patch over `/v1/tenant` (the tenant settings).
|
|
27
26
|
* @param config - Shared authentication and transport configuration.
|
|
28
27
|
* @returns The configured resource client.
|
|
29
28
|
*/
|
package/dist/resources/tenant.js
CHANGED
|
@@ -2,8 +2,7 @@ import { spendingLimitResponseSchema, } from "../contracts/entities/spending-lim
|
|
|
2
2
|
import { tenantSettingsResponseSchema, } from "../contracts/entities/tenants.js";
|
|
3
3
|
import { requestJson } from "../http.js";
|
|
4
4
|
/**
|
|
5
|
-
* `client.tenant` — get/patch over `/v1/tenant` (the tenant
|
|
6
|
-
* quota row). `quota: null` means unlimited (no row).
|
|
5
|
+
* `client.tenant` — get/patch over `/v1/tenant` (the tenant settings).
|
|
7
6
|
* @param config - Shared authentication and transport configuration.
|
|
8
7
|
* @returns The configured resource client.
|
|
9
8
|
*/
|