robotrock 0.8.1 → 0.8.4
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.js +485 -36
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/trigger.js +485 -36
- package/dist/ai/trigger.js.map +1 -1
- package/dist/ai/workflow.js +485 -36
- package/dist/ai/workflow.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +528 -39
- package/dist/index.js.map +1 -1
- package/dist/otel/index.d.ts +49 -0
- package/dist/otel/index.js +633 -0
- package/dist/otel/index.js.map +1 -0
- package/dist/schemas/index.d.ts +60 -1
- package/dist/schemas/index.js +407 -28
- package/dist/schemas/index.js.map +1 -1
- package/dist/trigger/index.js +382 -8
- package/dist/trigger/index.js.map +1 -1
- package/dist/workflow/index.js +382 -8
- package/dist/workflow/index.js.map +1 -1
- package/package.json +10 -4
package/dist/workflow/index.js
CHANGED
|
@@ -48,12 +48,189 @@ var __callDispose = (stack, error, hasError) => {
|
|
|
48
48
|
import { createWebhook, sleep as sleep2 } from "workflow";
|
|
49
49
|
|
|
50
50
|
// src/schemas/index.ts
|
|
51
|
+
import { z as z2 } from "zod";
|
|
52
|
+
|
|
53
|
+
// ../core/src/utils/safe-url.ts
|
|
54
|
+
var BLOCKED_HOSTNAMES = /* @__PURE__ */ new Set([
|
|
55
|
+
"localhost",
|
|
56
|
+
"metadata.google.internal",
|
|
57
|
+
"metadata.goog"
|
|
58
|
+
]);
|
|
59
|
+
function normalizeHostname(hostname) {
|
|
60
|
+
return hostname.toLowerCase().replace(/^\[|\]$/g, "");
|
|
61
|
+
}
|
|
62
|
+
function isBlockedIpv4(host) {
|
|
63
|
+
const match = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(host);
|
|
64
|
+
if (!match) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
const octets = match.slice(1, 5).map((part) => Number(part));
|
|
68
|
+
if (octets.some((octet) => Number.isNaN(octet) || octet < 0 || octet > 255)) {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
const [a, b, _c, _d] = octets;
|
|
72
|
+
if (a === void 0 || b === void 0) {
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
if (a === 127 || a === 0) return true;
|
|
76
|
+
if (a === 10) return true;
|
|
77
|
+
if (a === 169 && b === 254) return true;
|
|
78
|
+
if (a === 192 && b === 168) return true;
|
|
79
|
+
if (a === 172 && b >= 16 && b <= 31) return true;
|
|
80
|
+
if (a === 100 && b >= 64 && b <= 127) return true;
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
function ipv4FromNumericHost(host) {
|
|
84
|
+
if (/^\d+$/.test(host)) {
|
|
85
|
+
const num = Number(host);
|
|
86
|
+
if (!Number.isFinite(num) || num < 0 || num > 4294967295) {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
const a = num >>> 24 & 255;
|
|
90
|
+
const b = num >>> 16 & 255;
|
|
91
|
+
const c = num >>> 8 & 255;
|
|
92
|
+
const d = num & 255;
|
|
93
|
+
return `${a}.${b}.${c}.${d}`;
|
|
94
|
+
}
|
|
95
|
+
const hexMatch = /^0x([0-9a-f]{1,8})$/i.exec(host);
|
|
96
|
+
if (hexMatch) {
|
|
97
|
+
const num = Number.parseInt(hexMatch[1], 16);
|
|
98
|
+
if (!Number.isFinite(num) || num < 0 || num > 4294967295) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
const a = num >>> 24 & 255;
|
|
102
|
+
const b = num >>> 16 & 255;
|
|
103
|
+
const c = num >>> 8 & 255;
|
|
104
|
+
const d = num & 255;
|
|
105
|
+
return `${a}.${b}.${c}.${d}`;
|
|
106
|
+
}
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
function isBlockedIpv4Mapped(host) {
|
|
110
|
+
const mappedDotted = /^::ffff:(\d{1,3}(?:\.\d{1,3}){3})$/i.exec(host);
|
|
111
|
+
if (mappedDotted) {
|
|
112
|
+
return isBlockedIpv4(mappedDotted[1]);
|
|
113
|
+
}
|
|
114
|
+
const mappedHex = /^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/i.exec(host);
|
|
115
|
+
if (mappedHex) {
|
|
116
|
+
const high = Number.parseInt(mappedHex[1], 16);
|
|
117
|
+
const low = Number.parseInt(mappedHex[2], 16);
|
|
118
|
+
if (Number.isFinite(high) && Number.isFinite(low)) {
|
|
119
|
+
const a = high >> 8 & 255;
|
|
120
|
+
const b = high & 255;
|
|
121
|
+
const c = low >> 8 & 255;
|
|
122
|
+
const d = low & 255;
|
|
123
|
+
return isBlockedIpv4(`${a}.${b}.${c}.${d}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
function isBlockedIpv6(host) {
|
|
129
|
+
if (host === "::1" || host === "0:0:0:0:0:0:0:1") {
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
if (host.startsWith("fc") || host.startsWith("fd")) {
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
if (host.startsWith("fe80:")) {
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
if (isBlockedIpv4Mapped(host)) {
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
function isBlockedHostname(hostname) {
|
|
144
|
+
const host = normalizeHostname(hostname);
|
|
145
|
+
if (!host) {
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
if (BLOCKED_HOSTNAMES.has(host)) {
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
if (host.endsWith(".localhost") || host.endsWith(".local")) {
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
const numericIpv4 = ipv4FromNumericHost(host);
|
|
155
|
+
if (numericIpv4 && isBlockedIpv4(numericIpv4)) {
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
return isBlockedIpv4(host) || isBlockedIpv6(host);
|
|
159
|
+
}
|
|
160
|
+
function isPublicHttpUrl(urlString) {
|
|
161
|
+
let url;
|
|
162
|
+
try {
|
|
163
|
+
url = new URL(urlString);
|
|
164
|
+
} catch {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
if (url.username || url.password) {
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
return !isBlockedHostname(url.hostname);
|
|
174
|
+
}
|
|
175
|
+
var PUBLIC_HTTP_URL_ERROR = "URL must be a public http:// or https:// address";
|
|
176
|
+
|
|
177
|
+
// ../core/src/schemas/task.ts
|
|
51
178
|
import { z } from "zod";
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
179
|
+
|
|
180
|
+
// ../core/src/schemas/context-urls.ts
|
|
181
|
+
function resolveLinkUrl(value) {
|
|
182
|
+
return value.startsWith("http://") || value.startsWith("https://") ? value : `https://${value}`;
|
|
183
|
+
}
|
|
184
|
+
function widgetType(ui, field) {
|
|
185
|
+
const fieldUi = ui?.[field];
|
|
186
|
+
if (typeof fieldUi !== "object" || fieldUi === null) {
|
|
187
|
+
return void 0;
|
|
188
|
+
}
|
|
189
|
+
const widget = fieldUi["ui:widget"];
|
|
190
|
+
return typeof widget === "string" ? widget : void 0;
|
|
191
|
+
}
|
|
192
|
+
function validateUrlValue(value, widget) {
|
|
193
|
+
if (widget === "image" || widget === "link") {
|
|
194
|
+
if (typeof value !== "string") {
|
|
195
|
+
return PUBLIC_HTTP_URL_ERROR;
|
|
196
|
+
}
|
|
197
|
+
const url = widget === "link" ? resolveLinkUrl(value) : value;
|
|
198
|
+
if (!isPublicHttpUrl(url)) {
|
|
199
|
+
return PUBLIC_HTTP_URL_ERROR;
|
|
200
|
+
}
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
203
|
+
if (widget === "attachments" && Array.isArray(value)) {
|
|
204
|
+
for (const item of value) {
|
|
205
|
+
if (typeof item !== "object" || item === null) {
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
const url = item.url;
|
|
209
|
+
if (typeof url === "string" && !isPublicHttpUrl(resolveLinkUrl(url))) {
|
|
210
|
+
return PUBLIC_HTTP_URL_ERROR;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
216
|
+
function validateContextPublicUrls(context) {
|
|
217
|
+
if (!context?.data) {
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
220
|
+
for (const [field, value] of Object.entries(context.data)) {
|
|
221
|
+
const widget = widgetType(context.ui, field);
|
|
222
|
+
if (!widget) {
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
const error = validateUrlValue(value, widget);
|
|
226
|
+
if (error) {
|
|
227
|
+
return `context.data.${field}: ${error}`;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// ../core/src/schemas/task.ts
|
|
57
234
|
var safeUrlSchema = z.string().refine((url) => isPublicHttpUrl(url), {
|
|
58
235
|
message: PUBLIC_HTTP_URL_ERROR
|
|
59
236
|
});
|
|
@@ -81,6 +258,7 @@ var taskActionSchema = z.object({
|
|
|
81
258
|
schema: jsonSchema7Schema.optional(),
|
|
82
259
|
ui: uiSchemaSchema.optional(),
|
|
83
260
|
data: z.record(z.string(), z.unknown()).optional(),
|
|
261
|
+
// Optional handlers for this action - if present, must have at least 1
|
|
84
262
|
handlers: z.array(handlerSchema).min(1).optional()
|
|
85
263
|
});
|
|
86
264
|
var uiFieldSchemaSchema = z.object({
|
|
@@ -96,6 +274,7 @@ var contextDataSchema = z.object({
|
|
|
96
274
|
ui: contextUiSchema
|
|
97
275
|
}).optional();
|
|
98
276
|
var taskContextObjectSchema = z.object({
|
|
277
|
+
/** Source application id; omitted tasks are grouped in the default inbox. */
|
|
99
278
|
app: z.string().min(1).optional(),
|
|
100
279
|
type: z.string().min(1),
|
|
101
280
|
name: z.string().min(1),
|
|
@@ -160,17 +339,47 @@ var agentCostSchema = z.object({
|
|
|
160
339
|
usd: z.number().nonnegative().optional()
|
|
161
340
|
});
|
|
162
341
|
var AGENT_INFO_MAX_KEYS = 32;
|
|
342
|
+
var AGENT_TOOL_CALLS_MAX_KEYS = 64;
|
|
343
|
+
var AGENT_OTEL_SPANS_MAX = 32;
|
|
344
|
+
var agentToolCallsSchema = z.record(z.string().min(1), nonNegativeInt);
|
|
345
|
+
var agentOtelSpanStatusSchema = z.enum(["ok", "error"]);
|
|
346
|
+
var agentOtelSpanSummarySchema = z.object({
|
|
347
|
+
name: z.string().min(1),
|
|
348
|
+
durationMs: z.number().nonnegative(),
|
|
349
|
+
status: agentOtelSpanStatusSchema
|
|
350
|
+
});
|
|
351
|
+
var agentOtelSchema = z.object({
|
|
352
|
+
traceId: z.string().min(1),
|
|
353
|
+
spanId: z.string().min(1).optional(),
|
|
354
|
+
rootDurationMs: z.number().nonnegative().optional(),
|
|
355
|
+
spans: z.array(agentOtelSpanSummarySchema).max(AGENT_OTEL_SPANS_MAX).optional()
|
|
356
|
+
});
|
|
163
357
|
var agentTelemetrySchema = z.object({
|
|
358
|
+
/** Agent or app version (semver, git SHA, deploy tag — caller-defined). */
|
|
164
359
|
version: z.string().min(1).optional(),
|
|
360
|
+
/** Total tool invocations. When omitted but `toolCalls` is set, the sum of counts is used. */
|
|
165
361
|
toolCallCount: nonNegativeInt.optional(),
|
|
362
|
+
/** Per-tool invocation counts keyed by tool name. */
|
|
363
|
+
toolCalls: agentToolCallsSchema.optional(),
|
|
166
364
|
cost: agentCostSchema.optional(),
|
|
167
|
-
|
|
365
|
+
/** Free-form metadata for experiments (model, prompt variant, etc.). */
|
|
366
|
+
info: z.record(z.string(), z.unknown()).optional(),
|
|
367
|
+
/** Structured OpenTelemetry span snapshot for feedback analysis. */
|
|
368
|
+
otel: agentOtelSchema.optional()
|
|
168
369
|
}).refine(
|
|
169
370
|
(data) => {
|
|
170
371
|
const keys = data.info ? Object.keys(data.info) : [];
|
|
171
372
|
return keys.length <= AGENT_INFO_MAX_KEYS;
|
|
172
373
|
},
|
|
173
374
|
{ message: `agent.info may contain at most ${AGENT_INFO_MAX_KEYS} keys` }
|
|
375
|
+
).refine(
|
|
376
|
+
(data) => {
|
|
377
|
+
const keys = data.toolCalls ? Object.keys(data.toolCalls) : [];
|
|
378
|
+
return keys.length <= AGENT_TOOL_CALLS_MAX_KEYS;
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
message: `agent.toolCalls may contain at most ${AGENT_TOOL_CALLS_MAX_KEYS} tool names`
|
|
382
|
+
}
|
|
174
383
|
);
|
|
175
384
|
var createTaskBodySchema = taskContextObjectSchema.extend({
|
|
176
385
|
assignTo: assignToSchema.optional(),
|
|
@@ -189,9 +398,174 @@ var createTaskBodySchema = taskContextObjectSchema.extend({
|
|
|
189
398
|
* the inbox status bar and the thread update log.
|
|
190
399
|
*/
|
|
191
400
|
update: threadUpdateInputSchema.optional(),
|
|
401
|
+
/** Agent telemetry (version, cost, tool calls) — not shown in inbox UI. */
|
|
192
402
|
agent: agentTelemetrySchema.optional()
|
|
193
403
|
}).superRefine(refineContextPublicUrls);
|
|
194
|
-
|
|
404
|
+
|
|
405
|
+
// src/schemas/index.ts
|
|
406
|
+
var safeUrlSchema2 = z2.string().refine((url) => isPublicHttpUrl(url), {
|
|
407
|
+
message: PUBLIC_HTTP_URL_ERROR
|
|
408
|
+
});
|
|
409
|
+
var jsonSchema7Schema2 = z2.custom(
|
|
410
|
+
(val) => typeof val === "object" && val !== null,
|
|
411
|
+
{ message: "Must be a valid JSON Schema object" }
|
|
412
|
+
);
|
|
413
|
+
var uiSchemaSchema2 = z2.custom((val) => typeof val === "object" && val !== null, {
|
|
414
|
+
message: "Must be a valid UiSchema object"
|
|
415
|
+
});
|
|
416
|
+
var webhookHandlerSchema2 = z2.object({
|
|
417
|
+
type: z2.literal("webhook"),
|
|
418
|
+
url: safeUrlSchema2,
|
|
419
|
+
headers: z2.record(z2.string(), z2.string())
|
|
420
|
+
});
|
|
421
|
+
var triggerHandlerSchema2 = webhookHandlerSchema2.extend({
|
|
422
|
+
type: z2.literal("trigger"),
|
|
423
|
+
tokenId: z2.string().min(1)
|
|
424
|
+
});
|
|
425
|
+
var handlerSchema2 = z2.discriminatedUnion("type", [webhookHandlerSchema2, triggerHandlerSchema2]);
|
|
426
|
+
var taskActionSchema2 = z2.object({
|
|
427
|
+
id: z2.string().min(1),
|
|
428
|
+
title: z2.string().min(1),
|
|
429
|
+
description: z2.string().optional(),
|
|
430
|
+
schema: jsonSchema7Schema2.optional(),
|
|
431
|
+
ui: uiSchemaSchema2.optional(),
|
|
432
|
+
data: z2.record(z2.string(), z2.unknown()).optional(),
|
|
433
|
+
handlers: z2.array(handlerSchema2).min(1).optional()
|
|
434
|
+
});
|
|
435
|
+
var uiFieldSchemaSchema2 = z2.object({
|
|
436
|
+
"ui:widget": z2.string().optional(),
|
|
437
|
+
"ui:title": z2.string().optional(),
|
|
438
|
+
"ui:description": z2.string().optional(),
|
|
439
|
+
"ui:options": z2.record(z2.string(), z2.unknown()).optional(),
|
|
440
|
+
items: z2.lazy(() => z2.record(z2.string(), uiFieldSchemaSchema2)).optional()
|
|
441
|
+
}).passthrough();
|
|
442
|
+
var contextUiSchema2 = z2.record(z2.string(), uiFieldSchemaSchema2).optional();
|
|
443
|
+
var contextDataSchema2 = z2.object({
|
|
444
|
+
data: z2.record(z2.string(), z2.unknown()),
|
|
445
|
+
ui: contextUiSchema2
|
|
446
|
+
}).optional();
|
|
447
|
+
var taskContextObjectSchema2 = z2.object({
|
|
448
|
+
app: z2.string().min(1).optional(),
|
|
449
|
+
type: z2.string().min(1),
|
|
450
|
+
name: z2.string().min(1),
|
|
451
|
+
description: z2.string().optional(),
|
|
452
|
+
validUntil: z2.string().optional(),
|
|
453
|
+
context: contextDataSchema2,
|
|
454
|
+
version: z2.literal(2).optional(),
|
|
455
|
+
actions: z2.array(taskActionSchema2).min(1, "At least one action is required")
|
|
456
|
+
});
|
|
457
|
+
function refineContextPublicUrls2(data, ctx) {
|
|
458
|
+
const error = validateContextPublicUrls(data.context);
|
|
459
|
+
if (error) {
|
|
460
|
+
ctx.addIssue({
|
|
461
|
+
code: z2.ZodIssueCode.custom,
|
|
462
|
+
message: error,
|
|
463
|
+
path: ["context"]
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
var taskContextSchema2 = taskContextObjectSchema2.superRefine(
|
|
468
|
+
refineContextPublicUrls2
|
|
469
|
+
);
|
|
470
|
+
var assignToSchema2 = z2.object({
|
|
471
|
+
users: z2.array(z2.string().email()).optional(),
|
|
472
|
+
groups: z2.array(z2.string().min(1)).optional()
|
|
473
|
+
}).refine(
|
|
474
|
+
(data) => {
|
|
475
|
+
const groups = data.groups ?? [];
|
|
476
|
+
if (groups.includes("all") && groups.length > 1) {
|
|
477
|
+
return false;
|
|
478
|
+
}
|
|
479
|
+
return true;
|
|
480
|
+
},
|
|
481
|
+
{ message: 'Cannot combine "all" with other group slugs' }
|
|
482
|
+
);
|
|
483
|
+
var threadUpdateMessageSchema2 = z2.string().min(1).max(500);
|
|
484
|
+
var threadUpdateStatuses2 = [
|
|
485
|
+
"info",
|
|
486
|
+
"queued",
|
|
487
|
+
"running",
|
|
488
|
+
"waiting",
|
|
489
|
+
"succeeded",
|
|
490
|
+
"failed",
|
|
491
|
+
"cancelled"
|
|
492
|
+
];
|
|
493
|
+
var threadUpdateStatusSchema2 = z2.enum(threadUpdateStatuses2);
|
|
494
|
+
var threadUpdateInputSchema2 = z2.object({
|
|
495
|
+
message: threadUpdateMessageSchema2,
|
|
496
|
+
status: threadUpdateStatusSchema2.optional()
|
|
497
|
+
});
|
|
498
|
+
var taskPriorities2 = ["low", "normal", "high", "urgent"];
|
|
499
|
+
var taskPrioritySchema2 = z2.enum(taskPriorities2);
|
|
500
|
+
var nonNegativeInt2 = z2.number().int().nonnegative();
|
|
501
|
+
var agentCostTokensSchema2 = z2.object({
|
|
502
|
+
input: nonNegativeInt2.optional(),
|
|
503
|
+
output: nonNegativeInt2.optional(),
|
|
504
|
+
total: nonNegativeInt2.optional()
|
|
505
|
+
});
|
|
506
|
+
var agentCostSchema2 = z2.object({
|
|
507
|
+
tokens: agentCostTokensSchema2.optional(),
|
|
508
|
+
eur: z2.number().nonnegative().optional(),
|
|
509
|
+
usd: z2.number().nonnegative().optional()
|
|
510
|
+
});
|
|
511
|
+
var AGENT_INFO_MAX_KEYS2 = 32;
|
|
512
|
+
var AGENT_TOOL_CALLS_MAX_KEYS2 = 64;
|
|
513
|
+
var AGENT_OTEL_SPANS_MAX2 = 32;
|
|
514
|
+
var agentToolCallsSchema2 = z2.record(z2.string().min(1), nonNegativeInt2);
|
|
515
|
+
var agentOtelSpanStatusSchema2 = z2.enum(["ok", "error"]);
|
|
516
|
+
var agentOtelSpanSummarySchema2 = z2.object({
|
|
517
|
+
name: z2.string().min(1),
|
|
518
|
+
durationMs: z2.number().nonnegative(),
|
|
519
|
+
status: agentOtelSpanStatusSchema2
|
|
520
|
+
});
|
|
521
|
+
var agentOtelSchema2 = z2.object({
|
|
522
|
+
traceId: z2.string().min(1),
|
|
523
|
+
spanId: z2.string().min(1).optional(),
|
|
524
|
+
rootDurationMs: z2.number().nonnegative().optional(),
|
|
525
|
+
spans: z2.array(agentOtelSpanSummarySchema2).max(AGENT_OTEL_SPANS_MAX2).optional()
|
|
526
|
+
});
|
|
527
|
+
var agentTelemetrySchema2 = z2.object({
|
|
528
|
+
version: z2.string().min(1).optional(),
|
|
529
|
+
toolCallCount: nonNegativeInt2.optional(),
|
|
530
|
+
toolCalls: agentToolCallsSchema2.optional(),
|
|
531
|
+
cost: agentCostSchema2.optional(),
|
|
532
|
+
info: z2.record(z2.string(), z2.unknown()).optional(),
|
|
533
|
+
otel: agentOtelSchema2.optional()
|
|
534
|
+
}).refine(
|
|
535
|
+
(data) => {
|
|
536
|
+
const keys = data.info ? Object.keys(data.info) : [];
|
|
537
|
+
return keys.length <= AGENT_INFO_MAX_KEYS2;
|
|
538
|
+
},
|
|
539
|
+
{ message: `agent.info may contain at most ${AGENT_INFO_MAX_KEYS2} keys` }
|
|
540
|
+
).refine(
|
|
541
|
+
(data) => {
|
|
542
|
+
const keys = data.toolCalls ? Object.keys(data.toolCalls) : [];
|
|
543
|
+
return keys.length <= AGENT_TOOL_CALLS_MAX_KEYS2;
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
message: `agent.toolCalls may contain at most ${AGENT_TOOL_CALLS_MAX_KEYS2} tool names`
|
|
547
|
+
}
|
|
548
|
+
);
|
|
549
|
+
var createTaskBodySchema2 = taskContextObjectSchema2.extend({
|
|
550
|
+
assignTo: assignToSchema2.optional(),
|
|
551
|
+
/**
|
|
552
|
+
* Groups related tasks together. When omitted, the server generates one and
|
|
553
|
+
* returns it so the caller can reuse it on later tasks in the same thread.
|
|
554
|
+
*/
|
|
555
|
+
threadId: z2.string().min(1).optional(),
|
|
556
|
+
/**
|
|
557
|
+
* Optional thread priority. When set, applies to the whole thread and
|
|
558
|
+
* overwrites any previous priority. Omit on later tasks to leave unchanged.
|
|
559
|
+
*/
|
|
560
|
+
priority: taskPrioritySchema2.optional(),
|
|
561
|
+
/**
|
|
562
|
+
* Optional initial status update logged against the task's thread. Shows in
|
|
563
|
+
* the inbox status bar and the thread update log.
|
|
564
|
+
*/
|
|
565
|
+
update: threadUpdateInputSchema2.optional(),
|
|
566
|
+
agent: agentTelemetrySchema2.optional()
|
|
567
|
+
}).superRefine(refineContextPublicUrls2);
|
|
568
|
+
var threadUpdateBodySchema = threadUpdateInputSchema2;
|
|
195
569
|
|
|
196
570
|
// src/approval-result.ts
|
|
197
571
|
var TaskTimeoutError = class extends Error {
|
|
@@ -305,7 +679,7 @@ var RobotRock = class {
|
|
|
305
679
|
...task.update !== void 0 ? { update: task.update } : {},
|
|
306
680
|
...task.agent !== void 0 ? { agent: task.agent } : {}
|
|
307
681
|
};
|
|
308
|
-
const validation =
|
|
682
|
+
const validation = createTaskBodySchema2.safeParse(bodyPayload);
|
|
309
683
|
if (!validation.success) {
|
|
310
684
|
throw new RobotRockError(
|
|
311
685
|
`Invalid task: ${validation.error.issues[0]?.message}`,
|