@arbidocs/blocks 0.4.137 → 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.
- package/dist/agents/definitions/AgentConnectInstructions.d.ts +12 -0
- package/dist/agents/definitions/defaults.d.ts +12 -0
- package/dist/agents/definitions/index.d.ts +2 -0
- package/dist/agents/index.cjs +457 -418
- package/dist/agents/index.js +12 -13
- package/dist/agents/skills/SkillLibraryDetail.d.ts +26 -0
- package/dist/agents/skills/index.d.ts +2 -0
- package/dist/agents/skills/skillLibrary.d.ts +46 -0
- package/dist/calendar/CalendarFormDialog.d.ts +13 -0
- package/dist/calendar/ProposeTimeDialog.d.ts +22 -0
- package/dist/calendar/WeeklyHoursEditor.d.ts +7 -0
- package/dist/calendar/access-setup.d.ts +8 -0
- package/dist/calendar/api-mapping.d.ts +22 -0
- package/dist/calendar/booking-form.d.ts +46 -0
- package/dist/calendar/conference.d.ts +11 -0
- package/dist/calendar/errors.d.ts +7 -0
- package/dist/calendar/feeds.d.ts +2 -0
- package/dist/calendar/freebusy.d.ts +22 -0
- package/dist/calendar/ics.d.ts +33 -0
- package/dist/calendar/index.cjs +472 -4293
- package/dist/calendar/index.cjs.map +1 -1
- package/dist/calendar/index.d.ts +17 -1
- package/dist/calendar/index.js +1 -4227
- package/dist/calendar/index.js.map +1 -1
- package/dist/calendar/requests.d.ts +42 -0
- package/dist/calendar/room-window.d.ts +6 -0
- package/dist/calendar/settings-value.d.ts +4 -0
- package/dist/calls/index.cjs +4 -4
- package/dist/calls/index.js +3 -3
- package/dist/chat/index.cjs +141 -141
- package/dist/chat/index.js +6 -6
- package/dist/{chunk-M33QUNFH.js → chunk-22WFGXG2.js} +3 -3
- package/dist/{chunk-M33QUNFH.js.map → chunk-22WFGXG2.js.map} +1 -1
- package/dist/{chunk-VMESMX7N.js → chunk-453PNNNW.js} +3 -3
- package/dist/{chunk-VMESMX7N.js.map → chunk-453PNNNW.js.map} +1 -1
- package/dist/{chunk-2KUCVSFF.js → chunk-45LRMW54.js} +3 -3
- package/dist/{chunk-2KUCVSFF.js.map → chunk-45LRMW54.js.map} +1 -1
- package/dist/chunk-5FTIHRZH.cjs +177 -0
- package/dist/chunk-5FTIHRZH.cjs.map +1 -0
- package/dist/{chunk-FUTMU4FR.js → chunk-5HFPRI3W.js} +3 -3
- package/dist/{chunk-FUTMU4FR.js.map → chunk-5HFPRI3W.js.map} +1 -1
- package/dist/{chunk-JY73DJOS.cjs → chunk-5UXDUOOB.cjs} +84 -1211
- package/dist/chunk-5UXDUOOB.cjs.map +1 -0
- package/dist/{chunk-ATJUVHVB.js → chunk-6QMWP5IU.js} +1445 -11
- package/dist/chunk-6QMWP5IU.js.map +1 -0
- package/dist/chunk-6YTHQ73P.cjs +5334 -0
- package/dist/chunk-6YTHQ73P.cjs.map +1 -0
- package/dist/{chunk-KMNZ2RVO.js → chunk-7QUUZBQZ.js} +15 -1109
- package/dist/chunk-7QUUZBQZ.js.map +1 -0
- package/dist/{chunk-C3ZRLULA.cjs → chunk-7X255TOM.cjs} +5 -5
- package/dist/{chunk-C3ZRLULA.cjs.map → chunk-7X255TOM.cjs.map} +1 -1
- package/dist/chunk-A3XPS2EU.js +245 -0
- package/dist/chunk-A3XPS2EU.js.map +1 -0
- package/dist/chunk-B3AHCIV5.js +5206 -0
- package/dist/chunk-B3AHCIV5.js.map +1 -0
- package/dist/{chunk-2Q7FDZAY.js → chunk-BPBSSMRB.js} +5 -163
- package/dist/chunk-BPBSSMRB.js.map +1 -0
- package/dist/{chunk-KSHKTOY2.js → chunk-CKCBBYTA.js} +205 -5
- package/dist/chunk-CKCBBYTA.js.map +1 -0
- package/dist/chunk-CYNF5PZI.js +170 -0
- package/dist/chunk-CYNF5PZI.js.map +1 -0
- package/dist/{chunk-OPTBQSCV.cjs → chunk-DJM7DLCT.cjs} +3 -3
- package/dist/{chunk-OPTBQSCV.cjs.map → chunk-DJM7DLCT.cjs.map} +1 -1
- package/dist/{chunk-E5OYHJMU.js → chunk-DN55PRGS.js} +4 -4
- package/dist/{chunk-E5OYHJMU.js.map → chunk-DN55PRGS.js.map} +1 -1
- package/dist/{chunk-VHJHY7TT.js → chunk-ECERC6TI.js} +3 -3
- package/dist/{chunk-VHJHY7TT.js.map → chunk-ECERC6TI.js.map} +1 -1
- package/dist/{chunk-KDUGTKVI.cjs → chunk-GFNELPDP.cjs} +17 -6
- package/dist/chunk-GFNELPDP.cjs.map +1 -0
- package/dist/{chunk-OGBXV326.cjs → chunk-GFRQG36Y.cjs} +2 -243
- package/dist/chunk-GFRQG36Y.cjs.map +1 -0
- package/dist/{chunk-WXYQ66KC.cjs → chunk-HEMU73OP.cjs} +2 -166
- package/dist/chunk-HEMU73OP.cjs.map +1 -0
- package/dist/{chunk-UUHUQHXR.cjs → chunk-JZNXRMLH.cjs} +6 -6
- package/dist/{chunk-UUHUQHXR.cjs.map → chunk-JZNXRMLH.cjs.map} +1 -1
- package/dist/{chunk-HDYWXEQU.cjs → chunk-K3HNLWZZ.cjs} +8 -8
- package/dist/{chunk-HDYWXEQU.cjs.map → chunk-K3HNLWZZ.cjs.map} +1 -1
- package/dist/{chunk-7M4C6CK7.js → chunk-KTFDUSON.js} +4 -4
- package/dist/{chunk-7M4C6CK7.js.map → chunk-KTFDUSON.js.map} +1 -1
- package/dist/{chunk-HLB4DIYV.cjs → chunk-MABUMUCA.cjs} +6 -6
- package/dist/{chunk-HLB4DIYV.cjs.map → chunk-MABUMUCA.cjs.map} +1 -1
- package/dist/{chunk-RQ2Y7USX.cjs → chunk-MIDXCYZB.cjs} +235 -15
- package/dist/chunk-MIDXCYZB.cjs.map +1 -0
- package/dist/{chunk-L3T7OJRX.js → chunk-MTPWZQTL.js} +4 -4
- package/dist/{chunk-L3T7OJRX.js.map → chunk-MTPWZQTL.js.map} +1 -1
- package/dist/{chunk-BUNZWOPX.cjs → chunk-O4ZIQDUT.cjs} +5 -5
- package/dist/{chunk-BUNZWOPX.cjs.map → chunk-O4ZIQDUT.cjs.map} +1 -1
- package/dist/{chunk-W3VYZXNS.js → chunk-O6W6RW3B.js} +5 -240
- package/dist/chunk-O6W6RW3B.js.map +1 -0
- package/dist/{chunk-WS5EX7DN.cjs → chunk-OGP6MQXQ.cjs} +3 -3
- package/dist/{chunk-WS5EX7DN.cjs.map → chunk-OGP6MQXQ.cjs.map} +1 -1
- package/dist/{chunk-6F7SZCVL.cjs → chunk-OWCEQKAR.cjs} +3 -3
- package/dist/{chunk-6F7SZCVL.cjs.map → chunk-OWCEQKAR.cjs.map} +1 -1
- package/dist/{chunk-OQ7RUNOC.js → chunk-PC5KVHX3.js} +22 -6
- package/dist/chunk-PC5KVHX3.js.map +1 -0
- package/dist/{chunk-CHVCTKF4.cjs → chunk-ULEDHANM.cjs} +1543 -66
- package/dist/chunk-ULEDHANM.cjs.map +1 -0
- package/dist/{chunk-L2PAPOZ5.js → chunk-US3S4DCB.js} +17 -6
- package/dist/chunk-US3S4DCB.js.map +1 -0
- package/dist/chunk-V46W7YLI.cjs +252 -0
- package/dist/chunk-V46W7YLI.cjs.map +1 -0
- package/dist/{chunk-3RJN2VTL.js → chunk-XDQXDWE7.js} +3 -3
- package/dist/{chunk-3RJN2VTL.js.map → chunk-XDQXDWE7.js.map} +1 -1
- package/dist/{chunk-EHOPZBAX.cjs → chunk-XOC44HQY.cjs} +12 -12
- package/dist/{chunk-EHOPZBAX.cjs.map → chunk-XOC44HQY.cjs.map} +1 -1
- package/dist/{chunk-YOMPLCP6.js → chunk-Y5KTM3V5.js} +3 -3
- package/dist/{chunk-YOMPLCP6.js.map → chunk-Y5KTM3V5.js.map} +1 -1
- package/dist/{chunk-DWZXSPMB.cjs → chunk-ZAVEMQ37.cjs} +3 -3
- package/dist/{chunk-DWZXSPMB.cjs.map → chunk-ZAVEMQ37.cjs.map} +1 -1
- package/dist/{chunk-AAFX64WD.cjs → chunk-ZXAWOLBQ.cjs} +22 -5
- package/dist/chunk-ZXAWOLBQ.cjs.map +1 -0
- package/dist/citations/QuietMarks.d.ts +5 -2
- package/dist/citations/index.cjs +15 -14
- package/dist/citations/index.js +3 -2
- package/dist/collaboration/index.cjs +51 -51
- package/dist/collaboration/index.js +3 -3
- package/dist/connect/docx.cjs +6 -6
- package/dist/connect/docx.js +5 -5
- package/dist/connect/index.cjs +6595 -1600
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.d.ts +5 -0
- package/dist/connect/index.js +5064 -90
- package/dist/connect/index.js.map +1 -1
- package/dist/connection/ConnectedAgentCreator.d.ts +37 -0
- package/dist/connection/ConnectedSkillsLibrary.d.ts +26 -0
- package/dist/connection/ConnectedWorkflowHistory.d.ts +45 -0
- package/dist/connection/ConnectionProvider.d.ts +3 -1
- package/dist/connection/calendar/AddCalendarDialogs.d.ts +9 -0
- package/dist/connection/calendar/BookingPagesPanel.d.ts +13 -0
- package/dist/connection/calendar/CalendarAccountsPanel.d.ts +5 -0
- package/dist/connection/calendar/CalendarSettingsDialog.d.ts +12 -0
- package/dist/connection/calendar/ConnectedCalendar.d.ts +13 -0
- package/dist/connection/calendar/ConnectedMailInviteCard.d.ts +12 -0
- package/dist/connection/calendar/ConnectedPublicBooking.d.ts +9 -0
- package/dist/connection/calendar/ConnectedUpcomingEvents.d.ts +12 -0
- package/dist/connection/calendar/CopyField.d.ts +9 -0
- package/dist/connection/calendar/EventEditorDialog.d.ts +29 -0
- package/dist/connection/calendar/EventScheduling.d.ts +8 -0
- package/dist/connection/calendar/InvitationsPanel.d.ts +5 -0
- package/dist/connection/calendar/OpenAccessPanel.d.ts +7 -0
- package/dist/connection/calendar/PublishCalendarDialog.d.ts +8 -0
- package/dist/connection/calendar/RoomsDirectoryPanel.d.ts +8 -0
- package/dist/connection/calendar/ShareCalendarDialog.d.ts +6 -0
- package/dist/connection/calendar/copy.d.ts +2 -0
- package/dist/connection/calendar/index.d.ts +6 -0
- package/dist/connection/calendar/store.d.ts +47 -0
- package/dist/connection/calendar/types.d.ts +36 -0
- package/dist/connection/calendar/useWebinarAttendee.d.ts +3 -0
- package/dist/connection/notification-center/ConnectedNotificationCenter.d.ts +15 -0
- package/dist/connection/notification-center/NotificationCenter.d.ts +37 -0
- package/dist/connection/notification-center/NotificationEvent.d.ts +33 -0
- package/dist/connection/notification-center/index.d.ts +4 -0
- package/dist/connection/notification-center/items.d.ts +44 -0
- package/dist/document-tools/index.cjs +1 -1
- package/dist/document-tools/index.js +1 -1
- package/dist/facts/index.cjs +6 -6
- package/dist/facts/index.js +6 -6
- package/dist/files/index.cjs +6 -6
- package/dist/files/index.js +6 -6
- package/dist/home/index.cjs +20 -20
- package/dist/home/index.js +5 -5
- package/dist/index.cjs +969 -928
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +26 -25
- package/dist/index.js.map +1 -1
- package/dist/retrieval/index.cjs +1 -1
- package/dist/retrieval/index.js +1 -1
- package/dist/settings/index.cjs +58 -72
- package/dist/settings/index.cjs.map +1 -1
- package/dist/settings/index.js +6 -23
- package/dist/settings/index.js.map +1 -1
- package/dist/shell/index.cjs +61 -60
- package/dist/shell/index.js +5 -4
- package/dist/site/index.cjs +5 -5
- package/dist/site/index.js +1 -1
- package/dist/studio/index.cjs +11 -11
- package/dist/studio/index.js +9 -9
- package/dist/workflow-canvas/index.cjs +69 -70
- package/dist/workflow-canvas/index.cjs.map +1 -1
- package/dist/workflow-canvas/index.js +14 -15
- package/dist/workflow-canvas/index.js.map +1 -1
- package/dist/workspaces/index.cjs +2 -2
- package/dist/workspaces/index.js +2 -2
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +4 -4
- package/dist/chunk-2Q7FDZAY.js.map +0 -1
- package/dist/chunk-AAFX64WD.cjs.map +0 -1
- package/dist/chunk-ATJUVHVB.js.map +0 -1
- package/dist/chunk-CHVCTKF4.cjs.map +0 -1
- package/dist/chunk-CQCC7LE7.js +0 -210
- package/dist/chunk-CQCC7LE7.js.map +0 -1
- package/dist/chunk-JY73DJOS.cjs.map +0 -1
- package/dist/chunk-KDUGTKVI.cjs.map +0 -1
- package/dist/chunk-KMNZ2RVO.js.map +0 -1
- package/dist/chunk-KSHKTOY2.js.map +0 -1
- package/dist/chunk-L2PAPOZ5.js.map +0 -1
- package/dist/chunk-OGBXV326.cjs.map +0 -1
- package/dist/chunk-OQ7RUNOC.js.map +0 -1
- package/dist/chunk-RFIBUWLF.cjs +0 -232
- package/dist/chunk-RFIBUWLF.cjs.map +0 -1
- package/dist/chunk-RQ2Y7USX.cjs.map +0 -1
- package/dist/chunk-W3VYZXNS.js.map +0 -1
- package/dist/chunk-WXYQ66KC.cjs.map +0 -1
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { DocumentPicker, TriStateFilterMenu } from './chunk-
|
|
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
|
-
import {
|
|
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 {
|
|
9
|
+
import { useBlocksEnvironment } from './chunk-YNIBUKV5.js';
|
|
9
10
|
import { TabHeader } from './chunk-4WWM3GQ5.js';
|
|
10
|
-
import { defaultInputs, validateInputs, workflowSteps, canAssign, fieldToFrontmatter, workflowFromFrontmatter, nextAction, validateStep, assigneeName, runFieldsOf, failedUpstream, stepPhase, useElementSize, sendBackTargets, formatDate, shownValue, stepKindOf, stepLevels, waitingDocuments, stepDependencies, reviewInstructions, splitDocRef, isPersonStep, eventWaitingDocuments, waitingForDocumentsText, StepBadgeMark, StepChip, buildLaunch, STEP_KIND_ICONS, DEFAULT_STEP_KIND_LABELS, composeStepPrompt, isRunFinished, runFields, isWorkflowScope } from './chunk-
|
|
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,
|
|
16
|
-
import { cn, Label, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Dialog, DialogContent, Button, getEntityColor, Popover, PopoverTrigger, PopoverContent, Textarea, Card, UserEntity, getEntityColorStyles, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, badgeVariants, VisibilityToggle, Switch
|
|
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,1078 @@ 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
|
+
}
|
|
3648
|
+
function SkillTypeBadge({ type, className }) {
|
|
3649
|
+
return /* @__PURE__ */ jsx(
|
|
3650
|
+
"span",
|
|
3651
|
+
{
|
|
3652
|
+
className: cn(
|
|
3653
|
+
"shrink-0 rounded bg-background px-1.5 py-0.5 text-xs uppercase tracking-wide text-muted-foreground",
|
|
3654
|
+
className
|
|
3655
|
+
),
|
|
3656
|
+
"data-slot": "skill-type-badge",
|
|
3657
|
+
children: type
|
|
3658
|
+
}
|
|
3659
|
+
);
|
|
3660
|
+
}
|
|
3661
|
+
var DEFAULT_SKILL_GLOBAL_BADGE_LABELS = {
|
|
3662
|
+
global: "Global",
|
|
3663
|
+
globalTitle: "Shared with everyone in the marketplace"
|
|
3664
|
+
};
|
|
3665
|
+
function SkillGlobalBadge({
|
|
3666
|
+
className,
|
|
3667
|
+
labels
|
|
3668
|
+
}) {
|
|
3669
|
+
const l = { ...DEFAULT_SKILL_GLOBAL_BADGE_LABELS, ...labels };
|
|
3670
|
+
return /* @__PURE__ */ jsxs(
|
|
3671
|
+
"span",
|
|
3672
|
+
{
|
|
3673
|
+
className: cn(
|
|
3674
|
+
"inline-flex shrink-0 items-center gap-1 rounded bg-accent px-1.5 py-0.5 text-xs uppercase tracking-wide text-accent-foreground",
|
|
3675
|
+
className
|
|
3676
|
+
),
|
|
3677
|
+
title: l.globalTitle,
|
|
3678
|
+
"data-slot": "skill-global-badge",
|
|
3679
|
+
children: [
|
|
3680
|
+
/* @__PURE__ */ jsx(Globe, { className: "size-3" }),
|
|
3681
|
+
l.global
|
|
3682
|
+
]
|
|
3683
|
+
}
|
|
3684
|
+
);
|
|
3685
|
+
}
|
|
3686
|
+
function SkillActionButton({
|
|
3687
|
+
label,
|
|
3688
|
+
tooltip,
|
|
3689
|
+
onClick,
|
|
3690
|
+
children,
|
|
3691
|
+
testId
|
|
3692
|
+
}) {
|
|
3693
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
3694
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, onFocusCapture: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(
|
|
3695
|
+
Button,
|
|
3696
|
+
{
|
|
3697
|
+
variant: "ghost",
|
|
3698
|
+
size: "icon",
|
|
3699
|
+
className: "size-7 shrink-0 pointer-coarse:size-11",
|
|
3700
|
+
onClick: (e) => {
|
|
3701
|
+
e.stopPropagation();
|
|
3702
|
+
onClick(e);
|
|
3703
|
+
},
|
|
3704
|
+
"aria-label": label,
|
|
3705
|
+
"data-testid": testId,
|
|
3706
|
+
children
|
|
3707
|
+
}
|
|
3708
|
+
) }),
|
|
3709
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: tooltip ?? label }) })
|
|
3710
|
+
] });
|
|
3711
|
+
}
|
|
3712
|
+
function activateOnKey(handler) {
|
|
3713
|
+
return (e) => {
|
|
3714
|
+
if (e.target !== e.currentTarget) return;
|
|
3715
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
3716
|
+
e.preventDefault();
|
|
3717
|
+
handler();
|
|
3718
|
+
}
|
|
3719
|
+
};
|
|
3720
|
+
}
|
|
3721
|
+
var DEFAULT_SKILL_GENERATE_FORM_LABELS = {
|
|
3722
|
+
title: "Generate with AI",
|
|
3723
|
+
hint: "Describe what the skill should do. The assistant drafts it in chat, then you can edit it here.",
|
|
3724
|
+
placeholder: "e.g. Summarize a contract into key obligations, dates, and parties",
|
|
3725
|
+
generate: "Generate with AI",
|
|
3726
|
+
writeManually: "\u2026or write it manually"
|
|
3727
|
+
};
|
|
3728
|
+
function SkillGenerateForm({
|
|
3729
|
+
onGenerate,
|
|
3730
|
+
onManual,
|
|
3731
|
+
icon,
|
|
3732
|
+
labels,
|
|
3733
|
+
testIds
|
|
3734
|
+
}) {
|
|
3735
|
+
const l = { ...DEFAULT_SKILL_GENERATE_FORM_LABELS, ...labels };
|
|
3736
|
+
const [desc, setDesc] = useState("");
|
|
3737
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col gap-4 overflow-y-auto p-4", "data-slot": "skill-generate-form", children: [
|
|
3738
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-lg bg-muted p-4", children: [
|
|
3739
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-1 flex items-center gap-2", children: [
|
|
3740
|
+
/* @__PURE__ */ jsx(Wand2, { className: "size-4 text-primary" }),
|
|
3741
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: l.title })
|
|
3742
|
+
] }),
|
|
3743
|
+
/* @__PURE__ */ jsx("p", { className: "mb-3 text-xs text-muted-foreground", children: l.hint }),
|
|
3744
|
+
/* @__PURE__ */ jsx(
|
|
3745
|
+
Textarea,
|
|
3746
|
+
{
|
|
3747
|
+
value: desc,
|
|
3748
|
+
onChange: (e) => setDesc(e.target.value),
|
|
3749
|
+
rows: 4,
|
|
3750
|
+
placeholder: l.placeholder,
|
|
3751
|
+
"data-testid": testIdOr(testIds?.description, { testId: "skills-panel-ai-desc" })
|
|
3752
|
+
}
|
|
3753
|
+
),
|
|
3754
|
+
/* @__PURE__ */ jsx("div", { className: "mt-3 flex justify-end", children: /* @__PURE__ */ jsxs(
|
|
3755
|
+
Button,
|
|
3756
|
+
{
|
|
3757
|
+
size: "sm",
|
|
3758
|
+
disabled: !desc.trim(),
|
|
3759
|
+
onClick: () => onGenerate(desc.trim()),
|
|
3760
|
+
"data-testid": testIdOr(testIds?.generate, { testId: "skills-panel-ai-generate" }),
|
|
3761
|
+
children: [
|
|
3762
|
+
icon && /* @__PURE__ */ jsx("span", { className: "mr-1 [&>svg]:size-4", children: icon }),
|
|
3763
|
+
l.generate
|
|
3764
|
+
]
|
|
3765
|
+
}
|
|
3766
|
+
) })
|
|
3767
|
+
] }),
|
|
3768
|
+
/* @__PURE__ */ jsx(
|
|
3769
|
+
"button",
|
|
3770
|
+
{
|
|
3771
|
+
type: "button",
|
|
3772
|
+
className: "self-start text-sm text-muted-foreground underline-offset-2 hover:text-foreground hover:underline pointer-coarse:min-h-11",
|
|
3773
|
+
onClick: onManual,
|
|
3774
|
+
"data-testid": testIdOr(testIds?.writeManually, { testId: "skills-panel-write-manually" }),
|
|
3775
|
+
children: l.writeManually
|
|
3776
|
+
}
|
|
3777
|
+
)
|
|
3778
|
+
] });
|
|
3779
|
+
}
|
|
3780
|
+
var DEFAULT_SKILL_EDIT_FORM_LABELS = {
|
|
3781
|
+
name: "Name",
|
|
3782
|
+
namePlaceholder: "contract-summary",
|
|
3783
|
+
invokedAs: (name) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3784
|
+
"Invoked as ",
|
|
3785
|
+
/* @__PURE__ */ jsxs("span", { className: "font-mono", children: [
|
|
3786
|
+
"/",
|
|
3787
|
+
name || "skill-name"
|
|
3788
|
+
] })
|
|
3789
|
+
] }),
|
|
3790
|
+
description: "Description",
|
|
3791
|
+
descriptionPlaceholder: "What it does and when to use it",
|
|
3792
|
+
instructions: "Instructions",
|
|
3793
|
+
cancel: "Cancel",
|
|
3794
|
+
saving: "Saving\u2026",
|
|
3795
|
+
saveChanges: "Save changes",
|
|
3796
|
+
create: "Create skill"
|
|
3797
|
+
};
|
|
3798
|
+
var FIELD_LABEL = "text-xs font-semibold uppercase tracking-wide text-muted-foreground";
|
|
3799
|
+
function SkillEditForm({
|
|
3800
|
+
name,
|
|
3801
|
+
onNameChange,
|
|
3802
|
+
isNameLocked,
|
|
3803
|
+
nameError,
|
|
3804
|
+
description,
|
|
3805
|
+
onDescriptionChange,
|
|
3806
|
+
editor,
|
|
3807
|
+
isSaving,
|
|
3808
|
+
isEditing,
|
|
3809
|
+
onSave,
|
|
3810
|
+
onCancel,
|
|
3811
|
+
labels,
|
|
3812
|
+
testIds
|
|
3813
|
+
}) {
|
|
3814
|
+
const l = { ...DEFAULT_SKILL_EDIT_FORM_LABELS, ...labels };
|
|
3815
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex h-full min-h-0 flex-col", "data-slot": "skill-edit-form", children: [
|
|
3816
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto p-4", children: [
|
|
3817
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
3818
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "sp-name", className: FIELD_LABEL, children: l.name }),
|
|
3819
|
+
/* @__PURE__ */ jsx(
|
|
3820
|
+
Input,
|
|
3821
|
+
{
|
|
3822
|
+
id: "sp-name",
|
|
3823
|
+
value: name,
|
|
3824
|
+
disabled: isNameLocked,
|
|
3825
|
+
placeholder: l.namePlaceholder,
|
|
3826
|
+
onChange: (e) => onNameChange(e.target.value),
|
|
3827
|
+
className: "mt-1",
|
|
3828
|
+
"data-testid": testIdOr(testIds?.name, { testId: "skills-panel-edit-name" })
|
|
3829
|
+
}
|
|
3830
|
+
),
|
|
3831
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: l.invokedAs(name) }),
|
|
3832
|
+
nameError && /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-destructive", children: nameError })
|
|
3833
|
+
] }),
|
|
3834
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
3835
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "sp-desc", className: FIELD_LABEL, children: l.description }),
|
|
3836
|
+
/* @__PURE__ */ jsx(
|
|
3837
|
+
Input,
|
|
3838
|
+
{
|
|
3839
|
+
id: "sp-desc",
|
|
3840
|
+
value: description,
|
|
3841
|
+
placeholder: l.descriptionPlaceholder,
|
|
3842
|
+
onChange: (e) => onDescriptionChange(e.target.value),
|
|
3843
|
+
className: "mt-1",
|
|
3844
|
+
"data-testid": testIdOr(testIds?.description, { testId: "skills-panel-edit-desc" })
|
|
3845
|
+
}
|
|
3846
|
+
)
|
|
3847
|
+
] }),
|
|
3848
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 flex-col", children: [
|
|
3849
|
+
/* @__PURE__ */ jsx(Label, { className: `${FIELD_LABEL} mb-1`, children: l.instructions }),
|
|
3850
|
+
/* @__PURE__ */ jsx("div", { className: "min-h-[240px] flex-1 overflow-hidden rounded-md border border-border", children: editor })
|
|
3851
|
+
] })
|
|
3852
|
+
] }),
|
|
3853
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col-reverse sm:flex-row sm:justify-end gap-2 border-t border-border px-4 py-3", children: [
|
|
3854
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", onClick: onCancel, children: l.cancel }),
|
|
3855
|
+
/* @__PURE__ */ jsx(
|
|
3856
|
+
Button,
|
|
3857
|
+
{
|
|
3858
|
+
size: "sm",
|
|
3859
|
+
onClick: onSave,
|
|
3860
|
+
disabled: isSaving,
|
|
3861
|
+
"data-testid": testIdOr(testIds?.save, { testId: "skills-panel-edit-save" }),
|
|
3862
|
+
children: isSaving ? l.saving : isEditing ? l.saveChanges : l.create
|
|
3863
|
+
}
|
|
3864
|
+
)
|
|
3865
|
+
] })
|
|
3866
|
+
] });
|
|
3867
|
+
}
|
|
3868
|
+
function SkillFilterChips({
|
|
3869
|
+
options,
|
|
3870
|
+
value,
|
|
3871
|
+
onChange,
|
|
3872
|
+
label,
|
|
3873
|
+
testIdPrefix = "skills-filter",
|
|
3874
|
+
className
|
|
3875
|
+
}) {
|
|
3876
|
+
return /* @__PURE__ */ jsx(
|
|
3877
|
+
"div",
|
|
3878
|
+
{
|
|
3879
|
+
role: "radiogroup",
|
|
3880
|
+
"aria-label": label,
|
|
3881
|
+
className: cn("flex flex-wrap gap-2", className),
|
|
3882
|
+
"data-slot": "skill-filter-chips",
|
|
3883
|
+
children: options.map((option) => {
|
|
3884
|
+
const selected = option.id === value;
|
|
3885
|
+
return /* @__PURE__ */ jsxs(
|
|
3886
|
+
"button",
|
|
3887
|
+
{
|
|
3888
|
+
type: "button",
|
|
3889
|
+
role: "radio",
|
|
3890
|
+
"aria-checked": selected,
|
|
3891
|
+
onClick: () => onChange(option.id),
|
|
3892
|
+
"data-testid": `${testIdPrefix}-${option.id}`,
|
|
3893
|
+
className: cn(
|
|
3894
|
+
"inline-flex min-h-8 items-center gap-1.5 rounded-full border px-3 text-sm transition-colors pointer-coarse:min-h-11 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
3895
|
+
selected ? "border-primary bg-primary/10 text-foreground" : "border-border bg-background text-muted-foreground [&:hover]:bg-muted"
|
|
3896
|
+
),
|
|
3897
|
+
children: [
|
|
3898
|
+
option.label,
|
|
3899
|
+
option.count !== void 0 && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: option.count })
|
|
3900
|
+
]
|
|
3901
|
+
},
|
|
3902
|
+
option.id
|
|
3903
|
+
);
|
|
3904
|
+
})
|
|
3905
|
+
}
|
|
3906
|
+
);
|
|
3907
|
+
}
|
|
3908
|
+
var DEFAULT_SKILL_VIEW_TOGGLE_LABELS = {
|
|
3909
|
+
group: "View",
|
|
3910
|
+
gallery: "Gallery",
|
|
3911
|
+
list: "List"
|
|
3912
|
+
};
|
|
3913
|
+
function SkillViewToggle({ value, onChange, labels, testId }) {
|
|
3914
|
+
const l = { ...DEFAULT_SKILL_VIEW_TOGGLE_LABELS, ...labels };
|
|
3915
|
+
const item = (view, label, icon) => /* @__PURE__ */ jsx(
|
|
3916
|
+
"button",
|
|
3917
|
+
{
|
|
3918
|
+
type: "button",
|
|
3919
|
+
role: "radio",
|
|
3920
|
+
"aria-checked": value === view,
|
|
3921
|
+
"aria-label": label,
|
|
3922
|
+
title: label,
|
|
3923
|
+
onClick: () => onChange(view),
|
|
3924
|
+
"data-testid": `${testId ?? "skills-view-toggle"}-${view}`,
|
|
3925
|
+
className: cn(
|
|
3926
|
+
"flex size-8 items-center justify-center rounded-md pointer-coarse:size-11 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
3927
|
+
value === view ? "bg-background text-foreground shadow-sm" : "text-muted-foreground"
|
|
3928
|
+
),
|
|
3929
|
+
children: icon
|
|
3930
|
+
}
|
|
3931
|
+
);
|
|
3932
|
+
return /* @__PURE__ */ jsxs(
|
|
3933
|
+
"div",
|
|
3934
|
+
{
|
|
3935
|
+
role: "radiogroup",
|
|
3936
|
+
"aria-label": l.group,
|
|
3937
|
+
className: "inline-flex shrink-0 gap-0.5 rounded-lg bg-muted p-0.5",
|
|
3938
|
+
"data-testid": testId ?? "skills-view-toggle",
|
|
3939
|
+
children: [
|
|
3940
|
+
item("gallery", l.gallery, /* @__PURE__ */ jsx(LayoutGrid, { className: "size-4" })),
|
|
3941
|
+
item("list", l.list, /* @__PURE__ */ jsx(List, { className: "size-4" }))
|
|
3942
|
+
]
|
|
3943
|
+
}
|
|
3944
|
+
);
|
|
3945
|
+
}
|
|
3946
|
+
function SkillTile({
|
|
3947
|
+
name,
|
|
3948
|
+
description,
|
|
3949
|
+
sourceLabel,
|
|
3950
|
+
type,
|
|
3951
|
+
icon,
|
|
3952
|
+
layout,
|
|
3953
|
+
selected,
|
|
3954
|
+
onSelect,
|
|
3955
|
+
testId
|
|
3956
|
+
}) {
|
|
3957
|
+
const isRow = layout === "list";
|
|
3958
|
+
return /* @__PURE__ */ jsxs(
|
|
3959
|
+
"div",
|
|
3960
|
+
{
|
|
3961
|
+
role: "button",
|
|
3962
|
+
tabIndex: 0,
|
|
3963
|
+
"aria-pressed": selected,
|
|
3964
|
+
onClick: onSelect,
|
|
3965
|
+
onKeyDown: activateOnKey(onSelect),
|
|
3966
|
+
"data-testid": testId ?? `skill-tile-${name}`,
|
|
3967
|
+
"data-skill-name": name,
|
|
3968
|
+
"data-slot": "skill-tile",
|
|
3969
|
+
className: cn(
|
|
3970
|
+
"flex cursor-pointer rounded-lg border p-3 text-left transition-colors pointer-coarse:min-h-11 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
3971
|
+
isRow ? "items-center gap-3" : "h-full flex-col gap-2",
|
|
3972
|
+
selected ? "border-primary bg-primary/5" : "border-transparent bg-muted [&:hover]:bg-accent"
|
|
3973
|
+
),
|
|
3974
|
+
children: [
|
|
3975
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
3976
|
+
icon && /* @__PURE__ */ jsx("span", { className: "shrink-0 text-ai-ink [&>svg]:size-5", children: icon }),
|
|
3977
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 truncate text-sm font-semibold text-foreground", children: name })
|
|
3978
|
+
] }),
|
|
3979
|
+
/* @__PURE__ */ jsx(
|
|
3980
|
+
"p",
|
|
3981
|
+
{
|
|
3982
|
+
className: cn(
|
|
3983
|
+
"min-w-0 text-sm text-muted-foreground",
|
|
3984
|
+
isRow ? "flex-1 truncate max-sm:hidden" : "line-clamp-3"
|
|
3985
|
+
),
|
|
3986
|
+
children: description
|
|
3987
|
+
}
|
|
3988
|
+
),
|
|
3989
|
+
/* @__PURE__ */ jsxs("div", { className: cn("flex shrink-0 items-center gap-1.5", isRow && "ml-auto"), children: [
|
|
3990
|
+
type && type !== "markdown" && /* @__PURE__ */ jsx("span", { className: "rounded bg-background px-1.5 py-0.5 text-xs uppercase tracking-wide text-muted-foreground", children: type }),
|
|
3991
|
+
/* @__PURE__ */ jsx("span", { className: "rounded bg-background px-1.5 py-0.5 text-xs text-muted-foreground", children: sourceLabel })
|
|
3992
|
+
] })
|
|
3993
|
+
]
|
|
3994
|
+
}
|
|
3995
|
+
);
|
|
3996
|
+
}
|
|
3997
|
+
function SkillDetail({
|
|
3998
|
+
title,
|
|
3999
|
+
sourceLabel,
|
|
4000
|
+
description,
|
|
4001
|
+
icon,
|
|
4002
|
+
notice,
|
|
4003
|
+
children,
|
|
4004
|
+
actions,
|
|
4005
|
+
testId
|
|
4006
|
+
}) {
|
|
4007
|
+
return /* @__PURE__ */ jsxs(
|
|
4008
|
+
"section",
|
|
4009
|
+
{
|
|
4010
|
+
className: "flex min-h-0 flex-1 flex-col",
|
|
4011
|
+
"data-testid": testId ?? "skill-detail",
|
|
4012
|
+
"data-slot": "skill-detail",
|
|
4013
|
+
"aria-label": title,
|
|
4014
|
+
children: [
|
|
4015
|
+
/* @__PURE__ */ jsxs("div", { className: "min-h-0 flex-1 space-y-4 overflow-y-auto p-4", children: [
|
|
4016
|
+
/* @__PURE__ */ jsxs("header", { className: "space-y-1", children: [
|
|
4017
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
4018
|
+
icon && /* @__PURE__ */ jsx("span", { className: "text-ai-ink [&>svg]:size-5", children: icon }),
|
|
4019
|
+
/* @__PURE__ */ jsx("h3", { className: "text-base font-semibold text-foreground", children: title }),
|
|
4020
|
+
/* @__PURE__ */ jsx("span", { className: "rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground", children: sourceLabel })
|
|
4021
|
+
] }),
|
|
4022
|
+
description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: description }),
|
|
4023
|
+
notice && /* @__PURE__ */ jsx("p", { className: "text-sm text-foreground", children: notice })
|
|
4024
|
+
] }),
|
|
4025
|
+
children
|
|
4026
|
+
] }),
|
|
4027
|
+
actions && /* @__PURE__ */ jsx(
|
|
4028
|
+
"div",
|
|
4029
|
+
{
|
|
4030
|
+
className: "flex flex-wrap gap-2 border-t border-border bg-background p-3",
|
|
4031
|
+
"data-slot": "skill-detail-actions",
|
|
4032
|
+
children: actions
|
|
4033
|
+
}
|
|
4034
|
+
)
|
|
4035
|
+
]
|
|
4036
|
+
}
|
|
4037
|
+
);
|
|
4038
|
+
}
|
|
4039
|
+
function SkillDetailSection({
|
|
4040
|
+
title,
|
|
4041
|
+
children,
|
|
4042
|
+
testId
|
|
4043
|
+
}) {
|
|
4044
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", "data-testid": testId, children: [
|
|
4045
|
+
/* @__PURE__ */ jsx("h4", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: title }),
|
|
4046
|
+
children
|
|
4047
|
+
] });
|
|
4048
|
+
}
|
|
2975
4049
|
|
|
2976
4050
|
// src/agents/skills/skillFiles.ts
|
|
2977
4051
|
var SKILL_TYPES = ["markdown", "python", "shell", "javascript", "typescript"];
|
|
@@ -3174,6 +4248,201 @@ async function importSkillFromUrl(url) {
|
|
|
3174
4248
|
const last = parsed.pathname.split("/").filter(Boolean).pop() ?? "skill";
|
|
3175
4249
|
return importMarkdownSkill(last.includes(".") ? last : `${last}.md`, text);
|
|
3176
4250
|
}
|
|
4251
|
+
|
|
4252
|
+
// src/agents/skills/skillLibrary.ts
|
|
4253
|
+
var SKILL_SOURCE_LABELS = {
|
|
4254
|
+
builtin: "Built in",
|
|
4255
|
+
mine: "Yours",
|
|
4256
|
+
shared: "Shared"
|
|
4257
|
+
};
|
|
4258
|
+
var SKILL_TYPE_LABELS = {
|
|
4259
|
+
markdown: "Instructions",
|
|
4260
|
+
python: "Python",
|
|
4261
|
+
shell: "Shell",
|
|
4262
|
+
javascript: "JavaScript",
|
|
4263
|
+
typescript: "TypeScript"
|
|
4264
|
+
};
|
|
4265
|
+
var SKILL_FIELD_TYPE_LABELS = {
|
|
4266
|
+
text: "Short answer",
|
|
4267
|
+
longtext: "Free text",
|
|
4268
|
+
boolean: "Yes or no",
|
|
4269
|
+
select: "A choice",
|
|
4270
|
+
number: "A number",
|
|
4271
|
+
date: "A date",
|
|
4272
|
+
scope: "Which files",
|
|
4273
|
+
documents: "Pick files",
|
|
4274
|
+
person: "A person"
|
|
4275
|
+
};
|
|
4276
|
+
function buildLibrarySkills(builtins, listings) {
|
|
4277
|
+
const { host, skills } = mergeSkillWorkflows(builtins, listings);
|
|
4278
|
+
const builtinIds = new Set(builtins.map((w) => w.id));
|
|
4279
|
+
const stored = new Map(listings.filter((s) => s.doc_ext_id).map((s) => [s.slug, s]));
|
|
4280
|
+
return [...host, ...skills].flatMap((workflow) => {
|
|
4281
|
+
if (workflow.run.kind !== "prompt") return [];
|
|
4282
|
+
const listing = stored.get(workflow.id);
|
|
4283
|
+
if (!listing?.doc_ext_id) {
|
|
4284
|
+
if (!builtinIds.has(workflow.id)) return [];
|
|
4285
|
+
return [
|
|
4286
|
+
{
|
|
4287
|
+
slug: workflow.id,
|
|
4288
|
+
title: workflow.title,
|
|
4289
|
+
description: workflow.description,
|
|
4290
|
+
source: "builtin",
|
|
4291
|
+
type: "markdown",
|
|
4292
|
+
isShared: false,
|
|
4293
|
+
replacesBuiltin: false,
|
|
4294
|
+
workflow
|
|
4295
|
+
}
|
|
4296
|
+
];
|
|
4297
|
+
}
|
|
4298
|
+
const mine = listing.is_owner ?? true;
|
|
4299
|
+
return [
|
|
4300
|
+
{
|
|
4301
|
+
slug: workflow.id,
|
|
4302
|
+
title: workflow.title,
|
|
4303
|
+
description: listing.description || workflow.description,
|
|
4304
|
+
source: mine ? "mine" : "shared",
|
|
4305
|
+
type: listing.skill_type ?? "markdown",
|
|
4306
|
+
isShared: mine && listing.visibility === "global",
|
|
4307
|
+
replacesBuiltin: mine && builtinIds.has(listing.slug),
|
|
4308
|
+
workflow,
|
|
4309
|
+
docExtId: listing.doc_ext_id
|
|
4310
|
+
}
|
|
4311
|
+
];
|
|
4312
|
+
});
|
|
4313
|
+
}
|
|
4314
|
+
function filterLibrarySkills(skills, f) {
|
|
4315
|
+
const q = f.query.trim().toLowerCase();
|
|
4316
|
+
return skills.filter((s) => f.source === "all" || s.source === f.source).filter((s) => f.type === "all" || s.type === f.type).filter(
|
|
4317
|
+
(s) => !q || s.title.toLowerCase().includes(q) || s.slug.toLowerCase().includes(q) || s.description.toLowerCase().includes(q)
|
|
4318
|
+
);
|
|
4319
|
+
}
|
|
4320
|
+
var ACTION = "pointer-coarse:min-h-11";
|
|
4321
|
+
function SkillLibraryDetail({
|
|
4322
|
+
skill,
|
|
4323
|
+
instructions,
|
|
4324
|
+
isLoading,
|
|
4325
|
+
actions,
|
|
4326
|
+
icon
|
|
4327
|
+
}) {
|
|
4328
|
+
const fields = skill.workflow.inputs;
|
|
4329
|
+
const isOwner = skill.source === "mine";
|
|
4330
|
+
const canCopy = skill.source !== "mine";
|
|
4331
|
+
const notice = skill.replacesBuiltin ? "Your copy is used instead of the original; delete it to go back." : skill.isShared ? "Shared with everyone." : void 0;
|
|
4332
|
+
return /* @__PURE__ */ jsxs(
|
|
4333
|
+
SkillDetail,
|
|
4334
|
+
{
|
|
4335
|
+
title: skill.title,
|
|
4336
|
+
sourceLabel: SKILL_SOURCE_LABELS[skill.source],
|
|
4337
|
+
description: skill.description,
|
|
4338
|
+
icon,
|
|
4339
|
+
notice,
|
|
4340
|
+
testId: "skill-detail",
|
|
4341
|
+
actions: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4342
|
+
/* @__PURE__ */ jsxs(Button, { onClick: actions.onRun, className: ACTION, "data-testid": "skill-run", children: [
|
|
4343
|
+
/* @__PURE__ */ jsx(Play, { className: "mr-1.5 size-4" }),
|
|
4344
|
+
"Run"
|
|
4345
|
+
] }),
|
|
4346
|
+
canCopy && /* @__PURE__ */ jsxs(
|
|
4347
|
+
Button,
|
|
4348
|
+
{
|
|
4349
|
+
variant: "outline",
|
|
4350
|
+
onClick: actions.onCopy,
|
|
4351
|
+
disabled: actions.isBusy,
|
|
4352
|
+
className: ACTION,
|
|
4353
|
+
"data-testid": "skill-copy",
|
|
4354
|
+
children: [
|
|
4355
|
+
/* @__PURE__ */ jsx(Copy, { className: "mr-1.5 size-4" }),
|
|
4356
|
+
"Make a copy"
|
|
4357
|
+
]
|
|
4358
|
+
}
|
|
4359
|
+
),
|
|
4360
|
+
isOwner && /* @__PURE__ */ jsxs(
|
|
4361
|
+
Button,
|
|
4362
|
+
{
|
|
4363
|
+
variant: "outline",
|
|
4364
|
+
onClick: actions.onEdit,
|
|
4365
|
+
className: ACTION,
|
|
4366
|
+
"data-testid": "skill-edit",
|
|
4367
|
+
children: [
|
|
4368
|
+
/* @__PURE__ */ jsx(Pencil, { className: "mr-1.5 size-4" }),
|
|
4369
|
+
"Edit"
|
|
4370
|
+
]
|
|
4371
|
+
}
|
|
4372
|
+
),
|
|
4373
|
+
isOwner && /* @__PURE__ */ jsxs(
|
|
4374
|
+
Button,
|
|
4375
|
+
{
|
|
4376
|
+
variant: "outline",
|
|
4377
|
+
onClick: actions.onToggleShare,
|
|
4378
|
+
disabled: actions.isBusy,
|
|
4379
|
+
className: ACTION,
|
|
4380
|
+
"data-testid": "skill-share",
|
|
4381
|
+
children: [
|
|
4382
|
+
skill.isShared ? /* @__PURE__ */ jsx(Lock, { className: "mr-1.5 size-4" }) : /* @__PURE__ */ jsx(Globe, { className: "mr-1.5 size-4" }),
|
|
4383
|
+
skill.isShared ? "Make private" : "Share with everyone"
|
|
4384
|
+
]
|
|
4385
|
+
}
|
|
4386
|
+
),
|
|
4387
|
+
/* @__PURE__ */ jsxs(
|
|
4388
|
+
Button,
|
|
4389
|
+
{
|
|
4390
|
+
variant: "outline",
|
|
4391
|
+
onClick: actions.onExport,
|
|
4392
|
+
className: ACTION,
|
|
4393
|
+
"data-testid": "skill-export",
|
|
4394
|
+
children: [
|
|
4395
|
+
/* @__PURE__ */ jsx(Download, { className: "mr-1.5 size-4" }),
|
|
4396
|
+
"Export"
|
|
4397
|
+
]
|
|
4398
|
+
}
|
|
4399
|
+
),
|
|
4400
|
+
isOwner && /* @__PURE__ */ jsxs(
|
|
4401
|
+
Button,
|
|
4402
|
+
{
|
|
4403
|
+
variant: "ghost",
|
|
4404
|
+
onClick: actions.onDelete,
|
|
4405
|
+
disabled: actions.isBusy,
|
|
4406
|
+
className: `${ACTION} ml-auto text-destructive`,
|
|
4407
|
+
"data-testid": "skill-delete",
|
|
4408
|
+
children: [
|
|
4409
|
+
/* @__PURE__ */ jsx(Trash2, { className: "mr-1.5 size-4" }),
|
|
4410
|
+
"Delete"
|
|
4411
|
+
]
|
|
4412
|
+
}
|
|
4413
|
+
)
|
|
4414
|
+
] }),
|
|
4415
|
+
children: [
|
|
4416
|
+
/* @__PURE__ */ jsx(SkillDetailSection, { title: "What it asks you", testId: "skill-inputs", children: fields.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Nothing: it starts right away." }) : /* @__PURE__ */ jsx("ul", { className: "space-y-1 text-sm", children: fields.map((field) => /* @__PURE__ */ jsxs("li", { className: "flex flex-wrap items-baseline gap-x-2", children: [
|
|
4417
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: field.label }),
|
|
4418
|
+
/* @__PURE__ */ jsxs("span", { className: "text-xs text-muted-foreground", children: [
|
|
4419
|
+
SKILL_FIELD_TYPE_LABELS[field.type],
|
|
4420
|
+
field.required ? "" : ", optional"
|
|
4421
|
+
] })
|
|
4422
|
+
] }, field.name)) }) }),
|
|
4423
|
+
/* @__PURE__ */ jsxs(
|
|
4424
|
+
SkillDetailSection,
|
|
4425
|
+
{
|
|
4426
|
+
title: skill.type === "markdown" ? "Instructions" : `Instructions (${SKILL_TYPE_LABELS[skill.type] ?? skill.type})`,
|
|
4427
|
+
children: [
|
|
4428
|
+
isLoading ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Loading\u2026" }) : /* @__PURE__ */ jsx(
|
|
4429
|
+
"pre",
|
|
4430
|
+
{
|
|
4431
|
+
className: "max-h-72 overflow-auto whitespace-pre-wrap break-words rounded-md bg-muted p-3 font-mono text-xs",
|
|
4432
|
+
tabIndex: 0,
|
|
4433
|
+
"aria-label": "Instructions",
|
|
4434
|
+
"data-testid": "skill-instructions",
|
|
4435
|
+
children: instructions || "No instructions."
|
|
4436
|
+
}
|
|
4437
|
+
),
|
|
4438
|
+
!isOwner && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "You can read these. Make a copy to change them." })
|
|
4439
|
+
]
|
|
4440
|
+
}
|
|
4441
|
+
)
|
|
4442
|
+
]
|
|
4443
|
+
}
|
|
4444
|
+
);
|
|
4445
|
+
}
|
|
3177
4446
|
function PersonPill({ person, size = "sm", testId }) {
|
|
3178
4447
|
return /* @__PURE__ */ jsx("span", { "data-testid": testId, className: "inline-flex min-w-0", children: /* @__PURE__ */ jsx(
|
|
3179
4448
|
UserEntity,
|
|
@@ -4047,7 +5316,172 @@ function TaskActivityTimeline({
|
|
|
4047
5316
|
);
|
|
4048
5317
|
}) });
|
|
4049
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
|
+
}
|
|
4050
5484
|
|
|
4051
|
-
export { ActionStepBody, AgentSelect, ApprovalEvidence, AssigneeLine, DEFAULT_AGENT_SELECT_LABELS, DEFAULT_SCHEMA_FORM_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_MAIN_FILENAME, SKILL_TYPES, STEP_LABEL, STEP_LABEL_CURRENT, STEP_LABEL_MAX, SchemaForm, SendBackControl, StepBarFrame, TaskActivityTimeline, TaskTriggerChip, WORKFLOW_COLUMN_ORDER, WorkflowConfigDialog, WorkflowDocumentsField, WorkflowLauncher, WorkflowRunner, WorkflowStepBar, WorkflowsTable, activeStepId, buildWorkflowScopeSource, buildZipSkillImport, createWorkflowColumns, documentScopeLabels, fromPlanAssignee, fromPlanDocumentRef, fromPlanSteps, hasTrigger, importMarkdownSkill, importSkillFile, importSkillFromUrl, isIncompleteSignal, isMainSkillFile, isSkillRow, layoutFromPlanSteps, matchWorkflowScope, parseSkillFrontmatter, readSkillArchive, serializeSkill, skillSlug, stepWindow, taskActivityHeadline, toPlanAssignee, toPlanDocumentRef, toPlanSteps, useControllableState, useWorkflowView, workflowFromSkillMarkdown,
|
|
4052
|
-
//# sourceMappingURL=chunk-
|
|
4053
|
-
//# sourceMappingURL=chunk-
|
|
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
|