@dxos/plugin-automation 0.7.2 → 0.7.3-main.2dd075e
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/lib/browser/AssistantPanel-622FK3DP.mjs +341 -0
- package/dist/lib/browser/AssistantPanel-622FK3DP.mjs.map +7 -0
- package/dist/lib/browser/AutomationPanel-AQMN2CQR.mjs +153 -0
- package/dist/lib/browser/AutomationPanel-AQMN2CQR.mjs.map +7 -0
- package/dist/lib/browser/{chunk-B3Z4NQC2.mjs → chunk-7KB4UMXO.mjs} +2 -8
- package/dist/lib/browser/{chunk-B3Z4NQC2.mjs.map → chunk-7KB4UMXO.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-PQLGYMNY.mjs → chunk-X5KMOH3I.mjs} +2 -2
- package/dist/lib/browser/{chunk-PQLGYMNY.mjs.map → chunk-X5KMOH3I.mjs.map} +1 -1
- package/dist/lib/browser/index.mjs +111 -288
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/lib/browser/types/index.mjs +1 -2
- package/dist/lib/node/AssistantPanel-HRJRVOZD.cjs +361 -0
- package/dist/lib/node/AssistantPanel-HRJRVOZD.cjs.map +7 -0
- package/dist/lib/node/AutomationPanel-HZS5WKI5.cjs +173 -0
- package/dist/lib/node/AutomationPanel-HZS5WKI5.cjs.map +7 -0
- package/dist/lib/node/{chunk-SUMUWFZA.cjs → chunk-CUCUWUAF.cjs} +5 -8
- package/dist/lib/node/{chunk-SUMUWFZA.cjs.map → chunk-CUCUWUAF.cjs.map} +3 -3
- package/dist/lib/node/{chunk-JSZ6PAYL.cjs → chunk-DTJ7XVO2.cjs} +5 -5
- package/dist/lib/node/{chunk-JSZ6PAYL.cjs.map → chunk-DTJ7XVO2.cjs.map} +1 -1
- package/dist/lib/node/index.cjs +145 -315
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.cjs +3 -3
- package/dist/lib/node/meta.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/types/index.cjs +6 -7
- package/dist/lib/node/types/index.cjs.map +2 -2
- package/dist/lib/node-esm/AssistantPanel-QIIX7S4V.mjs +342 -0
- package/dist/lib/node-esm/AssistantPanel-QIIX7S4V.mjs.map +7 -0
- package/dist/lib/node-esm/AutomationPanel-JUHOWQWW.mjs +154 -0
- package/dist/lib/node-esm/AutomationPanel-JUHOWQWW.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-PYT2WY4B.mjs → chunk-23LY7DYS.mjs} +2 -7
- package/dist/lib/node-esm/{chunk-PYT2WY4B.mjs.map → chunk-23LY7DYS.mjs.map} +3 -3
- package/dist/lib/node-esm/{chunk-B35UD3D7.mjs → chunk-HNOBZHWK.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-B35UD3D7.mjs.map → chunk-HNOBZHWK.mjs.map} +1 -1
- package/dist/lib/node-esm/index.mjs +111 -288
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/meta.mjs +1 -1
- package/dist/lib/node-esm/types/index.mjs +1 -2
- package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
- package/dist/types/src/components/AssistantPanel/AssistantPanel.d.ts +8 -0
- package/dist/types/src/components/AssistantPanel/AssistantPanel.d.ts.map +1 -0
- package/dist/types/src/components/AssistantPanel/index.d.ts +3 -0
- package/dist/types/src/components/AssistantPanel/index.d.ts.map +1 -0
- package/dist/types/src/components/AssistantPanel/system-instructions.d.ts +6 -0
- package/dist/types/src/components/AssistantPanel/system-instructions.d.ts.map +1 -0
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +8 -0
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -0
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +6 -0
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -0
- package/dist/types/src/components/AutomationPanel/index.d.ts +3 -0
- package/dist/types/src/components/AutomationPanel/index.d.ts.map +1 -0
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +6 -3
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -3
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/email.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/testing.d.ts +12 -0
- package/dist/types/src/testing/testing.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +2 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +3 -3
- package/dist/types/src/types/types.d.ts +1 -2
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/package.json +38 -34
- package/src/AutomationPlugin.tsx +89 -36
- package/src/components/AssistantPanel/AssistantPanel.tsx +230 -0
- package/src/components/AssistantPanel/index.ts +7 -0
- package/src/components/AssistantPanel/system-instructions.ts +166 -0
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +57 -0
- package/src/components/AutomationPanel/AutomationPanel.tsx +135 -0
- package/src/components/AutomationPanel/index.ts +7 -0
- package/src/components/PromptEditor/PromptEditor.stories.tsx +1 -1
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +2 -32
- package/src/components/TriggerEditor/TriggerEditor.tsx +19 -47
- package/src/components/index.ts +4 -3
- package/src/hooks/email.ts +2 -2
- package/src/meta.ts +1 -1
- package/src/presets.ts +1 -1
- package/src/testing/index.ts +5 -0
- package/src/testing/testing.ts +34 -0
- package/src/translations.ts +3 -0
- package/src/types/types.ts +4 -6
- package/dist/types/src/components/AutomationPanel.d.ts +0 -3
- package/dist/types/src/components/AutomationPanel.d.ts.map +0 -1
- package/src/components/AutomationPanel.tsx +0 -23
package/dist/lib/node/index.cjs
CHANGED
|
@@ -28,280 +28,38 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var node_exports = {};
|
|
30
30
|
__export(node_exports, {
|
|
31
|
-
|
|
31
|
+
AssistantPanel: () => AssistantPanel,
|
|
32
|
+
AutomationAction: () => import_chunk_CUCUWUAF.AutomationAction,
|
|
32
33
|
AutomationPanel: () => AutomationPanel,
|
|
33
34
|
AutomationPlugin: () => AutomationPlugin,
|
|
34
|
-
ChainInputSchema: () =>
|
|
35
|
-
ChainInputType: () =>
|
|
36
|
-
ChainPromptType: () =>
|
|
37
|
-
ChainType: () =>
|
|
38
|
-
PromptEditor: () => PromptEditor,
|
|
39
|
-
TriggerEditor: () => TriggerEditor,
|
|
35
|
+
ChainInputSchema: () => import_chunk_CUCUWUAF.ChainInputSchema,
|
|
36
|
+
ChainInputType: () => import_chunk_CUCUWUAF.ChainInputType,
|
|
37
|
+
ChainPromptType: () => import_chunk_CUCUWUAF.ChainPromptType,
|
|
38
|
+
ChainType: () => import_chunk_CUCUWUAF.ChainType,
|
|
40
39
|
chainPresets: () => chainPresets,
|
|
41
40
|
default: () => src_default,
|
|
42
41
|
str: () => str
|
|
43
42
|
});
|
|
44
43
|
module.exports = __toCommonJS(node_exports);
|
|
45
|
-
var
|
|
46
|
-
var
|
|
44
|
+
var import_chunk_CUCUWUAF = require("./chunk-CUCUWUAF.cjs");
|
|
45
|
+
var import_chunk_DTJ7XVO2 = require("./chunk-DTJ7XVO2.cjs");
|
|
47
46
|
var import_react = __toESM(require("react"));
|
|
48
47
|
var import_app_framework = require("@dxos/app-framework");
|
|
49
48
|
var import_functions = require("@dxos/functions");
|
|
50
49
|
var import_invariant = require("@dxos/invariant");
|
|
51
50
|
var import_plugin_client = require("@dxos/plugin-client");
|
|
52
51
|
var import_plugin_graph = require("@dxos/plugin-graph");
|
|
52
|
+
var import_plugin_space = require("@dxos/plugin-space");
|
|
53
53
|
var import_echo = require("@dxos/react-client/echo");
|
|
54
|
-
var import_react2 = __toESM(require("react"));
|
|
55
|
-
var import_react_ui = require("@dxos/react-ui");
|
|
56
|
-
var import_react3 = __toESM(require("react"));
|
|
57
|
-
var import_echo2 = require("@dxos/react-client/echo");
|
|
58
|
-
var import_react_ui2 = require("@dxos/react-ui");
|
|
59
|
-
var import_react_ui_editor = require("@dxos/react-ui-editor");
|
|
60
|
-
var import_react_ui_theme = require("@dxos/react-ui-theme");
|
|
61
|
-
var import_util = require("@dxos/util");
|
|
62
|
-
var import_language = require("@codemirror/language");
|
|
63
|
-
var import_react_ui_editor2 = require("@dxos/react-ui-editor");
|
|
64
|
-
var import_react_ui_theme2 = require("@dxos/react-ui-theme");
|
|
65
|
-
var import_react4 = __toESM(require("react"));
|
|
66
|
-
var import_functions2 = require("@dxos/functions");
|
|
67
|
-
var import_types = require("@dxos/plugin-script/types");
|
|
68
|
-
var import_echo3 = require("@dxos/react-client/echo");
|
|
69
|
-
var import_react_ui3 = require("@dxos/react-ui");
|
|
70
54
|
var import_react_ui_form = require("@dxos/react-ui-form");
|
|
71
|
-
var
|
|
72
|
-
var
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
76
|
-
className: "flex flex-col"
|
|
77
|
-
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui.Toolbar.Root, {
|
|
78
|
-
classNames: "p-2"
|
|
79
|
-
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui.Button, {
|
|
80
|
-
onClick: handleCreate
|
|
81
|
-
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui.Icon, {
|
|
82
|
-
icon: "ph--plus--regular"
|
|
83
|
-
}))));
|
|
84
|
-
};
|
|
85
|
-
var nameRegex = /\{([\w-]+)}/;
|
|
86
|
-
var parser = import_language.StreamLanguage.define({
|
|
87
|
-
token: (stream) => {
|
|
88
|
-
if (stream.eatSpace()) {
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
if (stream.match(/^#.*/)) {
|
|
92
|
-
return "lineComment";
|
|
93
|
-
}
|
|
94
|
-
if (stream.match(/^-+$/)) {
|
|
95
|
-
return "lineComment";
|
|
96
|
-
}
|
|
97
|
-
if (stream.match(nameRegex)) {
|
|
98
|
-
return "variableName";
|
|
99
|
-
}
|
|
100
|
-
stream.next();
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
var highlightStyles = import_language.HighlightStyle.define([
|
|
105
|
-
{
|
|
106
|
-
tag: import_react_ui_editor2.tags.variableName,
|
|
107
|
-
class: (0, import_react_ui_theme2.mx)("rounded border border-yellow-500 bg-yellow-100 text-black font-mono text-sm")
|
|
108
|
-
}
|
|
109
|
-
]);
|
|
110
|
-
var promptExtension = [
|
|
111
|
-
parser,
|
|
112
|
-
(0, import_language.syntaxHighlighting)(highlightStyles)
|
|
113
|
-
];
|
|
114
|
-
var inputTypes = [
|
|
115
|
-
{
|
|
116
|
-
value: import_chunk_SUMUWFZA.ChainInputType.VALUE,
|
|
117
|
-
label: "Value"
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
value: import_chunk_SUMUWFZA.ChainInputType.PASS_THROUGH,
|
|
121
|
-
label: "Pass through"
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
value: import_chunk_SUMUWFZA.ChainInputType.RETRIEVER,
|
|
125
|
-
label: "Retriever"
|
|
126
|
-
},
|
|
127
|
-
// {
|
|
128
|
-
// value: ChainInputType.FUNCTION,
|
|
129
|
-
// label: 'Function',
|
|
130
|
-
// },
|
|
131
|
-
// {
|
|
132
|
-
// value: ChainInputType.QUERY,
|
|
133
|
-
// label: 'Query',
|
|
134
|
-
// },
|
|
135
|
-
{
|
|
136
|
-
value: import_chunk_SUMUWFZA.ChainInputType.RESOLVER,
|
|
137
|
-
label: "Resolver"
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
value: import_chunk_SUMUWFZA.ChainInputType.CONTEXT,
|
|
141
|
-
label: "Context"
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
value: import_chunk_SUMUWFZA.ChainInputType.SCHEMA,
|
|
145
|
-
label: "Schema"
|
|
146
|
-
}
|
|
147
|
-
];
|
|
148
|
-
var getInputType = (type) => inputTypes.find(({ value }) => String(value) === type)?.value;
|
|
149
|
-
var usePromptInputs = (prompt) => {
|
|
150
|
-
(0, import_react3.useEffect)(() => {
|
|
151
|
-
const text = prompt.template ?? "";
|
|
152
|
-
if (!prompt.inputs) {
|
|
153
|
-
prompt.inputs = [];
|
|
154
|
-
}
|
|
155
|
-
const regex = new RegExp(nameRegex, "g");
|
|
156
|
-
const variables = new Set([
|
|
157
|
-
...text.matchAll(regex)
|
|
158
|
-
].map((m) => m[1]));
|
|
159
|
-
const unclaimed = new Map(prompt.inputs?.filter(import_util.nonNullable).map((input) => [
|
|
160
|
-
input.name,
|
|
161
|
-
input
|
|
162
|
-
]));
|
|
163
|
-
const missing = [];
|
|
164
|
-
Array.from(variables.values()).forEach((name) => {
|
|
165
|
-
if (unclaimed.has(name)) {
|
|
166
|
-
unclaimed.delete(name);
|
|
167
|
-
} else {
|
|
168
|
-
missing.push(name);
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
const values = unclaimed.values();
|
|
172
|
-
missing.forEach((name) => {
|
|
173
|
-
const next = values.next().value;
|
|
174
|
-
if (next) {
|
|
175
|
-
next.name = name;
|
|
176
|
-
} else {
|
|
177
|
-
prompt.inputs?.push({
|
|
178
|
-
name
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
for (const input of values) {
|
|
183
|
-
prompt.inputs.splice(prompt.inputs.indexOf(input), 1);
|
|
184
|
-
}
|
|
185
|
-
}, [
|
|
186
|
-
prompt.template
|
|
187
|
-
]);
|
|
188
|
-
};
|
|
189
|
-
var PromptEditor = ({ prompt, commandEditable = true }) => {
|
|
190
|
-
const { t } = (0, import_react_ui2.useTranslation)(import_chunk_JSZ6PAYL.AUTOMATION_PLUGIN);
|
|
191
|
-
const { themeMode } = (0, import_react_ui2.useThemeContext)();
|
|
192
|
-
const { parentRef } = (0, import_react_ui_editor.useTextEditor)(() => ({
|
|
193
|
-
initialValue: prompt.template,
|
|
194
|
-
extensions: [
|
|
195
|
-
(0, import_react_ui_editor.createDataExtensions)({
|
|
196
|
-
id: prompt.id,
|
|
197
|
-
text: prompt.template !== void 0 ? (0, import_echo2.createDocAccessor)(prompt, [
|
|
198
|
-
"template"
|
|
199
|
-
]) : void 0
|
|
200
|
-
}),
|
|
201
|
-
(0, import_react_ui_editor.createBasicExtensions)({
|
|
202
|
-
bracketMatching: false,
|
|
203
|
-
lineWrapping: true,
|
|
204
|
-
placeholder: t("template placeholder")
|
|
205
|
-
}),
|
|
206
|
-
(0, import_react_ui_editor.createThemeExtensions)({
|
|
207
|
-
themeMode,
|
|
208
|
-
slots: {
|
|
209
|
-
content: {
|
|
210
|
-
className: "!p-3"
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}),
|
|
214
|
-
promptExtension
|
|
215
|
-
]
|
|
216
|
-
}), [
|
|
217
|
-
themeMode,
|
|
218
|
-
prompt
|
|
219
|
-
]);
|
|
220
|
-
usePromptInputs(prompt);
|
|
221
|
-
return /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
222
|
-
className: (0, import_react_ui_theme.mx)("flex flex-col w-full overflow-hidden gap-4", import_react_ui_theme.groupBorder)
|
|
223
|
-
}, commandEditable && /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
224
|
-
className: "flex items-center pl-4"
|
|
225
|
-
}, /* @__PURE__ */ import_react3.default.createElement("span", {
|
|
226
|
-
className: "text-neutral-500"
|
|
227
|
-
}, "/"), /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Input.Root, null, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Input.TextInput, {
|
|
228
|
-
placeholder: t("command placeholder"),
|
|
229
|
-
classNames: (0, import_react_ui_theme.mx)("is-full bg-transparent m-2"),
|
|
230
|
-
value: prompt.command ?? "",
|
|
231
|
-
onChange: (event) => {
|
|
232
|
-
prompt.command = event.target.value.replace(/\w/g, "");
|
|
233
|
-
}
|
|
234
|
-
}))), /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
235
|
-
ref: parentRef,
|
|
236
|
-
className: (0, import_react_ui_theme.mx)(import_react_ui_theme.attentionSurface, "rounded", "min-h-[120px]")
|
|
237
|
-
}), (prompt.inputs?.length ?? 0) > 0 && /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
238
|
-
className: "flex flex-col"
|
|
239
|
-
}, /* @__PURE__ */ import_react3.default.createElement("table", {
|
|
240
|
-
className: "w-full table-fixed border-collapse my-2"
|
|
241
|
-
}, /* @__PURE__ */ import_react3.default.createElement("tbody", null, prompt.inputs?.filter(import_util.nonNullable).map((input) => /* @__PURE__ */ import_react3.default.createElement("tr", {
|
|
242
|
-
key: input.name
|
|
243
|
-
}, /* @__PURE__ */ import_react3.default.createElement("td", {
|
|
244
|
-
className: "w-[160px] p-1 font-mono text-sm whitespace-nowrap truncate"
|
|
245
|
-
}, /* @__PURE__ */ import_react3.default.createElement("code", {
|
|
246
|
-
className: "px-2"
|
|
247
|
-
}, input.name)), /* @__PURE__ */ import_react3.default.createElement("td", {
|
|
248
|
-
className: "w-[120px] p-1"
|
|
249
|
-
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Input.Root, null, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Select.Root, {
|
|
250
|
-
value: String(input.type),
|
|
251
|
-
onValueChange: (type) => {
|
|
252
|
-
input.type = getInputType(type) ?? import_chunk_SUMUWFZA.ChainInputType.VALUE;
|
|
253
|
-
}
|
|
254
|
-
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Select.TriggerButton, {
|
|
255
|
-
placeholder: "Type",
|
|
256
|
-
classNames: "is-full"
|
|
257
|
-
}), /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Select.Portal, null, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Select.Content, null, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Select.Viewport, null, inputTypes.map(({ value, label }) => /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Select.Option, {
|
|
258
|
-
key: value,
|
|
259
|
-
value: String(value)
|
|
260
|
-
}, label)))))))), /* @__PURE__ */ import_react3.default.createElement("td", {
|
|
261
|
-
className: "p-1 pr-2"
|
|
262
|
-
}, input.type !== void 0 && [
|
|
263
|
-
import_chunk_SUMUWFZA.ChainInputType.VALUE,
|
|
264
|
-
import_chunk_SUMUWFZA.ChainInputType.CONTEXT,
|
|
265
|
-
import_chunk_SUMUWFZA.ChainInputType.RESOLVER,
|
|
266
|
-
import_chunk_SUMUWFZA.ChainInputType.SCHEMA
|
|
267
|
-
].includes(input.type) && /* @__PURE__ */ import_react3.default.createElement("div", null, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Input.Root, null, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Input.TextInput, {
|
|
268
|
-
placeholder: t("command placeholder"),
|
|
269
|
-
classNames: (0, import_react_ui_theme.mx)("is-full bg-transparent"),
|
|
270
|
-
value: input.value ?? "",
|
|
271
|
-
onChange: (event) => {
|
|
272
|
-
input.value = event.target.value;
|
|
273
|
-
}
|
|
274
|
-
}))))))))));
|
|
275
|
-
};
|
|
276
|
-
var TriggerEditor = ({ space, trigger }) => {
|
|
277
|
-
const { t } = (0, import_react_ui3.useTranslation)(import_chunk_JSZ6PAYL.AUTOMATION_PLUGIN);
|
|
278
|
-
const functions = (0, import_echo3.useQuery)(space, import_echo3.Filter.schema(import_types.FunctionType));
|
|
279
|
-
return /* @__PURE__ */ import_react4.default.createElement(import_react_ui_form.Form, {
|
|
280
|
-
schema: import_functions2.FunctionTriggerSchema,
|
|
281
|
-
values: trigger,
|
|
282
|
-
filter: (props) => props.filter((p) => p.name !== "meta"),
|
|
283
|
-
Custom: {
|
|
284
|
-
["function"]: (props) => /* @__PURE__ */ import_react4.default.createElement(import_react_ui_form.SelectInput, {
|
|
285
|
-
...props,
|
|
286
|
-
options: functions.map(({ name }) => ({
|
|
287
|
-
value: name,
|
|
288
|
-
label: name
|
|
289
|
-
}))
|
|
290
|
-
}),
|
|
291
|
-
["spec.type"]: (props) => /* @__PURE__ */ import_react4.default.createElement(import_react_ui_form.SelectInput, {
|
|
292
|
-
...props,
|
|
293
|
-
options: Object.values(import_functions2.TriggerKind).map((kind) => ({
|
|
294
|
-
value: kind,
|
|
295
|
-
label: t(`trigger type ${kind}`)
|
|
296
|
-
}))
|
|
297
|
-
})
|
|
298
|
-
}
|
|
299
|
-
});
|
|
300
|
-
};
|
|
55
|
+
var import_react2 = require("react");
|
|
56
|
+
var import_live_object = require("@dxos/live-object");
|
|
57
|
+
var AssistantPanel = (0, import_react2.lazy)(() => import("./AssistantPanel-HRJRVOZD.cjs"));
|
|
58
|
+
var AutomationPanel = (0, import_react2.lazy)(() => import("./AutomationPanel-HZS5WKI5.cjs"));
|
|
301
59
|
var translations_default = [
|
|
302
60
|
{
|
|
303
61
|
"en-US": {
|
|
304
|
-
[
|
|
62
|
+
[import_chunk_DTJ7XVO2.AUTOMATION_PLUGIN]: {
|
|
305
63
|
"plugin name": "Automation",
|
|
306
64
|
"object placeholder": "New prompt",
|
|
307
65
|
"create object label": "Create prompt",
|
|
@@ -324,7 +82,9 @@ var translations_default = [
|
|
|
324
82
|
"trigger filter": "Filter",
|
|
325
83
|
"trigger cron": "Cron",
|
|
326
84
|
"trigger method": "Method",
|
|
327
|
-
"trigger endpoint": "Endpoint"
|
|
85
|
+
"trigger endpoint": "Endpoint",
|
|
86
|
+
"open assistant panel label": "Show Assistant",
|
|
87
|
+
"assistant panel label": "Assistant"
|
|
328
88
|
}
|
|
329
89
|
}
|
|
330
90
|
}
|
|
@@ -332,15 +92,15 @@ var translations_default = [
|
|
|
332
92
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-automation/src/AutomationPlugin.tsx";
|
|
333
93
|
var AutomationPlugin = () => {
|
|
334
94
|
return {
|
|
335
|
-
meta:
|
|
95
|
+
meta: import_chunk_DTJ7XVO2.meta_default,
|
|
336
96
|
provides: {
|
|
337
97
|
metadata: {
|
|
338
98
|
records: {
|
|
339
|
-
[
|
|
99
|
+
[import_chunk_CUCUWUAF.ChainType.typename]: {
|
|
340
100
|
placeholder: [
|
|
341
101
|
"object placeholder",
|
|
342
102
|
{
|
|
343
|
-
ns:
|
|
103
|
+
ns: import_chunk_DTJ7XVO2.AUTOMATION_PLUGIN
|
|
344
104
|
}
|
|
345
105
|
],
|
|
346
106
|
icon: "ph--magic-wand--regular",
|
|
@@ -349,11 +109,14 @@ var AutomationPlugin = () => {
|
|
|
349
109
|
}
|
|
350
110
|
}
|
|
351
111
|
},
|
|
352
|
-
translations:
|
|
112
|
+
translations: [
|
|
113
|
+
...translations_default,
|
|
114
|
+
...import_react_ui_form.translations
|
|
115
|
+
],
|
|
353
116
|
echo: {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
117
|
+
system: [
|
|
118
|
+
import_chunk_CUCUWUAF.ChainType,
|
|
119
|
+
import_chunk_CUCUWUAF.ChainPromptType,
|
|
357
120
|
import_functions.FunctionTrigger
|
|
358
121
|
]
|
|
359
122
|
},
|
|
@@ -364,10 +127,20 @@ var AutomationPlugin = () => {
|
|
|
364
127
|
label: [
|
|
365
128
|
"open automation panel label",
|
|
366
129
|
{
|
|
367
|
-
ns:
|
|
130
|
+
ns: import_chunk_DTJ7XVO2.AUTOMATION_PLUGIN
|
|
368
131
|
}
|
|
369
132
|
],
|
|
370
|
-
icon: "ph--
|
|
133
|
+
icon: "ph--magic-wand--regular"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: "assistant",
|
|
137
|
+
label: [
|
|
138
|
+
"open assistant panel label",
|
|
139
|
+
{
|
|
140
|
+
ns: import_chunk_DTJ7XVO2.AUTOMATION_PLUGIN
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
icon: "ph--atom--regular"
|
|
371
144
|
}
|
|
372
145
|
]
|
|
373
146
|
},
|
|
@@ -379,7 +152,7 @@ var AutomationPlugin = () => {
|
|
|
379
152
|
const client = clientPlugin?.provides.client;
|
|
380
153
|
(0, import_invariant.invariant)(resolve, void 0, {
|
|
381
154
|
F: __dxlog_file,
|
|
382
|
-
L:
|
|
155
|
+
L: 66,
|
|
383
156
|
S: void 0,
|
|
384
157
|
A: [
|
|
385
158
|
"resolve",
|
|
@@ -388,7 +161,7 @@ var AutomationPlugin = () => {
|
|
|
388
161
|
});
|
|
389
162
|
(0, import_invariant.invariant)(client, void 0, {
|
|
390
163
|
F: __dxlog_file,
|
|
391
|
-
L:
|
|
164
|
+
L: 67,
|
|
392
165
|
S: void 0,
|
|
393
166
|
A: [
|
|
394
167
|
"client",
|
|
@@ -398,26 +171,27 @@ var AutomationPlugin = () => {
|
|
|
398
171
|
return [
|
|
399
172
|
// Create nodes for object settings.
|
|
400
173
|
(0, import_plugin_graph.createExtension)({
|
|
401
|
-
id: `${
|
|
174
|
+
id: `${import_chunk_DTJ7XVO2.AUTOMATION_PLUGIN}/automation-for-subject`,
|
|
402
175
|
resolver: ({ id }) => {
|
|
403
176
|
if (!id.endsWith("~automation")) {
|
|
404
177
|
return;
|
|
405
178
|
}
|
|
406
179
|
const type = "orphan-settings-for-subject";
|
|
407
|
-
const icon = "ph--
|
|
180
|
+
const icon = "ph--magic-wand--regular";
|
|
408
181
|
const [subjectId] = id.split("~");
|
|
409
182
|
const { spaceId, objectId } = (0, import_echo.parseId)(subjectId);
|
|
410
|
-
const
|
|
183
|
+
const spaces = (0, import_plugin_graph.toSignal)((onChange) => client.spaces.subscribe(() => onChange()).unsubscribe, () => client.spaces.get());
|
|
184
|
+
const space = spaces?.find((space2) => space2.id === spaceId && space2.state.get() === import_echo.SpaceState.SPACE_READY);
|
|
411
185
|
if (!objectId) {
|
|
412
186
|
const label2 = space ? space.properties.name || [
|
|
413
187
|
"unnamed space label",
|
|
414
188
|
{
|
|
415
|
-
ns:
|
|
189
|
+
ns: import_chunk_DTJ7XVO2.AUTOMATION_PLUGIN
|
|
416
190
|
}
|
|
417
191
|
] : [
|
|
418
192
|
"unnamed object settings label",
|
|
419
193
|
{
|
|
420
|
-
ns:
|
|
194
|
+
ns: import_chunk_DTJ7XVO2.AUTOMATION_PLUGIN
|
|
421
195
|
}
|
|
422
196
|
];
|
|
423
197
|
return {
|
|
@@ -433,15 +207,9 @@ var AutomationPlugin = () => {
|
|
|
433
207
|
}
|
|
434
208
|
};
|
|
435
209
|
}
|
|
436
|
-
const object = (0,
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
id: objectId
|
|
440
|
-
}).first();
|
|
441
|
-
onChange();
|
|
442
|
-
});
|
|
443
|
-
return () => clearTimeout(timeout);
|
|
444
|
-
}, () => space?.db.getObjectById(objectId), subjectId);
|
|
210
|
+
const [object] = (0, import_plugin_space.memoizeQuery)(space, {
|
|
211
|
+
id: objectId
|
|
212
|
+
});
|
|
445
213
|
if (!object || !subjectId) {
|
|
446
214
|
return;
|
|
447
215
|
}
|
|
@@ -449,7 +217,7 @@ var AutomationPlugin = () => {
|
|
|
449
217
|
const label = meta.label?.(object) || object.name || meta.placeholder || [
|
|
450
218
|
"unnamed object settings label",
|
|
451
219
|
{
|
|
452
|
-
ns:
|
|
220
|
+
ns: import_chunk_DTJ7XVO2.AUTOMATION_PLUGIN
|
|
453
221
|
}
|
|
454
222
|
];
|
|
455
223
|
return {
|
|
@@ -463,6 +231,54 @@ var AutomationPlugin = () => {
|
|
|
463
231
|
}
|
|
464
232
|
};
|
|
465
233
|
}
|
|
234
|
+
}),
|
|
235
|
+
(0, import_plugin_graph.createExtension)({
|
|
236
|
+
id: `${import_chunk_DTJ7XVO2.AUTOMATION_PLUGIN}/assistant-for-subject`,
|
|
237
|
+
resolver: ({ id }) => {
|
|
238
|
+
if (!id.endsWith("~assistant")) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
const [subjectId] = id.split("~");
|
|
242
|
+
const { spaceId, objectId } = (0, import_echo.parseId)(subjectId);
|
|
243
|
+
const spaces = (0, import_plugin_graph.toSignal)((onChange) => client.spaces.subscribe(() => onChange()).unsubscribe, () => client.spaces.get());
|
|
244
|
+
const space = spaces?.find((space2) => space2.id === spaceId && space2.state.get() === import_echo.SpaceState.SPACE_READY);
|
|
245
|
+
if (!objectId) {
|
|
246
|
+
return {
|
|
247
|
+
id,
|
|
248
|
+
type: "orphan-automation-for-subject",
|
|
249
|
+
data: null,
|
|
250
|
+
properties: {
|
|
251
|
+
icon: "ph--atom--regular",
|
|
252
|
+
label: [
|
|
253
|
+
"assistant panel label",
|
|
254
|
+
{
|
|
255
|
+
ns: import_chunk_DTJ7XVO2.AUTOMATION_PLUGIN
|
|
256
|
+
}
|
|
257
|
+
],
|
|
258
|
+
object: null,
|
|
259
|
+
space
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
const [object] = (0, import_plugin_space.memoizeQuery)(space, {
|
|
264
|
+
id: objectId
|
|
265
|
+
});
|
|
266
|
+
return {
|
|
267
|
+
id,
|
|
268
|
+
type: "orphan-automation-for-subject",
|
|
269
|
+
data: null,
|
|
270
|
+
properties: {
|
|
271
|
+
icon: "ph--atom--regular",
|
|
272
|
+
label: [
|
|
273
|
+
"assistant panel label",
|
|
274
|
+
{
|
|
275
|
+
ns: import_chunk_DTJ7XVO2.AUTOMATION_PLUGIN
|
|
276
|
+
}
|
|
277
|
+
],
|
|
278
|
+
object
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
}
|
|
466
282
|
})
|
|
467
283
|
];
|
|
468
284
|
}
|
|
@@ -470,21 +286,36 @@ var AutomationPlugin = () => {
|
|
|
470
286
|
surface: {
|
|
471
287
|
component: ({ data, role }) => {
|
|
472
288
|
switch (role) {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
289
|
+
case "complementary--assistant":
|
|
290
|
+
return /* @__PURE__ */ import_react.default.createElement(AssistantPanel, {
|
|
291
|
+
subject: data.subject
|
|
292
|
+
});
|
|
293
|
+
case "complementary--automation": {
|
|
294
|
+
const object = data.subject;
|
|
295
|
+
const space = (0, import_echo.isEchoObject)(object) ? (0, import_echo.getSpace)(object) : void 0;
|
|
296
|
+
if (space) {
|
|
297
|
+
(0, import_invariant.invariant)((0, import_echo.isEchoObject)(object), void 0, {
|
|
298
|
+
F: __dxlog_file,
|
|
299
|
+
L: 193,
|
|
300
|
+
S: void 0,
|
|
301
|
+
A: [
|
|
302
|
+
"isEchoObject(object)",
|
|
303
|
+
""
|
|
304
|
+
]
|
|
305
|
+
});
|
|
306
|
+
return /* @__PURE__ */ import_react.default.createElement(AutomationPanel, {
|
|
307
|
+
space,
|
|
308
|
+
object
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
477
313
|
}
|
|
478
314
|
return null;
|
|
479
315
|
}
|
|
480
316
|
},
|
|
481
317
|
intent: {
|
|
482
318
|
resolver: (intent) => {
|
|
483
|
-
switch (intent.action) {
|
|
484
|
-
case import_chunk_SUMUWFZA.AutomationAction.CREATE: {
|
|
485
|
-
return {};
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
319
|
}
|
|
489
320
|
}
|
|
490
321
|
}
|
|
@@ -495,7 +326,7 @@ var chainPresets = [
|
|
|
495
326
|
{
|
|
496
327
|
id: "dxos.org/prompt/translate",
|
|
497
328
|
title: "Translate",
|
|
498
|
-
createPrompt: () => (0,
|
|
329
|
+
createPrompt: () => (0, import_live_object.create)(import_chunk_CUCUWUAF.ChainPromptType, {
|
|
499
330
|
command: "say",
|
|
500
331
|
template: str(
|
|
501
332
|
// prettier-ignore
|
|
@@ -507,12 +338,12 @@ var chainPresets = [
|
|
|
507
338
|
),
|
|
508
339
|
inputs: [
|
|
509
340
|
{
|
|
510
|
-
type:
|
|
341
|
+
type: import_chunk_CUCUWUAF.ChainInputType.VALUE,
|
|
511
342
|
name: "language",
|
|
512
343
|
value: "japanese"
|
|
513
344
|
},
|
|
514
345
|
{
|
|
515
|
-
type:
|
|
346
|
+
type: import_chunk_CUCUWUAF.ChainInputType.PASS_THROUGH,
|
|
516
347
|
name: "input"
|
|
517
348
|
}
|
|
518
349
|
]
|
|
@@ -521,7 +352,7 @@ var chainPresets = [
|
|
|
521
352
|
{
|
|
522
353
|
id: "dxos.org/prompt/chess",
|
|
523
354
|
title: "Chess",
|
|
524
|
-
createPrompt: () => (0,
|
|
355
|
+
createPrompt: () => (0, import_live_object.create)(import_chunk_CUCUWUAF.ChainPromptType, {
|
|
525
356
|
command: "hint",
|
|
526
357
|
template: str(
|
|
527
358
|
// prettier-ignore
|
|
@@ -533,7 +364,7 @@ var chainPresets = [
|
|
|
533
364
|
),
|
|
534
365
|
inputs: [
|
|
535
366
|
{
|
|
536
|
-
type:
|
|
367
|
+
type: import_chunk_CUCUWUAF.ChainInputType.CONTEXT,
|
|
537
368
|
name: "history",
|
|
538
369
|
value: "object.pgn"
|
|
539
370
|
}
|
|
@@ -543,7 +374,7 @@ var chainPresets = [
|
|
|
543
374
|
{
|
|
544
375
|
id: "dxos.org/prompt/mermaid",
|
|
545
376
|
title: "Mermaid",
|
|
546
|
-
createPrompt: () => (0,
|
|
377
|
+
createPrompt: () => (0, import_live_object.create)(import_chunk_CUCUWUAF.ChainPromptType, {
|
|
547
378
|
command: "draw",
|
|
548
379
|
template: str(
|
|
549
380
|
// prettier-ignore
|
|
@@ -556,7 +387,7 @@ var chainPresets = [
|
|
|
556
387
|
),
|
|
557
388
|
inputs: [
|
|
558
389
|
{
|
|
559
|
-
type:
|
|
390
|
+
type: import_chunk_CUCUWUAF.ChainInputType.PASS_THROUGH,
|
|
560
391
|
name: "input"
|
|
561
392
|
}
|
|
562
393
|
]
|
|
@@ -565,7 +396,7 @@ var chainPresets = [
|
|
|
565
396
|
{
|
|
566
397
|
id: "dxos.org/prompt/list",
|
|
567
398
|
title: "List",
|
|
568
|
-
createPrompt: () => (0,
|
|
399
|
+
createPrompt: () => (0, import_live_object.create)(import_chunk_CUCUWUAF.ChainPromptType, {
|
|
569
400
|
command: "list",
|
|
570
401
|
template: str(
|
|
571
402
|
// prettier-ignore
|
|
@@ -582,12 +413,12 @@ var chainPresets = [
|
|
|
582
413
|
),
|
|
583
414
|
inputs: [
|
|
584
415
|
{
|
|
585
|
-
type:
|
|
416
|
+
type: import_chunk_CUCUWUAF.ChainInputType.SCHEMA,
|
|
586
417
|
name: "schema",
|
|
587
418
|
value: "example.com/type/project"
|
|
588
419
|
},
|
|
589
420
|
{
|
|
590
|
-
type:
|
|
421
|
+
type: import_chunk_CUCUWUAF.ChainInputType.PASS_THROUGH,
|
|
591
422
|
name: "question"
|
|
592
423
|
}
|
|
593
424
|
]
|
|
@@ -596,7 +427,7 @@ var chainPresets = [
|
|
|
596
427
|
{
|
|
597
428
|
id: "dxos.org/prompt/base",
|
|
598
429
|
title: "RAG",
|
|
599
|
-
createPrompt: () => (0,
|
|
430
|
+
createPrompt: () => (0, import_live_object.create)(import_chunk_CUCUWUAF.ChainPromptType, {
|
|
600
431
|
command: "rag",
|
|
601
432
|
template: str(
|
|
602
433
|
// prettier-ignore
|
|
@@ -611,11 +442,11 @@ var chainPresets = [
|
|
|
611
442
|
),
|
|
612
443
|
inputs: [
|
|
613
444
|
{
|
|
614
|
-
type:
|
|
445
|
+
type: import_chunk_CUCUWUAF.ChainInputType.RETRIEVER,
|
|
615
446
|
name: "context"
|
|
616
447
|
},
|
|
617
448
|
{
|
|
618
|
-
type:
|
|
449
|
+
type: import_chunk_CUCUWUAF.ChainInputType.CONTEXT,
|
|
619
450
|
name: "question",
|
|
620
451
|
value: "object.text"
|
|
621
452
|
}
|
|
@@ -625,7 +456,7 @@ var chainPresets = [
|
|
|
625
456
|
{
|
|
626
457
|
id: "dxos.org/prompt/lookup",
|
|
627
458
|
title: "Lookup",
|
|
628
|
-
createPrompt: () => (0,
|
|
459
|
+
createPrompt: () => (0, import_live_object.create)(import_chunk_CUCUWUAF.ChainPromptType, {
|
|
629
460
|
command: "lookup",
|
|
630
461
|
template: str(
|
|
631
462
|
// prettier-ignore
|
|
@@ -637,7 +468,7 @@ var chainPresets = [
|
|
|
637
468
|
),
|
|
638
469
|
inputs: [
|
|
639
470
|
{
|
|
640
|
-
type:
|
|
471
|
+
type: import_chunk_CUCUWUAF.ChainInputType.CONTEXT,
|
|
641
472
|
name: "input",
|
|
642
473
|
value: "text"
|
|
643
474
|
}
|
|
@@ -647,7 +478,7 @@ var chainPresets = [
|
|
|
647
478
|
{
|
|
648
479
|
id: "dxos.org/prompt/extract",
|
|
649
480
|
title: "Extract",
|
|
650
|
-
createPrompt: () => (0,
|
|
481
|
+
createPrompt: () => (0, import_live_object.create)(import_chunk_CUCUWUAF.ChainPromptType, {
|
|
651
482
|
command: "extract",
|
|
652
483
|
template: str(
|
|
653
484
|
// prettier-ignore
|
|
@@ -665,17 +496,17 @@ var chainPresets = [
|
|
|
665
496
|
),
|
|
666
497
|
inputs: [
|
|
667
498
|
{
|
|
668
|
-
type:
|
|
499
|
+
type: import_chunk_CUCUWUAF.ChainInputType.SCHEMA,
|
|
669
500
|
name: "contact",
|
|
670
501
|
value: "example.com/type/contact"
|
|
671
502
|
},
|
|
672
503
|
{
|
|
673
|
-
type:
|
|
504
|
+
type: import_chunk_CUCUWUAF.ChainInputType.SCHEMA,
|
|
674
505
|
name: "company",
|
|
675
506
|
value: "example.com/type/organization"
|
|
676
507
|
},
|
|
677
508
|
{
|
|
678
|
-
type:
|
|
509
|
+
type: import_chunk_CUCUWUAF.ChainInputType.CONTEXT,
|
|
679
510
|
name: "input",
|
|
680
511
|
value: "text"
|
|
681
512
|
}
|
|
@@ -685,7 +516,7 @@ var chainPresets = [
|
|
|
685
516
|
{
|
|
686
517
|
id: "dxos.org/prompt/discord",
|
|
687
518
|
title: "Summarize",
|
|
688
|
-
createPrompt: () => (0,
|
|
519
|
+
createPrompt: () => (0, import_live_object.create)(import_chunk_CUCUWUAF.ChainPromptType, {
|
|
689
520
|
command: "summarize",
|
|
690
521
|
template: str(
|
|
691
522
|
// prettier-ignore
|
|
@@ -697,7 +528,7 @@ var chainPresets = [
|
|
|
697
528
|
),
|
|
698
529
|
inputs: [
|
|
699
530
|
{
|
|
700
|
-
type:
|
|
531
|
+
type: import_chunk_CUCUWUAF.ChainInputType.RESOLVER,
|
|
701
532
|
name: "context",
|
|
702
533
|
value: "discord.messages.recent"
|
|
703
534
|
}
|
|
@@ -708,6 +539,7 @@ var chainPresets = [
|
|
|
708
539
|
var src_default = AutomationPlugin;
|
|
709
540
|
// Annotate the CommonJS export names for ESM import in node:
|
|
710
541
|
0 && (module.exports = {
|
|
542
|
+
AssistantPanel,
|
|
711
543
|
AutomationAction,
|
|
712
544
|
AutomationPanel,
|
|
713
545
|
AutomationPlugin,
|
|
@@ -715,8 +547,6 @@ var src_default = AutomationPlugin;
|
|
|
715
547
|
ChainInputType,
|
|
716
548
|
ChainPromptType,
|
|
717
549
|
ChainType,
|
|
718
|
-
PromptEditor,
|
|
719
|
-
TriggerEditor,
|
|
720
550
|
chainPresets,
|
|
721
551
|
str
|
|
722
552
|
});
|