robotrock 1.3.3 → 1.4.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 +32 -0
- package/dist/agent-admin.d.ts +5 -0
- package/dist/agent-admin.js +75 -2
- package/dist/agent-admin.js.map +1 -1
- package/dist/ai/index.d.ts +5 -5
- package/dist/ai/index.js +128 -4
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/trigger.d.ts +3 -3
- package/dist/ai/trigger.js +128 -4
- package/dist/ai/trigger.js.map +1 -1
- package/dist/ai/workflow.d.ts +3 -3
- package/dist/ai/workflow.js +128 -4
- package/dist/ai/workflow.js.map +1 -1
- package/dist/{client-CZ5eWH5v.d.ts → client-BxbxttFH.d.ts} +19 -1
- package/dist/eve/agent/index.d.ts +4 -3
- package/dist/eve/agent/index.js +736 -414
- package/dist/eve/agent/index.js.map +1 -1
- package/dist/eve/index.d.ts +4 -3
- package/dist/eve/index.js +437 -45
- package/dist/eve/index.js.map +1 -1
- package/dist/eve/tools/admin/assign-tasks.d.ts +40 -8
- package/dist/eve/tools/admin/assign-tasks.js +328 -66
- package/dist/eve/tools/admin/assign-tasks.js.map +1 -1
- package/dist/eve/tools/admin/get-workspace-usage.d.ts +71 -0
- package/dist/eve/tools/admin/get-workspace-usage.js +1353 -0
- package/dist/eve/tools/admin/get-workspace-usage.js.map +1 -0
- package/dist/eve/tools/admin/manage-groups.d.ts +122 -8
- package/dist/eve/tools/admin/manage-groups.js +348 -94
- package/dist/eve/tools/admin/manage-groups.js.map +1 -1
- package/dist/eve/tools/admin/manage-team-members.d.ts +86 -8
- package/dist/eve/tools/admin/manage-team-members.js +318 -72
- package/dist/eve/tools/admin/manage-team-members.js.map +1 -1
- package/dist/eve/tools/admin/query-tasks.d.ts +82 -8
- package/dist/eve/tools/admin/query-tasks.js +360 -113
- package/dist/eve/tools/admin/query-tasks.js.map +1 -1
- package/dist/eve/tools/catalog/generate-image.d.ts +64 -0
- package/dist/eve/tools/catalog/generate-image.js +2065 -0
- package/dist/eve/tools/catalog/generate-image.js.map +1 -0
- package/dist/eve/tools/catalog/generate-random-chart.d.ts +71 -0
- package/dist/eve/tools/catalog/generate-random-chart.js +372 -0
- package/dist/eve/tools/catalog/generate-random-chart.js.map +1 -0
- package/dist/eve/tools/catalog/search-products.d.ts +36 -44
- package/dist/eve/tools/catalog/search-products.js +237 -33
- package/dist/eve/tools/catalog/search-products.js.map +1 -1
- package/dist/eve/tools/identity/index.d.ts +2 -2
- package/dist/eve/tools/identity/index.js +35 -44
- package/dist/eve/tools/identity/index.js.map +1 -1
- package/dist/eve/tools/identity/my-access.d.ts +90 -6
- package/dist/eve/tools/identity/my-access.js +35 -44
- package/dist/eve/tools/identity/my-access.js.map +1 -1
- package/dist/eve/tools/identity/whoami.d.ts +1 -1
- package/dist/eve/tools/identity/whoami.js.map +1 -1
- package/dist/eve/tools/inbox/create-task.d.ts +1 -1
- package/dist/eve/tools/inbox/create-task.js +119 -2
- package/dist/eve/tools/inbox/create-task.js.map +1 -1
- package/dist/eve/tools/inbox/index.d.ts +1 -1
- package/dist/eve/tools/inbox/index.js +119 -2
- package/dist/eve/tools/inbox/index.js.map +1 -1
- package/dist/eve/tools/index.d.ts +5 -2
- package/dist/eve/tools/index.js +932 -288
- package/dist/eve/tools/index.js.map +1 -1
- package/dist/index-Drj0Rzf_.d.ts +905 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.js +335 -20
- package/dist/index.js.map +1 -1
- package/dist/schemas/index.js +67 -1
- package/dist/schemas/index.js.map +1 -1
- package/dist/{tool-approval-bridge-DnGaRES4.d.ts → tool-approval-bridge-Cz7qQUpw.d.ts} +1 -1
- package/dist/{tool-reply-guidance-C3qrT1In.d.ts → tool-reply-guidance-CJko9liH.d.ts} +5 -2
- package/dist/tool-result-ui-meta-KT0VafEO.d.ts +52 -0
- package/dist/trigger/index.d.ts +1 -1
- package/dist/trigger/index.js +118 -2
- package/dist/trigger/index.js.map +1 -1
- package/dist/{trigger--qTIK0s6.d.ts → trigger-C1ooSegc.d.ts} +2 -2
- package/dist/workflow/index.d.ts +1 -1
- package/dist/workflow/index.js +118 -2
- package/dist/workflow/index.js.map +1 -1
- package/package.json +21 -4
- package/dist/index-DePyAbTI.d.ts +0 -203
package/dist/eve/agent/index.js
CHANGED
|
@@ -118,6 +118,158 @@ function verifyRobotRockPlatformUserContextJwt(args) {
|
|
|
118
118
|
// ../core/src/eve/platform-user-context-public-key.ts
|
|
119
119
|
var ROBOTROCK_PLATFORM_USER_CONTEXT_PUBLIC_KEY_URL = "https://app.robotrock.io/.well-known/robotrock-user-context-public-key";
|
|
120
120
|
|
|
121
|
+
// ../core/src/utils/decode-html-entities.ts
|
|
122
|
+
function decodeHtmlEntities(value) {
|
|
123
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/'/g, "'").replace(/&#(\d+);/g, (_, code) => String.fromCharCode(Number(code))).replace(
|
|
124
|
+
/&#x([0-9a-f]+);/gi,
|
|
125
|
+
(_, code) => String.fromCharCode(parseInt(code, 16))
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// ../core/src/utils/safe-url.ts
|
|
130
|
+
var BLOCKED_HOSTNAMES = /* @__PURE__ */ new Set([
|
|
131
|
+
"localhost",
|
|
132
|
+
"metadata.google.internal",
|
|
133
|
+
"metadata.goog"
|
|
134
|
+
]);
|
|
135
|
+
function normalizeHostname(hostname) {
|
|
136
|
+
return hostname.toLowerCase().replace(/^\[|\]$/g, "");
|
|
137
|
+
}
|
|
138
|
+
function isBlockedIpv4(host) {
|
|
139
|
+
const match = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(host);
|
|
140
|
+
if (!match) {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
const octets = match.slice(1, 5).map((part) => Number(part));
|
|
144
|
+
if (octets.some((octet) => Number.isNaN(octet) || octet < 0 || octet > 255)) {
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
const [a, b, _c, _d] = octets;
|
|
148
|
+
if (a === void 0 || b === void 0) {
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
if (a === 127 || a === 0) return true;
|
|
152
|
+
if (a === 10) return true;
|
|
153
|
+
if (a === 169 && b === 254) return true;
|
|
154
|
+
if (a === 192 && b === 168) return true;
|
|
155
|
+
if (a === 172 && b >= 16 && b <= 31) return true;
|
|
156
|
+
if (a === 100 && b >= 64 && b <= 127) return true;
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
function ipv4FromNumericHost(host) {
|
|
160
|
+
if (/^\d+$/.test(host)) {
|
|
161
|
+
const num = Number(host);
|
|
162
|
+
if (!Number.isFinite(num) || num < 0 || num > 4294967295) {
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
const a = num >>> 24 & 255;
|
|
166
|
+
const b = num >>> 16 & 255;
|
|
167
|
+
const c = num >>> 8 & 255;
|
|
168
|
+
const d = num & 255;
|
|
169
|
+
return `${a}.${b}.${c}.${d}`;
|
|
170
|
+
}
|
|
171
|
+
const hexMatch = /^0x([0-9a-f]{1,8})$/i.exec(host);
|
|
172
|
+
if (hexMatch) {
|
|
173
|
+
const num = Number.parseInt(hexMatch[1], 16);
|
|
174
|
+
if (!Number.isFinite(num) || num < 0 || num > 4294967295) {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
const a = num >>> 24 & 255;
|
|
178
|
+
const b = num >>> 16 & 255;
|
|
179
|
+
const c = num >>> 8 & 255;
|
|
180
|
+
const d = num & 255;
|
|
181
|
+
return `${a}.${b}.${c}.${d}`;
|
|
182
|
+
}
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
function isBlockedIpv4Mapped(host) {
|
|
186
|
+
const mappedDotted = /^::ffff:(\d{1,3}(?:\.\d{1,3}){3})$/i.exec(host);
|
|
187
|
+
if (mappedDotted) {
|
|
188
|
+
return isBlockedIpv4(mappedDotted[1]);
|
|
189
|
+
}
|
|
190
|
+
const mappedHex = /^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/i.exec(host);
|
|
191
|
+
if (mappedHex) {
|
|
192
|
+
const high = Number.parseInt(mappedHex[1], 16);
|
|
193
|
+
const low = Number.parseInt(mappedHex[2], 16);
|
|
194
|
+
if (Number.isFinite(high) && Number.isFinite(low)) {
|
|
195
|
+
const a = high >> 8 & 255;
|
|
196
|
+
const b = high & 255;
|
|
197
|
+
const c = low >> 8 & 255;
|
|
198
|
+
const d = low & 255;
|
|
199
|
+
return isBlockedIpv4(`${a}.${b}.${c}.${d}`);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
function isBlockedIpv6(host) {
|
|
205
|
+
if (host === "::1" || host === "0:0:0:0:0:0:0:1") {
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
if (host.startsWith("fc") || host.startsWith("fd")) {
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
if (host.startsWith("fe80:")) {
|
|
212
|
+
return true;
|
|
213
|
+
}
|
|
214
|
+
if (isBlockedIpv4Mapped(host)) {
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
function isBlockedHostname(hostname) {
|
|
220
|
+
const host = normalizeHostname(hostname);
|
|
221
|
+
if (!host) {
|
|
222
|
+
return true;
|
|
223
|
+
}
|
|
224
|
+
if (BLOCKED_HOSTNAMES.has(host)) {
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
227
|
+
if (host.endsWith(".localhost") || host.endsWith(".local")) {
|
|
228
|
+
return true;
|
|
229
|
+
}
|
|
230
|
+
const numericIpv4 = ipv4FromNumericHost(host);
|
|
231
|
+
if (numericIpv4 && isBlockedIpv4(numericIpv4)) {
|
|
232
|
+
return true;
|
|
233
|
+
}
|
|
234
|
+
return isBlockedIpv4(host) || isBlockedIpv6(host);
|
|
235
|
+
}
|
|
236
|
+
function isLoopbackHandlerUrl(urlString) {
|
|
237
|
+
let url;
|
|
238
|
+
try {
|
|
239
|
+
url = new URL(urlString);
|
|
240
|
+
} catch {
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
246
|
+
if (url.username || url.password) {
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
const host = url.hostname.toLowerCase();
|
|
250
|
+
return host === "localhost" || host === "127.0.0.1" || host === "::1" || host === "[::1]" || host.endsWith(".localhost");
|
|
251
|
+
}
|
|
252
|
+
function isAllowedHandlerUrl(urlString) {
|
|
253
|
+
return isPublicHttpUrl(urlString) || isLoopbackHandlerUrl(urlString);
|
|
254
|
+
}
|
|
255
|
+
function isPublicHttpUrl(urlString) {
|
|
256
|
+
let url;
|
|
257
|
+
try {
|
|
258
|
+
url = new URL(urlString);
|
|
259
|
+
} catch {
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
262
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
if (url.username || url.password) {
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
return !isBlockedHostname(url.hostname);
|
|
269
|
+
}
|
|
270
|
+
var PUBLIC_HTTP_URL_ERROR = "URL must be a public http:// or https:// address";
|
|
271
|
+
var HANDLER_URL_ERROR = "Handler URL must be a public or loopback http:// or https:// address";
|
|
272
|
+
|
|
121
273
|
// src/eve/input-request.ts
|
|
122
274
|
var EVE_INPUT_SUBMIT_ACTION_ID = "submit";
|
|
123
275
|
var EVE_INPUT_OTHER_CHOICE_ID = "__other__";
|
|
@@ -127,6 +279,9 @@ var CONFIRMATION_DEFAULT_OPTIONS = [
|
|
|
127
279
|
{ id: "deny", label: "Deny", style: "danger" }
|
|
128
280
|
];
|
|
129
281
|
var SELECT_PER_OPTION_THRESHOLD = 6;
|
|
282
|
+
function decodeDisplayText(value) {
|
|
283
|
+
return decodeHtmlEntities(value);
|
|
284
|
+
}
|
|
130
285
|
function resolveEveInputDisplay(request, toolName) {
|
|
131
286
|
if (request.display) {
|
|
132
287
|
return request.display;
|
|
@@ -143,11 +298,12 @@ function confirmationActions(request) {
|
|
|
143
298
|
const options = request.options && request.options.length > 0 ? request.options : CONFIRMATION_DEFAULT_OPTIONS;
|
|
144
299
|
return options.map((option) => ({
|
|
145
300
|
id: option.id,
|
|
146
|
-
title: option.label,
|
|
147
|
-
...option.description ? { description: option.description } : {}
|
|
301
|
+
title: decodeDisplayText(option.label),
|
|
302
|
+
...option.description ? { description: decodeDisplayText(option.description) } : {}
|
|
148
303
|
}));
|
|
149
304
|
}
|
|
150
305
|
function textSubmitAction(prompt) {
|
|
306
|
+
const decodedPrompt = decodeDisplayText(prompt);
|
|
151
307
|
return {
|
|
152
308
|
id: EVE_INPUT_SUBMIT_ACTION_ID,
|
|
153
309
|
title: "Submit",
|
|
@@ -163,7 +319,7 @@ function textSubmitAction(prompt) {
|
|
|
163
319
|
},
|
|
164
320
|
ui: {
|
|
165
321
|
answer: {
|
|
166
|
-
"ui:title":
|
|
322
|
+
"ui:title": decodedPrompt.trim() || "Your answer",
|
|
167
323
|
"ui:widget": "textarea"
|
|
168
324
|
}
|
|
169
325
|
}
|
|
@@ -172,15 +328,15 @@ function textSubmitAction(prompt) {
|
|
|
172
328
|
function selectPerOptionActions(options) {
|
|
173
329
|
return options.map((option) => ({
|
|
174
330
|
id: option.id,
|
|
175
|
-
title: option.label,
|
|
176
|
-
...option.description ? { description: option.description } : {}
|
|
331
|
+
title: decodeDisplayText(option.label),
|
|
332
|
+
...option.description ? { description: decodeDisplayText(option.description) } : {}
|
|
177
333
|
}));
|
|
178
334
|
}
|
|
179
335
|
function selectFormAction(request) {
|
|
180
336
|
const options = request.options ?? [];
|
|
181
337
|
const allowFreeform = request.allowFreeform === true;
|
|
182
338
|
const enumValues = options.map((option) => option.id);
|
|
183
|
-
const enumNames = options.map((option) => option.label);
|
|
339
|
+
const enumNames = options.map((option) => decodeDisplayText(option.label));
|
|
184
340
|
if (allowFreeform) {
|
|
185
341
|
enumValues.push(EVE_INPUT_OTHER_CHOICE_ID);
|
|
186
342
|
enumNames.push(EVE_INPUT_OTHER_CHOICE_LABEL);
|
|
@@ -303,6 +459,12 @@ function isEveApprovalInputRequest(request) {
|
|
|
303
459
|
const options = request.options ?? [];
|
|
304
460
|
return options.length === 2 && options[0]?.id === "approve" && options[1]?.id === "deny";
|
|
305
461
|
}
|
|
462
|
+
function buildOptionIdFormData(display, optionId) {
|
|
463
|
+
if (display === "select" || display === "confirmation") {
|
|
464
|
+
return { choice: optionId };
|
|
465
|
+
}
|
|
466
|
+
return {};
|
|
467
|
+
}
|
|
306
468
|
function eveInputResponseToActionSubmission(request, response, options) {
|
|
307
469
|
const display = resolveEveInputDisplay(request, options?.toolName);
|
|
308
470
|
const actions = eveInputRequestToActions(request, options);
|
|
@@ -312,7 +474,7 @@ function eveInputResponseToActionSubmission(request, response, options) {
|
|
|
312
474
|
return {
|
|
313
475
|
actionId: response.optionId,
|
|
314
476
|
actionTitle: action.title,
|
|
315
|
-
formData:
|
|
477
|
+
formData: buildOptionIdFormData(display, response.optionId)
|
|
316
478
|
};
|
|
317
479
|
}
|
|
318
480
|
const option = request.options?.find((entry) => entry.id === response.optionId);
|
|
@@ -320,13 +482,13 @@ function eveInputResponseToActionSubmission(request, response, options) {
|
|
|
320
482
|
return {
|
|
321
483
|
actionId: response.optionId,
|
|
322
484
|
actionTitle: option.label,
|
|
323
|
-
formData:
|
|
485
|
+
formData: buildOptionIdFormData(display, response.optionId)
|
|
324
486
|
};
|
|
325
487
|
}
|
|
326
488
|
return {
|
|
327
489
|
actionId: response.optionId,
|
|
328
490
|
actionTitle: response.optionId,
|
|
329
|
-
formData:
|
|
491
|
+
formData: buildOptionIdFormData(display, response.optionId)
|
|
330
492
|
};
|
|
331
493
|
}
|
|
332
494
|
const text = response.text?.trim();
|
|
@@ -389,6 +551,190 @@ function parseEveAskQuestionToolOutput(output) {
|
|
|
389
551
|
return { ...optionId ? { optionId } : {}, ...text ? { text } : {} };
|
|
390
552
|
}
|
|
391
553
|
|
|
554
|
+
// src/eve/tool-result-ui-meta.ts
|
|
555
|
+
var TOOL_RESULT_UI_ENTITY_ID_RE = /^[a-z][a-z0-9_]{0,63}$/;
|
|
556
|
+
|
|
557
|
+
// src/eve/entity-schemas.ts
|
|
558
|
+
import { z } from "zod";
|
|
559
|
+
var toolResultUiMetaSchema = z.object({
|
|
560
|
+
present: z.boolean().optional(),
|
|
561
|
+
entity: z.string().regex(TOOL_RESULT_UI_ENTITY_ID_RE).optional(),
|
|
562
|
+
rowsPath: z.string().min(1).optional(),
|
|
563
|
+
layout: z.enum(["list", "chart", "table"]).optional()
|
|
564
|
+
}).strict();
|
|
565
|
+
var agentOnlyFields = {
|
|
566
|
+
replyGuidance: z.string().optional(),
|
|
567
|
+
ui: toolResultUiMetaSchema.optional(),
|
|
568
|
+
uiHint: z.enum(["list", "chart", "table"]).optional()
|
|
569
|
+
};
|
|
570
|
+
function withAgentOnlyFields(shape) {
|
|
571
|
+
return z.object({
|
|
572
|
+
...shape,
|
|
573
|
+
...agentOnlyFields
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
var productEntityRowSchema = z.object({
|
|
577
|
+
id: z.string().min(1),
|
|
578
|
+
name: z.string().min(1),
|
|
579
|
+
price: z.number(),
|
|
580
|
+
currency: z.string().min(1),
|
|
581
|
+
inStock: z.boolean(),
|
|
582
|
+
url: z.string().min(1)
|
|
583
|
+
});
|
|
584
|
+
var metricPointEntityRowSchema = z.object({
|
|
585
|
+
date: z.string().optional(),
|
|
586
|
+
category: z.string().optional(),
|
|
587
|
+
label: z.string().optional()
|
|
588
|
+
}).catchall(z.union([z.string(), z.number()]));
|
|
589
|
+
var memberEntityRowSchema = z.object({
|
|
590
|
+
name: z.string(),
|
|
591
|
+
email: z.string(),
|
|
592
|
+
role: z.string(),
|
|
593
|
+
membershipKind: z.string(),
|
|
594
|
+
profilePictureUrl: z.string().nullable()
|
|
595
|
+
});
|
|
596
|
+
var taskEntityRowSchema = z.object({
|
|
597
|
+
id: z.string().min(1),
|
|
598
|
+
name: z.string().min(1),
|
|
599
|
+
status: z.string().min(1),
|
|
600
|
+
type: z.string().nullable(),
|
|
601
|
+
description: z.string().nullable(),
|
|
602
|
+
validUntil: z.number(),
|
|
603
|
+
createdAt: z.number(),
|
|
604
|
+
url: z.string().min(1),
|
|
605
|
+
threadPriority: z.string().nullable().optional()
|
|
606
|
+
});
|
|
607
|
+
var groupEntityRowSchema = z.object({
|
|
608
|
+
name: z.string().min(1),
|
|
609
|
+
slug: z.string().min(1),
|
|
610
|
+
description: z.string().nullable(),
|
|
611
|
+
memberCount: z.number().nullable(),
|
|
612
|
+
url: z.string().min(1)
|
|
613
|
+
});
|
|
614
|
+
var groupDetailEntitySchema = z.object({
|
|
615
|
+
name: z.string().min(1),
|
|
616
|
+
slug: z.string().min(1),
|
|
617
|
+
description: z.string().nullable(),
|
|
618
|
+
url: z.string().min(1),
|
|
619
|
+
members: z.array(
|
|
620
|
+
z.object({
|
|
621
|
+
name: z.string(),
|
|
622
|
+
email: z.string(),
|
|
623
|
+
profilePictureUrl: z.string().nullable()
|
|
624
|
+
})
|
|
625
|
+
)
|
|
626
|
+
});
|
|
627
|
+
var statusEntityRowSchema = z.object({
|
|
628
|
+
id: z.string().min(1),
|
|
629
|
+
name: z.string().min(1),
|
|
630
|
+
status: z.string().min(1),
|
|
631
|
+
url: z.string().min(1),
|
|
632
|
+
type: z.string().nullable().optional(),
|
|
633
|
+
description: z.string().nullable().optional()
|
|
634
|
+
});
|
|
635
|
+
var agentAdminErrorResultSchema = z.object({
|
|
636
|
+
ok: z.literal(false),
|
|
637
|
+
status: z.number().optional(),
|
|
638
|
+
message: z.string(),
|
|
639
|
+
response: z.unknown().optional()
|
|
640
|
+
});
|
|
641
|
+
var agentAdminMutationResultSchema = z.object({
|
|
642
|
+
...agentOnlyFields
|
|
643
|
+
}).passthrough();
|
|
644
|
+
var searchProductsOutputSchema = withAgentOnlyFields({
|
|
645
|
+
items: z.array(productEntityRowSchema)
|
|
646
|
+
});
|
|
647
|
+
var generateRandomChartOutputSchema = withAgentOnlyFields({
|
|
648
|
+
title: z.string().min(1),
|
|
649
|
+
axis: z.enum(["time", "category"]),
|
|
650
|
+
series: z.array(metricPointEntityRowSchema)
|
|
651
|
+
});
|
|
652
|
+
var generateImageOutputSchema = withAgentOnlyFields({
|
|
653
|
+
prompt: z.string().min(1),
|
|
654
|
+
mediaType: z.string().min(1),
|
|
655
|
+
model: z.string().min(1),
|
|
656
|
+
storageId: z.string().min(1),
|
|
657
|
+
url: z.string().min(1),
|
|
658
|
+
/** @deprecated Legacy sessions only — prefer storageId/url. */
|
|
659
|
+
base64: z.string().min(1).optional()
|
|
660
|
+
});
|
|
661
|
+
var manageTeamMembersListOutputSchema = withAgentOnlyFields({
|
|
662
|
+
members: z.array(memberEntityRowSchema)
|
|
663
|
+
});
|
|
664
|
+
var manageTeamMembersDetailOutputSchema = withAgentOnlyFields(
|
|
665
|
+
memberEntityRowSchema.shape
|
|
666
|
+
);
|
|
667
|
+
var manageTeamMembersOutputSchema = z.union([
|
|
668
|
+
manageTeamMembersListOutputSchema,
|
|
669
|
+
manageTeamMembersDetailOutputSchema,
|
|
670
|
+
agentAdminMutationResultSchema,
|
|
671
|
+
agentAdminErrorResultSchema
|
|
672
|
+
]);
|
|
673
|
+
var manageGroupsListOutputSchema = withAgentOnlyFields({
|
|
674
|
+
groups: z.array(groupEntityRowSchema)
|
|
675
|
+
});
|
|
676
|
+
var manageGroupsDetailOutputSchema = withAgentOnlyFields(
|
|
677
|
+
groupDetailEntitySchema.shape
|
|
678
|
+
);
|
|
679
|
+
var manageGroupsSummaryOutputSchema = withAgentOnlyFields(
|
|
680
|
+
groupEntityRowSchema.shape
|
|
681
|
+
);
|
|
682
|
+
var manageGroupsOutputSchema = z.union([
|
|
683
|
+
manageGroupsListOutputSchema,
|
|
684
|
+
manageGroupsDetailOutputSchema,
|
|
685
|
+
manageGroupsSummaryOutputSchema,
|
|
686
|
+
agentAdminMutationResultSchema,
|
|
687
|
+
agentAdminErrorResultSchema
|
|
688
|
+
]);
|
|
689
|
+
var queryTasksListOutputSchema = withAgentOnlyFields({
|
|
690
|
+
items: z.array(taskEntityRowSchema),
|
|
691
|
+
nextCursor: z.string().nullable().optional()
|
|
692
|
+
});
|
|
693
|
+
var queryTasksDetailOutputSchema = withAgentOnlyFields({
|
|
694
|
+
id: z.string().nullable(),
|
|
695
|
+
status: z.string().nullable(),
|
|
696
|
+
type: z.string().nullable(),
|
|
697
|
+
name: z.string().nullable(),
|
|
698
|
+
description: z.string().nullable(),
|
|
699
|
+
validUntil: z.number().nullable(),
|
|
700
|
+
createdAt: z.number().nullable(),
|
|
701
|
+
url: z.string().min(1).nullable()
|
|
702
|
+
});
|
|
703
|
+
var queryTasksOutputSchema = z.union([
|
|
704
|
+
queryTasksListOutputSchema,
|
|
705
|
+
queryTasksDetailOutputSchema,
|
|
706
|
+
agentAdminErrorResultSchema
|
|
707
|
+
]);
|
|
708
|
+
var assignTasksOutputSchema = z.union([
|
|
709
|
+
withAgentOnlyFields({
|
|
710
|
+
results: z.array(statusEntityRowSchema)
|
|
711
|
+
}),
|
|
712
|
+
agentAdminErrorResultSchema
|
|
713
|
+
]);
|
|
714
|
+
var workspaceUsageEntitySchema = z.object({
|
|
715
|
+
workspace: z.string(),
|
|
716
|
+
plan: z.string(),
|
|
717
|
+
planType: z.string(),
|
|
718
|
+
trialState: z.string(),
|
|
719
|
+
daysRemaining: z.number().nullable(),
|
|
720
|
+
isPaidPro: z.boolean(),
|
|
721
|
+
subscriptionStatus: z.string(),
|
|
722
|
+
tasksToday: z.string(),
|
|
723
|
+
tasksResetAt: z.string(),
|
|
724
|
+
openTasks: z.number(),
|
|
725
|
+
totalTasks: z.number(),
|
|
726
|
+
seats: z.string(),
|
|
727
|
+
groups: z.string(),
|
|
728
|
+
apiKeys: z.string(),
|
|
729
|
+
rateLimitPerSecond: z.number()
|
|
730
|
+
});
|
|
731
|
+
var getWorkspaceUsageOutputSchema = z.union([
|
|
732
|
+
withAgentOnlyFields({
|
|
733
|
+
usage: workspaceUsageEntitySchema
|
|
734
|
+
}),
|
|
735
|
+
agentAdminErrorResultSchema
|
|
736
|
+
]);
|
|
737
|
+
|
|
392
738
|
// src/eve/index.ts
|
|
393
739
|
var ROBOTROCK_READY_HOOK_SLUG = "robotrock-ready";
|
|
394
740
|
|
|
@@ -703,154 +1049,10 @@ function robotrockEveChannel(options) {
|
|
|
703
1049
|
}
|
|
704
1050
|
|
|
705
1051
|
// src/schemas/index.ts
|
|
706
|
-
import { z as
|
|
707
|
-
|
|
708
|
-
// ../core/src/utils/safe-url.ts
|
|
709
|
-
var BLOCKED_HOSTNAMES = /* @__PURE__ */ new Set([
|
|
710
|
-
"localhost",
|
|
711
|
-
"metadata.google.internal",
|
|
712
|
-
"metadata.goog"
|
|
713
|
-
]);
|
|
714
|
-
function normalizeHostname(hostname) {
|
|
715
|
-
return hostname.toLowerCase().replace(/^\[|\]$/g, "");
|
|
716
|
-
}
|
|
717
|
-
function isBlockedIpv4(host) {
|
|
718
|
-
const match = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(host);
|
|
719
|
-
if (!match) {
|
|
720
|
-
return false;
|
|
721
|
-
}
|
|
722
|
-
const octets = match.slice(1, 5).map((part) => Number(part));
|
|
723
|
-
if (octets.some((octet) => Number.isNaN(octet) || octet < 0 || octet > 255)) {
|
|
724
|
-
return true;
|
|
725
|
-
}
|
|
726
|
-
const [a, b, _c, _d] = octets;
|
|
727
|
-
if (a === void 0 || b === void 0) {
|
|
728
|
-
return true;
|
|
729
|
-
}
|
|
730
|
-
if (a === 127 || a === 0) return true;
|
|
731
|
-
if (a === 10) return true;
|
|
732
|
-
if (a === 169 && b === 254) return true;
|
|
733
|
-
if (a === 192 && b === 168) return true;
|
|
734
|
-
if (a === 172 && b >= 16 && b <= 31) return true;
|
|
735
|
-
if (a === 100 && b >= 64 && b <= 127) return true;
|
|
736
|
-
return false;
|
|
737
|
-
}
|
|
738
|
-
function ipv4FromNumericHost(host) {
|
|
739
|
-
if (/^\d+$/.test(host)) {
|
|
740
|
-
const num = Number(host);
|
|
741
|
-
if (!Number.isFinite(num) || num < 0 || num > 4294967295) {
|
|
742
|
-
return null;
|
|
743
|
-
}
|
|
744
|
-
const a = num >>> 24 & 255;
|
|
745
|
-
const b = num >>> 16 & 255;
|
|
746
|
-
const c = num >>> 8 & 255;
|
|
747
|
-
const d = num & 255;
|
|
748
|
-
return `${a}.${b}.${c}.${d}`;
|
|
749
|
-
}
|
|
750
|
-
const hexMatch = /^0x([0-9a-f]{1,8})$/i.exec(host);
|
|
751
|
-
if (hexMatch) {
|
|
752
|
-
const num = Number.parseInt(hexMatch[1], 16);
|
|
753
|
-
if (!Number.isFinite(num) || num < 0 || num > 4294967295) {
|
|
754
|
-
return null;
|
|
755
|
-
}
|
|
756
|
-
const a = num >>> 24 & 255;
|
|
757
|
-
const b = num >>> 16 & 255;
|
|
758
|
-
const c = num >>> 8 & 255;
|
|
759
|
-
const d = num & 255;
|
|
760
|
-
return `${a}.${b}.${c}.${d}`;
|
|
761
|
-
}
|
|
762
|
-
return null;
|
|
763
|
-
}
|
|
764
|
-
function isBlockedIpv4Mapped(host) {
|
|
765
|
-
const mappedDotted = /^::ffff:(\d{1,3}(?:\.\d{1,3}){3})$/i.exec(host);
|
|
766
|
-
if (mappedDotted) {
|
|
767
|
-
return isBlockedIpv4(mappedDotted[1]);
|
|
768
|
-
}
|
|
769
|
-
const mappedHex = /^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/i.exec(host);
|
|
770
|
-
if (mappedHex) {
|
|
771
|
-
const high = Number.parseInt(mappedHex[1], 16);
|
|
772
|
-
const low = Number.parseInt(mappedHex[2], 16);
|
|
773
|
-
if (Number.isFinite(high) && Number.isFinite(low)) {
|
|
774
|
-
const a = high >> 8 & 255;
|
|
775
|
-
const b = high & 255;
|
|
776
|
-
const c = low >> 8 & 255;
|
|
777
|
-
const d = low & 255;
|
|
778
|
-
return isBlockedIpv4(`${a}.${b}.${c}.${d}`);
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
return false;
|
|
782
|
-
}
|
|
783
|
-
function isBlockedIpv6(host) {
|
|
784
|
-
if (host === "::1" || host === "0:0:0:0:0:0:0:1") {
|
|
785
|
-
return true;
|
|
786
|
-
}
|
|
787
|
-
if (host.startsWith("fc") || host.startsWith("fd")) {
|
|
788
|
-
return true;
|
|
789
|
-
}
|
|
790
|
-
if (host.startsWith("fe80:")) {
|
|
791
|
-
return true;
|
|
792
|
-
}
|
|
793
|
-
if (isBlockedIpv4Mapped(host)) {
|
|
794
|
-
return true;
|
|
795
|
-
}
|
|
796
|
-
return false;
|
|
797
|
-
}
|
|
798
|
-
function isBlockedHostname(hostname) {
|
|
799
|
-
const host = normalizeHostname(hostname);
|
|
800
|
-
if (!host) {
|
|
801
|
-
return true;
|
|
802
|
-
}
|
|
803
|
-
if (BLOCKED_HOSTNAMES.has(host)) {
|
|
804
|
-
return true;
|
|
805
|
-
}
|
|
806
|
-
if (host.endsWith(".localhost") || host.endsWith(".local")) {
|
|
807
|
-
return true;
|
|
808
|
-
}
|
|
809
|
-
const numericIpv4 = ipv4FromNumericHost(host);
|
|
810
|
-
if (numericIpv4 && isBlockedIpv4(numericIpv4)) {
|
|
811
|
-
return true;
|
|
812
|
-
}
|
|
813
|
-
return isBlockedIpv4(host) || isBlockedIpv6(host);
|
|
814
|
-
}
|
|
815
|
-
function isLoopbackHandlerUrl(urlString) {
|
|
816
|
-
let url;
|
|
817
|
-
try {
|
|
818
|
-
url = new URL(urlString);
|
|
819
|
-
} catch {
|
|
820
|
-
return false;
|
|
821
|
-
}
|
|
822
|
-
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
823
|
-
return false;
|
|
824
|
-
}
|
|
825
|
-
if (url.username || url.password) {
|
|
826
|
-
return false;
|
|
827
|
-
}
|
|
828
|
-
const host = url.hostname.toLowerCase();
|
|
829
|
-
return host === "localhost" || host === "127.0.0.1" || host === "::1" || host === "[::1]" || host.endsWith(".localhost");
|
|
830
|
-
}
|
|
831
|
-
function isAllowedHandlerUrl(urlString) {
|
|
832
|
-
return isPublicHttpUrl(urlString) || isLoopbackHandlerUrl(urlString);
|
|
833
|
-
}
|
|
834
|
-
function isPublicHttpUrl(urlString) {
|
|
835
|
-
let url;
|
|
836
|
-
try {
|
|
837
|
-
url = new URL(urlString);
|
|
838
|
-
} catch {
|
|
839
|
-
return false;
|
|
840
|
-
}
|
|
841
|
-
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
842
|
-
return false;
|
|
843
|
-
}
|
|
844
|
-
if (url.username || url.password) {
|
|
845
|
-
return false;
|
|
846
|
-
}
|
|
847
|
-
return !isBlockedHostname(url.hostname);
|
|
848
|
-
}
|
|
849
|
-
var PUBLIC_HTTP_URL_ERROR = "URL must be a public http:// or https:// address";
|
|
850
|
-
var HANDLER_URL_ERROR = "Handler URL must be a public or loopback http:// or https:// address";
|
|
1052
|
+
import { z as z5 } from "zod";
|
|
851
1053
|
|
|
852
1054
|
// ../core/src/schemas/task.ts
|
|
853
|
-
import { z } from "zod";
|
|
1055
|
+
import { z as z2 } from "zod";
|
|
854
1056
|
|
|
855
1057
|
// ../core/src/schemas/context-urls.ts
|
|
856
1058
|
function resolveLinkUrl(value) {
|
|
@@ -906,67 +1108,67 @@ function validateContextPublicUrls(context) {
|
|
|
906
1108
|
}
|
|
907
1109
|
|
|
908
1110
|
// ../core/src/schemas/task.ts
|
|
909
|
-
var safeUrlSchema =
|
|
1111
|
+
var safeUrlSchema = z2.string().refine((url) => isPublicHttpUrl(url), {
|
|
910
1112
|
message: PUBLIC_HTTP_URL_ERROR
|
|
911
1113
|
});
|
|
912
|
-
var handlerUrlSchema =
|
|
1114
|
+
var handlerUrlSchema = z2.string().refine((url) => isAllowedHandlerUrl(url), {
|
|
913
1115
|
message: HANDLER_URL_ERROR
|
|
914
1116
|
});
|
|
915
|
-
var jsonSchema7Schema =
|
|
1117
|
+
var jsonSchema7Schema = z2.custom(
|
|
916
1118
|
(val) => typeof val === "object" && val !== null,
|
|
917
1119
|
{ message: "Must be a valid JSON Schema object" }
|
|
918
1120
|
);
|
|
919
|
-
var uiSchemaSchema =
|
|
1121
|
+
var uiSchemaSchema = z2.custom((val) => typeof val === "object" && val !== null, {
|
|
920
1122
|
message: "Must be a valid UiSchema object"
|
|
921
1123
|
});
|
|
922
|
-
var webhookHandlerSchema =
|
|
923
|
-
type:
|
|
1124
|
+
var webhookHandlerSchema = z2.object({
|
|
1125
|
+
type: z2.literal("webhook"),
|
|
924
1126
|
url: handlerUrlSchema,
|
|
925
|
-
headers:
|
|
1127
|
+
headers: z2.record(z2.string(), z2.string())
|
|
926
1128
|
});
|
|
927
1129
|
var triggerHandlerSchema = webhookHandlerSchema.extend({
|
|
928
|
-
type:
|
|
929
|
-
tokenId:
|
|
1130
|
+
type: z2.literal("trigger"),
|
|
1131
|
+
tokenId: z2.string().min(1)
|
|
930
1132
|
});
|
|
931
|
-
var handlerSchema =
|
|
932
|
-
var taskActionInputSchema =
|
|
933
|
-
id:
|
|
934
|
-
title:
|
|
935
|
-
description:
|
|
1133
|
+
var handlerSchema = z2.discriminatedUnion("type", [webhookHandlerSchema, triggerHandlerSchema]);
|
|
1134
|
+
var taskActionInputSchema = z2.object({
|
|
1135
|
+
id: z2.string().min(1),
|
|
1136
|
+
title: z2.string().min(1),
|
|
1137
|
+
description: z2.string().optional(),
|
|
936
1138
|
schema: jsonSchema7Schema.optional(),
|
|
937
1139
|
ui: uiSchemaSchema.optional(),
|
|
938
|
-
data:
|
|
1140
|
+
data: z2.record(z2.string(), z2.unknown()).optional()
|
|
939
1141
|
});
|
|
940
1142
|
var taskActionSchema = taskActionInputSchema.extend({
|
|
941
1143
|
// Optional handlers for this action - if present, must have at least 1
|
|
942
|
-
handlers:
|
|
943
|
-
});
|
|
944
|
-
var uiFieldSchemaSchema =
|
|
945
|
-
"ui:widget":
|
|
946
|
-
"ui:title":
|
|
947
|
-
"ui:description":
|
|
948
|
-
"ui:options":
|
|
949
|
-
items:
|
|
1144
|
+
handlers: z2.array(handlerSchema).min(1).optional()
|
|
1145
|
+
});
|
|
1146
|
+
var uiFieldSchemaSchema = z2.object({
|
|
1147
|
+
"ui:widget": z2.string().optional(),
|
|
1148
|
+
"ui:title": z2.string().optional(),
|
|
1149
|
+
"ui:description": z2.string().optional(),
|
|
1150
|
+
"ui:options": z2.record(z2.string(), z2.unknown()).optional(),
|
|
1151
|
+
items: z2.lazy(() => z2.record(z2.string(), uiFieldSchemaSchema)).optional()
|
|
950
1152
|
}).passthrough();
|
|
951
|
-
var contextUiSchema =
|
|
952
|
-
var contextDataSchema =
|
|
953
|
-
data:
|
|
1153
|
+
var contextUiSchema = z2.record(z2.string(), uiFieldSchemaSchema).optional();
|
|
1154
|
+
var contextDataSchema = z2.object({
|
|
1155
|
+
data: z2.record(z2.string(), z2.unknown()),
|
|
954
1156
|
ui: contextUiSchema
|
|
955
1157
|
}).optional();
|
|
956
1158
|
var TASK_CONTEXT_FORMAT_VERSION = 2;
|
|
957
|
-
var taskContextObjectBaseSchema =
|
|
1159
|
+
var taskContextObjectBaseSchema = z2.object({
|
|
958
1160
|
/** Source application id; omitted tasks are grouped in the default inbox. */
|
|
959
|
-
app:
|
|
960
|
-
type:
|
|
961
|
-
name:
|
|
962
|
-
description:
|
|
963
|
-
validUntil:
|
|
1161
|
+
app: z2.string().min(1).optional(),
|
|
1162
|
+
type: z2.string().min(1),
|
|
1163
|
+
name: z2.string().min(1),
|
|
1164
|
+
description: z2.string().optional(),
|
|
1165
|
+
validUntil: z2.string().optional(),
|
|
964
1166
|
context: contextDataSchema,
|
|
965
1167
|
/** Task context wire format version. @default 2 */
|
|
966
|
-
contextVersion:
|
|
1168
|
+
contextVersion: z2.literal(2).optional(),
|
|
967
1169
|
/** @deprecated Use `contextVersion`. Accepted on ingest only. */
|
|
968
|
-
version:
|
|
969
|
-
actions:
|
|
1170
|
+
version: z2.literal(2).optional(),
|
|
1171
|
+
actions: z2.array(taskActionSchema).min(1, "At least one action is required")
|
|
970
1172
|
});
|
|
971
1173
|
function normalizeTaskContextVersion(data) {
|
|
972
1174
|
const { version: legacyVersion, contextVersion, ...rest } = data;
|
|
@@ -982,7 +1184,7 @@ function refineContextPublicUrls(data, ctx) {
|
|
|
982
1184
|
const error = validateContextPublicUrls(data.context);
|
|
983
1185
|
if (error) {
|
|
984
1186
|
ctx.addIssue({
|
|
985
|
-
code:
|
|
1187
|
+
code: z2.ZodIssueCode.custom,
|
|
986
1188
|
message: error,
|
|
987
1189
|
path: ["context"]
|
|
988
1190
|
});
|
|
@@ -991,9 +1193,9 @@ function refineContextPublicUrls(data, ctx) {
|
|
|
991
1193
|
var taskContextSchema = taskContextObjectSchema.superRefine(
|
|
992
1194
|
refineContextPublicUrls
|
|
993
1195
|
);
|
|
994
|
-
var assignToSchema =
|
|
995
|
-
users:
|
|
996
|
-
groups:
|
|
1196
|
+
var assignToSchema = z2.object({
|
|
1197
|
+
users: z2.array(z2.string().email()).optional(),
|
|
1198
|
+
groups: z2.array(z2.string().min(1)).optional()
|
|
997
1199
|
}).refine(
|
|
998
1200
|
(data) => {
|
|
999
1201
|
const groups = data.groups ?? [];
|
|
@@ -1004,7 +1206,7 @@ var assignToSchema = z.object({
|
|
|
1004
1206
|
},
|
|
1005
1207
|
{ message: 'Cannot combine "all" with other group slugs' }
|
|
1006
1208
|
);
|
|
1007
|
-
var threadUpdateMessageSchema =
|
|
1209
|
+
var threadUpdateMessageSchema = z2.string().min(1).max(500);
|
|
1008
1210
|
var threadUpdateStatuses = [
|
|
1009
1211
|
"info",
|
|
1010
1212
|
"queued",
|
|
@@ -1014,16 +1216,16 @@ var threadUpdateStatuses = [
|
|
|
1014
1216
|
"failed",
|
|
1015
1217
|
"cancelled"
|
|
1016
1218
|
];
|
|
1017
|
-
var threadUpdateStatusSchema =
|
|
1018
|
-
var threadUpdateInputSchema =
|
|
1219
|
+
var threadUpdateStatusSchema = z2.enum(threadUpdateStatuses);
|
|
1220
|
+
var threadUpdateInputSchema = z2.object({
|
|
1019
1221
|
message: threadUpdateMessageSchema,
|
|
1020
1222
|
status: threadUpdateStatusSchema.optional()
|
|
1021
1223
|
});
|
|
1022
1224
|
var taskPriorities = ["low", "normal", "high", "urgent"];
|
|
1023
|
-
var taskPrioritySchema =
|
|
1024
|
-
var agentTelemetrySchema =
|
|
1225
|
+
var taskPrioritySchema = z2.enum(taskPriorities);
|
|
1226
|
+
var agentTelemetrySchema = z2.object({
|
|
1025
1227
|
/** Agent or app version (semver, git SHA, deploy tag — caller-defined). */
|
|
1026
|
-
version:
|
|
1228
|
+
version: z2.string().min(1)
|
|
1027
1229
|
});
|
|
1028
1230
|
var createTaskBodySchema = taskContextObjectBaseSchema.extend({
|
|
1029
1231
|
assignTo: assignToSchema.optional(),
|
|
@@ -1031,7 +1233,7 @@ var createTaskBodySchema = taskContextObjectBaseSchema.extend({
|
|
|
1031
1233
|
* Groups related tasks together. When omitted, the server generates one and
|
|
1032
1234
|
* returns it so the caller can reuse it on later tasks in the same thread.
|
|
1033
1235
|
*/
|
|
1034
|
-
threadId:
|
|
1236
|
+
threadId: z2.string().min(1).optional(),
|
|
1035
1237
|
/**
|
|
1036
1238
|
* Optional thread priority. When set, applies to the whole thread and
|
|
1037
1239
|
* overwrites any previous priority. Omit on later tasks to leave unchanged.
|
|
@@ -1045,280 +1247,346 @@ var createTaskBodySchema = taskContextObjectBaseSchema.extend({
|
|
|
1045
1247
|
/** Agent release version — not shown in inbox UI. */
|
|
1046
1248
|
agent: agentTelemetrySchema.optional()
|
|
1047
1249
|
}).transform(normalizeTaskContextVersion).superRefine(refineContextPublicUrls);
|
|
1048
|
-
var agentChatSeedActionSchema =
|
|
1250
|
+
var agentChatSeedActionSchema = z2.object({
|
|
1049
1251
|
/** Stable action id echoed back on submit; auto-derived from title when omitted. */
|
|
1050
|
-
id:
|
|
1051
|
-
title:
|
|
1052
|
-
description:
|
|
1252
|
+
id: z2.string().min(1).optional(),
|
|
1253
|
+
title: z2.string().min(1),
|
|
1254
|
+
description: z2.string().optional(),
|
|
1053
1255
|
/** JSON Schema object for the form fields. */
|
|
1054
|
-
schema:
|
|
1256
|
+
schema: z2.record(z2.string(), z2.unknown()).optional(),
|
|
1055
1257
|
/** RJSF ui schema overrides (ui:widget, ui:enumNames, etc.). */
|
|
1056
|
-
ui:
|
|
1258
|
+
ui: z2.record(z2.string(), z2.unknown()).optional(),
|
|
1057
1259
|
/** Optional default field values. */
|
|
1058
|
-
data:
|
|
1260
|
+
data: z2.record(z2.string(), z2.unknown()).optional()
|
|
1059
1261
|
});
|
|
1060
|
-
var agentChatSeedMessageSchema =
|
|
1061
|
-
role:
|
|
1062
|
-
text:
|
|
1262
|
+
var agentChatSeedMessageSchema = z2.object({
|
|
1263
|
+
role: z2.enum(["user", "assistant"]),
|
|
1264
|
+
text: z2.string().min(1),
|
|
1063
1265
|
/** Optional display-name override for the message sender. */
|
|
1064
|
-
senderName:
|
|
1266
|
+
senderName: z2.string().min(1).optional(),
|
|
1065
1267
|
/**
|
|
1066
1268
|
* Optional structured input request rendered as a styled RobotRock action
|
|
1067
1269
|
* widget below the message text. Use this instead of asking the user to reply
|
|
1068
1270
|
* in plain text so the request is always a proper action form.
|
|
1069
1271
|
*/
|
|
1070
|
-
requestActionInput:
|
|
1071
|
-
prompt:
|
|
1272
|
+
requestActionInput: z2.object({
|
|
1273
|
+
prompt: z2.string().optional(),
|
|
1072
1274
|
action: agentChatSeedActionSchema
|
|
1073
1275
|
}).optional()
|
|
1074
1276
|
});
|
|
1075
|
-
var eveAgentChatTransportSchema =
|
|
1076
|
-
kind:
|
|
1077
|
-
chatId:
|
|
1078
|
-
baseUrl:
|
|
1079
|
-
sessionId:
|
|
1080
|
-
continuationToken:
|
|
1081
|
-
streamIndex:
|
|
1082
|
-
isStreaming:
|
|
1277
|
+
var eveAgentChatTransportSchema = z2.object({
|
|
1278
|
+
kind: z2.literal("eve"),
|
|
1279
|
+
chatId: z2.string().min(1),
|
|
1280
|
+
baseUrl: z2.string().url(),
|
|
1281
|
+
sessionId: z2.string().optional(),
|
|
1282
|
+
continuationToken: z2.string().optional(),
|
|
1283
|
+
streamIndex: z2.number().int().nonnegative().optional(),
|
|
1284
|
+
isStreaming: z2.boolean().optional()
|
|
1083
1285
|
});
|
|
1084
|
-
var createAgentChatBodySchema =
|
|
1286
|
+
var createAgentChatBodySchema = z2.object({
|
|
1085
1287
|
/** Agent id (eve agent name). Required unless `parentChatId` is set. */
|
|
1086
|
-
agentIdentifier:
|
|
1288
|
+
agentIdentifier: z2.string().min(1).optional(),
|
|
1087
1289
|
/** Inherit tenant/connection/agent from an existing chat (agent-spawned chats). */
|
|
1088
|
-
parentChatId:
|
|
1290
|
+
parentChatId: z2.string().min(1).optional(),
|
|
1089
1291
|
/** Convex tenantEveConnections id; resolved from the tenant when omitted. */
|
|
1090
|
-
eveConnectionId:
|
|
1292
|
+
eveConnectionId: z2.string().min(1).optional(),
|
|
1091
1293
|
/** Source application id; groups the chat under an inbox section. */
|
|
1092
|
-
app:
|
|
1294
|
+
app: z2.string().min(1).optional(),
|
|
1093
1295
|
/** Email of the user who owns the chat. Required unless `parentChatId` is set. */
|
|
1094
|
-
ownerEmail:
|
|
1095
|
-
title:
|
|
1096
|
-
messages:
|
|
1296
|
+
ownerEmail: z2.string().email().optional(),
|
|
1297
|
+
title: z2.string().min(1),
|
|
1298
|
+
messages: z2.array(agentChatSeedMessageSchema).default([]),
|
|
1097
1299
|
/** Provenance label stored on the session ("cron" | "agent" | ...). */
|
|
1098
|
-
source:
|
|
1300
|
+
source: z2.string().min(1).optional()
|
|
1099
1301
|
}).refine((data) => Boolean(data.agentIdentifier || data.parentChatId), {
|
|
1100
1302
|
message: "Provide either agentIdentifier or parentChatId"
|
|
1101
1303
|
}).refine((data) => Boolean(data.ownerEmail || data.parentChatId), {
|
|
1102
1304
|
message: "Provide ownerEmail unless parentChatId is set"
|
|
1103
1305
|
});
|
|
1104
|
-
var agentChatAuditToolBodySchema =
|
|
1105
|
-
eveSessionId:
|
|
1106
|
-
userId:
|
|
1107
|
-
toolCallId:
|
|
1108
|
-
toolName:
|
|
1109
|
-
input:
|
|
1110
|
-
success:
|
|
1111
|
-
status:
|
|
1112
|
-
error:
|
|
1113
|
-
idempotencyKey:
|
|
1114
|
-
});
|
|
1115
|
-
var agentChatAuditInputBodySchema =
|
|
1116
|
-
eveSessionId:
|
|
1117
|
-
userId:
|
|
1118
|
-
actionId:
|
|
1119
|
-
actionTitle:
|
|
1120
|
-
prompt:
|
|
1121
|
-
data:
|
|
1122
|
-
idempotencyKey:
|
|
1306
|
+
var agentChatAuditToolBodySchema = z2.object({
|
|
1307
|
+
eveSessionId: z2.string().min(1),
|
|
1308
|
+
userId: z2.string().min(1),
|
|
1309
|
+
toolCallId: z2.string().min(1),
|
|
1310
|
+
toolName: z2.string().min(1),
|
|
1311
|
+
input: z2.record(z2.string(), z2.unknown()).default({}),
|
|
1312
|
+
success: z2.boolean(),
|
|
1313
|
+
status: z2.enum(["completed", "failed", "rejected"]),
|
|
1314
|
+
error: z2.string().optional(),
|
|
1315
|
+
idempotencyKey: z2.string().optional()
|
|
1316
|
+
});
|
|
1317
|
+
var agentChatAuditInputBodySchema = z2.object({
|
|
1318
|
+
eveSessionId: z2.string().min(1),
|
|
1319
|
+
userId: z2.string().min(1),
|
|
1320
|
+
actionId: z2.string().min(1),
|
|
1321
|
+
actionTitle: z2.string().optional(),
|
|
1322
|
+
prompt: z2.string().optional(),
|
|
1323
|
+
data: z2.record(z2.string(), z2.unknown()).optional(),
|
|
1324
|
+
idempotencyKey: z2.string().optional(),
|
|
1123
1325
|
/** Eve input request id — used to merge staged HITL metadata. */
|
|
1124
|
-
requestId:
|
|
1326
|
+
requestId: z2.string().optional(),
|
|
1125
1327
|
/** Eve tool call id — fallback lookup for staged HITL metadata. */
|
|
1126
|
-
toolCallId:
|
|
1328
|
+
toolCallId: z2.string().optional()
|
|
1127
1329
|
});
|
|
1128
|
-
var eveHitlStagedOptionSchema =
|
|
1129
|
-
id:
|
|
1130
|
-
label:
|
|
1330
|
+
var eveHitlStagedOptionSchema = z2.object({
|
|
1331
|
+
id: z2.string(),
|
|
1332
|
+
label: z2.string()
|
|
1131
1333
|
});
|
|
1132
|
-
var agentChatStageHitlBodySchema =
|
|
1133
|
-
eveSessionId:
|
|
1134
|
-
requests:
|
|
1135
|
-
|
|
1136
|
-
requestId:
|
|
1137
|
-
toolCallId:
|
|
1138
|
-
toolName:
|
|
1139
|
-
prompt:
|
|
1140
|
-
display:
|
|
1141
|
-
allowFreeform:
|
|
1142
|
-
options:
|
|
1143
|
-
toolInput:
|
|
1334
|
+
var agentChatStageHitlBodySchema = z2.object({
|
|
1335
|
+
eveSessionId: z2.string().min(1),
|
|
1336
|
+
requests: z2.array(
|
|
1337
|
+
z2.object({
|
|
1338
|
+
requestId: z2.string().min(1),
|
|
1339
|
+
toolCallId: z2.string().min(1),
|
|
1340
|
+
toolName: z2.string().min(1),
|
|
1341
|
+
prompt: z2.string().min(1),
|
|
1342
|
+
display: z2.enum(["confirmation", "select", "text"]).optional(),
|
|
1343
|
+
allowFreeform: z2.boolean().optional(),
|
|
1344
|
+
options: z2.array(eveHitlStagedOptionSchema).optional(),
|
|
1345
|
+
toolInput: z2.record(z2.string(), z2.unknown()).optional()
|
|
1144
1346
|
})
|
|
1145
1347
|
)
|
|
1146
1348
|
});
|
|
1147
|
-
var agentChatLinkTaskBodySchema =
|
|
1148
|
-
eveSessionId:
|
|
1149
|
-
publicTaskId:
|
|
1150
|
-
toolCallId:
|
|
1349
|
+
var agentChatLinkTaskBodySchema = z2.object({
|
|
1350
|
+
eveSessionId: z2.string().min(1),
|
|
1351
|
+
publicTaskId: z2.string().min(1),
|
|
1352
|
+
toolCallId: z2.string().min(1)
|
|
1353
|
+
});
|
|
1354
|
+
var AGENT_FILE_TAGS_MAX = 20;
|
|
1355
|
+
var AGENT_FILE_TAG_MAX_LENGTH = 64;
|
|
1356
|
+
function normalizeAgentFileTags(tags) {
|
|
1357
|
+
if (!tags?.length) return void 0;
|
|
1358
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1359
|
+
const out = [];
|
|
1360
|
+
for (const raw of tags) {
|
|
1361
|
+
const tag = raw.trim().toLowerCase().slice(0, AGENT_FILE_TAG_MAX_LENGTH);
|
|
1362
|
+
if (!tag || seen.has(tag)) continue;
|
|
1363
|
+
seen.add(tag);
|
|
1364
|
+
out.push(tag);
|
|
1365
|
+
if (out.length >= AGENT_FILE_TAGS_MAX) break;
|
|
1366
|
+
}
|
|
1367
|
+
return out.length > 0 ? out : void 0;
|
|
1368
|
+
}
|
|
1369
|
+
var agentChatUploadImageBodySchema = z2.object({
|
|
1370
|
+
mediaType: z2.string().min(1),
|
|
1371
|
+
/** Raw base64 (no data: URL prefix). */
|
|
1372
|
+
base64: z2.string().min(1),
|
|
1373
|
+
chatId: z2.string().min(1).optional(),
|
|
1374
|
+
publicTaskId: z2.string().min(1).optional(),
|
|
1375
|
+
source: z2.string().min(1).optional(),
|
|
1376
|
+
/** Display / search name (e.g. `sunset-robot.png`). */
|
|
1377
|
+
filename: z2.string().min(1).max(255).optional(),
|
|
1378
|
+
/** Human-readable description (e.g. generation prompt). */
|
|
1379
|
+
description: z2.string().min(1).max(2e3).optional(),
|
|
1380
|
+
/**
|
|
1381
|
+
* Optional labels for later grouping/filtering.
|
|
1382
|
+
* Normalized to lowercase trimmed unique strings (max 20, 64 chars each).
|
|
1383
|
+
*/
|
|
1384
|
+
tags: z2.array(z2.string().min(1).max(AGENT_FILE_TAG_MAX_LENGTH)).max(AGENT_FILE_TAGS_MAX).optional().transform((tags) => normalizeAgentFileTags(tags))
|
|
1385
|
+
}).refine((data) => Boolean(data.chatId || data.publicTaskId), {
|
|
1386
|
+
message: "Provide chatId and/or publicTaskId"
|
|
1151
1387
|
});
|
|
1152
1388
|
|
|
1153
1389
|
// ../core/src/schemas/tool-result-display.ts
|
|
1154
|
-
import { z as
|
|
1155
|
-
var toolDisplayMetadataSchema =
|
|
1156
|
-
widget:
|
|
1157
|
-
title:
|
|
1158
|
-
description:
|
|
1390
|
+
import { z as z3 } from "zod";
|
|
1391
|
+
var toolDisplayMetadataSchema = z3.object({
|
|
1392
|
+
widget: z3.string().optional(),
|
|
1393
|
+
title: z3.string().optional(),
|
|
1394
|
+
description: z3.string().optional()
|
|
1159
1395
|
});
|
|
1160
|
-
var toolDisplayEnvelopeSchema =
|
|
1396
|
+
var toolDisplayEnvelopeSchema = z3.object({
|
|
1161
1397
|
display: toolDisplayMetadataSchema.optional(),
|
|
1162
|
-
data:
|
|
1163
|
-
ui:
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
"ui:widget":
|
|
1167
|
-
"ui:title":
|
|
1168
|
-
"ui:description":
|
|
1169
|
-
"ui:options":
|
|
1398
|
+
data: z3.record(z3.string(), z3.unknown()),
|
|
1399
|
+
ui: z3.record(
|
|
1400
|
+
z3.string(),
|
|
1401
|
+
z3.object({
|
|
1402
|
+
"ui:widget": z3.string().optional(),
|
|
1403
|
+
"ui:title": z3.string().optional(),
|
|
1404
|
+
"ui:description": z3.string().optional(),
|
|
1405
|
+
"ui:options": z3.record(z3.string(), z3.unknown()).optional()
|
|
1170
1406
|
}).passthrough()
|
|
1171
1407
|
).optional()
|
|
1172
1408
|
});
|
|
1173
1409
|
|
|
1174
1410
|
// ../core/src/schemas/agent-admin.ts
|
|
1175
|
-
import { z as
|
|
1176
|
-
var tenantRoleSchema =
|
|
1177
|
-
var agentAdminUserSchema =
|
|
1178
|
-
id:
|
|
1179
|
-
email:
|
|
1180
|
-
name:
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1411
|
+
import { z as z4 } from "zod";
|
|
1412
|
+
var tenantRoleSchema = z4.enum(["admin", "member"]);
|
|
1413
|
+
var agentAdminUserSchema = z4.object({
|
|
1414
|
+
id: z4.string(),
|
|
1415
|
+
email: z4.string().email(),
|
|
1416
|
+
name: z4.string(),
|
|
1417
|
+
profilePictureUrl: z4.string().nullable().optional()
|
|
1418
|
+
});
|
|
1419
|
+
var agentAdminMemberSchema = z4.object({
|
|
1420
|
+
userId: z4.string(),
|
|
1421
|
+
role: z4.string(),
|
|
1422
|
+
membershipKind: z4.enum(["team", "assignee"]),
|
|
1423
|
+
hasLoggedIn: z4.boolean(),
|
|
1187
1424
|
user: agentAdminUserSchema
|
|
1188
1425
|
});
|
|
1189
|
-
var agentAdminGroupSchema =
|
|
1190
|
-
id:
|
|
1191
|
-
name:
|
|
1192
|
-
slug:
|
|
1193
|
-
description:
|
|
1194
|
-
memberCount:
|
|
1426
|
+
var agentAdminGroupSchema = z4.object({
|
|
1427
|
+
id: z4.string(),
|
|
1428
|
+
name: z4.string(),
|
|
1429
|
+
slug: z4.string(),
|
|
1430
|
+
description: z4.string().nullable(),
|
|
1431
|
+
memberCount: z4.number().optional()
|
|
1195
1432
|
});
|
|
1196
1433
|
var agentAdminGroupDetailSchema = agentAdminGroupSchema.extend({
|
|
1197
|
-
members:
|
|
1198
|
-
|
|
1199
|
-
userId:
|
|
1434
|
+
members: z4.array(
|
|
1435
|
+
z4.object({
|
|
1436
|
+
userId: z4.string(),
|
|
1200
1437
|
user: agentAdminUserSchema
|
|
1201
1438
|
})
|
|
1202
1439
|
)
|
|
1203
1440
|
});
|
|
1204
|
-
var agentAdminTaskSummarySchema =
|
|
1205
|
-
id:
|
|
1206
|
-
convexId:
|
|
1207
|
-
status:
|
|
1208
|
-
type:
|
|
1209
|
-
name:
|
|
1210
|
-
description:
|
|
1211
|
-
validUntil:
|
|
1212
|
-
createdAt:
|
|
1213
|
-
threadPriority:
|
|
1214
|
-
handledByUserId:
|
|
1215
|
-
});
|
|
1216
|
-
var inviteMemberBodySchema =
|
|
1217
|
-
email:
|
|
1441
|
+
var agentAdminTaskSummarySchema = z4.object({
|
|
1442
|
+
id: z4.string(),
|
|
1443
|
+
convexId: z4.string(),
|
|
1444
|
+
status: z4.string(),
|
|
1445
|
+
type: z4.string().nullable(),
|
|
1446
|
+
name: z4.string().nullable(),
|
|
1447
|
+
description: z4.string().nullable(),
|
|
1448
|
+
validUntil: z4.number(),
|
|
1449
|
+
createdAt: z4.number(),
|
|
1450
|
+
threadPriority: z4.string().nullable(),
|
|
1451
|
+
handledByUserId: z4.string().nullable()
|
|
1452
|
+
});
|
|
1453
|
+
var inviteMemberBodySchema = z4.object({
|
|
1454
|
+
email: z4.string().email(),
|
|
1218
1455
|
role: tenantRoleSchema.optional()
|
|
1219
1456
|
});
|
|
1220
|
-
var updateMemberRoleBodySchema =
|
|
1457
|
+
var updateMemberRoleBodySchema = z4.object({
|
|
1221
1458
|
role: tenantRoleSchema
|
|
1222
1459
|
});
|
|
1223
|
-
var createGroupBodySchema =
|
|
1224
|
-
name:
|
|
1225
|
-
description:
|
|
1460
|
+
var createGroupBodySchema = z4.object({
|
|
1461
|
+
name: z4.string().min(1),
|
|
1462
|
+
description: z4.string().optional()
|
|
1226
1463
|
});
|
|
1227
|
-
var updateGroupBodySchema =
|
|
1228
|
-
name:
|
|
1229
|
-
description:
|
|
1464
|
+
var updateGroupBodySchema = z4.object({
|
|
1465
|
+
name: z4.string().min(1).optional(),
|
|
1466
|
+
description: z4.string().optional()
|
|
1467
|
+
});
|
|
1468
|
+
var addGroupMemberBodySchema = z4.object({
|
|
1469
|
+
userId: z4.string().min(1).describe("Convex user id or member email.")
|
|
1470
|
+
});
|
|
1471
|
+
var listTasksQuerySchema = z4.object({
|
|
1472
|
+
statusFilter: z4.enum(["all", "open", "handled", "expired"]).optional(),
|
|
1473
|
+
typeFilter: z4.string().optional(),
|
|
1474
|
+
appFilter: z4.string().optional(),
|
|
1475
|
+
sortField: z4.enum(["type", "date", "status", "validUntil"]).optional(),
|
|
1476
|
+
sortDirection: z4.enum(["asc", "desc"]).optional(),
|
|
1477
|
+
limit: z4.coerce.number().int().positive().max(100).optional(),
|
|
1478
|
+
cursor: z4.string().optional()
|
|
1230
1479
|
});
|
|
1231
|
-
var
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
});
|
|
1243
|
-
var
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
taskId: z3.string(),
|
|
1249
|
-
success: z3.boolean(),
|
|
1250
|
-
message: z3.string().optional(),
|
|
1251
|
-
name: z3.string().nullable().optional(),
|
|
1252
|
-
description: z3.string().nullable().optional(),
|
|
1253
|
-
type: z3.string().nullable().optional()
|
|
1254
|
-
});
|
|
1255
|
-
var assignTasksResponseSchema = z3.object({
|
|
1256
|
-
results: z3.array(assignTasksResultSchema)
|
|
1257
|
-
});
|
|
1258
|
-
var assignTasksBodySchema = z3.object({
|
|
1259
|
-
taskIds: z3.array(z3.string().min(1)).min(1).max(100),
|
|
1480
|
+
var searchTasksQuerySchema = z4.object({
|
|
1481
|
+
q: z4.string().min(1),
|
|
1482
|
+
limit: z4.coerce.number().int().positive().max(100).optional()
|
|
1483
|
+
});
|
|
1484
|
+
var assignTasksResultSchema = z4.object({
|
|
1485
|
+
taskId: z4.string(),
|
|
1486
|
+
success: z4.boolean(),
|
|
1487
|
+
message: z4.string().optional(),
|
|
1488
|
+
name: z4.string().nullable().optional(),
|
|
1489
|
+
description: z4.string().nullable().optional(),
|
|
1490
|
+
type: z4.string().nullable().optional()
|
|
1491
|
+
});
|
|
1492
|
+
var assignTasksResponseSchema = z4.object({
|
|
1493
|
+
results: z4.array(assignTasksResultSchema)
|
|
1494
|
+
});
|
|
1495
|
+
var assignTasksBodySchema = z4.object({
|
|
1496
|
+
taskIds: z4.array(z4.string().min(1)).min(1).max(100),
|
|
1260
1497
|
assignTo: assignToSchema.refine(
|
|
1261
1498
|
(value) => (value.users?.length ?? 0) > 0 || (value.groups?.length ?? 0) > 0,
|
|
1262
1499
|
{ message: "assignTo needs at least one user email or group slug." }
|
|
1263
1500
|
)
|
|
1264
1501
|
});
|
|
1502
|
+
var agentAdminPlanLimitsSchema = z4.object({
|
|
1503
|
+
tasksPerDay: z4.number(),
|
|
1504
|
+
members: z4.number(),
|
|
1505
|
+
apiKeys: z4.number(),
|
|
1506
|
+
groups: z4.number(),
|
|
1507
|
+
auditLogRetention: z4.number(),
|
|
1508
|
+
rateLimitPerSecond: z4.number(),
|
|
1509
|
+
taskRetentionDays: z4.number()
|
|
1510
|
+
});
|
|
1511
|
+
var agentAdminUsageSchema = z4.object({
|
|
1512
|
+
workspace: z4.string(),
|
|
1513
|
+
planName: z4.string(),
|
|
1514
|
+
planType: z4.string(),
|
|
1515
|
+
trialState: z4.enum(["none", "active", "expired"]),
|
|
1516
|
+
daysRemaining: z4.number().nullable(),
|
|
1517
|
+
isPaidPro: z4.boolean(),
|
|
1518
|
+
subscriptionStatus: z4.string().nullable(),
|
|
1519
|
+
tasksToday: z4.number(),
|
|
1520
|
+
maxTasksPerDay: z4.number().nullable(),
|
|
1521
|
+
tasksResetAt: z4.number(),
|
|
1522
|
+
openTasks: z4.number(),
|
|
1523
|
+
totalTasks: z4.number(),
|
|
1524
|
+
seatsCurrent: z4.number(),
|
|
1525
|
+
seatsMax: z4.number().nullable(),
|
|
1526
|
+
groupsCurrent: z4.number(),
|
|
1527
|
+
groupsMax: z4.number().nullable(),
|
|
1528
|
+
apiKeysCurrent: z4.number(),
|
|
1529
|
+
apiKeysMax: z4.number().nullable(),
|
|
1530
|
+
rateLimitPerSecond: z4.number(),
|
|
1531
|
+
limits: agentAdminPlanLimitsSchema
|
|
1532
|
+
});
|
|
1265
1533
|
|
|
1266
1534
|
// src/schemas/index.ts
|
|
1267
|
-
var handlerUrlSchema2 =
|
|
1535
|
+
var handlerUrlSchema2 = z5.string().refine((url) => isAllowedHandlerUrl(url), {
|
|
1268
1536
|
message: HANDLER_URL_ERROR
|
|
1269
1537
|
});
|
|
1270
|
-
var jsonSchema7Schema2 =
|
|
1538
|
+
var jsonSchema7Schema2 = z5.custom(
|
|
1271
1539
|
(val) => typeof val === "object" && val !== null,
|
|
1272
1540
|
{ message: "Must be a valid JSON Schema object" }
|
|
1273
1541
|
);
|
|
1274
|
-
var uiSchemaSchema2 =
|
|
1542
|
+
var uiSchemaSchema2 = z5.custom((val) => typeof val === "object" && val !== null, {
|
|
1275
1543
|
message: "Must be a valid UiSchema object"
|
|
1276
1544
|
});
|
|
1277
|
-
var webhookHandlerSchema2 =
|
|
1278
|
-
type:
|
|
1545
|
+
var webhookHandlerSchema2 = z5.object({
|
|
1546
|
+
type: z5.literal("webhook"),
|
|
1279
1547
|
url: handlerUrlSchema2,
|
|
1280
|
-
headers:
|
|
1548
|
+
headers: z5.record(z5.string(), z5.string())
|
|
1281
1549
|
});
|
|
1282
1550
|
var triggerHandlerSchema2 = webhookHandlerSchema2.extend({
|
|
1283
|
-
type:
|
|
1284
|
-
tokenId:
|
|
1285
|
-
});
|
|
1286
|
-
var handlerSchema2 =
|
|
1287
|
-
var taskActionInputSchema2 =
|
|
1288
|
-
id:
|
|
1289
|
-
title:
|
|
1290
|
-
description:
|
|
1551
|
+
type: z5.literal("trigger"),
|
|
1552
|
+
tokenId: z5.string().min(1)
|
|
1553
|
+
});
|
|
1554
|
+
var handlerSchema2 = z5.discriminatedUnion("type", [webhookHandlerSchema2, triggerHandlerSchema2]);
|
|
1555
|
+
var taskActionInputSchema2 = z5.object({
|
|
1556
|
+
id: z5.string().min(1),
|
|
1557
|
+
title: z5.string().min(1),
|
|
1558
|
+
description: z5.string().optional(),
|
|
1291
1559
|
schema: jsonSchema7Schema2.optional(),
|
|
1292
1560
|
ui: uiSchemaSchema2.optional(),
|
|
1293
|
-
data:
|
|
1561
|
+
data: z5.record(z5.string(), z5.unknown()).optional()
|
|
1294
1562
|
});
|
|
1295
1563
|
var taskActionSchema2 = taskActionInputSchema2.extend({
|
|
1296
|
-
handlers:
|
|
1297
|
-
});
|
|
1298
|
-
var uiFieldSchemaSchema2 =
|
|
1299
|
-
"ui:widget":
|
|
1300
|
-
"ui:title":
|
|
1301
|
-
"ui:description":
|
|
1302
|
-
"ui:options":
|
|
1303
|
-
items:
|
|
1564
|
+
handlers: z5.array(handlerSchema2).min(1).optional()
|
|
1565
|
+
});
|
|
1566
|
+
var uiFieldSchemaSchema2 = z5.object({
|
|
1567
|
+
"ui:widget": z5.string().optional(),
|
|
1568
|
+
"ui:title": z5.string().optional(),
|
|
1569
|
+
"ui:description": z5.string().optional(),
|
|
1570
|
+
"ui:options": z5.record(z5.string(), z5.unknown()).optional(),
|
|
1571
|
+
items: z5.lazy(() => z5.record(z5.string(), uiFieldSchemaSchema2)).optional()
|
|
1304
1572
|
}).passthrough();
|
|
1305
|
-
var contextUiSchema2 =
|
|
1306
|
-
var contextDataSchema2 =
|
|
1307
|
-
data:
|
|
1573
|
+
var contextUiSchema2 = z5.record(z5.string(), uiFieldSchemaSchema2).optional();
|
|
1574
|
+
var contextDataSchema2 = z5.object({
|
|
1575
|
+
data: z5.record(z5.string(), z5.unknown()),
|
|
1308
1576
|
ui: contextUiSchema2
|
|
1309
1577
|
}).optional();
|
|
1310
1578
|
var TASK_CONTEXT_FORMAT_VERSION2 = 2;
|
|
1311
|
-
var taskContextObjectBaseSchema2 =
|
|
1312
|
-
app:
|
|
1313
|
-
type:
|
|
1314
|
-
name:
|
|
1315
|
-
description:
|
|
1316
|
-
validUntil:
|
|
1579
|
+
var taskContextObjectBaseSchema2 = z5.object({
|
|
1580
|
+
app: z5.string().min(1).optional(),
|
|
1581
|
+
type: z5.string().min(1),
|
|
1582
|
+
name: z5.string().min(1),
|
|
1583
|
+
description: z5.string().optional(),
|
|
1584
|
+
validUntil: z5.string().optional(),
|
|
1317
1585
|
context: contextDataSchema2,
|
|
1318
|
-
contextVersion:
|
|
1586
|
+
contextVersion: z5.literal(2).optional(),
|
|
1319
1587
|
/** @deprecated Use `contextVersion`. Accepted on ingest only. */
|
|
1320
|
-
version:
|
|
1321
|
-
actions:
|
|
1588
|
+
version: z5.literal(2).optional(),
|
|
1589
|
+
actions: z5.array(taskActionSchema2).min(1, "At least one action is required")
|
|
1322
1590
|
});
|
|
1323
1591
|
function normalizeTaskContextVersion2(data) {
|
|
1324
1592
|
const { version: legacyVersion, contextVersion, ...rest } = data;
|
|
@@ -1334,7 +1602,7 @@ function refineContextPublicUrls2(data, ctx) {
|
|
|
1334
1602
|
const error = validateContextPublicUrls(data.context);
|
|
1335
1603
|
if (error) {
|
|
1336
1604
|
ctx.addIssue({
|
|
1337
|
-
code:
|
|
1605
|
+
code: z5.ZodIssueCode.custom,
|
|
1338
1606
|
message: error,
|
|
1339
1607
|
path: ["context"]
|
|
1340
1608
|
});
|
|
@@ -1343,9 +1611,9 @@ function refineContextPublicUrls2(data, ctx) {
|
|
|
1343
1611
|
var taskContextSchema2 = taskContextObjectSchema2.superRefine(
|
|
1344
1612
|
refineContextPublicUrls2
|
|
1345
1613
|
);
|
|
1346
|
-
var assignToSchema2 =
|
|
1347
|
-
users:
|
|
1348
|
-
groups:
|
|
1614
|
+
var assignToSchema2 = z5.object({
|
|
1615
|
+
users: z5.array(z5.string().email()).optional(),
|
|
1616
|
+
groups: z5.array(z5.string().min(1)).optional()
|
|
1349
1617
|
}).refine(
|
|
1350
1618
|
(data) => {
|
|
1351
1619
|
const groups = data.groups ?? [];
|
|
@@ -1356,7 +1624,7 @@ var assignToSchema2 = z4.object({
|
|
|
1356
1624
|
},
|
|
1357
1625
|
{ message: 'Cannot combine "all" with other group slugs' }
|
|
1358
1626
|
);
|
|
1359
|
-
var threadUpdateMessageSchema2 =
|
|
1627
|
+
var threadUpdateMessageSchema2 = z5.string().min(1).max(500);
|
|
1360
1628
|
var threadUpdateStatuses2 = [
|
|
1361
1629
|
"info",
|
|
1362
1630
|
"queued",
|
|
@@ -1366,15 +1634,15 @@ var threadUpdateStatuses2 = [
|
|
|
1366
1634
|
"failed",
|
|
1367
1635
|
"cancelled"
|
|
1368
1636
|
];
|
|
1369
|
-
var threadUpdateStatusSchema2 =
|
|
1370
|
-
var threadUpdateInputSchema2 =
|
|
1637
|
+
var threadUpdateStatusSchema2 = z5.enum(threadUpdateStatuses2);
|
|
1638
|
+
var threadUpdateInputSchema2 = z5.object({
|
|
1371
1639
|
message: threadUpdateMessageSchema2,
|
|
1372
1640
|
status: threadUpdateStatusSchema2.optional()
|
|
1373
1641
|
});
|
|
1374
1642
|
var taskPriorities2 = ["low", "normal", "high", "urgent"];
|
|
1375
|
-
var taskPrioritySchema2 =
|
|
1376
|
-
var agentTelemetrySchema2 =
|
|
1377
|
-
version:
|
|
1643
|
+
var taskPrioritySchema2 = z5.enum(taskPriorities2);
|
|
1644
|
+
var agentTelemetrySchema2 = z5.object({
|
|
1645
|
+
version: z5.string().min(1)
|
|
1378
1646
|
});
|
|
1379
1647
|
var createTaskBodySchema2 = taskContextObjectBaseSchema2.extend({
|
|
1380
1648
|
assignTo: assignToSchema2.optional(),
|
|
@@ -1382,7 +1650,7 @@ var createTaskBodySchema2 = taskContextObjectBaseSchema2.extend({
|
|
|
1382
1650
|
* Groups related tasks together. When omitted, the server generates one and
|
|
1383
1651
|
* returns it so the caller can reuse it on later tasks in the same thread.
|
|
1384
1652
|
*/
|
|
1385
|
-
threadId:
|
|
1653
|
+
threadId: z5.string().min(1).optional(),
|
|
1386
1654
|
/**
|
|
1387
1655
|
* Optional thread priority. When set, applies to the whole thread and
|
|
1388
1656
|
* overwrites any previous priority. Omit on later tasks to leave unchanged.
|
|
@@ -1417,7 +1685,7 @@ var HANDLER_RETRY_DELAYS_MS = [
|
|
|
1417
1685
|
var HANDLER_MAX_ATTEMPTS = HANDLER_RETRY_DELAYS_MS.length + 1;
|
|
1418
1686
|
|
|
1419
1687
|
// ../core/src/attribution/index.ts
|
|
1420
|
-
import { z as
|
|
1688
|
+
import { z as z6 } from "zod";
|
|
1421
1689
|
|
|
1422
1690
|
// ../core/src/app-url.ts
|
|
1423
1691
|
var PRODUCTION_APP_URL = "https://app.robotrock.io";
|
|
@@ -1444,16 +1712,16 @@ function getRobotRockApiBaseUrl() {
|
|
|
1444
1712
|
|
|
1445
1713
|
// ../core/src/attribution/index.ts
|
|
1446
1714
|
var ATTRIBUTION_COOKIE_MAX_AGE = 60 * 60 * 24 * 90;
|
|
1447
|
-
var attributionSchema =
|
|
1448
|
-
utmSource:
|
|
1449
|
-
utmMedium:
|
|
1450
|
-
utmCampaign:
|
|
1451
|
-
utmContent:
|
|
1452
|
-
utmTerm:
|
|
1453
|
-
gclid:
|
|
1454
|
-
landingUrl:
|
|
1455
|
-
referrer:
|
|
1456
|
-
capturedAt:
|
|
1715
|
+
var attributionSchema = z6.object({
|
|
1716
|
+
utmSource: z6.string().optional(),
|
|
1717
|
+
utmMedium: z6.string().optional(),
|
|
1718
|
+
utmCampaign: z6.string().optional(),
|
|
1719
|
+
utmContent: z6.string().optional(),
|
|
1720
|
+
utmTerm: z6.string().optional(),
|
|
1721
|
+
gclid: z6.string().optional(),
|
|
1722
|
+
landingUrl: z6.string().optional(),
|
|
1723
|
+
referrer: z6.string().optional(),
|
|
1724
|
+
capturedAt: z6.number()
|
|
1457
1725
|
});
|
|
1458
1726
|
|
|
1459
1727
|
// src/approval-result.ts
|
|
@@ -1565,7 +1833,11 @@ function resolveRobotRockAuthConfig(overrides) {
|
|
|
1565
1833
|
"RobotRock auth is required. Set ROBOTROCK_API_KEY, ROBOTROCK_AGENT_SERVICE_TOKEN with tenant context, or pass auth when creating the client."
|
|
1566
1834
|
);
|
|
1567
1835
|
}
|
|
1568
|
-
return {
|
|
1836
|
+
return {
|
|
1837
|
+
kind: "apiKey",
|
|
1838
|
+
apiKey,
|
|
1839
|
+
...overrides?.actingUserId?.trim() ? { actingUserId: overrides.actingUserId.trim() } : {}
|
|
1840
|
+
};
|
|
1569
1841
|
}
|
|
1570
1842
|
|
|
1571
1843
|
// src/chat-correlation.ts
|
|
@@ -1770,6 +2042,51 @@ function createChatsApi(config) {
|
|
|
1770
2042
|
data
|
|
1771
2043
|
);
|
|
1772
2044
|
}
|
|
2045
|
+
},
|
|
2046
|
+
async uploadImage(input) {
|
|
2047
|
+
const validation = agentChatUploadImageBodySchema.safeParse(input);
|
|
2048
|
+
if (!validation.success) {
|
|
2049
|
+
throw new RobotRockError(
|
|
2050
|
+
`Invalid image upload: ${validation.error.issues[0]?.message}`,
|
|
2051
|
+
400,
|
|
2052
|
+
validation.error.issues
|
|
2053
|
+
);
|
|
2054
|
+
}
|
|
2055
|
+
const response = await fetch(`${config.baseUrl}/agent-chats/images`, {
|
|
2056
|
+
method: "POST",
|
|
2057
|
+
headers: headers(),
|
|
2058
|
+
body: JSON.stringify(validation.data)
|
|
2059
|
+
});
|
|
2060
|
+
const data = await parseResponseBody(response);
|
|
2061
|
+
if (!response.ok) {
|
|
2062
|
+
throw new RobotRockError(
|
|
2063
|
+
getErrorMessage(data, "Failed to upload chat image"),
|
|
2064
|
+
response.status,
|
|
2065
|
+
data
|
|
2066
|
+
);
|
|
2067
|
+
}
|
|
2068
|
+
const uploaded = data;
|
|
2069
|
+
if (typeof uploaded.storageId !== "string" || typeof uploaded.url !== "string" || typeof uploaded.mediaType !== "string") {
|
|
2070
|
+
throw new RobotRockError(
|
|
2071
|
+
"Image upload returned an invalid response",
|
|
2072
|
+
500,
|
|
2073
|
+
data
|
|
2074
|
+
);
|
|
2075
|
+
}
|
|
2076
|
+
return {
|
|
2077
|
+
storageId: uploaded.storageId,
|
|
2078
|
+
url: uploaded.url,
|
|
2079
|
+
mediaType: uploaded.mediaType,
|
|
2080
|
+
...typeof uploaded.chatId === "string" ? { chatId: uploaded.chatId } : {},
|
|
2081
|
+
...typeof uploaded.publicTaskId === "string" ? { publicTaskId: uploaded.publicTaskId } : {},
|
|
2082
|
+
...typeof uploaded.filename === "string" ? { filename: uploaded.filename } : {},
|
|
2083
|
+
...typeof uploaded.description === "string" ? { description: uploaded.description } : {},
|
|
2084
|
+
...Array.isArray(uploaded.tags) ? {
|
|
2085
|
+
tags: uploaded.tags.filter(
|
|
2086
|
+
(tag) => typeof tag === "string"
|
|
2087
|
+
)
|
|
2088
|
+
} : {}
|
|
2089
|
+
};
|
|
1773
2090
|
}
|
|
1774
2091
|
};
|
|
1775
2092
|
}
|
|
@@ -1839,6 +2156,7 @@ var RobotRock = class {
|
|
|
1839
2156
|
}
|
|
1840
2157
|
this.auth = resolveRobotRockAuthConfig({
|
|
1841
2158
|
...apiKey ? { apiKey } : {},
|
|
2159
|
+
...config.actingUserId ? { actingUserId: config.actingUserId } : {},
|
|
1842
2160
|
...agentService ? { agentService } : {}
|
|
1843
2161
|
});
|
|
1844
2162
|
this.chatCorrelation = config.chatCorrelation;
|
|
@@ -2168,6 +2486,7 @@ function tryCreateBoundRobotRockClient(ctx) {
|
|
|
2168
2486
|
if (apiKey) {
|
|
2169
2487
|
return createClient({
|
|
2170
2488
|
apiKey,
|
|
2489
|
+
...caller?.userId ? { actingUserId: caller.userId } : {},
|
|
2171
2490
|
baseUrl: process.env.ROBOTROCK_BASE_URL?.trim(),
|
|
2172
2491
|
chatCorrelation
|
|
2173
2492
|
});
|
|
@@ -2597,6 +2916,9 @@ async function agentAdminFetch(config, path, init) {
|
|
|
2597
2916
|
}
|
|
2598
2917
|
function createAgentAdminApi(config) {
|
|
2599
2918
|
return {
|
|
2919
|
+
usage: {
|
|
2920
|
+
get: () => agentAdminFetch(config, "/usage")
|
|
2921
|
+
},
|
|
2600
2922
|
members: {
|
|
2601
2923
|
list: () => agentAdminFetch(config, "/members"),
|
|
2602
2924
|
get: (memberRef) => agentAdminFetch(config, `/members/${encodeURIComponent(memberRef)}`),
|