@blazingagents/sdk 0.23.0 → 0.25.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/chat-transport.d.ts +6 -0
- package/dist/chat-transport.js +15 -8
- package/dist/contracts/api.d.ts +0 -245
- package/dist/contracts/api.js +0 -121
- package/dist/contracts/entities/agent-tools.d.ts +0 -4
- package/dist/contracts/entities/agent-tools.js +0 -15
- package/dist/contracts/entities/agents.d.ts +2 -109
- package/dist/contracts/entities/agents.js +15 -16
- package/dist/contracts/entities/artifacts.d.ts +0 -30
- package/dist/contracts/entities/artifacts.js +1 -36
- package/dist/contracts/entities/attribution.d.ts +0 -2
- package/dist/contracts/entities/chat-connections.d.ts +0 -3
- package/dist/contracts/entities/chat-connections.js +0 -3
- package/dist/contracts/entities/chat.d.ts +1 -17
- package/dist/contracts/entities/chat.js +4 -13
- package/dist/contracts/entities/mcp-connections.d.ts +0 -168
- package/dist/contracts/entities/mcp-connections.js +1 -171
- package/dist/contracts/entities/memories.d.ts +0 -8
- package/dist/contracts/entities/memories.js +2 -15
- package/dist/contracts/entities/merchant.d.ts +0 -19
- package/dist/contracts/entities/merchant.js +1 -26
- package/dist/contracts/entities/prompts.d.ts +1 -14
- package/dist/contracts/entities/prompts.js +2 -3
- package/dist/contracts/entities/providers.d.ts +0 -28
- package/dist/contracts/entities/providers.js +1 -24
- package/dist/contracts/entities/sessions.d.ts +0 -9
- package/dist/contracts/entities/sessions.js +4 -21
- package/dist/contracts/entities/skills.d.ts +0 -52
- package/dist/contracts/entities/skills.js +2 -60
- package/dist/contracts/entities/tasks.d.ts +1 -168
- package/dist/contracts/entities/tasks.js +5 -14
- package/dist/contracts/entities/tenants.d.ts +0 -6
- package/dist/contracts/entities/usage.d.ts +0 -1
- package/dist/contracts/entities/workspaces.d.ts +0 -6
- package/dist/contracts/entities/workspaces.js +2 -14
- package/dist/contracts/ids.d.ts +1 -68
- package/dist/contracts/ids.js +2 -91
- package/dist/contracts/index.d.ts +3 -3
- package/dist/contracts/index.js +3 -3
- package/dist/contracts/limitations.d.ts +8 -81
- package/dist/contracts/limitations.js +8 -82
- package/dist/direct-chat-transport.d.ts +6 -0
- package/dist/direct-chat-transport.js +19 -2
- package/dist/generation.js +20 -4
- package/dist/types.d.ts +6 -0
- package/package.json +6 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { paginatedResponseSchema } from "../api.js";
|
|
3
3
|
import { agentIdSchema, memoryIdSchema, tenantIdSchema } from "../ids.js";
|
|
4
|
-
import {
|
|
4
|
+
import { MAX_MEMORY_TEXT_BYTES } from "../limitations.js";
|
|
5
5
|
import { userIdSchema } from "./attribution.js";
|
|
6
6
|
/**
|
|
7
7
|
* Memory — a single Agent-owned text row (Agent Memories PRD). `userId` is
|
|
@@ -36,19 +36,6 @@ export const memoryResponseSchema = z
|
|
|
36
36
|
})
|
|
37
37
|
.strip();
|
|
38
38
|
export const memoriesListResponseSchema = paginatedResponseSchema(memorySchema);
|
|
39
|
-
export const memoriesListQuerySchema = z
|
|
40
|
-
.object({
|
|
41
|
-
userId: userIdSchema.optional(),
|
|
42
|
-
search: z.string().trim().min(1).optional(),
|
|
43
|
-
cursor: cursorSchema.optional(),
|
|
44
|
-
limit: z.coerce
|
|
45
|
-
.number()
|
|
46
|
-
.int()
|
|
47
|
-
.min(1)
|
|
48
|
-
.max(MAX_MEMORIES_LIST_LIMIT)
|
|
49
|
-
.default(DEFAULT_MEMORIES_LIST_LIMIT),
|
|
50
|
-
})
|
|
51
|
-
.strict();
|
|
52
39
|
export const createMemoryBodySchema = z
|
|
53
40
|
.object({
|
|
54
41
|
text: memoryTextSchema,
|
|
@@ -113,11 +113,6 @@ export declare const merchantCustomerBindingSchema: z.ZodObject<{
|
|
|
113
113
|
updatedAt: z.ZodISODateTime;
|
|
114
114
|
}, z.core.$strip>;
|
|
115
115
|
export type MerchantCustomerBinding = z.infer<typeof merchantCustomerBindingSchema>;
|
|
116
|
-
export declare const merchantBindingsListQuerySchema: z.ZodObject<{
|
|
117
|
-
userId: z.ZodOptional<z.ZodString>;
|
|
118
|
-
cursor: z.ZodOptional<z.ZodString>;
|
|
119
|
-
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
120
|
-
}, z.core.$strict>;
|
|
121
116
|
export declare const merchantBindingsResponseSchema: z.ZodObject<{
|
|
122
117
|
bindings: z.ZodArray<z.ZodObject<{
|
|
123
118
|
userId: z.ZodString;
|
|
@@ -291,20 +286,6 @@ export declare const merchantUsageEventResponseSchema: z.ZodObject<{
|
|
|
291
286
|
}, z.core.$strip>;
|
|
292
287
|
}, z.core.$strip>;
|
|
293
288
|
export type MerchantUsageEventResponse = z.infer<typeof merchantUsageEventResponseSchema>;
|
|
294
|
-
export declare const merchantUsageEventsListQuerySchema: z.ZodObject<{
|
|
295
|
-
status: z.ZodOptional<z.ZodEnum<{
|
|
296
|
-
accepted: "accepted";
|
|
297
|
-
discarded: "discarded";
|
|
298
|
-
expired: "expired";
|
|
299
|
-
failed: "failed";
|
|
300
|
-
incomplete: "incomplete";
|
|
301
|
-
pending: "pending";
|
|
302
|
-
uncertain: "uncertain";
|
|
303
|
-
unmapped: "unmapped";
|
|
304
|
-
}>>;
|
|
305
|
-
cursor: z.ZodOptional<z.ZodString>;
|
|
306
|
-
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
307
|
-
}, z.core.$strict>;
|
|
308
289
|
export declare const merchantUsageEventsResponseSchema: z.ZodObject<{
|
|
309
290
|
events: z.ZodArray<z.ZodObject<{
|
|
310
291
|
id: z.ZodString;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { cursorSchema } from "../api.js";
|
|
3
2
|
import { agentIdSchema, merchantConnectionIdSchema, merchantUsageEventIdSchema, providerKeyFragmentSchema, sessionIdSchema, turnIdSchema, } from "../ids.js";
|
|
4
|
-
import {
|
|
3
|
+
import { DEFAULT_MERCHANT_USAGE_SUMMARY_DAYS, MAX_MERCHANT_PRODUCT_IDS, MAX_MERCHANT_USAGE_SUMMARY_DAYS, } from "../limitations.js";
|
|
5
4
|
import { hasUniqueValues } from "../utils.js";
|
|
6
5
|
import { userIdSchema } from "./attribution.js";
|
|
7
6
|
import { providerTypeSchema } from "./providers.js";
|
|
@@ -70,18 +69,6 @@ export const merchantCustomerBindingSchema = z
|
|
|
70
69
|
updatedAt: z.iso.datetime({ offset: true }),
|
|
71
70
|
})
|
|
72
71
|
.strip();
|
|
73
|
-
export const merchantBindingsListQuerySchema = z
|
|
74
|
-
.object({
|
|
75
|
-
userId: userIdSchema.optional(),
|
|
76
|
-
cursor: cursorSchema.optional(),
|
|
77
|
-
limit: z.coerce
|
|
78
|
-
.number()
|
|
79
|
-
.int()
|
|
80
|
-
.min(1)
|
|
81
|
-
.max(MAX_MERCHANT_LIST_LIMIT)
|
|
82
|
-
.default(DEFAULT_MERCHANT_LIST_LIMIT),
|
|
83
|
-
})
|
|
84
|
-
.strict();
|
|
85
72
|
export const merchantBindingsResponseSchema = z
|
|
86
73
|
.object({
|
|
87
74
|
bindings: z.array(merchantCustomerBindingSchema),
|
|
@@ -149,18 +136,6 @@ export const merchantUsageEventSchema = z
|
|
|
149
136
|
export const merchantUsageEventResponseSchema = z
|
|
150
137
|
.object({ event: merchantUsageEventSchema })
|
|
151
138
|
.strip();
|
|
152
|
-
export const merchantUsageEventsListQuerySchema = z
|
|
153
|
-
.object({
|
|
154
|
-
status: merchantUsageEventStatusSchema.optional(),
|
|
155
|
-
cursor: cursorSchema.optional(),
|
|
156
|
-
limit: z.coerce
|
|
157
|
-
.number()
|
|
158
|
-
.int()
|
|
159
|
-
.min(1)
|
|
160
|
-
.max(MAX_MERCHANT_LIST_LIMIT)
|
|
161
|
-
.default(DEFAULT_MERCHANT_LIST_LIMIT),
|
|
162
|
-
})
|
|
163
|
-
.strict();
|
|
164
139
|
export const merchantUsageEventsResponseSchema = z
|
|
165
140
|
.object({
|
|
166
141
|
events: z.array(merchantUsageEventSchema),
|
|
@@ -12,7 +12,7 @@ export declare const promptVariableNamePattern: RegExp;
|
|
|
12
12
|
*/
|
|
13
13
|
export declare function parsePromptVariables(template: string): PromptVariableParseResult;
|
|
14
14
|
export declare const promptTemplateSchema: z.ZodString;
|
|
15
|
-
export declare const
|
|
15
|
+
export declare const promptResponseSchema: z.ZodObject<{
|
|
16
16
|
id: z.ZodString;
|
|
17
17
|
tenantId: z.ZodString;
|
|
18
18
|
agentId: z.ZodNullable<z.ZodString>;
|
|
@@ -45,18 +45,6 @@ export declare const promptsListQuerySchema: z.ZodObject<{
|
|
|
45
45
|
userId: z.ZodOptional<z.ZodString>;
|
|
46
46
|
agentId: z.ZodOptional<z.ZodString>;
|
|
47
47
|
}, z.core.$strict>;
|
|
48
|
-
export declare const promptResponseSchema: z.ZodObject<{
|
|
49
|
-
id: z.ZodString;
|
|
50
|
-
tenantId: z.ZodString;
|
|
51
|
-
agentId: z.ZodNullable<z.ZodString>;
|
|
52
|
-
name: z.ZodString;
|
|
53
|
-
template: z.ZodString;
|
|
54
|
-
variables: z.ZodArray<z.ZodString>;
|
|
55
|
-
userId: z.ZodString;
|
|
56
|
-
metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
57
|
-
createdAt: z.ZodISODateTime;
|
|
58
|
-
updatedAt: z.ZodISODateTime;
|
|
59
|
-
}, z.core.$strip>;
|
|
60
48
|
export declare const createPromptBodySchema: z.ZodObject<{
|
|
61
49
|
name: z.ZodString;
|
|
62
50
|
template: z.ZodString;
|
|
@@ -79,7 +67,6 @@ export declare const updatePromptBodySchema: z.ZodObject<{
|
|
|
79
67
|
* @throws Error - If a variable has no string value.
|
|
80
68
|
*/
|
|
81
69
|
export declare function renderPromptTemplate(template: string, values: Record<string, string>): string;
|
|
82
|
-
export type Prompt = z.infer<typeof promptSchema>;
|
|
83
70
|
export type PromptsResponse = z.infer<typeof promptsResponseSchema>;
|
|
84
71
|
export type PromptsListQuery = z.infer<typeof promptsListQuerySchema>;
|
|
85
72
|
export type PromptResponse = z.infer<typeof promptResponseSchema>;
|
|
@@ -51,7 +51,7 @@ export const promptTemplateSchema = z
|
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
|
-
export const
|
|
54
|
+
export const promptResponseSchema = z
|
|
55
55
|
.object({
|
|
56
56
|
id: promptIdSchema,
|
|
57
57
|
tenantId: tenantIdSchema,
|
|
@@ -65,7 +65,7 @@ export const promptSchema = z
|
|
|
65
65
|
updatedAt: z.iso.datetime({ offset: true }),
|
|
66
66
|
})
|
|
67
67
|
.strip();
|
|
68
|
-
export const promptsResponseSchema = paginatedResponseSchema(
|
|
68
|
+
export const promptsResponseSchema = paginatedResponseSchema(promptResponseSchema);
|
|
69
69
|
export const promptsListQuerySchema = z
|
|
70
70
|
.object({
|
|
71
71
|
cursor: cursorSchema.optional(),
|
|
@@ -79,7 +79,6 @@ export const promptsListQuerySchema = z
|
|
|
79
79
|
agentId: agentIdSchema.optional(),
|
|
80
80
|
})
|
|
81
81
|
.strict();
|
|
82
|
-
export const promptResponseSchema = promptSchema;
|
|
83
82
|
export const createPromptBodySchema = z
|
|
84
83
|
.object({
|
|
85
84
|
name: promptNameSchema,
|
|
@@ -13,28 +13,6 @@ export declare const providerTypeSchema: z.ZodEnum<{
|
|
|
13
13
|
vercel_ai_gateway: "vercel_ai_gateway";
|
|
14
14
|
}>;
|
|
15
15
|
export type ProviderType = z.infer<typeof providerTypeSchema>;
|
|
16
|
-
/**
|
|
17
|
-
* Stored row — the full persisted record, including the Vault pointer and
|
|
18
|
-
* tenant id. Used internally by services; never sent on the wire.
|
|
19
|
-
*/
|
|
20
|
-
export declare const providerSchema: z.ZodObject<{
|
|
21
|
-
id: z.ZodString;
|
|
22
|
-
tenantId: z.ZodString;
|
|
23
|
-
name: z.ZodString;
|
|
24
|
-
providerType: z.ZodEnum<{
|
|
25
|
-
anthropic: "anthropic";
|
|
26
|
-
custom: "custom";
|
|
27
|
-
google: "google";
|
|
28
|
-
openai: "openai";
|
|
29
|
-
openrouter: "openrouter";
|
|
30
|
-
vercel_ai_gateway: "vercel_ai_gateway";
|
|
31
|
-
}>;
|
|
32
|
-
baseUrl: z.ZodNullable<z.ZodString>;
|
|
33
|
-
keyFragment: z.ZodString;
|
|
34
|
-
vaultSecretId: z.ZodString;
|
|
35
|
-
createdAt: z.ZodISODateTime;
|
|
36
|
-
updatedAt: z.ZodISODateTime;
|
|
37
|
-
}, z.core.$strict>;
|
|
38
16
|
/**
|
|
39
17
|
* `GET /v1/providers/{id}` wire response. The Vault pointer and tenant id
|
|
40
18
|
* stay internal.
|
|
@@ -91,10 +69,6 @@ export declare const providerModelsResponseSchema: z.ZodObject<{
|
|
|
91
69
|
id: z.ZodString;
|
|
92
70
|
}, z.core.$strip>>;
|
|
93
71
|
}, z.core.$strip>;
|
|
94
|
-
export declare const providerHistoricalUseDetailsSchema: z.ZodObject<{
|
|
95
|
-
sessionIds: z.ZodArray<z.ZodString>;
|
|
96
|
-
taskRunIds: z.ZodArray<z.ZodString>;
|
|
97
|
-
}, z.core.$strip>;
|
|
98
72
|
/**
|
|
99
73
|
* `POST /v1/providers` — name, type, optional base URL, and the API key
|
|
100
74
|
* (plaintext, never stored — goes to Vault). `custom` providers require a
|
|
@@ -118,11 +92,9 @@ export declare const createProviderBodySchema: z.ZodObject<{
|
|
|
118
92
|
export declare const updateProviderBodySchema: z.ZodObject<{
|
|
119
93
|
name: z.ZodString;
|
|
120
94
|
}, z.core.$strict>;
|
|
121
|
-
export type Provider = z.infer<typeof providerSchema>;
|
|
122
95
|
export type ProvidersResponse = z.infer<typeof providersResponseSchema>;
|
|
123
96
|
export type ProviderModelsResponse = z.infer<typeof providerModelsResponseSchema>;
|
|
124
97
|
export type ProviderModel = ProviderModelsResponse["models"][number];
|
|
125
|
-
export type ProviderHistoricalUseDetails = z.infer<typeof providerHistoricalUseDetailsSchema>;
|
|
126
98
|
export interface DeleteProviderOptions {
|
|
127
99
|
confirmSnapshotInvalidation?: boolean;
|
|
128
100
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { providerIdSchema, providerKeyFragmentSchema
|
|
2
|
+
import { providerIdSchema, providerKeyFragmentSchema } from "../ids.js";
|
|
3
3
|
import { MAX_PROVIDER_NAME_LENGTH } from "../limitations.js";
|
|
4
4
|
/**
|
|
5
5
|
* Provider type — the enum of model providers we support. Selects catalog
|
|
@@ -20,23 +20,6 @@ const providerNameSchema = z
|
|
|
20
20
|
.min(1)
|
|
21
21
|
.max(MAX_PROVIDER_NAME_LENGTH);
|
|
22
22
|
const providerBaseUrlSchema = z.string().trim().min(1).url().or(z.literal(""));
|
|
23
|
-
/**
|
|
24
|
-
* Stored row — the full persisted record, including the Vault pointer and
|
|
25
|
-
* tenant id. Used internally by services; never sent on the wire.
|
|
26
|
-
*/
|
|
27
|
-
export const providerSchema = z
|
|
28
|
-
.object({
|
|
29
|
-
id: providerIdSchema,
|
|
30
|
-
tenantId: tenantIdSchema,
|
|
31
|
-
name: providerNameSchema,
|
|
32
|
-
providerType: providerTypeSchema,
|
|
33
|
-
baseUrl: z.string().nullable(),
|
|
34
|
-
keyFragment: providerKeyFragmentSchema,
|
|
35
|
-
vaultSecretId: z.string().min(1),
|
|
36
|
-
createdAt: z.iso.datetime({ offset: true }),
|
|
37
|
-
updatedAt: z.iso.datetime({ offset: true }),
|
|
38
|
-
})
|
|
39
|
-
.strict();
|
|
40
23
|
/**
|
|
41
24
|
* `GET /v1/providers/{id}` wire response. The Vault pointer and tenant id
|
|
42
25
|
* stay internal.
|
|
@@ -70,12 +53,6 @@ export const providerModelsResponseSchema = z
|
|
|
70
53
|
.strip()),
|
|
71
54
|
})
|
|
72
55
|
.strip();
|
|
73
|
-
export const providerHistoricalUseDetailsSchema = z
|
|
74
|
-
.object({
|
|
75
|
-
sessionIds: z.array(sessionIdSchema),
|
|
76
|
-
taskRunIds: z.array(taskRunIdSchema),
|
|
77
|
-
})
|
|
78
|
-
.strip();
|
|
79
56
|
/**
|
|
80
57
|
* `POST /v1/providers` — name, type, optional base URL, and the API key
|
|
81
58
|
* (plaintext, never stored — goes to Vault). `custom` providers require a
|
|
@@ -221,11 +221,6 @@ export declare const sessionMessagesResponseSchema: z.ZodObject<{
|
|
|
221
221
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
222
222
|
latestCursor: z.ZodNullable<z.ZodString>;
|
|
223
223
|
}, z.core.$strip>;
|
|
224
|
-
export declare const sessionMessagesQuerySchema: z.ZodObject<{
|
|
225
|
-
limit: z.ZodDefault<z.ZodNumber>;
|
|
226
|
-
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
227
|
-
after: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
228
|
-
}, z.core.$strict>;
|
|
229
224
|
/** One decision in the current Tool approval round. */
|
|
230
225
|
export declare const toolApprovalDecisionSchema: z.ZodObject<{
|
|
231
226
|
approvalId: z.ZodString;
|
|
@@ -351,15 +346,11 @@ export declare const continueToolApprovalsBodySchema: z.ZodObject<{
|
|
|
351
346
|
inputSchema: z.ZodCustom<z.core.JSONSchema.JSONSchema, z.core.JSONSchema.JSONSchema>;
|
|
352
347
|
}, z.core.$strict>>>;
|
|
353
348
|
}, z.core.$strict>;
|
|
354
|
-
export type SessionListItem = z.infer<typeof sessionListItemSchema>;
|
|
355
349
|
export type SessionForkedFrom = z.infer<typeof sessionForkedFromSchema>;
|
|
356
350
|
export type SessionResponse = z.infer<typeof sessionResponseSchema>;
|
|
357
351
|
export type SessionsListResponse = z.infer<typeof sessionsListResponseSchema>;
|
|
358
|
-
export type LatestSessionListItem = z.infer<typeof latestSessionListItemSchema>;
|
|
359
352
|
export type LatestSessionsListResponse = z.infer<typeof latestSessionsListResponseSchema>;
|
|
360
|
-
export type SessionMessage = z.infer<typeof sessionMessageSchema>;
|
|
361
353
|
export type SessionMessagesResponse = z.infer<typeof sessionMessagesResponseSchema>;
|
|
362
|
-
export type SessionMessagesQuery = z.infer<typeof sessionMessagesQuerySchema>;
|
|
363
354
|
export type ToolApprovalDecision = z.infer<typeof toolApprovalDecisionSchema>;
|
|
364
355
|
export type ContinueToolApprovalsBody = z.infer<typeof continueToolApprovalsBodySchema>;
|
|
365
356
|
export type ToolApprovalContinuationState = z.infer<typeof toolApprovalContinuationStateSchema>;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { paginatedResponseSchema } from "../api.js";
|
|
3
3
|
import { agentIdSchema, sessionIdSchema } from "../ids.js";
|
|
4
|
-
import { DEFAULT_SESSION_MESSAGES_LIMIT, MAX_SESSION_MESSAGES_LIMIT, } from "../limitations.js";
|
|
5
4
|
import { toolExecutionReferenceSchema } from "./agent-approval.js";
|
|
6
|
-
import { agentConfigSchema,
|
|
5
|
+
import { agentConfigSchema, agentResponseSchema } from "./agents.js";
|
|
7
6
|
import { metadataSchema, userIdSchema } from "./attribution.js";
|
|
8
7
|
import { chatFunctionDefinitionsSchema } from "./chat.js";
|
|
9
8
|
/**
|
|
@@ -43,9 +42,9 @@ export const sessionResponseSchema = sessionListItemSchema
|
|
|
43
42
|
export const latestSessionListItemSchema = sessionListItemSchema
|
|
44
43
|
.extend({
|
|
45
44
|
agentId: agentIdSchema,
|
|
46
|
-
model:
|
|
47
|
-
thinkingLevel:
|
|
48
|
-
status:
|
|
45
|
+
model: agentResponseSchema.shape.model,
|
|
46
|
+
thinkingLevel: agentResponseSchema.shape.thinkingLevel,
|
|
47
|
+
status: agentResponseSchema.shape.status,
|
|
49
48
|
})
|
|
50
49
|
.strip();
|
|
51
50
|
export const latestSessionsListResponseSchema = paginatedResponseSchema(latestSessionListItemSchema);
|
|
@@ -85,22 +84,6 @@ export const sessionMessagesResponseSchema = z
|
|
|
85
84
|
latestCursor: z.string().nullable(),
|
|
86
85
|
})
|
|
87
86
|
.strip();
|
|
88
|
-
export const sessionMessagesQuerySchema = z
|
|
89
|
-
.object({
|
|
90
|
-
limit: z
|
|
91
|
-
.number()
|
|
92
|
-
.int()
|
|
93
|
-
.min(1)
|
|
94
|
-
.max(MAX_SESSION_MESSAGES_LIMIT)
|
|
95
|
-
.default(DEFAULT_SESSION_MESSAGES_LIMIT),
|
|
96
|
-
cursor: z.string().nullable().optional(),
|
|
97
|
-
after: z.string().nullable().optional(),
|
|
98
|
-
})
|
|
99
|
-
.strict()
|
|
100
|
-
.refine((value) => !(value.cursor && value.after), {
|
|
101
|
-
message: "cursor and after are mutually exclusive.",
|
|
102
|
-
path: ["after"],
|
|
103
|
-
});
|
|
104
87
|
/** One decision in the current Tool approval round. */
|
|
105
88
|
export const toolApprovalDecisionSchema = z
|
|
106
89
|
.object({
|
|
@@ -2,14 +2,6 @@ import { z } from "zod";
|
|
|
2
2
|
export declare const skillNameSchema: z.ZodString;
|
|
3
3
|
export declare const skillDescriptionSchema: z.ZodString;
|
|
4
4
|
export declare const skillMetadataSchema: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
5
|
-
export declare const skillFrontmatterSchema: z.ZodObject<{
|
|
6
|
-
name: z.ZodString;
|
|
7
|
-
description: z.ZodString;
|
|
8
|
-
license: z.ZodOptional<z.ZodString>;
|
|
9
|
-
compatibility: z.ZodOptional<z.ZodString>;
|
|
10
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
11
|
-
"allowed-tools": z.ZodOptional<z.ZodString>;
|
|
12
|
-
}, z.core.$strict>;
|
|
13
5
|
export declare const skillSchema: z.ZodObject<{
|
|
14
6
|
id: z.ZodString;
|
|
15
7
|
tenantId: z.ZodString;
|
|
@@ -39,24 +31,6 @@ export declare const skillDetailSchema: z.ZodObject<{
|
|
|
39
31
|
sizeBytes: z.ZodNumber;
|
|
40
32
|
}, z.core.$strip>>;
|
|
41
33
|
}, z.core.$strip>;
|
|
42
|
-
export declare const skillResponseSchema: z.ZodObject<{
|
|
43
|
-
id: z.ZodString;
|
|
44
|
-
tenantId: z.ZodString;
|
|
45
|
-
agentId: z.ZodString;
|
|
46
|
-
name: z.ZodString;
|
|
47
|
-
description: z.ZodString;
|
|
48
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
49
|
-
createdAt: z.ZodISODateTime;
|
|
50
|
-
updatedAt: z.ZodISODateTime;
|
|
51
|
-
files: z.ZodArray<z.ZodObject<{
|
|
52
|
-
path: z.ZodString;
|
|
53
|
-
sizeBytes: z.ZodNumber;
|
|
54
|
-
}, z.core.$strip>>;
|
|
55
|
-
}, z.core.$strip>;
|
|
56
|
-
export declare const skillsListQuerySchema: z.ZodObject<{
|
|
57
|
-
cursor: z.ZodOptional<z.ZodString>;
|
|
58
|
-
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
59
|
-
}, z.core.$strict>;
|
|
60
34
|
export declare const skillsListResponseSchema: z.ZodObject<{
|
|
61
35
|
data: z.ZodArray<z.ZodObject<{
|
|
62
36
|
id: z.ZodString;
|
|
@@ -79,14 +53,6 @@ export declare const skillArchiveTypeSchema: z.ZodEnum<{
|
|
|
79
53
|
"tar.gz": "tar.gz";
|
|
80
54
|
zip: "zip";
|
|
81
55
|
}>;
|
|
82
|
-
export declare const skillUploadBodySchema: z.ZodObject<{
|
|
83
|
-
type: z.ZodEnum<{
|
|
84
|
-
tar: "tar";
|
|
85
|
-
"tar.gz": "tar.gz";
|
|
86
|
-
zip: "zip";
|
|
87
|
-
}>;
|
|
88
|
-
file: z.ZodFile;
|
|
89
|
-
}, z.core.$strict>;
|
|
90
56
|
export declare const copySkillBodySchema: z.ZodObject<{
|
|
91
57
|
agentIds: z.ZodArray<z.ZodString>;
|
|
92
58
|
}, z.core.$strict>;
|
|
@@ -142,29 +108,11 @@ export declare const skillCopyResultsSchema: z.ZodArray<z.ZodDiscriminatedUnion<
|
|
|
142
108
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
143
109
|
}, z.core.$strip>;
|
|
144
110
|
}, z.core.$strip>], "status">>;
|
|
145
|
-
export interface SkillMarkdownFrontmatterParseSuccess {
|
|
146
|
-
frontmatter: SkillFrontmatter;
|
|
147
|
-
success: true;
|
|
148
|
-
}
|
|
149
|
-
export interface SkillMarkdownFrontmatterParseFailure {
|
|
150
|
-
message: string;
|
|
151
|
-
success: false;
|
|
152
|
-
}
|
|
153
|
-
export type SkillMarkdownFrontmatterParseResult = SkillMarkdownFrontmatterParseSuccess | SkillMarkdownFrontmatterParseFailure;
|
|
154
|
-
/**
|
|
155
|
-
* Parses and validates YAML frontmatter from Skill Markdown.
|
|
156
|
-
*/
|
|
157
|
-
export declare function parseSkillMarkdownFrontmatter(content: string): SkillMarkdownFrontmatterParseResult;
|
|
158
111
|
export type Skill = z.infer<typeof skillSchema>;
|
|
159
112
|
export type SkillDetail = z.infer<typeof skillDetailSchema>;
|
|
160
|
-
export type SkillResponse = z.infer<typeof skillResponseSchema>;
|
|
161
113
|
export type SkillFile = z.infer<typeof skillFileSchema>;
|
|
162
|
-
export type SkillFrontmatter = z.infer<typeof skillFrontmatterSchema>;
|
|
163
|
-
export type SkillsListQuery = z.infer<typeof skillsListQuerySchema>;
|
|
164
114
|
export type SkillsListResponse = z.infer<typeof skillsListResponseSchema>;
|
|
165
115
|
export type CreateSkillBody = z.infer<typeof createSkillBodySchema>;
|
|
166
116
|
export type SkillArchiveType = z.infer<typeof skillArchiveTypeSchema>;
|
|
167
|
-
export type SkillUploadBody = z.infer<typeof skillUploadBodySchema>;
|
|
168
|
-
export type CopySkillBody = z.infer<typeof copySkillBodySchema>;
|
|
169
117
|
export type SkillCopyResult = z.infer<typeof skillCopyResultSchema>;
|
|
170
118
|
export type SkillCopyResults = z.infer<typeof skillCopyResultsSchema>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { parseDocument } from "yaml";
|
|
2
1
|
import { z } from "zod";
|
|
3
|
-
import {
|
|
2
|
+
import { paginatedResponseSchema } from "../api.js";
|
|
4
3
|
import { agentIdSchema, skillIdSchema, tenantIdSchema } from "../ids.js";
|
|
5
|
-
import {
|
|
4
|
+
import { MAX_SKILL_COPY_DESTINATIONS, MAX_SKILL_DESCRIPTION_LENGTH, MAX_SKILL_NAME_LENGTH, } from "../limitations.js";
|
|
6
5
|
import { hasUniqueValues } from "../utils.js";
|
|
7
6
|
export const skillNameSchema = z
|
|
8
7
|
.string()
|
|
@@ -20,16 +19,6 @@ export const skillDescriptionSchema = z
|
|
|
20
19
|
.min(1, { message: "Description is required." })
|
|
21
20
|
.max(MAX_SKILL_DESCRIPTION_LENGTH);
|
|
22
21
|
export const skillMetadataSchema = z.record(z.string(), z.string());
|
|
23
|
-
export const skillFrontmatterSchema = z
|
|
24
|
-
.object({
|
|
25
|
-
name: skillNameSchema,
|
|
26
|
-
description: skillDescriptionSchema,
|
|
27
|
-
license: z.string().optional(),
|
|
28
|
-
compatibility: z.string().max(MAX_SKILL_COMPATIBILITY_LENGTH).optional(),
|
|
29
|
-
metadata: skillMetadataSchema.optional(),
|
|
30
|
-
"allowed-tools": z.string().optional(),
|
|
31
|
-
})
|
|
32
|
-
.strict();
|
|
33
22
|
export const skillSchema = z
|
|
34
23
|
.object({
|
|
35
24
|
id: skillIdSchema,
|
|
@@ -63,18 +52,6 @@ export const skillDetailSchema = skillSchema
|
|
|
63
52
|
files: z.array(skillFileSchema),
|
|
64
53
|
})
|
|
65
54
|
.strip();
|
|
66
|
-
export const skillResponseSchema = skillDetailSchema;
|
|
67
|
-
export const skillsListQuerySchema = z
|
|
68
|
-
.object({
|
|
69
|
-
cursor: cursorSchema.optional(),
|
|
70
|
-
limit: z.coerce
|
|
71
|
-
.number()
|
|
72
|
-
.int()
|
|
73
|
-
.min(1)
|
|
74
|
-
.max(MAX_SKILLS_LIST_LIMIT)
|
|
75
|
-
.default(DEFAULT_SKILLS_LIST_LIMIT),
|
|
76
|
-
})
|
|
77
|
-
.strict();
|
|
78
55
|
export const skillsListResponseSchema = paginatedResponseSchema(skillSchema);
|
|
79
56
|
export const createSkillBodySchema = z
|
|
80
57
|
.object({
|
|
@@ -83,12 +60,6 @@ export const createSkillBodySchema = z
|
|
|
83
60
|
})
|
|
84
61
|
.strict();
|
|
85
62
|
export const skillArchiveTypeSchema = z.enum(["zip", "tar", "tar.gz"]);
|
|
86
|
-
export const skillUploadBodySchema = z
|
|
87
|
-
.object({
|
|
88
|
-
type: skillArchiveTypeSchema,
|
|
89
|
-
file: z.file(),
|
|
90
|
-
})
|
|
91
|
-
.strict();
|
|
92
63
|
export const copySkillBodySchema = z
|
|
93
64
|
.object({
|
|
94
65
|
agentIds: z
|
|
@@ -125,32 +96,3 @@ export const skillCopyResultSchema = z.discriminatedUnion("status", [
|
|
|
125
96
|
skillCopyFailedResultSchema,
|
|
126
97
|
]);
|
|
127
98
|
export const skillCopyResultsSchema = z.array(skillCopyResultSchema);
|
|
128
|
-
const frontmatterPattern = /^---\n([\s\S]*?)\n---(?:\n|$)/;
|
|
129
|
-
/**
|
|
130
|
-
* Parses and validates YAML frontmatter from Skill Markdown.
|
|
131
|
-
*/
|
|
132
|
-
export function parseSkillMarkdownFrontmatter(content) {
|
|
133
|
-
const normalized = content.replaceAll("\r\n", "\n");
|
|
134
|
-
const match = frontmatterPattern.exec(normalized);
|
|
135
|
-
if (!match) {
|
|
136
|
-
return {
|
|
137
|
-
message: "SKILL.md must start with frontmatter.",
|
|
138
|
-
success: false,
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
const document = parseDocument(match[1]);
|
|
142
|
-
if (document.errors.length > 0) {
|
|
143
|
-
return {
|
|
144
|
-
message: `SKILL.md frontmatter is not valid YAML: ${document.errors[0].message}`,
|
|
145
|
-
success: false,
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
const result = skillFrontmatterSchema.safeParse(document.toJS());
|
|
149
|
-
if (!result.success) {
|
|
150
|
-
return {
|
|
151
|
-
message: "SKILL.md frontmatter does not match the accepted contract.",
|
|
152
|
-
success: false,
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
return { frontmatter: result.data, success: true };
|
|
156
|
-
}
|