@dxos/plugin-automation 0.6.14-main.8b352a0 → 0.6.14-staging.3e2eaca
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/{PromptContainer-RFMJXMUA.mjs → PromptContainer-3GUENQHE.mjs} +4 -4
- package/dist/lib/browser/{chunk-PSSWFA6A.mjs → chunk-2FOJUVYG.mjs} +3 -3
- package/dist/lib/browser/{chunk-GGA62V7D.mjs → chunk-J4SYTP4Y.mjs} +2 -2
- package/dist/lib/browser/{chunk-GGA62V7D.mjs.map → chunk-J4SYTP4Y.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-3TNRXJTD.mjs → chunk-PQLGYMNY.mjs} +6 -2
- package/dist/lib/browser/{chunk-3TNRXJTD.mjs.map → chunk-PQLGYMNY.mjs.map} +3 -3
- package/dist/lib/browser/index.mjs +88 -44
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/node/{PromptContainer-FRSY6FNL.cjs → PromptContainer-74ZRO4HK.cjs} +8 -8
- package/dist/lib/node/{chunk-E2H3AGKB.cjs → chunk-4TMTUB4X.cjs} +18 -18
- package/dist/lib/node/{chunk-UPPUTAPL.cjs → chunk-JSZ6PAYL.cjs} +9 -5
- package/dist/lib/node/{chunk-UPPUTAPL.cjs.map → chunk-JSZ6PAYL.cjs.map} +3 -3
- package/dist/lib/node/{chunk-N5IDAUFU.cjs → chunk-XS53UP75.cjs} +6 -6
- package/dist/lib/node/{chunk-N5IDAUFU.cjs.map → chunk-XS53UP75.cjs.map} +2 -2
- package/dist/lib/node/index.cjs +128 -84
- package/dist/lib/node/index.cjs.map +3 -3
- 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 +7 -7
- package/dist/lib/node/types/index.cjs.map +1 -1
- package/dist/lib/node-esm/{PromptContainer-4VHFPEQH.mjs → PromptContainer-5OK4GWIR.mjs} +4 -4
- package/dist/lib/node-esm/{chunk-UT6QKU6J.mjs → chunk-AAUSG7OA.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-UT6QKU6J.mjs.map → chunk-AAUSG7OA.mjs.map} +2 -2
- package/dist/lib/node-esm/{chunk-QAPWYK2P.mjs → chunk-B35UD3D7.mjs} +6 -2
- package/dist/lib/node-esm/{chunk-QAPWYK2P.mjs.map → chunk-B35UD3D7.mjs.map} +3 -3
- package/dist/lib/node-esm/{chunk-HFTXKLRR.mjs → chunk-FN6DOJZP.mjs} +3 -3
- package/dist/lib/node-esm/index.mjs +88 -44
- package/dist/lib/node-esm/index.mjs.map +3 -3
- 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 +2 -2
- package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -0
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +14 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +2 -1
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/package.json +33 -31
- package/src/AutomationPlugin.tsx +10 -1
- package/src/components/AutomationPanel.tsx +2 -0
- package/src/components/TriggerEditor/TriggerEditor.tsx +59 -44
- package/src/meta.ts +3 -1
- package/src/translations.ts +16 -6
- package/src/types/types.ts +3 -1
- /package/dist/lib/browser/{PromptContainer-RFMJXMUA.mjs.map → PromptContainer-3GUENQHE.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-PSSWFA6A.mjs.map → chunk-2FOJUVYG.mjs.map} +0 -0
- /package/dist/lib/node/{PromptContainer-FRSY6FNL.cjs.map → PromptContainer-74ZRO4HK.cjs.map} +0 -0
- /package/dist/lib/node/{chunk-E2H3AGKB.cjs.map → chunk-4TMTUB4X.cjs.map} +0 -0
- /package/dist/lib/node-esm/{PromptContainer-4VHFPEQH.mjs.map → PromptContainer-5OK4GWIR.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-HFTXKLRR.mjs.map → chunk-FN6DOJZP.mjs.map} +0 -0
package/dist/lib/node/index.cjs
CHANGED
|
@@ -28,26 +28,26 @@ 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
|
-
AutomationAction: () =>
|
|
31
|
+
AutomationAction: () => import_chunk_XS53UP75.AutomationAction,
|
|
32
32
|
AutomationPanel: () => AutomationPanel,
|
|
33
33
|
AutomationPlugin: () => AutomationPlugin,
|
|
34
34
|
Chain: () => Chain,
|
|
35
|
-
ChainInputSchema: () =>
|
|
36
|
-
ChainInputType: () =>
|
|
35
|
+
ChainInputSchema: () => import_chunk_XS53UP75.ChainInputSchema,
|
|
36
|
+
ChainInputType: () => import_chunk_XS53UP75.ChainInputType,
|
|
37
37
|
ChainPresets: () => ChainPresets,
|
|
38
|
-
ChainPromptType: () =>
|
|
39
|
-
ChainType: () =>
|
|
38
|
+
ChainPromptType: () => import_chunk_XS53UP75.ChainPromptType,
|
|
39
|
+
ChainType: () => import_chunk_XS53UP75.ChainType,
|
|
40
40
|
PromptContainer: () => PromptContainer,
|
|
41
|
-
PromptEditor: () =>
|
|
41
|
+
PromptEditor: () => import_chunk_4TMTUB4X.PromptEditor,
|
|
42
42
|
TriggerEditor: () => TriggerEditor,
|
|
43
43
|
chainPresets: () => chainPresets,
|
|
44
44
|
default: () => src_default,
|
|
45
45
|
str: () => str
|
|
46
46
|
});
|
|
47
47
|
module.exports = __toCommonJS(node_exports);
|
|
48
|
-
var
|
|
49
|
-
var
|
|
50
|
-
var
|
|
48
|
+
var import_chunk_4TMTUB4X = require("./chunk-4TMTUB4X.cjs");
|
|
49
|
+
var import_chunk_XS53UP75 = require("./chunk-XS53UP75.cjs");
|
|
50
|
+
var import_chunk_JSZ6PAYL = require("./chunk-JSZ6PAYL.cjs");
|
|
51
51
|
var import_react = __toESM(require("react"));
|
|
52
52
|
var import_app_framework = require("@dxos/app-framework");
|
|
53
53
|
var import_types = require("@dxos/functions/types");
|
|
@@ -115,7 +115,7 @@ var chainPresets = [
|
|
|
115
115
|
{
|
|
116
116
|
id: "dxos.org/prompt/translate",
|
|
117
117
|
title: "Translate",
|
|
118
|
-
createPrompt: () => (0, import_echo_schema.create)(
|
|
118
|
+
createPrompt: () => (0, import_echo_schema.create)(import_chunk_XS53UP75.ChainPromptType, {
|
|
119
119
|
command: "say",
|
|
120
120
|
template: str(
|
|
121
121
|
// prettier-ignore
|
|
@@ -127,12 +127,12 @@ var chainPresets = [
|
|
|
127
127
|
),
|
|
128
128
|
inputs: [
|
|
129
129
|
{
|
|
130
|
-
type:
|
|
130
|
+
type: import_chunk_XS53UP75.ChainInputType.VALUE,
|
|
131
131
|
name: "language",
|
|
132
132
|
value: "japanese"
|
|
133
133
|
},
|
|
134
134
|
{
|
|
135
|
-
type:
|
|
135
|
+
type: import_chunk_XS53UP75.ChainInputType.PASS_THROUGH,
|
|
136
136
|
name: "input"
|
|
137
137
|
}
|
|
138
138
|
]
|
|
@@ -141,7 +141,7 @@ var chainPresets = [
|
|
|
141
141
|
{
|
|
142
142
|
id: "dxos.org/prompt/chess",
|
|
143
143
|
title: "Chess",
|
|
144
|
-
createPrompt: () => (0, import_echo_schema.create)(
|
|
144
|
+
createPrompt: () => (0, import_echo_schema.create)(import_chunk_XS53UP75.ChainPromptType, {
|
|
145
145
|
command: "hint",
|
|
146
146
|
template: str(
|
|
147
147
|
// prettier-ignore
|
|
@@ -153,7 +153,7 @@ var chainPresets = [
|
|
|
153
153
|
),
|
|
154
154
|
inputs: [
|
|
155
155
|
{
|
|
156
|
-
type:
|
|
156
|
+
type: import_chunk_XS53UP75.ChainInputType.CONTEXT,
|
|
157
157
|
name: "history",
|
|
158
158
|
value: "object.pgn"
|
|
159
159
|
}
|
|
@@ -163,7 +163,7 @@ var chainPresets = [
|
|
|
163
163
|
{
|
|
164
164
|
id: "dxos.org/prompt/mermaid",
|
|
165
165
|
title: "Mermaid",
|
|
166
|
-
createPrompt: () => (0, import_echo_schema.create)(
|
|
166
|
+
createPrompt: () => (0, import_echo_schema.create)(import_chunk_XS53UP75.ChainPromptType, {
|
|
167
167
|
command: "draw",
|
|
168
168
|
template: str(
|
|
169
169
|
// prettier-ignore
|
|
@@ -176,7 +176,7 @@ var chainPresets = [
|
|
|
176
176
|
),
|
|
177
177
|
inputs: [
|
|
178
178
|
{
|
|
179
|
-
type:
|
|
179
|
+
type: import_chunk_XS53UP75.ChainInputType.PASS_THROUGH,
|
|
180
180
|
name: "input"
|
|
181
181
|
}
|
|
182
182
|
]
|
|
@@ -185,7 +185,7 @@ var chainPresets = [
|
|
|
185
185
|
{
|
|
186
186
|
id: "dxos.org/prompt/list",
|
|
187
187
|
title: "List",
|
|
188
|
-
createPrompt: () => (0, import_echo_schema.create)(
|
|
188
|
+
createPrompt: () => (0, import_echo_schema.create)(import_chunk_XS53UP75.ChainPromptType, {
|
|
189
189
|
command: "list",
|
|
190
190
|
template: str(
|
|
191
191
|
// prettier-ignore
|
|
@@ -202,12 +202,12 @@ var chainPresets = [
|
|
|
202
202
|
),
|
|
203
203
|
inputs: [
|
|
204
204
|
{
|
|
205
|
-
type:
|
|
205
|
+
type: import_chunk_XS53UP75.ChainInputType.SCHEMA,
|
|
206
206
|
name: "schema",
|
|
207
207
|
value: "example.com/type/project"
|
|
208
208
|
},
|
|
209
209
|
{
|
|
210
|
-
type:
|
|
210
|
+
type: import_chunk_XS53UP75.ChainInputType.PASS_THROUGH,
|
|
211
211
|
name: "question"
|
|
212
212
|
}
|
|
213
213
|
]
|
|
@@ -216,7 +216,7 @@ var chainPresets = [
|
|
|
216
216
|
{
|
|
217
217
|
id: "dxos.org/prompt/base",
|
|
218
218
|
title: "RAG",
|
|
219
|
-
createPrompt: () => (0, import_echo_schema.create)(
|
|
219
|
+
createPrompt: () => (0, import_echo_schema.create)(import_chunk_XS53UP75.ChainPromptType, {
|
|
220
220
|
command: "rag",
|
|
221
221
|
template: str(
|
|
222
222
|
// prettier-ignore
|
|
@@ -231,11 +231,11 @@ var chainPresets = [
|
|
|
231
231
|
),
|
|
232
232
|
inputs: [
|
|
233
233
|
{
|
|
234
|
-
type:
|
|
234
|
+
type: import_chunk_XS53UP75.ChainInputType.RETRIEVER,
|
|
235
235
|
name: "context"
|
|
236
236
|
},
|
|
237
237
|
{
|
|
238
|
-
type:
|
|
238
|
+
type: import_chunk_XS53UP75.ChainInputType.CONTEXT,
|
|
239
239
|
name: "question",
|
|
240
240
|
value: "object.text"
|
|
241
241
|
}
|
|
@@ -245,7 +245,7 @@ var chainPresets = [
|
|
|
245
245
|
{
|
|
246
246
|
id: "dxos.org/prompt/lookup",
|
|
247
247
|
title: "Lookup",
|
|
248
|
-
createPrompt: () => (0, import_echo_schema.create)(
|
|
248
|
+
createPrompt: () => (0, import_echo_schema.create)(import_chunk_XS53UP75.ChainPromptType, {
|
|
249
249
|
command: "lookup",
|
|
250
250
|
template: str(
|
|
251
251
|
// prettier-ignore
|
|
@@ -257,7 +257,7 @@ var chainPresets = [
|
|
|
257
257
|
),
|
|
258
258
|
inputs: [
|
|
259
259
|
{
|
|
260
|
-
type:
|
|
260
|
+
type: import_chunk_XS53UP75.ChainInputType.CONTEXT,
|
|
261
261
|
name: "input",
|
|
262
262
|
value: "text"
|
|
263
263
|
}
|
|
@@ -267,7 +267,7 @@ var chainPresets = [
|
|
|
267
267
|
{
|
|
268
268
|
id: "dxos.org/prompt/extract",
|
|
269
269
|
title: "Extract",
|
|
270
|
-
createPrompt: () => (0, import_echo_schema.create)(
|
|
270
|
+
createPrompt: () => (0, import_echo_schema.create)(import_chunk_XS53UP75.ChainPromptType, {
|
|
271
271
|
command: "extract",
|
|
272
272
|
template: str(
|
|
273
273
|
// prettier-ignore
|
|
@@ -285,17 +285,17 @@ var chainPresets = [
|
|
|
285
285
|
),
|
|
286
286
|
inputs: [
|
|
287
287
|
{
|
|
288
|
-
type:
|
|
288
|
+
type: import_chunk_XS53UP75.ChainInputType.SCHEMA,
|
|
289
289
|
name: "contact",
|
|
290
290
|
value: "example.com/type/contact"
|
|
291
291
|
},
|
|
292
292
|
{
|
|
293
|
-
type:
|
|
293
|
+
type: import_chunk_XS53UP75.ChainInputType.SCHEMA,
|
|
294
294
|
name: "company",
|
|
295
295
|
value: "example.com/type/organization"
|
|
296
296
|
},
|
|
297
297
|
{
|
|
298
|
-
type:
|
|
298
|
+
type: import_chunk_XS53UP75.ChainInputType.CONTEXT,
|
|
299
299
|
name: "input",
|
|
300
300
|
value: "text"
|
|
301
301
|
}
|
|
@@ -305,7 +305,7 @@ var chainPresets = [
|
|
|
305
305
|
{
|
|
306
306
|
id: "dxos.org/prompt/discord",
|
|
307
307
|
title: "Summarize",
|
|
308
|
-
createPrompt: () => (0, import_echo_schema.create)(
|
|
308
|
+
createPrompt: () => (0, import_echo_schema.create)(import_chunk_XS53UP75.ChainPromptType, {
|
|
309
309
|
command: "summarize",
|
|
310
310
|
template: str(
|
|
311
311
|
// prettier-ignore
|
|
@@ -317,7 +317,7 @@ var chainPresets = [
|
|
|
317
317
|
),
|
|
318
318
|
inputs: [
|
|
319
319
|
{
|
|
320
|
-
type:
|
|
320
|
+
type: import_chunk_XS53UP75.ChainInputType.RESOLVER,
|
|
321
321
|
name: "context",
|
|
322
322
|
value: "discord.messages.recent"
|
|
323
323
|
}
|
|
@@ -339,7 +339,7 @@ var Chain = ({ chain }) => {
|
|
|
339
339
|
};
|
|
340
340
|
return /* @__PURE__ */ import_react4.default.createElement("div", {
|
|
341
341
|
className: "flex flex-col my-2 gap-4"
|
|
342
|
-
}, chain.prompts?.filter(import_util.nonNullable).map((prompt, i) => /* @__PURE__ */ import_react4.default.createElement(
|
|
342
|
+
}, chain.prompts?.filter(import_util.nonNullable).map((prompt, i) => /* @__PURE__ */ import_react4.default.createElement(import_chunk_4TMTUB4X.PromptEditor, {
|
|
343
343
|
key: i,
|
|
344
344
|
prompt
|
|
345
345
|
})), /* @__PURE__ */ import_react4.default.createElement("div", {
|
|
@@ -350,7 +350,7 @@ var Chain = ({ chain }) => {
|
|
|
350
350
|
})));
|
|
351
351
|
};
|
|
352
352
|
var ChainPresets = ({ presets, onSelect }) => {
|
|
353
|
-
const { t } = (0, import_react_ui2.useTranslation)(
|
|
353
|
+
const { t } = (0, import_react_ui2.useTranslation)(import_chunk_JSZ6PAYL.AUTOMATION_PLUGIN);
|
|
354
354
|
return /* @__PURE__ */ import_react4.default.createElement(import_react_ui2.Select.Root, {
|
|
355
355
|
onValueChange: (value) => {
|
|
356
356
|
onSelect(presets.find(({ id }) => id === value));
|
|
@@ -614,7 +614,7 @@ var ChainPromptMetaProps = ({ meta, triggerId }) => {
|
|
|
614
614
|
}
|
|
615
615
|
})), meta.prompt && /* @__PURE__ */ import_react7.default.createElement(InputRow, {
|
|
616
616
|
label: "Prompt"
|
|
617
|
-
}, /* @__PURE__ */ import_react7.default.createElement(
|
|
617
|
+
}, /* @__PURE__ */ import_react7.default.createElement(import_chunk_4TMTUB4X.PromptEditor, {
|
|
618
618
|
prompt: meta.prompt,
|
|
619
619
|
schema
|
|
620
620
|
})));
|
|
@@ -670,12 +670,19 @@ var triggerTypes = [
|
|
|
670
670
|
];
|
|
671
671
|
var registerTriggersMutex = new import_async.Mutex();
|
|
672
672
|
var TriggerEditor = ({ space, trigger }) => {
|
|
673
|
+
const { t } = (0, import_react_ui3.useTranslation)(import_chunk_JSZ6PAYL.AUTOMATION_PLUGIN);
|
|
673
674
|
const client = (0, import_react_client.useClient)();
|
|
674
675
|
const scripts = (0, import_echo3.useQuery)(space, import_echo3.Filter.schema(import_types3.ScriptType));
|
|
675
676
|
const script = (0, import_react5.useMemo)(() => scripts.find((script2) => script2.id === trigger.function), [
|
|
676
677
|
trigger.function,
|
|
677
678
|
scripts
|
|
678
679
|
]);
|
|
680
|
+
const triggerLabels = {
|
|
681
|
+
subscription: t("trigger type subscription"),
|
|
682
|
+
timer: t("trigger type timer"),
|
|
683
|
+
webhook: t("trigger type webhook"),
|
|
684
|
+
websocket: t("trigger type websocket")
|
|
685
|
+
};
|
|
679
686
|
const [registry] = (0, import_react5.useState)(/* @__PURE__ */ new Map());
|
|
680
687
|
const triggers = (0, import_echo3.useQuery)(space, import_echo3.Filter.schema(import_types2.FunctionTrigger));
|
|
681
688
|
(0, import_react5.useEffect)(() => {
|
|
@@ -684,11 +691,11 @@ var TriggerEditor = ({ space, trigger }) => {
|
|
|
684
691
|
const deprecated = new Set(Array.from(registry.keys()));
|
|
685
692
|
import_log.log.info("triggers", {
|
|
686
693
|
deprecated,
|
|
687
|
-
all: triggers.map((
|
|
688
|
-
enabled: triggers.filter((
|
|
694
|
+
all: triggers.map((t2) => t2.id),
|
|
695
|
+
enabled: triggers.filter((t2) => t2.enabled).map((t2) => t2.id)
|
|
689
696
|
}, {
|
|
690
697
|
F: __dxlog_file3,
|
|
691
|
-
L:
|
|
698
|
+
L: 56,
|
|
692
699
|
S: void 0,
|
|
693
700
|
C: (f, a) => f(...a)
|
|
694
701
|
});
|
|
@@ -700,13 +707,13 @@ var TriggerEditor = ({ space, trigger }) => {
|
|
|
700
707
|
}
|
|
701
708
|
import_log.log.info("activating trigger", trigger2.id, {
|
|
702
709
|
F: __dxlog_file3,
|
|
703
|
-
L:
|
|
710
|
+
L: 68,
|
|
704
711
|
S: void 0,
|
|
705
712
|
C: (f, a) => f(...a)
|
|
706
713
|
});
|
|
707
714
|
const ctx = new import_context.Context(void 0, {
|
|
708
715
|
F: __dxlog_file3,
|
|
709
|
-
L:
|
|
716
|
+
L: 70
|
|
710
717
|
});
|
|
711
718
|
registry.set(trigger2.id, ctx);
|
|
712
719
|
const triggerSpec = trigger2.spec;
|
|
@@ -720,7 +727,7 @@ var TriggerEditor = ({ space, trigger }) => {
|
|
|
720
727
|
type: triggerSpec.type
|
|
721
728
|
}, {
|
|
722
729
|
F: __dxlog_file3,
|
|
723
|
-
L:
|
|
730
|
+
L: 80,
|
|
724
731
|
S: void 0,
|
|
725
732
|
C: (f, a) => f(...a)
|
|
726
733
|
});
|
|
@@ -751,7 +758,7 @@ var TriggerEditor = ({ space, trigger }) => {
|
|
|
751
758
|
};
|
|
752
759
|
}, []);
|
|
753
760
|
(0, import_react5.useEffect)(() => {
|
|
754
|
-
void space.db.
|
|
761
|
+
void space.db.schemaRegistry.query().then((schemas) => {
|
|
755
762
|
state.schemas = (0, import_util2.distinctBy)([
|
|
756
763
|
...state.schemas,
|
|
757
764
|
...schemas
|
|
@@ -832,34 +839,35 @@ var TriggerEditor = ({ space, trigger }) => {
|
|
|
832
839
|
}, /* @__PURE__ */ import_react5.default.createElement("table", {
|
|
833
840
|
className: "is-full table-fixed"
|
|
834
841
|
}, /* @__PURE__ */ import_react5.default.createElement("tbody", null, /* @__PURE__ */ import_react5.default.createElement(InputRow, {
|
|
835
|
-
label: "
|
|
842
|
+
label: t("function select label")
|
|
836
843
|
}, /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Select.Root, {
|
|
837
844
|
value: script?.id,
|
|
838
845
|
onValueChange: handleSelectFunction
|
|
839
846
|
}, /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Select.TriggerButton, {
|
|
840
|
-
|
|
847
|
+
classNames: "w-full",
|
|
848
|
+
placeholder: t("function select placeholder")
|
|
841
849
|
}), /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Select.Portal, null, /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Select.Content, null, /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Select.Viewport, null, scripts.map(({ id, name }) => /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Select.Option, {
|
|
842
850
|
key: id,
|
|
843
851
|
value: id
|
|
844
|
-
}, name ??
|
|
852
|
+
}, name ?? id))))))), script?.description?.length && /* @__PURE__ */ import_react5.default.createElement(InputRow, null, /* @__PURE__ */ import_react5.default.createElement("div", {
|
|
845
853
|
className: "px-2"
|
|
846
854
|
}, /* @__PURE__ */ import_react5.default.createElement("p", {
|
|
847
855
|
className: "text-sm text-description"
|
|
848
856
|
}, script?.description?.length))), /* @__PURE__ */ import_react5.default.createElement(InputRow, {
|
|
849
|
-
label: "
|
|
857
|
+
label: t("trigger select label")
|
|
850
858
|
}, /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Select.Root, {
|
|
851
859
|
value: trigger.spec?.type,
|
|
852
860
|
onValueChange: handleSelectTriggerType
|
|
853
861
|
}, /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Select.TriggerButton, {
|
|
854
|
-
placeholder: "
|
|
862
|
+
placeholder: t("trigger select placeholder")
|
|
855
863
|
}), /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Select.Portal, null, /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Select.Content, null, /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Select.Viewport, null, triggerTypes.map((trigger2) => /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Select.Option, {
|
|
856
864
|
key: trigger2,
|
|
857
865
|
value: trigger2
|
|
858
|
-
}, trigger2)))))))), /* @__PURE__ */ import_react5.default.createElement("tbody", null, trigger.spec && /* @__PURE__ */ import_react5.default.createElement(TriggerSpec, {
|
|
866
|
+
}, triggerLabels[trigger2])))))))), /* @__PURE__ */ import_react5.default.createElement("tbody", null, trigger.spec && /* @__PURE__ */ import_react5.default.createElement(TriggerSpec, {
|
|
859
867
|
space,
|
|
860
868
|
spec: trigger.spec
|
|
861
869
|
}), /* @__PURE__ */ import_react5.default.createElement(InputRow, {
|
|
862
|
-
label: "
|
|
870
|
+
label: t("function enabled")
|
|
863
871
|
}, /* @__PURE__ */ import_react5.default.createElement("div", {
|
|
864
872
|
className: "flex items-center h-8"
|
|
865
873
|
}, /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Input.Switch, {
|
|
@@ -874,10 +882,11 @@ var TriggerEditor = ({ space, trigger }) => {
|
|
|
874
882
|
}))));
|
|
875
883
|
};
|
|
876
884
|
var TriggerSpecSubscription = ({ spec }) => {
|
|
885
|
+
const { t } = (0, import_react_ui3.useTranslation)(import_chunk_JSZ6PAYL.AUTOMATION_PLUGIN);
|
|
877
886
|
if (!spec.filter) {
|
|
878
887
|
return null;
|
|
879
888
|
}
|
|
880
|
-
const
|
|
889
|
+
const handleValueChange = (typename) => {
|
|
881
890
|
spec.filter = [
|
|
882
891
|
{
|
|
883
892
|
type: typename
|
|
@@ -885,10 +894,10 @@ var TriggerSpecSubscription = ({ spec }) => {
|
|
|
885
894
|
];
|
|
886
895
|
};
|
|
887
896
|
return /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, /* @__PURE__ */ import_react5.default.createElement(InputRow, {
|
|
888
|
-
label: "
|
|
897
|
+
label: t("trigger filter")
|
|
889
898
|
}, /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Select.Root, {
|
|
890
899
|
value: spec.filter.length > 0 ? spec.filter[0].type : void 0,
|
|
891
|
-
onValueChange:
|
|
900
|
+
onValueChange: handleValueChange
|
|
892
901
|
}, /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Select.TriggerButton, {
|
|
893
902
|
classNames: "w-full",
|
|
894
903
|
placeholder: "Select type"
|
|
@@ -897,28 +906,35 @@ var TriggerSpecSubscription = ({ spec }) => {
|
|
|
897
906
|
value: typename
|
|
898
907
|
}, typename))))))));
|
|
899
908
|
};
|
|
900
|
-
var TriggerSpecTimer = ({ spec }) =>
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
909
|
+
var TriggerSpecTimer = ({ spec }) => {
|
|
910
|
+
const { t } = (0, import_react_ui3.useTranslation)(import_chunk_JSZ6PAYL.AUTOMATION_PLUGIN);
|
|
911
|
+
return /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, /* @__PURE__ */ import_react5.default.createElement(InputRow, {
|
|
912
|
+
label: t("trigger cron")
|
|
913
|
+
}, /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Input.TextInput, {
|
|
914
|
+
value: spec.cron,
|
|
915
|
+
onChange: (event) => spec.cron = event.target.value
|
|
916
|
+
})));
|
|
917
|
+
};
|
|
906
918
|
var methods = [
|
|
907
919
|
"GET",
|
|
908
920
|
"POST"
|
|
909
921
|
];
|
|
910
|
-
var TriggerSpecWebhook = ({ spec }) =>
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
922
|
+
var TriggerSpecWebhook = ({ spec }) => {
|
|
923
|
+
const { t } = (0, import_react_ui3.useTranslation)(import_chunk_JSZ6PAYL.AUTOMATION_PLUGIN);
|
|
924
|
+
return /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, /* @__PURE__ */ import_react5.default.createElement(InputRow, {
|
|
925
|
+
label: t("trigger method")
|
|
926
|
+
}, /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Select.Root, {
|
|
927
|
+
value: spec.method,
|
|
928
|
+
onValueChange: (value) => spec.method = value
|
|
929
|
+
}, /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Select.TriggerButton, {
|
|
930
|
+
placeholder: "type"
|
|
931
|
+
}), /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Select.Portal, null, /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Select.Content, null, /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Select.Viewport, null, methods.map((method) => /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Select.Option, {
|
|
932
|
+
key: method,
|
|
933
|
+
value: method
|
|
934
|
+
}, method))))))));
|
|
935
|
+
};
|
|
921
936
|
var TriggerSpecWebsocket = ({ spec }) => {
|
|
937
|
+
const { t } = (0, import_react_ui3.useTranslation)(import_chunk_JSZ6PAYL.AUTOMATION_PLUGIN);
|
|
922
938
|
const handleChangeInit = (event) => {
|
|
923
939
|
try {
|
|
924
940
|
spec.init = JSON.parse(event.target.value);
|
|
@@ -926,7 +942,7 @@ var TriggerSpecWebsocket = ({ spec }) => {
|
|
|
926
942
|
}
|
|
927
943
|
};
|
|
928
944
|
return /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, /* @__PURE__ */ import_react5.default.createElement(InputRow, {
|
|
929
|
-
label: "
|
|
945
|
+
label: t("trigger method")
|
|
930
946
|
}, /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Input.TextInput, {
|
|
931
947
|
value: spec.url,
|
|
932
948
|
onChange: (event) => spec.url = event.target.value,
|
|
@@ -952,11 +968,11 @@ var TriggerSpec = ({ space, spec }) => {
|
|
|
952
968
|
spec
|
|
953
969
|
}) : null;
|
|
954
970
|
};
|
|
955
|
-
var PromptContainer = (0, import_react2.lazy)(() => import("./PromptContainer-
|
|
971
|
+
var PromptContainer = (0, import_react2.lazy)(() => import("./PromptContainer-74ZRO4HK.cjs"));
|
|
956
972
|
var translations_default = [
|
|
957
973
|
{
|
|
958
974
|
"en-US": {
|
|
959
|
-
[
|
|
975
|
+
[import_chunk_JSZ6PAYL.AUTOMATION_PLUGIN]: {
|
|
960
976
|
"plugin name": "Automation",
|
|
961
977
|
"object placeholder": "New prompt",
|
|
962
978
|
"create object label": "Create prompt",
|
|
@@ -965,7 +981,21 @@ var translations_default = [
|
|
|
965
981
|
"command placeholder": "Enter slash command...",
|
|
966
982
|
"template placeholder": "Enter template...",
|
|
967
983
|
"value placeholder": "Enter value...",
|
|
968
|
-
"select preset template placeholder": "Select preset"
|
|
984
|
+
"select preset template placeholder": "Select preset",
|
|
985
|
+
"open automation panel label": "Show Automations",
|
|
986
|
+
"function select label": "Function",
|
|
987
|
+
"function select placeholder": "Select function",
|
|
988
|
+
"function enabled": "Enabled",
|
|
989
|
+
"trigger select label": "Trigger",
|
|
990
|
+
"trigger select placeholder": "Trigger type",
|
|
991
|
+
"trigger type subscription": "Subscription",
|
|
992
|
+
"trigger type timer": "Timer",
|
|
993
|
+
"trigger type webhook": "Webhook",
|
|
994
|
+
"trigger type websocket": "Websocket",
|
|
995
|
+
"trigger filter": "Filter",
|
|
996
|
+
"trigger cron": "Cron",
|
|
997
|
+
"trigger method": "Method",
|
|
998
|
+
"trigger endpoint": "Endpoint"
|
|
969
999
|
}
|
|
970
1000
|
}
|
|
971
1001
|
}
|
|
@@ -973,15 +1003,15 @@ var translations_default = [
|
|
|
973
1003
|
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-automation/src/AutomationPlugin.tsx";
|
|
974
1004
|
var AutomationPlugin = () => {
|
|
975
1005
|
return {
|
|
976
|
-
meta:
|
|
1006
|
+
meta: import_chunk_JSZ6PAYL.meta_default,
|
|
977
1007
|
provides: {
|
|
978
1008
|
metadata: {
|
|
979
1009
|
records: {
|
|
980
|
-
[
|
|
1010
|
+
[import_chunk_XS53UP75.ChainType.typename]: {
|
|
981
1011
|
placeholder: [
|
|
982
1012
|
"object placeholder",
|
|
983
1013
|
{
|
|
984
|
-
ns:
|
|
1014
|
+
ns: import_chunk_JSZ6PAYL.AUTOMATION_PLUGIN
|
|
985
1015
|
}
|
|
986
1016
|
],
|
|
987
1017
|
icon: "ph--magic-wand--regular",
|
|
@@ -993,12 +1023,26 @@ var AutomationPlugin = () => {
|
|
|
993
1023
|
translations: translations_default,
|
|
994
1024
|
echo: {
|
|
995
1025
|
schema: [
|
|
996
|
-
|
|
997
|
-
|
|
1026
|
+
import_chunk_XS53UP75.ChainType,
|
|
1027
|
+
import_chunk_XS53UP75.ChainPromptType,
|
|
998
1028
|
import_types.FunctionDef,
|
|
999
1029
|
import_types.FunctionTrigger
|
|
1000
1030
|
]
|
|
1001
1031
|
},
|
|
1032
|
+
complementary: {
|
|
1033
|
+
panels: [
|
|
1034
|
+
{
|
|
1035
|
+
id: "automation",
|
|
1036
|
+
label: [
|
|
1037
|
+
"open automation panel label",
|
|
1038
|
+
{
|
|
1039
|
+
ns: import_chunk_JSZ6PAYL.AUTOMATION_PLUGIN
|
|
1040
|
+
}
|
|
1041
|
+
],
|
|
1042
|
+
icon: "ph--flow-arrow--regular"
|
|
1043
|
+
}
|
|
1044
|
+
]
|
|
1045
|
+
},
|
|
1002
1046
|
graph: {
|
|
1003
1047
|
builder: (plugins) => {
|
|
1004
1048
|
const clientPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_plugin_client.parseClientPlugin);
|
|
@@ -1007,7 +1051,7 @@ var AutomationPlugin = () => {
|
|
|
1007
1051
|
const client = clientPlugin?.provides.client;
|
|
1008
1052
|
(0, import_invariant.invariant)(resolve, void 0, {
|
|
1009
1053
|
F: __dxlog_file4,
|
|
1010
|
-
L:
|
|
1054
|
+
L: 55,
|
|
1011
1055
|
S: void 0,
|
|
1012
1056
|
A: [
|
|
1013
1057
|
"resolve",
|
|
@@ -1016,7 +1060,7 @@ var AutomationPlugin = () => {
|
|
|
1016
1060
|
});
|
|
1017
1061
|
(0, import_invariant.invariant)(client, void 0, {
|
|
1018
1062
|
F: __dxlog_file4,
|
|
1019
|
-
L:
|
|
1063
|
+
L: 56,
|
|
1020
1064
|
S: void 0,
|
|
1021
1065
|
A: [
|
|
1022
1066
|
"client",
|
|
@@ -1026,13 +1070,13 @@ var AutomationPlugin = () => {
|
|
|
1026
1070
|
return [
|
|
1027
1071
|
// Create nodes for object settings.
|
|
1028
1072
|
(0, import_plugin_graph.createExtension)({
|
|
1029
|
-
id: `${
|
|
1073
|
+
id: `${import_chunk_JSZ6PAYL.AUTOMATION_PLUGIN}/automation-for-subject`,
|
|
1030
1074
|
resolver: ({ id }) => {
|
|
1031
1075
|
if (!id.endsWith("~automation")) {
|
|
1032
1076
|
return;
|
|
1033
1077
|
}
|
|
1034
1078
|
const type = "orphan-settings-for-subject";
|
|
1035
|
-
const icon = "ph--
|
|
1079
|
+
const icon = "ph--flow-arrow--regular";
|
|
1036
1080
|
const [subjectId] = id.split("~");
|
|
1037
1081
|
const { spaceId, objectId } = (0, import_echo.parseId)(subjectId);
|
|
1038
1082
|
const space = client.spaces.get().find((space2) => space2.id === spaceId);
|
|
@@ -1040,12 +1084,12 @@ var AutomationPlugin = () => {
|
|
|
1040
1084
|
const label2 = space ? space.properties.name || [
|
|
1041
1085
|
"unnamed space label",
|
|
1042
1086
|
{
|
|
1043
|
-
ns:
|
|
1087
|
+
ns: import_chunk_JSZ6PAYL.AUTOMATION_PLUGIN
|
|
1044
1088
|
}
|
|
1045
1089
|
] : [
|
|
1046
1090
|
"unnamed object settings label",
|
|
1047
1091
|
{
|
|
1048
|
-
ns:
|
|
1092
|
+
ns: import_chunk_JSZ6PAYL.AUTOMATION_PLUGIN
|
|
1049
1093
|
}
|
|
1050
1094
|
];
|
|
1051
1095
|
return {
|
|
@@ -1075,7 +1119,7 @@ var AutomationPlugin = () => {
|
|
|
1075
1119
|
const label = meta.label?.(object) || object.name || meta.placeholder || [
|
|
1076
1120
|
"unnamed object settings label",
|
|
1077
1121
|
{
|
|
1078
|
-
ns:
|
|
1122
|
+
ns: import_chunk_JSZ6PAYL.AUTOMATION_PLUGIN
|
|
1079
1123
|
}
|
|
1080
1124
|
];
|
|
1081
1125
|
return {
|
|
@@ -1107,7 +1151,7 @@ var AutomationPlugin = () => {
|
|
|
1107
1151
|
intent: {
|
|
1108
1152
|
resolver: (intent) => {
|
|
1109
1153
|
switch (intent.action) {
|
|
1110
|
-
case
|
|
1154
|
+
case import_chunk_XS53UP75.AutomationAction.CREATE: {
|
|
1111
1155
|
return {};
|
|
1112
1156
|
}
|
|
1113
1157
|
}
|