@arbidocs/blocks 0.4.135 → 0.4.137
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/index.cjs +422 -367
- package/dist/agents/index.js +8 -9
- package/dist/agents/skills/index.d.ts +2 -0
- package/dist/agents/skills/skillFiles.d.ts +65 -0
- package/dist/agents/skills/skillImport.d.ts +36 -0
- package/dist/agents/workflows/WorkflowDocumentsField.d.ts +42 -5
- package/dist/agents/workflows/index.d.ts +3 -3
- package/dist/agents/workflows/workflow.d.ts +19 -0
- package/dist/agents/workflows/workspaceScope.d.ts +12 -0
- package/dist/chat/index.cjs +138 -138
- package/dist/chat/index.js +3 -3
- package/dist/chunk-2KUCVSFF.js +51 -0
- package/dist/chunk-2KUCVSFF.js.map +1 -0
- package/dist/{chunk-GDBDHOI4.js → chunk-3RJN2VTL.js} +36 -6
- package/dist/chunk-3RJN2VTL.js.map +1 -0
- package/dist/{chunk-6AALMYPS.cjs → chunk-6F7SZCVL.cjs} +23 -2
- package/dist/chunk-6F7SZCVL.cjs.map +1 -0
- package/dist/{chunk-PUCY3UXN.js → chunk-7M4C6CK7.js} +3 -3
- package/dist/{chunk-PUCY3UXN.js.map → chunk-7M4C6CK7.js.map} +1 -1
- package/dist/{chunk-2PNNCEPH.js → chunk-ATJUVHVB.js} +1545 -8
- package/dist/chunk-ATJUVHVB.js.map +1 -0
- package/dist/{chunk-4S5IDT5F.cjs → chunk-BUNZWOPX.cjs} +5 -5
- package/dist/{chunk-4S5IDT5F.cjs.map → chunk-BUNZWOPX.cjs.map} +1 -1
- package/dist/{chunk-KYDRUFWT.cjs → chunk-C3ZRLULA.cjs} +5 -5
- package/dist/{chunk-KYDRUFWT.cjs.map → chunk-C3ZRLULA.cjs.map} +1 -1
- package/dist/{chunk-SARREDFP.cjs → chunk-CHVCTKF4.cjs} +1620 -47
- package/dist/chunk-CHVCTKF4.cjs.map +1 -0
- package/dist/chunk-CQCC7LE7.js +210 -0
- package/dist/chunk-CQCC7LE7.js.map +1 -0
- package/dist/{chunk-4UMXQPNA.js → chunk-E5OYHJMU.js} +3 -3
- package/dist/{chunk-4UMXQPNA.js.map → chunk-E5OYHJMU.js.map} +1 -1
- package/dist/{chunk-PJJY6CYL.cjs → chunk-EHOPZBAX.cjs} +11 -11
- package/dist/{chunk-PJJY6CYL.cjs.map → chunk-EHOPZBAX.cjs.map} +1 -1
- package/dist/{chunk-4QIIDXLF.cjs → chunk-HDYWXEQU.cjs} +8 -8
- package/dist/{chunk-4QIIDXLF.cjs.map → chunk-HDYWXEQU.cjs.map} +1 -1
- package/dist/{chunk-GZPTWHP5.cjs → chunk-HLB4DIYV.cjs} +5 -5
- package/dist/{chunk-GZPTWHP5.cjs.map → chunk-HLB4DIYV.cjs.map} +1 -1
- package/dist/{chunk-TT6XV6WM.cjs → chunk-JY73DJOS.cjs} +78 -1274
- package/dist/chunk-JY73DJOS.cjs.map +1 -0
- package/dist/{chunk-ARDHLU73.cjs → chunk-KDUGTKVI.cjs} +21 -2
- package/dist/chunk-KDUGTKVI.cjs.map +1 -0
- package/dist/{chunk-UMIY4SQS.js → chunk-KMNZ2RVO.js} +17 -1191
- package/dist/chunk-KMNZ2RVO.js.map +1 -0
- package/dist/{chunk-6S5FLMWG.js → chunk-KSHKTOY2.js} +203 -7
- package/dist/chunk-KSHKTOY2.js.map +1 -0
- package/dist/{chunk-4RLCRFZS.js → chunk-L2PAPOZ5.js} +21 -3
- package/dist/chunk-L2PAPOZ5.js.map +1 -0
- package/dist/{chunk-QYTYW74G.js → chunk-L3T7OJRX.js} +4 -4
- package/dist/{chunk-QYTYW74G.js.map → chunk-L3T7OJRX.js.map} +1 -1
- package/dist/{chunk-ENDP7JER.js → chunk-M33QUNFH.js} +3 -3
- package/dist/{chunk-ENDP7JER.js.map → chunk-M33QUNFH.js.map} +1 -1
- package/dist/chunk-RFIBUWLF.cjs +232 -0
- package/dist/chunk-RFIBUWLF.cjs.map +1 -0
- package/dist/{chunk-N26CXGXC.cjs → chunk-RQ2Y7USX.cjs} +201 -3
- package/dist/chunk-RQ2Y7USX.cjs.map +1 -0
- package/dist/chunk-UUHUQHXR.cjs +56 -0
- package/dist/chunk-UUHUQHXR.cjs.map +1 -0
- package/dist/{chunk-SZX44LCT.js → chunk-VMESMX7N.js} +3 -3
- package/dist/{chunk-SZX44LCT.js.map → chunk-VMESMX7N.js.map} +1 -1
- package/dist/{chunk-QDEODGXE.cjs → chunk-WS5EX7DN.cjs} +37 -6
- package/dist/chunk-WS5EX7DN.cjs.map +1 -0
- package/dist/{chunk-2DFDFOM7.js → chunk-YOMPLCP6.js} +22 -3
- package/dist/chunk-YOMPLCP6.js.map +1 -0
- package/dist/connect/docx.cjs +4 -4
- package/dist/connect/docx.js +3 -3
- package/dist/connect/index.cjs +463 -97
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.d.ts +5 -2
- package/dist/connect/index.js +387 -49
- package/dist/connect/index.js.map +1 -1
- package/dist/connection/ConnectedSkillUpload.d.ts +26 -2
- package/dist/connection/ConnectedWorkflowBuilder.d.ts +24 -12
- package/dist/connection/ConnectedWorkflowLauncher.d.ts +35 -0
- package/dist/connection/ConnectedWorkflowsTable.d.ts +62 -0
- package/dist/connection/ConnectionProvider.d.ts +17 -0
- package/dist/connection/workspaceData.d.ts +45 -0
- package/dist/facts/index.cjs +1 -1
- package/dist/facts/index.js +1 -1
- package/dist/files/index.cjs +1 -1
- package/dist/files/index.js +1 -1
- package/dist/home/index.cjs +20 -21
- package/dist/home/index.cjs.map +1 -1
- package/dist/home/index.js +2 -3
- package/dist/home/index.js.map +1 -1
- package/dist/index.cjs +610 -555
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -15
- package/dist/index.js.map +1 -1
- package/dist/settings/index.cjs +11 -11
- package/dist/settings/index.js +2 -2
- package/dist/shell/index.cjs +1 -1
- package/dist/shell/index.js +1 -1
- package/dist/site/index.cjs +5 -5
- package/dist/site/index.js +1 -1
- package/dist/studio/index.cjs +7 -7
- package/dist/studio/index.js +5 -5
- package/dist/workflow-canvas/index.cjs +122 -96
- package/dist/workflow-canvas/index.cjs.map +1 -1
- package/dist/workflow-canvas/index.d.ts +1 -1
- package/dist/workflow-canvas/index.js +73 -48
- package/dist/workflow-canvas/index.js.map +1 -1
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +4 -4
- package/dist/chunk-2DFDFOM7.js.map +0 -1
- package/dist/chunk-2PNNCEPH.js.map +0 -1
- package/dist/chunk-4RLCRFZS.js.map +0 -1
- package/dist/chunk-4XJZ6AAY.js +0 -407
- package/dist/chunk-4XJZ6AAY.js.map +0 -1
- package/dist/chunk-6AALMYPS.cjs.map +0 -1
- package/dist/chunk-6S5FLMWG.js.map +0 -1
- package/dist/chunk-7D737FLE.cjs +0 -43
- package/dist/chunk-7D737FLE.cjs.map +0 -1
- package/dist/chunk-ARDHLU73.cjs.map +0 -1
- package/dist/chunk-GDBDHOI4.js.map +0 -1
- package/dist/chunk-N26CXGXC.cjs.map +0 -1
- package/dist/chunk-QDEODGXE.cjs.map +0 -1
- package/dist/chunk-S5HZBXZA.cjs +0 -430
- package/dist/chunk-S5HZBXZA.cjs.map +0 -1
- package/dist/chunk-SARREDFP.cjs.map +0 -1
- package/dist/chunk-TT6XV6WM.cjs.map +0 -1
- package/dist/chunk-UMIY4SQS.js.map +0 -1
- package/dist/chunk-XD2M6LIG.js +0 -41
- package/dist/chunk-XD2M6LIG.js.map +0 -1
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* because it brings the graph library; import `@arbidocs/blocks/workflow-canvas.css` once next to
|
|
5
5
|
* `blocks.css` where it is used.
|
|
6
6
|
*/
|
|
7
|
-
export { ConnectedWorkflowBuilder, DEFAULT_CONNECTED_WORKFLOW_BUILDER_LABELS, DEFAULT_WORKFLOW_EVENT_KINDS, type ConnectedWorkflowBuilderProps, type ConnectedWorkflowBuilderLabels, } from '../connection/ConnectedWorkflowBuilder';
|
|
7
|
+
export { ConnectedWorkflowBuilder, DEFAULT_CONNECTED_WORKFLOW_BUILDER_LABELS, DEFAULT_WORKFLOW_EVENT_KINDS, newWorkflowBuilderValue, type ConnectedWorkflowBuilderProps, type ConnectedWorkflowBuilderLabels, } from '../connection/ConnectedWorkflowBuilder';
|
|
8
8
|
export { WorkflowBuilder, DEFAULT_WORKFLOW_BUILDER_LABELS, type WorkflowBuilderProps, type WorkflowBuilderLabels, } from './WorkflowBuilder';
|
|
9
9
|
export { TriggerInspector, DEFAULT_TRIGGER_INSPECTOR_LABELS, triggerSummary, type TriggerInspectorProps, type TriggerInspectorLabels, } from './TriggerInspector';
|
|
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';
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useConnectedTags, useConnectedDocuments, useConnectedConversations } from '../chunk-2KUCVSFF.js';
|
|
3
|
+
import { useConnectedWorkspace } from '../chunk-L2PAPOZ5.js';
|
|
4
|
+
import { workflowWhen, isoToLocalInput, describeRRule, RecurrenceBuilder, useWorkflowPreview, localInputToIso } from '../chunk-KMNZ2RVO.js';
|
|
4
5
|
import '../chunk-RFXJYIDV.js';
|
|
5
|
-
import '../chunk-
|
|
6
|
+
import '../chunk-CQCC7LE7.js';
|
|
6
7
|
import '../chunk-5LXQPP2K.js';
|
|
7
|
-
import '../chunk-
|
|
8
|
-
import { isIncompleteSignal, fromPlanSteps, layoutFromPlanSteps, WorkflowRunner, toPlanSteps } from '../chunk-2PNNCEPH.js';
|
|
8
|
+
import { isIncompleteSignal, fromPlanSteps, layoutFromPlanSteps, AgentSelect, WorkflowRunner, toPlanSteps } from '../chunk-ATJUVHVB.js';
|
|
9
9
|
import '../chunk-EVUEIBNU.js';
|
|
10
|
-
import '../chunk-
|
|
10
|
+
import '../chunk-KSHKTOY2.js';
|
|
11
|
+
import '../chunk-P6GHJSLR.js';
|
|
12
|
+
import '../chunk-3RJN2VTL.js';
|
|
13
|
+
import '../chunk-444XKG46.js';
|
|
11
14
|
import '../chunk-NUNKSZKU.js';
|
|
12
15
|
import '../chunk-YU2KUMGE.js';
|
|
13
16
|
import '../chunk-N5YEF3LC.js';
|
|
14
|
-
import '../chunk-GDBDHOI4.js';
|
|
15
|
-
import '../chunk-444XKG46.js';
|
|
16
|
-
import '../chunk-XD2M6LIG.js';
|
|
17
17
|
import '../chunk-4WWM3GQ5.js';
|
|
18
|
-
import { DEFAULT_STEP_KIND_LABELS, workflowSteps, dependsOn, stepLevels, runFields, upstreamSteps, stepDependencies, canAssign, WORKFLOW_STEP_KINDS, STEP_KIND_ICONS, validateWorkflowGraph, stepConfigProblems,
|
|
18
|
+
import { DEFAULT_STEP_KIND_LABELS, workflowSteps, dependsOn, stepLevels, runFields, upstreamSteps, stepDependencies, canAssign, WORKFLOW_STEP_KINDS, STEP_KIND_ICONS, validateWorkflowGraph, stepConfigProblems, mergeSkillWorkflows, assigneeName, orderSteps, stepKindOf } from '../chunk-YOMPLCP6.js';
|
|
19
19
|
import { TONE_DOT, TONES, isTone } from '../chunk-AUS3KBHJ.js';
|
|
20
20
|
import '../chunk-AA3PT6KR.js';
|
|
21
21
|
import '../chunk-SLSBJRWW.js';
|
|
22
22
|
import '../chunk-NPLYHR2E.js';
|
|
23
23
|
import '../chunk-7F6CBP3Z.js';
|
|
24
|
-
import '../chunk-YNIBUKV5.js';
|
|
24
|
+
import { useBlocksEnvironment } from '../chunk-YNIBUKV5.js';
|
|
25
25
|
import '../chunk-TX2ZICS7.js';
|
|
26
26
|
import '../chunk-OXF2IFXG.js';
|
|
27
27
|
import '../chunk-VUNV25KB.js';
|
|
28
28
|
import { useState, useMemo, useEffect, useCallback, useRef } from 'react';
|
|
29
|
-
import { useWorkspaceUsers,
|
|
29
|
+
import { useWorkspaceUsers, useWorkflows, useSkills, useAgents, useCreateWorkflow, useUpdateWorkflow, useRunWorkflow, useGrantAgentAccess } from '@arbidocs/react';
|
|
30
30
|
import { Label, Input, cn, Button, Textarea, Checkbox, Popover, PopoverTrigger, PopoverContent } from '@arbidocs/react/ui';
|
|
31
31
|
import { X, Plus, Trash2, Maximize, PencilRuler, Eye, LayoutGrid, Settings2, Loader2, Play, Save, Zap, GitBranch, FilePenLine, UserRound, Hourglass, Check, AlertTriangle, MinusCircle } from 'lucide-react';
|
|
32
32
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
@@ -2703,15 +2703,42 @@ function WorkflowPreview({
|
|
|
2703
2703
|
}
|
|
2704
2704
|
);
|
|
2705
2705
|
}
|
|
2706
|
+
var NO_WORKFLOWS = [];
|
|
2706
2707
|
var DEFAULT_CONNECTED_WORKFLOW_BUILDER_LABELS = {
|
|
2707
2708
|
save: "Save",
|
|
2708
2709
|
saving: "Saving\u2026",
|
|
2709
2710
|
runNow: "Run now",
|
|
2710
|
-
saved: "
|
|
2711
|
+
saved: "Workflow saved",
|
|
2711
2712
|
needTrigger: "Finish setting when it starts.",
|
|
2712
2713
|
running: "Starting\u2026",
|
|
2713
|
-
|
|
2714
|
+
saveFailed: "Could not save the workflow",
|
|
2715
|
+
runFailed: "Could not run the workflow",
|
|
2716
|
+
untitledTask: "Untitled thread"
|
|
2714
2717
|
};
|
|
2718
|
+
function newWorkflowBuilderValue() {
|
|
2719
|
+
return {
|
|
2720
|
+
workflow: {
|
|
2721
|
+
id: "new",
|
|
2722
|
+
title: "New workflow",
|
|
2723
|
+
description: "",
|
|
2724
|
+
inputs: [],
|
|
2725
|
+
landing: "chat",
|
|
2726
|
+
schedulable: false,
|
|
2727
|
+
run: {
|
|
2728
|
+
kind: "steps",
|
|
2729
|
+
steps: [
|
|
2730
|
+
{
|
|
2731
|
+
id: "work",
|
|
2732
|
+
kind: "agent",
|
|
2733
|
+
title: "Do the work",
|
|
2734
|
+
run: { kind: "prompt", promptTemplate: "" }
|
|
2735
|
+
}
|
|
2736
|
+
]
|
|
2737
|
+
}
|
|
2738
|
+
},
|
|
2739
|
+
trigger: DEFAULT_WORKFLOW_TRIGGER
|
|
2740
|
+
};
|
|
2741
|
+
}
|
|
2715
2742
|
var DEFAULT_WORKFLOW_EVENT_KINDS = [
|
|
2716
2743
|
{ value: "conversation_done", label: "A task is marked done" },
|
|
2717
2744
|
{ value: "conversation_ready", label: "Work is ready for me" },
|
|
@@ -2723,8 +2750,8 @@ var DEFAULT_WORKFLOW_EVENT_KINDS = [
|
|
|
2723
2750
|
];
|
|
2724
2751
|
function ConnectedWorkflowBuilder({
|
|
2725
2752
|
workflowId,
|
|
2726
|
-
initial,
|
|
2727
|
-
workflows: hostWorkflows =
|
|
2753
|
+
initial = newWorkflowBuilderValue(),
|
|
2754
|
+
workflows: hostWorkflows = NO_WORKFLOWS,
|
|
2728
2755
|
eventKinds = DEFAULT_WORKFLOW_EVENT_KINDS,
|
|
2729
2756
|
compose,
|
|
2730
2757
|
onSaved,
|
|
@@ -2735,33 +2762,33 @@ function ConnectedWorkflowBuilder({
|
|
|
2735
2762
|
...builderProps
|
|
2736
2763
|
}) {
|
|
2737
2764
|
const l = { ...DEFAULT_CONNECTED_WORKFLOW_BUILDER_LABELS, ...connectedLabels };
|
|
2738
|
-
const {
|
|
2765
|
+
const { notify, openConversation } = useBlocksEnvironment();
|
|
2766
|
+
const { workspaceId, live, ensureWorkspaceOpen } = useConnectedWorkspace();
|
|
2739
2767
|
const members = useWorkspaceUsers(workspaceId ?? void 0, {
|
|
2740
|
-
enabled:
|
|
2768
|
+
enabled: live && !!workspaceId,
|
|
2741
2769
|
beforeFetch: ensureWorkspaceOpen
|
|
2742
2770
|
});
|
|
2743
|
-
const
|
|
2744
|
-
const
|
|
2771
|
+
const { data: tagList } = useConnectedTags();
|
|
2772
|
+
const { data: docList } = useConnectedDocuments();
|
|
2745
2773
|
const people = (members.data ?? []).map((m) => ({
|
|
2746
2774
|
value: m.user.external_id,
|
|
2747
2775
|
label: [m.user.given_name, m.user.family_name].filter(Boolean).join(" ") || m.user.email
|
|
2748
2776
|
}));
|
|
2749
|
-
const tagOptions =
|
|
2750
|
-
const documentOptions =
|
|
2777
|
+
const tagOptions = tagList.map((t) => ({ value: t.external_id, label: t.name }));
|
|
2778
|
+
const documentOptions = docList.map((d) => ({
|
|
2751
2779
|
value: d.external_id,
|
|
2752
2780
|
label: d.file_name ?? d.external_id
|
|
2753
2781
|
}));
|
|
2754
2782
|
const saved = useWorkflows();
|
|
2755
2783
|
const skills = useSkills();
|
|
2756
2784
|
const agentsQuery = useAgents();
|
|
2757
|
-
const conversations =
|
|
2785
|
+
const { data: conversations } = useConnectedConversations();
|
|
2758
2786
|
const create = useCreateWorkflow();
|
|
2759
2787
|
const update = useUpdateWorkflow();
|
|
2760
2788
|
const run = useRunWorkflow();
|
|
2789
|
+
const grantAccess = useGrantAgentAccess();
|
|
2761
2790
|
const [id, setId] = useState(workflowId);
|
|
2762
2791
|
const [value, setValue] = useState(initial);
|
|
2763
|
-
const [message, setMessage] = useState(null);
|
|
2764
|
-
const [error, setError] = useState(null);
|
|
2765
2792
|
const [pending, setPending] = useState();
|
|
2766
2793
|
const record = saved.data?.find((w) => w.external_id === id);
|
|
2767
2794
|
const [loaded, setLoaded] = useState(void 0);
|
|
@@ -2771,25 +2798,15 @@ function ConnectedWorkflowBuilder({
|
|
|
2771
2798
|
setLoaded(record.external_id);
|
|
2772
2799
|
}
|
|
2773
2800
|
}, [record, loaded]);
|
|
2774
|
-
const workflows = useMemo(
|
|
2775
|
-
(
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
(s) => skillToWorkflow({
|
|
2779
|
-
name: s.name,
|
|
2780
|
-
slug: s.slug,
|
|
2781
|
-
description: s.description,
|
|
2782
|
-
arg_hint: s.arg_hint
|
|
2783
|
-
})
|
|
2784
|
-
)
|
|
2785
|
-
],
|
|
2786
|
-
[hostWorkflows, skills.data]
|
|
2787
|
-
);
|
|
2801
|
+
const workflows = useMemo(() => {
|
|
2802
|
+
const merged = mergeSkillWorkflows(hostWorkflows, skills.data ?? []);
|
|
2803
|
+
return [...merged.host, ...merged.skills];
|
|
2804
|
+
}, [hostWorkflows, skills.data]);
|
|
2788
2805
|
const agents = (agentsQuery.data ?? []).map((a) => ({
|
|
2789
2806
|
id: a.external_id,
|
|
2790
2807
|
label: a.given_name || a.email
|
|
2791
2808
|
}));
|
|
2792
|
-
const tasks =
|
|
2809
|
+
const tasks = conversations.filter((c) => c.status && c.status !== "done").map((c) => ({ value: c.external_id, label: c.title || l.untitledTask }));
|
|
2793
2810
|
const options = { resolveWorkflow: (wid) => workflows.find((w) => w.id === wid), compose };
|
|
2794
2811
|
const problem = triggerProblem(value.trigger) ?? (validateWorkflowGraph(workflowSteps(value.workflow)).length || stepConfigProblems(workflowSteps(value.workflow)).length ? "graph" : null);
|
|
2795
2812
|
const busy = !!pending || create.isPending || update.isPending || run.isPending;
|
|
@@ -2798,26 +2815,36 @@ function ConnectedWorkflowBuilder({
|
|
|
2798
2815
|
const result = id ? await update.mutateAsync({ workflowId: id, patch: builderToWorkflowUpdate(value, options) }) : await create.mutateAsync(builderToWorkflowRequest(value, workspaceId, options));
|
|
2799
2816
|
setId(result.external_id);
|
|
2800
2817
|
setLoaded(result.external_id);
|
|
2818
|
+
const { trigger } = value;
|
|
2819
|
+
const agentId = trigger.agentId || result.agent_ext_id;
|
|
2820
|
+
const isMember = (members.data ?? []).some((m) => m.user.external_id === agentId);
|
|
2821
|
+
if (trigger.start !== "manual" && trigger.access === "standing" && agentId && !isMember) {
|
|
2822
|
+
await ensureWorkspaceOpen();
|
|
2823
|
+
await grantAccess.mutateAsync({ agentExtId: agentId, workspaceId });
|
|
2824
|
+
}
|
|
2801
2825
|
await onSaved?.(result.external_id, value);
|
|
2802
2826
|
return result.external_id;
|
|
2803
2827
|
};
|
|
2804
2828
|
const attempt = async (andRun) => {
|
|
2805
|
-
setMessage(null);
|
|
2806
|
-
setError(null);
|
|
2807
2829
|
setPending({ action: andRun ? "run" : "save", phase: "saving" });
|
|
2808
2830
|
try {
|
|
2809
2831
|
const savedId = await save();
|
|
2810
2832
|
if (!savedId) return;
|
|
2811
2833
|
if (!andRun) {
|
|
2812
|
-
|
|
2834
|
+
notify(l.saved, "success");
|
|
2813
2835
|
return;
|
|
2814
2836
|
}
|
|
2815
2837
|
setPending({ action: "run", phase: "running" });
|
|
2816
2838
|
const started = await run.mutateAsync(savedId);
|
|
2817
2839
|
if (started.error) throw new Error(started.error);
|
|
2818
|
-
|
|
2840
|
+
const conversationId = started.conversation_ext_id ?? void 0;
|
|
2841
|
+
if (onRun) onRun(conversationId);
|
|
2842
|
+
else if (conversationId) openConversation(conversationId);
|
|
2819
2843
|
} catch (e) {
|
|
2820
|
-
|
|
2844
|
+
notify(
|
|
2845
|
+
e instanceof Error && e.message ? e.message : andRun ? l.runFailed : l.saveFailed,
|
|
2846
|
+
"error"
|
|
2847
|
+
);
|
|
2821
2848
|
} finally {
|
|
2822
2849
|
setPending(void 0);
|
|
2823
2850
|
}
|
|
@@ -2840,8 +2867,6 @@ function ConnectedWorkflowBuilder({
|
|
|
2840
2867
|
testId,
|
|
2841
2868
|
actions: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2842
2869
|
actions,
|
|
2843
|
-
message && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: message }),
|
|
2844
|
-
error && /* @__PURE__ */ jsx("span", { role: "alert", className: "text-xs text-destructive", "data-testid": `${testId}-error`, children: error }),
|
|
2845
2870
|
problem && problem !== "graph" && /* @__PURE__ */ jsx("span", { className: "text-xs text-destructive", children: l.needTrigger }),
|
|
2846
2871
|
/* @__PURE__ */ jsxs(
|
|
2847
2872
|
Button,
|
|
@@ -2875,6 +2900,6 @@ function ConnectedWorkflowBuilder({
|
|
|
2875
2900
|
);
|
|
2876
2901
|
}
|
|
2877
2902
|
|
|
2878
|
-
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 };
|
|
2903
|
+
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, newWorkflowBuilderValue, removeStep, signalConditions, signalSlug, stepIdFor, triggerProblem, triggerSummary, updateStep, workflowRecordToBuilder, wouldCycle };
|
|
2879
2904
|
//# sourceMappingURL=index.js.map
|
|
2880
2905
|
//# sourceMappingURL=index.js.map
|