robotrock 1.1.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.
Files changed (70) hide show
  1. package/dist/agent-admin.d.ts +82 -0
  2. package/dist/agent-admin.js +938 -0
  3. package/dist/agent-admin.js.map +1 -0
  4. package/dist/ai/index.d.ts +6 -5
  5. package/dist/ai/index.js +407 -188
  6. package/dist/ai/index.js.map +1 -1
  7. package/dist/ai/trigger.d.ts +4 -3
  8. package/dist/ai/trigger.js +407 -188
  9. package/dist/ai/trigger.js.map +1 -1
  10. package/dist/ai/workflow.d.ts +4 -3
  11. package/dist/ai/workflow.js +404 -185
  12. package/dist/ai/workflow.js.map +1 -1
  13. package/dist/auth-headers-qL-ZeEtd.d.ts +13 -0
  14. package/dist/{client-XTnFHGFE.d.ts → client-YO9Y1rkH.d.ts} +29 -17
  15. package/dist/eve/agent/index.d.ts +11 -35
  16. package/dist/eve/agent/index.js +678 -146
  17. package/dist/eve/agent/index.js.map +1 -1
  18. package/dist/eve/index.d.ts +5 -2
  19. package/dist/eve/index.js +195 -2
  20. package/dist/eve/index.js.map +1 -1
  21. package/dist/eve/tools/admin/assign-tasks.d.ts +39 -0
  22. package/dist/eve/tools/admin/assign-tasks.js +1060 -0
  23. package/dist/eve/tools/admin/assign-tasks.js.map +1 -0
  24. package/dist/eve/tools/admin/manage-groups.d.ts +53 -0
  25. package/dist/eve/tools/admin/manage-groups.js +1218 -0
  26. package/dist/eve/tools/admin/manage-groups.js.map +1 -0
  27. package/dist/eve/tools/admin/manage-team-members.d.ts +45 -0
  28. package/dist/eve/tools/admin/manage-team-members.js +1160 -0
  29. package/dist/eve/tools/admin/manage-team-members.js.map +1 -0
  30. package/dist/eve/tools/admin/query-tasks.d.ts +71 -0
  31. package/dist/eve/tools/admin/query-tasks.js +1161 -0
  32. package/dist/eve/tools/admin/query-tasks.js.map +1 -0
  33. package/dist/eve/tools/catalog/search-products.d.ts +57 -0
  34. package/dist/eve/tools/catalog/search-products.js +94 -0
  35. package/dist/eve/tools/catalog/search-products.js.map +1 -0
  36. package/dist/eve/tools/identity/index.d.ts +2 -0
  37. package/dist/eve/tools/identity/index.js +117 -27
  38. package/dist/eve/tools/identity/index.js.map +1 -1
  39. package/dist/eve/tools/identity/my-access.d.ts +6 -46
  40. package/dist/eve/tools/identity/my-access.js +91 -10
  41. package/dist/eve/tools/identity/my-access.js.map +1 -1
  42. package/dist/eve/tools/identity/whoami.d.ts +7 -8
  43. package/dist/eve/tools/identity/whoami.js +33 -17
  44. package/dist/eve/tools/identity/whoami.js.map +1 -1
  45. package/dist/eve/tools/inbox/create-task.d.ts +5 -4
  46. package/dist/eve/tools/inbox/create-task.js +365 -137
  47. package/dist/eve/tools/inbox/create-task.js.map +1 -1
  48. package/dist/eve/tools/inbox/index.d.ts +1 -0
  49. package/dist/eve/tools/inbox/index.js +365 -137
  50. package/dist/eve/tools/inbox/index.js.map +1 -1
  51. package/dist/eve/tools/index.d.ts +7 -0
  52. package/dist/eve/tools/index.js +1362 -168
  53. package/dist/eve/tools/index.js.map +1 -1
  54. package/dist/{index-BL9qKHA8.d.ts → index-DoQN48Bm.d.ts} +61 -2
  55. package/dist/index.d.ts +6 -3
  56. package/dist/index.js +325 -119
  57. package/dist/index.js.map +1 -1
  58. package/dist/schemas/index.d.ts +6 -1
  59. package/dist/schemas/index.js +177 -48
  60. package/dist/schemas/index.js.map +1 -1
  61. package/dist/{tool-approval-bridge-C4bTm8vu.d.ts → tool-approval-bridge-aMA79Z1B.d.ts} +1 -1
  62. package/dist/tool-reply-guidance-C3qrT1In.d.ts +25 -0
  63. package/dist/trigger/index.d.ts +2 -1
  64. package/dist/trigger/index.js +310 -108
  65. package/dist/trigger/index.js.map +1 -1
  66. package/dist/{trigger-Dn0DFiyU.d.ts → trigger-CXrbKVCL.d.ts} +2 -2
  67. package/dist/workflow/index.d.ts +2 -1
  68. package/dist/workflow/index.js +310 -108
  69. package/dist/workflow/index.js.map +1 -1
  70. package/package.json +28 -4
@@ -205,7 +205,12 @@ declare const taskContextSchema: z.ZodPipe<z.ZodObject<{
205
205
  /**
206
206
  * Assignment targets at task create (not stored in task context JSON).
207
207
  * Unknown user emails are auto-provisioned as assignee memberships (count toward seat limits).
208
+ *
209
+ * Virtual group slugs (membership derived from tenantUsers, not groupMembers):
210
+ * - `all` — all workspace members (omit assignTo defaults to this)
211
+ * - `admins` — workspace users with tenant admin role
208
212
  */
213
+ declare const VIRTUAL_ASSIGN_TO_GROUP_SLUGS: readonly ["all", "admins"];
209
214
  declare const assignToSchema: z.ZodObject<{
210
215
  users: z.ZodOptional<z.ZodArray<z.ZodString>>;
211
216
  groups: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -544,4 +549,4 @@ type DiscriminatedApprovalResult<TActions extends readonly {
544
549
  } : never;
545
550
  }[TupleElementIndices<TActions>];
546
551
 
547
- export { type AgentTelemetry, type AgentTelemetryInput, type ApprovalResult, type AssignToInput, type CreateTaskBody, type CreateTaskBodyInput, DEFAULT_TASK_PRIORITY, DEFAULT_THREAD_UPDATE_STATUS, type DiscriminatedApprovalResult, type ExtendedJSONSchema7, type Handler, type InferActionData, type InferJsonSchema7, type JSONSchema7, type JSONSchema7TypeName, LOWEST_TASK_PRIORITY, TASK_CONTEXT_FORMAT_VERSION, TASK_PRIORITY_RANK, type Task, type TaskAction, type TaskActionInput, type TaskContext, type TaskContextFormatVersion, type TaskContextInput, type TaskContextOutput, type TaskPriority, type TaskResponse, type TaskResult, type TaskStatus, type ThreadUpdate, type ThreadUpdateBody, type ThreadUpdateBodyInput, type ThreadUpdateInput, type ThreadUpdateResponse, type ThreadUpdateSource, type ThreadUpdateStatus, type TriggerHandler, type TupleElementIndices, type UiSchema, type WebhookHandler, agentTelemetrySchema, assignToSchema, createTaskBodySchema, taskActionInputSchema, taskContextSchema, taskPriorities, taskPrioritySchema, threadUpdateBodySchema, threadUpdateInputSchema, threadUpdateMessageSchema, threadUpdateStatusSchema, threadUpdateStatuses };
552
+ export { type AgentTelemetry, type AgentTelemetryInput, type ApprovalResult, type AssignToInput, type CreateTaskBody, type CreateTaskBodyInput, DEFAULT_TASK_PRIORITY, DEFAULT_THREAD_UPDATE_STATUS, type DiscriminatedApprovalResult, type ExtendedJSONSchema7, type Handler, type InferActionData, type InferJsonSchema7, type JSONSchema7, type JSONSchema7TypeName, LOWEST_TASK_PRIORITY, TASK_CONTEXT_FORMAT_VERSION, TASK_PRIORITY_RANK, type Task, type TaskAction, type TaskActionInput, type TaskContext, type TaskContextFormatVersion, type TaskContextInput, type TaskContextOutput, type TaskPriority, type TaskResponse, type TaskResult, type TaskStatus, type ThreadUpdate, type ThreadUpdateBody, type ThreadUpdateBodyInput, type ThreadUpdateInput, type ThreadUpdateResponse, type ThreadUpdateSource, type ThreadUpdateStatus, type TriggerHandler, type TupleElementIndices, type UiSchema, VIRTUAL_ASSIGN_TO_GROUP_SLUGS, type WebhookHandler, agentTelemetrySchema, assignToSchema, createTaskBodySchema, taskActionInputSchema, taskContextSchema, taskPriorities, taskPrioritySchema, threadUpdateBodySchema, threadUpdateInputSchema, threadUpdateMessageSchema, threadUpdateStatusSchema, threadUpdateStatuses };
@@ -1,5 +1,5 @@
1
1
  // src/schemas/index.ts
2
- import { z as z2 } from "zod";
2
+ import { z as z4 } from "zod";
3
3
 
4
4
  // ../core/src/utils/safe-url.ts
5
5
  var BLOCKED_HOSTNAMES = /* @__PURE__ */ new Set([
@@ -386,13 +386,27 @@ var createAgentChatBodySchema = z.object({
386
386
  eveConnectionId: z.string().min(1).optional(),
387
387
  /** Source application id; groups the chat under an inbox section. */
388
388
  app: z.string().min(1).optional(),
389
- assignTo: assignToSchema.optional(),
389
+ /** Email of the user who owns the chat. Required unless `parentChatId` is set. */
390
+ ownerEmail: z.string().email().optional(),
390
391
  title: z.string().min(1),
391
392
  messages: z.array(agentChatSeedMessageSchema).default([]),
392
393
  /** Provenance label stored on the session ("cron" | "agent" | ...). */
393
394
  source: z.string().min(1).optional()
394
395
  }).refine((data) => Boolean(data.agentIdentifier || data.parentChatId), {
395
396
  message: "Provide either agentIdentifier or parentChatId"
397
+ }).refine((data) => Boolean(data.ownerEmail || data.parentChatId), {
398
+ message: "Provide ownerEmail unless parentChatId is set"
399
+ });
400
+ var agentChatAuditToolBodySchema = z.object({
401
+ eveSessionId: z.string().min(1),
402
+ userId: z.string().min(1),
403
+ toolCallId: z.string().min(1),
404
+ toolName: z.string().min(1),
405
+ input: z.record(z.string(), z.unknown()).default({}),
406
+ success: z.boolean(),
407
+ status: z.enum(["completed", "failed", "rejected"]),
408
+ error: z.string().optional(),
409
+ idempotencyKey: z.string().optional()
396
410
  });
397
411
  var agentChatAuditInputBodySchema = z.object({
398
412
  eveSessionId: z.string().min(1),
@@ -432,62 +446,175 @@ var agentChatLinkTaskBodySchema = z.object({
432
446
  toolCallId: z.string().min(1)
433
447
  });
434
448
 
449
+ // ../core/src/schemas/tool-result-display.ts
450
+ import { z as z2 } from "zod";
451
+ var toolDisplayMetadataSchema = z2.object({
452
+ widget: z2.string().optional(),
453
+ title: z2.string().optional(),
454
+ description: z2.string().optional()
455
+ });
456
+ var toolDisplayEnvelopeSchema = z2.object({
457
+ display: toolDisplayMetadataSchema.optional(),
458
+ data: z2.record(z2.string(), z2.unknown()),
459
+ ui: z2.record(
460
+ z2.string(),
461
+ z2.object({
462
+ "ui:widget": z2.string().optional(),
463
+ "ui:title": z2.string().optional(),
464
+ "ui:description": z2.string().optional(),
465
+ "ui:options": z2.record(z2.string(), z2.unknown()).optional()
466
+ }).passthrough()
467
+ ).optional()
468
+ });
469
+
470
+ // ../core/src/schemas/agent-admin.ts
471
+ import { z as z3 } from "zod";
472
+ var tenantRoleSchema = z3.enum(["admin", "member"]);
473
+ var agentAdminUserSchema = z3.object({
474
+ id: z3.string(),
475
+ email: z3.string().email(),
476
+ name: z3.string()
477
+ });
478
+ var agentAdminMemberSchema = z3.object({
479
+ userId: z3.string(),
480
+ role: z3.string(),
481
+ membershipKind: z3.enum(["team", "assignee"]),
482
+ hasLoggedIn: z3.boolean(),
483
+ user: agentAdminUserSchema
484
+ });
485
+ var agentAdminGroupSchema = z3.object({
486
+ id: z3.string(),
487
+ name: z3.string(),
488
+ slug: z3.string(),
489
+ description: z3.string().nullable(),
490
+ memberCount: z3.number().optional()
491
+ });
492
+ var agentAdminGroupDetailSchema = agentAdminGroupSchema.extend({
493
+ members: z3.array(
494
+ z3.object({
495
+ userId: z3.string(),
496
+ user: agentAdminUserSchema
497
+ })
498
+ )
499
+ });
500
+ var agentAdminTaskSummarySchema = z3.object({
501
+ id: z3.string(),
502
+ convexId: z3.string(),
503
+ status: z3.string(),
504
+ type: z3.string().nullable(),
505
+ name: z3.string().nullable(),
506
+ description: z3.string().nullable(),
507
+ validUntil: z3.number(),
508
+ createdAt: z3.number(),
509
+ threadPriority: z3.string().nullable(),
510
+ handledByUserId: z3.string().nullable()
511
+ });
512
+ var inviteMemberBodySchema = z3.object({
513
+ email: z3.string().email(),
514
+ role: tenantRoleSchema.optional()
515
+ });
516
+ var updateMemberRoleBodySchema = z3.object({
517
+ role: tenantRoleSchema
518
+ });
519
+ var createGroupBodySchema = z3.object({
520
+ name: z3.string().min(1),
521
+ description: z3.string().optional()
522
+ });
523
+ var updateGroupBodySchema = z3.object({
524
+ name: z3.string().min(1).optional(),
525
+ description: z3.string().optional()
526
+ });
527
+ var addGroupMemberBodySchema = z3.object({
528
+ userId: z3.string().min(1).describe("Convex user id or member email.")
529
+ });
530
+ var listTasksQuerySchema = z3.object({
531
+ statusFilter: z3.enum(["all", "open", "handled", "expired"]).optional(),
532
+ typeFilter: z3.string().optional(),
533
+ appFilter: z3.string().optional(),
534
+ sortField: z3.enum(["type", "date", "status", "validUntil"]).optional(),
535
+ sortDirection: z3.enum(["asc", "desc"]).optional(),
536
+ limit: z3.coerce.number().int().positive().max(100).optional(),
537
+ cursor: z3.string().optional()
538
+ });
539
+ var searchTasksQuerySchema = z3.object({
540
+ q: z3.string().min(1),
541
+ limit: z3.coerce.number().int().positive().max(100).optional()
542
+ });
543
+ var assignTasksResultSchema = z3.object({
544
+ taskId: z3.string(),
545
+ success: z3.boolean(),
546
+ message: z3.string().optional(),
547
+ name: z3.string().nullable().optional(),
548
+ description: z3.string().nullable().optional(),
549
+ type: z3.string().nullable().optional()
550
+ });
551
+ var assignTasksResponseSchema = z3.object({
552
+ results: z3.array(assignTasksResultSchema)
553
+ });
554
+ var assignTasksBodySchema = z3.object({
555
+ taskIds: z3.array(z3.string().min(1)).min(1).max(100),
556
+ assignTo: assignToSchema.refine(
557
+ (value) => (value.users?.length ?? 0) > 0 || (value.groups?.length ?? 0) > 0,
558
+ { message: "assignTo needs at least one user email or group slug." }
559
+ )
560
+ });
561
+
435
562
  // src/schemas/index.ts
436
- var handlerUrlSchema2 = z2.string().refine((url) => isAllowedHandlerUrl(url), {
563
+ var handlerUrlSchema2 = z4.string().refine((url) => isAllowedHandlerUrl(url), {
437
564
  message: HANDLER_URL_ERROR
438
565
  });
439
- var jsonSchema7Schema2 = z2.custom(
566
+ var jsonSchema7Schema2 = z4.custom(
440
567
  (val) => typeof val === "object" && val !== null,
441
568
  { message: "Must be a valid JSON Schema object" }
442
569
  );
443
- var uiSchemaSchema2 = z2.custom((val) => typeof val === "object" && val !== null, {
570
+ var uiSchemaSchema2 = z4.custom((val) => typeof val === "object" && val !== null, {
444
571
  message: "Must be a valid UiSchema object"
445
572
  });
446
- var webhookHandlerSchema2 = z2.object({
447
- type: z2.literal("webhook"),
573
+ var webhookHandlerSchema2 = z4.object({
574
+ type: z4.literal("webhook"),
448
575
  url: handlerUrlSchema2,
449
- headers: z2.record(z2.string(), z2.string())
576
+ headers: z4.record(z4.string(), z4.string())
450
577
  });
451
578
  var triggerHandlerSchema2 = webhookHandlerSchema2.extend({
452
- type: z2.literal("trigger"),
453
- tokenId: z2.string().min(1)
454
- });
455
- var handlerSchema2 = z2.discriminatedUnion("type", [webhookHandlerSchema2, triggerHandlerSchema2]);
456
- var taskActionInputSchema2 = z2.object({
457
- id: z2.string().min(1),
458
- title: z2.string().min(1),
459
- description: z2.string().optional(),
579
+ type: z4.literal("trigger"),
580
+ tokenId: z4.string().min(1)
581
+ });
582
+ var handlerSchema2 = z4.discriminatedUnion("type", [webhookHandlerSchema2, triggerHandlerSchema2]);
583
+ var taskActionInputSchema2 = z4.object({
584
+ id: z4.string().min(1),
585
+ title: z4.string().min(1),
586
+ description: z4.string().optional(),
460
587
  schema: jsonSchema7Schema2.optional(),
461
588
  ui: uiSchemaSchema2.optional(),
462
- data: z2.record(z2.string(), z2.unknown()).optional()
589
+ data: z4.record(z4.string(), z4.unknown()).optional()
463
590
  });
464
591
  var taskActionSchema2 = taskActionInputSchema2.extend({
465
- handlers: z2.array(handlerSchema2).min(1).optional()
466
- });
467
- var uiFieldSchemaSchema2 = z2.object({
468
- "ui:widget": z2.string().optional(),
469
- "ui:title": z2.string().optional(),
470
- "ui:description": z2.string().optional(),
471
- "ui:options": z2.record(z2.string(), z2.unknown()).optional(),
472
- items: z2.lazy(() => z2.record(z2.string(), uiFieldSchemaSchema2)).optional()
592
+ handlers: z4.array(handlerSchema2).min(1).optional()
593
+ });
594
+ var uiFieldSchemaSchema2 = z4.object({
595
+ "ui:widget": z4.string().optional(),
596
+ "ui:title": z4.string().optional(),
597
+ "ui:description": z4.string().optional(),
598
+ "ui:options": z4.record(z4.string(), z4.unknown()).optional(),
599
+ items: z4.lazy(() => z4.record(z4.string(), uiFieldSchemaSchema2)).optional()
473
600
  }).passthrough();
474
- var contextUiSchema2 = z2.record(z2.string(), uiFieldSchemaSchema2).optional();
475
- var contextDataSchema2 = z2.object({
476
- data: z2.record(z2.string(), z2.unknown()),
601
+ var contextUiSchema2 = z4.record(z4.string(), uiFieldSchemaSchema2).optional();
602
+ var contextDataSchema2 = z4.object({
603
+ data: z4.record(z4.string(), z4.unknown()),
477
604
  ui: contextUiSchema2
478
605
  }).optional();
479
606
  var TASK_CONTEXT_FORMAT_VERSION2 = 2;
480
- var taskContextObjectBaseSchema2 = z2.object({
481
- app: z2.string().min(1).optional(),
482
- type: z2.string().min(1),
483
- name: z2.string().min(1),
484
- description: z2.string().optional(),
485
- validUntil: z2.string().optional(),
607
+ var taskContextObjectBaseSchema2 = z4.object({
608
+ app: z4.string().min(1).optional(),
609
+ type: z4.string().min(1),
610
+ name: z4.string().min(1),
611
+ description: z4.string().optional(),
612
+ validUntil: z4.string().optional(),
486
613
  context: contextDataSchema2,
487
- contextVersion: z2.literal(2).optional(),
614
+ contextVersion: z4.literal(2).optional(),
488
615
  /** @deprecated Use `contextVersion`. Accepted on ingest only. */
489
- version: z2.literal(2).optional(),
490
- actions: z2.array(taskActionSchema2).min(1, "At least one action is required")
616
+ version: z4.literal(2).optional(),
617
+ actions: z4.array(taskActionSchema2).min(1, "At least one action is required")
491
618
  });
492
619
  function normalizeTaskContextVersion2(data) {
493
620
  const { version: legacyVersion, contextVersion, ...rest } = data;
@@ -503,7 +630,7 @@ function refineContextPublicUrls2(data, ctx) {
503
630
  const error = validateContextPublicUrls(data.context);
504
631
  if (error) {
505
632
  ctx.addIssue({
506
- code: z2.ZodIssueCode.custom,
633
+ code: z4.ZodIssueCode.custom,
507
634
  message: error,
508
635
  path: ["context"]
509
636
  });
@@ -512,9 +639,10 @@ function refineContextPublicUrls2(data, ctx) {
512
639
  var taskContextSchema2 = taskContextObjectSchema2.superRefine(
513
640
  refineContextPublicUrls2
514
641
  );
515
- var assignToSchema2 = z2.object({
516
- users: z2.array(z2.string().email()).optional(),
517
- groups: z2.array(z2.string().min(1)).optional()
642
+ var VIRTUAL_ASSIGN_TO_GROUP_SLUGS = ["all", "admins"];
643
+ var assignToSchema2 = z4.object({
644
+ users: z4.array(z4.string().email()).optional(),
645
+ groups: z4.array(z4.string().min(1)).optional()
518
646
  }).refine(
519
647
  (data) => {
520
648
  const groups = data.groups ?? [];
@@ -525,7 +653,7 @@ var assignToSchema2 = z2.object({
525
653
  },
526
654
  { message: 'Cannot combine "all" with other group slugs' }
527
655
  );
528
- var threadUpdateMessageSchema2 = z2.string().min(1).max(500);
656
+ var threadUpdateMessageSchema2 = z4.string().min(1).max(500);
529
657
  var threadUpdateStatuses2 = [
530
658
  "info",
531
659
  "queued",
@@ -535,14 +663,14 @@ var threadUpdateStatuses2 = [
535
663
  "failed",
536
664
  "cancelled"
537
665
  ];
538
- var threadUpdateStatusSchema2 = z2.enum(threadUpdateStatuses2);
666
+ var threadUpdateStatusSchema2 = z4.enum(threadUpdateStatuses2);
539
667
  var DEFAULT_THREAD_UPDATE_STATUS = "info";
540
- var threadUpdateInputSchema2 = z2.object({
668
+ var threadUpdateInputSchema2 = z4.object({
541
669
  message: threadUpdateMessageSchema2,
542
670
  status: threadUpdateStatusSchema2.optional()
543
671
  });
544
672
  var taskPriorities2 = ["low", "normal", "high", "urgent"];
545
- var taskPrioritySchema2 = z2.enum(taskPriorities2);
673
+ var taskPrioritySchema2 = z4.enum(taskPriorities2);
546
674
  var DEFAULT_TASK_PRIORITY = "normal";
547
675
  var LOWEST_TASK_PRIORITY = "low";
548
676
  var TASK_PRIORITY_RANK = {
@@ -551,8 +679,8 @@ var TASK_PRIORITY_RANK = {
551
679
  high: 3,
552
680
  urgent: 4
553
681
  };
554
- var agentTelemetrySchema2 = z2.object({
555
- version: z2.string().min(1)
682
+ var agentTelemetrySchema2 = z4.object({
683
+ version: z4.string().min(1)
556
684
  });
557
685
  var createTaskBodySchema2 = taskContextObjectBaseSchema2.extend({
558
686
  assignTo: assignToSchema2.optional(),
@@ -560,7 +688,7 @@ var createTaskBodySchema2 = taskContextObjectBaseSchema2.extend({
560
688
  * Groups related tasks together. When omitted, the server generates one and
561
689
  * returns it so the caller can reuse it on later tasks in the same thread.
562
690
  */
563
- threadId: z2.string().min(1).optional(),
691
+ threadId: z4.string().min(1).optional(),
564
692
  /**
565
693
  * Optional thread priority. When set, applies to the whole thread and
566
694
  * overwrites any previous priority. Omit on later tasks to leave unchanged.
@@ -580,6 +708,7 @@ export {
580
708
  LOWEST_TASK_PRIORITY,
581
709
  TASK_CONTEXT_FORMAT_VERSION2 as TASK_CONTEXT_FORMAT_VERSION,
582
710
  TASK_PRIORITY_RANK,
711
+ VIRTUAL_ASSIGN_TO_GROUP_SLUGS,
583
712
  agentTelemetrySchema2 as agentTelemetrySchema,
584
713
  assignToSchema2 as assignToSchema,
585
714
  createTaskBodySchema2 as createTaskBodySchema,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/schemas/index.ts","../../../core/src/utils/safe-url.ts","../../../core/src/schemas/task.ts","../../../core/src/schemas/context-urls.ts"],"sourcesContent":["import { z } from \"zod\";\nimport {\n isAllowedHandlerUrl,\n HANDLER_URL_ERROR,\n} from \"@robotrock/core/utils\";\nimport { validateContextPublicUrls } from \"@robotrock/core/schemas\";\n\nexport interface JSONSchema7 {\n $id?: string;\n $ref?: string;\n $schema?: string;\n $comment?: string;\n type?: JSONSchema7TypeName | JSONSchema7TypeName[];\n enum?: unknown[];\n const?: unknown;\n multipleOf?: number;\n maximum?: number;\n exclusiveMaximum?: number;\n minimum?: number;\n exclusiveMinimum?: number;\n maxLength?: number;\n minLength?: number;\n pattern?: string;\n format?: string;\n items?: JSONSchema7 | JSONSchema7[];\n additionalItems?: JSONSchema7 | boolean;\n maxItems?: number;\n minItems?: number;\n uniqueItems?: boolean;\n contains?: JSONSchema7;\n maxProperties?: number;\n minProperties?: number;\n required?: string[];\n properties?: Record<string, JSONSchema7>;\n patternProperties?: Record<string, JSONSchema7>;\n additionalProperties?: JSONSchema7 | boolean;\n dependencies?: Record<string, JSONSchema7 | string[]>;\n propertyNames?: JSONSchema7;\n if?: JSONSchema7;\n then?: JSONSchema7;\n else?: JSONSchema7;\n allOf?: JSONSchema7[];\n anyOf?: JSONSchema7[];\n oneOf?: JSONSchema7[];\n not?: JSONSchema7;\n title?: string;\n description?: string;\n default?: unknown;\n readOnly?: boolean;\n writeOnly?: boolean;\n examples?: unknown[];\n}\n\nexport type JSONSchema7TypeName =\n | \"string\"\n | \"number\"\n | \"integer\"\n | \"boolean\"\n | \"object\"\n | \"array\"\n | \"null\";\n\nexport type ExtendedJSONSchema7 = JSONSchema7 & {\n enumNames?: string[];\n [key: string]: unknown;\n};\n\nexport type UiSchema = {\n \"ui:widget\"?: string;\n \"ui:title\"?: string;\n \"ui:description\"?: string;\n \"ui:placeholder\"?: string;\n \"ui:options\"?: Record<string, unknown>;\n [key: string]: unknown;\n};\n\nconst handlerUrlSchema = z.string().refine((url) => isAllowedHandlerUrl(url), {\n message: HANDLER_URL_ERROR,\n});\n\nconst jsonSchema7Schema = z.custom<ExtendedJSONSchema7>(\n (val) => typeof val === \"object\" && val !== null,\n { message: \"Must be a valid JSON Schema object\" }\n);\n\nconst uiSchemaSchema = z.custom<UiSchema>((val) => typeof val === \"object\" && val !== null, {\n message: \"Must be a valid UiSchema object\",\n});\n\nconst webhookHandlerSchema = z.object({\n type: z.literal(\"webhook\"),\n url: handlerUrlSchema,\n headers: z.record(z.string(), z.string()),\n});\n\nconst triggerHandlerSchema = webhookHandlerSchema.extend({\n type: z.literal(\"trigger\"),\n tokenId: z.string().min(1),\n});\n\nconst handlerSchema = z.discriminatedUnion(\"type\", [webhookHandlerSchema, triggerHandlerSchema]);\n\n/** Action config without handlers — used for chat widgets and agent tool input. */\nexport const taskActionInputSchema = z.object({\n id: z.string().min(1),\n title: z.string().min(1),\n description: z.string().optional(),\n schema: jsonSchema7Schema.optional(),\n ui: uiSchemaSchema.optional(),\n data: z.record(z.string(), z.unknown()).optional(),\n});\n\nconst taskActionSchema = taskActionInputSchema.extend({\n handlers: z.array(handlerSchema).min(1).optional(),\n});\n\nconst uiFieldSchemaSchema: z.ZodType<Record<string, unknown>> = z\n .object({\n \"ui:widget\": z.string().optional(),\n \"ui:title\": z.string().optional(),\n \"ui:description\": z.string().optional(),\n \"ui:options\": z.record(z.string(), z.unknown()).optional(),\n items: z.lazy(() => z.record(z.string(), uiFieldSchemaSchema)).optional(),\n })\n .passthrough();\n\nconst contextUiSchema = z.record(z.string(), uiFieldSchemaSchema).optional();\n\nconst contextDataSchema = z\n .object({\n data: z.record(z.string(), z.unknown()),\n ui: contextUiSchema,\n })\n .optional();\n\n/** Task context wire format version (always `2` today). */\nexport const TASK_CONTEXT_FORMAT_VERSION = 2 as const;\nexport type TaskContextFormatVersion = typeof TASK_CONTEXT_FORMAT_VERSION;\n\nconst taskContextObjectBaseSchema = z.object({\n app: z.string().min(1).optional(),\n type: z.string().min(1),\n name: z.string().min(1),\n description: z.string().optional(),\n validUntil: z.string().optional(),\n context: contextDataSchema,\n contextVersion: z.literal(2).optional(),\n /** @deprecated Use `contextVersion`. Accepted on ingest only. */\n version: z.literal(2).optional(),\n actions: z.array(taskActionSchema).min(1, \"At least one action is required\"),\n});\n\nfunction normalizeTaskContextVersion<T extends { contextVersion?: 2; version?: 2 }>(\n data: T\n): Omit<T, \"version\" | \"contextVersion\"> & { contextVersion: 2 } {\n const { version: legacyVersion, contextVersion, ...rest } = data;\n return {\n ...rest,\n contextVersion: contextVersion ?? legacyVersion ?? TASK_CONTEXT_FORMAT_VERSION,\n };\n}\n\nconst taskContextObjectSchema = taskContextObjectBaseSchema.transform(\n normalizeTaskContextVersion\n);\n\nfunction refineContextPublicUrls<T extends { context?: z.infer<typeof contextDataSchema> }>(\n data: T,\n ctx: z.RefinementCtx\n) {\n const error = validateContextPublicUrls(data.context);\n if (error) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: error,\n path: [\"context\"],\n });\n }\n}\n\nexport const taskContextSchema = taskContextObjectSchema.superRefine(\n refineContextPublicUrls\n);\n\n/**\n * Assignment targets at task create (not stored in task context JSON).\n * Unknown user emails are auto-provisioned as assignee memberships (count toward seat limits).\n */\nexport const assignToSchema = z\n .object({\n users: z.array(z.string().email()).optional(),\n groups: z.array(z.string().min(1)).optional(),\n })\n .refine(\n (data) => {\n const groups = data.groups ?? [];\n if (groups.includes(\"all\") && groups.length > 1) {\n return false;\n }\n return true;\n },\n { message: 'Cannot combine \"all\" with other group slugs' }\n );\n\n/** A short thread-scoped status update message (1-2 sentences). */\nexport const threadUpdateMessageSchema = z.string().min(1).max(500);\n\n/**\n * Lifecycle status carried by a thread update. Drives the icon and color shown\n * in the inbox status bar. Defaults to `info` when omitted.\n */\nexport const threadUpdateStatuses = [\n \"info\",\n \"queued\",\n \"running\",\n \"waiting\",\n \"succeeded\",\n \"failed\",\n \"cancelled\",\n] as const;\n\nexport const threadUpdateStatusSchema = z.enum(threadUpdateStatuses);\n\n/** The default status applied when an update omits one. */\nexport const DEFAULT_THREAD_UPDATE_STATUS: ThreadUpdateStatus = \"info\";\n\n/** Shared shape for a thread update (standalone and at task creation). */\nexport const threadUpdateInputSchema = z.object({\n message: threadUpdateMessageSchema,\n status: threadUpdateStatusSchema.optional(),\n});\n\n/** Thread priority levels for inbox ordering and display. */\nexport const taskPriorities = [\"low\", \"normal\", \"high\", \"urgent\"] as const;\n\nexport const taskPrioritySchema = z.enum(taskPriorities);\n\nexport type TaskPriority = (typeof taskPriorities)[number];\n\nexport const DEFAULT_TASK_PRIORITY: TaskPriority = \"normal\";\n\nexport const LOWEST_TASK_PRIORITY: TaskPriority = \"low\";\n\nexport const TASK_PRIORITY_RANK: Record<TaskPriority, number> = {\n low: 1,\n normal: 2,\n high: 3,\n urgent: 4,\n};\n\nexport const agentTelemetrySchema = z.object({\n version: z.string().min(1),\n});\n\nexport const createTaskBodySchema = taskContextObjectBaseSchema\n .extend({\n assignTo: assignToSchema.optional(),\n /**\n * Groups related tasks together. When omitted, the server generates one and\n * returns it so the caller can reuse it on later tasks in the same thread.\n */\n threadId: z.string().min(1).optional(),\n /**\n * Optional thread priority. When set, applies to the whole thread and\n * overwrites any previous priority. Omit on later tasks to leave unchanged.\n */\n priority: taskPrioritySchema.optional(),\n /**\n * Optional initial status update logged against the task's thread. Shows in\n * the inbox status bar and the thread update log.\n */\n update: threadUpdateInputSchema.optional(),\n agent: agentTelemetrySchema.optional(),\n })\n .transform(normalizeTaskContextVersion)\n .superRefine(refineContextPublicUrls);\n\n/** POST /v1/threads/:threadId/updates body: a standalone thread update. */\nexport const threadUpdateBodySchema = threadUpdateInputSchema;\n\n/** Where a thread update originated. */\nexport type ThreadUpdateSource = \"api\" | \"task_create\" | \"dashboard\";\n\n/** Lifecycle status carried by a thread update. */\nexport type ThreadUpdateStatus = (typeof threadUpdateStatuses)[number];\n\n/** A logged thread update as returned by the API. */\nexport interface ThreadUpdate {\n id: string;\n threadId: string;\n message: string;\n status: ThreadUpdateStatus;\n source: ThreadUpdateSource;\n createdAt: number;\n}\n\nexport type AssignToInput = z.infer<typeof assignToSchema>;\nexport type CreateTaskBodyInput = z.input<typeof createTaskBodySchema>;\nexport type CreateTaskBody = z.output<typeof createTaskBodySchema>;\nexport type ThreadUpdateBodyInput = z.input<typeof threadUpdateBodySchema>;\nexport type ThreadUpdateBody = z.output<typeof threadUpdateBodySchema>;\nexport type ThreadUpdateInput = z.input<typeof threadUpdateInputSchema>;\nexport type TaskContextInput = z.input<typeof taskContextSchema>;\nexport type TaskContextOutput = z.output<typeof taskContextSchema>;\nexport type TaskContext = TaskContextOutput;\nexport type TaskActionInput = z.infer<typeof taskActionInputSchema>;\nexport type TaskAction = z.infer<typeof taskActionSchema>;\nexport type WebhookHandler = z.infer<typeof webhookHandlerSchema>;\nexport type TriggerHandler = z.infer<typeof triggerHandlerSchema>;\nexport type Handler = z.infer<typeof handlerSchema>;\nexport type AgentTelemetry = z.infer<typeof agentTelemetrySchema>;\nexport type AgentTelemetryInput = z.input<typeof agentTelemetrySchema>;\n\ntype InferObjectProperties<\n Props,\n Req extends PropertyKey,\n> = Props extends Record<string, unknown>\n ? ({\n [K in keyof Props as K extends Req ? K : never]-?: InferJsonSchema7<Props[K]>;\n } & {\n [K in keyof Props as K extends Req ? never : K]?: InferJsonSchema7<Props[K]>;\n } extends infer O\n ? { [K in keyof O]: O[K] }\n : never)\n : Record<string, unknown>;\n\ntype RequiredKeys<S> =\n S extends { readonly required: readonly string[] } ? S[\"required\"][number] : never;\n\nexport type InferJsonSchema7<S> = [S] extends [undefined]\n ? Record<string, never>\n : S extends { readonly const: infer C }\n ? C\n : S extends {\n readonly enum: readonly (infer E)[];\n }\n ? E\n : S extends {\n readonly type: \"object\";\n readonly properties?: infer Props;\n }\n ? InferObjectProperties<Props, RequiredKeys<S>>\n : S extends {\n readonly type: \"object\";\n readonly properties?: undefined;\n }\n ? Record<string, unknown>\n : S extends {\n readonly type: \"array\";\n readonly items?: infer Items;\n }\n ? Items extends readonly unknown[]\n ? InferJsonSchema7<Items[number]>[]\n : Items extends object\n ? InferJsonSchema7<Items>[]\n : unknown[]\n : S extends { readonly type: \"string\" }\n ? string\n : S extends { readonly type: \"number\" } | { readonly type: \"integer\" }\n ? number\n : S extends { readonly type: \"boolean\" }\n ? boolean\n : unknown;\n\nexport type TaskStatus = \"pending\" | \"open\" | \"handled\" | \"expired\";\n\nexport interface TaskResponse {\n success: boolean;\n task: {\n taskId: string;\n threadId: string;\n status: \"pending\" | \"open\";\n context: TaskContext;\n validUntil: string;\n submittedAt: string;\n };\n message: string;\n}\n\nexport interface ThreadUpdateResponse {\n success: boolean;\n update: ThreadUpdate;\n message: string;\n}\n\nexport interface Task {\n id: string;\n threadId?: string;\n createdAt: Date;\n status: TaskStatus;\n context: TaskContext;\n validUntil: number;\n handledAt?: number;\n handled?: {\n action: {\n id: string;\n data: unknown;\n };\n handledBy?: string;\n userId?: string;\n token?: string;\n };\n}\n\nexport type InferActionData<T extends { schema?: unknown }> = [\n Exclude<T[\"schema\"], undefined>,\n] extends [\n never,\n]\n ? Record<string, never>\n : Exclude<T[\"schema\"], undefined> extends infer S\n ? InferJsonSchema7<S>\n : Record<string, never>;\n\nexport type TupleElementIndices<T extends readonly unknown[]> = T extends readonly [\n unknown,\n ...unknown[],\n]\n ? Exclude<keyof T, keyof unknown[]>\n : number;\n\nexport interface TaskResult<T = Record<string, unknown>> {\n actionId: string;\n data: T;\n handledBy?: string;\n handledAt: Date;\n}\n\nexport interface ApprovalResult<T = Record<string, unknown>> extends TaskResult<T> {\n taskId: string;\n}\n\nexport type DiscriminatedApprovalResult<\n TActions extends readonly { id: string; schema?: unknown }[],\n> = {\n [I in TupleElementIndices<TActions>]: TActions[I] extends { id: string; schema?: unknown }\n ? Omit<ApprovalResult<InferActionData<TActions[I]>>, \"actionId\" | \"data\"> & {\n actionId: TActions[I][\"id\"];\n data: InferActionData<TActions[I]>;\n }\n : never\n}[TupleElementIndices<TActions>];\n","const BLOCKED_HOSTNAMES = new Set([\n \"localhost\",\n \"metadata.google.internal\",\n \"metadata.goog\",\n]);\n\nfunction normalizeHostname(hostname: string): string {\n return hostname.toLowerCase().replace(/^\\[|\\]$/g, \"\");\n}\n\nfunction isBlockedIpv4(host: string): boolean {\n const match = /^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$/.exec(host);\n if (!match) {\n return false;\n }\n\n const octets = match.slice(1, 5).map((part) => Number(part));\n if (octets.some((octet) => Number.isNaN(octet) || octet < 0 || octet > 255)) {\n return true;\n }\n\n const [a, b, _c, _d] = octets;\n if (a === undefined || b === undefined) {\n return true;\n }\n if (a === 127 || a === 0) return true;\n if (a === 10) return true;\n if (a === 169 && b === 254) return true;\n if (a === 192 && b === 168) return true;\n if (a === 172 && b >= 16 && b <= 31) return true;\n if (a === 100 && b >= 64 && b <= 127) return true;\n\n return false;\n}\n\nfunction ipv4FromNumericHost(host: string): string | null {\n if (/^\\d+$/.test(host)) {\n const num = Number(host);\n if (!Number.isFinite(num) || num < 0 || num > 0xffffffff) {\n return null;\n }\n const a = (num >>> 24) & 0xff;\n const b = (num >>> 16) & 0xff;\n const c = (num >>> 8) & 0xff;\n const d = num & 0xff;\n return `${a}.${b}.${c}.${d}`;\n }\n\n const hexMatch = /^0x([0-9a-f]{1,8})$/i.exec(host);\n if (hexMatch) {\n const num = Number.parseInt(hexMatch[1]!, 16);\n if (!Number.isFinite(num) || num < 0 || num > 0xffffffff) {\n return null;\n }\n const a = (num >>> 24) & 0xff;\n const b = (num >>> 16) & 0xff;\n const c = (num >>> 8) & 0xff;\n const d = num & 0xff;\n return `${a}.${b}.${c}.${d}`;\n }\n\n return null;\n}\n\nfunction isBlockedIpv4Mapped(host: string): boolean {\n const mappedDotted = /^::ffff:(\\d{1,3}(?:\\.\\d{1,3}){3})$/i.exec(host);\n if (mappedDotted) {\n return isBlockedIpv4(mappedDotted[1]!);\n }\n\n const mappedHex = /^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/i.exec(host);\n if (mappedHex) {\n const high = Number.parseInt(mappedHex[1]!, 16);\n const low = Number.parseInt(mappedHex[2]!, 16);\n if (Number.isFinite(high) && Number.isFinite(low)) {\n const a = (high >> 8) & 0xff;\n const b = high & 0xff;\n const c = (low >> 8) & 0xff;\n const d = low & 0xff;\n return isBlockedIpv4(`${a}.${b}.${c}.${d}`);\n }\n }\n\n return false;\n}\n\nfunction isBlockedIpv6(host: string): boolean {\n if (host === \"::1\" || host === \"0:0:0:0:0:0:0:1\") {\n return true;\n }\n if (host.startsWith(\"fc\") || host.startsWith(\"fd\")) {\n return true;\n }\n if (host.startsWith(\"fe80:\")) {\n return true;\n }\n if (isBlockedIpv4Mapped(host)) {\n return true;\n }\n return false;\n}\n\nfunction isBlockedHostname(hostname: string): boolean {\n const host = normalizeHostname(hostname);\n if (!host) {\n return true;\n }\n if (BLOCKED_HOSTNAMES.has(host)) {\n return true;\n }\n if (host.endsWith(\".localhost\") || host.endsWith(\".local\")) {\n return true;\n }\n\n const numericIpv4 = ipv4FromNumericHost(host);\n if (numericIpv4 && isBlockedIpv4(numericIpv4)) {\n return true;\n }\n\n return isBlockedIpv4(host) || isBlockedIpv6(host);\n}\n\n/**\n * True when a handler URL targets the local machine. Convex cloud cannot POST\n * these directly; loopback deliveries are queued in Redis and drained by a local\n * worker (see apps/api handler-outbound).\n */\nexport function isLoopbackHandlerUrl(urlString: string): boolean {\n let url: URL;\n try {\n url = new URL(urlString);\n } catch {\n return false;\n }\n\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") {\n return false;\n }\n if (url.username || url.password) {\n return false;\n }\n\n const host = url.hostname.toLowerCase();\n return (\n host === \"localhost\" ||\n host === \"127.0.0.1\" ||\n host === \"::1\" ||\n host === \"[::1]\" ||\n host.endsWith(\".localhost\")\n );\n}\n\n/**\n * Webhook/trigger handler URLs may target a public host or loopback (local dev).\n */\nexport function isAllowedHandlerUrl(urlString: string): boolean {\n return isPublicHttpUrl(urlString) || isLoopbackHandlerUrl(urlString);\n}\n\n/**\n * Returns true when the URL uses http(s) and targets a public, non-reserved host.\n */\nexport function isPublicHttpUrl(urlString: string): boolean {\n let url: URL;\n try {\n url = new URL(urlString);\n } catch {\n return false;\n }\n\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") {\n return false;\n }\n if (url.username || url.password) {\n return false;\n }\n\n return !isBlockedHostname(url.hostname);\n}\n\nexport const PUBLIC_HTTP_URL_ERROR =\n \"URL must be a public http:// or https:// address\";\n\nexport const HANDLER_URL_ERROR =\n \"Handler URL must be a public or loopback http:// or https:// address\";\n\nconst FORBIDDEN_HANDLER_HEADERS = new Set([\n \"host\",\n \"connection\",\n \"content-length\",\n \"transfer-encoding\",\n \"te\",\n \"trailer\",\n \"upgrade\",\n \"proxy-authorization\",\n \"proxy-connection\",\n \"keep-alive\",\n \"x-robotrock-signature\",\n \"x-robotrock-delivery-id\",\n \"x-robotrock-delivery-attempt\",\n]);\n\n/**\n * Allow only safe custom webhook headers; blocks overrides of delivery metadata.\n */\nexport function filterHandlerHeaders(\n headers: Record<string, string> | undefined\n): Record<string, string> {\n if (!headers) {\n return {};\n }\n\n const filtered: Record<string, string> = {};\n for (const [rawKey, value] of Object.entries(headers)) {\n const key = rawKey.toLowerCase().trim();\n if (!key || FORBIDDEN_HANDLER_HEADERS.has(key)) {\n continue;\n }\n if (!/^[a-z0-9][a-z0-9._-]*$/.test(key)) {\n continue;\n }\n filtered[key] = value;\n }\n return filtered;\n}\n","import { z } from \"zod\";\nimport {\n isAllowedHandlerUrl,\n isPublicHttpUrl,\n HANDLER_URL_ERROR,\n PUBLIC_HTTP_URL_ERROR,\n} from \"../utils/safe-url\";\nimport { validateContextPublicUrls } from \"./context-urls\";\nimport type { JSONSchema7 } from \"./json-schema\";\n\n/**\n * Extended JSONSchema7 type that includes RJSF extensions like enumNames\n */\nexport type ExtendedJSONSchema7 = JSONSchema7 & {\n enumNames?: string[];\n [key: string]: unknown;\n};\n\n/**\n * UI Schema for RJSF form customization\n */\nexport type UiSchema = {\n \"ui:widget\"?: string;\n \"ui:title\"?: string;\n \"ui:description\"?: string;\n \"ui:placeholder\"?: string;\n \"ui:options\"?: Record<string, unknown>;\n [key: string]: unknown;\n};\n\n// Helper schemas\nexport const safeUrlSchema = z.string().refine((url) => isPublicHttpUrl(url), {\n message: PUBLIC_HTTP_URL_ERROR,\n});\n\nconst handlerUrlSchema = z.string().refine((url) => isAllowedHandlerUrl(url), {\n message: HANDLER_URL_ERROR,\n});\n\n// JSONSchema7 validation\nconst jsonSchema7Schema = z.custom<ExtendedJSONSchema7>(\n (val) => typeof val === \"object\" && val !== null,\n { message: \"Must be a valid JSON Schema object\" }\n);\n\n// UiSchema validation\nconst uiSchemaSchema = z.custom<UiSchema>((val) => typeof val === \"object\" && val !== null, {\n message: \"Must be a valid UiSchema object\",\n});\n\n// Handler schemas (per-action handlers for webhooks, triggers, etc.)\nconst webhookHandlerSchema = z.object({\n type: z.literal(\"webhook\"),\n url: handlerUrlSchema,\n headers: z.record(z.string(), z.string()),\n});\n\nconst triggerHandlerSchema = webhookHandlerSchema.extend({\n type: z.literal(\"trigger\"),\n tokenId: z.string().min(1),\n});\n\nconst handlerSchema = z.discriminatedUnion(\"type\", [webhookHandlerSchema, triggerHandlerSchema]);\n\n/** Action config without handlers — used for chat widgets and agent tool input. */\nexport const taskActionInputSchema = z.object({\n id: z.string().min(1),\n title: z.string().min(1),\n description: z.string().optional(),\n schema: jsonSchema7Schema.optional(),\n ui: uiSchemaSchema.optional(),\n data: z.record(z.string(), z.unknown()).optional(),\n});\n\n// Action schema with JSONSchema-based feedback and optional handlers\nconst taskActionSchema = taskActionInputSchema.extend({\n // Optional handlers for this action - if present, must have at least 1\n handlers: z.array(handlerSchema).min(1).optional(),\n});\n\n// UI Field Schema\nconst uiFieldSchemaSchema: z.ZodType<Record<string, unknown>> = z\n .object({\n \"ui:widget\": z.string().optional(),\n \"ui:title\": z.string().optional(),\n \"ui:description\": z.string().optional(),\n \"ui:options\": z.record(z.string(), z.unknown()).optional(),\n items: z.lazy(() => z.record(z.string(), uiFieldSchemaSchema)).optional(),\n })\n .passthrough();\n\n// Context UI Schema\nconst contextUiSchema = z.record(z.string(), uiFieldSchemaSchema).optional();\n\n// Context data schema\nconst contextDataSchema = z\n .object({\n data: z.record(z.string(), z.unknown()),\n ui: contextUiSchema,\n })\n .optional();\n\nexport const TASK_CONTEXT_FORMAT_VERSION = 2 as const;\nexport type TaskContextFormatVersion = typeof TASK_CONTEXT_FORMAT_VERSION;\n\n// Main TaskContext schema\nconst taskContextObjectBaseSchema = z.object({\n /** Source application id; omitted tasks are grouped in the default inbox. */\n app: z.string().min(1).optional(),\n type: z.string().min(1),\n name: z.string().min(1),\n description: z.string().optional(),\n validUntil: z.string().optional(),\n context: contextDataSchema,\n /** Task context wire format version. @default 2 */\n contextVersion: z.literal(2).optional(),\n /** @deprecated Use `contextVersion`. Accepted on ingest only. */\n version: z.literal(2).optional(),\n actions: z.array(taskActionSchema).min(1, \"At least one action is required\"),\n});\n\nfunction normalizeTaskContextVersion<T extends { contextVersion?: 2; version?: 2 }>(\n data: T\n): Omit<T, \"version\" | \"contextVersion\"> & { contextVersion: 2 } {\n const { version: legacyVersion, contextVersion, ...rest } = data;\n return {\n ...rest,\n contextVersion: contextVersion ?? legacyVersion ?? TASK_CONTEXT_FORMAT_VERSION,\n };\n}\n\nconst taskContextObjectSchema = taskContextObjectBaseSchema.transform(\n normalizeTaskContextVersion\n);\n\nfunction refineContextPublicUrls<T extends { context?: z.infer<typeof contextDataSchema> }>(\n data: T,\n ctx: z.RefinementCtx\n) {\n const error = validateContextPublicUrls(data.context);\n if (error) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: error,\n path: [\"context\"],\n });\n }\n}\n\nexport const taskContextSchema = taskContextObjectSchema.superRefine(\n refineContextPublicUrls\n);\n\n/**\n * Assignment targets at task create (not stored in task context JSON).\n * Unknown user emails are auto-provisioned as assignee memberships (count toward seat limits).\n */\nexport const assignToSchema = z\n .object({\n users: z.array(z.string().email()).optional(),\n groups: z.array(z.string().min(1)).optional(),\n })\n .refine(\n (data) => {\n const groups = data.groups ?? [];\n if (groups.includes(\"all\") && groups.length > 1) {\n return false;\n }\n return true;\n },\n { message: 'Cannot combine \"all\" with other group slugs' }\n );\n\n/** A short thread-scoped status update message (1-2 sentences). */\nexport const threadUpdateMessageSchema = z.string().min(1).max(500);\n\n/**\n * Lifecycle status carried by a thread update. Drives the icon and color shown\n * in the inbox status bar. Defaults to `info` when omitted.\n */\nexport const threadUpdateStatuses = [\n \"info\",\n \"queued\",\n \"running\",\n \"waiting\",\n \"succeeded\",\n \"failed\",\n \"cancelled\",\n] as const;\n\nexport const threadUpdateStatusSchema = z.enum(threadUpdateStatuses);\n\n/** The default status applied when an update omits one. */\nexport const DEFAULT_THREAD_UPDATE_STATUS: ThreadUpdateStatus = \"info\";\n\n/** Shared shape for a thread update (standalone and at task creation). */\nexport const threadUpdateInputSchema = z.object({\n message: threadUpdateMessageSchema,\n status: threadUpdateStatusSchema.optional(),\n});\n\n/** Thread priority levels for inbox ordering and display. */\nexport const taskPriorities = [\"low\", \"normal\", \"high\", \"urgent\"] as const;\n\nexport const taskPrioritySchema = z.enum(taskPriorities);\n\nexport type TaskPriority = (typeof taskPriorities)[number];\n\nexport const DEFAULT_TASK_PRIORITY: TaskPriority = \"normal\";\n\nexport const LOWEST_TASK_PRIORITY: TaskPriority = \"low\";\n\nexport const TASK_PRIORITY_RANK: Record<TaskPriority, number> = {\n low: 1,\n normal: 2,\n high: 3,\n urgent: 4,\n};\n\n/**\n * Agent release at task create (not shown in inbox reviewer UI).\n * Used for feedback analysis over deploys.\n */\nexport const agentTelemetrySchema = z.object({\n /** Agent or app version (semver, git SHA, deploy tag — caller-defined). */\n version: z.string().min(1),\n});\n\n/** POST /v1 body: task context plus optional assignment. */\nexport const createTaskBodySchema = taskContextObjectBaseSchema\n .extend({\n assignTo: assignToSchema.optional(),\n /**\n * Groups related tasks together. When omitted, the server generates one and\n * returns it so the caller can reuse it on later tasks in the same thread.\n */\n threadId: z.string().min(1).optional(),\n /**\n * Optional thread priority. When set, applies to the whole thread and\n * overwrites any previous priority. Omit on later tasks to leave unchanged.\n */\n priority: taskPrioritySchema.optional(),\n /**\n * Optional initial status update logged against the task's thread. Shows in\n * the inbox status bar and the thread update log.\n */\n update: threadUpdateInputSchema.optional(),\n /** Agent release version — not shown in inbox UI. */\n agent: agentTelemetrySchema.optional(),\n })\n .transform(normalizeTaskContextVersion)\n .superRefine(refineContextPublicUrls);\n\n/** POST /v1/threads/:threadId/updates body: a standalone thread update. */\nexport const threadUpdateBodySchema = threadUpdateInputSchema;\n\n/** Action widget config for a seeded assistant message (mirrors the `requestActionInput` tool input). */\nexport const agentChatSeedActionSchema = z.object({\n /** Stable action id echoed back on submit; auto-derived from title when omitted. */\n id: z.string().min(1).optional(),\n title: z.string().min(1),\n description: z.string().optional(),\n /** JSON Schema object for the form fields. */\n schema: z.record(z.string(), z.unknown()).optional(),\n /** RJSF ui schema overrides (ui:widget, ui:enumNames, etc.). */\n ui: z.record(z.string(), z.unknown()).optional(),\n /** Optional default field values. */\n data: z.record(z.string(), z.unknown()).optional(),\n});\n\n/** A single pre-seeded chat message injected into a programmatic agent chat. */\nexport const agentChatSeedMessageSchema = z.object({\n role: z.enum([\"user\", \"assistant\"]),\n text: z.string().min(1),\n /** Optional display-name override for the message sender. */\n senderName: z.string().min(1).optional(),\n /**\n * Optional structured input request rendered as a styled RobotRock action\n * widget below the message text. Use this instead of asking the user to reply\n * in plain text so the request is always a proper action form.\n */\n requestActionInput: z\n .object({\n prompt: z.string().optional(),\n action: agentChatSeedActionSchema,\n })\n .optional(),\n});\n\n/**\n * POST /v1/agent-chats body: create + assign one or more agent chat sessions.\n * Either `agentIdentifier` (new chat) or `parentChatId` (spawned from a chat) is required.\n */\nconst eveAgentChatTransportSchema = z.object({\n kind: z.literal(\"eve\"),\n chatId: z.string().min(1),\n baseUrl: z.string().url(),\n sessionId: z.string().optional(),\n continuationToken: z.string().optional(),\n streamIndex: z.number().int().nonnegative().optional(),\n isStreaming: z.boolean().optional(),\n});\n\nexport const createAgentChatBodySchema = z\n .object({\n /** Agent id (eve agent name). Required unless `parentChatId` is set. */\n agentIdentifier: z.string().min(1).optional(),\n /** Inherit tenant/connection/agent from an existing chat (agent-spawned chats). */\n parentChatId: z.string().min(1).optional(),\n /** Convex tenantEveConnections id; resolved from the tenant when omitted. */\n eveConnectionId: z.string().min(1).optional(),\n /** Source application id; groups the chat under an inbox section. */\n app: z.string().min(1).optional(),\n assignTo: assignToSchema.optional(),\n title: z.string().min(1),\n messages: z.array(agentChatSeedMessageSchema).default([]),\n /** Provenance label stored on the session (\"cron\" | \"agent\" | ...). */\n source: z.string().min(1).optional(),\n })\n .refine((data) => Boolean(data.agentIdentifier || data.parentChatId), {\n message: \"Provide either agentIdentifier or parentChatId\",\n });\n\n/** POST /v1/agent-chats/transport body: persist live-chat cursor for the browser. */\nexport const agentChatTransportBodySchema = eveAgentChatTransportSchema;\n\n/** POST /v1/agent-chats/audit-input body: log Eve HITL choices from agent hooks. */\nexport const agentChatAuditInputBodySchema = z.object({\n eveSessionId: z.string().min(1),\n userId: z.string().min(1),\n actionId: z.string().min(1),\n actionTitle: z.string().optional(),\n prompt: z.string().optional(),\n data: z.record(z.string(), z.unknown()).optional(),\n idempotencyKey: z.string().optional(),\n /** Eve input request id — used to merge staged HITL metadata. */\n requestId: z.string().optional(),\n /** Eve tool call id — fallback lookup for staged HITL metadata. */\n toolCallId: z.string().optional(),\n});\n\nconst eveHitlStagedOptionSchema = z.object({\n id: z.string(),\n label: z.string(),\n});\n\n/** POST /v1/agent-chats/stage-hitl body: persist pending Eve HITL requests on the chat. */\nexport const agentChatStageHitlBodySchema = z.object({\n eveSessionId: z.string().min(1),\n requests: z.array(\n z.object({\n requestId: z.string().min(1),\n toolCallId: z.string().min(1),\n toolName: z.string().min(1),\n prompt: z.string().min(1),\n display: z.enum([\"confirmation\", \"select\", \"text\"]).optional(),\n allowFreeform: z.boolean().optional(),\n options: z.array(eveHitlStagedOptionSchema).optional(),\n toolInput: z.record(z.string(), z.unknown()).optional(),\n })\n ),\n});\n\n/** POST /v1/agent-chats/link-task body: associate an inbox task with an Eve chat session. */\nexport const agentChatLinkTaskBodySchema = z.object({\n eveSessionId: z.string().min(1),\n publicTaskId: z.string().min(1),\n toolCallId: z.string().min(1),\n});\n\n/** Where a thread update originated. */\nexport type ThreadUpdateSource = \"api\" | \"task_create\" | \"dashboard\";\n\n/** Lifecycle status carried by a thread update. */\nexport type ThreadUpdateStatus = (typeof threadUpdateStatuses)[number];\n\n/** A logged thread update as returned by the API. */\nexport interface ThreadUpdate {\n id: string;\n threadId: string;\n message: string;\n status: ThreadUpdateStatus;\n source: ThreadUpdateSource;\n createdAt: number;\n}\n\n// Type exports\nexport type AssignToInput = z.infer<typeof assignToSchema>;\nexport type CreateTaskBodyInput = z.input<typeof createTaskBodySchema>;\nexport type CreateTaskBody = z.output<typeof createTaskBodySchema>;\nexport type ThreadUpdateBodyInput = z.input<typeof threadUpdateBodySchema>;\nexport type ThreadUpdateBody = z.output<typeof threadUpdateBodySchema>;\nexport type ThreadUpdateInput = z.input<typeof threadUpdateInputSchema>;\nexport type AgentChatSeedAction = z.output<typeof agentChatSeedActionSchema>;\nexport type AgentChatSeedMessage = z.output<typeof agentChatSeedMessageSchema>;\nexport type CreateAgentChatBodyInput = z.input<typeof createAgentChatBodySchema>;\nexport type CreateAgentChatBody = z.output<typeof createAgentChatBodySchema>;\nexport type AgentChatTransportBody = z.output<typeof agentChatTransportBodySchema>;\nexport type AgentChatAuditInputBody = z.output<typeof agentChatAuditInputBodySchema>;\nexport type AgentChatStageHitlBody = z.output<typeof agentChatStageHitlBodySchema>;\nexport type AgentChatLinkTaskBody = z.output<typeof agentChatLinkTaskBodySchema>;\nexport type TaskContextInput = z.input<typeof taskContextSchema>;\nexport type TaskContextOutput = z.output<typeof taskContextSchema>;\nexport type TaskContext = TaskContextOutput;\nexport type SafeUrl = z.infer<typeof safeUrlSchema>;\nexport type TaskActionInput = z.infer<typeof taskActionInputSchema>;\nexport type TaskAction = z.infer<typeof taskActionSchema>;\nexport type WebhookHandler = z.infer<typeof webhookHandlerSchema>;\nexport type TriggerHandler = z.infer<typeof triggerHandlerSchema>;\nexport type Handler = z.infer<typeof handlerSchema>;\nexport type ContextData = z.infer<typeof contextDataSchema>;\nexport type ContextUiSchema = z.infer<typeof contextUiSchema>;\nexport type UiFieldSchema = z.infer<typeof uiFieldSchemaSchema>;\nexport type AgentTelemetry = z.infer<typeof agentTelemetrySchema>;\nexport type AgentTelemetryInput = z.input<typeof agentTelemetrySchema>;\n","import { isPublicHttpUrl, PUBLIC_HTTP_URL_ERROR } from \"../utils/safe-url\";\n\ntype ContextInput = {\n data?: Record<string, unknown>;\n ui?: Record<string, unknown>;\n};\n\nfunction resolveLinkUrl(value: string): string {\n return value.startsWith(\"http://\") || value.startsWith(\"https://\")\n ? value\n : `https://${value}`;\n}\n\nfunction widgetType(\n ui: Record<string, unknown> | undefined,\n field: string\n): string | undefined {\n const fieldUi = ui?.[field];\n if (typeof fieldUi !== \"object\" || fieldUi === null) {\n return undefined;\n }\n const widget = (fieldUi as Record<string, unknown>)[\"ui:widget\"];\n return typeof widget === \"string\" ? widget : undefined;\n}\n\nfunction validateUrlValue(value: unknown, widget: string): string | null {\n if (widget === \"image\" || widget === \"link\") {\n if (typeof value !== \"string\") {\n return PUBLIC_HTTP_URL_ERROR;\n }\n const url = widget === \"link\" ? resolveLinkUrl(value) : value;\n if (!isPublicHttpUrl(url)) {\n return PUBLIC_HTTP_URL_ERROR;\n }\n return null;\n }\n\n if (widget === \"attachments\" && Array.isArray(value)) {\n for (const item of value) {\n if (typeof item !== \"object\" || item === null) {\n continue;\n }\n const url = (item as { url?: unknown }).url;\n if (typeof url === \"string\" && !isPublicHttpUrl(resolveLinkUrl(url))) {\n return PUBLIC_HTTP_URL_ERROR;\n }\n }\n }\n\n return null;\n}\n\n/**\n * Validates URL-bearing context widget values (image, link, attachments).\n * Returns an error message or null when valid.\n */\nexport function validateContextPublicUrls(\n context: ContextInput | undefined\n): string | null {\n if (!context?.data) {\n return null;\n }\n\n for (const [field, value] of Object.entries(context.data)) {\n const widget = widgetType(context.ui, field);\n if (!widget) {\n continue;\n }\n const error = validateUrlValue(value, widget);\n if (error) {\n return `context.data.${field}: ${error}`;\n }\n }\n\n return null;\n}\n"],"mappings":";AAAA,SAAS,KAAAA,UAAS;;;ACAlB,IAAM,oBAAoB,oBAAI,IAAI;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,SAAS,kBAAkB,UAA0B;AACnD,SAAO,SAAS,YAAY,EAAE,QAAQ,YAAY,EAAE;AACtD;AAEA,SAAS,cAAc,MAAuB;AAC5C,QAAM,QAAQ,+CAA+C,KAAK,IAAI;AACtE,MAAI,CAAC,OAAO;AACV,WAAO;AAAA,EACT;AAEA,QAAM,SAAS,MAAM,MAAM,GAAG,CAAC,EAAE,IAAI,CAAC,SAAS,OAAO,IAAI,CAAC;AAC3D,MAAI,OAAO,KAAK,CAAC,UAAU,OAAO,MAAM,KAAK,KAAK,QAAQ,KAAK,QAAQ,GAAG,GAAG;AAC3E,WAAO;AAAA,EACT;AAEA,QAAM,CAAC,GAAG,GAAG,IAAI,EAAE,IAAI;AACvB,MAAI,MAAM,UAAa,MAAM,QAAW;AACtC,WAAO;AAAA,EACT;AACA,MAAI,MAAM,OAAO,MAAM,EAAG,QAAO;AACj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A,EAAE,SAAS,8CAA8C;AAC3D;AAGK,IAAMkB,6BAA4BlB,GAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAM3D,IAAMmB,wBAAuB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAMC,4BAA2BpB,GAAE,KAAKmB,qBAAoB;AAG5D,IAAM,+BAAmD;AAGzD,IAAME,2BAA0BrB,GAAE,OAAO;AAAA,EAC9C,SAASkB;AAAA,EACT,QAAQE,0BAAyB,SAAS;AAC5C,CAAC;AAGM,IAAME,kBAAiB,CAAC,OAAO,UAAU,QAAQ,QAAQ;AAEzD,IAAMC,sBAAqBvB,GAAE,KAAKsB,eAAc;AAIhD,IAAM,wBAAsC;AAE5C,IAAM,uBAAqC;AAE3C,IAAM,qBAAmD;AAAA,EAC9D,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AACV;AAEO,IAAME,wBAAuBxB,GAAE,OAAO;AAAA,EAC3C,SAASA,GAAE,OAAO,EAAE,IAAI,CAAC;AAC3B,CAAC;AAEM,IAAMyB,wBAAuBb,6BACjC,OAAO;AAAA,EACN,UAAUK,gBAAe,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,EAKlC,UAAUjB,GAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,EAKrC,UAAUuB,oBAAmB,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,EAKtC,QAAQF,yBAAwB,SAAS;AAAA,EACzC,OAAOG,sBAAqB,SAAS;AACvC,CAAC,EACA,UAAUX,4BAA2B,EACrC,YAAYE,wBAAuB;AAG/B,IAAM,yBAAyBM;","names":["z","handlerUrlSchema","z","jsonSchema7Schema","uiSchemaSchema","webhookHandlerSchema","triggerHandlerSchema","handlerSchema","taskActionInputSchema","taskActionSchema","uiFieldSchemaSchema","contextUiSchema","contextDataSchema","TASK_CONTEXT_FORMAT_VERSION","taskContextObjectBaseSchema","normalizeTaskContextVersion","taskContextObjectSchema","refineContextPublicUrls","taskContextSchema","assignToSchema","threadUpdateMessageSchema","threadUpdateStatuses","threadUpdateStatusSchema","threadUpdateInputSchema","taskPriorities","taskPrioritySchema","agentTelemetrySchema","createTaskBodySchema"]}
1
+ {"version":3,"sources":["../../src/schemas/index.ts","../../../core/src/utils/safe-url.ts","../../../core/src/schemas/task.ts","../../../core/src/schemas/context-urls.ts","../../../core/src/schemas/tool-result-display.ts","../../../core/src/schemas/agent-admin.ts"],"sourcesContent":["import { z } from \"zod\";\nimport {\n isAllowedHandlerUrl,\n HANDLER_URL_ERROR,\n} from \"@robotrock/core/utils\";\nimport { validateContextPublicUrls } from \"@robotrock/core/schemas\";\n\nexport interface JSONSchema7 {\n $id?: string;\n $ref?: string;\n $schema?: string;\n $comment?: string;\n type?: JSONSchema7TypeName | JSONSchema7TypeName[];\n enum?: unknown[];\n const?: unknown;\n multipleOf?: number;\n maximum?: number;\n exclusiveMaximum?: number;\n minimum?: number;\n exclusiveMinimum?: number;\n maxLength?: number;\n minLength?: number;\n pattern?: string;\n format?: string;\n items?: JSONSchema7 | JSONSchema7[];\n additionalItems?: JSONSchema7 | boolean;\n maxItems?: number;\n minItems?: number;\n uniqueItems?: boolean;\n contains?: JSONSchema7;\n maxProperties?: number;\n minProperties?: number;\n required?: string[];\n properties?: Record<string, JSONSchema7>;\n patternProperties?: Record<string, JSONSchema7>;\n additionalProperties?: JSONSchema7 | boolean;\n dependencies?: Record<string, JSONSchema7 | string[]>;\n propertyNames?: JSONSchema7;\n if?: JSONSchema7;\n then?: JSONSchema7;\n else?: JSONSchema7;\n allOf?: JSONSchema7[];\n anyOf?: JSONSchema7[];\n oneOf?: JSONSchema7[];\n not?: JSONSchema7;\n title?: string;\n description?: string;\n default?: unknown;\n readOnly?: boolean;\n writeOnly?: boolean;\n examples?: unknown[];\n}\n\nexport type JSONSchema7TypeName =\n | \"string\"\n | \"number\"\n | \"integer\"\n | \"boolean\"\n | \"object\"\n | \"array\"\n | \"null\";\n\nexport type ExtendedJSONSchema7 = JSONSchema7 & {\n enumNames?: string[];\n [key: string]: unknown;\n};\n\nexport type UiSchema = {\n \"ui:widget\"?: string;\n \"ui:title\"?: string;\n \"ui:description\"?: string;\n \"ui:placeholder\"?: string;\n \"ui:options\"?: Record<string, unknown>;\n [key: string]: unknown;\n};\n\nconst handlerUrlSchema = z.string().refine((url) => isAllowedHandlerUrl(url), {\n message: HANDLER_URL_ERROR,\n});\n\nconst jsonSchema7Schema = z.custom<ExtendedJSONSchema7>(\n (val) => typeof val === \"object\" && val !== null,\n { message: \"Must be a valid JSON Schema object\" }\n);\n\nconst uiSchemaSchema = z.custom<UiSchema>((val) => typeof val === \"object\" && val !== null, {\n message: \"Must be a valid UiSchema object\",\n});\n\nconst webhookHandlerSchema = z.object({\n type: z.literal(\"webhook\"),\n url: handlerUrlSchema,\n headers: z.record(z.string(), z.string()),\n});\n\nconst triggerHandlerSchema = webhookHandlerSchema.extend({\n type: z.literal(\"trigger\"),\n tokenId: z.string().min(1),\n});\n\nconst handlerSchema = z.discriminatedUnion(\"type\", [webhookHandlerSchema, triggerHandlerSchema]);\n\n/** Action config without handlers — used for chat widgets and agent tool input. */\nexport const taskActionInputSchema = z.object({\n id: z.string().min(1),\n title: z.string().min(1),\n description: z.string().optional(),\n schema: jsonSchema7Schema.optional(),\n ui: uiSchemaSchema.optional(),\n data: z.record(z.string(), z.unknown()).optional(),\n});\n\nconst taskActionSchema = taskActionInputSchema.extend({\n handlers: z.array(handlerSchema).min(1).optional(),\n});\n\nconst uiFieldSchemaSchema: z.ZodType<Record<string, unknown>> = z\n .object({\n \"ui:widget\": z.string().optional(),\n \"ui:title\": z.string().optional(),\n \"ui:description\": z.string().optional(),\n \"ui:options\": z.record(z.string(), z.unknown()).optional(),\n items: z.lazy(() => z.record(z.string(), uiFieldSchemaSchema)).optional(),\n })\n .passthrough();\n\nconst contextUiSchema = z.record(z.string(), uiFieldSchemaSchema).optional();\n\nconst contextDataSchema = z\n .object({\n data: z.record(z.string(), z.unknown()),\n ui: contextUiSchema,\n })\n .optional();\n\n/** Task context wire format version (always `2` today). */\nexport const TASK_CONTEXT_FORMAT_VERSION = 2 as const;\nexport type TaskContextFormatVersion = typeof TASK_CONTEXT_FORMAT_VERSION;\n\nconst taskContextObjectBaseSchema = z.object({\n app: z.string().min(1).optional(),\n type: z.string().min(1),\n name: z.string().min(1),\n description: z.string().optional(),\n validUntil: z.string().optional(),\n context: contextDataSchema,\n contextVersion: z.literal(2).optional(),\n /** @deprecated Use `contextVersion`. Accepted on ingest only. */\n version: z.literal(2).optional(),\n actions: z.array(taskActionSchema).min(1, \"At least one action is required\"),\n});\n\nfunction normalizeTaskContextVersion<T extends { contextVersion?: 2; version?: 2 }>(\n data: T\n): Omit<T, \"version\" | \"contextVersion\"> & { contextVersion: 2 } {\n const { version: legacyVersion, contextVersion, ...rest } = data;\n return {\n ...rest,\n contextVersion: contextVersion ?? legacyVersion ?? TASK_CONTEXT_FORMAT_VERSION,\n };\n}\n\nconst taskContextObjectSchema = taskContextObjectBaseSchema.transform(\n normalizeTaskContextVersion\n);\n\nfunction refineContextPublicUrls<T extends { context?: z.infer<typeof contextDataSchema> }>(\n data: T,\n ctx: z.RefinementCtx\n) {\n const error = validateContextPublicUrls(data.context);\n if (error) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: error,\n path: [\"context\"],\n });\n }\n}\n\nexport const taskContextSchema = taskContextObjectSchema.superRefine(\n refineContextPublicUrls\n);\n\n/**\n * Assignment targets at task create (not stored in task context JSON).\n * Unknown user emails are auto-provisioned as assignee memberships (count toward seat limits).\n *\n * Virtual group slugs (membership derived from tenantUsers, not groupMembers):\n * - `all` — all workspace members (omit assignTo defaults to this)\n * - `admins` — workspace users with tenant admin role\n */\nexport const VIRTUAL_ASSIGN_TO_GROUP_SLUGS = [\"all\", \"admins\"] as const;\n\nexport const assignToSchema = z\n .object({\n users: z.array(z.string().email()).optional(),\n groups: z.array(z.string().min(1)).optional(),\n })\n .refine(\n (data) => {\n const groups = data.groups ?? [];\n if (groups.includes(\"all\") && groups.length > 1) {\n return false;\n }\n return true;\n },\n { message: 'Cannot combine \"all\" with other group slugs' }\n );\n\n/** A short thread-scoped status update message (1-2 sentences). */\nexport const threadUpdateMessageSchema = z.string().min(1).max(500);\n\n/**\n * Lifecycle status carried by a thread update. Drives the icon and color shown\n * in the inbox status bar. Defaults to `info` when omitted.\n */\nexport const threadUpdateStatuses = [\n \"info\",\n \"queued\",\n \"running\",\n \"waiting\",\n \"succeeded\",\n \"failed\",\n \"cancelled\",\n] as const;\n\nexport const threadUpdateStatusSchema = z.enum(threadUpdateStatuses);\n\n/** The default status applied when an update omits one. */\nexport const DEFAULT_THREAD_UPDATE_STATUS: ThreadUpdateStatus = \"info\";\n\n/** Shared shape for a thread update (standalone and at task creation). */\nexport const threadUpdateInputSchema = z.object({\n message: threadUpdateMessageSchema,\n status: threadUpdateStatusSchema.optional(),\n});\n\n/** Thread priority levels for inbox ordering and display. */\nexport const taskPriorities = [\"low\", \"normal\", \"high\", \"urgent\"] as const;\n\nexport const taskPrioritySchema = z.enum(taskPriorities);\n\nexport type TaskPriority = (typeof taskPriorities)[number];\n\nexport const DEFAULT_TASK_PRIORITY: TaskPriority = \"normal\";\n\nexport const LOWEST_TASK_PRIORITY: TaskPriority = \"low\";\n\nexport const TASK_PRIORITY_RANK: Record<TaskPriority, number> = {\n low: 1,\n normal: 2,\n high: 3,\n urgent: 4,\n};\n\nexport const agentTelemetrySchema = z.object({\n version: z.string().min(1),\n});\n\nexport const createTaskBodySchema = taskContextObjectBaseSchema\n .extend({\n assignTo: assignToSchema.optional(),\n /**\n * Groups related tasks together. When omitted, the server generates one and\n * returns it so the caller can reuse it on later tasks in the same thread.\n */\n threadId: z.string().min(1).optional(),\n /**\n * Optional thread priority. When set, applies to the whole thread and\n * overwrites any previous priority. Omit on later tasks to leave unchanged.\n */\n priority: taskPrioritySchema.optional(),\n /**\n * Optional initial status update logged against the task's thread. Shows in\n * the inbox status bar and the thread update log.\n */\n update: threadUpdateInputSchema.optional(),\n agent: agentTelemetrySchema.optional(),\n })\n .transform(normalizeTaskContextVersion)\n .superRefine(refineContextPublicUrls);\n\n/** POST /v1/threads/:threadId/updates body: a standalone thread update. */\nexport const threadUpdateBodySchema = threadUpdateInputSchema;\n\n/** Where a thread update originated. */\nexport type ThreadUpdateSource = \"api\" | \"task_create\" | \"dashboard\";\n\n/** Lifecycle status carried by a thread update. */\nexport type ThreadUpdateStatus = (typeof threadUpdateStatuses)[number];\n\n/** A logged thread update as returned by the API. */\nexport interface ThreadUpdate {\n id: string;\n threadId: string;\n message: string;\n status: ThreadUpdateStatus;\n source: ThreadUpdateSource;\n createdAt: number;\n}\n\nexport type AssignToInput = z.infer<typeof assignToSchema>;\nexport type CreateTaskBodyInput = z.input<typeof createTaskBodySchema>;\nexport type CreateTaskBody = z.output<typeof createTaskBodySchema>;\nexport type ThreadUpdateBodyInput = z.input<typeof threadUpdateBodySchema>;\nexport type ThreadUpdateBody = z.output<typeof threadUpdateBodySchema>;\nexport type ThreadUpdateInput = z.input<typeof threadUpdateInputSchema>;\nexport type TaskContextInput = z.input<typeof taskContextSchema>;\nexport type TaskContextOutput = z.output<typeof taskContextSchema>;\nexport type TaskContext = TaskContextOutput;\nexport type TaskActionInput = z.infer<typeof taskActionInputSchema>;\nexport type TaskAction = z.infer<typeof taskActionSchema>;\nexport type WebhookHandler = z.infer<typeof webhookHandlerSchema>;\nexport type TriggerHandler = z.infer<typeof triggerHandlerSchema>;\nexport type Handler = z.infer<typeof handlerSchema>;\nexport type AgentTelemetry = z.infer<typeof agentTelemetrySchema>;\nexport type AgentTelemetryInput = z.input<typeof agentTelemetrySchema>;\n\ntype InferObjectProperties<\n Props,\n Req extends PropertyKey,\n> = Props extends Record<string, unknown>\n ? ({\n [K in keyof Props as K extends Req ? K : never]-?: InferJsonSchema7<Props[K]>;\n } & {\n [K in keyof Props as K extends Req ? never : K]?: InferJsonSchema7<Props[K]>;\n } extends infer O\n ? { [K in keyof O]: O[K] }\n : never)\n : Record<string, unknown>;\n\ntype RequiredKeys<S> =\n S extends { readonly required: readonly string[] } ? S[\"required\"][number] : never;\n\nexport type InferJsonSchema7<S> = [S] extends [undefined]\n ? Record<string, never>\n : S extends { readonly const: infer C }\n ? C\n : S extends {\n readonly enum: readonly (infer E)[];\n }\n ? E\n : S extends {\n readonly type: \"object\";\n readonly properties?: infer Props;\n }\n ? InferObjectProperties<Props, RequiredKeys<S>>\n : S extends {\n readonly type: \"object\";\n readonly properties?: undefined;\n }\n ? Record<string, unknown>\n : S extends {\n readonly type: \"array\";\n readonly items?: infer Items;\n }\n ? Items extends readonly unknown[]\n ? InferJsonSchema7<Items[number]>[]\n : Items extends object\n ? InferJsonSchema7<Items>[]\n : unknown[]\n : S extends { readonly type: \"string\" }\n ? string\n : S extends { readonly type: \"number\" } | { readonly type: \"integer\" }\n ? number\n : S extends { readonly type: \"boolean\" }\n ? boolean\n : unknown;\n\nexport type TaskStatus = \"pending\" | \"open\" | \"handled\" | \"expired\";\n\nexport interface TaskResponse {\n success: boolean;\n task: {\n taskId: string;\n threadId: string;\n status: \"pending\" | \"open\";\n context: TaskContext;\n validUntil: string;\n submittedAt: string;\n };\n message: string;\n}\n\nexport interface ThreadUpdateResponse {\n success: boolean;\n update: ThreadUpdate;\n message: string;\n}\n\nexport interface Task {\n id: string;\n threadId?: string;\n createdAt: Date;\n status: TaskStatus;\n context: TaskContext;\n validUntil: number;\n handledAt?: number;\n handled?: {\n action: {\n id: string;\n data: unknown;\n };\n handledBy?: string;\n userId?: string;\n token?: string;\n };\n}\n\nexport type InferActionData<T extends { schema?: unknown }> = [\n Exclude<T[\"schema\"], undefined>,\n] extends [\n never,\n]\n ? Record<string, never>\n : Exclude<T[\"schema\"], undefined> extends infer S\n ? InferJsonSchema7<S>\n : Record<string, never>;\n\nexport type TupleElementIndices<T extends readonly unknown[]> = T extends readonly [\n unknown,\n ...unknown[],\n]\n ? Exclude<keyof T, keyof unknown[]>\n : number;\n\nexport interface TaskResult<T = Record<string, unknown>> {\n actionId: string;\n data: T;\n handledBy?: string;\n handledAt: Date;\n}\n\nexport interface ApprovalResult<T = Record<string, unknown>> extends TaskResult<T> {\n taskId: string;\n}\n\nexport type DiscriminatedApprovalResult<\n TActions extends readonly { id: string; schema?: unknown }[],\n> = {\n [I in TupleElementIndices<TActions>]: TActions[I] extends { id: string; schema?: unknown }\n ? Omit<ApprovalResult<InferActionData<TActions[I]>>, \"actionId\" | \"data\"> & {\n actionId: TActions[I][\"id\"];\n data: InferActionData<TActions[I]>;\n }\n : never\n}[TupleElementIndices<TActions>];\n","const BLOCKED_HOSTNAMES = new Set([\n \"localhost\",\n \"metadata.google.internal\",\n \"metadata.goog\",\n]);\n\nfunction normalizeHostname(hostname: string): string {\n return hostname.toLowerCase().replace(/^\\[|\\]$/g, \"\");\n}\n\nfunction isBlockedIpv4(host: string): boolean {\n const match = /^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$/.exec(host);\n if (!match) {\n return false;\n }\n\n const octets = match.slice(1, 5).map((part) => Number(part));\n if (octets.some((octet) => Number.isNaN(octet) || octet < 0 || octet > 255)) {\n return true;\n }\n\n const [a, b, _c, _d] = octets;\n if (a === undefined || b === undefined) {\n return true;\n }\n if (a === 127 || a === 0) return true;\n if (a === 10) return true;\n if (a === 169 && b === 254) return true;\n if (a === 192 && b === 168) return true;\n if (a === 172 && b >= 16 && b <= 31) return true;\n if (a === 100 && b >= 64 && b <= 127) return true;\n\n return false;\n}\n\nfunction ipv4FromNumericHost(host: string): string | null {\n if (/^\\d+$/.test(host)) {\n const num = Number(host);\n if (!Number.isFinite(num) || num < 0 || num > 0xffffffff) {\n return null;\n }\n const a = (num >>> 24) & 0xff;\n const b = (num >>> 16) & 0xff;\n const c = (num >>> 8) & 0xff;\n const d = num & 0xff;\n return `${a}.${b}.${c}.${d}`;\n }\n\n const hexMatch = /^0x([0-9a-f]{1,8})$/i.exec(host);\n if (hexMatch) {\n const num = Number.parseInt(hexMatch[1]!, 16);\n if (!Number.isFinite(num) || num < 0 || num > 0xffffffff) {\n return null;\n }\n const a = (num >>> 24) & 0xff;\n const b = (num >>> 16) & 0xff;\n const c = (num >>> 8) & 0xff;\n const d = num & 0xff;\n return `${a}.${b}.${c}.${d}`;\n }\n\n return null;\n}\n\nfunction isBlockedIpv4Mapped(host: string): boolean {\n const mappedDotted = /^::ffff:(\\d{1,3}(?:\\.\\d{1,3}){3})$/i.exec(host);\n if (mappedDotted) {\n return isBlockedIpv4(mappedDotted[1]!);\n }\n\n const mappedHex = /^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/i.exec(host);\n if (mappedHex) {\n const high = Number.parseInt(mappedHex[1]!, 16);\n const low = Number.parseInt(mappedHex[2]!, 16);\n if (Number.isFinite(high) && Number.isFinite(low)) {\n const a = (high >> 8) & 0xff;\n const b = high & 0xff;\n const c = (low >> 8) & 0xff;\n const d = low & 0xff;\n return isBlockedIpv4(`${a}.${b}.${c}.${d}`);\n }\n }\n\n return false;\n}\n\nfunction isBlockedIpv6(host: string): boolean {\n if (host === \"::1\" || host === \"0:0:0:0:0:0:0:1\") {\n return true;\n }\n if (host.startsWith(\"fc\") || host.startsWith(\"fd\")) {\n return true;\n }\n if (host.startsWith(\"fe80:\")) {\n return true;\n }\n if (isBlockedIpv4Mapped(host)) {\n return true;\n }\n return false;\n}\n\nfunction isBlockedHostname(hostname: string): boolean {\n const host = normalizeHostname(hostname);\n if (!host) {\n return true;\n }\n if (BLOCKED_HOSTNAMES.has(host)) {\n return true;\n }\n if (host.endsWith(\".localhost\") || host.endsWith(\".local\")) {\n return true;\n }\n\n const numericIpv4 = ipv4FromNumericHost(host);\n if (numericIpv4 && isBlockedIpv4(numericIpv4)) {\n return true;\n }\n\n return isBlockedIpv4(host) || isBlockedIpv6(host);\n}\n\n/**\n * True when a handler URL targets the local machine. Convex cloud cannot POST\n * these directly; loopback deliveries are queued in Redis and drained by a local\n * worker (see apps/api handler-outbound).\n */\nexport function isLoopbackHandlerUrl(urlString: string): boolean {\n let url: URL;\n try {\n url = new URL(urlString);\n } catch {\n return false;\n }\n\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") {\n return false;\n }\n if (url.username || url.password) {\n return false;\n }\n\n const host = url.hostname.toLowerCase();\n return (\n host === \"localhost\" ||\n host === \"127.0.0.1\" ||\n host === \"::1\" ||\n host === \"[::1]\" ||\n host.endsWith(\".localhost\")\n );\n}\n\n/**\n * Webhook/trigger handler URLs may target a public host or loopback (local dev).\n */\nexport function isAllowedHandlerUrl(urlString: string): boolean {\n return isPublicHttpUrl(urlString) || isLoopbackHandlerUrl(urlString);\n}\n\n/**\n * Returns true when the URL uses http(s) and targets a public, non-reserved host.\n */\nexport function isPublicHttpUrl(urlString: string): boolean {\n let url: URL;\n try {\n url = new URL(urlString);\n } catch {\n return false;\n }\n\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") {\n return false;\n }\n if (url.username || url.password) {\n return false;\n }\n\n return !isBlockedHostname(url.hostname);\n}\n\nexport const PUBLIC_HTTP_URL_ERROR =\n \"URL must be a public http:// or https:// address\";\n\nexport const HANDLER_URL_ERROR =\n \"Handler URL must be a public or loopback http:// or https:// address\";\n\nconst FORBIDDEN_HANDLER_HEADERS = new Set([\n \"host\",\n \"connection\",\n \"content-length\",\n \"transfer-encoding\",\n \"te\",\n \"trailer\",\n \"upgrade\",\n \"proxy-authorization\",\n \"proxy-connection\",\n \"keep-alive\",\n \"x-robotrock-signature\",\n \"x-robotrock-delivery-id\",\n \"x-robotrock-delivery-attempt\",\n]);\n\n/**\n * Allow only safe custom webhook headers; blocks overrides of delivery metadata.\n */\nexport function filterHandlerHeaders(\n headers: Record<string, string> | undefined\n): Record<string, string> {\n if (!headers) {\n return {};\n }\n\n const filtered: Record<string, string> = {};\n for (const [rawKey, value] of Object.entries(headers)) {\n const key = rawKey.toLowerCase().trim();\n if (!key || FORBIDDEN_HANDLER_HEADERS.has(key)) {\n continue;\n }\n if (!/^[a-z0-9][a-z0-9._-]*$/.test(key)) {\n continue;\n }\n filtered[key] = value;\n }\n return filtered;\n}\n","import { z } from \"zod\";\nimport {\n isAllowedHandlerUrl,\n isPublicHttpUrl,\n HANDLER_URL_ERROR,\n PUBLIC_HTTP_URL_ERROR,\n} from \"../utils/safe-url\";\nimport { validateContextPublicUrls } from \"./context-urls\";\nimport type { JSONSchema7 } from \"./json-schema\";\n\n/**\n * Extended JSONSchema7 type that includes RJSF extensions like enumNames\n */\nexport type ExtendedJSONSchema7 = JSONSchema7 & {\n enumNames?: string[];\n [key: string]: unknown;\n};\n\n/**\n * UI Schema for RJSF form customization\n */\nexport type UiSchema = {\n \"ui:widget\"?: string;\n \"ui:title\"?: string;\n \"ui:description\"?: string;\n \"ui:placeholder\"?: string;\n \"ui:options\"?: Record<string, unknown>;\n [key: string]: unknown;\n};\n\n// Helper schemas\nexport const safeUrlSchema = z.string().refine((url) => isPublicHttpUrl(url), {\n message: PUBLIC_HTTP_URL_ERROR,\n});\n\nconst handlerUrlSchema = z.string().refine((url) => isAllowedHandlerUrl(url), {\n message: HANDLER_URL_ERROR,\n});\n\n// JSONSchema7 validation\nconst jsonSchema7Schema = z.custom<ExtendedJSONSchema7>(\n (val) => typeof val === \"object\" && val !== null,\n { message: \"Must be a valid JSON Schema object\" }\n);\n\n// UiSchema validation\nconst uiSchemaSchema = z.custom<UiSchema>((val) => typeof val === \"object\" && val !== null, {\n message: \"Must be a valid UiSchema object\",\n});\n\n// Handler schemas (per-action handlers for webhooks, triggers, etc.)\nconst webhookHandlerSchema = z.object({\n type: z.literal(\"webhook\"),\n url: handlerUrlSchema,\n headers: z.record(z.string(), z.string()),\n});\n\nconst triggerHandlerSchema = webhookHandlerSchema.extend({\n type: z.literal(\"trigger\"),\n tokenId: z.string().min(1),\n});\n\nconst handlerSchema = z.discriminatedUnion(\"type\", [webhookHandlerSchema, triggerHandlerSchema]);\n\n/** Action config without handlers — used for chat widgets and agent tool input. */\nexport const taskActionInputSchema = z.object({\n id: z.string().min(1),\n title: z.string().min(1),\n description: z.string().optional(),\n schema: jsonSchema7Schema.optional(),\n ui: uiSchemaSchema.optional(),\n data: z.record(z.string(), z.unknown()).optional(),\n});\n\n// Action schema with JSONSchema-based feedback and optional handlers\nconst taskActionSchema = taskActionInputSchema.extend({\n // Optional handlers for this action - if present, must have at least 1\n handlers: z.array(handlerSchema).min(1).optional(),\n});\n\n// UI Field Schema\nconst uiFieldSchemaSchema: z.ZodType<Record<string, unknown>> = z\n .object({\n \"ui:widget\": z.string().optional(),\n \"ui:title\": z.string().optional(),\n \"ui:description\": z.string().optional(),\n \"ui:options\": z.record(z.string(), z.unknown()).optional(),\n items: z.lazy(() => z.record(z.string(), uiFieldSchemaSchema)).optional(),\n })\n .passthrough();\n\n// Context UI Schema\nconst contextUiSchema = z.record(z.string(), uiFieldSchemaSchema).optional();\n\n// Context data schema\nconst contextDataSchema = z\n .object({\n data: z.record(z.string(), z.unknown()),\n ui: contextUiSchema,\n })\n .optional();\n\nexport const TASK_CONTEXT_FORMAT_VERSION = 2 as const;\nexport type TaskContextFormatVersion = typeof TASK_CONTEXT_FORMAT_VERSION;\n\n// Main TaskContext schema\nconst taskContextObjectBaseSchema = z.object({\n /** Source application id; omitted tasks are grouped in the default inbox. */\n app: z.string().min(1).optional(),\n type: z.string().min(1),\n name: z.string().min(1),\n description: z.string().optional(),\n validUntil: z.string().optional(),\n context: contextDataSchema,\n /** Task context wire format version. @default 2 */\n contextVersion: z.literal(2).optional(),\n /** @deprecated Use `contextVersion`. Accepted on ingest only. */\n version: z.literal(2).optional(),\n actions: z.array(taskActionSchema).min(1, \"At least one action is required\"),\n});\n\nfunction normalizeTaskContextVersion<T extends { contextVersion?: 2; version?: 2 }>(\n data: T\n): Omit<T, \"version\" | \"contextVersion\"> & { contextVersion: 2 } {\n const { version: legacyVersion, contextVersion, ...rest } = data;\n return {\n ...rest,\n contextVersion: contextVersion ?? legacyVersion ?? TASK_CONTEXT_FORMAT_VERSION,\n };\n}\n\nconst taskContextObjectSchema = taskContextObjectBaseSchema.transform(\n normalizeTaskContextVersion\n);\n\nfunction refineContextPublicUrls<T extends { context?: z.infer<typeof contextDataSchema> }>(\n data: T,\n ctx: z.RefinementCtx\n) {\n const error = validateContextPublicUrls(data.context);\n if (error) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: error,\n path: [\"context\"],\n });\n }\n}\n\nexport const taskContextSchema = taskContextObjectSchema.superRefine(\n refineContextPublicUrls\n);\n\n/**\n * Assignment targets at task create (not stored in task context JSON).\n * Unknown user emails are auto-provisioned as assignee memberships (count toward seat limits).\n *\n * Virtual group slugs (membership derived from tenantUsers, not groupMembers):\n * - `all` — all workspace members (omit assignTo defaults to this)\n * - `admins` — workspace users with tenant admin role\n */\nexport const VIRTUAL_ASSIGN_TO_GROUP_SLUGS = [\"all\", \"admins\"] as const;\n\nexport const assignToSchema = z\n .object({\n users: z.array(z.string().email()).optional(),\n groups: z.array(z.string().min(1)).optional(),\n })\n .refine(\n (data) => {\n const groups = data.groups ?? [];\n if (groups.includes(\"all\") && groups.length > 1) {\n return false;\n }\n return true;\n },\n { message: 'Cannot combine \"all\" with other group slugs' }\n );\n\n/** A short thread-scoped status update message (1-2 sentences). */\nexport const threadUpdateMessageSchema = z.string().min(1).max(500);\n\n/**\n * Lifecycle status carried by a thread update. Drives the icon and color shown\n * in the inbox status bar. Defaults to `info` when omitted.\n */\nexport const threadUpdateStatuses = [\n \"info\",\n \"queued\",\n \"running\",\n \"waiting\",\n \"succeeded\",\n \"failed\",\n \"cancelled\",\n] as const;\n\nexport const threadUpdateStatusSchema = z.enum(threadUpdateStatuses);\n\n/** The default status applied when an update omits one. */\nexport const DEFAULT_THREAD_UPDATE_STATUS: ThreadUpdateStatus = \"info\";\n\n/** Shared shape for a thread update (standalone and at task creation). */\nexport const threadUpdateInputSchema = z.object({\n message: threadUpdateMessageSchema,\n status: threadUpdateStatusSchema.optional(),\n});\n\n/** Thread priority levels for inbox ordering and display. */\nexport const taskPriorities = [\"low\", \"normal\", \"high\", \"urgent\"] as const;\n\nexport const taskPrioritySchema = z.enum(taskPriorities);\n\nexport type TaskPriority = (typeof taskPriorities)[number];\n\nexport const DEFAULT_TASK_PRIORITY: TaskPriority = \"normal\";\n\nexport const LOWEST_TASK_PRIORITY: TaskPriority = \"low\";\n\nexport const TASK_PRIORITY_RANK: Record<TaskPriority, number> = {\n low: 1,\n normal: 2,\n high: 3,\n urgent: 4,\n};\n\n/**\n * Agent release at task create (not shown in inbox reviewer UI).\n * Used for feedback analysis over deploys.\n */\nexport const agentTelemetrySchema = z.object({\n /** Agent or app version (semver, git SHA, deploy tag — caller-defined). */\n version: z.string().min(1),\n});\n\n/** POST /v1 body: task context plus optional assignment. */\nexport const createTaskBodySchema = taskContextObjectBaseSchema\n .extend({\n assignTo: assignToSchema.optional(),\n /**\n * Groups related tasks together. When omitted, the server generates one and\n * returns it so the caller can reuse it on later tasks in the same thread.\n */\n threadId: z.string().min(1).optional(),\n /**\n * Optional thread priority. When set, applies to the whole thread and\n * overwrites any previous priority. Omit on later tasks to leave unchanged.\n */\n priority: taskPrioritySchema.optional(),\n /**\n * Optional initial status update logged against the task's thread. Shows in\n * the inbox status bar and the thread update log.\n */\n update: threadUpdateInputSchema.optional(),\n /** Agent release version — not shown in inbox UI. */\n agent: agentTelemetrySchema.optional(),\n })\n .transform(normalizeTaskContextVersion)\n .superRefine(refineContextPublicUrls);\n\n/** POST /v1/threads/:threadId/updates body: a standalone thread update. */\nexport const threadUpdateBodySchema = threadUpdateInputSchema;\n\n/** Action widget config for a seeded assistant message (mirrors the `requestActionInput` tool input). */\nexport const agentChatSeedActionSchema = z.object({\n /** Stable action id echoed back on submit; auto-derived from title when omitted. */\n id: z.string().min(1).optional(),\n title: z.string().min(1),\n description: z.string().optional(),\n /** JSON Schema object for the form fields. */\n schema: z.record(z.string(), z.unknown()).optional(),\n /** RJSF ui schema overrides (ui:widget, ui:enumNames, etc.). */\n ui: z.record(z.string(), z.unknown()).optional(),\n /** Optional default field values. */\n data: z.record(z.string(), z.unknown()).optional(),\n});\n\n/** A single pre-seeded chat message injected into a programmatic agent chat. */\nexport const agentChatSeedMessageSchema = z.object({\n role: z.enum([\"user\", \"assistant\"]),\n text: z.string().min(1),\n /** Optional display-name override for the message sender. */\n senderName: z.string().min(1).optional(),\n /**\n * Optional structured input request rendered as a styled RobotRock action\n * widget below the message text. Use this instead of asking the user to reply\n * in plain text so the request is always a proper action form.\n */\n requestActionInput: z\n .object({\n prompt: z.string().optional(),\n action: agentChatSeedActionSchema,\n })\n .optional(),\n});\n\n/**\n * POST /v1/agent-chats body: create + assign one or more agent chat sessions.\n * Either `agentIdentifier` (new chat) or `parentChatId` (spawned from a chat) is required.\n */\nconst eveAgentChatTransportSchema = z.object({\n kind: z.literal(\"eve\"),\n chatId: z.string().min(1),\n baseUrl: z.string().url(),\n sessionId: z.string().optional(),\n continuationToken: z.string().optional(),\n streamIndex: z.number().int().nonnegative().optional(),\n isStreaming: z.boolean().optional(),\n});\n\nexport const createAgentChatBodySchema = z\n .object({\n /** Agent id (eve agent name). Required unless `parentChatId` is set. */\n agentIdentifier: z.string().min(1).optional(),\n /** Inherit tenant/connection/agent from an existing chat (agent-spawned chats). */\n parentChatId: z.string().min(1).optional(),\n /** Convex tenantEveConnections id; resolved from the tenant when omitted. */\n eveConnectionId: z.string().min(1).optional(),\n /** Source application id; groups the chat under an inbox section. */\n app: z.string().min(1).optional(),\n /** Email of the user who owns the chat. Required unless `parentChatId` is set. */\n ownerEmail: z.string().email().optional(),\n title: z.string().min(1),\n messages: z.array(agentChatSeedMessageSchema).default([]),\n /** Provenance label stored on the session (\"cron\" | \"agent\" | ...). */\n source: z.string().min(1).optional(),\n })\n .refine((data) => Boolean(data.agentIdentifier || data.parentChatId), {\n message: \"Provide either agentIdentifier or parentChatId\",\n })\n .refine((data) => Boolean(data.ownerEmail || data.parentChatId), {\n message: \"Provide ownerEmail unless parentChatId is set\",\n });\n\n/** POST /v1/agent-chats/transport body: persist live-chat cursor for the browser. */\nexport const agentChatTransportBodySchema = eveAgentChatTransportSchema;\n\n/** POST /v1/agent-chats/audit-tool body: log Eve tool executions from agent hooks. */\nexport const agentChatAuditToolBodySchema = z.object({\n eveSessionId: z.string().min(1),\n userId: z.string().min(1),\n toolCallId: z.string().min(1),\n toolName: z.string().min(1),\n input: z.record(z.string(), z.unknown()).default({}),\n success: z.boolean(),\n status: z.enum([\"completed\", \"failed\", \"rejected\"]),\n error: z.string().optional(),\n idempotencyKey: z.string().optional(),\n});\n\n/** POST /v1/agent-chats/audit-input body: log Eve HITL choices from agent hooks. */\nexport const agentChatAuditInputBodySchema = z.object({\n eveSessionId: z.string().min(1),\n userId: z.string().min(1),\n actionId: z.string().min(1),\n actionTitle: z.string().optional(),\n prompt: z.string().optional(),\n data: z.record(z.string(), z.unknown()).optional(),\n idempotencyKey: z.string().optional(),\n /** Eve input request id — used to merge staged HITL metadata. */\n requestId: z.string().optional(),\n /** Eve tool call id — fallback lookup for staged HITL metadata. */\n toolCallId: z.string().optional(),\n});\n\nconst eveHitlStagedOptionSchema = z.object({\n id: z.string(),\n label: z.string(),\n});\n\n/** POST /v1/agent-chats/stage-hitl body: persist pending Eve HITL requests on the chat. */\nexport const agentChatStageHitlBodySchema = z.object({\n eveSessionId: z.string().min(1),\n requests: z.array(\n z.object({\n requestId: z.string().min(1),\n toolCallId: z.string().min(1),\n toolName: z.string().min(1),\n prompt: z.string().min(1),\n display: z.enum([\"confirmation\", \"select\", \"text\"]).optional(),\n allowFreeform: z.boolean().optional(),\n options: z.array(eveHitlStagedOptionSchema).optional(),\n toolInput: z.record(z.string(), z.unknown()).optional(),\n })\n ),\n});\n\n/** POST /v1/agent-chats/link-task body: associate an inbox task with an Eve chat session. */\nexport const agentChatLinkTaskBodySchema = z.object({\n eveSessionId: z.string().min(1),\n publicTaskId: z.string().min(1),\n toolCallId: z.string().min(1),\n});\n\n/** Where a thread update originated. */\nexport type ThreadUpdateSource = \"api\" | \"task_create\" | \"dashboard\";\n\n/** Lifecycle status carried by a thread update. */\nexport type ThreadUpdateStatus = (typeof threadUpdateStatuses)[number];\n\n/** A logged thread update as returned by the API. */\nexport interface ThreadUpdate {\n id: string;\n threadId: string;\n message: string;\n status: ThreadUpdateStatus;\n source: ThreadUpdateSource;\n createdAt: number;\n}\n\n// Type exports\nexport type AssignToInput = z.infer<typeof assignToSchema>;\nexport type CreateTaskBodyInput = z.input<typeof createTaskBodySchema>;\nexport type CreateTaskBody = z.output<typeof createTaskBodySchema>;\nexport type ThreadUpdateBodyInput = z.input<typeof threadUpdateBodySchema>;\nexport type ThreadUpdateBody = z.output<typeof threadUpdateBodySchema>;\nexport type ThreadUpdateInput = z.input<typeof threadUpdateInputSchema>;\nexport type AgentChatSeedAction = z.output<typeof agentChatSeedActionSchema>;\nexport type AgentChatSeedMessage = z.output<typeof agentChatSeedMessageSchema>;\nexport type CreateAgentChatBodyInput = z.input<typeof createAgentChatBodySchema>;\nexport type CreateAgentChatBody = z.output<typeof createAgentChatBodySchema>;\nexport type AgentChatTransportBody = z.output<typeof agentChatTransportBodySchema>;\nexport type AgentChatAuditToolBody = z.output<typeof agentChatAuditToolBodySchema>;\nexport type AgentChatAuditInputBody = z.output<typeof agentChatAuditInputBodySchema>;\nexport type AgentChatStageHitlBody = z.output<typeof agentChatStageHitlBodySchema>;\nexport type AgentChatLinkTaskBody = z.output<typeof agentChatLinkTaskBodySchema>;\nexport type TaskContextInput = z.input<typeof taskContextSchema>;\nexport type TaskContextOutput = z.output<typeof taskContextSchema>;\nexport type TaskContext = TaskContextOutput;\nexport type SafeUrl = z.infer<typeof safeUrlSchema>;\nexport type TaskActionInput = z.infer<typeof taskActionInputSchema>;\nexport type TaskAction = z.infer<typeof taskActionSchema>;\nexport type WebhookHandler = z.infer<typeof webhookHandlerSchema>;\nexport type TriggerHandler = z.infer<typeof triggerHandlerSchema>;\nexport type Handler = z.infer<typeof handlerSchema>;\nexport type ContextData = z.infer<typeof contextDataSchema>;\nexport type ContextUiSchema = z.infer<typeof contextUiSchema>;\nexport type UiFieldSchema = z.infer<typeof uiFieldSchemaSchema>;\nexport type AgentTelemetry = z.infer<typeof agentTelemetrySchema>;\nexport type AgentTelemetryInput = z.input<typeof agentTelemetrySchema>;\n","import { isPublicHttpUrl, PUBLIC_HTTP_URL_ERROR } from \"../utils/safe-url\";\n\ntype ContextInput = {\n data?: Record<string, unknown>;\n ui?: Record<string, unknown>;\n};\n\nfunction resolveLinkUrl(value: string): string {\n return value.startsWith(\"http://\") || value.startsWith(\"https://\")\n ? value\n : `https://${value}`;\n}\n\nfunction widgetType(\n ui: Record<string, unknown> | undefined,\n field: string\n): string | undefined {\n const fieldUi = ui?.[field];\n if (typeof fieldUi !== \"object\" || fieldUi === null) {\n return undefined;\n }\n const widget = (fieldUi as Record<string, unknown>)[\"ui:widget\"];\n return typeof widget === \"string\" ? widget : undefined;\n}\n\nfunction validateUrlValue(value: unknown, widget: string): string | null {\n if (widget === \"image\" || widget === \"link\") {\n if (typeof value !== \"string\") {\n return PUBLIC_HTTP_URL_ERROR;\n }\n const url = widget === \"link\" ? resolveLinkUrl(value) : value;\n if (!isPublicHttpUrl(url)) {\n return PUBLIC_HTTP_URL_ERROR;\n }\n return null;\n }\n\n if (widget === \"attachments\" && Array.isArray(value)) {\n for (const item of value) {\n if (typeof item !== \"object\" || item === null) {\n continue;\n }\n const url = (item as { url?: unknown }).url;\n if (typeof url === \"string\" && !isPublicHttpUrl(resolveLinkUrl(url))) {\n return PUBLIC_HTTP_URL_ERROR;\n }\n }\n }\n\n return null;\n}\n\n/**\n * Validates URL-bearing context widget values (image, link, attachments).\n * Returns an error message or null when valid.\n */\nexport function validateContextPublicUrls(\n context: ContextInput | undefined\n): string | null {\n if (!context?.data) {\n return null;\n }\n\n for (const [field, value] of Object.entries(context.data)) {\n const widget = widgetType(context.ui, field);\n if (!widget) {\n continue;\n }\n const error = validateUrlValue(value, widget);\n if (error) {\n return `context.data.${field}: ${error}`;\n }\n }\n\n return null;\n}\n","import { z } from \"zod\";\nimport type { UiSchema } from \"./task\";\n\nexport const toolDisplayMetadataSchema = z.object({\n widget: z.string().optional(),\n title: z.string().optional(),\n description: z.string().optional(),\n});\n\nexport type ToolDisplayMetadata = z.infer<typeof toolDisplayMetadataSchema>;\n\nexport const toolDisplayEnvelopeSchema = z.object({\n display: toolDisplayMetadataSchema.optional(),\n data: z.record(z.string(), z.unknown()),\n ui: z\n .record(\n z.string(),\n z\n .object({\n \"ui:widget\": z.string().optional(),\n \"ui:title\": z.string().optional(),\n \"ui:description\": z.string().optional(),\n \"ui:options\": z.record(z.string(), z.unknown()).optional(),\n })\n .passthrough()\n )\n .optional(),\n});\n\nexport type ToolDisplayEnvelope<\n TData extends Record<string, unknown> = Record<string, unknown>,\n> = {\n display?: ToolDisplayMetadata;\n data: TData;\n ui?: Record<string, UiSchema>;\n};\n\n/** Detect agent-sent display envelopes without matching arbitrary tool payloads. */\nexport function isToolDisplayEnvelope(\n value: unknown\n): value is ToolDisplayEnvelope {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n\n const record = value as Record<string, unknown>;\n if (!(\"data\" in record)) {\n return false;\n }\n\n const data = record.data;\n if (typeof data !== \"object\" || data === null || Array.isArray(data)) {\n return false;\n }\n\n return \"display\" in record || \"ui\" in record;\n}\n","import { z } from \"zod\";\nimport { assignToSchema } from \"./task\";\n\nexport const tenantRoleSchema = z.enum([\"admin\", \"member\"]);\n\nexport const agentAdminUserSchema = z.object({\n id: z.string(),\n email: z.string().email(),\n name: z.string(),\n});\n\nexport const agentAdminMemberSchema = z.object({\n userId: z.string(),\n role: z.string(),\n membershipKind: z.enum([\"team\", \"assignee\"]),\n hasLoggedIn: z.boolean(),\n user: agentAdminUserSchema,\n});\n\nexport const agentAdminGroupSchema = z.object({\n id: z.string(),\n name: z.string(),\n slug: z.string(),\n description: z.string().nullable(),\n memberCount: z.number().optional(),\n});\n\nexport const agentAdminGroupDetailSchema = agentAdminGroupSchema.extend({\n members: z.array(\n z.object({\n userId: z.string(),\n user: agentAdminUserSchema,\n })\n ),\n});\n\nexport const agentAdminTaskSummarySchema = z.object({\n id: z.string(),\n convexId: z.string(),\n status: z.string(),\n type: z.string().nullable(),\n name: z.string().nullable(),\n description: z.string().nullable(),\n validUntil: z.number(),\n createdAt: z.number(),\n threadPriority: z.string().nullable(),\n handledByUserId: z.string().nullable(),\n});\n\nexport const inviteMemberBodySchema = z.object({\n email: z.string().email(),\n role: tenantRoleSchema.optional(),\n});\n\nexport const updateMemberRoleBodySchema = z.object({\n role: tenantRoleSchema,\n});\n\nexport const createGroupBodySchema = z.object({\n name: z.string().min(1),\n description: z.string().optional(),\n});\n\nexport const updateGroupBodySchema = z.object({\n name: z.string().min(1).optional(),\n description: z.string().optional(),\n});\n\nexport const addGroupMemberBodySchema = z.object({\n userId: z\n .string()\n .min(1)\n .describe(\"Convex user id or member email.\"),\n});\n\nexport const listTasksQuerySchema = z.object({\n statusFilter: z.enum([\"all\", \"open\", \"handled\", \"expired\"]).optional(),\n typeFilter: z.string().optional(),\n appFilter: z.string().optional(),\n sortField: z.enum([\"type\", \"date\", \"status\", \"validUntil\"]).optional(),\n sortDirection: z.enum([\"asc\", \"desc\"]).optional(),\n limit: z.coerce.number().int().positive().max(100).optional(),\n cursor: z.string().optional(),\n});\n\nexport const searchTasksQuerySchema = z.object({\n q: z.string().min(1),\n limit: z.coerce.number().int().positive().max(100).optional(),\n});\n\nexport const assignTasksResultSchema = z.object({\n taskId: z.string(),\n success: z.boolean(),\n message: z.string().optional(),\n name: z.string().nullable().optional(),\n description: z.string().nullable().optional(),\n type: z.string().nullable().optional(),\n});\n\nexport const assignTasksResponseSchema = z.object({\n results: z.array(assignTasksResultSchema),\n});\n\nexport const assignTasksBodySchema = z.object({\n taskIds: z.array(z.string().min(1)).min(1).max(100),\n assignTo: assignToSchema.refine(\n (value) => (value.users?.length ?? 0) > 0 || (value.groups?.length ?? 0) > 0,\n { message: \"assignTo needs at least one user email or group slug.\" }\n ),\n});\n\nexport type AgentAdminMember = z.infer<typeof agentAdminMemberSchema>;\nexport type AgentAdminGroup = z.infer<typeof agentAdminGroupSchema>;\nexport type AgentAdminGroupDetail = z.infer<typeof agentAdminGroupDetailSchema>;\nexport type AgentAdminTaskSummary = z.infer<typeof agentAdminTaskSummarySchema>;\nexport type AgentAdminAssignTaskResult = z.infer<typeof assignTasksResultSchema>;\n"],"mappings":";AAAA,SAAS,KAAAA,UAAS;;;ACAlB,IAAM,oBAAoB,oBAAI,IAAI;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,SAAS,kBAAkB,UAA0B;AACnD,SAAO,SAAS,YAAY,EAAE,QAAQ,YAAY,EAAE;AACtD;AAEA,SAAS,cAAc,MAAuB;AAC5C,QAAM,QAAQ,+CAA+C,KAAK,IAAI;AACtE,MAAI,CAAC,OAAO;AACV,WAAO;AAAA,EACT;AAEA,QAAM,SAAS,MAAM,MAAM,GAAG,CAAC,EAAE,IAAI,CAAC,SAAS,OAAO,IAAI,CAAC;AAC3D,MAAI,OAAO,KAAK,CAAC,UAAU,OAAO,MAAM,KAAK,KAAK,QAAQ,KAAK,QAAQ,GAAG,GAAG;AAC3E,WAAO;AAAA,EACT;AAEA,QAAM,CAAC,GAAG,GAAG,IAAI,EAAE,IAAI;AACvB,MAAI,MAAM,UAAa,MAAM,QAAW;AACtC,WAAO;AAAA,EACT;AACA,MAAI,MAAM,OAAO,MAAM,EAAG,QAAO;AACjC,MAAI,MAAM,GAAI,QAAO;AACrB,MAAI,MAAM,OAAO,MAAM,IAAK,QAAO;AACnC,MAAI,MAAM,OAAO,MAAM,IAAK,QAAO;AACnC,MAAI,MAAM,OAAO,KAAK,MAAM,KAAK,GAAI,QAAO;AAC5C,MAAI,MAAM,OAAO,KAAK,MAAM,KAAK,IAAK,QAAO;AAE7C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;AAE3C,IAAM,qBAAmD;AAAA,EAC9D,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AACV;AAEO,IAAME,wBAAuBxB,GAAE,OAAO;AAAA,EAC3C,SAASA,GAAE,OAAO,EAAE,IAAI,CAAC;AAC3B,CAAC;AAEM,IAAMyB,wBAAuBb,6BACjC,OAAO;AAAA,EACN,UAAUK,gBAAe,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,EAKlC,UAAUjB,GAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,EAKrC,UAAUuB,oBAAmB,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,EAKtC,QAAQF,yBAAwB,SAAS;AAAA,EACzC,OAAOG,sBAAqB,SAAS;AACvC,CAAC,EACA,UAAUX,4BAA2B,EACrC,YAAYE,wBAAuB;AAG/B,IAAM,yBAAyBM;","names":["z","z","z","z","handlerUrlSchema","z","jsonSchema7Schema","uiSchemaSchema","webhookHandlerSchema","triggerHandlerSchema","handlerSchema","taskActionInputSchema","taskActionSchema","uiFieldSchemaSchema","contextUiSchema","contextDataSchema","TASK_CONTEXT_FORMAT_VERSION","taskContextObjectBaseSchema","normalizeTaskContextVersion","taskContextObjectSchema","refineContextPublicUrls","taskContextSchema","assignToSchema","threadUpdateMessageSchema","threadUpdateStatuses","threadUpdateStatusSchema","threadUpdateInputSchema","taskPriorities","taskPrioritySchema","agentTelemetrySchema","createTaskBodySchema"]}