@blazingagents/sdk 0.2.1 → 0.3.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/README.md +115 -344
- package/dist/client.d.ts +3 -1
- package/dist/client.js +1 -1
- package/dist/contracts/api.d.ts +1 -1
- package/dist/contracts/api.js +1 -1
- package/dist/contracts/entities/agents.d.ts +14 -7
- package/dist/contracts/entities/agents.js +7 -3
- package/dist/contracts/entities/artifacts.d.ts +9 -9
- package/dist/contracts/entities/artifacts.js +5 -5
- package/dist/contracts/entities/chat.d.ts +7 -7
- package/dist/contracts/entities/chat.js +5 -5
- package/dist/contracts/entities/mcp-connections.d.ts +18 -18
- package/dist/contracts/entities/mcp-connections.js +13 -13
- package/dist/contracts/entities/memories.d.ts +5 -5
- package/dist/contracts/entities/memories.js +2 -2
- package/dist/contracts/entities/prompts.d.ts +4 -4
- package/dist/contracts/entities/prompts.js +2 -2
- package/dist/contracts/entities/providers.d.ts +12 -7
- package/dist/contracts/entities/providers.js +12 -6
- package/dist/contracts/entities/sessions.d.ts +10 -10
- package/dist/contracts/entities/sessions.js +6 -6
- package/dist/contracts/entities/skills.d.ts +18 -18
- package/dist/contracts/entities/skills.js +6 -6
- package/dist/contracts/entities/tasks.d.ts +56 -46
- package/dist/contracts/entities/tasks.js +25 -16
- package/dist/contracts/entities/tenants.d.ts +6 -6
- package/dist/contracts/entities/tenants.js +4 -4
- package/dist/contracts/entities/usage.d.ts +5 -5
- package/dist/contracts/entities/usage.js +3 -3
- package/dist/contracts/entities/workspaces.d.ts +9 -9
- package/dist/contracts/entities/workspaces.js +7 -2
- package/dist/contracts/index.d.ts +1 -1
- package/dist/contracts/index.js +1 -1
- package/dist/direct-chat-transport.d.ts +16 -0
- package/dist/direct-chat-transport.js +49 -0
- package/dist/generation.js +4 -3
- package/dist/http.d.ts +2 -0
- package/dist/http.js +2 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -0
- package/dist/relay.js +2 -2
- package/dist/resources/agents.js +37 -22
- package/dist/resources/artifacts.js +8 -6
- package/dist/resources/mcp-connections.js +19 -15
- package/dist/resources/memories.js +10 -9
- package/dist/resources/prompts.js +10 -6
- package/dist/resources/providers.js +18 -12
- package/dist/resources/sessions.js +12 -10
- package/dist/resources/skills.js +33 -21
- package/dist/resources/tasks.js +22 -14
- package/dist/resources/tenant.js +4 -3
- package/dist/resources/usage.js +4 -3
- package/dist/resources/workspaces.js +10 -8
- package/dist/types.d.ts +225 -104
- package/package.json +2 -2
|
@@ -15,7 +15,7 @@ export declare const sessionListItemSchema: z.ZodObject<{
|
|
|
15
15
|
metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
16
16
|
createdAt: z.ZodISODateTime;
|
|
17
17
|
updatedAt: z.ZodISODateTime;
|
|
18
|
-
}, z.core.$
|
|
18
|
+
}, z.core.$strip>;
|
|
19
19
|
export declare const sessionsListResponseSchema: z.ZodObject<{
|
|
20
20
|
data: z.ZodArray<z.ZodObject<{
|
|
21
21
|
agentVersion: z.ZodNullable<z.ZodNumber>;
|
|
@@ -26,9 +26,9 @@ export declare const sessionsListResponseSchema: z.ZodObject<{
|
|
|
26
26
|
metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
27
27
|
createdAt: z.ZodISODateTime;
|
|
28
28
|
updatedAt: z.ZodISODateTime;
|
|
29
|
-
}, z.core.$
|
|
29
|
+
}, z.core.$strip>>;
|
|
30
30
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
31
|
-
}, z.core.$
|
|
31
|
+
}, z.core.$strip>;
|
|
32
32
|
/**
|
|
33
33
|
* `GET /v1/agents/{agentId}/sessions/{sessionId}/messages` — transcript as
|
|
34
34
|
* `UIMessage[]` verbatim, paginated backwards (newest page first) with an
|
|
@@ -70,7 +70,7 @@ export declare const sessionMessagesResponseSchema: z.ZodObject<{
|
|
|
70
70
|
}, z.core.$loose>>;
|
|
71
71
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
72
72
|
latestCursor: z.ZodNullable<z.ZodString>;
|
|
73
|
-
}, z.core.$
|
|
73
|
+
}, z.core.$strip>;
|
|
74
74
|
export declare const sessionMessagesQuerySchema: z.ZodObject<{
|
|
75
75
|
limit: z.ZodDefault<z.ZodNumber>;
|
|
76
76
|
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -99,7 +99,7 @@ export declare const toolApprovalStateSchema: z.ZodObject<{
|
|
|
99
99
|
reason: z.ZodNullable<z.ZodString>;
|
|
100
100
|
toolCallId: z.ZodString;
|
|
101
101
|
toolName: z.ZodString;
|
|
102
|
-
}, z.core.$
|
|
102
|
+
}, z.core.$strip>;
|
|
103
103
|
export declare const toolApprovalContinuationSchema: z.ZodObject<{
|
|
104
104
|
id: z.ZodString;
|
|
105
105
|
state: z.ZodEnum<{
|
|
@@ -109,7 +109,7 @@ export declare const toolApprovalContinuationSchema: z.ZodObject<{
|
|
|
109
109
|
succeeded: "succeeded";
|
|
110
110
|
waiting: "waiting";
|
|
111
111
|
}>;
|
|
112
|
-
}, z.core.$
|
|
112
|
+
}, z.core.$strip>;
|
|
113
113
|
export declare const toolApprovalsResponseSchema: z.ZodObject<{
|
|
114
114
|
data: z.ZodArray<z.ZodObject<{
|
|
115
115
|
approvalId: z.ZodString;
|
|
@@ -122,7 +122,7 @@ export declare const toolApprovalsResponseSchema: z.ZodObject<{
|
|
|
122
122
|
reason: z.ZodNullable<z.ZodString>;
|
|
123
123
|
toolCallId: z.ZodString;
|
|
124
124
|
toolName: z.ZodString;
|
|
125
|
-
}, z.core.$
|
|
125
|
+
}, z.core.$strip>>;
|
|
126
126
|
continuation: z.ZodNullable<z.ZodObject<{
|
|
127
127
|
id: z.ZodString;
|
|
128
128
|
state: z.ZodEnum<{
|
|
@@ -132,8 +132,8 @@ export declare const toolApprovalsResponseSchema: z.ZodObject<{
|
|
|
132
132
|
succeeded: "succeeded";
|
|
133
133
|
waiting: "waiting";
|
|
134
134
|
}>;
|
|
135
|
-
}, z.core.$
|
|
136
|
-
}, z.core.$
|
|
135
|
+
}, z.core.$strip>>;
|
|
136
|
+
}, z.core.$strip>;
|
|
137
137
|
export declare const toolApprovalDecisionResponseSchema: z.ZodObject<{
|
|
138
138
|
continuationId: z.ZodString;
|
|
139
139
|
state: z.ZodEnum<{
|
|
@@ -143,7 +143,7 @@ export declare const toolApprovalDecisionResponseSchema: z.ZodObject<{
|
|
|
143
143
|
succeeded: "succeeded";
|
|
144
144
|
waiting: "waiting";
|
|
145
145
|
}>;
|
|
146
|
-
}, z.core.$
|
|
146
|
+
}, z.core.$strip>;
|
|
147
147
|
export type SessionListItem = z.infer<typeof sessionListItemSchema>;
|
|
148
148
|
export type SessionsListResponse = z.infer<typeof sessionsListResponseSchema>;
|
|
149
149
|
export type SessionMessage = z.infer<typeof sessionMessageSchema>;
|
|
@@ -22,7 +22,7 @@ export const sessionListItemSchema = z
|
|
|
22
22
|
createdAt: z.iso.datetime({ offset: true }),
|
|
23
23
|
updatedAt: z.iso.datetime({ offset: true }),
|
|
24
24
|
})
|
|
25
|
-
.
|
|
25
|
+
.strip();
|
|
26
26
|
export const sessionsListResponseSchema = paginatedResponseSchema(sessionListItemSchema);
|
|
27
27
|
/**
|
|
28
28
|
* `GET /v1/agents/{agentId}/sessions/{sessionId}/messages` — transcript as
|
|
@@ -58,7 +58,7 @@ export const sessionMessagesResponseSchema = z
|
|
|
58
58
|
nextCursor: z.string().nullable(),
|
|
59
59
|
latestCursor: z.string().nullable(),
|
|
60
60
|
})
|
|
61
|
-
.
|
|
61
|
+
.strip();
|
|
62
62
|
// Query params for the messages endpoint.
|
|
63
63
|
export const sessionMessagesQuerySchema = z
|
|
64
64
|
.object({
|
|
@@ -99,22 +99,22 @@ export const toolApprovalStateSchema = z
|
|
|
99
99
|
toolCallId: z.string().min(1),
|
|
100
100
|
toolName: z.string().min(1),
|
|
101
101
|
})
|
|
102
|
-
.
|
|
102
|
+
.strip();
|
|
103
103
|
export const toolApprovalContinuationSchema = z
|
|
104
104
|
.object({
|
|
105
105
|
id: z.string().min(1),
|
|
106
106
|
state: toolApprovalContinuationStateSchema,
|
|
107
107
|
})
|
|
108
|
-
.
|
|
108
|
+
.strip();
|
|
109
109
|
export const toolApprovalsResponseSchema = z
|
|
110
110
|
.object({
|
|
111
111
|
data: z.array(toolApprovalStateSchema),
|
|
112
112
|
continuation: toolApprovalContinuationSchema.nullable(),
|
|
113
113
|
})
|
|
114
|
-
.
|
|
114
|
+
.strip();
|
|
115
115
|
export const toolApprovalDecisionResponseSchema = z
|
|
116
116
|
.object({
|
|
117
117
|
continuationId: z.string().min(1),
|
|
118
118
|
state: toolApprovalContinuationStateSchema,
|
|
119
119
|
})
|
|
120
|
-
.
|
|
120
|
+
.strip();
|
|
@@ -19,12 +19,12 @@ export declare const skillSchema: z.ZodObject<{
|
|
|
19
19
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
20
20
|
createdAt: z.ZodISODateTime;
|
|
21
21
|
updatedAt: z.ZodISODateTime;
|
|
22
|
-
}, z.core.$
|
|
22
|
+
}, z.core.$strip>;
|
|
23
23
|
export declare const skillFilePathSchema: z.ZodString;
|
|
24
24
|
export declare const skillFileSchema: z.ZodObject<{
|
|
25
25
|
path: z.ZodString;
|
|
26
26
|
sizeBytes: z.ZodNumber;
|
|
27
|
-
}, z.core.$
|
|
27
|
+
}, z.core.$strip>;
|
|
28
28
|
export declare const skillDetailSchema: z.ZodObject<{
|
|
29
29
|
id: z.ZodString;
|
|
30
30
|
tenantId: z.ZodString;
|
|
@@ -37,8 +37,8 @@ export declare const skillDetailSchema: z.ZodObject<{
|
|
|
37
37
|
files: z.ZodArray<z.ZodObject<{
|
|
38
38
|
path: z.ZodString;
|
|
39
39
|
sizeBytes: z.ZodNumber;
|
|
40
|
-
}, z.core.$
|
|
41
|
-
}, z.core.$
|
|
40
|
+
}, z.core.$strip>>;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
42
|
export declare const skillResponseSchema: z.ZodObject<{
|
|
43
43
|
id: z.ZodString;
|
|
44
44
|
tenantId: z.ZodString;
|
|
@@ -51,8 +51,8 @@ export declare const skillResponseSchema: z.ZodObject<{
|
|
|
51
51
|
files: z.ZodArray<z.ZodObject<{
|
|
52
52
|
path: z.ZodString;
|
|
53
53
|
sizeBytes: z.ZodNumber;
|
|
54
|
-
}, z.core.$
|
|
55
|
-
}, z.core.$
|
|
54
|
+
}, z.core.$strip>>;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
56
|
export declare const skillsListQuerySchema: z.ZodObject<{
|
|
57
57
|
cursor: z.ZodOptional<z.ZodString>;
|
|
58
58
|
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
@@ -67,9 +67,9 @@ export declare const skillsListResponseSchema: z.ZodObject<{
|
|
|
67
67
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
68
68
|
createdAt: z.ZodISODateTime;
|
|
69
69
|
updatedAt: z.ZodISODateTime;
|
|
70
|
-
}, z.core.$
|
|
70
|
+
}, z.core.$strip>>;
|
|
71
71
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
72
|
-
}, z.core.$
|
|
72
|
+
}, z.core.$strip>;
|
|
73
73
|
export declare const createSkillBodySchema: z.ZodObject<{
|
|
74
74
|
path: z.ZodLiteral<"SKILL.md">;
|
|
75
75
|
content: z.ZodString;
|
|
@@ -105,17 +105,17 @@ export declare const skillCopyResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
105
105
|
files: z.ZodArray<z.ZodObject<{
|
|
106
106
|
path: z.ZodString;
|
|
107
107
|
sizeBytes: z.ZodNumber;
|
|
108
|
-
}, z.core.$
|
|
109
|
-
}, z.core.$
|
|
110
|
-
}, z.core.$
|
|
108
|
+
}, z.core.$strip>>;
|
|
109
|
+
}, z.core.$strip>;
|
|
110
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
111
111
|
agentId: z.ZodString;
|
|
112
112
|
status: z.ZodLiteral<"failed">;
|
|
113
113
|
error: z.ZodObject<{
|
|
114
114
|
code: z.ZodString;
|
|
115
115
|
message: z.ZodString;
|
|
116
116
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
117
|
-
}, z.core.$
|
|
118
|
-
}, z.core.$
|
|
117
|
+
}, z.core.$strip>;
|
|
118
|
+
}, z.core.$strip>], "status">;
|
|
119
119
|
export declare const skillCopyResultsSchema: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
120
120
|
agentId: z.ZodString;
|
|
121
121
|
status: z.ZodLiteral<"created">;
|
|
@@ -131,17 +131,17 @@ export declare const skillCopyResultsSchema: z.ZodArray<z.ZodDiscriminatedUnion<
|
|
|
131
131
|
files: z.ZodArray<z.ZodObject<{
|
|
132
132
|
path: z.ZodString;
|
|
133
133
|
sizeBytes: z.ZodNumber;
|
|
134
|
-
}, z.core.$
|
|
135
|
-
}, z.core.$
|
|
136
|
-
}, z.core.$
|
|
134
|
+
}, z.core.$strip>>;
|
|
135
|
+
}, z.core.$strip>;
|
|
136
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
137
137
|
agentId: z.ZodString;
|
|
138
138
|
status: z.ZodLiteral<"failed">;
|
|
139
139
|
error: z.ZodObject<{
|
|
140
140
|
code: z.ZodString;
|
|
141
141
|
message: z.ZodString;
|
|
142
142
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
143
|
-
}, z.core.$
|
|
144
|
-
}, z.core.$
|
|
143
|
+
}, z.core.$strip>;
|
|
144
|
+
}, z.core.$strip>], "status">>;
|
|
145
145
|
export interface SkillMarkdownFrontmatterParseSuccess {
|
|
146
146
|
frontmatter: SkillFrontmatter;
|
|
147
147
|
success: true;
|
|
@@ -41,7 +41,7 @@ export const skillSchema = z
|
|
|
41
41
|
createdAt: z.iso.datetime({ offset: true }),
|
|
42
42
|
updatedAt: z.iso.datetime({ offset: true }),
|
|
43
43
|
})
|
|
44
|
-
.
|
|
44
|
+
.strip();
|
|
45
45
|
export const skillFilePathSchema = z
|
|
46
46
|
.string()
|
|
47
47
|
.min(1)
|
|
@@ -57,12 +57,12 @@ export const skillFileSchema = z
|
|
|
57
57
|
path: skillFilePathSchema,
|
|
58
58
|
sizeBytes: z.number().int().nonnegative(),
|
|
59
59
|
})
|
|
60
|
-
.
|
|
60
|
+
.strip();
|
|
61
61
|
export const skillDetailSchema = skillSchema
|
|
62
62
|
.extend({
|
|
63
63
|
files: z.array(skillFileSchema),
|
|
64
64
|
})
|
|
65
|
-
.
|
|
65
|
+
.strip();
|
|
66
66
|
export const skillResponseSchema = skillDetailSchema;
|
|
67
67
|
export const skillsListQuerySchema = z
|
|
68
68
|
.object({
|
|
@@ -106,7 +106,7 @@ const skillCopyCreatedResultSchema = z
|
|
|
106
106
|
status: z.literal("created"),
|
|
107
107
|
skill: skillDetailSchema,
|
|
108
108
|
})
|
|
109
|
-
.
|
|
109
|
+
.strip();
|
|
110
110
|
const skillCopyFailedResultSchema = z
|
|
111
111
|
.object({
|
|
112
112
|
agentId: agentIdSchema,
|
|
@@ -117,9 +117,9 @@ const skillCopyFailedResultSchema = z
|
|
|
117
117
|
message: z.string().min(1),
|
|
118
118
|
details: z.unknown().optional(),
|
|
119
119
|
})
|
|
120
|
-
.
|
|
120
|
+
.strip(),
|
|
121
121
|
})
|
|
122
|
-
.
|
|
122
|
+
.strip();
|
|
123
123
|
export const skillCopyResultSchema = z.discriminatedUnion("status", [
|
|
124
124
|
skillCopyCreatedResultSchema,
|
|
125
125
|
skillCopyFailedResultSchema,
|
|
@@ -132,20 +132,20 @@ export declare const taskSchema: z.ZodObject<{
|
|
|
132
132
|
kind: z.ZodLiteral<"once">;
|
|
133
133
|
config: z.ZodObject<{
|
|
134
134
|
at: z.ZodISODateTime;
|
|
135
|
-
}, z.core.$
|
|
136
|
-
}, z.core.$
|
|
135
|
+
}, z.core.$strip>;
|
|
136
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
137
137
|
kind: z.ZodLiteral<"interval">;
|
|
138
138
|
config: z.ZodObject<{
|
|
139
139
|
everyMs: z.ZodNumber;
|
|
140
|
-
}, z.core.$
|
|
141
|
-
}, z.core.$
|
|
140
|
+
}, z.core.$strip>;
|
|
141
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
142
142
|
kind: z.ZodLiteral<"cron">;
|
|
143
143
|
config: z.ZodObject<{
|
|
144
144
|
expression: z.ZodString;
|
|
145
145
|
staggerMs: z.ZodOptional<z.ZodNumber>;
|
|
146
146
|
timezone: z.ZodDefault<z.ZodString>;
|
|
147
|
-
}, z.core.$
|
|
148
|
-
}, z.core.$
|
|
147
|
+
}, z.core.$strip>;
|
|
148
|
+
}, z.core.$strip>], "kind">>;
|
|
149
149
|
enabled: z.ZodBoolean;
|
|
150
150
|
activeRunId: z.ZodNullable<z.ZodString>;
|
|
151
151
|
latestRunId: z.ZodNullable<z.ZodString>;
|
|
@@ -154,7 +154,7 @@ export declare const taskSchema: z.ZodObject<{
|
|
|
154
154
|
deletedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
155
155
|
createdAt: z.ZodISODateTime;
|
|
156
156
|
updatedAt: z.ZodISODateTime;
|
|
157
|
-
}, z.core.$
|
|
157
|
+
}, z.core.$strip>;
|
|
158
158
|
export declare const taskLatestRunSchema: z.ZodObject<{
|
|
159
159
|
id: z.ZodString;
|
|
160
160
|
status: z.ZodEnum<{
|
|
@@ -166,7 +166,7 @@ export declare const taskLatestRunSchema: z.ZodObject<{
|
|
|
166
166
|
succeeded: "succeeded";
|
|
167
167
|
}>;
|
|
168
168
|
finishedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
169
|
-
}, z.core.$
|
|
169
|
+
}, z.core.$strip>;
|
|
170
170
|
export declare const taskListItemSchema: z.ZodObject<{
|
|
171
171
|
id: z.ZodString;
|
|
172
172
|
tenantId: z.ZodString;
|
|
@@ -178,20 +178,20 @@ export declare const taskListItemSchema: z.ZodObject<{
|
|
|
178
178
|
kind: z.ZodLiteral<"once">;
|
|
179
179
|
config: z.ZodObject<{
|
|
180
180
|
at: z.ZodISODateTime;
|
|
181
|
-
}, z.core.$
|
|
182
|
-
}, z.core.$
|
|
181
|
+
}, z.core.$strip>;
|
|
182
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
183
183
|
kind: z.ZodLiteral<"interval">;
|
|
184
184
|
config: z.ZodObject<{
|
|
185
185
|
everyMs: z.ZodNumber;
|
|
186
|
-
}, z.core.$
|
|
187
|
-
}, z.core.$
|
|
186
|
+
}, z.core.$strip>;
|
|
187
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
188
188
|
kind: z.ZodLiteral<"cron">;
|
|
189
189
|
config: z.ZodObject<{
|
|
190
190
|
expression: z.ZodString;
|
|
191
191
|
staggerMs: z.ZodOptional<z.ZodNumber>;
|
|
192
192
|
timezone: z.ZodDefault<z.ZodString>;
|
|
193
|
-
}, z.core.$
|
|
194
|
-
}, z.core.$
|
|
193
|
+
}, z.core.$strip>;
|
|
194
|
+
}, z.core.$strip>], "kind">>;
|
|
195
195
|
enabled: z.ZodBoolean;
|
|
196
196
|
activeRunId: z.ZodNullable<z.ZodString>;
|
|
197
197
|
latestRunId: z.ZodNullable<z.ZodString>;
|
|
@@ -211,8 +211,8 @@ export declare const taskListItemSchema: z.ZodObject<{
|
|
|
211
211
|
succeeded: "succeeded";
|
|
212
212
|
}>;
|
|
213
213
|
finishedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
214
|
-
}, z.core.$
|
|
215
|
-
}, z.core.$
|
|
214
|
+
}, z.core.$strip>>;
|
|
215
|
+
}, z.core.$strip>;
|
|
216
216
|
export declare const tasksListResponseSchema: z.ZodObject<{
|
|
217
217
|
data: z.ZodArray<z.ZodObject<{
|
|
218
218
|
id: z.ZodString;
|
|
@@ -225,20 +225,20 @@ export declare const tasksListResponseSchema: z.ZodObject<{
|
|
|
225
225
|
kind: z.ZodLiteral<"once">;
|
|
226
226
|
config: z.ZodObject<{
|
|
227
227
|
at: z.ZodISODateTime;
|
|
228
|
-
}, z.core.$
|
|
229
|
-
}, z.core.$
|
|
228
|
+
}, z.core.$strip>;
|
|
229
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
230
230
|
kind: z.ZodLiteral<"interval">;
|
|
231
231
|
config: z.ZodObject<{
|
|
232
232
|
everyMs: z.ZodNumber;
|
|
233
|
-
}, z.core.$
|
|
234
|
-
}, z.core.$
|
|
233
|
+
}, z.core.$strip>;
|
|
234
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
235
235
|
kind: z.ZodLiteral<"cron">;
|
|
236
236
|
config: z.ZodObject<{
|
|
237
237
|
expression: z.ZodString;
|
|
238
238
|
staggerMs: z.ZodOptional<z.ZodNumber>;
|
|
239
239
|
timezone: z.ZodDefault<z.ZodString>;
|
|
240
|
-
}, z.core.$
|
|
241
|
-
}, z.core.$
|
|
240
|
+
}, z.core.$strip>;
|
|
241
|
+
}, z.core.$strip>], "kind">>;
|
|
242
242
|
enabled: z.ZodBoolean;
|
|
243
243
|
activeRunId: z.ZodNullable<z.ZodString>;
|
|
244
244
|
latestRunId: z.ZodNullable<z.ZodString>;
|
|
@@ -258,10 +258,10 @@ export declare const tasksListResponseSchema: z.ZodObject<{
|
|
|
258
258
|
succeeded: "succeeded";
|
|
259
259
|
}>;
|
|
260
260
|
finishedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
261
|
-
}, z.core.$
|
|
262
|
-
}, z.core.$
|
|
261
|
+
}, z.core.$strip>>;
|
|
262
|
+
}, z.core.$strip>>;
|
|
263
263
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
264
|
-
}, z.core.$
|
|
264
|
+
}, z.core.$strip>;
|
|
265
265
|
export declare const tasksListQuerySchema: z.ZodObject<{
|
|
266
266
|
agentId: z.ZodOptional<z.ZodString>;
|
|
267
267
|
userId: z.ZodOptional<z.ZodString>;
|
|
@@ -278,20 +278,20 @@ export declare const taskResponseSchema: z.ZodObject<{
|
|
|
278
278
|
kind: z.ZodLiteral<"once">;
|
|
279
279
|
config: z.ZodObject<{
|
|
280
280
|
at: z.ZodISODateTime;
|
|
281
|
-
}, z.core.$
|
|
282
|
-
}, z.core.$
|
|
281
|
+
}, z.core.$strip>;
|
|
282
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
283
283
|
kind: z.ZodLiteral<"interval">;
|
|
284
284
|
config: z.ZodObject<{
|
|
285
285
|
everyMs: z.ZodNumber;
|
|
286
|
-
}, z.core.$
|
|
287
|
-
}, z.core.$
|
|
286
|
+
}, z.core.$strip>;
|
|
287
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
288
288
|
kind: z.ZodLiteral<"cron">;
|
|
289
289
|
config: z.ZodObject<{
|
|
290
290
|
expression: z.ZodString;
|
|
291
291
|
staggerMs: z.ZodOptional<z.ZodNumber>;
|
|
292
292
|
timezone: z.ZodDefault<z.ZodString>;
|
|
293
|
-
}, z.core.$
|
|
294
|
-
}, z.core.$
|
|
293
|
+
}, z.core.$strip>;
|
|
294
|
+
}, z.core.$strip>], "kind">>;
|
|
295
295
|
enabled: z.ZodBoolean;
|
|
296
296
|
activeRunId: z.ZodNullable<z.ZodString>;
|
|
297
297
|
latestRunId: z.ZodNullable<z.ZodString>;
|
|
@@ -300,7 +300,7 @@ export declare const taskResponseSchema: z.ZodObject<{
|
|
|
300
300
|
deletedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
301
301
|
createdAt: z.ZodISODateTime;
|
|
302
302
|
updatedAt: z.ZodISODateTime;
|
|
303
|
-
}, z.core.$
|
|
303
|
+
}, z.core.$strip>;
|
|
304
304
|
export declare const taskRunSchema: z.ZodObject<{
|
|
305
305
|
id: z.ZodString;
|
|
306
306
|
taskId: z.ZodString;
|
|
@@ -326,7 +326,7 @@ export declare const taskRunSchema: z.ZodObject<{
|
|
|
326
326
|
canceledAt: z.ZodNullable<z.ZodISODateTime>;
|
|
327
327
|
createdAt: z.ZodISODateTime;
|
|
328
328
|
updatedAt: z.ZodISODateTime;
|
|
329
|
-
}, z.core.$
|
|
329
|
+
}, z.core.$strip>;
|
|
330
330
|
export declare const taskRunResponseSchema: z.ZodObject<{
|
|
331
331
|
id: z.ZodString;
|
|
332
332
|
taskId: z.ZodString;
|
|
@@ -352,7 +352,7 @@ export declare const taskRunResponseSchema: z.ZodObject<{
|
|
|
352
352
|
canceledAt: z.ZodNullable<z.ZodISODateTime>;
|
|
353
353
|
createdAt: z.ZodISODateTime;
|
|
354
354
|
updatedAt: z.ZodISODateTime;
|
|
355
|
-
}, z.core.$
|
|
355
|
+
}, z.core.$strip>;
|
|
356
356
|
export declare const taskRunsListResponseSchema: z.ZodObject<{
|
|
357
357
|
data: z.ZodArray<z.ZodObject<{
|
|
358
358
|
id: z.ZodString;
|
|
@@ -379,9 +379,9 @@ export declare const taskRunsListResponseSchema: z.ZodObject<{
|
|
|
379
379
|
canceledAt: z.ZodNullable<z.ZodISODateTime>;
|
|
380
380
|
createdAt: z.ZodISODateTime;
|
|
381
381
|
updatedAt: z.ZodISODateTime;
|
|
382
|
-
}, z.core.$
|
|
382
|
+
}, z.core.$strip>>;
|
|
383
383
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
384
|
-
}, z.core.$
|
|
384
|
+
}, z.core.$strip>;
|
|
385
385
|
export declare const createTaskResponseSchema: z.ZodObject<{
|
|
386
386
|
task: z.ZodObject<{
|
|
387
387
|
id: z.ZodString;
|
|
@@ -394,20 +394,20 @@ export declare const createTaskResponseSchema: z.ZodObject<{
|
|
|
394
394
|
kind: z.ZodLiteral<"once">;
|
|
395
395
|
config: z.ZodObject<{
|
|
396
396
|
at: z.ZodISODateTime;
|
|
397
|
-
}, z.core.$
|
|
398
|
-
}, z.core.$
|
|
397
|
+
}, z.core.$strip>;
|
|
398
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
399
399
|
kind: z.ZodLiteral<"interval">;
|
|
400
400
|
config: z.ZodObject<{
|
|
401
401
|
everyMs: z.ZodNumber;
|
|
402
|
-
}, z.core.$
|
|
403
|
-
}, z.core.$
|
|
402
|
+
}, z.core.$strip>;
|
|
403
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
404
404
|
kind: z.ZodLiteral<"cron">;
|
|
405
405
|
config: z.ZodObject<{
|
|
406
406
|
expression: z.ZodString;
|
|
407
407
|
staggerMs: z.ZodOptional<z.ZodNumber>;
|
|
408
408
|
timezone: z.ZodDefault<z.ZodString>;
|
|
409
|
-
}, z.core.$
|
|
410
|
-
}, z.core.$
|
|
409
|
+
}, z.core.$strip>;
|
|
410
|
+
}, z.core.$strip>], "kind">>;
|
|
411
411
|
enabled: z.ZodBoolean;
|
|
412
412
|
activeRunId: z.ZodNullable<z.ZodString>;
|
|
413
413
|
latestRunId: z.ZodNullable<z.ZodString>;
|
|
@@ -416,12 +416,12 @@ export declare const createTaskResponseSchema: z.ZodObject<{
|
|
|
416
416
|
deletedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
417
417
|
createdAt: z.ZodISODateTime;
|
|
418
418
|
updatedAt: z.ZodISODateTime;
|
|
419
|
-
}, z.core.$
|
|
419
|
+
}, z.core.$strip>;
|
|
420
420
|
runId: z.ZodNullable<z.ZodString>;
|
|
421
|
-
}, z.core.$
|
|
421
|
+
}, z.core.$strip>;
|
|
422
422
|
export declare const createTaskRunResponseSchema: z.ZodObject<{
|
|
423
423
|
runId: z.ZodString;
|
|
424
|
-
}, z.core.$
|
|
424
|
+
}, z.core.$strip>;
|
|
425
425
|
export declare const taskRunMessagesResponseSchema: z.ZodObject<{
|
|
426
426
|
data: z.ZodArray<z.ZodObject<{
|
|
427
427
|
id: z.ZodString;
|
|
@@ -437,7 +437,17 @@ export declare const taskRunMessagesResponseSchema: z.ZodObject<{
|
|
|
437
437
|
}, z.core.$loose>>;
|
|
438
438
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
439
439
|
latestCursor: z.ZodNullable<z.ZodString>;
|
|
440
|
-
|
|
440
|
+
error: z.ZodNullable<z.ZodString>;
|
|
441
|
+
finishedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
442
|
+
status: z.ZodEnum<{
|
|
443
|
+
blocked: "blocked";
|
|
444
|
+
canceled: "canceled";
|
|
445
|
+
failed: "failed";
|
|
446
|
+
queued: "queued";
|
|
447
|
+
running: "running";
|
|
448
|
+
succeeded: "succeeded";
|
|
449
|
+
}>;
|
|
450
|
+
}, z.core.$strip>;
|
|
441
451
|
export type Task = z.infer<typeof taskSchema>;
|
|
442
452
|
export type TaskListItem = z.infer<typeof taskListItemSchema>;
|
|
443
453
|
export type TaskLatestRun = z.infer<typeof taskLatestRunSchema>;
|
|
@@ -6,7 +6,7 @@ import { MAX_TASK_NAME_LENGTH, MAX_TASK_PROMPT_LENGTH, MIN_TASK_INTERVAL_MS, } f
|
|
|
6
6
|
import { atLeastOneFieldMessage, hasObjectKeys } from "../utils.js";
|
|
7
7
|
import { agentVersionNumberSchema } from "./agents.js";
|
|
8
8
|
import { metadataSchema, userIdSchema } from "./attribution.js";
|
|
9
|
-
import {
|
|
9
|
+
import { sessionMessagesResponseSchema } from "./sessions.js";
|
|
10
10
|
/**
|
|
11
11
|
* Schedule kinds — discriminated union, Cohand's kinds with croner-forked
|
|
12
12
|
* next-run math. `staggerMs` is an optional cron load-spreading offset.
|
|
@@ -161,6 +161,15 @@ export const taskRunStatusSchema = z.enum([
|
|
|
161
161
|
"failed",
|
|
162
162
|
"canceled",
|
|
163
163
|
]);
|
|
164
|
+
/** Response schedules accept additive fields without relaxing schedule writes. */
|
|
165
|
+
const taskScheduleResponseSchema = z.discriminatedUnion("kind", [
|
|
166
|
+
z.object({ kind: z.literal("once"), config: taskOnceConfigSchema.strip() }),
|
|
167
|
+
z.object({
|
|
168
|
+
kind: z.literal("interval"),
|
|
169
|
+
config: taskIntervalConfigSchema.strip(),
|
|
170
|
+
}),
|
|
171
|
+
z.object({ kind: z.literal("cron"), config: taskCronConfigSchema.strip() }),
|
|
172
|
+
]);
|
|
164
173
|
// The task record — pure definition; state lives in its runs.
|
|
165
174
|
export const taskSchema = z
|
|
166
175
|
.object({
|
|
@@ -170,7 +179,7 @@ export const taskSchema = z
|
|
|
170
179
|
agentVersion: agentVersionNumberSchema.nullable(),
|
|
171
180
|
name: taskNameSchema,
|
|
172
181
|
prompt: taskPromptSchema,
|
|
173
|
-
schedule:
|
|
182
|
+
schedule: taskScheduleResponseSchema.nullable(),
|
|
174
183
|
enabled: z.boolean(),
|
|
175
184
|
activeRunId: taskRunIdSchema.nullable(),
|
|
176
185
|
latestRunId: taskRunIdSchema.nullable(),
|
|
@@ -180,7 +189,7 @@ export const taskSchema = z
|
|
|
180
189
|
createdAt: z.iso.datetime({ offset: true }),
|
|
181
190
|
updatedAt: z.iso.datetime({ offset: true }),
|
|
182
191
|
})
|
|
183
|
-
.
|
|
192
|
+
.strip();
|
|
184
193
|
// Compact run embed for list items — kills N+1 status polling.
|
|
185
194
|
export const taskLatestRunSchema = z
|
|
186
195
|
.object({
|
|
@@ -188,7 +197,7 @@ export const taskLatestRunSchema = z
|
|
|
188
197
|
status: taskRunStatusSchema,
|
|
189
198
|
finishedAt: z.iso.datetime({ offset: true }).nullable(),
|
|
190
199
|
})
|
|
191
|
-
.
|
|
200
|
+
.strip();
|
|
192
201
|
export const taskListItemSchema = taskSchema.extend({
|
|
193
202
|
latestRun: taskLatestRunSchema.nullable(),
|
|
194
203
|
});
|
|
@@ -224,7 +233,7 @@ export const taskRunSchema = z
|
|
|
224
233
|
createdAt: z.iso.datetime({ offset: true }),
|
|
225
234
|
updatedAt: z.iso.datetime({ offset: true }),
|
|
226
235
|
})
|
|
227
|
-
.
|
|
236
|
+
.strip();
|
|
228
237
|
export const taskRunResponseSchema = taskRunSchema;
|
|
229
238
|
export const taskRunsListResponseSchema = paginatedResponseSchema(taskRunSchema);
|
|
230
239
|
// `POST /v1/tasks` response — the created task + optional queued run id.
|
|
@@ -233,20 +242,20 @@ export const createTaskResponseSchema = z
|
|
|
233
242
|
task: taskSchema,
|
|
234
243
|
runId: taskRunIdSchema.nullable(),
|
|
235
244
|
})
|
|
236
|
-
.
|
|
245
|
+
.strip();
|
|
237
246
|
// `POST /v1/tasks/{taskId}/runs` response — the queued run id.
|
|
238
247
|
export const createTaskRunResponseSchema = z
|
|
239
248
|
.object({
|
|
240
249
|
runId: taskRunIdSchema,
|
|
241
250
|
})
|
|
242
|
-
.
|
|
243
|
-
// `GET .../runs/{runId}/messages` — task-run session transcript, paginated
|
|
244
|
-
//
|
|
245
|
-
//
|
|
246
|
-
export const taskRunMessagesResponseSchema =
|
|
247
|
-
.
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
+
.strip();
|
|
252
|
+
// `GET .../runs/{runId}/messages` — task-run session transcript, paginated,
|
|
253
|
+
// plus `status`, `error`, and `finishedAt` for a single client poll loop.
|
|
254
|
+
// `latestCursor` remains the tail position for the next `?after=` request.
|
|
255
|
+
export const taskRunMessagesResponseSchema = sessionMessagesResponseSchema
|
|
256
|
+
.extend({
|
|
257
|
+
error: z.string().nullable(),
|
|
258
|
+
finishedAt: z.iso.datetime({ offset: true }).nullable(),
|
|
259
|
+
status: taskRunStatusSchema,
|
|
251
260
|
})
|
|
252
|
-
.
|
|
261
|
+
.strip();
|
|
@@ -10,7 +10,7 @@ export declare const tenantSchema: z.ZodObject<{
|
|
|
10
10
|
name: z.ZodString;
|
|
11
11
|
createdAt: z.ZodISODateTime;
|
|
12
12
|
updatedAt: z.ZodISODateTime;
|
|
13
|
-
}, z.core.$
|
|
13
|
+
}, z.core.$strip>;
|
|
14
14
|
export declare const subscriptionStatusSchema: z.ZodEnum<{
|
|
15
15
|
active: "active";
|
|
16
16
|
inactive: "inactive";
|
|
@@ -26,7 +26,7 @@ export declare const tenantResponseSchema: z.ZodObject<{
|
|
|
26
26
|
active: "active";
|
|
27
27
|
inactive: "inactive";
|
|
28
28
|
}>;
|
|
29
|
-
}, z.core.$
|
|
29
|
+
}, z.core.$strip>;
|
|
30
30
|
/**
|
|
31
31
|
* Quota — `GET/PATCH /v1/tenant` carries the tenant's self-set quota.
|
|
32
32
|
* `null` means unlimited (no quota row).
|
|
@@ -42,16 +42,16 @@ export declare const tenantSettingsSchema: z.ZodObject<{
|
|
|
42
42
|
monthlyTokenLimit: z.ZodNullable<z.ZodNumber>;
|
|
43
43
|
monthlyRequestLimit: z.ZodNullable<z.ZodNumber>;
|
|
44
44
|
resetDay: z.ZodNumber;
|
|
45
|
-
}, z.core.$
|
|
46
|
-
}, z.core.$
|
|
45
|
+
}, z.core.$strip>>;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
47
|
export declare const tenantSettingsResponseSchema: z.ZodObject<{
|
|
48
48
|
name: z.ZodString;
|
|
49
49
|
quota: z.ZodNullable<z.ZodObject<{
|
|
50
50
|
monthlyTokenLimit: z.ZodNullable<z.ZodNumber>;
|
|
51
51
|
monthlyRequestLimit: z.ZodNullable<z.ZodNumber>;
|
|
52
52
|
resetDay: z.ZodNumber;
|
|
53
|
-
}, z.core.$
|
|
54
|
-
}, z.core.$
|
|
53
|
+
}, z.core.$strip>>;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
55
|
export declare const updateTenantSettingsBodySchema: z.ZodObject<{
|
|
56
56
|
name: z.ZodOptional<z.ZodString>;
|
|
57
57
|
quota: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
@@ -15,11 +15,11 @@ export const tenantSchema = z
|
|
|
15
15
|
createdAt: z.iso.datetime({ offset: true }),
|
|
16
16
|
updatedAt: z.iso.datetime({ offset: true }),
|
|
17
17
|
})
|
|
18
|
-
.
|
|
18
|
+
.strip();
|
|
19
19
|
export const subscriptionStatusSchema = z.enum(["active", "inactive"]);
|
|
20
20
|
export const tenantResponseSchema = tenantSchema
|
|
21
21
|
.extend({ subscriptionStatus: subscriptionStatusSchema })
|
|
22
|
-
.
|
|
22
|
+
.strip();
|
|
23
23
|
/**
|
|
24
24
|
* Quota — `GET/PATCH /v1/tenant` carries the tenant's self-set quota.
|
|
25
25
|
* `null` means unlimited (no quota row).
|
|
@@ -39,9 +39,9 @@ export const quotaSchema = z
|
|
|
39
39
|
export const tenantSettingsSchema = z
|
|
40
40
|
.object({
|
|
41
41
|
name: z.string().trim().min(1).max(MAX_TENANT_NAME_LENGTH),
|
|
42
|
-
quota: quotaSchema.nullable(),
|
|
42
|
+
quota: quotaSchema.strip().nullable(),
|
|
43
43
|
})
|
|
44
|
-
.
|
|
44
|
+
.strip();
|
|
45
45
|
export const tenantSettingsResponseSchema = tenantSettingsSchema;
|
|
46
46
|
export const updateTenantSettingsBodySchema = z
|
|
47
47
|
.object({
|