@arbidocs/blocks 0.4.138 → 0.4.139

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 (191) hide show
  1. package/dist/agents/definitions/AgentConnectInstructions.d.ts +12 -0
  2. package/dist/agents/definitions/defaults.d.ts +12 -0
  3. package/dist/agents/definitions/index.d.ts +2 -0
  4. package/dist/agents/index.cjs +335 -320
  5. package/dist/agents/index.js +9 -10
  6. package/dist/calendar/CalendarFormDialog.d.ts +13 -0
  7. package/dist/calendar/ProposeTimeDialog.d.ts +22 -0
  8. package/dist/calendar/WeeklyHoursEditor.d.ts +7 -0
  9. package/dist/calendar/access-setup.d.ts +8 -0
  10. package/dist/calendar/api-mapping.d.ts +22 -0
  11. package/dist/calendar/booking-form.d.ts +46 -0
  12. package/dist/calendar/conference.d.ts +11 -0
  13. package/dist/calendar/errors.d.ts +7 -0
  14. package/dist/calendar/feeds.d.ts +2 -0
  15. package/dist/calendar/freebusy.d.ts +22 -0
  16. package/dist/calendar/ics.d.ts +33 -0
  17. package/dist/calendar/index.cjs +472 -4293
  18. package/dist/calendar/index.cjs.map +1 -1
  19. package/dist/calendar/index.d.ts +17 -1
  20. package/dist/calendar/index.js +1 -4227
  21. package/dist/calendar/index.js.map +1 -1
  22. package/dist/calendar/requests.d.ts +42 -0
  23. package/dist/calendar/room-window.d.ts +6 -0
  24. package/dist/calendar/settings-value.d.ts +4 -0
  25. package/dist/calls/index.cjs +4 -4
  26. package/dist/calls/index.js +3 -3
  27. package/dist/chat/index.cjs +138 -138
  28. package/dist/chat/index.js +4 -4
  29. package/dist/{chunk-ED4HHTIA.js → chunk-22WFGXG2.js} +3 -3
  30. package/dist/{chunk-ED4HHTIA.js.map → chunk-22WFGXG2.js.map} +1 -1
  31. package/dist/{chunk-5BXEYYH6.js → chunk-453PNNNW.js} +3 -3
  32. package/dist/{chunk-5BXEYYH6.js.map → chunk-453PNNNW.js.map} +1 -1
  33. package/dist/{chunk-2KUCVSFF.js → chunk-45LRMW54.js} +3 -3
  34. package/dist/{chunk-2KUCVSFF.js.map → chunk-45LRMW54.js.map} +1 -1
  35. package/dist/chunk-5FTIHRZH.cjs +177 -0
  36. package/dist/chunk-5FTIHRZH.cjs.map +1 -0
  37. package/dist/{chunk-FUTMU4FR.js → chunk-5HFPRI3W.js} +3 -3
  38. package/dist/{chunk-FUTMU4FR.js.map → chunk-5HFPRI3W.js.map} +1 -1
  39. package/dist/{chunk-MJKBVIV3.cjs → chunk-5UXDUOOB.cjs} +39 -751
  40. package/dist/chunk-5UXDUOOB.cjs.map +1 -0
  41. package/dist/{chunk-XVME4XYD.js → chunk-6QMWP5IU.js} +847 -9
  42. package/dist/chunk-6QMWP5IU.js.map +1 -0
  43. package/dist/chunk-6YTHQ73P.cjs +5334 -0
  44. package/dist/chunk-6YTHQ73P.cjs.map +1 -0
  45. package/dist/{chunk-UBEI6WFJ.js → chunk-7QUUZBQZ.js} +13 -706
  46. package/dist/chunk-7QUUZBQZ.js.map +1 -0
  47. package/dist/{chunk-JVL7HUIQ.cjs → chunk-7X255TOM.cjs} +5 -5
  48. package/dist/{chunk-JVL7HUIQ.cjs.map → chunk-7X255TOM.cjs.map} +1 -1
  49. package/dist/chunk-A3XPS2EU.js +245 -0
  50. package/dist/chunk-A3XPS2EU.js.map +1 -0
  51. package/dist/chunk-B3AHCIV5.js +5206 -0
  52. package/dist/chunk-B3AHCIV5.js.map +1 -0
  53. package/dist/{chunk-2Q7FDZAY.js → chunk-BPBSSMRB.js} +5 -163
  54. package/dist/chunk-BPBSSMRB.js.map +1 -0
  55. package/dist/{chunk-KSHKTOY2.js → chunk-CKCBBYTA.js} +205 -5
  56. package/dist/chunk-CKCBBYTA.js.map +1 -0
  57. package/dist/chunk-CYNF5PZI.js +170 -0
  58. package/dist/chunk-CYNF5PZI.js.map +1 -0
  59. package/dist/{chunk-OPTBQSCV.cjs → chunk-DJM7DLCT.cjs} +3 -3
  60. package/dist/{chunk-OPTBQSCV.cjs.map → chunk-DJM7DLCT.cjs.map} +1 -1
  61. package/dist/{chunk-E5OYHJMU.js → chunk-DN55PRGS.js} +4 -4
  62. package/dist/{chunk-E5OYHJMU.js.map → chunk-DN55PRGS.js.map} +1 -1
  63. package/dist/{chunk-VHJHY7TT.js → chunk-ECERC6TI.js} +3 -3
  64. package/dist/{chunk-VHJHY7TT.js.map → chunk-ECERC6TI.js.map} +1 -1
  65. package/dist/{chunk-KDUGTKVI.cjs → chunk-GFNELPDP.cjs} +17 -6
  66. package/dist/chunk-GFNELPDP.cjs.map +1 -0
  67. package/dist/{chunk-OGBXV326.cjs → chunk-GFRQG36Y.cjs} +2 -243
  68. package/dist/chunk-GFRQG36Y.cjs.map +1 -0
  69. package/dist/{chunk-WXYQ66KC.cjs → chunk-HEMU73OP.cjs} +2 -166
  70. package/dist/chunk-HEMU73OP.cjs.map +1 -0
  71. package/dist/{chunk-UUHUQHXR.cjs → chunk-JZNXRMLH.cjs} +6 -6
  72. package/dist/{chunk-UUHUQHXR.cjs.map → chunk-JZNXRMLH.cjs.map} +1 -1
  73. package/dist/{chunk-IE5CUCZK.cjs → chunk-K3HNLWZZ.cjs} +8 -8
  74. package/dist/{chunk-IE5CUCZK.cjs.map → chunk-K3HNLWZZ.cjs.map} +1 -1
  75. package/dist/{chunk-JO3EMZ4X.js → chunk-KTFDUSON.js} +3 -3
  76. package/dist/{chunk-JO3EMZ4X.js.map → chunk-KTFDUSON.js.map} +1 -1
  77. package/dist/{chunk-HLB4DIYV.cjs → chunk-MABUMUCA.cjs} +6 -6
  78. package/dist/{chunk-HLB4DIYV.cjs.map → chunk-MABUMUCA.cjs.map} +1 -1
  79. package/dist/{chunk-RQ2Y7USX.cjs → chunk-MIDXCYZB.cjs} +235 -15
  80. package/dist/chunk-MIDXCYZB.cjs.map +1 -0
  81. package/dist/{chunk-ZNI4SW2G.js → chunk-MTPWZQTL.js} +4 -4
  82. package/dist/{chunk-ZNI4SW2G.js.map → chunk-MTPWZQTL.js.map} +1 -1
  83. package/dist/{chunk-OAL3B2ZU.cjs → chunk-O4ZIQDUT.cjs} +5 -5
  84. package/dist/{chunk-OAL3B2ZU.cjs.map → chunk-O4ZIQDUT.cjs.map} +1 -1
  85. package/dist/{chunk-W3VYZXNS.js → chunk-O6W6RW3B.js} +5 -240
  86. package/dist/chunk-O6W6RW3B.js.map +1 -0
  87. package/dist/{chunk-WS5EX7DN.cjs → chunk-OGP6MQXQ.cjs} +3 -3
  88. package/dist/{chunk-WS5EX7DN.cjs.map → chunk-OGP6MQXQ.cjs.map} +1 -1
  89. package/dist/{chunk-OQ7RUNOC.js → chunk-PC5KVHX3.js} +22 -6
  90. package/dist/chunk-PC5KVHX3.js.map +1 -0
  91. package/dist/{chunk-3BI6EWKP.cjs → chunk-ULEDHANM.cjs} +874 -14
  92. package/dist/chunk-ULEDHANM.cjs.map +1 -0
  93. package/dist/{chunk-L2PAPOZ5.js → chunk-US3S4DCB.js} +17 -6
  94. package/dist/chunk-US3S4DCB.js.map +1 -0
  95. package/dist/chunk-V46W7YLI.cjs +252 -0
  96. package/dist/chunk-V46W7YLI.cjs.map +1 -0
  97. package/dist/{chunk-3RJN2VTL.js → chunk-XDQXDWE7.js} +3 -3
  98. package/dist/{chunk-3RJN2VTL.js.map → chunk-XDQXDWE7.js.map} +1 -1
  99. package/dist/{chunk-7YLJHTDC.cjs → chunk-XOC44HQY.cjs} +3 -3
  100. package/dist/{chunk-7YLJHTDC.cjs.map → chunk-XOC44HQY.cjs.map} +1 -1
  101. package/dist/{chunk-DWZXSPMB.cjs → chunk-ZAVEMQ37.cjs} +3 -3
  102. package/dist/{chunk-DWZXSPMB.cjs.map → chunk-ZAVEMQ37.cjs.map} +1 -1
  103. package/dist/{chunk-AAFX64WD.cjs → chunk-ZXAWOLBQ.cjs} +22 -5
  104. package/dist/chunk-ZXAWOLBQ.cjs.map +1 -0
  105. package/dist/citations/QuietMarks.d.ts +5 -2
  106. package/dist/citations/index.cjs +15 -14
  107. package/dist/citations/index.js +3 -2
  108. package/dist/collaboration/index.cjs +42 -42
  109. package/dist/collaboration/index.js +2 -2
  110. package/dist/connect/docx.cjs +6 -6
  111. package/dist/connect/docx.js +5 -5
  112. package/dist/connect/index.cjs +4797 -184
  113. package/dist/connect/index.cjs.map +1 -1
  114. package/dist/connect/index.d.ts +4 -0
  115. package/dist/connect/index.js +4687 -94
  116. package/dist/connect/index.js.map +1 -1
  117. package/dist/connection/ConnectedAgentCreator.d.ts +37 -0
  118. package/dist/connection/ConnectedWorkflowHistory.d.ts +45 -0
  119. package/dist/connection/ConnectionProvider.d.ts +3 -1
  120. package/dist/connection/calendar/AddCalendarDialogs.d.ts +9 -0
  121. package/dist/connection/calendar/BookingPagesPanel.d.ts +13 -0
  122. package/dist/connection/calendar/CalendarAccountsPanel.d.ts +5 -0
  123. package/dist/connection/calendar/CalendarSettingsDialog.d.ts +12 -0
  124. package/dist/connection/calendar/ConnectedCalendar.d.ts +13 -0
  125. package/dist/connection/calendar/ConnectedMailInviteCard.d.ts +12 -0
  126. package/dist/connection/calendar/ConnectedPublicBooking.d.ts +9 -0
  127. package/dist/connection/calendar/ConnectedUpcomingEvents.d.ts +12 -0
  128. package/dist/connection/calendar/CopyField.d.ts +9 -0
  129. package/dist/connection/calendar/EventEditorDialog.d.ts +29 -0
  130. package/dist/connection/calendar/EventScheduling.d.ts +8 -0
  131. package/dist/connection/calendar/InvitationsPanel.d.ts +5 -0
  132. package/dist/connection/calendar/OpenAccessPanel.d.ts +7 -0
  133. package/dist/connection/calendar/PublishCalendarDialog.d.ts +8 -0
  134. package/dist/connection/calendar/RoomsDirectoryPanel.d.ts +8 -0
  135. package/dist/connection/calendar/ShareCalendarDialog.d.ts +6 -0
  136. package/dist/connection/calendar/copy.d.ts +2 -0
  137. package/dist/connection/calendar/index.d.ts +6 -0
  138. package/dist/connection/calendar/store.d.ts +47 -0
  139. package/dist/connection/calendar/types.d.ts +36 -0
  140. package/dist/connection/calendar/useWebinarAttendee.d.ts +3 -0
  141. package/dist/connection/notification-center/ConnectedNotificationCenter.d.ts +15 -0
  142. package/dist/connection/notification-center/NotificationCenter.d.ts +37 -0
  143. package/dist/connection/notification-center/NotificationEvent.d.ts +33 -0
  144. package/dist/connection/notification-center/index.d.ts +4 -0
  145. package/dist/connection/notification-center/items.d.ts +44 -0
  146. package/dist/facts/index.cjs +6 -6
  147. package/dist/facts/index.js +6 -6
  148. package/dist/files/index.cjs +6 -6
  149. package/dist/files/index.js +6 -6
  150. package/dist/home/index.cjs +20 -20
  151. package/dist/home/index.js +5 -5
  152. package/dist/index.cjs +921 -904
  153. package/dist/index.cjs.map +1 -1
  154. package/dist/index.js +22 -21
  155. package/dist/index.js.map +1 -1
  156. package/dist/retrieval/index.cjs +1 -1
  157. package/dist/retrieval/index.js +1 -1
  158. package/dist/settings/index.cjs +52 -66
  159. package/dist/settings/index.cjs.map +1 -1
  160. package/dist/settings/index.js +6 -23
  161. package/dist/settings/index.js.map +1 -1
  162. package/dist/shell/index.cjs +61 -60
  163. package/dist/shell/index.js +5 -4
  164. package/dist/studio/index.cjs +8 -8
  165. package/dist/studio/index.js +6 -6
  166. package/dist/workflow-canvas/index.cjs +28 -29
  167. package/dist/workflow-canvas/index.cjs.map +1 -1
  168. package/dist/workflow-canvas/index.js +11 -12
  169. package/dist/workflow-canvas/index.js.map +1 -1
  170. package/dist/workspaces/index.cjs +2 -2
  171. package/dist/workspaces/index.js +2 -2
  172. package/node_modules/@arbidocs/coedit/package.json +1 -1
  173. package/package.json +4 -4
  174. package/dist/chunk-2Q7FDZAY.js.map +0 -1
  175. package/dist/chunk-3BI6EWKP.cjs.map +0 -1
  176. package/dist/chunk-AAFX64WD.cjs.map +0 -1
  177. package/dist/chunk-CQCC7LE7.js +0 -210
  178. package/dist/chunk-CQCC7LE7.js.map +0 -1
  179. package/dist/chunk-KDUGTKVI.cjs.map +0 -1
  180. package/dist/chunk-KSHKTOY2.js.map +0 -1
  181. package/dist/chunk-L2PAPOZ5.js.map +0 -1
  182. package/dist/chunk-MJKBVIV3.cjs.map +0 -1
  183. package/dist/chunk-OGBXV326.cjs.map +0 -1
  184. package/dist/chunk-OQ7RUNOC.js.map +0 -1
  185. package/dist/chunk-RFIBUWLF.cjs +0 -232
  186. package/dist/chunk-RFIBUWLF.cjs.map +0 -1
  187. package/dist/chunk-RQ2Y7USX.cjs.map +0 -1
  188. package/dist/chunk-UBEI6WFJ.js.map +0 -1
  189. package/dist/chunk-W3VYZXNS.js.map +0 -1
  190. package/dist/chunk-WXYQ66KC.cjs.map +0 -1
  191. package/dist/chunk-XVME4XYD.js.map +0 -1
@@ -1,19 +1,21 @@
1
1
  "use client";
2
- import { FoldSection, QuickActionDialogHeader, AddFilesFirst, StartTiles, ScopePicker } from './chunk-3RJN2VTL.js';
3
- import { DocumentPicker, TriStateFilterMenu } from './chunk-KSHKTOY2.js';
2
+ import { FoldSection, QuickActionDialogHeader, AddFilesFirst, StartTiles, ScopePicker } from './chunk-XDQXDWE7.js';
3
+ import { DocumentPicker, TriStateFilterMenu } from './chunk-CKCBBYTA.js';
4
4
  import { EmptyState } from './chunk-P6GHJSLR.js';
5
5
  import { UploadDropzone } from './chunk-EVUEIBNU.js';
6
+ import { ActionLink } from './chunk-444XKG46.js';
6
7
  import { SelectionBar, SelectionBarAction } from './chunk-NUNKSZKU.js';
7
8
  import { FilterInput } from './chunk-YU2KUMGE.js';
8
- import { GridView } from './chunk-N5YEF3LC.js';
9
+ import { useBlocksEnvironment } from './chunk-YNIBUKV5.js';
9
10
  import { TabHeader } from './chunk-4WWM3GQ5.js';
10
11
  import { defaultInputs, validateInputs, workflowSteps, canAssign, fieldToFrontmatter, workflowFromFrontmatter, nextAction, validateStep, assigneeName, runFieldsOf, failedUpstream, stepPhase, useElementSize, sendBackTargets, formatDate, shownValue, stepKindOf, stepLevels, waitingDocuments, stepDependencies, reviewInstructions, splitDocRef, isPersonStep, mergeSkillWorkflows, eventWaitingDocuments, waitingForDocumentsText, StepBadgeMark, StepChip, buildLaunch, STEP_KIND_ICONS, DEFAULT_STEP_KIND_LABELS, composeStepPrompt, isRunFinished, runFields, isWorkflowScope } from './chunk-Y5KTM3V5.js';
11
12
  import { TONE_DOT, TONE_SURFACE, TONE_SOLID_BORDER, TONE_BORDER } from './chunk-AUS3KBHJ.js';
12
- import { testIdOr, prefixedTestId } from './chunk-7F6CBP3Z.js';
13
13
  import { initials } from './chunk-OXF2IFXG.js';
14
+ import { GridView } from './chunk-N5YEF3LC.js';
15
+ import { testIdOr, prefixedTestId } from './chunk-7F6CBP3Z.js';
14
16
  import { useState, useRef, useCallback, useId, useMemo, useEffect } from 'react';
15
- import { Loader2, Play, FolderPlus, ImageIcon, X, UserRound, CornerUpLeft, ShieldCheck, MessageSquare, Check, Hourglass, Clock, PenLine, ExternalLink, Mail, Table2, CheckCircle2, ArrowLeft, ArrowRight, RotateCw, GitBranch, AlertTriangle, Globe, Wand2, Copy, Pencil, Lock, Download, Trash2, MoreHorizontal, History, Workflow, LayoutGrid, List, ChevronLeft, ChevronRight, FileText, Link2, Bell, MousePointerClick, ArrowUpRight, BellRing, Flag, RotateCcw, Disc, Phone, UserRoundCog, Sparkles, MessageSquareReply, Square, KeyRound } from 'lucide-react';
16
- import { cn, Label, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Dialog, DialogContent, Button, getEntityColor, Popover, PopoverTrigger, PopoverContent, Textarea, Card, Tooltip, TooltipTrigger, TooltipContent, Input, UserEntity, getEntityColorStyles, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, badgeVariants, VisibilityToggle, Switch } from '@arbidocs/react/ui';
17
+ import { Globe, Terminal, Telescope, ListChecks, FileText, ImageIcon, Brain, Wand2, Loader2, Play, FolderPlus, X, UserRound, CornerUpLeft, ShieldCheck, MessageSquare, Check, Hourglass, Clock, PenLine, ExternalLink, Mail, Table2, CheckCircle2, ArrowLeft, ArrowRight, RotateCw, GitBranch, AlertTriangle, Bot, Sparkles, Copy, Pencil, Lock, Download, Trash2, MoreHorizontal, History, Workflow, Eye, LayoutGrid, List, ChevronLeft, ChevronRight, Link2, Bell, MousePointerClick, ArrowUpRight, BellRing, Flag, RotateCcw, Disc, Phone, UserRoundCog, MessageSquareReply, Square, KeyRound } from 'lucide-react';
18
+ import { cn, Label, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Dialog, DialogContent, Button, getEntityColor, Popover, PopoverTrigger, PopoverContent, Textarea, Card, DialogHeader, DialogTitle, DialogDescription, Input, Tooltip, TooltipTrigger, TooltipContent, UserEntity, getEntityColorStyles, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, badgeVariants, VisibilityToggle, Switch } from '@arbidocs/react/ui';
17
19
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
18
20
  import { unzip, strFromU8 } from 'fflate';
19
21
 
@@ -2972,6 +2974,677 @@ function StepNotices({
2972
2974
  ))
2973
2975
  ] });
2974
2976
  }
2977
+ function CapabilityTile({
2978
+ label,
2979
+ description,
2980
+ icon: Icon,
2981
+ selected,
2982
+ onToggle,
2983
+ testId,
2984
+ className
2985
+ }) {
2986
+ return /* @__PURE__ */ jsxs(
2987
+ "button",
2988
+ {
2989
+ type: "button",
2990
+ onClick: onToggle,
2991
+ "aria-pressed": selected,
2992
+ "data-testid": testId,
2993
+ "data-slot": "capability-tile",
2994
+ className: cn(
2995
+ "flex flex-col items-start gap-1 rounded-lg p-3 text-left transition-colors pointer-coarse:min-h-11 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
2996
+ selected ? "bg-accent text-accent-foreground ring-1 ring-inset ring-primary/30" : "bg-muted hover:bg-accent/60",
2997
+ className
2998
+ ),
2999
+ children: [
3000
+ /* @__PURE__ */ jsx(Icon, { size: 16, className: selected ? "text-accent-foreground" : "text-muted-foreground" }),
3001
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium leading-tight", children: label }),
3002
+ /* @__PURE__ */ jsx("span", { className: "text-xs leading-tight text-muted-foreground", children: description })
3003
+ ]
3004
+ }
3005
+ );
3006
+ }
3007
+ function CapabilityGrid({
3008
+ children,
3009
+ testId,
3010
+ className
3011
+ }) {
3012
+ return /* @__PURE__ */ jsx(
3013
+ "div",
3014
+ {
3015
+ className: cn("grid grid-cols-2 gap-2 sm:grid-cols-4", className),
3016
+ "data-testid": testIdOr(testId, { testId: "agent-capabilities" }),
3017
+ children
3018
+ }
3019
+ );
3020
+ }
3021
+ var DEFAULT_AGENT_TYPE_SELECTOR_LABELS = {
3022
+ agentType: "Agent type"
3023
+ };
3024
+ function AgentTypeSelector({
3025
+ value,
3026
+ onChange,
3027
+ options,
3028
+ label,
3029
+ labels,
3030
+ testId,
3031
+ optionTestId
3032
+ }) {
3033
+ const l = { ...DEFAULT_AGENT_TYPE_SELECTOR_LABELS, ...labels };
3034
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", "data-testid": testIdOr(testId, { testId: "agent-type-selector" }), children: [
3035
+ /* @__PURE__ */ jsx(Label, { children: label ?? l.agentType }),
3036
+ /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-2", children: options.map((opt) => /* @__PURE__ */ jsxs(
3037
+ "button",
3038
+ {
3039
+ type: "button",
3040
+ onClick: () => onChange(opt.value),
3041
+ "aria-pressed": value === opt.value,
3042
+ "data-testid": testIdOr(optionTestId?.(opt.value), { testId: `agent-type-${opt.value}` }),
3043
+ className: cn(
3044
+ "rounded-lg p-3 text-left transition-colors pointer-coarse:min-h-11 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3045
+ value === opt.value ? "bg-accent text-accent-foreground ring-1 ring-inset ring-primary/30" : "bg-muted hover:bg-accent/60"
3046
+ ),
3047
+ children: [
3048
+ /* @__PURE__ */ jsx("div", { className: "text-sm font-medium", children: opt.title }),
3049
+ /* @__PURE__ */ jsx("div", { className: "mt-0.5 text-xs text-muted-foreground", children: opt.description })
3050
+ ]
3051
+ },
3052
+ opt.value
3053
+ )) })
3054
+ ] });
3055
+ }
3056
+ var DEFAULT_AGENT_AVATAR_FIELD_LABELS = {
3057
+ painting: "Painting\u2026",
3058
+ generate: "Generate avatar",
3059
+ regenerate: "Regenerate"
3060
+ };
3061
+ function AgentAvatarField({
3062
+ picture,
3063
+ isBusy,
3064
+ canGenerate,
3065
+ onGenerate,
3066
+ labels,
3067
+ testIds
3068
+ }) {
3069
+ const l = { ...DEFAULT_AGENT_AVATAR_FIELD_LABELS, ...labels };
3070
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", "data-slot": "agent-avatar-field", children: [
3071
+ /* @__PURE__ */ jsx(
3072
+ "div",
3073
+ {
3074
+ className: "flex size-24 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted",
3075
+ "data-testid": testIdOr(testIds?.preview, { testId: "agent-avatar-preview" }),
3076
+ children: isBusy ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1 text-ai-ink", children: [
3077
+ /* @__PURE__ */ jsx(Loader2, { className: "size-7 animate-spin" }),
3078
+ /* @__PURE__ */ jsx("span", { className: "text-xs", children: l.painting })
3079
+ ] }) : picture ? /* @__PURE__ */ jsx("img", { src: picture, alt: "", className: "size-full object-cover" }) : /* @__PURE__ */ jsx(Bot, { className: "size-10 text-ai-ink/70" })
3080
+ }
3081
+ ),
3082
+ /* @__PURE__ */ jsxs(
3083
+ Button,
3084
+ {
3085
+ variant: "outline",
3086
+ size: "sm",
3087
+ className: "h-8 gap-1 px-2 text-xs pointer-coarse:h-11",
3088
+ disabled: isBusy || !canGenerate,
3089
+ onClick: onGenerate,
3090
+ "data-testid": testIdOr(testIds?.generate, { testId: "agent-avatar-generate" }),
3091
+ children: [
3092
+ /* @__PURE__ */ jsx(Wand2, { size: 12 }),
3093
+ " ",
3094
+ picture ? l.regenerate : l.generate
3095
+ ]
3096
+ }
3097
+ )
3098
+ ] });
3099
+ }
3100
+ var DEFAULT_AGENT_CREATOR_LABELS = {
3101
+ titleNew: "New agent",
3102
+ titleEdit: (name) => `Edit ${name}`,
3103
+ descriptionNew: "Say what this agent is for. Everything else follows from that.",
3104
+ descriptionEdit: "Change what this agent is for, or fine-tune it under Advanced.",
3105
+ describe: "What should it do?",
3106
+ describePlaceholder: "e.g. Reads new files each morning and tells me what changed, with sources.",
3107
+ describeHint: "This becomes the agent\u2019s persona and shapes every answer.",
3108
+ startFrom: "Or start from",
3109
+ summaryHeading: "What it can do (its tools)",
3110
+ summaryCan: (list) => `Can ${list}.`,
3111
+ summaryCannot: (list) => `Cannot ${list}.`,
3112
+ summaryNone: "It can read your files and answer. Nothing else is switched on yet.",
3113
+ summaryModel: (model) => `Uses ${model}.`,
3114
+ summaryModelAuto: "Uses the default model.",
3115
+ summaryWorkspaces: (list) => `Can read ${list}.`,
3116
+ summaryNoWorkspaces: "Cannot read any workspace yet. Give it access under Advanced.",
3117
+ summaryName: (name) => `Will be called ${name}.`,
3118
+ workspaceAccess: "Workspace access",
3119
+ workspaceAccessHint: "Each workspace stays separate. The agent can only read the ones you tick here.",
3120
+ workspaceAlready: "Already has access",
3121
+ revokeWorkspace: (name) => `Remove access to ${name}`,
3122
+ noWorkspacesToGrant: "You have no workspaces yet.",
3123
+ name: "Name",
3124
+ nameHint: "Letters, digits, - and _ only; must start with a letter or digit.",
3125
+ nameInvalid: "Letters, digits, - and _ only; must start with a letter or digit.",
3126
+ advanced: "Advanced",
3127
+ capabilities: "Tools",
3128
+ toolsHint: "Tools are switches on this agent: what it may do on its own, such as search the web or run code. Change them any time.",
3129
+ summaryChange: "Change tools",
3130
+ model: "Model",
3131
+ modelAuto: "Automatic",
3132
+ cancel: "Cancel",
3133
+ create: "Create agent",
3134
+ save: "Save changes",
3135
+ saving: "Saving\u2026"
3136
+ };
3137
+ var NAME_RE = /^[a-zA-Z0-9][a-zA-Z0-9_-]*$/;
3138
+ var FILLER = /* @__PURE__ */ new Set([
3139
+ "a",
3140
+ "an",
3141
+ "the",
3142
+ "who",
3143
+ "that",
3144
+ "which",
3145
+ "to",
3146
+ "for",
3147
+ "and",
3148
+ "of",
3149
+ "i",
3150
+ "my"
3151
+ ]);
3152
+ function deriveAgentName(description) {
3153
+ const words = description.toLowerCase().replace(/[^a-z0-9\s-]/g, " ").split(/\s+/).filter((w) => w && !FILLER.has(w)).slice(0, 3);
3154
+ return words.join("-").slice(0, 64);
3155
+ }
3156
+ var isValidAgentName = (name) => NAME_RE.test(name) && name.length <= 64;
3157
+ var joinList = (items) => items.length <= 2 ? items.join(" and ") : `${items.slice(0, -1).join(", ")} and ${items[items.length - 1]}`;
3158
+ function summarizeCapabilities(capabilities, enabled, modelName, labels = DEFAULT_AGENT_CREATOR_LABELS) {
3159
+ const on = capabilities.filter((c) => enabled[c.key]).map((c) => c.label.toLowerCase());
3160
+ const off = capabilities.filter((c) => !enabled[c.key]).map((c) => c.label.toLowerCase());
3161
+ const lines = [];
3162
+ if (on.length === 0) lines.push(labels.summaryNone);
3163
+ else {
3164
+ lines.push(labels.summaryCan(joinList(on)));
3165
+ if (off.length > 0) lines.push(labels.summaryCannot(joinList(off)));
3166
+ }
3167
+ lines.push(modelName ? labels.summaryModel(modelName) : labels.summaryModelAuto);
3168
+ return lines;
3169
+ }
3170
+ function summarizeAgent(capabilities, values, workspaces, labels = DEFAULT_AGENT_CREATOR_LABELS) {
3171
+ const lines = summarizeCapabilities(capabilities, values.capabilities, values.modelName, labels);
3172
+ const names = workspaces.filter((w) => values.workspaceIds.includes(w.id)).map((w) => w.name);
3173
+ lines.push(
3174
+ names.length > 0 ? labels.summaryWorkspaces(joinList(names)) : labels.summaryNoWorkspaces
3175
+ );
3176
+ if (values.name) lines.push(labels.summaryName(values.name));
3177
+ return lines;
3178
+ }
3179
+ var BLANK = {
3180
+ name: "",
3181
+ persona: "",
3182
+ capabilities: {},
3183
+ modelName: "",
3184
+ type: "builtin",
3185
+ workspaceIds: []
3186
+ };
3187
+ function AgentCreator({
3188
+ open,
3189
+ onOpenChange,
3190
+ isEdit = false,
3191
+ agentName,
3192
+ capabilities,
3193
+ templates = [],
3194
+ models = [],
3195
+ workspaces = [],
3196
+ grantedWorkspaceIds = [],
3197
+ onRevokeWorkspace,
3198
+ revokingWorkspaceId,
3199
+ avatar,
3200
+ types,
3201
+ values: valuesProp,
3202
+ initialValues,
3203
+ onValuesChange,
3204
+ advanced,
3205
+ isSaving,
3206
+ onSubmit,
3207
+ labels,
3208
+ testId
3209
+ }) {
3210
+ const l = { ...DEFAULT_AGENT_CREATOR_LABELS, ...labels };
3211
+ const seed = useMemo(
3212
+ () => ({ ...BLANK, ...initialValues }),
3213
+ // Seeded once per open.
3214
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3215
+ [open]
3216
+ );
3217
+ const [values, setValues] = useControllableState(
3218
+ valuesProp,
3219
+ seed,
3220
+ onValuesChange
3221
+ );
3222
+ const [advancedOpen, setAdvancedOpen] = useState(false);
3223
+ const [nameTouched, setNameTouched] = useState(false);
3224
+ useEffect(() => {
3225
+ if (open) {
3226
+ if (valuesProp === void 0) setValues(seed);
3227
+ setAdvancedOpen(false);
3228
+ setNameTouched(Boolean(seed.name));
3229
+ }
3230
+ }, [open]);
3231
+ const id = testIdOr(testId, { testId: "agent-creator" });
3232
+ const name = values.name;
3233
+ const nameValid = isValidAgentName(name);
3234
+ const canSubmit = (isEdit || nameValid) && !isSaving;
3235
+ const patch = (next) => setValues({ ...values, ...next });
3236
+ const setPersona = (persona) => patch({ persona, ...!isEdit && !nameTouched ? { name: deriveAgentName(persona) } : {} });
3237
+ const applyTemplate = (t) => patch({
3238
+ persona: t.persona,
3239
+ capabilities: Object.fromEntries(
3240
+ capabilities.map((c) => [c.key, t.capabilities.includes(c.key)])
3241
+ ),
3242
+ ...!isEdit && !nameTouched ? { name: deriveAgentName(t.persona) } : {}
3243
+ });
3244
+ const summary = summarizeAgent(capabilities, values, workspaces, l);
3245
+ return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(
3246
+ DialogContent,
3247
+ {
3248
+ presentation: "sheet",
3249
+ className: "max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-xl",
3250
+ "data-testid": id,
3251
+ children: [
3252
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [
3253
+ /* @__PURE__ */ jsx(DialogTitle, { children: isEdit ? l.titleEdit(agentName ?? name) : l.titleNew }),
3254
+ /* @__PURE__ */ jsx(DialogDescription, { children: isEdit ? l.descriptionEdit : l.descriptionNew })
3255
+ ] }),
3256
+ /* @__PURE__ */ jsxs(
3257
+ "form",
3258
+ {
3259
+ className: "flex flex-col gap-5",
3260
+ onSubmit: (event) => {
3261
+ event.preventDefault();
3262
+ if (canSubmit) onSubmit(values);
3263
+ },
3264
+ children: [
3265
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
3266
+ /* @__PURE__ */ jsx(Label, { htmlFor: "agent-creator-describe", children: l.describe }),
3267
+ /* @__PURE__ */ jsx(
3268
+ Textarea,
3269
+ {
3270
+ id: "agent-creator-describe",
3271
+ "data-testid": `${id}-describe`,
3272
+ value: values.persona,
3273
+ placeholder: l.describePlaceholder,
3274
+ rows: 4,
3275
+ autoFocus: true,
3276
+ onChange: (e) => setPersona(e.target.value)
3277
+ }
3278
+ ),
3279
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: l.describeHint })
3280
+ ] }),
3281
+ !isEdit && templates.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", "data-testid": `${id}-templates`, children: [
3282
+ /* @__PURE__ */ jsx(Label, { children: l.startFrom }),
3283
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: templates.map((t) => /* @__PURE__ */ jsx(
3284
+ "button",
3285
+ {
3286
+ type: "button",
3287
+ title: t.description,
3288
+ onClick: () => applyTemplate(t),
3289
+ "data-testid": `${id}-template-${t.id}`,
3290
+ className: cn(
3291
+ "rounded-full border border-border px-3 py-1.5 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring pointer-coarse:min-h-11 [&:hover]:bg-accent"
3292
+ ),
3293
+ children: t.title
3294
+ },
3295
+ t.id
3296
+ )) })
3297
+ ] }),
3298
+ /* @__PURE__ */ jsxs(
3299
+ "div",
3300
+ {
3301
+ className: "rounded-lg bg-muted p-3 text-sm",
3302
+ "data-testid": `${id}-summary`,
3303
+ "aria-live": "polite",
3304
+ children: [
3305
+ /* @__PURE__ */ jsxs("div", { className: "mb-1 flex items-center gap-1.5 text-xs font-medium text-muted-foreground", children: [
3306
+ /* @__PURE__ */ jsx(Sparkles, { className: "size-4 text-ai-ink", "aria-hidden": "true" }),
3307
+ l.summaryHeading
3308
+ ] }),
3309
+ summary.map((line) => /* @__PURE__ */ jsx("p", { children: line }, line)),
3310
+ /* @__PURE__ */ jsx(
3311
+ "button",
3312
+ {
3313
+ type: "button",
3314
+ onClick: () => setAdvancedOpen(true),
3315
+ "data-testid": `${id}-summary-change`,
3316
+ className: "mt-1 text-xs font-medium text-primary underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring pointer-coarse:min-h-11",
3317
+ children: l.summaryChange
3318
+ }
3319
+ )
3320
+ ]
3321
+ }
3322
+ ),
3323
+ /* @__PURE__ */ jsxs("div", { className: "flex items-end gap-4", children: [
3324
+ typeof avatar === "function" ? avatar(values) : avatar,
3325
+ !isEdit && /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-1.5", children: [
3326
+ /* @__PURE__ */ jsx(Label, { htmlFor: "agent-creator-name", children: l.name }),
3327
+ /* @__PURE__ */ jsx(
3328
+ Input,
3329
+ {
3330
+ id: "agent-creator-name",
3331
+ "data-testid": `${id}-name`,
3332
+ value: name,
3333
+ placeholder: "research-assistant",
3334
+ "aria-invalid": name !== "" && !nameValid ? true : void 0,
3335
+ onChange: (e) => {
3336
+ setNameTouched(true);
3337
+ patch({ name: e.target.value });
3338
+ }
3339
+ }
3340
+ ),
3341
+ name !== "" && !nameValid && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: l.nameInvalid })
3342
+ ] })
3343
+ ] }),
3344
+ /* @__PURE__ */ jsx(
3345
+ FoldSection,
3346
+ {
3347
+ label: l.advanced,
3348
+ open: advancedOpen,
3349
+ onOpenChange: setAdvancedOpen,
3350
+ testId: `${id}-advanced-toggle`,
3351
+ children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
3352
+ !isEdit && types && types.length > 0 && /* @__PURE__ */ jsx(
3353
+ AgentTypeSelector,
3354
+ {
3355
+ value: values.type,
3356
+ onChange: (type) => patch({ type }),
3357
+ options: types,
3358
+ testId: `${id}-type`,
3359
+ optionTestId: (value) => `${id}-type-${value}`
3360
+ }
3361
+ ),
3362
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
3363
+ /* @__PURE__ */ jsx(Label, { children: l.capabilities }),
3364
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: l.toolsHint }),
3365
+ /* @__PURE__ */ jsx(CapabilityGrid, { testId: `${id}-capabilities`, children: capabilities.map((c) => /* @__PURE__ */ jsx(
3366
+ CapabilityTile,
3367
+ {
3368
+ label: c.label,
3369
+ description: c.description,
3370
+ icon: c.icon,
3371
+ selected: Boolean(values.capabilities[c.key]),
3372
+ onToggle: () => patch({
3373
+ capabilities: {
3374
+ ...values.capabilities,
3375
+ [c.key]: !values.capabilities[c.key]
3376
+ }
3377
+ }),
3378
+ testId: `${id}-cap-${c.key}`
3379
+ },
3380
+ c.key
3381
+ )) })
3382
+ ] }),
3383
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", "data-testid": `${id}-workspaces`, children: [
3384
+ /* @__PURE__ */ jsx(Label, { children: l.workspaceAccess }),
3385
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: l.workspaceAccessHint }),
3386
+ workspaces.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: l.noWorkspacesToGrant }) : /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: workspaces.map((w) => {
3387
+ const already = grantedWorkspaceIds.includes(w.id);
3388
+ const on = already || values.workspaceIds.includes(w.id);
3389
+ return /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1", children: [
3390
+ /* @__PURE__ */ jsx(
3391
+ "button",
3392
+ {
3393
+ type: "button",
3394
+ role: "checkbox",
3395
+ "aria-checked": on,
3396
+ disabled: already,
3397
+ title: already ? l.workspaceAlready : void 0,
3398
+ "data-testid": `${id}-workspace-${w.id}`,
3399
+ onClick: () => patch({
3400
+ workspaceIds: on ? values.workspaceIds.filter((x) => x !== w.id) : [...values.workspaceIds, w.id]
3401
+ }),
3402
+ className: cn(
3403
+ "rounded-md border px-3 py-1.5 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-60 pointer-coarse:min-h-11",
3404
+ on ? "border-primary bg-primary/10 text-primary" : "border-border [&:hover:not(:disabled)]:bg-accent"
3405
+ ),
3406
+ children: w.name
3407
+ }
3408
+ ),
3409
+ already && onRevokeWorkspace && /* @__PURE__ */ jsx(
3410
+ "button",
3411
+ {
3412
+ type: "button",
3413
+ "aria-label": l.revokeWorkspace(w.name),
3414
+ title: l.revokeWorkspace(w.name),
3415
+ disabled: revokingWorkspaceId === w.id,
3416
+ "data-testid": `${id}-workspace-${w.id}-revoke`,
3417
+ onClick: () => onRevokeWorkspace(w.id),
3418
+ className: "flex size-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 pointer-coarse:size-11",
3419
+ children: /* @__PURE__ */ jsx(X, { className: "size-4", "aria-hidden": true })
3420
+ }
3421
+ )
3422
+ ] }, w.id);
3423
+ }) })
3424
+ ] }),
3425
+ models.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
3426
+ /* @__PURE__ */ jsx(Label, { children: l.model }),
3427
+ /* @__PURE__ */ jsxs(
3428
+ Select,
3429
+ {
3430
+ value: values.modelName || "__auto__",
3431
+ onValueChange: (v) => patch({ modelName: v === "__auto__" ? "" : v }),
3432
+ children: [
3433
+ /* @__PURE__ */ jsx(SelectTrigger, { "data-testid": `${id}-model`, className: "pointer-coarse:min-h-11", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
3434
+ /* @__PURE__ */ jsxs(SelectContent, { children: [
3435
+ /* @__PURE__ */ jsx(SelectItem, { value: "__auto__", children: l.modelAuto }),
3436
+ models.map((m) => /* @__PURE__ */ jsx(SelectItem, { value: m, children: m }, m))
3437
+ ] })
3438
+ ]
3439
+ }
3440
+ )
3441
+ ] }),
3442
+ typeof advanced === "function" ? advanced(values) : advanced
3443
+ ] })
3444
+ }
3445
+ ),
3446
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col-reverse sm:flex-row sm:justify-end gap-2 border-t border-border pt-3", children: [
3447
+ /* @__PURE__ */ jsx(
3448
+ Button,
3449
+ {
3450
+ type: "button",
3451
+ variant: "ghost",
3452
+ onClick: () => onOpenChange(false),
3453
+ "data-testid": `${id}-cancel`,
3454
+ className: "pointer-coarse:min-h-11",
3455
+ children: l.cancel
3456
+ }
3457
+ ),
3458
+ /* @__PURE__ */ jsxs(
3459
+ Button,
3460
+ {
3461
+ type: "submit",
3462
+ disabled: !canSubmit,
3463
+ "data-testid": `${id}-submit`,
3464
+ className: "gap-1.5 pointer-coarse:min-h-11",
3465
+ children: [
3466
+ isSaving ? /* @__PURE__ */ jsx(Loader2, { className: "size-4 animate-spin" }) : /* @__PURE__ */ jsx(Sparkles, { className: "size-4" }),
3467
+ isSaving ? l.saving : isEdit ? l.save : l.create
3468
+ ]
3469
+ }
3470
+ )
3471
+ ] })
3472
+ ]
3473
+ }
3474
+ )
3475
+ ]
3476
+ }
3477
+ ) });
3478
+ }
3479
+
3480
+ // src/agents/definitions/persona.ts
3481
+ function composePersona(name, description) {
3482
+ const body = description.trim();
3483
+ const preamble = `You are ${name}, an AI agent.`;
3484
+ return body ? `${preamble} ${body}` : preamble;
3485
+ }
3486
+ function stripPersonaPreamble(persona) {
3487
+ return persona.replace(/^You are .+?, an AI agent\.\s*/, "").trim();
3488
+ }
3489
+ function agentCreatorToConfigSection(values, capabilityKeys) {
3490
+ return {
3491
+ PERSONA: composePersona(values.name, values.persona),
3492
+ ...values.modelName ? { AGENT_MODEL_NAME: values.modelName } : {},
3493
+ ...Object.fromEntries(capabilityKeys.map((k) => [k, !!values.capabilities[k]]))
3494
+ };
3495
+ }
3496
+ function agentConfigSectionToValues(section, capabilityKeys) {
3497
+ const s = section ?? {};
3498
+ return {
3499
+ persona: stripPersonaPreamble(String(s.PERSONA ?? "")),
3500
+ modelName: String(s.AGENT_MODEL_NAME ?? ""),
3501
+ capabilities: Object.fromEntries(capabilityKeys.map((k) => [k, Boolean(s[k])]))
3502
+ };
3503
+ }
3504
+ var DEFAULT_AGENT_CAPABILITIES = [
3505
+ {
3506
+ key: "WEB_SEARCH_ENABLED",
3507
+ label: "Web search",
3508
+ description: "Current facts, cited sources",
3509
+ icon: Globe
3510
+ },
3511
+ {
3512
+ key: "RUN_CODE_ENABLED",
3513
+ label: "Run code",
3514
+ description: "Exact numbers, real computation",
3515
+ icon: Terminal
3516
+ },
3517
+ {
3518
+ key: "DEEP_RESEARCH_ENABLED",
3519
+ label: "Deep research",
3520
+ description: "Multi-source investigations",
3521
+ icon: Telescope
3522
+ },
3523
+ {
3524
+ key: "PLANNING_ENABLED",
3525
+ label: "Planning",
3526
+ description: "Plans complex work first",
3527
+ icon: ListChecks
3528
+ },
3529
+ {
3530
+ key: "ARTIFACTS_ENABLED",
3531
+ label: "Documents",
3532
+ description: "Drafts and edits documents",
3533
+ icon: FileText
3534
+ },
3535
+ {
3536
+ key: "IMAGE_ENABLED",
3537
+ label: "Images",
3538
+ description: "Generates and edits images",
3539
+ icon: ImageIcon
3540
+ },
3541
+ { key: "MEMORY_ENABLED", label: "Memory", description: "Remembers across sessions", icon: Brain },
3542
+ { key: "SKILLS_ENABLED", label: "Skills", description: "May follow your skills", icon: Wand2 }
3543
+ ];
3544
+ var DEFAULT_AGENT_TEMPLATES = [
3545
+ {
3546
+ id: "researcher",
3547
+ title: "Researcher",
3548
+ description: "Looks things up and cites its sources",
3549
+ persona: "Researches a question thoroughly, reads the best sources, and cites every claim. Says plainly when something could not be confirmed.",
3550
+ capabilities: ["WEB_SEARCH_ENABLED", "DEEP_RESEARCH_ENABLED", "PLANNING_ENABLED"]
3551
+ },
3552
+ {
3553
+ id: "analyst",
3554
+ title: "Analyst",
3555
+ description: "Works through numbers and data",
3556
+ persona: "Works through data carefully, checks its arithmetic by running code, and explains how it reached each figure.",
3557
+ capabilities: ["RUN_CODE_ENABLED", "PLANNING_ENABLED", "ARTIFACTS_ENABLED"]
3558
+ },
3559
+ {
3560
+ id: "note-taker",
3561
+ title: "Note taker",
3562
+ description: "Keeps notes and remembers context",
3563
+ persona: "Keeps concise notes, remembers what matters between sessions, and drafts clean summaries on request.",
3564
+ capabilities: ["MEMORY_ENABLED", "ARTIFACTS_ENABLED"]
3565
+ },
3566
+ { id: "blank", title: "Blank", description: "Start from nothing", persona: "", capabilities: [] }
3567
+ ];
3568
+ var DEFAULT_AGENT_TYPES = [
3569
+ {
3570
+ value: "builtin",
3571
+ title: "Built-in",
3572
+ description: "Runs on ARBI\u2019s servers \u2014 woken by tasks and messages."
3573
+ },
3574
+ {
3575
+ value: "external",
3576
+ title: "External",
3577
+ description: "Connect a Claude or OpenClaw runtime from your machine."
3578
+ }
3579
+ ];
3580
+ function AgentConnectInstructions({ email, signingKey }) {
3581
+ const { notify, runtimeConfig } = useBlocksEnvironment();
3582
+ const [agentBackend, setAgentBackend] = useState("claude");
3583
+ const [copied, setCopied] = useState(false);
3584
+ const setupScript = useMemo(
3585
+ () => [
3586
+ "npm install -g @arbidocs/cli",
3587
+ `arbi config set-url https://${runtimeConfig.deploymentDomain}`,
3588
+ `arbi login --email ${email} --signing-key ${signingKey}`,
3589
+ `arbi listen --agent ${agentBackend}`
3590
+ ].join("\n"),
3591
+ [email, signingKey, agentBackend, runtimeConfig.deploymentDomain]
3592
+ );
3593
+ const handleCopy = useCallback(async () => {
3594
+ try {
3595
+ await navigator.clipboard.writeText(setupScript);
3596
+ setCopied(true);
3597
+ notify("Setup commands copied", "success");
3598
+ setTimeout(() => setCopied(false), 2e3);
3599
+ } catch {
3600
+ notify("Failed to copy", "error");
3601
+ }
3602
+ }, [setupScript, notify]);
3603
+ return /* @__PURE__ */ jsxs(
3604
+ "div",
3605
+ {
3606
+ className: "space-y-2 rounded-lg border border-yellow-border bg-yellow-bg/60 p-3",
3607
+ "data-testid": "agent-connect-instructions",
3608
+ children: [
3609
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3", children: [
3610
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: "Connect it \u2014 run on the agent machine:" }),
3611
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
3612
+ /* @__PURE__ */ jsx(Label, { htmlFor: "agent-backend", className: "text-xs text-muted-foreground", children: "Runtime" }),
3613
+ /* @__PURE__ */ jsxs(
3614
+ "select",
3615
+ {
3616
+ id: "agent-backend",
3617
+ value: agentBackend,
3618
+ onChange: (e) => setAgentBackend(e.target.value),
3619
+ className: "h-7 rounded-md border border-input bg-background px-2 text-xs",
3620
+ "data-testid": "agent-backend-select",
3621
+ children: [
3622
+ /* @__PURE__ */ jsx("option", { value: "claude", children: "claude" }),
3623
+ /* @__PURE__ */ jsx("option", { value: "openclaw", children: "openclaw" })
3624
+ ]
3625
+ }
3626
+ )
3627
+ ] })
3628
+ ] }),
3629
+ /* @__PURE__ */ jsx(
3630
+ "pre",
3631
+ {
3632
+ className: "select-all whitespace-pre-wrap break-all rounded-md bg-muted p-3 text-xs font-mono leading-relaxed",
3633
+ "data-testid": "agent-setup-script",
3634
+ children: setupScript
3635
+ }
3636
+ ),
3637
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
3638
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "The signing key is shown only once \u2014 copy it now. It cannot be recovered." }),
3639
+ /* @__PURE__ */ jsxs(Button, { variant: "outline", size: "sm", onClick: handleCopy, className: "shrink-0", children: [
3640
+ copied ? /* @__PURE__ */ jsx(Check, { className: "mr-2 h-4 w-4" }) : /* @__PURE__ */ jsx(Copy, { className: "mr-2 h-4 w-4" }),
3641
+ "Copy"
3642
+ ] })
3643
+ ] })
3644
+ ]
3645
+ }
3646
+ );
3647
+ }
2975
3648
  function SkillTypeBadge({ type, className }) {
2976
3649
  return /* @__PURE__ */ jsx(
2977
3650
  "span",
@@ -4643,7 +5316,172 @@ function TaskActivityTimeline({
4643
5316
  );
4644
5317
  }) });
4645
5318
  }
5319
+ function TaskActivityDialog({
5320
+ open,
5321
+ onOpenChange,
5322
+ taskName,
5323
+ events,
5324
+ isLoading,
5325
+ isError,
5326
+ labels,
5327
+ testId,
5328
+ ...timeline
5329
+ }) {
5330
+ const l = { ...DEFAULT_TASK_ACTIVITY_LABELS, ...labels };
5331
+ const id = testIdOr(testId, { testId: "task-activity" });
5332
+ const count = events?.length ?? 0;
5333
+ const scrollToEnd = useCallback(
5334
+ (el) => {
5335
+ if (count >= 0) el?.scrollIntoView?.({ block: "end" });
5336
+ },
5337
+ [count]
5338
+ );
5339
+ return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { presentation: "sheet", className: "max-h-[80dvh] sm:max-w-lg", "data-testid": id, children: [
5340
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [
5341
+ /* @__PURE__ */ jsx(DialogTitle, { children: l.title }),
5342
+ /* @__PURE__ */ jsx(DialogDescription, { className: "truncate", children: taskName })
5343
+ ] }),
5344
+ /* @__PURE__ */ jsxs("div", { className: "max-h-[55dvh] overflow-y-auto pr-1", "data-testid": `${id}-scroll`, children: [
5345
+ isLoading && !events ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: l.loading }) : isError && !events ? /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: l.error }) : count === 0 ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: l.empty }) : /* @__PURE__ */ jsx(TaskActivityTimeline, { events: events ?? [], labels, testId: id, ...timeline }),
5346
+ /* @__PURE__ */ jsx("div", { ref: scrollToEnd })
5347
+ ] })
5348
+ ] }) });
5349
+ }
5350
+ var DEFAULT_TASK_RUNS_DIALOG_LABELS = {
5351
+ title: (taskName) => `Run history \u2014 ${taskName}`,
5352
+ description: "Every time this task ran. Open a run to read or watch it in its conversation.",
5353
+ loading: "Loading runs\u2026",
5354
+ empty: "This task hasn\u2019t run yet.",
5355
+ open: "Open"
5356
+ };
5357
+ var STATUS_STYLE = {
5358
+ running: "bg-ai-soft text-ai-ink",
5359
+ success: "bg-green-bg text-green-text",
5360
+ completed: "bg-green-bg text-green-text",
5361
+ failed: "bg-red-bg text-red-text"
5362
+ };
5363
+ function TaskRunsDialog({
5364
+ inline = false,
5365
+ renderErrorReport,
5366
+ hideHeader = false,
5367
+ open,
5368
+ onOpenChange,
5369
+ taskName,
5370
+ runs,
5371
+ isLoading,
5372
+ onOpenRun,
5373
+ onOpenResult,
5374
+ getRunHref,
5375
+ testIds,
5376
+ labels
5377
+ }) {
5378
+ const l = { ...DEFAULT_TASK_RUNS_DIALOG_LABELS, ...labels };
5379
+ const columns = useMemo(
5380
+ () => [
5381
+ {
5382
+ colId: "status",
5383
+ field: "status",
5384
+ headerName: "Status",
5385
+ width: 160,
5386
+ minWidth: 140,
5387
+ cellRenderer: ({ data }) => data && /* @__PURE__ */ jsx(
5388
+ "span",
5389
+ {
5390
+ className: cn(
5391
+ "rounded-full px-2 py-0.5 text-xs font-medium capitalize",
5392
+ STATUS_STYLE[data.status] ?? "text-muted-foreground"
5393
+ ),
5394
+ children: workflowRunStatusLabel(data.status)
5395
+ }
5396
+ )
5397
+ },
5398
+ { colId: "when", field: "when", headerName: "Run", flex: 2, minWidth: 240 },
5399
+ {
5400
+ colId: "result",
5401
+ headerName: "",
5402
+ width: 280,
5403
+ minWidth: 220,
5404
+ sortable: false,
5405
+ cellRenderer: ({ data: run }) => {
5406
+ if (!run) return null;
5407
+ return /* @__PURE__ */ jsxs("div", { className: "flex h-full items-center gap-2", children: [
5408
+ run.error && renderErrorReport?.(run),
5409
+ (run.conversationId || run.resultId && onOpenResult) && /* @__PURE__ */ jsx(Button, { asChild: true, variant: "ghost", size: "sm", className: "h-7 gap-1.5", children: /* @__PURE__ */ jsxs(
5410
+ ActionLink,
5411
+ {
5412
+ href: getRunHref?.(run),
5413
+ onSelect: () => {
5414
+ if (run.conversationId) onOpenRun(run.conversationId);
5415
+ else if (run.resultId) onOpenResult?.(run.resultId);
5416
+ onOpenChange(false);
5417
+ },
5418
+ "data-testid": testIdOr(testIds?.open, { testId: "task-run-open" }),
5419
+ children: [
5420
+ /* @__PURE__ */ jsx(Eye, { size: 13 }),
5421
+ " ",
5422
+ l.open
5423
+ ]
5424
+ }
5425
+ ) })
5426
+ ] });
5427
+ }
5428
+ }
5429
+ ],
5430
+ [onOpenRun, onOpenResult, getRunHref, onOpenChange, testIds?.open, l.open, renderErrorReport]
5431
+ );
5432
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [
5433
+ hideHeader ? null : inline ? /* @__PURE__ */ jsx(
5434
+ TabHeader,
5435
+ {
5436
+ tabs: [
5437
+ {
5438
+ id: "history",
5439
+ label: l.title(taskName),
5440
+ count: runs.length,
5441
+ countIcon: /* @__PURE__ */ jsx(History, { size: 14 }),
5442
+ presentation: "count",
5443
+ onClose: () => onOpenChange(false)
5444
+ }
5445
+ ],
5446
+ activeTabId: "history",
5447
+ onTabChange: () => {
5448
+ }
5449
+ }
5450
+ ) : /* @__PURE__ */ jsxs(DialogHeader, { children: [
5451
+ /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2", children: [
5452
+ /* @__PURE__ */ jsx(History, { size: 16 }),
5453
+ " ",
5454
+ l.title(taskName)
5455
+ ] }),
5456
+ /* @__PURE__ */ jsx(DialogDescription, { children: l.description })
5457
+ ] }),
5458
+ /* @__PURE__ */ jsx("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsx(
5459
+ GridView,
5460
+ {
5461
+ testId: testIdOr(testIds?.list, { testId: "task-runs-list" }),
5462
+ gridId: "workflow-runs",
5463
+ items: runs,
5464
+ columnDefs: columns,
5465
+ getItemId: (run) => run.id,
5466
+ getRowTestId: () => testIdOr(testIds?.row, { testId: "task-run-row" }),
5467
+ isLoading,
5468
+ loadingMessage: l.loading,
5469
+ emptyState: { title: l.empty },
5470
+ height: "100%"
5471
+ }
5472
+ ) })
5473
+ ] });
5474
+ return inline ? /* @__PURE__ */ jsx("section", { className: "flex min-h-0 flex-1 flex-col", "data-testid": "automation-history", children: content }) : /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsx(
5475
+ DialogContent,
5476
+ {
5477
+ presentation: "sheet",
5478
+ className: "flex h-[min(32rem,calc(100dvh-2rem))] min-h-0 max-w-3xl flex-col",
5479
+ "data-testid": testIdOr(testIds?.modal, { testId: "task-runs-modal" }),
5480
+ children: content
5481
+ }
5482
+ ) });
5483
+ }
4646
5484
 
4647
- export { ActionStepBody, AgentSelect, ApprovalEvidence, AssigneeLine, DEFAULT_AGENT_SELECT_LABELS, DEFAULT_SCHEMA_FORM_LABELS, DEFAULT_SKILL_EDIT_FORM_LABELS, DEFAULT_SKILL_GENERATE_FORM_LABELS, DEFAULT_SKILL_GLOBAL_BADGE_LABELS, DEFAULT_SKILL_VIEW_TOGGLE_LABELS, DEFAULT_STEP_BAR_LABELS, DEFAULT_TASK_ACTIVITY_LABELS, DEFAULT_TASK_TRIGGER_CHIP_LABELS, DEFAULT_WORKFLOW_CONFIG_DIALOG_LABELS, DEFAULT_WORKFLOW_DOCUMENTS_FIELD_LABELS, DEFAULT_WORKFLOW_LIST_LABELS, DEFAULT_WORKFLOW_RUNNER_LABELS, DEFAULT_WORKFLOW_STEP_PARTS_LABELS, PersonPill, SKILL_FIELD_TYPE_LABELS, SKILL_MAIN_FILENAME, SKILL_SOURCE_LABELS, SKILL_TYPES, SKILL_TYPE_LABELS, STEP_LABEL, STEP_LABEL_CURRENT, STEP_LABEL_MAX, SchemaForm, SendBackControl, SkillActionButton, SkillDetail, SkillDetailSection, SkillEditForm, SkillFilterChips, SkillGenerateForm, SkillGlobalBadge, SkillLibraryDetail, SkillTile, SkillTypeBadge, SkillViewToggle, StepBarFrame, TaskActivityTimeline, TaskTriggerChip, WORKFLOW_COLUMN_ORDER, WorkflowConfigDialog, WorkflowDocumentsField, WorkflowLauncher, WorkflowRunner, WorkflowStepBar, WorkflowsTable, activateOnKey, activeStepId, buildLibrarySkills, buildWorkflowScopeSource, buildZipSkillImport, createWorkflowColumns, documentScopeLabels, filterLibrarySkills, fromPlanAssignee, fromPlanDocumentRef, fromPlanSteps, hasTrigger, importMarkdownSkill, importSkillFile, importSkillFromUrl, isIncompleteSignal, isMainSkillFile, isSkillRow, layoutFromPlanSteps, matchWorkflowScope, parseSkillFrontmatter, readSkillArchive, serializeSkill, skillSlug, stepWindow, taskActivityHeadline, toPlanAssignee, toPlanDocumentRef, toPlanSteps, useControllableState, useWorkflowView, workflowFromSkillMarkdown, workflowRunStatusLabel, workflowStatus, workflowToSkillMarkdown, workflowTriggerType };
4648
- //# sourceMappingURL=chunk-XVME4XYD.js.map
4649
- //# sourceMappingURL=chunk-XVME4XYD.js.map
5485
+ export { ActionStepBody, AgentAvatarField, AgentConnectInstructions, AgentCreator, AgentSelect, AgentTypeSelector, ApprovalEvidence, AssigneeLine, CapabilityGrid, CapabilityTile, DEFAULT_AGENT_AVATAR_FIELD_LABELS, DEFAULT_AGENT_CAPABILITIES, DEFAULT_AGENT_CREATOR_LABELS, DEFAULT_AGENT_SELECT_LABELS, DEFAULT_AGENT_TEMPLATES, DEFAULT_AGENT_TYPES, DEFAULT_AGENT_TYPE_SELECTOR_LABELS, DEFAULT_SCHEMA_FORM_LABELS, DEFAULT_SKILL_EDIT_FORM_LABELS, DEFAULT_SKILL_GENERATE_FORM_LABELS, DEFAULT_SKILL_GLOBAL_BADGE_LABELS, DEFAULT_SKILL_VIEW_TOGGLE_LABELS, DEFAULT_STEP_BAR_LABELS, DEFAULT_TASK_ACTIVITY_LABELS, DEFAULT_TASK_RUNS_DIALOG_LABELS, DEFAULT_TASK_TRIGGER_CHIP_LABELS, DEFAULT_WORKFLOW_CONFIG_DIALOG_LABELS, DEFAULT_WORKFLOW_DOCUMENTS_FIELD_LABELS, DEFAULT_WORKFLOW_LIST_LABELS, DEFAULT_WORKFLOW_RUNNER_LABELS, DEFAULT_WORKFLOW_STEP_PARTS_LABELS, PersonPill, SKILL_FIELD_TYPE_LABELS, SKILL_MAIN_FILENAME, SKILL_SOURCE_LABELS, SKILL_TYPES, SKILL_TYPE_LABELS, STEP_LABEL, STEP_LABEL_CURRENT, STEP_LABEL_MAX, SchemaForm, SendBackControl, SkillActionButton, SkillDetail, SkillDetailSection, SkillEditForm, SkillFilterChips, SkillGenerateForm, SkillGlobalBadge, SkillLibraryDetail, SkillTile, SkillTypeBadge, SkillViewToggle, StepBarFrame, TaskActivityDialog, TaskActivityTimeline, TaskRunsDialog, TaskTriggerChip, WORKFLOW_COLUMN_ORDER, WorkflowConfigDialog, WorkflowDocumentsField, WorkflowLauncher, WorkflowRunner, WorkflowStepBar, WorkflowsTable, activateOnKey, activeStepId, agentConfigSectionToValues, agentCreatorToConfigSection, buildLibrarySkills, buildWorkflowScopeSource, buildZipSkillImport, composePersona, createWorkflowColumns, deriveAgentName, documentScopeLabels, filterLibrarySkills, fromPlanAssignee, fromPlanDocumentRef, fromPlanSteps, hasTrigger, importMarkdownSkill, importSkillFile, importSkillFromUrl, isIncompleteSignal, isMainSkillFile, isSkillRow, isValidAgentName, layoutFromPlanSteps, matchWorkflowScope, parseSkillFrontmatter, readSkillArchive, serializeSkill, skillSlug, stepWindow, stripPersonaPreamble, summarizeAgent, summarizeCapabilities, taskActivityHeadline, toPlanAssignee, toPlanDocumentRef, toPlanSteps, useControllableState, useWorkflowView, workflowFromSkillMarkdown, workflowStatus, workflowToSkillMarkdown, workflowTriggerType };
5486
+ //# sourceMappingURL=chunk-6QMWP5IU.js.map
5487
+ //# sourceMappingURL=chunk-6QMWP5IU.js.map