robotrock 1.0.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-admin.d.ts +82 -0
- package/dist/agent-admin.js +938 -0
- package/dist/agent-admin.js.map +1 -0
- package/dist/ai/index.d.ts +6 -5
- package/dist/ai/index.js +682 -225
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/trigger.d.ts +4 -3
- package/dist/ai/trigger.js +682 -225
- package/dist/ai/trigger.js.map +1 -1
- package/dist/ai/workflow.d.ts +4 -3
- package/dist/ai/workflow.js +679 -222
- package/dist/ai/workflow.js.map +1 -1
- package/dist/auth-headers-qL-ZeEtd.d.ts +13 -0
- package/dist/{client-CzVmjXpz.d.ts → client-YO9Y1rkH.d.ts} +51 -10
- package/dist/eve/agent/index.d.ts +164 -0
- package/dist/eve/agent/index.js +2854 -0
- package/dist/eve/agent/index.js.map +1 -0
- package/dist/eve/index.d.ts +8 -0
- package/dist/eve/index.js +639 -0
- package/dist/eve/index.js.map +1 -0
- package/dist/eve/tools/admin/assign-tasks.d.ts +39 -0
- package/dist/eve/tools/admin/assign-tasks.js +1060 -0
- package/dist/eve/tools/admin/assign-tasks.js.map +1 -0
- package/dist/eve/tools/admin/manage-groups.d.ts +53 -0
- package/dist/eve/tools/admin/manage-groups.js +1218 -0
- package/dist/eve/tools/admin/manage-groups.js.map +1 -0
- package/dist/eve/tools/admin/manage-team-members.d.ts +45 -0
- package/dist/eve/tools/admin/manage-team-members.js +1160 -0
- package/dist/eve/tools/admin/manage-team-members.js.map +1 -0
- package/dist/eve/tools/admin/query-tasks.d.ts +71 -0
- package/dist/eve/tools/admin/query-tasks.js +1161 -0
- package/dist/eve/tools/admin/query-tasks.js.map +1 -0
- package/dist/eve/tools/catalog/search-products.d.ts +57 -0
- package/dist/eve/tools/catalog/search-products.js +94 -0
- package/dist/eve/tools/catalog/search-products.js.map +1 -0
- package/dist/eve/tools/identity/index.d.ts +8 -0
- package/dist/eve/tools/identity/index.js +234 -0
- package/dist/eve/tools/identity/index.js.map +1 -0
- package/dist/eve/tools/identity/my-access.d.ts +18 -0
- package/dist/eve/tools/identity/my-access.js +187 -0
- package/dist/eve/tools/identity/my-access.js.map +1 -0
- package/dist/eve/tools/identity/whoami.d.ts +44 -0
- package/dist/eve/tools/identity/whoami.js +117 -0
- package/dist/eve/tools/identity/whoami.js.map +1 -0
- package/dist/eve/tools/inbox/create-task.d.ts +114 -0
- package/dist/eve/tools/inbox/create-task.js +1785 -0
- package/dist/eve/tools/inbox/create-task.js.map +1 -0
- package/dist/eve/tools/inbox/index.d.ts +6 -0
- package/dist/eve/tools/inbox/index.js +1785 -0
- package/dist/eve/tools/inbox/index.js.map +1 -0
- package/dist/eve/tools/index.d.ts +24 -0
- package/dist/eve/tools/index.js +2848 -0
- package/dist/eve/tools/index.js.map +1 -0
- package/dist/index-DoQN48Bm.d.ts +200 -0
- package/dist/index.d.ts +8 -44
- package/dist/index.js +842 -137
- package/dist/index.js.map +1 -1
- package/dist/schemas/index.d.ts +6 -1
- package/dist/schemas/index.js +251 -59
- package/dist/schemas/index.js.map +1 -1
- package/dist/tenant-5YKDrdC-.d.ts +23 -0
- package/dist/{tool-approval-bridge-DbwUEBHv.d.ts → tool-approval-bridge-aMA79Z1B.d.ts} +1 -1
- package/dist/tool-reply-guidance-C3qrT1In.d.ts +25 -0
- package/dist/trigger/index.d.ts +2 -1
- package/dist/trigger/index.js +543 -127
- package/dist/trigger/index.js.map +1 -1
- package/dist/{trigger-BCKBbAV7.d.ts → trigger-CXrbKVCL.d.ts} +2 -2
- package/dist/workflow/index.d.ts +2 -1
- package/dist/workflow/index.js +543 -127
- package/dist/workflow/index.js.map +1 -1
- package/package.json +69 -8
package/dist/ai/workflow.js
CHANGED
|
@@ -75,6 +75,13 @@ var init_convex_sanitize = __esm({
|
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
77
|
|
|
78
|
+
// ../core/src/utils/deployment-secret-encryption.ts
|
|
79
|
+
var init_deployment_secret_encryption = __esm({
|
|
80
|
+
"../core/src/utils/deployment-secret-encryption.ts"() {
|
|
81
|
+
"use strict";
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
78
85
|
// ../core/src/utils/safe-url.ts
|
|
79
86
|
function normalizeHostname(hostname) {
|
|
80
87
|
return hostname.toLowerCase().replace(/^\[|\]$/g, "");
|
|
@@ -177,6 +184,25 @@ function isBlockedHostname(hostname) {
|
|
|
177
184
|
}
|
|
178
185
|
return isBlockedIpv4(host) || isBlockedIpv6(host);
|
|
179
186
|
}
|
|
187
|
+
function isLoopbackHandlerUrl(urlString) {
|
|
188
|
+
let url;
|
|
189
|
+
try {
|
|
190
|
+
url = new URL(urlString);
|
|
191
|
+
} catch {
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
if (url.username || url.password) {
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
const host = url.hostname.toLowerCase();
|
|
201
|
+
return host === "localhost" || host === "127.0.0.1" || host === "::1" || host === "[::1]" || host.endsWith(".localhost");
|
|
202
|
+
}
|
|
203
|
+
function isAllowedHandlerUrl(urlString) {
|
|
204
|
+
return isPublicHttpUrl(urlString) || isLoopbackHandlerUrl(urlString);
|
|
205
|
+
}
|
|
180
206
|
function isPublicHttpUrl(urlString) {
|
|
181
207
|
let url;
|
|
182
208
|
try {
|
|
@@ -192,7 +218,7 @@ function isPublicHttpUrl(urlString) {
|
|
|
192
218
|
}
|
|
193
219
|
return !isBlockedHostname(url.hostname);
|
|
194
220
|
}
|
|
195
|
-
var BLOCKED_HOSTNAMES, PUBLIC_HTTP_URL_ERROR;
|
|
221
|
+
var BLOCKED_HOSTNAMES, PUBLIC_HTTP_URL_ERROR, HANDLER_URL_ERROR;
|
|
196
222
|
var init_safe_url = __esm({
|
|
197
223
|
"../core/src/utils/safe-url.ts"() {
|
|
198
224
|
"use strict";
|
|
@@ -202,6 +228,7 @@ var init_safe_url = __esm({
|
|
|
202
228
|
"metadata.goog"
|
|
203
229
|
]);
|
|
204
230
|
PUBLIC_HTTP_URL_ERROR = "URL must be a public http:// or https:// address";
|
|
231
|
+
HANDLER_URL_ERROR = "Handler URL must be a public or loopback http:// or https:// address";
|
|
205
232
|
}
|
|
206
233
|
});
|
|
207
234
|
|
|
@@ -218,6 +245,7 @@ var init_utils = __esm({
|
|
|
218
245
|
"use strict";
|
|
219
246
|
init_cn();
|
|
220
247
|
init_convex_sanitize();
|
|
248
|
+
init_deployment_secret_encryption();
|
|
221
249
|
init_safe_url();
|
|
222
250
|
init_task_app();
|
|
223
251
|
}
|
|
@@ -301,7 +329,7 @@ function refineContextPublicUrls(data, ctx) {
|
|
|
301
329
|
});
|
|
302
330
|
}
|
|
303
331
|
}
|
|
304
|
-
var safeUrlSchema, jsonSchema7Schema, uiSchemaSchema, webhookHandlerSchema, triggerHandlerSchema, handlerSchema, taskActionInputSchema, taskActionSchema, uiFieldSchemaSchema, contextUiSchema, contextDataSchema, TASK_CONTEXT_FORMAT_VERSION, taskContextObjectBaseSchema, taskContextObjectSchema, taskContextSchema, assignToSchema, threadUpdateMessageSchema, threadUpdateStatuses, threadUpdateStatusSchema, threadUpdateInputSchema, taskPriorities, taskPrioritySchema, agentTelemetrySchema, createTaskBodySchema, agentChatSeedActionSchema, agentChatSeedMessageSchema, createAgentChatBodySchema,
|
|
332
|
+
var safeUrlSchema, handlerUrlSchema, jsonSchema7Schema, uiSchemaSchema, webhookHandlerSchema, triggerHandlerSchema, handlerSchema, taskActionInputSchema, taskActionSchema, uiFieldSchemaSchema, contextUiSchema, contextDataSchema, TASK_CONTEXT_FORMAT_VERSION, taskContextObjectBaseSchema, taskContextObjectSchema, taskContextSchema, assignToSchema, threadUpdateMessageSchema, threadUpdateStatuses, threadUpdateStatusSchema, threadUpdateInputSchema, taskPriorities, taskPrioritySchema, agentTelemetrySchema, createTaskBodySchema, agentChatSeedActionSchema, agentChatSeedMessageSchema, eveAgentChatTransportSchema, createAgentChatBodySchema, agentChatAuditToolBodySchema, agentChatAuditInputBodySchema, eveHitlStagedOptionSchema, agentChatStageHitlBodySchema, agentChatLinkTaskBodySchema;
|
|
305
333
|
var init_task = __esm({
|
|
306
334
|
"../core/src/schemas/task.ts"() {
|
|
307
335
|
"use strict";
|
|
@@ -310,6 +338,9 @@ var init_task = __esm({
|
|
|
310
338
|
safeUrlSchema = z.string().refine((url) => isPublicHttpUrl(url), {
|
|
311
339
|
message: PUBLIC_HTTP_URL_ERROR
|
|
312
340
|
});
|
|
341
|
+
handlerUrlSchema = z.string().refine((url) => isAllowedHandlerUrl(url), {
|
|
342
|
+
message: HANDLER_URL_ERROR
|
|
343
|
+
});
|
|
313
344
|
jsonSchema7Schema = z.custom(
|
|
314
345
|
(val) => typeof val === "object" && val !== null,
|
|
315
346
|
{ message: "Must be a valid JSON Schema object" }
|
|
@@ -319,7 +350,7 @@ var init_task = __esm({
|
|
|
319
350
|
});
|
|
320
351
|
webhookHandlerSchema = z.object({
|
|
321
352
|
type: z.literal("webhook"),
|
|
322
|
-
url:
|
|
353
|
+
url: handlerUrlSchema,
|
|
323
354
|
headers: z.record(z.string(), z.string())
|
|
324
355
|
});
|
|
325
356
|
triggerHandlerSchema = webhookHandlerSchema.extend({
|
|
@@ -453,28 +484,82 @@ var init_task = __esm({
|
|
|
453
484
|
action: agentChatSeedActionSchema
|
|
454
485
|
}).optional()
|
|
455
486
|
});
|
|
487
|
+
eveAgentChatTransportSchema = z.object({
|
|
488
|
+
kind: z.literal("eve"),
|
|
489
|
+
chatId: z.string().min(1),
|
|
490
|
+
baseUrl: z.string().url(),
|
|
491
|
+
sessionId: z.string().optional(),
|
|
492
|
+
continuationToken: z.string().optional(),
|
|
493
|
+
streamIndex: z.number().int().nonnegative().optional(),
|
|
494
|
+
isStreaming: z.boolean().optional()
|
|
495
|
+
});
|
|
456
496
|
createAgentChatBodySchema = z.object({
|
|
457
|
-
/**
|
|
497
|
+
/** Agent id (eve agent name). Required unless `parentChatId` is set. */
|
|
458
498
|
agentIdentifier: z.string().min(1).optional(),
|
|
459
499
|
/** Inherit tenant/connection/agent from an existing chat (agent-spawned chats). */
|
|
460
500
|
parentChatId: z.string().min(1).optional(),
|
|
461
|
-
/** Convex
|
|
462
|
-
|
|
501
|
+
/** Convex tenantEveConnections id; resolved from the tenant when omitted. */
|
|
502
|
+
eveConnectionId: z.string().min(1).optional(),
|
|
463
503
|
/** Source application id; groups the chat under an inbox section. */
|
|
464
504
|
app: z.string().min(1).optional(),
|
|
465
|
-
|
|
505
|
+
/** Email of the user who owns the chat. Required unless `parentChatId` is set. */
|
|
506
|
+
ownerEmail: z.string().email().optional(),
|
|
466
507
|
title: z.string().min(1),
|
|
467
508
|
messages: z.array(agentChatSeedMessageSchema).default([]),
|
|
468
509
|
/** Provenance label stored on the session ("cron" | "agent" | ...). */
|
|
469
510
|
source: z.string().min(1).optional()
|
|
470
511
|
}).refine((data) => Boolean(data.agentIdentifier || data.parentChatId), {
|
|
471
512
|
message: "Provide either agentIdentifier or parentChatId"
|
|
513
|
+
}).refine((data) => Boolean(data.ownerEmail || data.parentChatId), {
|
|
514
|
+
message: "Provide ownerEmail unless parentChatId is set"
|
|
472
515
|
});
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
516
|
+
agentChatAuditToolBodySchema = z.object({
|
|
517
|
+
eveSessionId: z.string().min(1),
|
|
518
|
+
userId: z.string().min(1),
|
|
519
|
+
toolCallId: z.string().min(1),
|
|
520
|
+
toolName: z.string().min(1),
|
|
521
|
+
input: z.record(z.string(), z.unknown()).default({}),
|
|
522
|
+
success: z.boolean(),
|
|
523
|
+
status: z.enum(["completed", "failed", "rejected"]),
|
|
524
|
+
error: z.string().optional(),
|
|
525
|
+
idempotencyKey: z.string().optional()
|
|
526
|
+
});
|
|
527
|
+
agentChatAuditInputBodySchema = z.object({
|
|
528
|
+
eveSessionId: z.string().min(1),
|
|
529
|
+
userId: z.string().min(1),
|
|
530
|
+
actionId: z.string().min(1),
|
|
531
|
+
actionTitle: z.string().optional(),
|
|
532
|
+
prompt: z.string().optional(),
|
|
533
|
+
data: z.record(z.string(), z.unknown()).optional(),
|
|
534
|
+
idempotencyKey: z.string().optional(),
|
|
535
|
+
/** Eve input request id — used to merge staged HITL metadata. */
|
|
536
|
+
requestId: z.string().optional(),
|
|
537
|
+
/** Eve tool call id — fallback lookup for staged HITL metadata. */
|
|
538
|
+
toolCallId: z.string().optional()
|
|
539
|
+
});
|
|
540
|
+
eveHitlStagedOptionSchema = z.object({
|
|
541
|
+
id: z.string(),
|
|
542
|
+
label: z.string()
|
|
543
|
+
});
|
|
544
|
+
agentChatStageHitlBodySchema = z.object({
|
|
545
|
+
eveSessionId: z.string().min(1),
|
|
546
|
+
requests: z.array(
|
|
547
|
+
z.object({
|
|
548
|
+
requestId: z.string().min(1),
|
|
549
|
+
toolCallId: z.string().min(1),
|
|
550
|
+
toolName: z.string().min(1),
|
|
551
|
+
prompt: z.string().min(1),
|
|
552
|
+
display: z.enum(["confirmation", "select", "text"]).optional(),
|
|
553
|
+
allowFreeform: z.boolean().optional(),
|
|
554
|
+
options: z.array(eveHitlStagedOptionSchema).optional(),
|
|
555
|
+
toolInput: z.record(z.string(), z.unknown()).optional()
|
|
556
|
+
})
|
|
557
|
+
)
|
|
558
|
+
});
|
|
559
|
+
agentChatLinkTaskBodySchema = z.object({
|
|
560
|
+
eveSessionId: z.string().min(1),
|
|
561
|
+
publicTaskId: z.string().min(1),
|
|
562
|
+
toolCallId: z.string().min(1)
|
|
478
563
|
});
|
|
479
564
|
}
|
|
480
565
|
});
|
|
@@ -486,6 +571,132 @@ var init_json_schema = __esm({
|
|
|
486
571
|
}
|
|
487
572
|
});
|
|
488
573
|
|
|
574
|
+
// ../core/src/schemas/tool-result-display.ts
|
|
575
|
+
import { z as z2 } from "zod";
|
|
576
|
+
var toolDisplayMetadataSchema, toolDisplayEnvelopeSchema;
|
|
577
|
+
var init_tool_result_display = __esm({
|
|
578
|
+
"../core/src/schemas/tool-result-display.ts"() {
|
|
579
|
+
"use strict";
|
|
580
|
+
toolDisplayMetadataSchema = z2.object({
|
|
581
|
+
widget: z2.string().optional(),
|
|
582
|
+
title: z2.string().optional(),
|
|
583
|
+
description: z2.string().optional()
|
|
584
|
+
});
|
|
585
|
+
toolDisplayEnvelopeSchema = z2.object({
|
|
586
|
+
display: toolDisplayMetadataSchema.optional(),
|
|
587
|
+
data: z2.record(z2.string(), z2.unknown()),
|
|
588
|
+
ui: z2.record(
|
|
589
|
+
z2.string(),
|
|
590
|
+
z2.object({
|
|
591
|
+
"ui:widget": z2.string().optional(),
|
|
592
|
+
"ui:title": z2.string().optional(),
|
|
593
|
+
"ui:description": z2.string().optional(),
|
|
594
|
+
"ui:options": z2.record(z2.string(), z2.unknown()).optional()
|
|
595
|
+
}).passthrough()
|
|
596
|
+
).optional()
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
});
|
|
600
|
+
|
|
601
|
+
// ../core/src/schemas/agent-admin.ts
|
|
602
|
+
import { z as z3 } from "zod";
|
|
603
|
+
var tenantRoleSchema, agentAdminUserSchema, agentAdminMemberSchema, agentAdminGroupSchema, agentAdminGroupDetailSchema, agentAdminTaskSummarySchema, inviteMemberBodySchema, updateMemberRoleBodySchema, createGroupBodySchema, updateGroupBodySchema, addGroupMemberBodySchema, listTasksQuerySchema, searchTasksQuerySchema, assignTasksResultSchema, assignTasksResponseSchema, assignTasksBodySchema;
|
|
604
|
+
var init_agent_admin = __esm({
|
|
605
|
+
"../core/src/schemas/agent-admin.ts"() {
|
|
606
|
+
"use strict";
|
|
607
|
+
init_task();
|
|
608
|
+
tenantRoleSchema = z3.enum(["admin", "member"]);
|
|
609
|
+
agentAdminUserSchema = z3.object({
|
|
610
|
+
id: z3.string(),
|
|
611
|
+
email: z3.string().email(),
|
|
612
|
+
name: z3.string()
|
|
613
|
+
});
|
|
614
|
+
agentAdminMemberSchema = z3.object({
|
|
615
|
+
userId: z3.string(),
|
|
616
|
+
role: z3.string(),
|
|
617
|
+
membershipKind: z3.enum(["team", "assignee"]),
|
|
618
|
+
hasLoggedIn: z3.boolean(),
|
|
619
|
+
user: agentAdminUserSchema
|
|
620
|
+
});
|
|
621
|
+
agentAdminGroupSchema = z3.object({
|
|
622
|
+
id: z3.string(),
|
|
623
|
+
name: z3.string(),
|
|
624
|
+
slug: z3.string(),
|
|
625
|
+
description: z3.string().nullable(),
|
|
626
|
+
memberCount: z3.number().optional()
|
|
627
|
+
});
|
|
628
|
+
agentAdminGroupDetailSchema = agentAdminGroupSchema.extend({
|
|
629
|
+
members: z3.array(
|
|
630
|
+
z3.object({
|
|
631
|
+
userId: z3.string(),
|
|
632
|
+
user: agentAdminUserSchema
|
|
633
|
+
})
|
|
634
|
+
)
|
|
635
|
+
});
|
|
636
|
+
agentAdminTaskSummarySchema = z3.object({
|
|
637
|
+
id: z3.string(),
|
|
638
|
+
convexId: z3.string(),
|
|
639
|
+
status: z3.string(),
|
|
640
|
+
type: z3.string().nullable(),
|
|
641
|
+
name: z3.string().nullable(),
|
|
642
|
+
description: z3.string().nullable(),
|
|
643
|
+
validUntil: z3.number(),
|
|
644
|
+
createdAt: z3.number(),
|
|
645
|
+
threadPriority: z3.string().nullable(),
|
|
646
|
+
handledByUserId: z3.string().nullable()
|
|
647
|
+
});
|
|
648
|
+
inviteMemberBodySchema = z3.object({
|
|
649
|
+
email: z3.string().email(),
|
|
650
|
+
role: tenantRoleSchema.optional()
|
|
651
|
+
});
|
|
652
|
+
updateMemberRoleBodySchema = z3.object({
|
|
653
|
+
role: tenantRoleSchema
|
|
654
|
+
});
|
|
655
|
+
createGroupBodySchema = z3.object({
|
|
656
|
+
name: z3.string().min(1),
|
|
657
|
+
description: z3.string().optional()
|
|
658
|
+
});
|
|
659
|
+
updateGroupBodySchema = z3.object({
|
|
660
|
+
name: z3.string().min(1).optional(),
|
|
661
|
+
description: z3.string().optional()
|
|
662
|
+
});
|
|
663
|
+
addGroupMemberBodySchema = z3.object({
|
|
664
|
+
userId: z3.string().min(1).describe("Convex user id or member email.")
|
|
665
|
+
});
|
|
666
|
+
listTasksQuerySchema = z3.object({
|
|
667
|
+
statusFilter: z3.enum(["all", "open", "handled", "expired"]).optional(),
|
|
668
|
+
typeFilter: z3.string().optional(),
|
|
669
|
+
appFilter: z3.string().optional(),
|
|
670
|
+
sortField: z3.enum(["type", "date", "status", "validUntil"]).optional(),
|
|
671
|
+
sortDirection: z3.enum(["asc", "desc"]).optional(),
|
|
672
|
+
limit: z3.coerce.number().int().positive().max(100).optional(),
|
|
673
|
+
cursor: z3.string().optional()
|
|
674
|
+
});
|
|
675
|
+
searchTasksQuerySchema = z3.object({
|
|
676
|
+
q: z3.string().min(1),
|
|
677
|
+
limit: z3.coerce.number().int().positive().max(100).optional()
|
|
678
|
+
});
|
|
679
|
+
assignTasksResultSchema = z3.object({
|
|
680
|
+
taskId: z3.string(),
|
|
681
|
+
success: z3.boolean(),
|
|
682
|
+
message: z3.string().optional(),
|
|
683
|
+
name: z3.string().nullable().optional(),
|
|
684
|
+
description: z3.string().nullable().optional(),
|
|
685
|
+
type: z3.string().nullable().optional()
|
|
686
|
+
});
|
|
687
|
+
assignTasksResponseSchema = z3.object({
|
|
688
|
+
results: z3.array(assignTasksResultSchema)
|
|
689
|
+
});
|
|
690
|
+
assignTasksBodySchema = z3.object({
|
|
691
|
+
taskIds: z3.array(z3.string().min(1)).min(1).max(100),
|
|
692
|
+
assignTo: assignToSchema.refine(
|
|
693
|
+
(value) => (value.users?.length ?? 0) > 0 || (value.groups?.length ?? 0) > 0,
|
|
694
|
+
{ message: "assignTo needs at least one user email or group slug." }
|
|
695
|
+
)
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
});
|
|
699
|
+
|
|
489
700
|
// ../core/src/schemas/index.ts
|
|
490
701
|
var init_schemas = __esm({
|
|
491
702
|
"../core/src/schemas/index.ts"() {
|
|
@@ -493,11 +704,13 @@ var init_schemas = __esm({
|
|
|
493
704
|
init_task();
|
|
494
705
|
init_json_schema();
|
|
495
706
|
init_context_urls();
|
|
707
|
+
init_tool_result_display();
|
|
708
|
+
init_agent_admin();
|
|
496
709
|
}
|
|
497
710
|
});
|
|
498
711
|
|
|
499
712
|
// src/schemas/index.ts
|
|
500
|
-
import { z as
|
|
713
|
+
import { z as z4 } from "zod";
|
|
501
714
|
function normalizeTaskContextVersion2(data) {
|
|
502
715
|
const { version: legacyVersion, contextVersion, ...rest } = data;
|
|
503
716
|
return {
|
|
@@ -509,73 +722,73 @@ function refineContextPublicUrls2(data, ctx) {
|
|
|
509
722
|
const error = validateContextPublicUrls(data.context);
|
|
510
723
|
if (error) {
|
|
511
724
|
ctx.addIssue({
|
|
512
|
-
code:
|
|
725
|
+
code: z4.ZodIssueCode.custom,
|
|
513
726
|
message: error,
|
|
514
727
|
path: ["context"]
|
|
515
728
|
});
|
|
516
729
|
}
|
|
517
730
|
}
|
|
518
|
-
var
|
|
731
|
+
var handlerUrlSchema2, jsonSchema7Schema2, uiSchemaSchema2, webhookHandlerSchema2, triggerHandlerSchema2, handlerSchema2, taskActionInputSchema2, taskActionSchema2, uiFieldSchemaSchema2, contextUiSchema2, contextDataSchema2, TASK_CONTEXT_FORMAT_VERSION2, taskContextObjectBaseSchema2, taskContextObjectSchema2, taskContextSchema2, assignToSchema2, threadUpdateMessageSchema2, threadUpdateStatuses2, threadUpdateStatusSchema2, threadUpdateInputSchema2, taskPriorities2, taskPrioritySchema2, agentTelemetrySchema2, createTaskBodySchema2, threadUpdateBodySchema;
|
|
519
732
|
var init_schemas2 = __esm({
|
|
520
733
|
"src/schemas/index.ts"() {
|
|
521
734
|
"use strict";
|
|
522
735
|
init_utils();
|
|
523
736
|
init_schemas();
|
|
524
|
-
|
|
525
|
-
message:
|
|
737
|
+
handlerUrlSchema2 = z4.string().refine((url) => isAllowedHandlerUrl(url), {
|
|
738
|
+
message: HANDLER_URL_ERROR
|
|
526
739
|
});
|
|
527
|
-
jsonSchema7Schema2 =
|
|
740
|
+
jsonSchema7Schema2 = z4.custom(
|
|
528
741
|
(val) => typeof val === "object" && val !== null,
|
|
529
742
|
{ message: "Must be a valid JSON Schema object" }
|
|
530
743
|
);
|
|
531
|
-
uiSchemaSchema2 =
|
|
744
|
+
uiSchemaSchema2 = z4.custom((val) => typeof val === "object" && val !== null, {
|
|
532
745
|
message: "Must be a valid UiSchema object"
|
|
533
746
|
});
|
|
534
|
-
webhookHandlerSchema2 =
|
|
535
|
-
type:
|
|
536
|
-
url:
|
|
537
|
-
headers:
|
|
747
|
+
webhookHandlerSchema2 = z4.object({
|
|
748
|
+
type: z4.literal("webhook"),
|
|
749
|
+
url: handlerUrlSchema2,
|
|
750
|
+
headers: z4.record(z4.string(), z4.string())
|
|
538
751
|
});
|
|
539
752
|
triggerHandlerSchema2 = webhookHandlerSchema2.extend({
|
|
540
|
-
type:
|
|
541
|
-
tokenId:
|
|
753
|
+
type: z4.literal("trigger"),
|
|
754
|
+
tokenId: z4.string().min(1)
|
|
542
755
|
});
|
|
543
|
-
handlerSchema2 =
|
|
544
|
-
taskActionInputSchema2 =
|
|
545
|
-
id:
|
|
546
|
-
title:
|
|
547
|
-
description:
|
|
756
|
+
handlerSchema2 = z4.discriminatedUnion("type", [webhookHandlerSchema2, triggerHandlerSchema2]);
|
|
757
|
+
taskActionInputSchema2 = z4.object({
|
|
758
|
+
id: z4.string().min(1),
|
|
759
|
+
title: z4.string().min(1),
|
|
760
|
+
description: z4.string().optional(),
|
|
548
761
|
schema: jsonSchema7Schema2.optional(),
|
|
549
762
|
ui: uiSchemaSchema2.optional(),
|
|
550
|
-
data:
|
|
763
|
+
data: z4.record(z4.string(), z4.unknown()).optional()
|
|
551
764
|
});
|
|
552
765
|
taskActionSchema2 = taskActionInputSchema2.extend({
|
|
553
|
-
handlers:
|
|
766
|
+
handlers: z4.array(handlerSchema2).min(1).optional()
|
|
554
767
|
});
|
|
555
|
-
uiFieldSchemaSchema2 =
|
|
556
|
-
"ui:widget":
|
|
557
|
-
"ui:title":
|
|
558
|
-
"ui:description":
|
|
559
|
-
"ui:options":
|
|
560
|
-
items:
|
|
768
|
+
uiFieldSchemaSchema2 = z4.object({
|
|
769
|
+
"ui:widget": z4.string().optional(),
|
|
770
|
+
"ui:title": z4.string().optional(),
|
|
771
|
+
"ui:description": z4.string().optional(),
|
|
772
|
+
"ui:options": z4.record(z4.string(), z4.unknown()).optional(),
|
|
773
|
+
items: z4.lazy(() => z4.record(z4.string(), uiFieldSchemaSchema2)).optional()
|
|
561
774
|
}).passthrough();
|
|
562
|
-
contextUiSchema2 =
|
|
563
|
-
contextDataSchema2 =
|
|
564
|
-
data:
|
|
775
|
+
contextUiSchema2 = z4.record(z4.string(), uiFieldSchemaSchema2).optional();
|
|
776
|
+
contextDataSchema2 = z4.object({
|
|
777
|
+
data: z4.record(z4.string(), z4.unknown()),
|
|
565
778
|
ui: contextUiSchema2
|
|
566
779
|
}).optional();
|
|
567
780
|
TASK_CONTEXT_FORMAT_VERSION2 = 2;
|
|
568
|
-
taskContextObjectBaseSchema2 =
|
|
569
|
-
app:
|
|
570
|
-
type:
|
|
571
|
-
name:
|
|
572
|
-
description:
|
|
573
|
-
validUntil:
|
|
781
|
+
taskContextObjectBaseSchema2 = z4.object({
|
|
782
|
+
app: z4.string().min(1).optional(),
|
|
783
|
+
type: z4.string().min(1),
|
|
784
|
+
name: z4.string().min(1),
|
|
785
|
+
description: z4.string().optional(),
|
|
786
|
+
validUntil: z4.string().optional(),
|
|
574
787
|
context: contextDataSchema2,
|
|
575
|
-
contextVersion:
|
|
788
|
+
contextVersion: z4.literal(2).optional(),
|
|
576
789
|
/** @deprecated Use `contextVersion`. Accepted on ingest only. */
|
|
577
|
-
version:
|
|
578
|
-
actions:
|
|
790
|
+
version: z4.literal(2).optional(),
|
|
791
|
+
actions: z4.array(taskActionSchema2).min(1, "At least one action is required")
|
|
579
792
|
});
|
|
580
793
|
taskContextObjectSchema2 = taskContextObjectBaseSchema2.transform(
|
|
581
794
|
normalizeTaskContextVersion2
|
|
@@ -583,9 +796,9 @@ var init_schemas2 = __esm({
|
|
|
583
796
|
taskContextSchema2 = taskContextObjectSchema2.superRefine(
|
|
584
797
|
refineContextPublicUrls2
|
|
585
798
|
);
|
|
586
|
-
assignToSchema2 =
|
|
587
|
-
users:
|
|
588
|
-
groups:
|
|
799
|
+
assignToSchema2 = z4.object({
|
|
800
|
+
users: z4.array(z4.string().email()).optional(),
|
|
801
|
+
groups: z4.array(z4.string().min(1)).optional()
|
|
589
802
|
}).refine(
|
|
590
803
|
(data) => {
|
|
591
804
|
const groups = data.groups ?? [];
|
|
@@ -596,7 +809,7 @@ var init_schemas2 = __esm({
|
|
|
596
809
|
},
|
|
597
810
|
{ message: 'Cannot combine "all" with other group slugs' }
|
|
598
811
|
);
|
|
599
|
-
threadUpdateMessageSchema2 =
|
|
812
|
+
threadUpdateMessageSchema2 = z4.string().min(1).max(500);
|
|
600
813
|
threadUpdateStatuses2 = [
|
|
601
814
|
"info",
|
|
602
815
|
"queued",
|
|
@@ -606,15 +819,15 @@ var init_schemas2 = __esm({
|
|
|
606
819
|
"failed",
|
|
607
820
|
"cancelled"
|
|
608
821
|
];
|
|
609
|
-
threadUpdateStatusSchema2 =
|
|
610
|
-
threadUpdateInputSchema2 =
|
|
822
|
+
threadUpdateStatusSchema2 = z4.enum(threadUpdateStatuses2);
|
|
823
|
+
threadUpdateInputSchema2 = z4.object({
|
|
611
824
|
message: threadUpdateMessageSchema2,
|
|
612
825
|
status: threadUpdateStatusSchema2.optional()
|
|
613
826
|
});
|
|
614
827
|
taskPriorities2 = ["low", "normal", "high", "urgent"];
|
|
615
|
-
taskPrioritySchema2 =
|
|
616
|
-
agentTelemetrySchema2 =
|
|
617
|
-
version:
|
|
828
|
+
taskPrioritySchema2 = z4.enum(taskPriorities2);
|
|
829
|
+
agentTelemetrySchema2 = z4.object({
|
|
830
|
+
version: z4.string().min(1)
|
|
618
831
|
});
|
|
619
832
|
createTaskBodySchema2 = taskContextObjectBaseSchema2.extend({
|
|
620
833
|
assignTo: assignToSchema2.optional(),
|
|
@@ -622,7 +835,7 @@ var init_schemas2 = __esm({
|
|
|
622
835
|
* Groups related tasks together. When omitted, the server generates one and
|
|
623
836
|
* returns it so the caller can reuse it on later tasks in the same thread.
|
|
624
837
|
*/
|
|
625
|
-
threadId:
|
|
838
|
+
threadId: z4.string().min(1).optional(),
|
|
626
839
|
/**
|
|
627
840
|
* Optional thread priority. When set, applies to the whole thread and
|
|
628
841
|
* overwrites any previous priority. Omit on later tasks to leave unchanged.
|
|
@@ -639,87 +852,6 @@ var init_schemas2 = __esm({
|
|
|
639
852
|
}
|
|
640
853
|
});
|
|
641
854
|
|
|
642
|
-
// src/approval-result.ts
|
|
643
|
-
function toDiscriminatedApprovalResult(actions, task2) {
|
|
644
|
-
void actions;
|
|
645
|
-
if (!task2.handled) {
|
|
646
|
-
throw new Error("Task has no handled result");
|
|
647
|
-
}
|
|
648
|
-
return {
|
|
649
|
-
actionId: task2.handled.action.id,
|
|
650
|
-
data: task2.handled.action.data,
|
|
651
|
-
handledBy: task2.handled.handledBy,
|
|
652
|
-
handledAt: new Date(task2.handledAt ?? Date.now()),
|
|
653
|
-
taskId: task2.id
|
|
654
|
-
};
|
|
655
|
-
}
|
|
656
|
-
var TaskTimeoutError, TaskExpiredError;
|
|
657
|
-
var init_approval_result = __esm({
|
|
658
|
-
"src/approval-result.ts"() {
|
|
659
|
-
"use strict";
|
|
660
|
-
TaskTimeoutError = class extends Error {
|
|
661
|
-
constructor(message) {
|
|
662
|
-
super(message);
|
|
663
|
-
this.name = "TaskTimeoutError";
|
|
664
|
-
}
|
|
665
|
-
};
|
|
666
|
-
TaskExpiredError = class extends Error {
|
|
667
|
-
constructor(message) {
|
|
668
|
-
super(message);
|
|
669
|
-
this.name = "TaskExpiredError";
|
|
670
|
-
}
|
|
671
|
-
};
|
|
672
|
-
}
|
|
673
|
-
});
|
|
674
|
-
|
|
675
|
-
// src/http.ts
|
|
676
|
-
async function parseResponseBody(response) {
|
|
677
|
-
const contentType = response.headers.get("content-type") ?? "";
|
|
678
|
-
const bodyText = await response.text();
|
|
679
|
-
if (!bodyText) {
|
|
680
|
-
return null;
|
|
681
|
-
}
|
|
682
|
-
if (contentType.toLowerCase().includes("application/json")) {
|
|
683
|
-
try {
|
|
684
|
-
return JSON.parse(bodyText);
|
|
685
|
-
} catch {
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
try {
|
|
689
|
-
return JSON.parse(bodyText);
|
|
690
|
-
} catch {
|
|
691
|
-
return bodyText;
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
function getErrorMessage(data, fallback) {
|
|
695
|
-
if (data && typeof data === "object" && !Array.isArray(data)) {
|
|
696
|
-
const maybeMessage = data.message;
|
|
697
|
-
if (typeof maybeMessage === "string" && maybeMessage.trim()) {
|
|
698
|
-
return maybeMessage;
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
if (typeof data === "string" && data.trim()) {
|
|
702
|
-
const compact = data.replace(/\s+/g, " ").trim();
|
|
703
|
-
const snippet = compact.length > 180 ? `${compact.slice(0, 180)}...` : compact;
|
|
704
|
-
return `${fallback}. Server returned non-JSON response: ${snippet}`;
|
|
705
|
-
}
|
|
706
|
-
return fallback;
|
|
707
|
-
}
|
|
708
|
-
var RobotRockError;
|
|
709
|
-
var init_http = __esm({
|
|
710
|
-
"src/http.ts"() {
|
|
711
|
-
"use strict";
|
|
712
|
-
RobotRockError = class extends Error {
|
|
713
|
-
constructor(message, statusCode, response) {
|
|
714
|
-
super(message);
|
|
715
|
-
this.statusCode = statusCode;
|
|
716
|
-
this.response = response;
|
|
717
|
-
this.name = "RobotRockError";
|
|
718
|
-
}
|
|
719
|
-
};
|
|
720
|
-
}
|
|
721
|
-
});
|
|
722
|
-
|
|
723
855
|
// ../core/src/types/task.ts
|
|
724
856
|
var init_task2 = __esm({
|
|
725
857
|
"../core/src/types/task.ts"() {
|
|
@@ -790,17 +922,36 @@ var init_welcome_task = __esm({
|
|
|
790
922
|
});
|
|
791
923
|
|
|
792
924
|
// ../core/src/app-url.ts
|
|
793
|
-
|
|
925
|
+
function normalizeRobotRockApiBaseUrl(baseUrl) {
|
|
926
|
+
const trimmed = baseUrl.trim().replace(/\/+$/, "");
|
|
927
|
+
if (trimmed.endsWith("/v1")) {
|
|
928
|
+
return trimmed;
|
|
929
|
+
}
|
|
930
|
+
return `${trimmed}/v1`;
|
|
931
|
+
}
|
|
932
|
+
function getRobotRockApiBaseUrl() {
|
|
933
|
+
const explicit = process.env.ROBOTROCK_BASE_URL?.trim() || process.env.ROBOTROCK_API_URL?.trim();
|
|
934
|
+
if (explicit) {
|
|
935
|
+
return normalizeRobotRockApiBaseUrl(explicit);
|
|
936
|
+
}
|
|
937
|
+
if (process.env.NODE_ENV === "production") {
|
|
938
|
+
return PRODUCTION_API_URL;
|
|
939
|
+
}
|
|
940
|
+
return DEV_API_URL;
|
|
941
|
+
}
|
|
942
|
+
var PRODUCTION_APP_URL, PRODUCTION_API_URL, DEV_API_URL, APP_SIGNUP_URL;
|
|
794
943
|
var init_app_url = __esm({
|
|
795
944
|
"../core/src/app-url.ts"() {
|
|
796
945
|
"use strict";
|
|
797
946
|
PRODUCTION_APP_URL = "https://app.robotrock.io";
|
|
947
|
+
PRODUCTION_API_URL = "https://api.robotrock.io/v1";
|
|
948
|
+
DEV_API_URL = "http://localhost:4001/v1";
|
|
798
949
|
APP_SIGNUP_URL = `${PRODUCTION_APP_URL}/sign-up`;
|
|
799
950
|
}
|
|
800
951
|
});
|
|
801
952
|
|
|
802
953
|
// ../core/src/attribution/index.ts
|
|
803
|
-
import { z as
|
|
954
|
+
import { z as z5 } from "zod";
|
|
804
955
|
var ATTRIBUTION_COOKIE_MAX_AGE, attributionSchema;
|
|
805
956
|
var init_attribution = __esm({
|
|
806
957
|
"../core/src/attribution/index.ts"() {
|
|
@@ -808,20 +959,27 @@ var init_attribution = __esm({
|
|
|
808
959
|
init_app_url();
|
|
809
960
|
init_app_url();
|
|
810
961
|
ATTRIBUTION_COOKIE_MAX_AGE = 60 * 60 * 24 * 90;
|
|
811
|
-
attributionSchema =
|
|
812
|
-
utmSource:
|
|
813
|
-
utmMedium:
|
|
814
|
-
utmCampaign:
|
|
815
|
-
utmContent:
|
|
816
|
-
utmTerm:
|
|
817
|
-
gclid:
|
|
818
|
-
landingUrl:
|
|
819
|
-
referrer:
|
|
820
|
-
capturedAt:
|
|
962
|
+
attributionSchema = z5.object({
|
|
963
|
+
utmSource: z5.string().optional(),
|
|
964
|
+
utmMedium: z5.string().optional(),
|
|
965
|
+
utmCampaign: z5.string().optional(),
|
|
966
|
+
utmContent: z5.string().optional(),
|
|
967
|
+
utmTerm: z5.string().optional(),
|
|
968
|
+
gclid: z5.string().optional(),
|
|
969
|
+
landingUrl: z5.string().optional(),
|
|
970
|
+
referrer: z5.string().optional(),
|
|
971
|
+
capturedAt: z5.number()
|
|
821
972
|
});
|
|
822
973
|
}
|
|
823
974
|
});
|
|
824
975
|
|
|
976
|
+
// ../core/src/agent-service-auth.ts
|
|
977
|
+
var init_agent_service_auth = __esm({
|
|
978
|
+
"../core/src/agent-service-auth.ts"() {
|
|
979
|
+
"use strict";
|
|
980
|
+
}
|
|
981
|
+
});
|
|
982
|
+
|
|
825
983
|
// ../core/src/index.ts
|
|
826
984
|
var init_src = __esm({
|
|
827
985
|
"../core/src/index.ts"() {
|
|
@@ -835,6 +993,137 @@ var init_src = __esm({
|
|
|
835
993
|
init_welcome_task();
|
|
836
994
|
init_attribution();
|
|
837
995
|
init_app_url();
|
|
996
|
+
init_agent_service_auth();
|
|
997
|
+
}
|
|
998
|
+
});
|
|
999
|
+
|
|
1000
|
+
// src/approval-result.ts
|
|
1001
|
+
function toDiscriminatedApprovalResult(actions, task2) {
|
|
1002
|
+
void actions;
|
|
1003
|
+
if (!task2.handled) {
|
|
1004
|
+
throw new Error("Task has no handled result");
|
|
1005
|
+
}
|
|
1006
|
+
return {
|
|
1007
|
+
actionId: task2.handled.action.id,
|
|
1008
|
+
data: task2.handled.action.data,
|
|
1009
|
+
handledBy: task2.handled.handledBy,
|
|
1010
|
+
handledAt: new Date(task2.handledAt ?? Date.now()),
|
|
1011
|
+
taskId: task2.id
|
|
1012
|
+
};
|
|
1013
|
+
}
|
|
1014
|
+
var TaskTimeoutError, TaskExpiredError;
|
|
1015
|
+
var init_approval_result = __esm({
|
|
1016
|
+
"src/approval-result.ts"() {
|
|
1017
|
+
"use strict";
|
|
1018
|
+
TaskTimeoutError = class extends Error {
|
|
1019
|
+
constructor(message) {
|
|
1020
|
+
super(message);
|
|
1021
|
+
this.name = "TaskTimeoutError";
|
|
1022
|
+
}
|
|
1023
|
+
};
|
|
1024
|
+
TaskExpiredError = class extends Error {
|
|
1025
|
+
constructor(message) {
|
|
1026
|
+
super(message);
|
|
1027
|
+
this.name = "TaskExpiredError";
|
|
1028
|
+
}
|
|
1029
|
+
};
|
|
1030
|
+
}
|
|
1031
|
+
});
|
|
1032
|
+
|
|
1033
|
+
// src/http.ts
|
|
1034
|
+
async function parseResponseBody(response) {
|
|
1035
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
1036
|
+
const bodyText = await response.text();
|
|
1037
|
+
if (!bodyText) {
|
|
1038
|
+
return null;
|
|
1039
|
+
}
|
|
1040
|
+
if (contentType.toLowerCase().includes("application/json")) {
|
|
1041
|
+
try {
|
|
1042
|
+
return JSON.parse(bodyText);
|
|
1043
|
+
} catch {
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
try {
|
|
1047
|
+
return JSON.parse(bodyText);
|
|
1048
|
+
} catch {
|
|
1049
|
+
return bodyText;
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
function getErrorMessage(data, fallback) {
|
|
1053
|
+
if (data && typeof data === "object" && !Array.isArray(data)) {
|
|
1054
|
+
const record = data;
|
|
1055
|
+
const maybeMessage = record.message;
|
|
1056
|
+
const maybeHint = record.hint;
|
|
1057
|
+
if (typeof maybeMessage === "string" && maybeMessage.trim()) {
|
|
1058
|
+
if (typeof maybeHint === "string" && maybeHint.trim()) {
|
|
1059
|
+
return `${maybeMessage.trim()} ${maybeHint.trim()}`;
|
|
1060
|
+
}
|
|
1061
|
+
return maybeMessage;
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
if (typeof data === "string" && data.trim()) {
|
|
1065
|
+
const compact = data.replace(/\s+/g, " ").trim();
|
|
1066
|
+
const snippet = compact.length > 180 ? `${compact.slice(0, 180)}...` : compact;
|
|
1067
|
+
return `${fallback}. Server returned non-JSON response: ${snippet}`;
|
|
1068
|
+
}
|
|
1069
|
+
return fallback;
|
|
1070
|
+
}
|
|
1071
|
+
var RobotRockError;
|
|
1072
|
+
var init_http = __esm({
|
|
1073
|
+
"src/http.ts"() {
|
|
1074
|
+
"use strict";
|
|
1075
|
+
RobotRockError = class extends Error {
|
|
1076
|
+
constructor(message, statusCode, response) {
|
|
1077
|
+
super(message);
|
|
1078
|
+
this.statusCode = statusCode;
|
|
1079
|
+
this.response = response;
|
|
1080
|
+
this.name = "RobotRockError";
|
|
1081
|
+
}
|
|
1082
|
+
};
|
|
1083
|
+
}
|
|
1084
|
+
});
|
|
1085
|
+
|
|
1086
|
+
// src/auth-headers.ts
|
|
1087
|
+
function buildRobotRockAuthHeaders(auth) {
|
|
1088
|
+
if (auth.kind === "apiKey") {
|
|
1089
|
+
const headers2 = {
|
|
1090
|
+
"X-Api-Key": auth.apiKey
|
|
1091
|
+
};
|
|
1092
|
+
if (auth.actingUserId?.trim()) {
|
|
1093
|
+
headers2[ROBOTROCK_ACTING_USER_ID_HEADER] = auth.actingUserId.trim();
|
|
1094
|
+
}
|
|
1095
|
+
return headers2;
|
|
1096
|
+
}
|
|
1097
|
+
const headers = {
|
|
1098
|
+
Authorization: `Bearer ${auth.token}`,
|
|
1099
|
+
"X-RobotRock-Tenant-Slug": auth.tenantSlug,
|
|
1100
|
+
"X-RobotRock-Connection-Id": auth.connectionId
|
|
1101
|
+
};
|
|
1102
|
+
if (auth.actingUserId?.trim()) {
|
|
1103
|
+
headers[ROBOTROCK_ACTING_USER_ID_HEADER] = auth.actingUserId.trim();
|
|
1104
|
+
}
|
|
1105
|
+
return headers;
|
|
1106
|
+
}
|
|
1107
|
+
function resolveRobotRockAuthConfig(overrides) {
|
|
1108
|
+
if (overrides?.agentService) {
|
|
1109
|
+
return {
|
|
1110
|
+
kind: "agentService",
|
|
1111
|
+
...overrides.agentService
|
|
1112
|
+
};
|
|
1113
|
+
}
|
|
1114
|
+
const apiKey = overrides?.apiKey ?? process.env.ROBOTROCK_API_KEY;
|
|
1115
|
+
if (!apiKey) {
|
|
1116
|
+
throw new Error(
|
|
1117
|
+
"RobotRock auth is required. Set ROBOTROCK_API_KEY, ROBOTROCK_AGENT_SERVICE_TOKEN with tenant context, or pass auth when creating the client."
|
|
1118
|
+
);
|
|
1119
|
+
}
|
|
1120
|
+
return { kind: "apiKey", apiKey };
|
|
1121
|
+
}
|
|
1122
|
+
var ROBOTROCK_ACTING_USER_ID_HEADER;
|
|
1123
|
+
var init_auth_headers = __esm({
|
|
1124
|
+
"src/auth-headers.ts"() {
|
|
1125
|
+
"use strict";
|
|
1126
|
+
ROBOTROCK_ACTING_USER_ID_HEADER = "x-robotrock-acting-user-id";
|
|
838
1127
|
}
|
|
839
1128
|
});
|
|
840
1129
|
|
|
@@ -842,7 +1131,7 @@ var init_src = __esm({
|
|
|
842
1131
|
function createChatsApi(config) {
|
|
843
1132
|
const headers = () => ({
|
|
844
1133
|
"Content-Type": "application/json",
|
|
845
|
-
|
|
1134
|
+
...buildRobotRockAuthHeaders(config.auth)
|
|
846
1135
|
});
|
|
847
1136
|
return {
|
|
848
1137
|
async create(input) {
|
|
@@ -895,6 +1184,120 @@ function createChatsApi(config) {
|
|
|
895
1184
|
data
|
|
896
1185
|
);
|
|
897
1186
|
}
|
|
1187
|
+
},
|
|
1188
|
+
async stageHitlRequests(input) {
|
|
1189
|
+
const validation = agentChatStageHitlBodySchema.safeParse(input);
|
|
1190
|
+
if (!validation.success) {
|
|
1191
|
+
throw new RobotRockError(
|
|
1192
|
+
`Invalid stage HITL input: ${validation.error.issues[0]?.message}`,
|
|
1193
|
+
400,
|
|
1194
|
+
validation.error.issues
|
|
1195
|
+
);
|
|
1196
|
+
}
|
|
1197
|
+
const response = await fetch(`${config.baseUrl}/agent-chats/stage-hitl`, {
|
|
1198
|
+
method: "POST",
|
|
1199
|
+
headers: headers(),
|
|
1200
|
+
body: JSON.stringify(validation.data)
|
|
1201
|
+
});
|
|
1202
|
+
if (!response.ok) {
|
|
1203
|
+
const data = await parseResponseBody(response);
|
|
1204
|
+
throw new RobotRockError(
|
|
1205
|
+
getErrorMessage(data, "Failed to stage chat HITL requests"),
|
|
1206
|
+
response.status,
|
|
1207
|
+
data
|
|
1208
|
+
);
|
|
1209
|
+
}
|
|
1210
|
+
},
|
|
1211
|
+
async getStagedHitlRequests(eveSessionId) {
|
|
1212
|
+
const trimmed = eveSessionId.trim();
|
|
1213
|
+
if (!trimmed) {
|
|
1214
|
+
throw new RobotRockError("eveSessionId is required", 400);
|
|
1215
|
+
}
|
|
1216
|
+
const url = new URL(`${config.baseUrl}/agent-chats/staged-hitl`);
|
|
1217
|
+
url.searchParams.set("eveSessionId", trimmed);
|
|
1218
|
+
const response = await fetch(url.toString(), {
|
|
1219
|
+
method: "GET",
|
|
1220
|
+
headers: headers()
|
|
1221
|
+
});
|
|
1222
|
+
const data = await parseResponseBody(response);
|
|
1223
|
+
if (!response.ok) {
|
|
1224
|
+
throw new RobotRockError(
|
|
1225
|
+
getErrorMessage(data, "Failed to fetch staged chat HITL requests"),
|
|
1226
|
+
response.status,
|
|
1227
|
+
data
|
|
1228
|
+
);
|
|
1229
|
+
}
|
|
1230
|
+
const requests = data.requests;
|
|
1231
|
+
return Array.isArray(requests) ? requests : [];
|
|
1232
|
+
},
|
|
1233
|
+
async logInputSubmission(input) {
|
|
1234
|
+
const validation = agentChatAuditInputBodySchema.safeParse(input);
|
|
1235
|
+
if (!validation.success) {
|
|
1236
|
+
throw new RobotRockError(
|
|
1237
|
+
`Invalid audit input: ${validation.error.issues[0]?.message}`,
|
|
1238
|
+
400,
|
|
1239
|
+
validation.error.issues
|
|
1240
|
+
);
|
|
1241
|
+
}
|
|
1242
|
+
const response = await fetch(`${config.baseUrl}/agent-chats/audit-input`, {
|
|
1243
|
+
method: "POST",
|
|
1244
|
+
headers: headers(),
|
|
1245
|
+
body: JSON.stringify(validation.data)
|
|
1246
|
+
});
|
|
1247
|
+
if (!response.ok) {
|
|
1248
|
+
const data = await parseResponseBody(response);
|
|
1249
|
+
throw new RobotRockError(
|
|
1250
|
+
getErrorMessage(data, "Failed to log chat input submission"),
|
|
1251
|
+
response.status,
|
|
1252
|
+
data
|
|
1253
|
+
);
|
|
1254
|
+
}
|
|
1255
|
+
},
|
|
1256
|
+
async logToolExecution(input) {
|
|
1257
|
+
const validation = agentChatAuditToolBodySchema.safeParse(input);
|
|
1258
|
+
if (!validation.success) {
|
|
1259
|
+
throw new RobotRockError(
|
|
1260
|
+
`Invalid audit tool input: ${validation.error.issues[0]?.message}`,
|
|
1261
|
+
400,
|
|
1262
|
+
validation.error.issues
|
|
1263
|
+
);
|
|
1264
|
+
}
|
|
1265
|
+
const response = await fetch(`${config.baseUrl}/agent-chats/audit-tool`, {
|
|
1266
|
+
method: "POST",
|
|
1267
|
+
headers: headers(),
|
|
1268
|
+
body: JSON.stringify(validation.data)
|
|
1269
|
+
});
|
|
1270
|
+
if (!response.ok) {
|
|
1271
|
+
const data = await parseResponseBody(response);
|
|
1272
|
+
throw new RobotRockError(
|
|
1273
|
+
getErrorMessage(data, "Failed to log chat tool execution"),
|
|
1274
|
+
response.status,
|
|
1275
|
+
data
|
|
1276
|
+
);
|
|
1277
|
+
}
|
|
1278
|
+
},
|
|
1279
|
+
async linkTask(input) {
|
|
1280
|
+
const validation = agentChatLinkTaskBodySchema.safeParse(input);
|
|
1281
|
+
if (!validation.success) {
|
|
1282
|
+
throw new RobotRockError(
|
|
1283
|
+
`Invalid link task input: ${validation.error.issues[0]?.message}`,
|
|
1284
|
+
400,
|
|
1285
|
+
validation.error.issues
|
|
1286
|
+
);
|
|
1287
|
+
}
|
|
1288
|
+
const response = await fetch(`${config.baseUrl}/agent-chats/link-task`, {
|
|
1289
|
+
method: "POST",
|
|
1290
|
+
headers: headers(),
|
|
1291
|
+
body: JSON.stringify(validation.data)
|
|
1292
|
+
});
|
|
1293
|
+
if (!response.ok) {
|
|
1294
|
+
const data = await parseResponseBody(response);
|
|
1295
|
+
throw new RobotRockError(
|
|
1296
|
+
getErrorMessage(data, "Failed to link inbox task to chat"),
|
|
1297
|
+
response.status,
|
|
1298
|
+
data
|
|
1299
|
+
);
|
|
1300
|
+
}
|
|
898
1301
|
}
|
|
899
1302
|
};
|
|
900
1303
|
}
|
|
@@ -903,6 +1306,7 @@ var init_chats = __esm({
|
|
|
903
1306
|
"use strict";
|
|
904
1307
|
init_src();
|
|
905
1308
|
init_http();
|
|
1309
|
+
init_auth_headers();
|
|
906
1310
|
}
|
|
907
1311
|
});
|
|
908
1312
|
|
|
@@ -988,14 +1392,17 @@ var init_client = __esm({
|
|
|
988
1392
|
"src/client.ts"() {
|
|
989
1393
|
"use strict";
|
|
990
1394
|
init_schemas2();
|
|
1395
|
+
init_src();
|
|
991
1396
|
init_approval_result();
|
|
992
1397
|
init_http();
|
|
1398
|
+
init_src();
|
|
993
1399
|
init_chats();
|
|
1400
|
+
init_auth_headers();
|
|
994
1401
|
init_http();
|
|
995
1402
|
DEFAULT_POLL_INTERVAL_MS = 2e3;
|
|
996
1403
|
DEFAULT_TIMEOUT_MS = 24 * 60 * 60 * 1e3;
|
|
997
1404
|
RobotRock = class {
|
|
998
|
-
|
|
1405
|
+
auth;
|
|
999
1406
|
baseUrl;
|
|
1000
1407
|
app;
|
|
1001
1408
|
agentVersion;
|
|
@@ -1013,14 +1420,17 @@ var init_client = __esm({
|
|
|
1013
1420
|
);
|
|
1014
1421
|
}
|
|
1015
1422
|
const apiKey = config.apiKey ?? process.env.ROBOTROCK_API_KEY;
|
|
1016
|
-
|
|
1423
|
+
const agentService = config.agentService;
|
|
1424
|
+
if (apiKey && agentService) {
|
|
1017
1425
|
throw new Error(
|
|
1018
|
-
"RobotRock
|
|
1426
|
+
"RobotRock client cannot configure both apiKey and agentService."
|
|
1019
1427
|
);
|
|
1020
1428
|
}
|
|
1021
|
-
this.
|
|
1022
|
-
|
|
1023
|
-
|
|
1429
|
+
this.auth = resolveRobotRockAuthConfig({
|
|
1430
|
+
...apiKey ? { apiKey } : {},
|
|
1431
|
+
...agentService ? { agentService } : {}
|
|
1432
|
+
});
|
|
1433
|
+
this.baseUrl = config.baseUrl ?? getRobotRockApiBaseUrl();
|
|
1024
1434
|
this.app = config.app;
|
|
1025
1435
|
this.agentVersion = config.version ?? resolveAgentVersionFromEnv();
|
|
1026
1436
|
this.contextVersion = config.advanced?.contextVersion ?? TASK_CONTEXT_FORMAT_VERSION2;
|
|
@@ -1030,14 +1440,23 @@ var init_client = __esm({
|
|
|
1030
1440
|
create: (task2) => this.createTaskRequest(task2),
|
|
1031
1441
|
get: (taskId) => this.getTaskById(taskId),
|
|
1032
1442
|
cancel: (taskId) => this.cancelTaskRequest(taskId),
|
|
1033
|
-
sendUpdate: (input) => this.sendThreadUpdate(input)
|
|
1443
|
+
sendUpdate: (input) => this.sendThreadUpdate(input),
|
|
1444
|
+
list: (input) => this.listTasksRequest(input),
|
|
1445
|
+
search: (input) => this.searchTasksRequest(input)
|
|
1034
1446
|
};
|
|
1035
1447
|
this.chats = createChatsApi({
|
|
1036
1448
|
baseUrl: this.baseUrl,
|
|
1037
|
-
|
|
1449
|
+
auth: this.auth,
|
|
1038
1450
|
app: this.app
|
|
1039
1451
|
});
|
|
1040
1452
|
}
|
|
1453
|
+
authHeaders(extra) {
|
|
1454
|
+
return {
|
|
1455
|
+
"Content-Type": "application/json",
|
|
1456
|
+
...buildRobotRockAuthHeaders(this.auth),
|
|
1457
|
+
...extra
|
|
1458
|
+
};
|
|
1459
|
+
}
|
|
1041
1460
|
async createTaskRequest(task2) {
|
|
1042
1461
|
const normalizedTask = normalizeSendToHumanInput(task2, {
|
|
1043
1462
|
webhook: this.webhook,
|
|
@@ -1062,13 +1481,9 @@ var init_client = __esm({
|
|
|
1062
1481
|
validation.error.issues
|
|
1063
1482
|
);
|
|
1064
1483
|
}
|
|
1065
|
-
const headers =
|
|
1066
|
-
"
|
|
1067
|
-
|
|
1068
|
-
};
|
|
1069
|
-
if (task2.idempotencyKey) {
|
|
1070
|
-
headers["Idempotency-Key"] = task2.idempotencyKey;
|
|
1071
|
-
}
|
|
1484
|
+
const headers = this.authHeaders(
|
|
1485
|
+
task2.idempotencyKey ? { "Idempotency-Key": task2.idempotencyKey } : void 0
|
|
1486
|
+
);
|
|
1072
1487
|
const response = await fetch(`${this.baseUrl}/`, {
|
|
1073
1488
|
method: "POST",
|
|
1074
1489
|
headers,
|
|
@@ -1161,9 +1576,7 @@ var init_client = __esm({
|
|
|
1161
1576
|
async getTaskById(taskId) {
|
|
1162
1577
|
const response = await fetch(`${this.baseUrl}/tasks/${taskId}`, {
|
|
1163
1578
|
method: "GET",
|
|
1164
|
-
headers:
|
|
1165
|
-
"X-Api-Key": this.apiKey
|
|
1166
|
-
}
|
|
1579
|
+
headers: this.authHeaders()
|
|
1167
1580
|
});
|
|
1168
1581
|
if (response.status === 404) {
|
|
1169
1582
|
return null;
|
|
@@ -1198,10 +1611,7 @@ var init_client = __esm({
|
|
|
1198
1611
|
`${this.baseUrl}/threads/${encodeURIComponent(threadId)}/updates`,
|
|
1199
1612
|
{
|
|
1200
1613
|
method: "POST",
|
|
1201
|
-
headers:
|
|
1202
|
-
"Content-Type": "application/json",
|
|
1203
|
-
"X-Api-Key": this.apiKey
|
|
1204
|
-
},
|
|
1614
|
+
headers: this.authHeaders(),
|
|
1205
1615
|
body: JSON.stringify(validation.data)
|
|
1206
1616
|
}
|
|
1207
1617
|
);
|
|
@@ -1218,9 +1628,7 @@ var init_client = __esm({
|
|
|
1218
1628
|
async cancelTaskRequest(taskId) {
|
|
1219
1629
|
const response = await fetch(`${this.baseUrl}/tasks/${taskId}/cancel`, {
|
|
1220
1630
|
method: "POST",
|
|
1221
|
-
headers:
|
|
1222
|
-
"X-Api-Key": this.apiKey
|
|
1223
|
-
}
|
|
1631
|
+
headers: this.authHeaders()
|
|
1224
1632
|
});
|
|
1225
1633
|
if (!response.ok) {
|
|
1226
1634
|
const data = await parseResponseBody(response);
|
|
@@ -1231,28 +1639,77 @@ var init_client = __esm({
|
|
|
1231
1639
|
);
|
|
1232
1640
|
}
|
|
1233
1641
|
}
|
|
1642
|
+
async listTasksRequest(input) {
|
|
1643
|
+
const params = new URLSearchParams();
|
|
1644
|
+
for (const [key, value] of Object.entries(input ?? {})) {
|
|
1645
|
+
if (value !== void 0 && value !== "") {
|
|
1646
|
+
params.set(key, String(value));
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
const suffix = params.size > 0 ? `?${params.toString()}` : "";
|
|
1650
|
+
const response = await fetch(`${this.baseUrl}/tasks${suffix}`, {
|
|
1651
|
+
method: "GET",
|
|
1652
|
+
headers: this.authHeaders()
|
|
1653
|
+
});
|
|
1654
|
+
const data = await parseResponseBody(response);
|
|
1655
|
+
if (!response.ok) {
|
|
1656
|
+
throw new RobotRockError(
|
|
1657
|
+
getErrorMessage(data, "Failed to list tasks"),
|
|
1658
|
+
response.status,
|
|
1659
|
+
data
|
|
1660
|
+
);
|
|
1661
|
+
}
|
|
1662
|
+
return data;
|
|
1663
|
+
}
|
|
1664
|
+
async searchTasksRequest(input) {
|
|
1665
|
+
const params = new URLSearchParams({ q: input.q });
|
|
1666
|
+
if (input.limit !== void 0) {
|
|
1667
|
+
params.set("limit", String(input.limit));
|
|
1668
|
+
}
|
|
1669
|
+
const response = await fetch(`${this.baseUrl}/tasks/search?${params.toString()}`, {
|
|
1670
|
+
method: "GET",
|
|
1671
|
+
headers: this.authHeaders()
|
|
1672
|
+
});
|
|
1673
|
+
const data = await parseResponseBody(response);
|
|
1674
|
+
if (!response.ok) {
|
|
1675
|
+
throw new RobotRockError(
|
|
1676
|
+
getErrorMessage(data, "Failed to search tasks"),
|
|
1677
|
+
response.status,
|
|
1678
|
+
data
|
|
1679
|
+
);
|
|
1680
|
+
}
|
|
1681
|
+
return data;
|
|
1682
|
+
}
|
|
1234
1683
|
};
|
|
1235
1684
|
}
|
|
1236
1685
|
});
|
|
1237
1686
|
|
|
1238
1687
|
// src/env.ts
|
|
1239
1688
|
function resolveRobotRockConfig(overrides) {
|
|
1689
|
+
const agentService = overrides?.agentService;
|
|
1240
1690
|
const apiKey = overrides?.apiKey ?? process.env.ROBOTROCK_API_KEY;
|
|
1241
|
-
if (
|
|
1691
|
+
if (agentService && apiKey) {
|
|
1242
1692
|
throw new Error(
|
|
1243
|
-
"RobotRock
|
|
1693
|
+
"RobotRock client cannot configure both apiKey and agentService."
|
|
1244
1694
|
);
|
|
1245
1695
|
}
|
|
1246
|
-
const baseUrl = overrides?.baseUrl ??
|
|
1696
|
+
const baseUrl = overrides?.baseUrl ?? getRobotRockApiBaseUrl();
|
|
1247
1697
|
const app = overrides?.app ?? process.env.ROBOTROCK_APP;
|
|
1698
|
+
if (agentService) {
|
|
1699
|
+
return app ? { agentService, baseUrl, app } : { agentService, baseUrl };
|
|
1700
|
+
}
|
|
1701
|
+
if (!apiKey) {
|
|
1702
|
+
throw new Error(
|
|
1703
|
+
"RobotRock API key is required. Set ROBOTROCK_API_KEY or pass agentService when creating the client."
|
|
1704
|
+
);
|
|
1705
|
+
}
|
|
1248
1706
|
return app ? { apiKey, baseUrl, app } : { apiKey, baseUrl };
|
|
1249
1707
|
}
|
|
1250
|
-
var DEFAULT_BASE_URL;
|
|
1251
1708
|
var init_env = __esm({
|
|
1252
1709
|
"src/env.ts"() {
|
|
1253
1710
|
"use strict";
|
|
1254
1711
|
init_client();
|
|
1255
|
-
|
|
1712
|
+
init_src();
|
|
1256
1713
|
}
|
|
1257
1714
|
});
|
|
1258
1715
|
|
|
@@ -1781,7 +2238,7 @@ var init_workflow = __esm({
|
|
|
1781
2238
|
});
|
|
1782
2239
|
|
|
1783
2240
|
// src/ai/approve-by-human-tool-core.ts
|
|
1784
|
-
import { z as
|
|
2241
|
+
import { z as z6 } from "zod";
|
|
1785
2242
|
|
|
1786
2243
|
// src/ai/context.ts
|
|
1787
2244
|
init_client();
|
|
@@ -1918,11 +2375,11 @@ function toHumanToolResult(result) {
|
|
|
1918
2375
|
}
|
|
1919
2376
|
|
|
1920
2377
|
// src/ai/approve-by-human-tool-core.ts
|
|
1921
|
-
var approveByHumanInputSchema =
|
|
1922
|
-
type:
|
|
1923
|
-
name:
|
|
1924
|
-
description:
|
|
1925
|
-
contextSummary:
|
|
2378
|
+
var approveByHumanInputSchema = z6.object({
|
|
2379
|
+
type: z6.string().optional().describe("Task type slug; defaults to ai-approval"),
|
|
2380
|
+
name: z6.string().describe("Short title for the approval request"),
|
|
2381
|
+
description: z6.string().describe("What needs approval and the consequences of approving or declining"),
|
|
2382
|
+
contextSummary: z6.string().optional().describe("Optional markdown summary shown to the reviewer")
|
|
1926
2383
|
});
|
|
1927
2384
|
function resolveApproveByHumanToolConfig(clientOrContext, maybeOptions = {}) {
|
|
1928
2385
|
const isDurable = typeof clientOrContext === "object" && clientOrContext !== null && "mode" in clientOrContext && (clientOrContext.mode === "trigger" || clientOrContext.mode === "workflow");
|
|
@@ -1964,16 +2421,16 @@ function buildApproveByHumanToolDefinition(clientOrContext, maybeOptions = {}) {
|
|
|
1964
2421
|
|
|
1965
2422
|
// src/ai/create-send-to-human-tool-core.ts
|
|
1966
2423
|
init_schemas2();
|
|
1967
|
-
import { z as
|
|
1968
|
-
var sendToHumanToolInputSchema =
|
|
1969
|
-
type:
|
|
1970
|
-
name:
|
|
1971
|
-
description:
|
|
1972
|
-
context:
|
|
1973
|
-
data:
|
|
1974
|
-
ui:
|
|
2424
|
+
import { z as z7 } from "zod";
|
|
2425
|
+
var sendToHumanToolInputSchema = z7.object({
|
|
2426
|
+
type: z7.string().describe("Task type slug shown in the RobotRock inbox"),
|
|
2427
|
+
name: z7.string().describe("Short title for the human reviewer"),
|
|
2428
|
+
description: z7.string().optional().describe("What you need from the human and why you cannot proceed alone"),
|
|
2429
|
+
context: z7.object({
|
|
2430
|
+
data: z7.record(z7.string(), z7.unknown()).optional(),
|
|
2431
|
+
ui: z7.record(z7.string(), z7.unknown()).optional()
|
|
1975
2432
|
}).optional().describe("Optional structured context for the inbox UI"),
|
|
1976
|
-
validUntil:
|
|
2433
|
+
validUntil: z7.string().datetime().optional().describe("Optional ISO deadline for the task"),
|
|
1977
2434
|
assignTo: assignToSchema2.optional().describe(
|
|
1978
2435
|
"Assign to tenant member emails and/or group slugs; narrows who sees the task in the inbox"
|
|
1979
2436
|
)
|
|
@@ -2019,12 +2476,12 @@ function buildSendToHumanToolDefinition(clientOrOptions, maybeOptions) {
|
|
|
2019
2476
|
// src/ai/create-send-update-tool-core.ts
|
|
2020
2477
|
init_schemas2();
|
|
2021
2478
|
init_client();
|
|
2022
|
-
import { z as
|
|
2023
|
-
var sendUpdateToolInputSchema =
|
|
2024
|
-
threadId:
|
|
2479
|
+
import { z as z8 } from "zod";
|
|
2480
|
+
var sendUpdateToolInputSchema = z8.object({
|
|
2481
|
+
threadId: z8.string().optional().describe(
|
|
2025
2482
|
"Thread to post the update to. Use the `threadId` returned by a prior send-to-human task. Omit only when a session threadId is configured on the tool."
|
|
2026
2483
|
),
|
|
2027
|
-
message:
|
|
2484
|
+
message: z8.string().describe("Short progress update (1-2 sentences) shown in the inbox status bar"),
|
|
2028
2485
|
status: threadUpdateStatusSchema2.optional().describe(
|
|
2029
2486
|
"Lifecycle status driving the status-bar icon/color: info, queued, running, waiting, succeeded, failed, cancelled"
|
|
2030
2487
|
)
|
|
@@ -2076,25 +2533,25 @@ function buildSendUpdateToolDefinition(clientOrOptions, maybeOptions = {}) {
|
|
|
2076
2533
|
}
|
|
2077
2534
|
|
|
2078
2535
|
// src/ai/request-action-input-tool-core.ts
|
|
2079
|
-
import { z as
|
|
2080
|
-
var requestActionInputActionSchema =
|
|
2081
|
-
id:
|
|
2536
|
+
import { z as z9 } from "zod";
|
|
2537
|
+
var requestActionInputActionSchema = z9.object({
|
|
2538
|
+
id: z9.string().min(1).optional().describe(
|
|
2082
2539
|
"Stable action identifier echoed in tool output (e.g. pick-blog-topic). Strongly recommended \u2014 auto-derived from title when omitted."
|
|
2083
2540
|
),
|
|
2084
|
-
title:
|
|
2085
|
-
description:
|
|
2086
|
-
schema:
|
|
2087
|
-
ui:
|
|
2541
|
+
title: z9.string().min(1),
|
|
2542
|
+
description: z9.string().optional(),
|
|
2543
|
+
schema: z9.record(z9.string(), z9.unknown()).optional().describe("JSON Schema object for the human feedback form"),
|
|
2544
|
+
ui: z9.record(z9.string(), z9.unknown()).optional().describe(
|
|
2088
2545
|
'RJSF ui schema overrides (ui:widget, ui:enumNames, etc.). Use ui:widget "radio" for 2\u20136 discrete choices rendered as tappable cards.'
|
|
2089
2546
|
),
|
|
2090
|
-
data:
|
|
2547
|
+
data: z9.record(z9.string(), z9.unknown()).optional().describe("Optional default form field values")
|
|
2091
2548
|
});
|
|
2092
|
-
var requestActionInputToolOutputSchema =
|
|
2093
|
-
actionId:
|
|
2094
|
-
data:
|
|
2549
|
+
var requestActionInputToolOutputSchema = z9.object({
|
|
2550
|
+
actionId: z9.string().min(1),
|
|
2551
|
+
data: z9.record(z9.string(), z9.unknown())
|
|
2095
2552
|
});
|
|
2096
|
-
var requestActionInputToolInputSchema =
|
|
2097
|
-
prompt:
|
|
2553
|
+
var requestActionInputToolInputSchema = z9.object({
|
|
2554
|
+
prompt: z9.string().optional().describe("Optional heading shown above the action widget in chat"),
|
|
2098
2555
|
action: requestActionInputActionSchema.describe(
|
|
2099
2556
|
"Action widget config: JSON Schema form fields and optional RJSF ui overrides (same shape as RobotRock inbox actions)"
|
|
2100
2557
|
)
|
|
@@ -2109,24 +2566,24 @@ function buildRequestActionInputToolDefinition(options = {}) {
|
|
|
2109
2566
|
}
|
|
2110
2567
|
|
|
2111
2568
|
// src/ai/report-status-tool-core.ts
|
|
2112
|
-
import { z as
|
|
2113
|
-
var reportStatusPhaseSchema =
|
|
2569
|
+
import { z as z10 } from "zod";
|
|
2570
|
+
var reportStatusPhaseSchema = z10.enum([
|
|
2114
2571
|
"info",
|
|
2115
2572
|
"running",
|
|
2116
2573
|
"waiting",
|
|
2117
2574
|
"succeeded",
|
|
2118
2575
|
"failed"
|
|
2119
2576
|
]);
|
|
2120
|
-
var reportStatusToolInputSchema =
|
|
2121
|
-
message:
|
|
2577
|
+
var reportStatusToolInputSchema = z10.object({
|
|
2578
|
+
message: z10.string().min(1).describe(
|
|
2122
2579
|
"Short progress update shown in chat (1-2 sentences). Use while researching, drafting, or waiting on external work."
|
|
2123
2580
|
),
|
|
2124
2581
|
phase: reportStatusPhaseSchema.optional().describe(
|
|
2125
2582
|
"Lifecycle phase for the status marker. Defaults to running. Use succeeded or failed when a step finishes."
|
|
2126
2583
|
)
|
|
2127
2584
|
});
|
|
2128
|
-
var reportStatusToolOutputSchema =
|
|
2129
|
-
message:
|
|
2585
|
+
var reportStatusToolOutputSchema = z10.object({
|
|
2586
|
+
message: z10.string().min(1),
|
|
2130
2587
|
phase: reportStatusPhaseSchema
|
|
2131
2588
|
});
|
|
2132
2589
|
function normalizeReportStatusToolInput(input) {
|