@arbidocs/blocks 0.4.137 → 0.4.138

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 (61) hide show
  1. package/dist/agents/index.cjs +380 -356
  2. package/dist/agents/index.js +8 -8
  3. package/dist/agents/skills/SkillLibraryDetail.d.ts +26 -0
  4. package/dist/agents/skills/index.d.ts +2 -0
  5. package/dist/agents/skills/skillLibrary.d.ts +46 -0
  6. package/dist/chat/index.cjs +139 -139
  7. package/dist/chat/index.js +4 -4
  8. package/dist/{chunk-CHVCTKF4.cjs → chunk-3BI6EWKP.cjs} +672 -55
  9. package/dist/chunk-3BI6EWKP.cjs.map +1 -0
  10. package/dist/{chunk-VMESMX7N.js → chunk-5BXEYYH6.js} +3 -3
  11. package/dist/{chunk-VMESMX7N.js.map → chunk-5BXEYYH6.js.map} +1 -1
  12. package/dist/{chunk-EHOPZBAX.cjs → chunk-7YLJHTDC.cjs} +11 -11
  13. package/dist/{chunk-EHOPZBAX.cjs.map → chunk-7YLJHTDC.cjs.map} +1 -1
  14. package/dist/{chunk-M33QUNFH.js → chunk-ED4HHTIA.js} +3 -3
  15. package/dist/{chunk-M33QUNFH.js.map → chunk-ED4HHTIA.js.map} +1 -1
  16. package/dist/{chunk-HDYWXEQU.cjs → chunk-IE5CUCZK.cjs} +4 -4
  17. package/dist/{chunk-HDYWXEQU.cjs.map → chunk-IE5CUCZK.cjs.map} +1 -1
  18. package/dist/{chunk-7M4C6CK7.js → chunk-JO3EMZ4X.js} +3 -3
  19. package/dist/{chunk-7M4C6CK7.js.map → chunk-JO3EMZ4X.js.map} +1 -1
  20. package/dist/{chunk-C3ZRLULA.cjs → chunk-JVL7HUIQ.cjs} +5 -5
  21. package/dist/{chunk-C3ZRLULA.cjs.map → chunk-JVL7HUIQ.cjs.map} +1 -1
  22. package/dist/{chunk-JY73DJOS.cjs → chunk-MJKBVIV3.cjs} +80 -495
  23. package/dist/{chunk-KMNZ2RVO.js.map → chunk-MJKBVIV3.cjs.map} +1 -1
  24. package/dist/{chunk-BUNZWOPX.cjs → chunk-OAL3B2ZU.cjs} +5 -5
  25. package/dist/{chunk-BUNZWOPX.cjs.map → chunk-OAL3B2ZU.cjs.map} +1 -1
  26. package/dist/{chunk-6F7SZCVL.cjs → chunk-OWCEQKAR.cjs} +3 -3
  27. package/dist/{chunk-6F7SZCVL.cjs.map → chunk-OWCEQKAR.cjs.map} +1 -1
  28. package/dist/{chunk-KMNZ2RVO.js → chunk-UBEI6WFJ.js} +10 -411
  29. package/dist/{chunk-JY73DJOS.cjs.map → chunk-UBEI6WFJ.js.map} +1 -1
  30. package/dist/{chunk-ATJUVHVB.js → chunk-XVME4XYD.js} +604 -8
  31. package/dist/chunk-XVME4XYD.js.map +1 -0
  32. package/dist/{chunk-YOMPLCP6.js → chunk-Y5KTM3V5.js} +3 -3
  33. package/dist/{chunk-YOMPLCP6.js.map → chunk-Y5KTM3V5.js.map} +1 -1
  34. package/dist/{chunk-L3T7OJRX.js → chunk-ZNI4SW2G.js} +3 -3
  35. package/dist/{chunk-L3T7OJRX.js.map → chunk-ZNI4SW2G.js.map} +1 -1
  36. package/dist/collaboration/index.cjs +9 -9
  37. package/dist/collaboration/index.js +1 -1
  38. package/dist/connect/index.cjs +436 -54
  39. package/dist/connect/index.cjs.map +1 -1
  40. package/dist/connect/index.d.ts +1 -0
  41. package/dist/connect/index.js +399 -18
  42. package/dist/connect/index.js.map +1 -1
  43. package/dist/connection/ConnectedSkillsLibrary.d.ts +26 -0
  44. package/dist/document-tools/index.cjs +1 -1
  45. package/dist/document-tools/index.js +1 -1
  46. package/dist/facts/index.cjs +2 -2
  47. package/dist/facts/index.js +2 -2
  48. package/dist/index.cjs +650 -626
  49. package/dist/index.js +15 -15
  50. package/dist/settings/index.cjs +10 -10
  51. package/dist/settings/index.js +2 -2
  52. package/dist/site/index.cjs +5 -5
  53. package/dist/site/index.js +1 -1
  54. package/dist/studio/index.cjs +6 -6
  55. package/dist/studio/index.js +5 -5
  56. package/dist/workflow-canvas/index.cjs +59 -59
  57. package/dist/workflow-canvas/index.js +8 -8
  58. package/node_modules/@arbidocs/coedit/package.json +1 -1
  59. package/package.json +4 -4
  60. package/dist/chunk-ATJUVHVB.js.map +0 -1
  61. package/dist/chunk-CHVCTKF4.cjs.map +0 -1
@@ -1,19 +1,19 @@
1
1
  "use client";
2
- import { UploadDropzone } from './chunk-EVUEIBNU.js';
2
+ import { FoldSection, QuickActionDialogHeader, AddFilesFirst, StartTiles, ScopePicker } from './chunk-3RJN2VTL.js';
3
3
  import { DocumentPicker, TriStateFilterMenu } from './chunk-KSHKTOY2.js';
4
4
  import { EmptyState } from './chunk-P6GHJSLR.js';
5
- import { FoldSection, QuickActionDialogHeader, AddFilesFirst, StartTiles, ScopePicker } from './chunk-3RJN2VTL.js';
5
+ import { UploadDropzone } from './chunk-EVUEIBNU.js';
6
6
  import { SelectionBar, SelectionBarAction } from './chunk-NUNKSZKU.js';
7
7
  import { FilterInput } from './chunk-YU2KUMGE.js';
8
8
  import { GridView } from './chunk-N5YEF3LC.js';
9
9
  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-YOMPLCP6.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, mergeSkillWorkflows, eventWaitingDocuments, waitingForDocumentsText, StepBadgeMark, StepChip, buildLaunch, STEP_KIND_ICONS, DEFAULT_STEP_KIND_LABELS, composeStepPrompt, isRunFinished, runFields, isWorkflowScope } from './chunk-Y5KTM3V5.js';
11
11
  import { TONE_DOT, TONE_SURFACE, TONE_SOLID_BORDER, TONE_BORDER } from './chunk-AUS3KBHJ.js';
12
12
  import { testIdOr, prefixedTestId } from './chunk-7F6CBP3Z.js';
13
13
  import { initials } from './chunk-OXF2IFXG.js';
14
14
  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, MoreHorizontal, History, Pencil, Trash2, Workflow, ChevronLeft, ChevronRight, FileText, Link2, Bell, MousePointerClick, ArrowUpRight, BellRing, Flag, RotateCcw, Disc, Phone, UserRoundCog, Sparkles, MessageSquareReply, Square, KeyRound, Lock } from 'lucide-react';
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, Input } from '@arbidocs/react/ui';
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
17
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
18
18
  import { unzip, strFromU8 } from 'fflate';
19
19
 
@@ -2972,6 +2972,407 @@ function StepNotices({
2972
2972
  ))
2973
2973
  ] });
2974
2974
  }
2975
+ function SkillTypeBadge({ type, className }) {
2976
+ return /* @__PURE__ */ jsx(
2977
+ "span",
2978
+ {
2979
+ className: cn(
2980
+ "shrink-0 rounded bg-background px-1.5 py-0.5 text-xs uppercase tracking-wide text-muted-foreground",
2981
+ className
2982
+ ),
2983
+ "data-slot": "skill-type-badge",
2984
+ children: type
2985
+ }
2986
+ );
2987
+ }
2988
+ var DEFAULT_SKILL_GLOBAL_BADGE_LABELS = {
2989
+ global: "Global",
2990
+ globalTitle: "Shared with everyone in the marketplace"
2991
+ };
2992
+ function SkillGlobalBadge({
2993
+ className,
2994
+ labels
2995
+ }) {
2996
+ const l = { ...DEFAULT_SKILL_GLOBAL_BADGE_LABELS, ...labels };
2997
+ return /* @__PURE__ */ jsxs(
2998
+ "span",
2999
+ {
3000
+ className: cn(
3001
+ "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",
3002
+ className
3003
+ ),
3004
+ title: l.globalTitle,
3005
+ "data-slot": "skill-global-badge",
3006
+ children: [
3007
+ /* @__PURE__ */ jsx(Globe, { className: "size-3" }),
3008
+ l.global
3009
+ ]
3010
+ }
3011
+ );
3012
+ }
3013
+ function SkillActionButton({
3014
+ label,
3015
+ tooltip,
3016
+ onClick,
3017
+ children,
3018
+ testId
3019
+ }) {
3020
+ return /* @__PURE__ */ jsxs(Tooltip, { children: [
3021
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, onFocusCapture: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(
3022
+ Button,
3023
+ {
3024
+ variant: "ghost",
3025
+ size: "icon",
3026
+ className: "size-7 shrink-0 pointer-coarse:size-11",
3027
+ onClick: (e) => {
3028
+ e.stopPropagation();
3029
+ onClick(e);
3030
+ },
3031
+ "aria-label": label,
3032
+ "data-testid": testId,
3033
+ children
3034
+ }
3035
+ ) }),
3036
+ /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: tooltip ?? label }) })
3037
+ ] });
3038
+ }
3039
+ function activateOnKey(handler) {
3040
+ return (e) => {
3041
+ if (e.target !== e.currentTarget) return;
3042
+ if (e.key === "Enter" || e.key === " ") {
3043
+ e.preventDefault();
3044
+ handler();
3045
+ }
3046
+ };
3047
+ }
3048
+ var DEFAULT_SKILL_GENERATE_FORM_LABELS = {
3049
+ title: "Generate with AI",
3050
+ hint: "Describe what the skill should do. The assistant drafts it in chat, then you can edit it here.",
3051
+ placeholder: "e.g. Summarize a contract into key obligations, dates, and parties",
3052
+ generate: "Generate with AI",
3053
+ writeManually: "\u2026or write it manually"
3054
+ };
3055
+ function SkillGenerateForm({
3056
+ onGenerate,
3057
+ onManual,
3058
+ icon,
3059
+ labels,
3060
+ testIds
3061
+ }) {
3062
+ const l = { ...DEFAULT_SKILL_GENERATE_FORM_LABELS, ...labels };
3063
+ const [desc, setDesc] = useState("");
3064
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col gap-4 overflow-y-auto p-4", "data-slot": "skill-generate-form", children: [
3065
+ /* @__PURE__ */ jsxs("div", { className: "rounded-lg bg-muted p-4", children: [
3066
+ /* @__PURE__ */ jsxs("div", { className: "mb-1 flex items-center gap-2", children: [
3067
+ /* @__PURE__ */ jsx(Wand2, { className: "size-4 text-primary" }),
3068
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: l.title })
3069
+ ] }),
3070
+ /* @__PURE__ */ jsx("p", { className: "mb-3 text-xs text-muted-foreground", children: l.hint }),
3071
+ /* @__PURE__ */ jsx(
3072
+ Textarea,
3073
+ {
3074
+ value: desc,
3075
+ onChange: (e) => setDesc(e.target.value),
3076
+ rows: 4,
3077
+ placeholder: l.placeholder,
3078
+ "data-testid": testIdOr(testIds?.description, { testId: "skills-panel-ai-desc" })
3079
+ }
3080
+ ),
3081
+ /* @__PURE__ */ jsx("div", { className: "mt-3 flex justify-end", children: /* @__PURE__ */ jsxs(
3082
+ Button,
3083
+ {
3084
+ size: "sm",
3085
+ disabled: !desc.trim(),
3086
+ onClick: () => onGenerate(desc.trim()),
3087
+ "data-testid": testIdOr(testIds?.generate, { testId: "skills-panel-ai-generate" }),
3088
+ children: [
3089
+ icon && /* @__PURE__ */ jsx("span", { className: "mr-1 [&>svg]:size-4", children: icon }),
3090
+ l.generate
3091
+ ]
3092
+ }
3093
+ ) })
3094
+ ] }),
3095
+ /* @__PURE__ */ jsx(
3096
+ "button",
3097
+ {
3098
+ type: "button",
3099
+ className: "self-start text-sm text-muted-foreground underline-offset-2 hover:text-foreground hover:underline pointer-coarse:min-h-11",
3100
+ onClick: onManual,
3101
+ "data-testid": testIdOr(testIds?.writeManually, { testId: "skills-panel-write-manually" }),
3102
+ children: l.writeManually
3103
+ }
3104
+ )
3105
+ ] });
3106
+ }
3107
+ var DEFAULT_SKILL_EDIT_FORM_LABELS = {
3108
+ name: "Name",
3109
+ namePlaceholder: "contract-summary",
3110
+ invokedAs: (name) => /* @__PURE__ */ jsxs(Fragment, { children: [
3111
+ "Invoked as ",
3112
+ /* @__PURE__ */ jsxs("span", { className: "font-mono", children: [
3113
+ "/",
3114
+ name || "skill-name"
3115
+ ] })
3116
+ ] }),
3117
+ description: "Description",
3118
+ descriptionPlaceholder: "What it does and when to use it",
3119
+ instructions: "Instructions",
3120
+ cancel: "Cancel",
3121
+ saving: "Saving\u2026",
3122
+ saveChanges: "Save changes",
3123
+ create: "Create skill"
3124
+ };
3125
+ var FIELD_LABEL = "text-xs font-semibold uppercase tracking-wide text-muted-foreground";
3126
+ function SkillEditForm({
3127
+ name,
3128
+ onNameChange,
3129
+ isNameLocked,
3130
+ nameError,
3131
+ description,
3132
+ onDescriptionChange,
3133
+ editor,
3134
+ isSaving,
3135
+ isEditing,
3136
+ onSave,
3137
+ onCancel,
3138
+ labels,
3139
+ testIds
3140
+ }) {
3141
+ const l = { ...DEFAULT_SKILL_EDIT_FORM_LABELS, ...labels };
3142
+ return /* @__PURE__ */ jsxs("div", { className: "flex h-full min-h-0 flex-col", "data-slot": "skill-edit-form", children: [
3143
+ /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto p-4", children: [
3144
+ /* @__PURE__ */ jsxs("div", { children: [
3145
+ /* @__PURE__ */ jsx(Label, { htmlFor: "sp-name", className: FIELD_LABEL, children: l.name }),
3146
+ /* @__PURE__ */ jsx(
3147
+ Input,
3148
+ {
3149
+ id: "sp-name",
3150
+ value: name,
3151
+ disabled: isNameLocked,
3152
+ placeholder: l.namePlaceholder,
3153
+ onChange: (e) => onNameChange(e.target.value),
3154
+ className: "mt-1",
3155
+ "data-testid": testIdOr(testIds?.name, { testId: "skills-panel-edit-name" })
3156
+ }
3157
+ ),
3158
+ /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: l.invokedAs(name) }),
3159
+ nameError && /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-destructive", children: nameError })
3160
+ ] }),
3161
+ /* @__PURE__ */ jsxs("div", { children: [
3162
+ /* @__PURE__ */ jsx(Label, { htmlFor: "sp-desc", className: FIELD_LABEL, children: l.description }),
3163
+ /* @__PURE__ */ jsx(
3164
+ Input,
3165
+ {
3166
+ id: "sp-desc",
3167
+ value: description,
3168
+ placeholder: l.descriptionPlaceholder,
3169
+ onChange: (e) => onDescriptionChange(e.target.value),
3170
+ className: "mt-1",
3171
+ "data-testid": testIdOr(testIds?.description, { testId: "skills-panel-edit-desc" })
3172
+ }
3173
+ )
3174
+ ] }),
3175
+ /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 flex-col", children: [
3176
+ /* @__PURE__ */ jsx(Label, { className: `${FIELD_LABEL} mb-1`, children: l.instructions }),
3177
+ /* @__PURE__ */ jsx("div", { className: "min-h-[240px] flex-1 overflow-hidden rounded-md border border-border", children: editor })
3178
+ ] })
3179
+ ] }),
3180
+ /* @__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: [
3181
+ /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", onClick: onCancel, children: l.cancel }),
3182
+ /* @__PURE__ */ jsx(
3183
+ Button,
3184
+ {
3185
+ size: "sm",
3186
+ onClick: onSave,
3187
+ disabled: isSaving,
3188
+ "data-testid": testIdOr(testIds?.save, { testId: "skills-panel-edit-save" }),
3189
+ children: isSaving ? l.saving : isEditing ? l.saveChanges : l.create
3190
+ }
3191
+ )
3192
+ ] })
3193
+ ] });
3194
+ }
3195
+ function SkillFilterChips({
3196
+ options,
3197
+ value,
3198
+ onChange,
3199
+ label,
3200
+ testIdPrefix = "skills-filter",
3201
+ className
3202
+ }) {
3203
+ return /* @__PURE__ */ jsx(
3204
+ "div",
3205
+ {
3206
+ role: "radiogroup",
3207
+ "aria-label": label,
3208
+ className: cn("flex flex-wrap gap-2", className),
3209
+ "data-slot": "skill-filter-chips",
3210
+ children: options.map((option) => {
3211
+ const selected = option.id === value;
3212
+ return /* @__PURE__ */ jsxs(
3213
+ "button",
3214
+ {
3215
+ type: "button",
3216
+ role: "radio",
3217
+ "aria-checked": selected,
3218
+ onClick: () => onChange(option.id),
3219
+ "data-testid": `${testIdPrefix}-${option.id}`,
3220
+ className: cn(
3221
+ "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",
3222
+ selected ? "border-primary bg-primary/10 text-foreground" : "border-border bg-background text-muted-foreground [&:hover]:bg-muted"
3223
+ ),
3224
+ children: [
3225
+ option.label,
3226
+ option.count !== void 0 && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: option.count })
3227
+ ]
3228
+ },
3229
+ option.id
3230
+ );
3231
+ })
3232
+ }
3233
+ );
3234
+ }
3235
+ var DEFAULT_SKILL_VIEW_TOGGLE_LABELS = {
3236
+ group: "View",
3237
+ gallery: "Gallery",
3238
+ list: "List"
3239
+ };
3240
+ function SkillViewToggle({ value, onChange, labels, testId }) {
3241
+ const l = { ...DEFAULT_SKILL_VIEW_TOGGLE_LABELS, ...labels };
3242
+ const item = (view, label, icon) => /* @__PURE__ */ jsx(
3243
+ "button",
3244
+ {
3245
+ type: "button",
3246
+ role: "radio",
3247
+ "aria-checked": value === view,
3248
+ "aria-label": label,
3249
+ title: label,
3250
+ onClick: () => onChange(view),
3251
+ "data-testid": `${testId ?? "skills-view-toggle"}-${view}`,
3252
+ className: cn(
3253
+ "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",
3254
+ value === view ? "bg-background text-foreground shadow-sm" : "text-muted-foreground"
3255
+ ),
3256
+ children: icon
3257
+ }
3258
+ );
3259
+ return /* @__PURE__ */ jsxs(
3260
+ "div",
3261
+ {
3262
+ role: "radiogroup",
3263
+ "aria-label": l.group,
3264
+ className: "inline-flex shrink-0 gap-0.5 rounded-lg bg-muted p-0.5",
3265
+ "data-testid": testId ?? "skills-view-toggle",
3266
+ children: [
3267
+ item("gallery", l.gallery, /* @__PURE__ */ jsx(LayoutGrid, { className: "size-4" })),
3268
+ item("list", l.list, /* @__PURE__ */ jsx(List, { className: "size-4" }))
3269
+ ]
3270
+ }
3271
+ );
3272
+ }
3273
+ function SkillTile({
3274
+ name,
3275
+ description,
3276
+ sourceLabel,
3277
+ type,
3278
+ icon,
3279
+ layout,
3280
+ selected,
3281
+ onSelect,
3282
+ testId
3283
+ }) {
3284
+ const isRow = layout === "list";
3285
+ return /* @__PURE__ */ jsxs(
3286
+ "div",
3287
+ {
3288
+ role: "button",
3289
+ tabIndex: 0,
3290
+ "aria-pressed": selected,
3291
+ onClick: onSelect,
3292
+ onKeyDown: activateOnKey(onSelect),
3293
+ "data-testid": testId ?? `skill-tile-${name}`,
3294
+ "data-skill-name": name,
3295
+ "data-slot": "skill-tile",
3296
+ className: cn(
3297
+ "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",
3298
+ isRow ? "items-center gap-3" : "h-full flex-col gap-2",
3299
+ selected ? "border-primary bg-primary/5" : "border-transparent bg-muted [&:hover]:bg-accent"
3300
+ ),
3301
+ children: [
3302
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
3303
+ icon && /* @__PURE__ */ jsx("span", { className: "shrink-0 text-ai-ink [&>svg]:size-5", children: icon }),
3304
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate text-sm font-semibold text-foreground", children: name })
3305
+ ] }),
3306
+ /* @__PURE__ */ jsx(
3307
+ "p",
3308
+ {
3309
+ className: cn(
3310
+ "min-w-0 text-sm text-muted-foreground",
3311
+ isRow ? "flex-1 truncate max-sm:hidden" : "line-clamp-3"
3312
+ ),
3313
+ children: description
3314
+ }
3315
+ ),
3316
+ /* @__PURE__ */ jsxs("div", { className: cn("flex shrink-0 items-center gap-1.5", isRow && "ml-auto"), children: [
3317
+ 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 }),
3318
+ /* @__PURE__ */ jsx("span", { className: "rounded bg-background px-1.5 py-0.5 text-xs text-muted-foreground", children: sourceLabel })
3319
+ ] })
3320
+ ]
3321
+ }
3322
+ );
3323
+ }
3324
+ function SkillDetail({
3325
+ title,
3326
+ sourceLabel,
3327
+ description,
3328
+ icon,
3329
+ notice,
3330
+ children,
3331
+ actions,
3332
+ testId
3333
+ }) {
3334
+ return /* @__PURE__ */ jsxs(
3335
+ "section",
3336
+ {
3337
+ className: "flex min-h-0 flex-1 flex-col",
3338
+ "data-testid": testId ?? "skill-detail",
3339
+ "data-slot": "skill-detail",
3340
+ "aria-label": title,
3341
+ children: [
3342
+ /* @__PURE__ */ jsxs("div", { className: "min-h-0 flex-1 space-y-4 overflow-y-auto p-4", children: [
3343
+ /* @__PURE__ */ jsxs("header", { className: "space-y-1", children: [
3344
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
3345
+ icon && /* @__PURE__ */ jsx("span", { className: "text-ai-ink [&>svg]:size-5", children: icon }),
3346
+ /* @__PURE__ */ jsx("h3", { className: "text-base font-semibold text-foreground", children: title }),
3347
+ /* @__PURE__ */ jsx("span", { className: "rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground", children: sourceLabel })
3348
+ ] }),
3349
+ description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: description }),
3350
+ notice && /* @__PURE__ */ jsx("p", { className: "text-sm text-foreground", children: notice })
3351
+ ] }),
3352
+ children
3353
+ ] }),
3354
+ actions && /* @__PURE__ */ jsx(
3355
+ "div",
3356
+ {
3357
+ className: "flex flex-wrap gap-2 border-t border-border bg-background p-3",
3358
+ "data-slot": "skill-detail-actions",
3359
+ children: actions
3360
+ }
3361
+ )
3362
+ ]
3363
+ }
3364
+ );
3365
+ }
3366
+ function SkillDetailSection({
3367
+ title,
3368
+ children,
3369
+ testId
3370
+ }) {
3371
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", "data-testid": testId, children: [
3372
+ /* @__PURE__ */ jsx("h4", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: title }),
3373
+ children
3374
+ ] });
3375
+ }
2975
3376
 
2976
3377
  // src/agents/skills/skillFiles.ts
2977
3378
  var SKILL_TYPES = ["markdown", "python", "shell", "javascript", "typescript"];
@@ -3174,6 +3575,201 @@ async function importSkillFromUrl(url) {
3174
3575
  const last = parsed.pathname.split("/").filter(Boolean).pop() ?? "skill";
3175
3576
  return importMarkdownSkill(last.includes(".") ? last : `${last}.md`, text);
3176
3577
  }
3578
+
3579
+ // src/agents/skills/skillLibrary.ts
3580
+ var SKILL_SOURCE_LABELS = {
3581
+ builtin: "Built in",
3582
+ mine: "Yours",
3583
+ shared: "Shared"
3584
+ };
3585
+ var SKILL_TYPE_LABELS = {
3586
+ markdown: "Instructions",
3587
+ python: "Python",
3588
+ shell: "Shell",
3589
+ javascript: "JavaScript",
3590
+ typescript: "TypeScript"
3591
+ };
3592
+ var SKILL_FIELD_TYPE_LABELS = {
3593
+ text: "Short answer",
3594
+ longtext: "Free text",
3595
+ boolean: "Yes or no",
3596
+ select: "A choice",
3597
+ number: "A number",
3598
+ date: "A date",
3599
+ scope: "Which files",
3600
+ documents: "Pick files",
3601
+ person: "A person"
3602
+ };
3603
+ function buildLibrarySkills(builtins, listings) {
3604
+ const { host, skills } = mergeSkillWorkflows(builtins, listings);
3605
+ const builtinIds = new Set(builtins.map((w) => w.id));
3606
+ const stored = new Map(listings.filter((s) => s.doc_ext_id).map((s) => [s.slug, s]));
3607
+ return [...host, ...skills].flatMap((workflow) => {
3608
+ if (workflow.run.kind !== "prompt") return [];
3609
+ const listing = stored.get(workflow.id);
3610
+ if (!listing?.doc_ext_id) {
3611
+ if (!builtinIds.has(workflow.id)) return [];
3612
+ return [
3613
+ {
3614
+ slug: workflow.id,
3615
+ title: workflow.title,
3616
+ description: workflow.description,
3617
+ source: "builtin",
3618
+ type: "markdown",
3619
+ isShared: false,
3620
+ replacesBuiltin: false,
3621
+ workflow
3622
+ }
3623
+ ];
3624
+ }
3625
+ const mine = listing.is_owner ?? true;
3626
+ return [
3627
+ {
3628
+ slug: workflow.id,
3629
+ title: workflow.title,
3630
+ description: listing.description || workflow.description,
3631
+ source: mine ? "mine" : "shared",
3632
+ type: listing.skill_type ?? "markdown",
3633
+ isShared: mine && listing.visibility === "global",
3634
+ replacesBuiltin: mine && builtinIds.has(listing.slug),
3635
+ workflow,
3636
+ docExtId: listing.doc_ext_id
3637
+ }
3638
+ ];
3639
+ });
3640
+ }
3641
+ function filterLibrarySkills(skills, f) {
3642
+ const q = f.query.trim().toLowerCase();
3643
+ return skills.filter((s) => f.source === "all" || s.source === f.source).filter((s) => f.type === "all" || s.type === f.type).filter(
3644
+ (s) => !q || s.title.toLowerCase().includes(q) || s.slug.toLowerCase().includes(q) || s.description.toLowerCase().includes(q)
3645
+ );
3646
+ }
3647
+ var ACTION = "pointer-coarse:min-h-11";
3648
+ function SkillLibraryDetail({
3649
+ skill,
3650
+ instructions,
3651
+ isLoading,
3652
+ actions,
3653
+ icon
3654
+ }) {
3655
+ const fields = skill.workflow.inputs;
3656
+ const isOwner = skill.source === "mine";
3657
+ const canCopy = skill.source !== "mine";
3658
+ const notice = skill.replacesBuiltin ? "Your copy is used instead of the original; delete it to go back." : skill.isShared ? "Shared with everyone." : void 0;
3659
+ return /* @__PURE__ */ jsxs(
3660
+ SkillDetail,
3661
+ {
3662
+ title: skill.title,
3663
+ sourceLabel: SKILL_SOURCE_LABELS[skill.source],
3664
+ description: skill.description,
3665
+ icon,
3666
+ notice,
3667
+ testId: "skill-detail",
3668
+ actions: /* @__PURE__ */ jsxs(Fragment, { children: [
3669
+ /* @__PURE__ */ jsxs(Button, { onClick: actions.onRun, className: ACTION, "data-testid": "skill-run", children: [
3670
+ /* @__PURE__ */ jsx(Play, { className: "mr-1.5 size-4" }),
3671
+ "Run"
3672
+ ] }),
3673
+ canCopy && /* @__PURE__ */ jsxs(
3674
+ Button,
3675
+ {
3676
+ variant: "outline",
3677
+ onClick: actions.onCopy,
3678
+ disabled: actions.isBusy,
3679
+ className: ACTION,
3680
+ "data-testid": "skill-copy",
3681
+ children: [
3682
+ /* @__PURE__ */ jsx(Copy, { className: "mr-1.5 size-4" }),
3683
+ "Make a copy"
3684
+ ]
3685
+ }
3686
+ ),
3687
+ isOwner && /* @__PURE__ */ jsxs(
3688
+ Button,
3689
+ {
3690
+ variant: "outline",
3691
+ onClick: actions.onEdit,
3692
+ className: ACTION,
3693
+ "data-testid": "skill-edit",
3694
+ children: [
3695
+ /* @__PURE__ */ jsx(Pencil, { className: "mr-1.5 size-4" }),
3696
+ "Edit"
3697
+ ]
3698
+ }
3699
+ ),
3700
+ isOwner && /* @__PURE__ */ jsxs(
3701
+ Button,
3702
+ {
3703
+ variant: "outline",
3704
+ onClick: actions.onToggleShare,
3705
+ disabled: actions.isBusy,
3706
+ className: ACTION,
3707
+ "data-testid": "skill-share",
3708
+ children: [
3709
+ skill.isShared ? /* @__PURE__ */ jsx(Lock, { className: "mr-1.5 size-4" }) : /* @__PURE__ */ jsx(Globe, { className: "mr-1.5 size-4" }),
3710
+ skill.isShared ? "Make private" : "Share with everyone"
3711
+ ]
3712
+ }
3713
+ ),
3714
+ /* @__PURE__ */ jsxs(
3715
+ Button,
3716
+ {
3717
+ variant: "outline",
3718
+ onClick: actions.onExport,
3719
+ className: ACTION,
3720
+ "data-testid": "skill-export",
3721
+ children: [
3722
+ /* @__PURE__ */ jsx(Download, { className: "mr-1.5 size-4" }),
3723
+ "Export"
3724
+ ]
3725
+ }
3726
+ ),
3727
+ isOwner && /* @__PURE__ */ jsxs(
3728
+ Button,
3729
+ {
3730
+ variant: "ghost",
3731
+ onClick: actions.onDelete,
3732
+ disabled: actions.isBusy,
3733
+ className: `${ACTION} ml-auto text-destructive`,
3734
+ "data-testid": "skill-delete",
3735
+ children: [
3736
+ /* @__PURE__ */ jsx(Trash2, { className: "mr-1.5 size-4" }),
3737
+ "Delete"
3738
+ ]
3739
+ }
3740
+ )
3741
+ ] }),
3742
+ children: [
3743
+ /* @__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: [
3744
+ /* @__PURE__ */ jsx("span", { className: "font-medium", children: field.label }),
3745
+ /* @__PURE__ */ jsxs("span", { className: "text-xs text-muted-foreground", children: [
3746
+ SKILL_FIELD_TYPE_LABELS[field.type],
3747
+ field.required ? "" : ", optional"
3748
+ ] })
3749
+ ] }, field.name)) }) }),
3750
+ /* @__PURE__ */ jsxs(
3751
+ SkillDetailSection,
3752
+ {
3753
+ title: skill.type === "markdown" ? "Instructions" : `Instructions (${SKILL_TYPE_LABELS[skill.type] ?? skill.type})`,
3754
+ children: [
3755
+ isLoading ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Loading\u2026" }) : /* @__PURE__ */ jsx(
3756
+ "pre",
3757
+ {
3758
+ className: "max-h-72 overflow-auto whitespace-pre-wrap break-words rounded-md bg-muted p-3 font-mono text-xs",
3759
+ tabIndex: 0,
3760
+ "aria-label": "Instructions",
3761
+ "data-testid": "skill-instructions",
3762
+ children: instructions || "No instructions."
3763
+ }
3764
+ ),
3765
+ !isOwner && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "You can read these. Make a copy to change them." })
3766
+ ]
3767
+ }
3768
+ )
3769
+ ]
3770
+ }
3771
+ );
3772
+ }
3177
3773
  function PersonPill({ person, size = "sm", testId }) {
3178
3774
  return /* @__PURE__ */ jsx("span", { "data-testid": testId, className: "inline-flex min-w-0", children: /* @__PURE__ */ jsx(
3179
3775
  UserEntity,
@@ -4048,6 +4644,6 @@ function TaskActivityTimeline({
4048
4644
  }) });
4049
4645
  }
4050
4646
 
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, workflowRunStatusLabel, workflowStatus, workflowToSkillMarkdown, workflowTriggerType };
4052
- //# sourceMappingURL=chunk-ATJUVHVB.js.map
4053
- //# sourceMappingURL=chunk-ATJUVHVB.js.map
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