@arbidocs/blocks 0.4.89 → 0.4.91

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 (72) hide show
  1. package/dist/agents/index.cjs +283 -282
  2. package/dist/agents/index.js +7 -6
  3. package/dist/agents/workflows/types.d.ts +6 -0
  4. package/dist/{chunk-2CFW2ELM.cjs → chunk-2EI7NCUA.cjs} +2 -8
  5. package/dist/chunk-2EI7NCUA.cjs.map +1 -0
  6. package/dist/chunk-32HW2Q33.cjs +59 -0
  7. package/dist/chunk-32HW2Q33.cjs.map +1 -0
  8. package/dist/{chunk-MOJ5JQDN.cjs → chunk-3US5OIDQ.cjs} +69 -34
  9. package/dist/chunk-3US5OIDQ.cjs.map +1 -0
  10. package/dist/{chunk-DPLRHEJZ.js → chunk-5LXQPP2K.js} +4 -33
  11. package/dist/chunk-5LXQPP2K.js.map +1 -0
  12. package/dist/{chunk-QLHW7JGN.js → chunk-5NQIBJPP.js} +7 -7
  13. package/dist/{chunk-QLHW7JGN.js.map → chunk-5NQIBJPP.js.map} +1 -1
  14. package/dist/{chunk-3D5MDCQ7.js → chunk-5RQOVALO.js} +3 -3
  15. package/dist/{chunk-3D5MDCQ7.js.map → chunk-5RQOVALO.js.map} +1 -1
  16. package/dist/chunk-AUS3KBHJ.js +52 -0
  17. package/dist/chunk-AUS3KBHJ.js.map +1 -0
  18. package/dist/{chunk-CNI5QJ5B.cjs → chunk-DDYXFALG.cjs} +50 -50
  19. package/dist/{chunk-CNI5QJ5B.cjs.map → chunk-DDYXFALG.cjs.map} +1 -1
  20. package/dist/chunk-DVUZTGVL.cjs +52 -0
  21. package/dist/chunk-DVUZTGVL.cjs.map +1 -0
  22. package/dist/{chunk-TF6YMDZL.cjs → chunk-EHF63UYP.cjs} +5 -5
  23. package/dist/{chunk-TF6YMDZL.cjs.map → chunk-EHF63UYP.cjs.map} +1 -1
  24. package/dist/{chunk-I44NX2ZB.js → chunk-PGDL26TQ.js} +69 -34
  25. package/dist/chunk-PGDL26TQ.js.map +1 -0
  26. package/dist/{chunk-ZX2VPMBJ.js → chunk-YU2KUMGE.js} +2 -8
  27. package/dist/chunk-YU2KUMGE.js.map +1 -0
  28. package/dist/components/tones.d.ts +5 -0
  29. package/dist/connect/index.cjs +26 -25
  30. package/dist/connect/index.cjs.map +1 -1
  31. package/dist/connect/index.js +5 -4
  32. package/dist/connect/index.js.map +1 -1
  33. package/dist/facts/FactSourceGroup.d.ts +2 -1
  34. package/dist/facts/index.cjs +6 -6
  35. package/dist/facts/index.cjs.map +1 -1
  36. package/dist/facts/index.js +3 -3
  37. package/dist/facts/index.js.map +1 -1
  38. package/dist/files/cells/LabelMultiSelect.d.ts +11 -3
  39. package/dist/files/index.cjs +23 -16
  40. package/dist/files/index.cjs.map +1 -1
  41. package/dist/files/index.js +20 -13
  42. package/dist/files/index.js.map +1 -1
  43. package/dist/index.cjs +371 -358
  44. package/dist/index.cjs.map +1 -1
  45. package/dist/index.d.ts +1 -0
  46. package/dist/index.js +54 -49
  47. package/dist/index.js.map +1 -1
  48. package/dist/settings/index.cjs +6 -5
  49. package/dist/settings/index.cjs.map +1 -1
  50. package/dist/settings/index.js +2 -1
  51. package/dist/settings/index.js.map +1 -1
  52. package/dist/shell/FilterInput.d.ts +1 -3
  53. package/dist/shell/index.cjs +4 -4
  54. package/dist/shell/index.js +1 -1
  55. package/dist/site/index.cjs +4 -3
  56. package/dist/site/index.js +2 -1
  57. package/dist/tags/TagDetail.d.ts +10 -1
  58. package/dist/workflow-canvas/FieldOptionsEditor.d.ts +25 -0
  59. package/dist/workflow-canvas/StepInspector.d.ts +6 -2
  60. package/dist/workflow-canvas/index.cjs +179 -50
  61. package/dist/workflow-canvas/index.cjs.map +1 -1
  62. package/dist/workflow-canvas/index.d.ts +1 -0
  63. package/dist/workflow-canvas/index.js +136 -9
  64. package/dist/workflow-canvas/index.js.map +1 -1
  65. package/package.json +4 -4
  66. package/dist/chunk-2CFW2ELM.cjs.map +0 -1
  67. package/dist/chunk-DPLRHEJZ.js.map +0 -1
  68. package/dist/chunk-I44NX2ZB.js.map +0 -1
  69. package/dist/chunk-MOJ5JQDN.cjs.map +0 -1
  70. package/dist/chunk-VFUWWH52.cjs +0 -83
  71. package/dist/chunk-VFUWWH52.cjs.map +0 -1
  72. package/dist/chunk-ZX2VPMBJ.js.map +0 -1
@@ -10,5 +10,6 @@ export { TriggerInspector, DEFAULT_TRIGGER_INSPECTOR_LABELS, triggerSummary, typ
10
10
  export { DEFAULT_WORKFLOW_TRIGGER, WORKFLOW_SIGNAL_EVENT, declaredSignals, isSignalTrigger, triggerProblem, builderToWorkflowRequest, builderToWorkflowUpdate, workflowRecordToBuilder, type WorkflowStart, type WorkflowTrigger, type WorkflowBuilderValue, type DeclaredSignal, } from './trigger';
11
11
  export { WorkflowCanvas, TRIGGER_NODE, DEFAULT_WORKFLOW_CANVAS_LABELS, type WorkflowCanvasProps, type WorkflowCanvasLabels, } from './WorkflowCanvas';
12
12
  export { SignalsEditor, DEFAULT_SIGNALS_EDITOR_LABELS, signalConditions, signalSlug, type SignalsEditorProps, type SignalsEditorLabels, } from './SignalsEditor';
13
+ export { FieldOptionsEditor, DEFAULT_FIELD_OPTIONS_EDITOR_LABELS, type FieldOptionsEditorLabels, } from './FieldOptionsEditor';
13
14
  export { StepInspector, DEFAULT_STEP_INSPECTOR_LABELS, type StepInspectorProps, type StepInspectorLabels, } from './StepInspector';
14
15
  export { newSteppedWorkflow, addStep, removeStep, connectSteps, disconnectSteps, updateStep, moveStep, wouldCycle, stepIdFor, autoLayout, layoutWithDefaults, type WorkflowLayout, type WorkflowStepKind, } from './edit';
@@ -1,18 +1,19 @@
1
1
  "use client";
2
2
  import { useConnection } from '../chunk-OYMWV45N.js';
3
- import { workflowWhen, isoToLocalInput, describeRRule, RecurrenceBuilder, AgentSelect, useWorkflowPreview, localInputToIso } from '../chunk-QLHW7JGN.js';
3
+ import { workflowWhen, isoToLocalInput, describeRRule, RecurrenceBuilder, AgentSelect, useWorkflowPreview, localInputToIso } from '../chunk-5NQIBJPP.js';
4
4
  import '../chunk-4XJZ6AAY.js';
5
5
  import '../chunk-P6GHJSLR.js';
6
- import { workflowSteps, dependsOn, stepLevels, isIncompleteSignal, runFields, upstreamSteps, stepDependencies, canAssign, fromPlanSteps, layoutFromPlanSteps, validateWorkflowGraph, stepConfigProblems, WorkflowRunner, skillToWorkflow, assigneeName, orderSteps, toPlanSteps } from '../chunk-I44NX2ZB.js';
6
+ import { workflowSteps, dependsOn, stepLevels, isIncompleteSignal, runFields, upstreamSteps, stepDependencies, canAssign, fromPlanSteps, layoutFromPlanSteps, validateWorkflowGraph, stepConfigProblems, WorkflowRunner, skillToWorkflow, assigneeName, orderSteps, toPlanSteps } from '../chunk-PGDL26TQ.js';
7
7
  import '../chunk-6S5FLMWG.js';
8
8
  import '../chunk-4WWM3GQ5.js';
9
- import '../chunk-DDF5GPIJ.js';
10
- import '../chunk-XD2M6LIG.js';
11
9
  import '../chunk-RFXJYIDV.js';
12
- import '../chunk-DPLRHEJZ.js';
10
+ import '../chunk-5LXQPP2K.js';
13
11
  import '../chunk-EVUEIBNU.js';
12
+ import { TONE_DOT, TONES, isTone } from '../chunk-AUS3KBHJ.js';
14
13
  import '../chunk-NUNKSZKU.js';
15
- import '../chunk-ZX2VPMBJ.js';
14
+ import '../chunk-YU2KUMGE.js';
15
+ import '../chunk-DDF5GPIJ.js';
16
+ import '../chunk-XD2M6LIG.js';
16
17
  import '../chunk-S7PSMMRG.js';
17
18
  import '../chunk-HOXKR26S.js';
18
19
  import '../chunk-AA3PT6KR.js';
@@ -24,7 +25,7 @@ import '../chunk-ZPLG7QYF.js';
24
25
  import '../chunk-SLSBJRWW.js';
25
26
  import '../chunk-7F6CBP3Z.js';
26
27
  import '../chunk-VUNV25KB.js';
27
- import { useMemo, useState, useEffect, useCallback, useRef } from 'react';
28
+ import { useState, useMemo, useEffect, useCallback, useRef } from 'react';
28
29
  import { useWorkspaceUsers, useTags, useDocuments, useWorkflows, useSkills, useAgents, useConversations, useCreateWorkflow, useUpdateWorkflow, useRunWorkflow } from '@arbidocs/react';
29
30
  import { Label, Input, cn, Button, Textarea, Checkbox, Popover, PopoverTrigger, PopoverContent } from '@arbidocs/react/ui';
30
31
  import { X, Plus, Trash2, Maximize, Table2, Mail, PenLine, ClipboardCheck, Bot, Upload, FileInput, PencilRuler, Eye, LayoutGrid, Settings2, Loader2, Play, Save, Zap, GitBranch, FilePenLine, UserRound, Hourglass, Check, AlertTriangle, MinusCircle } from 'lucide-react';
@@ -977,6 +978,117 @@ function EditDocumentSettings({
977
978
  )
978
979
  ] });
979
980
  }
981
+ var DEFAULT_FIELD_OPTIONS_EDITOR_LABELS = {
982
+ options: "Choices",
983
+ addOption: "Add choice",
984
+ optionLabel: "Choice",
985
+ optionTone: "Colour",
986
+ noTone: "No colour",
987
+ tones: {
988
+ neutral: "Grey",
989
+ info: "Blue",
990
+ success: "Green",
991
+ warning: "Amber",
992
+ danger: "Red",
993
+ accent: "Purple",
994
+ ai: "AI"
995
+ }
996
+ };
997
+ var optionValue = (label, taken) => {
998
+ const base = label.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || "option";
999
+ let value = base;
1000
+ let n = 2;
1001
+ while (taken.includes(value)) value = `${base}_${n++}`;
1002
+ return value;
1003
+ };
1004
+ function FieldOptionsEditor({
1005
+ options,
1006
+ onChange,
1007
+ l,
1008
+ testId
1009
+ }) {
1010
+ const [fresh, setFresh] = useState(() => /* @__PURE__ */ new Set());
1011
+ const others = (i) => options.filter((_, j) => j !== i).map((o) => o.value);
1012
+ const set = (i, p) => {
1013
+ const before = options[i]?.value;
1014
+ if (before !== void 0 && p.value !== void 0 && p.value !== before && fresh.has(before))
1015
+ setFresh((s) => new Set([...s].filter((v) => v !== before)).add(p.value));
1016
+ onChange(options.map((o, j) => j === i ? { ...o, ...p } : o));
1017
+ };
1018
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", "data-testid": `${testId}-options`, children: [
1019
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: l.options }),
1020
+ options.map((o, i) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", "data-testid": `${testId}-option-${i}`, children: [
1021
+ /* @__PURE__ */ jsx(
1022
+ "span",
1023
+ {
1024
+ "aria-hidden": true,
1025
+ className: cn(
1026
+ "size-2 shrink-0 rounded-full",
1027
+ o.tone ? TONE_DOT[o.tone] : "border border-border"
1028
+ )
1029
+ }
1030
+ ),
1031
+ /* @__PURE__ */ jsx(
1032
+ Input,
1033
+ {
1034
+ value: o.label,
1035
+ "aria-label": l.optionLabel,
1036
+ onChange: (e) => set(i, {
1037
+ label: e.target.value,
1038
+ // A saved option keeps its value: a signal (`equals: high`) may test it.
1039
+ value: fresh.has(o.value) ? optionValue(e.target.value, others(i)) : o.value
1040
+ }),
1041
+ className: "h-8 min-w-0 flex-1"
1042
+ }
1043
+ ),
1044
+ /* @__PURE__ */ jsxs(
1045
+ "select",
1046
+ {
1047
+ "aria-label": l.optionTone,
1048
+ className: cn(selectClass2, "h-8 w-28 shrink-0"),
1049
+ value: o.tone ?? "",
1050
+ onChange: (e) => set(i, { tone: isTone(e.target.value) ? e.target.value : void 0 }),
1051
+ "data-testid": `${testId}-option-${i}-tone`,
1052
+ children: [
1053
+ /* @__PURE__ */ jsx("option", { value: "", children: l.noTone }),
1054
+ TONES.map((t) => /* @__PURE__ */ jsx("option", { value: t, children: l.tones[t] }, t))
1055
+ ]
1056
+ }
1057
+ ),
1058
+ /* @__PURE__ */ jsx(
1059
+ "button",
1060
+ {
1061
+ type: "button",
1062
+ "aria-label": `${o.label} \xD7`,
1063
+ onClick: () => onChange(options.filter((_, j) => j !== i)),
1064
+ children: /* @__PURE__ */ jsx(X, { className: "size-4 text-muted-foreground" })
1065
+ }
1066
+ )
1067
+ ] }, i)),
1068
+ /* @__PURE__ */ jsxs(
1069
+ Button,
1070
+ {
1071
+ variant: "ghost",
1072
+ size: "sm",
1073
+ onClick: () => {
1074
+ const label = `${l.optionLabel} ${options.length + 1}`;
1075
+ const value = optionValue(
1076
+ label,
1077
+ options.map((o) => o.value)
1078
+ );
1079
+ setFresh((s) => new Set(s).add(value));
1080
+ onChange([...options, { value, label }]);
1081
+ },
1082
+ "data-testid": `${testId}-add-option`,
1083
+ children: [
1084
+ /* @__PURE__ */ jsx(Plus, { className: "size-4" }),
1085
+ " ",
1086
+ l.addOption
1087
+ ]
1088
+ }
1089
+ )
1090
+ ] });
1091
+ }
980
1092
  var DEFAULT_STEP_INSPECTOR_LABELS = {
981
1093
  workflow: "Workflow",
982
1094
  title: "Title",
@@ -1014,6 +1126,7 @@ var FIELD_TYPES = [
1014
1126
  "text",
1015
1127
  "longtext",
1016
1128
  "boolean",
1129
+ "select",
1017
1130
  "number",
1018
1131
  "date",
1019
1132
  "scope",
@@ -1038,9 +1151,11 @@ function StepInspector({
1038
1151
  labels,
1039
1152
  actionLabels,
1040
1153
  signalLabels,
1154
+ optionLabels,
1041
1155
  testId = "step-inspector"
1042
1156
  }) {
1043
1157
  const l = { ...DEFAULT_STEP_INSPECTOR_LABELS, ...labels };
1158
+ const ol = { ...DEFAULT_FIELD_OPTIONS_EDITOR_LABELS, ...optionLabels };
1044
1159
  const steps = workflowSteps(workflow);
1045
1160
  const step = steps.find((s) => s.id === stepId);
1046
1161
  const run = workflow.run.kind === "steps" ? workflow.run : void 0;
@@ -1142,6 +1257,7 @@ function StepInspector({
1142
1257
  taken: takenBy(step.id),
1143
1258
  onChange: (inputs) => setFields(step.inputs, inputs, "inputs"),
1144
1259
  l,
1260
+ optionLabels: ol,
1145
1261
  testId
1146
1262
  }
1147
1263
  ),
@@ -1195,6 +1311,7 @@ function StepInspector({
1195
1311
  taken: takenBy(step.id),
1196
1312
  onChange: (fields) => setFields(step.fields ?? [], fields, "fields"),
1197
1313
  l: { ...l, fields: l.reviewFields },
1314
+ optionLabels: ol,
1198
1315
  hint: l.reviewFieldsHint,
1199
1316
  testId: `${testId}-review`
1200
1317
  }
@@ -1265,6 +1382,7 @@ function FormFields({
1265
1382
  taken,
1266
1383
  onChange,
1267
1384
  l,
1385
+ optionLabels = DEFAULT_FIELD_OPTIONS_EDITOR_LABELS,
1268
1386
  hint,
1269
1387
  testId
1270
1388
  }) {
@@ -1321,7 +1439,16 @@ function FormFields({
1321
1439
  l.required
1322
1440
  ] }),
1323
1441
  /* @__PURE__ */ jsx("code", { className: "shrink-0 text-[11px] text-muted-foreground", children: `{{${f.name}}}` })
1324
- ] })
1442
+ ] }),
1443
+ f.type === "select" && /* @__PURE__ */ jsx(
1444
+ FieldOptionsEditor,
1445
+ {
1446
+ options: f.options ?? [],
1447
+ onChange: (options) => set(i, { options }),
1448
+ l: optionLabels,
1449
+ testId: `${testId}-field-${i}`
1450
+ }
1451
+ )
1325
1452
  ] }, i)),
1326
1453
  /* @__PURE__ */ jsxs(
1327
1454
  Button,
@@ -2771,6 +2898,6 @@ function ConnectedWorkflowBuilder({
2771
2898
  );
2772
2899
  }
2773
2900
 
2774
- export { ConnectedWorkflowBuilder, DEFAULT_CONNECTED_WORKFLOW_BUILDER_LABELS, DEFAULT_SIGNALS_EDITOR_LABELS, DEFAULT_STEP_INSPECTOR_LABELS, DEFAULT_TRIGGER_INSPECTOR_LABELS, DEFAULT_WORKFLOW_BUILDER_LABELS, DEFAULT_WORKFLOW_CANVAS_LABELS, DEFAULT_WORKFLOW_EVENT_KINDS, DEFAULT_WORKFLOW_TRIGGER, SignalsEditor, StepInspector, TRIGGER_NODE, TriggerInspector, WORKFLOW_SIGNAL_EVENT, WorkflowBuilder, WorkflowCanvas, addStep, autoLayout, builderToWorkflowRequest, builderToWorkflowUpdate, connectSteps, declaredSignals, disconnectSteps, isSignalTrigger, layoutWithDefaults, moveStep, newSteppedWorkflow, removeStep, signalConditions, signalSlug, stepIdFor, triggerProblem, triggerSummary, updateStep, workflowRecordToBuilder, wouldCycle };
2901
+ export { ConnectedWorkflowBuilder, DEFAULT_CONNECTED_WORKFLOW_BUILDER_LABELS, DEFAULT_FIELD_OPTIONS_EDITOR_LABELS, DEFAULT_SIGNALS_EDITOR_LABELS, DEFAULT_STEP_INSPECTOR_LABELS, DEFAULT_TRIGGER_INSPECTOR_LABELS, DEFAULT_WORKFLOW_BUILDER_LABELS, DEFAULT_WORKFLOW_CANVAS_LABELS, DEFAULT_WORKFLOW_EVENT_KINDS, DEFAULT_WORKFLOW_TRIGGER, FieldOptionsEditor, SignalsEditor, StepInspector, TRIGGER_NODE, TriggerInspector, WORKFLOW_SIGNAL_EVENT, WorkflowBuilder, WorkflowCanvas, addStep, autoLayout, builderToWorkflowRequest, builderToWorkflowUpdate, connectSteps, declaredSignals, disconnectSteps, isSignalTrigger, layoutWithDefaults, moveStep, newSteppedWorkflow, removeStep, signalConditions, signalSlug, stepIdFor, triggerProblem, triggerSummary, updateStep, workflowRecordToBuilder, wouldCycle };
2775
2902
  //# sourceMappingURL=index.js.map
2776
2903
  //# sourceMappingURL=index.js.map