@arbidocs/blocks 0.4.134 → 0.4.136
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 +354 -306
- package/dist/agents/index.js +5 -5
- 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/index.d.ts +1 -1
- package/dist/agents/workflows/workflow.d.ts +19 -0
- package/dist/calls/index.cjs +3 -3
- package/dist/calls/index.js +2 -2
- package/dist/chat/index.cjs +138 -138
- package/dist/chat/index.js +3 -3
- package/dist/{chunk-26E6PHD2.js → chunk-5BXEYYH6.js} +3 -3
- package/dist/{chunk-26E6PHD2.js.map → chunk-5BXEYYH6.js.map} +1 -1
- 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-WV4IDVDQ.cjs → chunk-7YLJHTDC.cjs} +11 -11
- package/dist/{chunk-WV4IDVDQ.cjs.map → chunk-7YLJHTDC.cjs.map} +1 -1
- package/dist/{chunk-GZPTWHP5.cjs → chunk-C44D4WFG.cjs} +6 -6
- package/dist/{chunk-GZPTWHP5.cjs.map → chunk-C44D4WFG.cjs.map} +1 -1
- 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-VHJHY7TT.js → chunk-ECERC6TI.js} +3 -3
- package/dist/{chunk-VHJHY7TT.js.map → chunk-ECERC6TI.js.map} +1 -1
- package/dist/{chunk-OQ7RUNOC.js → chunk-GFYGYME3.js} +3 -3
- package/dist/{chunk-OQ7RUNOC.js.map → chunk-GFYGYME3.js.map} +1 -1
- package/dist/{chunk-HW2J4JMV.cjs → chunk-IE5CUCZK.cjs} +8 -8
- package/dist/{chunk-HW2J4JMV.cjs.map → chunk-IE5CUCZK.cjs.map} +1 -1
- package/dist/{chunk-54ANPPMV.js → chunk-IQU2GI6V.js} +248 -4
- package/dist/chunk-IQU2GI6V.js.map +1 -0
- package/dist/{chunk-CXLVI3SB.js → chunk-JO3EMZ4X.js} +3 -3
- package/dist/{chunk-CXLVI3SB.js.map → chunk-JO3EMZ4X.js.map} +1 -1
- package/dist/{chunk-ARDHLU73.cjs → chunk-KDUGTKVI.cjs} +21 -2
- package/dist/chunk-KDUGTKVI.cjs.map +1 -0
- package/dist/{chunk-4RLCRFZS.js → chunk-L2PAPOZ5.js} +21 -3
- package/dist/chunk-L2PAPOZ5.js.map +1 -0
- package/dist/{chunk-LC2KJSUS.cjs → chunk-LIHRGG4M.cjs} +302 -45
- package/dist/chunk-LIHRGG4M.cjs.map +1 -0
- package/dist/{chunk-BMNNT27D.js → chunk-LT2X5N37.js} +7 -48
- package/dist/chunk-LT2X5N37.js.map +1 -0
- package/dist/{chunk-D4YR56FV.cjs → chunk-N55UIXVT.cjs} +5 -5
- package/dist/{chunk-D4YR56FV.cjs.map → chunk-N55UIXVT.cjs.map} +1 -1
- package/dist/{chunk-BZF55UCE.cjs → chunk-OAL3B2ZU.cjs} +5 -5
- package/dist/{chunk-BZF55UCE.cjs.map → chunk-OAL3B2ZU.cjs.map} +1 -1
- package/dist/{chunk-AAFX64WD.cjs → chunk-OR4CO743.cjs} +3 -3
- package/dist/{chunk-AAFX64WD.cjs.map → chunk-OR4CO743.cjs.map} +1 -1
- package/dist/{chunk-HM23LXUP.cjs → chunk-OWCEQKAR.cjs} +23 -2
- package/dist/chunk-OWCEQKAR.cjs.map +1 -0
- package/dist/{chunk-QUDCNT63.cjs → chunk-OZLWSNUC.cjs} +66 -110
- package/dist/chunk-OZLWSNUC.cjs.map +1 -0
- package/dist/{chunk-VW2C2AZL.js → chunk-RUB62J2X.js} +3 -3
- package/dist/{chunk-VW2C2AZL.js.map → chunk-RUB62J2X.js.map} +1 -1
- package/dist/{chunk-4UMXQPNA.js → chunk-VIU7AMHF.js} +4 -4
- package/dist/{chunk-4UMXQPNA.js.map → chunk-VIU7AMHF.js.map} +1 -1
- package/dist/{chunk-7HAM7Y5U.js → chunk-Y5KTM3V5.js} +22 -3
- package/dist/chunk-Y5KTM3V5.js.map +1 -0
- 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-YIF6SVSO.js → chunk-ZNI4SW2G.js} +4 -4
- package/dist/{chunk-YIF6SVSO.js.map → chunk-ZNI4SW2G.js.map} +1 -1
- package/dist/collaboration/index.cjs +42 -42
- package/dist/collaboration/index.js +2 -2
- package/dist/connect/docx.cjs +6 -6
- package/dist/connect/docx.js +5 -5
- package/dist/connect/index.cjs +220 -131
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.d.ts +2 -2
- package/dist/connect/index.js +142 -58
- package/dist/connect/index.js.map +1 -1
- package/dist/connection/ConnectedSkillUpload.d.ts +26 -2
- package/dist/connection/ConnectedWorkflowBuilder.d.ts +23 -11
- package/dist/connection/ConnectionProvider.d.ts +17 -0
- package/dist/facts/index.cjs +3 -3
- package/dist/facts/index.js +3 -3
- package/dist/files/index.cjs +2 -2
- package/dist/files/index.js +2 -2
- package/dist/home/index.cjs +2 -2
- package/dist/home/index.js +2 -2
- package/dist/index.cjs +616 -568
- package/dist/index.js +12 -12
- package/dist/retrieval/index.cjs +1 -1
- package/dist/retrieval/index.js +1 -1
- package/dist/settings/index.cjs +38 -38
- package/dist/settings/index.js +4 -4
- package/dist/shell/index.cjs +2 -2
- package/dist/shell/index.js +2 -2
- package/dist/studio/index.cjs +8 -8
- package/dist/studio/index.js +6 -6
- package/dist/workflow-canvas/index.cjs +109 -85
- package/dist/workflow-canvas/index.cjs.map +1 -1
- package/dist/workflow-canvas/index.d.ts +1 -1
- package/dist/workflow-canvas/index.js +60 -37
- 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-4RLCRFZS.js.map +0 -1
- package/dist/chunk-54ANPPMV.js.map +0 -1
- package/dist/chunk-7HAM7Y5U.js.map +0 -1
- package/dist/chunk-ARDHLU73.cjs.map +0 -1
- package/dist/chunk-BMNNT27D.js.map +0 -1
- package/dist/chunk-HM23LXUP.cjs.map +0 -1
- package/dist/chunk-LC2KJSUS.cjs.map +0 -1
- package/dist/chunk-QUDCNT63.cjs.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var chunkKDUGTKVI_cjs = require('../chunk-KDUGTKVI.cjs');
|
|
5
|
+
var chunkOZLWSNUC_cjs = require('../chunk-OZLWSNUC.cjs');
|
|
6
6
|
require('../chunk-44R3CCZT.cjs');
|
|
7
7
|
require('../chunk-S5HZBXZA.cjs');
|
|
8
8
|
require('../chunk-ZW6FPIFC.cjs');
|
|
9
|
-
var
|
|
9
|
+
var chunkLIHRGG4M_cjs = require('../chunk-LIHRGG4M.cjs');
|
|
10
10
|
require('../chunk-7D737FLE.cjs');
|
|
11
11
|
require('../chunk-N26CXGXC.cjs');
|
|
12
12
|
require('../chunk-3AFWGEDJ.cjs');
|
|
@@ -17,14 +17,14 @@ require('../chunk-V4ISCZJ7.cjs');
|
|
|
17
17
|
require('../chunk-2EI7NCUA.cjs');
|
|
18
18
|
require('../chunk-C2CWWEHO.cjs');
|
|
19
19
|
require('../chunk-7RGLTF76.cjs');
|
|
20
|
-
var
|
|
20
|
+
var chunkC4WSHRR6_cjs = require('../chunk-C4WSHRR6.cjs');
|
|
21
|
+
require('../chunk-ULWRNGGE.cjs');
|
|
22
|
+
var chunkOWCEQKAR_cjs = require('../chunk-OWCEQKAR.cjs');
|
|
21
23
|
require('../chunk-7UTB4PHM.cjs');
|
|
22
24
|
var chunk32HW2Q33_cjs = require('../chunk-32HW2Q33.cjs');
|
|
23
25
|
require('../chunk-FX3K6LNZ.cjs');
|
|
24
26
|
require('../chunk-PPCATBOY.cjs');
|
|
25
27
|
require('../chunk-MHVNT4J3.cjs');
|
|
26
|
-
require('../chunk-C4WSHRR6.cjs');
|
|
27
|
-
require('../chunk-ULWRNGGE.cjs');
|
|
28
28
|
require('../chunk-KDG6FER6.cjs');
|
|
29
29
|
require('../chunk-DES3K4SD.cjs');
|
|
30
30
|
var react = require('react');
|
|
@@ -50,11 +50,11 @@ function withSteps(workflow, steps, layout) {
|
|
|
50
50
|
const run = workflow.run.kind === "steps" ? workflow.run : { kind: "steps", steps: [] };
|
|
51
51
|
return {
|
|
52
52
|
...workflow,
|
|
53
|
-
run: { ...run, steps:
|
|
53
|
+
run: { ...run, steps: chunkOWCEQKAR_cjs.orderSteps(steps), layout: layout ?? run.layout }
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
var layoutOf = (workflow) => workflow.run.kind === "steps" && workflow.run.layout || {};
|
|
57
|
-
var explicit = (steps) => steps.map((s) => ({ ...s, after:
|
|
57
|
+
var explicit = (steps) => steps.map((s) => ({ ...s, after: chunkOWCEQKAR_cjs.stepDependencies(steps, s.id) }));
|
|
58
58
|
function stepIdFor(steps, title) {
|
|
59
59
|
const base = title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/^[^a-z]+/, "") || "step";
|
|
60
60
|
const taken = new Set(steps.map((s) => s.id));
|
|
@@ -101,7 +101,7 @@ function blankStep(kind, id, title) {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
function addStep(workflow, kind, options = {}) {
|
|
104
|
-
const steps = explicit(
|
|
104
|
+
const steps = explicit(chunkOWCEQKAR_cjs.workflowSteps(workflow));
|
|
105
105
|
const title = options.title ?? DEFAULT_TITLES[kind];
|
|
106
106
|
const id = stepIdFor(steps, title);
|
|
107
107
|
const step = { ...blankStep(kind, id, title), after: options.after ? [options.after] : [] };
|
|
@@ -110,7 +110,7 @@ function addStep(workflow, kind, options = {}) {
|
|
|
110
110
|
return { workflow: withSteps(workflow, [...steps, step], layout), id };
|
|
111
111
|
}
|
|
112
112
|
function removeStep(workflow, id) {
|
|
113
|
-
const steps = explicit(
|
|
113
|
+
const steps = explicit(chunkOWCEQKAR_cjs.workflowSteps(workflow));
|
|
114
114
|
const removed = steps.find((s) => s.id === id);
|
|
115
115
|
if (!removed) return workflow;
|
|
116
116
|
const bridged = steps.filter((s) => s.id !== id).map(
|
|
@@ -123,8 +123,8 @@ function removeStep(workflow, id) {
|
|
|
123
123
|
return withSteps(workflow, bridged, layout);
|
|
124
124
|
}
|
|
125
125
|
function connectSteps(workflow, from, to) {
|
|
126
|
-
const steps = explicit(
|
|
127
|
-
if (from === to || !steps.some((s) => s.id === from) ||
|
|
126
|
+
const steps = explicit(chunkOWCEQKAR_cjs.workflowSteps(workflow));
|
|
127
|
+
if (from === to || !steps.some((s) => s.id === from) || chunkOWCEQKAR_cjs.dependsOn(steps, from, to)) {
|
|
128
128
|
return workflow;
|
|
129
129
|
}
|
|
130
130
|
return withSteps(
|
|
@@ -134,16 +134,16 @@ function connectSteps(workflow, from, to) {
|
|
|
134
134
|
)
|
|
135
135
|
);
|
|
136
136
|
}
|
|
137
|
-
var wouldCycle = (workflow, from, to) => from === to ||
|
|
137
|
+
var wouldCycle = (workflow, from, to) => from === to || chunkOWCEQKAR_cjs.dependsOn(chunkOWCEQKAR_cjs.workflowSteps(workflow), from, to);
|
|
138
138
|
function disconnectSteps(workflow, from, to) {
|
|
139
|
-
const steps = explicit(
|
|
139
|
+
const steps = explicit(chunkOWCEQKAR_cjs.workflowSteps(workflow));
|
|
140
140
|
return withSteps(
|
|
141
141
|
workflow,
|
|
142
142
|
steps.map((s) => s.id === to ? { ...s, after: (s.after ?? []).filter((d) => d !== from) } : s)
|
|
143
143
|
);
|
|
144
144
|
}
|
|
145
145
|
function updateStep(workflow, id, patch) {
|
|
146
|
-
const steps = explicit(
|
|
146
|
+
const steps = explicit(chunkOWCEQKAR_cjs.workflowSteps(workflow));
|
|
147
147
|
return withSteps(
|
|
148
148
|
workflow,
|
|
149
149
|
steps.map(
|
|
@@ -157,7 +157,7 @@ var renameIn = (text, from, to) => text.replace(
|
|
|
157
157
|
);
|
|
158
158
|
function renameInput(workflow, from, to) {
|
|
159
159
|
if (from === to) return workflow;
|
|
160
|
-
const steps =
|
|
160
|
+
const steps = chunkOWCEQKAR_cjs.workflowSteps(workflow).map((s) => {
|
|
161
161
|
if (s.kind === "agent")
|
|
162
162
|
return {
|
|
163
163
|
...s,
|
|
@@ -206,13 +206,13 @@ function renameInput(workflow, from, to) {
|
|
|
206
206
|
var renamePerson = (a, from, to) => "input" in a && a.input === from ? { input: to } : a;
|
|
207
207
|
var renameRef = (r, from, to) => "input" in r && r.input === from ? { input: to } : r;
|
|
208
208
|
function moveStep(workflow, id, position) {
|
|
209
|
-
return withSteps(workflow,
|
|
209
|
+
return withSteps(workflow, chunkOWCEQKAR_cjs.workflowSteps(workflow), { ...layoutOf(workflow), [id]: position });
|
|
210
210
|
}
|
|
211
211
|
var COLUMN = 300;
|
|
212
212
|
var ROW = 140;
|
|
213
213
|
function autoLayout(steps) {
|
|
214
214
|
const layout = {};
|
|
215
|
-
|
|
215
|
+
chunkOWCEQKAR_cjs.stepLevels(steps).forEach(
|
|
216
216
|
(level, x) => level.forEach((s, y) => {
|
|
217
217
|
layout[s.id] = { x: x * COLUMN, y: (y - (level.length - 1) / 2) * ROW };
|
|
218
218
|
})
|
|
@@ -220,7 +220,7 @@ function autoLayout(steps) {
|
|
|
220
220
|
return layout;
|
|
221
221
|
}
|
|
222
222
|
function layoutWithDefaults(workflow) {
|
|
223
|
-
const auto = autoLayout(
|
|
223
|
+
const auto = autoLayout(chunkOWCEQKAR_cjs.workflowSteps(workflow));
|
|
224
224
|
return { ...auto, ...layoutOf(workflow) };
|
|
225
225
|
}
|
|
226
226
|
var DEFAULT_SIGNALS_EDITOR_LABELS = {
|
|
@@ -317,9 +317,9 @@ function SignalsEditor({
|
|
|
317
317
|
{
|
|
318
318
|
className: ui.cn(
|
|
319
319
|
"space-y-1.5 rounded-md border p-2",
|
|
320
|
-
|
|
320
|
+
chunkLIHRGG4M_cjs.isIncompleteSignal(signal) ? "border-destructive/50" : "border-border"
|
|
321
321
|
),
|
|
322
|
-
"data-incomplete":
|
|
322
|
+
"data-incomplete": chunkLIHRGG4M_cjs.isIncompleteSignal(signal) || void 0,
|
|
323
323
|
"data-testid": `${testId}-${i}`,
|
|
324
324
|
children: [
|
|
325
325
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
@@ -1148,7 +1148,7 @@ function StepInspector({
|
|
|
1148
1148
|
}) {
|
|
1149
1149
|
const l = { ...DEFAULT_STEP_INSPECTOR_LABELS, ...labels };
|
|
1150
1150
|
const ol = { ...DEFAULT_FIELD_OPTIONS_EDITOR_LABELS, ...optionLabels };
|
|
1151
|
-
const steps =
|
|
1151
|
+
const steps = chunkOWCEQKAR_cjs.workflowSteps(workflow);
|
|
1152
1152
|
const step = steps.find((s) => s.id === stepId);
|
|
1153
1153
|
const run = workflow.run.kind === "steps" ? workflow.run : void 0;
|
|
1154
1154
|
if (!step || !run) {
|
|
@@ -1175,8 +1175,8 @@ function StepInspector({
|
|
|
1175
1175
|
const patch = (p) => onChange(updateStep(workflow, step.id, p));
|
|
1176
1176
|
const al = { ...DEFAULT_STEP_ACTION_SETTINGS_LABELS, ...actionLabels };
|
|
1177
1177
|
const ctx = {
|
|
1178
|
-
earlier:
|
|
1179
|
-
fields:
|
|
1178
|
+
earlier: chunkOWCEQKAR_cjs.upstreamSteps(steps, step.id),
|
|
1179
|
+
fields: chunkOWCEQKAR_cjs.runFields(workflow),
|
|
1180
1180
|
people,
|
|
1181
1181
|
tags,
|
|
1182
1182
|
documents
|
|
@@ -1197,7 +1197,7 @@ function StepInspector({
|
|
|
1197
1197
|
)
|
|
1198
1198
|
);
|
|
1199
1199
|
};
|
|
1200
|
-
const deps =
|
|
1200
|
+
const deps = chunkOWCEQKAR_cjs.stepDependencies(steps, step.id);
|
|
1201
1201
|
const titleOf = (id) => steps.find((s) => s.id === id)?.title ?? id;
|
|
1202
1202
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", "data-testid": `${testId}-step`, children: [
|
|
1203
1203
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
@@ -1278,7 +1278,7 @@ function StepInspector({
|
|
|
1278
1278
|
{
|
|
1279
1279
|
step,
|
|
1280
1280
|
workflows,
|
|
1281
|
-
fields:
|
|
1281
|
+
fields: chunkOWCEQKAR_cjs.runFields(workflow).map((f) => f.name),
|
|
1282
1282
|
patch,
|
|
1283
1283
|
l,
|
|
1284
1284
|
testId
|
|
@@ -1339,7 +1339,7 @@ function StepInspector({
|
|
|
1339
1339
|
testId: `${testId}-review-grid`
|
|
1340
1340
|
}
|
|
1341
1341
|
),
|
|
1342
|
-
|
|
1342
|
+
chunkOWCEQKAR_cjs.canAssign(step) && /* @__PURE__ */ jsxRuntime.jsx(AssigneeSettings, { step, patch, ctx, l: al, testId }),
|
|
1343
1343
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1344
1344
|
SignalsEditor,
|
|
1345
1345
|
{
|
|
@@ -1605,7 +1605,7 @@ function triggerFields(trigger, clearOthers) {
|
|
|
1605
1605
|
return {
|
|
1606
1606
|
timezone: trigger.timezone,
|
|
1607
1607
|
rrule: trigger.start === "repeat" ? trigger.rrule.trim() : none,
|
|
1608
|
-
run_at: trigger.start === "once" ?
|
|
1608
|
+
run_at: trigger.start === "once" ? chunkOZLWSNUC_cjs.localInputToIso(trigger.runAt) : none,
|
|
1609
1609
|
event_kind: trigger.start === "event" ? trigger.eventKind.trim() : none,
|
|
1610
1610
|
// A step signal is `workflow_signal` narrowed to one signal name.
|
|
1611
1611
|
event_filter: filter ?? none,
|
|
@@ -1621,7 +1621,7 @@ function plan(value, options) {
|
|
|
1621
1621
|
criteria: [],
|
|
1622
1622
|
max_passes: 3,
|
|
1623
1623
|
documents: [],
|
|
1624
|
-
steps:
|
|
1624
|
+
steps: chunkLIHRGG4M_cjs.toPlanSteps(value.workflow, options)
|
|
1625
1625
|
};
|
|
1626
1626
|
}
|
|
1627
1627
|
function builderToWorkflowRequest(value, workspaceId, options = {}) {
|
|
@@ -1656,7 +1656,7 @@ function builderToWorkflowUpdate(value, options = {}) {
|
|
|
1656
1656
|
}
|
|
1657
1657
|
function workflowRecordToBuilder(record) {
|
|
1658
1658
|
const planned = record.plan?.steps ?? [];
|
|
1659
|
-
const steps = planned.length ?
|
|
1659
|
+
const steps = planned.length ? chunkLIHRGG4M_cjs.fromPlanSteps(planned) : record.prompt || record.skill_ref ? [
|
|
1660
1660
|
{
|
|
1661
1661
|
id: "work",
|
|
1662
1662
|
kind: "agent",
|
|
@@ -1664,7 +1664,7 @@ function workflowRecordToBuilder(record) {
|
|
|
1664
1664
|
...record.skill_ref ? { workflow: record.skill_ref } : { run: { kind: "prompt", promptTemplate: record.prompt } }
|
|
1665
1665
|
}
|
|
1666
1666
|
] : [];
|
|
1667
|
-
const when =
|
|
1667
|
+
const when = chunkOZLWSNUC_cjs.workflowWhen(record);
|
|
1668
1668
|
return {
|
|
1669
1669
|
workflow: {
|
|
1670
1670
|
id: record.external_id,
|
|
@@ -1673,12 +1673,12 @@ function workflowRecordToBuilder(record) {
|
|
|
1673
1673
|
inputs: [],
|
|
1674
1674
|
landing: "chat",
|
|
1675
1675
|
schedulable: false,
|
|
1676
|
-
run: { kind: "steps", steps, layout:
|
|
1676
|
+
run: { kind: "steps", steps, layout: chunkLIHRGG4M_cjs.layoutFromPlanSteps(planned ?? []) }
|
|
1677
1677
|
},
|
|
1678
1678
|
trigger: {
|
|
1679
1679
|
...DEFAULT_WORKFLOW_TRIGGER,
|
|
1680
1680
|
start: when === "now" ? "manual" : when,
|
|
1681
|
-
runAt:
|
|
1681
|
+
runAt: chunkOZLWSNUC_cjs.isoToLocalInput(record.run_at),
|
|
1682
1682
|
rrule: record.rrule ?? "",
|
|
1683
1683
|
timezone: record.timezone || DEFAULT_WORKFLOW_TRIGGER.timezone,
|
|
1684
1684
|
eventKind: record.event_kind ?? "",
|
|
@@ -1734,7 +1734,7 @@ function triggerSummary(trigger, options = {}) {
|
|
|
1734
1734
|
case "once":
|
|
1735
1735
|
return trigger.runAt ? new Date(trigger.runAt).toLocaleString() : l.starts.once;
|
|
1736
1736
|
case "repeat":
|
|
1737
|
-
return trigger.rrule ?
|
|
1737
|
+
return trigger.rrule ? chunkOZLWSNUC_cjs.describeRRule(trigger.rrule) : l.starts.repeat;
|
|
1738
1738
|
case "event":
|
|
1739
1739
|
if (isSignalTrigger(trigger))
|
|
1740
1740
|
return trigger.signal ? l.signalSummary.replace("{signal}", trigger.signal) : l.stepSignals;
|
|
@@ -1793,7 +1793,7 @@ function TriggerInspector({
|
|
|
1793
1793
|
}
|
|
1794
1794
|
)
|
|
1795
1795
|
] }),
|
|
1796
|
-
trigger.start === "repeat" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1796
|
+
trigger.start === "repeat" && /* @__PURE__ */ jsxRuntime.jsx(chunkOZLWSNUC_cjs.RecurrenceBuilder, { rrule: trigger.rrule, onChange: (rrule) => set({ rrule }) }),
|
|
1797
1797
|
trigger.start === "event" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
|
|
1798
1798
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "text-xs", children: l.event }),
|
|
1799
1799
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -1845,7 +1845,7 @@ function TriggerInspector({
|
|
|
1845
1845
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
|
|
1846
1846
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "text-xs", children: l.agent }),
|
|
1847
1847
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1848
|
-
|
|
1848
|
+
chunkOZLWSNUC_cjs.AgentSelect,
|
|
1849
1849
|
{
|
|
1850
1850
|
agents,
|
|
1851
1851
|
value: trigger.agentId,
|
|
@@ -1913,7 +1913,7 @@ function revealCenter(node, view, frame, reserveRight = 0) {
|
|
|
1913
1913
|
};
|
|
1914
1914
|
}
|
|
1915
1915
|
var DEFAULT_WORKFLOW_CANVAS_LABELS = {
|
|
1916
|
-
...
|
|
1916
|
+
...chunkOWCEQKAR_cjs.DEFAULT_STEP_KIND_LABELS,
|
|
1917
1917
|
redline: "Tracked changes",
|
|
1918
1918
|
branch: "Branch",
|
|
1919
1919
|
kindHints: {
|
|
@@ -1944,7 +1944,7 @@ var DEFAULT_WORKFLOW_CANVAS_LABELS = {
|
|
|
1944
1944
|
fitView: "Fit view"
|
|
1945
1945
|
};
|
|
1946
1946
|
var TRIGGER_NODE = "__trigger";
|
|
1947
|
-
var KINDS =
|
|
1947
|
+
var KINDS = chunkOWCEQKAR_cjs.WORKFLOW_STEP_KINDS;
|
|
1948
1948
|
function AddNext({
|
|
1949
1949
|
from,
|
|
1950
1950
|
onAdd,
|
|
@@ -1966,7 +1966,7 @@ function AddNext({
|
|
|
1966
1966
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.PopoverContent, { side: "right", align: "start", className: "w-60 p-1.5", children: [
|
|
1967
1967
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-2 pb-1 pt-0.5 text-xs font-medium text-muted-foreground", children: l.addNext }),
|
|
1968
1968
|
KINDS.map((kind) => {
|
|
1969
|
-
const Icon =
|
|
1969
|
+
const Icon = chunkOWCEQKAR_cjs.STEP_KIND_ICONS[kind];
|
|
1970
1970
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1971
1971
|
"button",
|
|
1972
1972
|
{
|
|
@@ -2005,8 +2005,8 @@ function PhaseMark({ phase }) {
|
|
|
2005
2005
|
}
|
|
2006
2006
|
function StepNode({ data }) {
|
|
2007
2007
|
const { step, phase, summary, assignee, icon, l, onAdd, testId } = data;
|
|
2008
|
-
const kind =
|
|
2009
|
-
const KindIcon =
|
|
2008
|
+
const kind = chunkOWCEQKAR_cjs.stepKindOf(step);
|
|
2009
|
+
const KindIcon = chunkOWCEQKAR_cjs.STEP_KIND_ICONS[kind];
|
|
2010
2010
|
const redline = step.kind === "agent" && !!step.editDocument;
|
|
2011
2011
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2012
2012
|
"div",
|
|
@@ -2140,12 +2140,12 @@ function WorkflowCanvas({
|
|
|
2140
2140
|
testId = "workflow-canvas"
|
|
2141
2141
|
}) {
|
|
2142
2142
|
const l = react.useMemo(() => ({ ...DEFAULT_WORKFLOW_CANVAS_LABELS, ...labels }), [labels]);
|
|
2143
|
-
const steps =
|
|
2143
|
+
const steps = chunkOWCEQKAR_cjs.workflowSteps(workflow);
|
|
2144
2144
|
const editable = !!onChange;
|
|
2145
2145
|
const built = react.useMemo(() => {
|
|
2146
2146
|
const layout = layoutWithDefaults(workflow);
|
|
2147
|
-
const all =
|
|
2148
|
-
const roots = all.filter((s) =>
|
|
2147
|
+
const all = chunkOWCEQKAR_cjs.workflowSteps(workflow);
|
|
2148
|
+
const roots = all.filter((s) => chunkOWCEQKAR_cjs.stepDependencies(all, s.id).length === 0);
|
|
2149
2149
|
const triggerNode = trigger ? [
|
|
2150
2150
|
{
|
|
2151
2151
|
id: TRIGGER_NODE,
|
|
@@ -2194,7 +2194,7 @@ function WorkflowCanvas({
|
|
|
2194
2194
|
react.useEffect(() => setNodes(built), [built]);
|
|
2195
2195
|
const edges = react.useMemo(
|
|
2196
2196
|
() => steps.flatMap((s) => {
|
|
2197
|
-
const deps =
|
|
2197
|
+
const deps = chunkOWCEQKAR_cjs.stepDependencies(steps, s.id);
|
|
2198
2198
|
const from = deps.length ? deps : trigger ? [TRIGGER_NODE] : [];
|
|
2199
2199
|
return from.map((d) => ({
|
|
2200
2200
|
id: `${d}->${s.id}`,
|
|
@@ -2364,7 +2364,7 @@ function WorkflowCanvas({
|
|
|
2364
2364
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold", children: l.emptyTitle }),
|
|
2365
2365
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: l.emptyHint }),
|
|
2366
2366
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 grid grid-cols-2 gap-2", children: KINDS.map((kind) => {
|
|
2367
|
-
const Icon =
|
|
2367
|
+
const Icon = chunkOWCEQKAR_cjs.STEP_KIND_ICONS[kind];
|
|
2368
2368
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2369
2369
|
"button",
|
|
2370
2370
|
{
|
|
@@ -2414,7 +2414,7 @@ var DEFAULT_WORKFLOW_BUILDER_LABELS = {
|
|
|
2414
2414
|
}
|
|
2415
2415
|
};
|
|
2416
2416
|
var PANEL_WIDTH = 344;
|
|
2417
|
-
var KINDS2 =
|
|
2417
|
+
var KINDS2 = chunkOWCEQKAR_cjs.WORKFLOW_STEP_KINDS;
|
|
2418
2418
|
function WorkflowBuilder({
|
|
2419
2419
|
value,
|
|
2420
2420
|
onChange,
|
|
@@ -2446,12 +2446,12 @@ function WorkflowBuilder({
|
|
|
2446
2446
|
const [mode, setMode] = react.useState("design");
|
|
2447
2447
|
const [adding, setAdding] = react.useState(false);
|
|
2448
2448
|
const { workflow, trigger } = value;
|
|
2449
|
-
const steps =
|
|
2450
|
-
const problems =
|
|
2451
|
-
const missing =
|
|
2449
|
+
const steps = chunkOWCEQKAR_cjs.workflowSteps(workflow);
|
|
2450
|
+
const problems = chunkOWCEQKAR_cjs.validateWorkflowGraph(steps);
|
|
2451
|
+
const missing = chunkOWCEQKAR_cjs.stepConfigProblems(steps);
|
|
2452
2452
|
const nameOf = (id) => people.find((p) => p.value === id)?.label;
|
|
2453
|
-
const fields =
|
|
2454
|
-
const assigneeOf = (step) =>
|
|
2453
|
+
const fields = chunkOWCEQKAR_cjs.runFields(workflow);
|
|
2454
|
+
const assigneeOf = (step) => chunkOWCEQKAR_cjs.canAssign(step) ? chunkOWCEQKAR_cjs.assigneeName(step.assignee, { nameOf, fields }) : void 0;
|
|
2455
2455
|
const titles = react.useMemo(() => new Map(workflows.map((w) => [w.id, w.title])), [workflows]);
|
|
2456
2456
|
const setWorkflow = (next) => onChange({ ...value, workflow: next });
|
|
2457
2457
|
const addAfter = (from, kind) => {
|
|
@@ -2520,7 +2520,7 @@ function WorkflowBuilder({
|
|
|
2520
2520
|
l.addStep
|
|
2521
2521
|
] }) }),
|
|
2522
2522
|
/* @__PURE__ */ jsxRuntime.jsx(ui.PopoverContent, { align: "start", className: "w-64 p-1.5", children: KINDS2.map((kind) => {
|
|
2523
|
-
const Icon =
|
|
2523
|
+
const Icon = chunkOWCEQKAR_cjs.STEP_KIND_ICONS[kind];
|
|
2524
2524
|
const cls = { ...DEFAULT_WORKFLOW_CANVAS_LABELS, ...canvasLabels };
|
|
2525
2525
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2526
2526
|
"button",
|
|
@@ -2682,13 +2682,13 @@ function WorkflowPreview({
|
|
|
2682
2682
|
renderIcon,
|
|
2683
2683
|
testId
|
|
2684
2684
|
}) {
|
|
2685
|
-
const run =
|
|
2685
|
+
const run = chunkOZLWSNUC_cjs.useWorkflowPreview(workflow, {
|
|
2686
2686
|
resolveWorkflow: (id) => workflows.find((w) => w.id === id),
|
|
2687
2687
|
compose,
|
|
2688
2688
|
answer
|
|
2689
2689
|
});
|
|
2690
2690
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2691
|
-
|
|
2691
|
+
chunkLIHRGG4M_cjs.WorkflowRunner,
|
|
2692
2692
|
{
|
|
2693
2693
|
workflow,
|
|
2694
2694
|
run,
|
|
@@ -2705,15 +2705,42 @@ function WorkflowPreview({
|
|
|
2705
2705
|
}
|
|
2706
2706
|
);
|
|
2707
2707
|
}
|
|
2708
|
+
var NO_WORKFLOWS = [];
|
|
2708
2709
|
var DEFAULT_CONNECTED_WORKFLOW_BUILDER_LABELS = {
|
|
2709
2710
|
save: "Save",
|
|
2710
2711
|
saving: "Saving\u2026",
|
|
2711
2712
|
runNow: "Run now",
|
|
2712
|
-
saved: "
|
|
2713
|
+
saved: "Workflow saved",
|
|
2713
2714
|
needTrigger: "Finish setting when it starts.",
|
|
2714
2715
|
running: "Starting\u2026",
|
|
2715
|
-
|
|
2716
|
+
saveFailed: "Could not save the workflow",
|
|
2717
|
+
runFailed: "Could not run the workflow",
|
|
2718
|
+
untitledTask: "Untitled thread"
|
|
2716
2719
|
};
|
|
2720
|
+
function newWorkflowBuilderValue() {
|
|
2721
|
+
return {
|
|
2722
|
+
workflow: {
|
|
2723
|
+
id: "new",
|
|
2724
|
+
title: "New workflow",
|
|
2725
|
+
description: "",
|
|
2726
|
+
inputs: [],
|
|
2727
|
+
landing: "chat",
|
|
2728
|
+
schedulable: false,
|
|
2729
|
+
run: {
|
|
2730
|
+
kind: "steps",
|
|
2731
|
+
steps: [
|
|
2732
|
+
{
|
|
2733
|
+
id: "work",
|
|
2734
|
+
kind: "agent",
|
|
2735
|
+
title: "Do the work",
|
|
2736
|
+
run: { kind: "prompt", promptTemplate: "" }
|
|
2737
|
+
}
|
|
2738
|
+
]
|
|
2739
|
+
}
|
|
2740
|
+
},
|
|
2741
|
+
trigger: DEFAULT_WORKFLOW_TRIGGER
|
|
2742
|
+
};
|
|
2743
|
+
}
|
|
2717
2744
|
var DEFAULT_WORKFLOW_EVENT_KINDS = [
|
|
2718
2745
|
{ value: "conversation_done", label: "A task is marked done" },
|
|
2719
2746
|
{ value: "conversation_ready", label: "Work is ready for me" },
|
|
@@ -2725,8 +2752,8 @@ var DEFAULT_WORKFLOW_EVENT_KINDS = [
|
|
|
2725
2752
|
];
|
|
2726
2753
|
function ConnectedWorkflowBuilder({
|
|
2727
2754
|
workflowId,
|
|
2728
|
-
initial,
|
|
2729
|
-
workflows: hostWorkflows =
|
|
2755
|
+
initial = newWorkflowBuilderValue(),
|
|
2756
|
+
workflows: hostWorkflows = NO_WORKFLOWS,
|
|
2730
2757
|
eventKinds = DEFAULT_WORKFLOW_EVENT_KINDS,
|
|
2731
2758
|
compose,
|
|
2732
2759
|
onSaved,
|
|
@@ -2737,9 +2764,10 @@ function ConnectedWorkflowBuilder({
|
|
|
2737
2764
|
...builderProps
|
|
2738
2765
|
}) {
|
|
2739
2766
|
const l = { ...DEFAULT_CONNECTED_WORKFLOW_BUILDER_LABELS, ...connectedLabels };
|
|
2740
|
-
const {
|
|
2767
|
+
const { notify } = chunkC4WSHRR6_cjs.useBlocksEnvironment();
|
|
2768
|
+
const { workspaceId, live, ensureWorkspaceOpen } = chunkKDUGTKVI_cjs.useConnectedWorkspace();
|
|
2741
2769
|
const members = react$2.useWorkspaceUsers(workspaceId ?? void 0, {
|
|
2742
|
-
enabled:
|
|
2770
|
+
enabled: live && !!workspaceId,
|
|
2743
2771
|
beforeFetch: ensureWorkspaceOpen
|
|
2744
2772
|
});
|
|
2745
2773
|
const tagsQuery = react$2.useTags(workspaceId ?? void 0);
|
|
@@ -2760,10 +2788,9 @@ function ConnectedWorkflowBuilder({
|
|
|
2760
2788
|
const create = react$2.useCreateWorkflow();
|
|
2761
2789
|
const update = react$2.useUpdateWorkflow();
|
|
2762
2790
|
const run = react$2.useRunWorkflow();
|
|
2791
|
+
const grantAccess = react$2.useGrantAgentAccess();
|
|
2763
2792
|
const [id, setId] = react.useState(workflowId);
|
|
2764
2793
|
const [value, setValue] = react.useState(initial);
|
|
2765
|
-
const [message, setMessage] = react.useState(null);
|
|
2766
|
-
const [error, setError] = react.useState(null);
|
|
2767
2794
|
const [pending, setPending] = react.useState();
|
|
2768
2795
|
const record = saved.data?.find((w) => w.external_id === id);
|
|
2769
2796
|
const [loaded, setLoaded] = react.useState(void 0);
|
|
@@ -2773,45 +2800,40 @@ function ConnectedWorkflowBuilder({
|
|
|
2773
2800
|
setLoaded(record.external_id);
|
|
2774
2801
|
}
|
|
2775
2802
|
}, [record, loaded]);
|
|
2776
|
-
const workflows = react.useMemo(
|
|
2777
|
-
(
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
(s) => chunkHM23LXUP_cjs.skillToWorkflow({
|
|
2781
|
-
name: s.name,
|
|
2782
|
-
slug: s.slug,
|
|
2783
|
-
description: s.description,
|
|
2784
|
-
arg_hint: s.arg_hint
|
|
2785
|
-
})
|
|
2786
|
-
)
|
|
2787
|
-
],
|
|
2788
|
-
[hostWorkflows, skills.data]
|
|
2789
|
-
);
|
|
2803
|
+
const workflows = react.useMemo(() => {
|
|
2804
|
+
const merged = chunkOWCEQKAR_cjs.mergeSkillWorkflows(hostWorkflows, skills.data ?? []);
|
|
2805
|
+
return [...merged.host, ...merged.skills];
|
|
2806
|
+
}, [hostWorkflows, skills.data]);
|
|
2790
2807
|
const agents = (agentsQuery.data ?? []).map((a) => ({
|
|
2791
2808
|
id: a.external_id,
|
|
2792
2809
|
label: a.given_name || a.email
|
|
2793
2810
|
}));
|
|
2794
|
-
const tasks = (conversations.data ?? []).filter((c) => c.status && c.status !== "done").map((c) => ({ value: c.external_id, label: c.title ||
|
|
2811
|
+
const tasks = (conversations.data ?? []).filter((c) => c.status && c.status !== "done").map((c) => ({ value: c.external_id, label: c.title || l.untitledTask }));
|
|
2795
2812
|
const options = { resolveWorkflow: (wid) => workflows.find((w) => w.id === wid), compose };
|
|
2796
|
-
const problem = triggerProblem(value.trigger) ?? (
|
|
2813
|
+
const problem = triggerProblem(value.trigger) ?? (chunkOWCEQKAR_cjs.validateWorkflowGraph(chunkOWCEQKAR_cjs.workflowSteps(value.workflow)).length || chunkOWCEQKAR_cjs.stepConfigProblems(chunkOWCEQKAR_cjs.workflowSteps(value.workflow)).length ? "graph" : null);
|
|
2797
2814
|
const busy = !!pending || create.isPending || update.isPending || run.isPending;
|
|
2798
2815
|
const save = async () => {
|
|
2799
2816
|
if (!workspaceId) return void 0;
|
|
2800
2817
|
const result = id ? await update.mutateAsync({ workflowId: id, patch: builderToWorkflowUpdate(value, options) }) : await create.mutateAsync(builderToWorkflowRequest(value, workspaceId, options));
|
|
2801
2818
|
setId(result.external_id);
|
|
2802
2819
|
setLoaded(result.external_id);
|
|
2820
|
+
const { trigger } = value;
|
|
2821
|
+
const agentId = trigger.agentId || result.agent_ext_id;
|
|
2822
|
+
const isMember = (members.data ?? []).some((m) => m.user.external_id === agentId);
|
|
2823
|
+
if (trigger.start !== "manual" && trigger.access === "standing" && agentId && !isMember) {
|
|
2824
|
+
await ensureWorkspaceOpen();
|
|
2825
|
+
await grantAccess.mutateAsync({ agentExtId: agentId, workspaceId });
|
|
2826
|
+
}
|
|
2803
2827
|
await onSaved?.(result.external_id, value);
|
|
2804
2828
|
return result.external_id;
|
|
2805
2829
|
};
|
|
2806
2830
|
const attempt = async (andRun) => {
|
|
2807
|
-
setMessage(null);
|
|
2808
|
-
setError(null);
|
|
2809
2831
|
setPending({ action: andRun ? "run" : "save", phase: "saving" });
|
|
2810
2832
|
try {
|
|
2811
2833
|
const savedId = await save();
|
|
2812
2834
|
if (!savedId) return;
|
|
2813
2835
|
if (!andRun) {
|
|
2814
|
-
|
|
2836
|
+
notify(l.saved, "success");
|
|
2815
2837
|
return;
|
|
2816
2838
|
}
|
|
2817
2839
|
setPending({ action: "run", phase: "running" });
|
|
@@ -2819,7 +2841,10 @@ function ConnectedWorkflowBuilder({
|
|
|
2819
2841
|
if (started.error) throw new Error(started.error);
|
|
2820
2842
|
onRun?.(started.conversation_ext_id ?? void 0);
|
|
2821
2843
|
} catch (e) {
|
|
2822
|
-
|
|
2844
|
+
notify(
|
|
2845
|
+
e instanceof Error && e.message ? e.message : andRun ? l.runFailed : l.saveFailed,
|
|
2846
|
+
"error"
|
|
2847
|
+
);
|
|
2823
2848
|
} finally {
|
|
2824
2849
|
setPending(void 0);
|
|
2825
2850
|
}
|
|
@@ -2842,8 +2867,6 @@ function ConnectedWorkflowBuilder({
|
|
|
2842
2867
|
testId,
|
|
2843
2868
|
actions: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2844
2869
|
actions,
|
|
2845
|
-
message && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: message }),
|
|
2846
|
-
error && /* @__PURE__ */ jsxRuntime.jsx("span", { role: "alert", className: "text-xs text-destructive", "data-testid": `${testId}-error`, children: error }),
|
|
2847
2870
|
problem && problem !== "graph" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-destructive", children: l.needTrigger }),
|
|
2848
2871
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2849
2872
|
ui.Button,
|
|
@@ -2906,6 +2929,7 @@ exports.isSignalTrigger = isSignalTrigger;
|
|
|
2906
2929
|
exports.layoutWithDefaults = layoutWithDefaults;
|
|
2907
2930
|
exports.moveStep = moveStep;
|
|
2908
2931
|
exports.newSteppedWorkflow = newSteppedWorkflow;
|
|
2932
|
+
exports.newWorkflowBuilderValue = newWorkflowBuilderValue;
|
|
2909
2933
|
exports.removeStep = removeStep;
|
|
2910
2934
|
exports.signalConditions = signalConditions;
|
|
2911
2935
|
exports.signalSlug = signalSlug;
|