robotrock 0.8.5 → 0.9.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/ai/index.d.ts +4 -4
- package/dist/ai/index.js +398 -202
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/trigger.d.ts +3 -3
- package/dist/ai/trigger.js +398 -202
- package/dist/ai/trigger.js.map +1 -1
- package/dist/ai/workflow.d.ts +3 -3
- package/dist/ai/workflow.js +399 -203
- package/dist/ai/workflow.js.map +1 -1
- package/dist/{client-D-XEBOWd.d.ts → client-Cy7YLxms.d.ts} +17 -9
- package/dist/index.d.ts +9 -8
- package/dist/index.js +232 -207
- package/dist/index.js.map +1 -1
- package/dist/otel-platform-DzHyHkGk.d.ts +108 -0
- package/dist/schemas/index.d.ts +162 -104
- package/dist/schemas/index.js +39 -114
- package/dist/schemas/index.js.map +1 -1
- package/dist/{tool-approval-bridge-BKDY5NAY.d.ts → tool-approval-bridge-G765kMJR.d.ts} +1 -1
- package/dist/trigger/index.d.ts +6 -4
- package/dist/trigger/index.js +308 -145
- package/dist/trigger/index.js.map +1 -1
- package/dist/{trigger-CsOLTjsH.d.ts → trigger-D0shjqk0.d.ts} +2 -2
- package/dist/workflow/index.d.ts +6 -4
- package/dist/workflow/index.js +302 -142
- package/dist/workflow/index.js.map +1 -1
- package/package.json +1 -5
- package/dist/handler-webhook-BqEi6Bk-.d.ts +0 -16
- package/dist/otel/index.d.ts +0 -49
- package/dist/otel/index.js +0 -633
- package/dist/otel/index.js.map +0 -1
package/dist/schemas/index.d.ts
CHANGED
|
@@ -97,7 +97,10 @@ declare const taskActionSchema: z.ZodObject<{
|
|
|
97
97
|
tokenId: z.ZodString;
|
|
98
98
|
}, z.core.$strip>], "type">>>;
|
|
99
99
|
}, z.core.$strip>;
|
|
100
|
-
|
|
100
|
+
/** Task context wire format version (always `2` today). */
|
|
101
|
+
declare const TASK_CONTEXT_FORMAT_VERSION: 2;
|
|
102
|
+
type TaskContextFormatVersion = typeof TASK_CONTEXT_FORMAT_VERSION;
|
|
103
|
+
declare const taskContextSchema: z.ZodPipe<z.ZodObject<{
|
|
101
104
|
app: z.ZodOptional<z.ZodString>;
|
|
102
105
|
type: z.ZodString;
|
|
103
106
|
name: z.ZodString;
|
|
@@ -107,6 +110,7 @@ declare const taskContextSchema: z.ZodObject<{
|
|
|
107
110
|
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
108
111
|
ui: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<Record<string, unknown>, unknown, z.core.$ZodTypeInternals<Record<string, unknown>, unknown>>>>;
|
|
109
112
|
}, z.core.$strip>>;
|
|
113
|
+
contextVersion: z.ZodOptional<z.ZodLiteral<2>>;
|
|
110
114
|
version: z.ZodOptional<z.ZodLiteral<2>>;
|
|
111
115
|
actions: z.ZodArray<z.ZodObject<{
|
|
112
116
|
id: z.ZodString;
|
|
@@ -126,7 +130,69 @@ declare const taskContextSchema: z.ZodObject<{
|
|
|
126
130
|
tokenId: z.ZodString;
|
|
127
131
|
}, z.core.$strip>], "type">>>;
|
|
128
132
|
}, z.core.$strip>>;
|
|
129
|
-
}, z.core.$strip
|
|
133
|
+
}, z.core.$strip>, z.ZodTransform<Omit<{
|
|
134
|
+
type: string;
|
|
135
|
+
name: string;
|
|
136
|
+
actions: {
|
|
137
|
+
id: string;
|
|
138
|
+
title: string;
|
|
139
|
+
description?: string | undefined;
|
|
140
|
+
schema?: ExtendedJSONSchema7 | undefined;
|
|
141
|
+
ui?: UiSchema | undefined;
|
|
142
|
+
data?: Record<string, unknown> | undefined;
|
|
143
|
+
handlers?: ({
|
|
144
|
+
type: "webhook";
|
|
145
|
+
url: string;
|
|
146
|
+
headers: Record<string, string>;
|
|
147
|
+
} | {
|
|
148
|
+
url: string;
|
|
149
|
+
headers: Record<string, string>;
|
|
150
|
+
type: "trigger";
|
|
151
|
+
tokenId: string;
|
|
152
|
+
})[] | undefined;
|
|
153
|
+
}[];
|
|
154
|
+
app?: string | undefined;
|
|
155
|
+
description?: string | undefined;
|
|
156
|
+
validUntil?: string | undefined;
|
|
157
|
+
context?: {
|
|
158
|
+
data: Record<string, unknown>;
|
|
159
|
+
ui?: Record<string, Record<string, unknown>> | undefined;
|
|
160
|
+
} | undefined;
|
|
161
|
+
contextVersion?: 2 | undefined;
|
|
162
|
+
version?: 2 | undefined;
|
|
163
|
+
}, "contextVersion" | "version"> & {
|
|
164
|
+
contextVersion: 2;
|
|
165
|
+
}, {
|
|
166
|
+
type: string;
|
|
167
|
+
name: string;
|
|
168
|
+
actions: {
|
|
169
|
+
id: string;
|
|
170
|
+
title: string;
|
|
171
|
+
description?: string | undefined;
|
|
172
|
+
schema?: ExtendedJSONSchema7 | undefined;
|
|
173
|
+
ui?: UiSchema | undefined;
|
|
174
|
+
data?: Record<string, unknown> | undefined;
|
|
175
|
+
handlers?: ({
|
|
176
|
+
type: "webhook";
|
|
177
|
+
url: string;
|
|
178
|
+
headers: Record<string, string>;
|
|
179
|
+
} | {
|
|
180
|
+
url: string;
|
|
181
|
+
headers: Record<string, string>;
|
|
182
|
+
type: "trigger";
|
|
183
|
+
tokenId: string;
|
|
184
|
+
})[] | undefined;
|
|
185
|
+
}[];
|
|
186
|
+
app?: string | undefined;
|
|
187
|
+
description?: string | undefined;
|
|
188
|
+
validUntil?: string | undefined;
|
|
189
|
+
context?: {
|
|
190
|
+
data: Record<string, unknown>;
|
|
191
|
+
ui?: Record<string, Record<string, unknown>> | undefined;
|
|
192
|
+
} | undefined;
|
|
193
|
+
contextVersion?: 2 | undefined;
|
|
194
|
+
version?: 2 | undefined;
|
|
195
|
+
}>>;
|
|
130
196
|
/**
|
|
131
197
|
* Assignment targets at task create (not stored in task context JSON).
|
|
132
198
|
* Unknown user emails are auto-provisioned as assignee memberships (count toward seat limits).
|
|
@@ -178,76 +244,10 @@ type TaskPriority = (typeof taskPriorities)[number];
|
|
|
178
244
|
declare const DEFAULT_TASK_PRIORITY: TaskPriority;
|
|
179
245
|
declare const LOWEST_TASK_PRIORITY: TaskPriority;
|
|
180
246
|
declare const TASK_PRIORITY_RANK: Record<TaskPriority, number>;
|
|
181
|
-
declare const agentCostTokensSchema: z.ZodObject<{
|
|
182
|
-
input: z.ZodOptional<z.ZodNumber>;
|
|
183
|
-
output: z.ZodOptional<z.ZodNumber>;
|
|
184
|
-
total: z.ZodOptional<z.ZodNumber>;
|
|
185
|
-
}, z.core.$strip>;
|
|
186
|
-
declare const agentCostSchema: z.ZodObject<{
|
|
187
|
-
tokens: z.ZodOptional<z.ZodObject<{
|
|
188
|
-
input: z.ZodOptional<z.ZodNumber>;
|
|
189
|
-
output: z.ZodOptional<z.ZodNumber>;
|
|
190
|
-
total: z.ZodOptional<z.ZodNumber>;
|
|
191
|
-
}, z.core.$strip>>;
|
|
192
|
-
eur: z.ZodOptional<z.ZodNumber>;
|
|
193
|
-
usd: z.ZodOptional<z.ZodNumber>;
|
|
194
|
-
}, z.core.$strip>;
|
|
195
|
-
declare const AGENT_OTEL_SPANS_MAX = 32;
|
|
196
|
-
declare const agentToolCallsSchema: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
197
|
-
declare const agentOtelSpanStatusSchema: z.ZodEnum<{
|
|
198
|
-
error: "error";
|
|
199
|
-
ok: "ok";
|
|
200
|
-
}>;
|
|
201
|
-
declare const agentOtelSpanSummarySchema: z.ZodObject<{
|
|
202
|
-
name: z.ZodString;
|
|
203
|
-
durationMs: z.ZodNumber;
|
|
204
|
-
status: z.ZodEnum<{
|
|
205
|
-
error: "error";
|
|
206
|
-
ok: "ok";
|
|
207
|
-
}>;
|
|
208
|
-
}, z.core.$strip>;
|
|
209
|
-
declare const agentOtelSchema: z.ZodObject<{
|
|
210
|
-
traceId: z.ZodString;
|
|
211
|
-
spanId: z.ZodOptional<z.ZodString>;
|
|
212
|
-
rootDurationMs: z.ZodOptional<z.ZodNumber>;
|
|
213
|
-
spans: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
214
|
-
name: z.ZodString;
|
|
215
|
-
durationMs: z.ZodNumber;
|
|
216
|
-
status: z.ZodEnum<{
|
|
217
|
-
error: "error";
|
|
218
|
-
ok: "ok";
|
|
219
|
-
}>;
|
|
220
|
-
}, z.core.$strip>>>;
|
|
221
|
-
}, z.core.$strip>;
|
|
222
247
|
declare const agentTelemetrySchema: z.ZodObject<{
|
|
223
|
-
version: z.
|
|
224
|
-
toolCallCount: z.ZodOptional<z.ZodNumber>;
|
|
225
|
-
toolCalls: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
226
|
-
cost: z.ZodOptional<z.ZodObject<{
|
|
227
|
-
tokens: z.ZodOptional<z.ZodObject<{
|
|
228
|
-
input: z.ZodOptional<z.ZodNumber>;
|
|
229
|
-
output: z.ZodOptional<z.ZodNumber>;
|
|
230
|
-
total: z.ZodOptional<z.ZodNumber>;
|
|
231
|
-
}, z.core.$strip>>;
|
|
232
|
-
eur: z.ZodOptional<z.ZodNumber>;
|
|
233
|
-
usd: z.ZodOptional<z.ZodNumber>;
|
|
234
|
-
}, z.core.$strip>>;
|
|
235
|
-
info: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
236
|
-
otel: z.ZodOptional<z.ZodObject<{
|
|
237
|
-
traceId: z.ZodString;
|
|
238
|
-
spanId: z.ZodOptional<z.ZodString>;
|
|
239
|
-
rootDurationMs: z.ZodOptional<z.ZodNumber>;
|
|
240
|
-
spans: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
241
|
-
name: z.ZodString;
|
|
242
|
-
durationMs: z.ZodNumber;
|
|
243
|
-
status: z.ZodEnum<{
|
|
244
|
-
error: "error";
|
|
245
|
-
ok: "ok";
|
|
246
|
-
}>;
|
|
247
|
-
}, z.core.$strip>>>;
|
|
248
|
-
}, z.core.$strip>>;
|
|
248
|
+
version: z.ZodString;
|
|
249
249
|
}, z.core.$strip>;
|
|
250
|
-
declare const createTaskBodySchema: z.ZodObject<{
|
|
250
|
+
declare const createTaskBodySchema: z.ZodPipe<z.ZodObject<{
|
|
251
251
|
app: z.ZodOptional<z.ZodString>;
|
|
252
252
|
type: z.ZodString;
|
|
253
253
|
name: z.ZodString;
|
|
@@ -257,6 +257,7 @@ declare const createTaskBodySchema: z.ZodObject<{
|
|
|
257
257
|
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
258
258
|
ui: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<Record<string, unknown>, unknown, z.core.$ZodTypeInternals<Record<string, unknown>, unknown>>>>;
|
|
259
259
|
}, z.core.$strip>>;
|
|
260
|
+
contextVersion: z.ZodOptional<z.ZodLiteral<2>>;
|
|
260
261
|
version: z.ZodOptional<z.ZodLiteral<2>>;
|
|
261
262
|
actions: z.ZodArray<z.ZodObject<{
|
|
262
263
|
id: z.ZodString;
|
|
@@ -300,34 +301,97 @@ declare const createTaskBodySchema: z.ZodObject<{
|
|
|
300
301
|
}>>;
|
|
301
302
|
}, z.core.$strip>>;
|
|
302
303
|
agent: z.ZodOptional<z.ZodObject<{
|
|
303
|
-
version: z.
|
|
304
|
-
toolCallCount: z.ZodOptional<z.ZodNumber>;
|
|
305
|
-
toolCalls: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
306
|
-
cost: z.ZodOptional<z.ZodObject<{
|
|
307
|
-
tokens: z.ZodOptional<z.ZodObject<{
|
|
308
|
-
input: z.ZodOptional<z.ZodNumber>;
|
|
309
|
-
output: z.ZodOptional<z.ZodNumber>;
|
|
310
|
-
total: z.ZodOptional<z.ZodNumber>;
|
|
311
|
-
}, z.core.$strip>>;
|
|
312
|
-
eur: z.ZodOptional<z.ZodNumber>;
|
|
313
|
-
usd: z.ZodOptional<z.ZodNumber>;
|
|
314
|
-
}, z.core.$strip>>;
|
|
315
|
-
info: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
316
|
-
otel: z.ZodOptional<z.ZodObject<{
|
|
317
|
-
traceId: z.ZodString;
|
|
318
|
-
spanId: z.ZodOptional<z.ZodString>;
|
|
319
|
-
rootDurationMs: z.ZodOptional<z.ZodNumber>;
|
|
320
|
-
spans: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
321
|
-
name: z.ZodString;
|
|
322
|
-
durationMs: z.ZodNumber;
|
|
323
|
-
status: z.ZodEnum<{
|
|
324
|
-
error: "error";
|
|
325
|
-
ok: "ok";
|
|
326
|
-
}>;
|
|
327
|
-
}, z.core.$strip>>>;
|
|
328
|
-
}, z.core.$strip>>;
|
|
304
|
+
version: z.ZodString;
|
|
329
305
|
}, z.core.$strip>>;
|
|
330
|
-
}, z.core.$strip
|
|
306
|
+
}, z.core.$strip>, z.ZodTransform<Omit<{
|
|
307
|
+
type: string;
|
|
308
|
+
name: string;
|
|
309
|
+
actions: {
|
|
310
|
+
id: string;
|
|
311
|
+
title: string;
|
|
312
|
+
description?: string | undefined;
|
|
313
|
+
schema?: ExtendedJSONSchema7 | undefined;
|
|
314
|
+
ui?: UiSchema | undefined;
|
|
315
|
+
data?: Record<string, unknown> | undefined;
|
|
316
|
+
handlers?: ({
|
|
317
|
+
type: "webhook";
|
|
318
|
+
url: string;
|
|
319
|
+
headers: Record<string, string>;
|
|
320
|
+
} | {
|
|
321
|
+
url: string;
|
|
322
|
+
headers: Record<string, string>;
|
|
323
|
+
type: "trigger";
|
|
324
|
+
tokenId: string;
|
|
325
|
+
})[] | undefined;
|
|
326
|
+
}[];
|
|
327
|
+
app?: string | undefined;
|
|
328
|
+
description?: string | undefined;
|
|
329
|
+
validUntil?: string | undefined;
|
|
330
|
+
context?: {
|
|
331
|
+
data: Record<string, unknown>;
|
|
332
|
+
ui?: Record<string, Record<string, unknown>> | undefined;
|
|
333
|
+
} | undefined;
|
|
334
|
+
contextVersion?: 2 | undefined;
|
|
335
|
+
version?: 2 | undefined;
|
|
336
|
+
assignTo?: {
|
|
337
|
+
users?: string[] | undefined;
|
|
338
|
+
groups?: string[] | undefined;
|
|
339
|
+
} | undefined;
|
|
340
|
+
threadId?: string | undefined;
|
|
341
|
+
priority?: "low" | "normal" | "high" | "urgent" | undefined;
|
|
342
|
+
update?: {
|
|
343
|
+
message: string;
|
|
344
|
+
status?: "info" | "queued" | "running" | "waiting" | "succeeded" | "failed" | "cancelled" | undefined;
|
|
345
|
+
} | undefined;
|
|
346
|
+
agent?: {
|
|
347
|
+
version: string;
|
|
348
|
+
} | undefined;
|
|
349
|
+
}, "contextVersion" | "version"> & {
|
|
350
|
+
contextVersion: 2;
|
|
351
|
+
}, {
|
|
352
|
+
type: string;
|
|
353
|
+
name: string;
|
|
354
|
+
actions: {
|
|
355
|
+
id: string;
|
|
356
|
+
title: string;
|
|
357
|
+
description?: string | undefined;
|
|
358
|
+
schema?: ExtendedJSONSchema7 | undefined;
|
|
359
|
+
ui?: UiSchema | undefined;
|
|
360
|
+
data?: Record<string, unknown> | undefined;
|
|
361
|
+
handlers?: ({
|
|
362
|
+
type: "webhook";
|
|
363
|
+
url: string;
|
|
364
|
+
headers: Record<string, string>;
|
|
365
|
+
} | {
|
|
366
|
+
url: string;
|
|
367
|
+
headers: Record<string, string>;
|
|
368
|
+
type: "trigger";
|
|
369
|
+
tokenId: string;
|
|
370
|
+
})[] | undefined;
|
|
371
|
+
}[];
|
|
372
|
+
app?: string | undefined;
|
|
373
|
+
description?: string | undefined;
|
|
374
|
+
validUntil?: string | undefined;
|
|
375
|
+
context?: {
|
|
376
|
+
data: Record<string, unknown>;
|
|
377
|
+
ui?: Record<string, Record<string, unknown>> | undefined;
|
|
378
|
+
} | undefined;
|
|
379
|
+
contextVersion?: 2 | undefined;
|
|
380
|
+
version?: 2 | undefined;
|
|
381
|
+
assignTo?: {
|
|
382
|
+
users?: string[] | undefined;
|
|
383
|
+
groups?: string[] | undefined;
|
|
384
|
+
} | undefined;
|
|
385
|
+
threadId?: string | undefined;
|
|
386
|
+
priority?: "low" | "normal" | "high" | "urgent" | undefined;
|
|
387
|
+
update?: {
|
|
388
|
+
message: string;
|
|
389
|
+
status?: "info" | "queued" | "running" | "waiting" | "succeeded" | "failed" | "cancelled" | undefined;
|
|
390
|
+
} | undefined;
|
|
391
|
+
agent?: {
|
|
392
|
+
version: string;
|
|
393
|
+
} | undefined;
|
|
394
|
+
}>>;
|
|
331
395
|
/** POST /v1/threads/:threadId/updates body: a standalone thread update. */
|
|
332
396
|
declare const threadUpdateBodySchema: z.ZodObject<{
|
|
333
397
|
message: z.ZodString;
|
|
@@ -367,12 +431,6 @@ type TaskAction = z.infer<typeof taskActionSchema>;
|
|
|
367
431
|
type WebhookHandler = z.infer<typeof webhookHandlerSchema>;
|
|
368
432
|
type TriggerHandler = z.infer<typeof triggerHandlerSchema>;
|
|
369
433
|
type Handler = z.infer<typeof handlerSchema>;
|
|
370
|
-
type AgentCostTokens = z.infer<typeof agentCostTokensSchema>;
|
|
371
|
-
type AgentCost = z.infer<typeof agentCostSchema>;
|
|
372
|
-
type AgentToolCalls = z.infer<typeof agentToolCallsSchema>;
|
|
373
|
-
type AgentOtelSpanStatus = z.infer<typeof agentOtelSpanStatusSchema>;
|
|
374
|
-
type AgentOtelSpanSummary = z.infer<typeof agentOtelSpanSummarySchema>;
|
|
375
|
-
type AgentOtel = z.infer<typeof agentOtelSchema>;
|
|
376
434
|
type AgentTelemetry = z.infer<typeof agentTelemetrySchema>;
|
|
377
435
|
type AgentTelemetryInput = z.input<typeof agentTelemetrySchema>;
|
|
378
436
|
type InferObjectProperties<Props, Req extends PropertyKey> = Props extends Record<string, unknown> ? ({
|
|
@@ -476,4 +534,4 @@ type DiscriminatedApprovalResult<TActions extends readonly {
|
|
|
476
534
|
} : never;
|
|
477
535
|
}[TupleElementIndices<TActions>];
|
|
478
536
|
|
|
479
|
-
export {
|
|
537
|
+
export { type AgentTelemetry, type AgentTelemetryInput, type ApprovalResult, type AssignToInput, type CreateTaskBody, type CreateTaskBodyInput, DEFAULT_TASK_PRIORITY, DEFAULT_THREAD_UPDATE_STATUS, type DiscriminatedApprovalResult, type ExtendedJSONSchema7, type Handler, type InferActionData, type InferJsonSchema7, type JSONSchema7, type JSONSchema7TypeName, LOWEST_TASK_PRIORITY, TASK_CONTEXT_FORMAT_VERSION, TASK_PRIORITY_RANK, type Task, type TaskAction, type TaskContext, type TaskContextFormatVersion, type TaskContextInput, type TaskContextOutput, type TaskPriority, type TaskResponse, type TaskResult, type TaskStatus, type ThreadUpdate, type ThreadUpdateBody, type ThreadUpdateBodyInput, type ThreadUpdateInput, type ThreadUpdateResponse, type ThreadUpdateSource, type ThreadUpdateStatus, type TriggerHandler, type TupleElementIndices, type UiSchema, type WebhookHandler, agentTelemetrySchema, assignToSchema, createTaskBodySchema, taskContextSchema, taskPriorities, taskPrioritySchema, threadUpdateBodySchema, threadUpdateInputSchema, threadUpdateMessageSchema, threadUpdateStatusSchema, threadUpdateStatuses };
|
package/dist/schemas/index.js
CHANGED
|
@@ -224,7 +224,8 @@ var contextDataSchema = z.object({
|
|
|
224
224
|
data: z.record(z.string(), z.unknown()),
|
|
225
225
|
ui: contextUiSchema
|
|
226
226
|
}).optional();
|
|
227
|
-
var
|
|
227
|
+
var TASK_CONTEXT_FORMAT_VERSION = 2;
|
|
228
|
+
var taskContextObjectBaseSchema = z.object({
|
|
228
229
|
/** Source application id; omitted tasks are grouped in the default inbox. */
|
|
229
230
|
app: z.string().min(1).optional(),
|
|
230
231
|
type: z.string().min(1),
|
|
@@ -232,9 +233,22 @@ var taskContextObjectSchema = z.object({
|
|
|
232
233
|
description: z.string().optional(),
|
|
233
234
|
validUntil: z.string().optional(),
|
|
234
235
|
context: contextDataSchema,
|
|
236
|
+
/** Task context wire format version. @default 2 */
|
|
237
|
+
contextVersion: z.literal(2).optional(),
|
|
238
|
+
/** @deprecated Use `contextVersion`. Accepted on ingest only. */
|
|
235
239
|
version: z.literal(2).optional(),
|
|
236
240
|
actions: z.array(taskActionSchema).min(1, "At least one action is required")
|
|
237
241
|
});
|
|
242
|
+
function normalizeTaskContextVersion(data) {
|
|
243
|
+
const { version: legacyVersion, contextVersion, ...rest } = data;
|
|
244
|
+
return {
|
|
245
|
+
...rest,
|
|
246
|
+
contextVersion: contextVersion ?? legacyVersion ?? TASK_CONTEXT_FORMAT_VERSION
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
var taskContextObjectSchema = taskContextObjectBaseSchema.transform(
|
|
250
|
+
normalizeTaskContextVersion
|
|
251
|
+
);
|
|
238
252
|
function refineContextPublicUrls(data, ctx) {
|
|
239
253
|
const error = validateContextPublicUrls(data.context);
|
|
240
254
|
if (error) {
|
|
@@ -278,61 +292,11 @@ var threadUpdateInputSchema = z.object({
|
|
|
278
292
|
});
|
|
279
293
|
var taskPriorities = ["low", "normal", "high", "urgent"];
|
|
280
294
|
var taskPrioritySchema = z.enum(taskPriorities);
|
|
281
|
-
var nonNegativeInt = z.number().int().nonnegative();
|
|
282
|
-
var agentCostTokensSchema = z.object({
|
|
283
|
-
input: nonNegativeInt.optional(),
|
|
284
|
-
output: nonNegativeInt.optional(),
|
|
285
|
-
total: nonNegativeInt.optional()
|
|
286
|
-
});
|
|
287
|
-
var agentCostSchema = z.object({
|
|
288
|
-
tokens: agentCostTokensSchema.optional(),
|
|
289
|
-
eur: z.number().nonnegative().optional(),
|
|
290
|
-
usd: z.number().nonnegative().optional()
|
|
291
|
-
});
|
|
292
|
-
var AGENT_INFO_MAX_KEYS = 32;
|
|
293
|
-
var AGENT_TOOL_CALLS_MAX_KEYS = 64;
|
|
294
|
-
var AGENT_OTEL_SPANS_MAX = 32;
|
|
295
|
-
var agentToolCallsSchema = z.record(z.string().min(1), nonNegativeInt);
|
|
296
|
-
var agentOtelSpanStatusSchema = z.enum(["ok", "error"]);
|
|
297
|
-
var agentOtelSpanSummarySchema = z.object({
|
|
298
|
-
name: z.string().min(1),
|
|
299
|
-
durationMs: z.number().nonnegative(),
|
|
300
|
-
status: agentOtelSpanStatusSchema
|
|
301
|
-
});
|
|
302
|
-
var agentOtelSchema = z.object({
|
|
303
|
-
traceId: z.string().min(1),
|
|
304
|
-
spanId: z.string().min(1).optional(),
|
|
305
|
-
rootDurationMs: z.number().nonnegative().optional(),
|
|
306
|
-
spans: z.array(agentOtelSpanSummarySchema).max(AGENT_OTEL_SPANS_MAX).optional()
|
|
307
|
-
});
|
|
308
295
|
var agentTelemetrySchema = z.object({
|
|
309
296
|
/** Agent or app version (semver, git SHA, deploy tag — caller-defined). */
|
|
310
|
-
version: z.string().min(1)
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
/** Per-tool invocation counts keyed by tool name. */
|
|
314
|
-
toolCalls: agentToolCallsSchema.optional(),
|
|
315
|
-
cost: agentCostSchema.optional(),
|
|
316
|
-
/** Free-form metadata for experiments (model, prompt variant, etc.). */
|
|
317
|
-
info: z.record(z.string(), z.unknown()).optional(),
|
|
318
|
-
/** Structured OpenTelemetry span snapshot for feedback analysis. */
|
|
319
|
-
otel: agentOtelSchema.optional()
|
|
320
|
-
}).refine(
|
|
321
|
-
(data) => {
|
|
322
|
-
const keys = data.info ? Object.keys(data.info) : [];
|
|
323
|
-
return keys.length <= AGENT_INFO_MAX_KEYS;
|
|
324
|
-
},
|
|
325
|
-
{ message: `agent.info may contain at most ${AGENT_INFO_MAX_KEYS} keys` }
|
|
326
|
-
).refine(
|
|
327
|
-
(data) => {
|
|
328
|
-
const keys = data.toolCalls ? Object.keys(data.toolCalls) : [];
|
|
329
|
-
return keys.length <= AGENT_TOOL_CALLS_MAX_KEYS;
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
message: `agent.toolCalls may contain at most ${AGENT_TOOL_CALLS_MAX_KEYS} tool names`
|
|
333
|
-
}
|
|
334
|
-
);
|
|
335
|
-
var createTaskBodySchema = taskContextObjectSchema.extend({
|
|
297
|
+
version: z.string().min(1)
|
|
298
|
+
});
|
|
299
|
+
var createTaskBodySchema = taskContextObjectBaseSchema.extend({
|
|
336
300
|
assignTo: assignToSchema.optional(),
|
|
337
301
|
/**
|
|
338
302
|
* Groups related tasks together. When omitted, the server generates one and
|
|
@@ -349,9 +313,9 @@ var createTaskBodySchema = taskContextObjectSchema.extend({
|
|
|
349
313
|
* the inbox status bar and the thread update log.
|
|
350
314
|
*/
|
|
351
315
|
update: threadUpdateInputSchema.optional(),
|
|
352
|
-
/** Agent
|
|
316
|
+
/** Agent release version — not shown in inbox UI. */
|
|
353
317
|
agent: agentTelemetrySchema.optional()
|
|
354
|
-
}).superRefine(refineContextPublicUrls);
|
|
318
|
+
}).transform(normalizeTaskContextVersion).superRefine(refineContextPublicUrls);
|
|
355
319
|
|
|
356
320
|
// src/schemas/index.ts
|
|
357
321
|
var safeUrlSchema2 = z2.string().refine((url) => isPublicHttpUrl(url), {
|
|
@@ -395,16 +359,29 @@ var contextDataSchema2 = z2.object({
|
|
|
395
359
|
data: z2.record(z2.string(), z2.unknown()),
|
|
396
360
|
ui: contextUiSchema2
|
|
397
361
|
}).optional();
|
|
398
|
-
var
|
|
362
|
+
var TASK_CONTEXT_FORMAT_VERSION2 = 2;
|
|
363
|
+
var taskContextObjectBaseSchema2 = z2.object({
|
|
399
364
|
app: z2.string().min(1).optional(),
|
|
400
365
|
type: z2.string().min(1),
|
|
401
366
|
name: z2.string().min(1),
|
|
402
367
|
description: z2.string().optional(),
|
|
403
368
|
validUntil: z2.string().optional(),
|
|
404
369
|
context: contextDataSchema2,
|
|
370
|
+
contextVersion: z2.literal(2).optional(),
|
|
371
|
+
/** @deprecated Use `contextVersion`. Accepted on ingest only. */
|
|
405
372
|
version: z2.literal(2).optional(),
|
|
406
373
|
actions: z2.array(taskActionSchema2).min(1, "At least one action is required")
|
|
407
374
|
});
|
|
375
|
+
function normalizeTaskContextVersion2(data) {
|
|
376
|
+
const { version: legacyVersion, contextVersion, ...rest } = data;
|
|
377
|
+
return {
|
|
378
|
+
...rest,
|
|
379
|
+
contextVersion: contextVersion ?? legacyVersion ?? TASK_CONTEXT_FORMAT_VERSION2
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
var taskContextObjectSchema2 = taskContextObjectBaseSchema2.transform(
|
|
383
|
+
normalizeTaskContextVersion2
|
|
384
|
+
);
|
|
408
385
|
function refineContextPublicUrls2(data, ctx) {
|
|
409
386
|
const error = validateContextPublicUrls(data.context);
|
|
410
387
|
if (error) {
|
|
@@ -457,56 +434,10 @@ var TASK_PRIORITY_RANK = {
|
|
|
457
434
|
high: 3,
|
|
458
435
|
urgent: 4
|
|
459
436
|
};
|
|
460
|
-
var nonNegativeInt2 = z2.number().int().nonnegative();
|
|
461
|
-
var agentCostTokensSchema2 = z2.object({
|
|
462
|
-
input: nonNegativeInt2.optional(),
|
|
463
|
-
output: nonNegativeInt2.optional(),
|
|
464
|
-
total: nonNegativeInt2.optional()
|
|
465
|
-
});
|
|
466
|
-
var agentCostSchema2 = z2.object({
|
|
467
|
-
tokens: agentCostTokensSchema2.optional(),
|
|
468
|
-
eur: z2.number().nonnegative().optional(),
|
|
469
|
-
usd: z2.number().nonnegative().optional()
|
|
470
|
-
});
|
|
471
|
-
var AGENT_INFO_MAX_KEYS2 = 32;
|
|
472
|
-
var AGENT_TOOL_CALLS_MAX_KEYS2 = 64;
|
|
473
|
-
var AGENT_OTEL_SPANS_MAX2 = 32;
|
|
474
|
-
var agentToolCallsSchema2 = z2.record(z2.string().min(1), nonNegativeInt2);
|
|
475
|
-
var agentOtelSpanStatusSchema2 = z2.enum(["ok", "error"]);
|
|
476
|
-
var agentOtelSpanSummarySchema2 = z2.object({
|
|
477
|
-
name: z2.string().min(1),
|
|
478
|
-
durationMs: z2.number().nonnegative(),
|
|
479
|
-
status: agentOtelSpanStatusSchema2
|
|
480
|
-
});
|
|
481
|
-
var agentOtelSchema2 = z2.object({
|
|
482
|
-
traceId: z2.string().min(1),
|
|
483
|
-
spanId: z2.string().min(1).optional(),
|
|
484
|
-
rootDurationMs: z2.number().nonnegative().optional(),
|
|
485
|
-
spans: z2.array(agentOtelSpanSummarySchema2).max(AGENT_OTEL_SPANS_MAX2).optional()
|
|
486
|
-
});
|
|
487
437
|
var agentTelemetrySchema2 = z2.object({
|
|
488
|
-
version: z2.string().min(1)
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
cost: agentCostSchema2.optional(),
|
|
492
|
-
info: z2.record(z2.string(), z2.unknown()).optional(),
|
|
493
|
-
otel: agentOtelSchema2.optional()
|
|
494
|
-
}).refine(
|
|
495
|
-
(data) => {
|
|
496
|
-
const keys = data.info ? Object.keys(data.info) : [];
|
|
497
|
-
return keys.length <= AGENT_INFO_MAX_KEYS2;
|
|
498
|
-
},
|
|
499
|
-
{ message: `agent.info may contain at most ${AGENT_INFO_MAX_KEYS2} keys` }
|
|
500
|
-
).refine(
|
|
501
|
-
(data) => {
|
|
502
|
-
const keys = data.toolCalls ? Object.keys(data.toolCalls) : [];
|
|
503
|
-
return keys.length <= AGENT_TOOL_CALLS_MAX_KEYS2;
|
|
504
|
-
},
|
|
505
|
-
{
|
|
506
|
-
message: `agent.toolCalls may contain at most ${AGENT_TOOL_CALLS_MAX_KEYS2} tool names`
|
|
507
|
-
}
|
|
508
|
-
);
|
|
509
|
-
var createTaskBodySchema2 = taskContextObjectSchema2.extend({
|
|
438
|
+
version: z2.string().min(1)
|
|
439
|
+
});
|
|
440
|
+
var createTaskBodySchema2 = taskContextObjectBaseSchema2.extend({
|
|
510
441
|
assignTo: assignToSchema2.optional(),
|
|
511
442
|
/**
|
|
512
443
|
* Groups related tasks together. When omitted, the server generates one and
|
|
@@ -524,21 +455,15 @@ var createTaskBodySchema2 = taskContextObjectSchema2.extend({
|
|
|
524
455
|
*/
|
|
525
456
|
update: threadUpdateInputSchema2.optional(),
|
|
526
457
|
agent: agentTelemetrySchema2.optional()
|
|
527
|
-
}).superRefine(refineContextPublicUrls2);
|
|
458
|
+
}).transform(normalizeTaskContextVersion2).superRefine(refineContextPublicUrls2);
|
|
528
459
|
var threadUpdateBodySchema = threadUpdateInputSchema2;
|
|
529
460
|
export {
|
|
530
|
-
AGENT_OTEL_SPANS_MAX2 as AGENT_OTEL_SPANS_MAX,
|
|
531
461
|
DEFAULT_TASK_PRIORITY,
|
|
532
462
|
DEFAULT_THREAD_UPDATE_STATUS,
|
|
533
463
|
LOWEST_TASK_PRIORITY,
|
|
464
|
+
TASK_CONTEXT_FORMAT_VERSION2 as TASK_CONTEXT_FORMAT_VERSION,
|
|
534
465
|
TASK_PRIORITY_RANK,
|
|
535
|
-
agentCostSchema2 as agentCostSchema,
|
|
536
|
-
agentCostTokensSchema2 as agentCostTokensSchema,
|
|
537
|
-
agentOtelSchema2 as agentOtelSchema,
|
|
538
|
-
agentOtelSpanStatusSchema2 as agentOtelSpanStatusSchema,
|
|
539
|
-
agentOtelSpanSummarySchema2 as agentOtelSpanSummarySchema,
|
|
540
466
|
agentTelemetrySchema2 as agentTelemetrySchema,
|
|
541
|
-
agentToolCallsSchema2 as agentToolCallsSchema,
|
|
542
467
|
assignToSchema2 as assignToSchema,
|
|
543
468
|
createTaskBodySchema2 as createTaskBodySchema,
|
|
544
469
|
taskContextSchema2 as taskContextSchema,
|