@dxos/plugin-automation 0.7.2-main.f1adc9f → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/lib/browser/{chunk-R6GS7UA7.mjs → chunk-B3Z4NQC2.mjs} +8 -2
  2. package/dist/lib/browser/{chunk-R6GS7UA7.mjs.map → chunk-B3Z4NQC2.mjs.map} +3 -3
  3. package/dist/lib/browser/{chunk-X5KMOH3I.mjs → chunk-PQLGYMNY.mjs} +2 -2
  4. package/dist/lib/browser/{chunk-X5KMOH3I.mjs.map → chunk-PQLGYMNY.mjs.map} +1 -1
  5. package/dist/lib/browser/index.mjs +286 -109
  6. package/dist/lib/browser/index.mjs.map +4 -4
  7. package/dist/lib/browser/meta.json +1 -1
  8. package/dist/lib/browser/meta.mjs +1 -1
  9. package/dist/lib/browser/types/index.mjs +2 -1
  10. package/dist/lib/node/{chunk-DTJ7XVO2.cjs → chunk-JSZ6PAYL.cjs} +5 -5
  11. package/dist/lib/node/{chunk-DTJ7XVO2.cjs.map → chunk-JSZ6PAYL.cjs.map} +1 -1
  12. package/dist/lib/node/{chunk-JHKEVE65.cjs → chunk-SUMUWFZA.cjs} +8 -5
  13. package/dist/lib/node/{chunk-JHKEVE65.cjs.map → chunk-SUMUWFZA.cjs.map} +3 -3
  14. package/dist/lib/node/index.cjs +313 -143
  15. package/dist/lib/node/index.cjs.map +4 -4
  16. package/dist/lib/node/meta.cjs +3 -3
  17. package/dist/lib/node/meta.cjs.map +1 -1
  18. package/dist/lib/node/meta.json +1 -1
  19. package/dist/lib/node/types/index.cjs +7 -6
  20. package/dist/lib/node/types/index.cjs.map +2 -2
  21. package/dist/lib/node-esm/{chunk-HNOBZHWK.mjs → chunk-B35UD3D7.mjs} +2 -2
  22. package/dist/lib/node-esm/{chunk-HNOBZHWK.mjs.map → chunk-B35UD3D7.mjs.map} +1 -1
  23. package/dist/lib/node-esm/{chunk-ISJZVA2J.mjs → chunk-PYT2WY4B.mjs} +7 -2
  24. package/dist/lib/node-esm/{chunk-ISJZVA2J.mjs.map → chunk-PYT2WY4B.mjs.map} +3 -3
  25. package/dist/lib/node-esm/index.mjs +286 -109
  26. package/dist/lib/node-esm/index.mjs.map +4 -4
  27. package/dist/lib/node-esm/meta.json +1 -1
  28. package/dist/lib/node-esm/meta.mjs +1 -1
  29. package/dist/lib/node-esm/types/index.mjs +2 -1
  30. package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
  31. package/dist/types/src/components/AutomationPanel.d.ts +3 -0
  32. package/dist/types/src/components/AutomationPanel.d.ts.map +1 -0
  33. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +2 -4
  34. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
  35. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
  36. package/dist/types/src/components/index.d.ts +3 -2
  37. package/dist/types/src/components/index.d.ts.map +1 -1
  38. package/dist/types/src/translations.d.ts +0 -2
  39. package/dist/types/src/translations.d.ts.map +1 -1
  40. package/dist/types/src/types/schema.d.ts +3 -3
  41. package/dist/types/src/types/types.d.ts +1 -0
  42. package/dist/types/src/types/types.d.ts.map +1 -1
  43. package/package.json +34 -37
  44. package/src/AutomationPlugin.tsx +35 -88
  45. package/src/components/AutomationPanel.tsx +23 -0
  46. package/src/components/TriggerEditor/TriggerEditor.stories.tsx +32 -2
  47. package/src/components/TriggerEditor/TriggerEditor.tsx +43 -9
  48. package/src/components/index.ts +3 -4
  49. package/src/meta.ts +1 -1
  50. package/src/translations.ts +0 -3
  51. package/src/types/types.ts +5 -3
  52. package/dist/lib/browser/AssistantPanel-622FK3DP.mjs +0 -341
  53. package/dist/lib/browser/AssistantPanel-622FK3DP.mjs.map +0 -7
  54. package/dist/lib/browser/AutomationPanel-PVI2EJNE.mjs +0 -125
  55. package/dist/lib/browser/AutomationPanel-PVI2EJNE.mjs.map +0 -7
  56. package/dist/lib/node/AssistantPanel-HRJRVOZD.cjs +0 -361
  57. package/dist/lib/node/AssistantPanel-HRJRVOZD.cjs.map +0 -7
  58. package/dist/lib/node/AutomationPanel-Z2XW24BN.cjs +0 -145
  59. package/dist/lib/node/AutomationPanel-Z2XW24BN.cjs.map +0 -7
  60. package/dist/lib/node-esm/AssistantPanel-QIIX7S4V.mjs +0 -342
  61. package/dist/lib/node-esm/AssistantPanel-QIIX7S4V.mjs.map +0 -7
  62. package/dist/lib/node-esm/AutomationPanel-5L5NFVKU.mjs +0 -126
  63. package/dist/lib/node-esm/AutomationPanel-5L5NFVKU.mjs.map +0 -7
  64. package/dist/types/src/components/AssistantPanel/AssistantPanel.d.ts +0 -8
  65. package/dist/types/src/components/AssistantPanel/AssistantPanel.d.ts.map +0 -1
  66. package/dist/types/src/components/AssistantPanel/index.d.ts +0 -3
  67. package/dist/types/src/components/AssistantPanel/index.d.ts.map +0 -1
  68. package/dist/types/src/components/AssistantPanel/system-instructions.d.ts +0 -6
  69. package/dist/types/src/components/AssistantPanel/system-instructions.d.ts.map +0 -1
  70. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +0 -9
  71. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +0 -1
  72. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +0 -6
  73. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +0 -1
  74. package/dist/types/src/components/AutomationPanel/index.d.ts +0 -3
  75. package/dist/types/src/components/AutomationPanel/index.d.ts.map +0 -1
  76. package/dist/types/src/testing/index.d.ts +0 -2
  77. package/dist/types/src/testing/index.d.ts.map +0 -1
  78. package/dist/types/src/testing/testing.d.ts +0 -12
  79. package/dist/types/src/testing/testing.d.ts.map +0 -1
  80. package/src/components/AssistantPanel/AssistantPanel.tsx +0 -230
  81. package/src/components/AssistantPanel/index.ts +0 -7
  82. package/src/components/AssistantPanel/system-instructions.ts +0 -166
  83. package/src/components/AutomationPanel/AutomationPanel.stories.tsx +0 -57
  84. package/src/components/AutomationPanel/AutomationPanel.tsx +0 -96
  85. package/src/components/AutomationPanel/index.ts +0 -7
  86. package/src/testing/index.ts +0 -5
  87. package/src/testing/testing.ts +0 -34
@@ -28,38 +28,280 @@ 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
- AssistantPanel: () => AssistantPanel,
32
- AutomationAction: () => import_chunk_JHKEVE65.AutomationAction,
31
+ AutomationAction: () => import_chunk_SUMUWFZA.AutomationAction,
33
32
  AutomationPanel: () => AutomationPanel,
34
33
  AutomationPlugin: () => AutomationPlugin,
35
- ChainInputSchema: () => import_chunk_JHKEVE65.ChainInputSchema,
36
- ChainInputType: () => import_chunk_JHKEVE65.ChainInputType,
37
- ChainPromptType: () => import_chunk_JHKEVE65.ChainPromptType,
38
- ChainType: () => import_chunk_JHKEVE65.ChainType,
34
+ ChainInputSchema: () => import_chunk_SUMUWFZA.ChainInputSchema,
35
+ ChainInputType: () => import_chunk_SUMUWFZA.ChainInputType,
36
+ ChainPromptType: () => import_chunk_SUMUWFZA.ChainPromptType,
37
+ ChainType: () => import_chunk_SUMUWFZA.ChainType,
38
+ PromptEditor: () => PromptEditor,
39
+ TriggerEditor: () => TriggerEditor,
39
40
  chainPresets: () => chainPresets,
40
41
  default: () => src_default,
41
42
  str: () => str
42
43
  });
43
44
  module.exports = __toCommonJS(node_exports);
44
- var import_chunk_JHKEVE65 = require("./chunk-JHKEVE65.cjs");
45
- var import_chunk_DTJ7XVO2 = require("./chunk-DTJ7XVO2.cjs");
45
+ var import_chunk_SUMUWFZA = require("./chunk-SUMUWFZA.cjs");
46
+ var import_chunk_JSZ6PAYL = require("./chunk-JSZ6PAYL.cjs");
46
47
  var import_react = __toESM(require("react"));
47
48
  var import_app_framework = require("@dxos/app-framework");
48
49
  var import_functions = require("@dxos/functions");
49
50
  var import_invariant = require("@dxos/invariant");
50
51
  var import_plugin_client = require("@dxos/plugin-client");
51
52
  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");
54
70
  var import_react_ui_form = require("@dxos/react-ui-form");
55
- var import_react2 = require("react");
56
71
  var import_echo_schema = require("@dxos/echo-schema");
57
- var AssistantPanel = (0, import_react2.lazy)(() => import("./AssistantPanel-HRJRVOZD.cjs"));
58
- var AutomationPanel = (0, import_react2.lazy)(() => import("./AutomationPanel-Z2XW24BN.cjs"));
72
+ var AutomationPanel = () => {
73
+ const handleCreate = () => {
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
+ };
59
301
  var translations_default = [
60
302
  {
61
303
  "en-US": {
62
- [import_chunk_DTJ7XVO2.AUTOMATION_PLUGIN]: {
304
+ [import_chunk_JSZ6PAYL.AUTOMATION_PLUGIN]: {
63
305
  "plugin name": "Automation",
64
306
  "object placeholder": "New prompt",
65
307
  "create object label": "Create prompt",
@@ -82,9 +324,7 @@ var translations_default = [
82
324
  "trigger filter": "Filter",
83
325
  "trigger cron": "Cron",
84
326
  "trigger method": "Method",
85
- "trigger endpoint": "Endpoint",
86
- "open assistant panel label": "Show Assistant",
87
- "assistant panel label": "Assistant"
327
+ "trigger endpoint": "Endpoint"
88
328
  }
89
329
  }
90
330
  }
@@ -92,15 +332,15 @@ var translations_default = [
92
332
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-automation/src/AutomationPlugin.tsx";
93
333
  var AutomationPlugin = () => {
94
334
  return {
95
- meta: import_chunk_DTJ7XVO2.meta_default,
335
+ meta: import_chunk_JSZ6PAYL.meta_default,
96
336
  provides: {
97
337
  metadata: {
98
338
  records: {
99
- [import_chunk_JHKEVE65.ChainType.typename]: {
339
+ [import_chunk_SUMUWFZA.ChainType.typename]: {
100
340
  placeholder: [
101
341
  "object placeholder",
102
342
  {
103
- ns: import_chunk_DTJ7XVO2.AUTOMATION_PLUGIN
343
+ ns: import_chunk_JSZ6PAYL.AUTOMATION_PLUGIN
104
344
  }
105
345
  ],
106
346
  icon: "ph--magic-wand--regular",
@@ -109,14 +349,11 @@ var AutomationPlugin = () => {
109
349
  }
110
350
  }
111
351
  },
112
- translations: [
113
- ...translations_default,
114
- ...import_react_ui_form.translations
115
- ],
352
+ translations: translations_default,
116
353
  echo: {
117
354
  schema: [
118
- import_chunk_JHKEVE65.ChainType,
119
- import_chunk_JHKEVE65.ChainPromptType,
355
+ import_chunk_SUMUWFZA.ChainType,
356
+ import_chunk_SUMUWFZA.ChainPromptType,
120
357
  import_functions.FunctionTrigger
121
358
  ]
122
359
  },
@@ -127,20 +364,10 @@ var AutomationPlugin = () => {
127
364
  label: [
128
365
  "open automation panel label",
129
366
  {
130
- ns: import_chunk_DTJ7XVO2.AUTOMATION_PLUGIN
367
+ ns: import_chunk_JSZ6PAYL.AUTOMATION_PLUGIN
131
368
  }
132
369
  ],
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"
370
+ icon: "ph--flow-arrow--regular"
144
371
  }
145
372
  ]
146
373
  },
@@ -152,7 +379,7 @@ var AutomationPlugin = () => {
152
379
  const client = clientPlugin?.provides.client;
153
380
  (0, import_invariant.invariant)(resolve, void 0, {
154
381
  F: __dxlog_file,
155
- L: 66,
382
+ L: 52,
156
383
  S: void 0,
157
384
  A: [
158
385
  "resolve",
@@ -161,7 +388,7 @@ var AutomationPlugin = () => {
161
388
  });
162
389
  (0, import_invariant.invariant)(client, void 0, {
163
390
  F: __dxlog_file,
164
- L: 67,
391
+ L: 53,
165
392
  S: void 0,
166
393
  A: [
167
394
  "client",
@@ -171,27 +398,26 @@ var AutomationPlugin = () => {
171
398
  return [
172
399
  // Create nodes for object settings.
173
400
  (0, import_plugin_graph.createExtension)({
174
- id: `${import_chunk_DTJ7XVO2.AUTOMATION_PLUGIN}/automation-for-subject`,
401
+ id: `${import_chunk_JSZ6PAYL.AUTOMATION_PLUGIN}/automation-for-subject`,
175
402
  resolver: ({ id }) => {
176
403
  if (!id.endsWith("~automation")) {
177
404
  return;
178
405
  }
179
406
  const type = "orphan-settings-for-subject";
180
- const icon = "ph--magic-wand--regular";
407
+ const icon = "ph--flow-arrow--regular";
181
408
  const [subjectId] = id.split("~");
182
409
  const { spaceId, objectId } = (0, import_echo.parseId)(subjectId);
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);
410
+ const space = client.spaces.get().find((space2) => space2.id === spaceId);
185
411
  if (!objectId) {
186
412
  const label2 = space ? space.properties.name || [
187
413
  "unnamed space label",
188
414
  {
189
- ns: import_chunk_DTJ7XVO2.AUTOMATION_PLUGIN
415
+ ns: import_chunk_JSZ6PAYL.AUTOMATION_PLUGIN
190
416
  }
191
417
  ] : [
192
418
  "unnamed object settings label",
193
419
  {
194
- ns: import_chunk_DTJ7XVO2.AUTOMATION_PLUGIN
420
+ ns: import_chunk_JSZ6PAYL.AUTOMATION_PLUGIN
195
421
  }
196
422
  ];
197
423
  return {
@@ -207,9 +433,15 @@ var AutomationPlugin = () => {
207
433
  }
208
434
  };
209
435
  }
210
- const [object] = (0, import_plugin_space.memoizeQuery)(space, {
211
- id: objectId
212
- });
436
+ const object = (0, import_plugin_graph.toSignal)((onChange) => {
437
+ const timeout = setTimeout(async () => {
438
+ await space?.db.query({
439
+ id: objectId
440
+ }).first();
441
+ onChange();
442
+ });
443
+ return () => clearTimeout(timeout);
444
+ }, () => space?.db.getObjectById(objectId), subjectId);
213
445
  if (!object || !subjectId) {
214
446
  return;
215
447
  }
@@ -217,7 +449,7 @@ var AutomationPlugin = () => {
217
449
  const label = meta.label?.(object) || object.name || meta.placeholder || [
218
450
  "unnamed object settings label",
219
451
  {
220
- ns: import_chunk_DTJ7XVO2.AUTOMATION_PLUGIN
452
+ ns: import_chunk_JSZ6PAYL.AUTOMATION_PLUGIN
221
453
  }
222
454
  ];
223
455
  return {
@@ -231,54 +463,6 @@ var AutomationPlugin = () => {
231
463
  }
232
464
  };
233
465
  }
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
- }
282
466
  })
283
467
  ];
284
468
  }
@@ -286,36 +470,21 @@ var AutomationPlugin = () => {
286
470
  surface: {
287
471
  component: ({ data, role }) => {
288
472
  switch (role) {
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
- }
473
+ // case 'article':
474
+ // return data.object instanceof ChainType ? <ChainArticle chain={data.object} /> : null;
475
+ case "complementary--automation":
476
+ return /* @__PURE__ */ import_react.default.createElement(AutomationPanel, null);
313
477
  }
314
478
  return null;
315
479
  }
316
480
  },
317
481
  intent: {
318
482
  resolver: (intent) => {
483
+ switch (intent.action) {
484
+ case import_chunk_SUMUWFZA.AutomationAction.CREATE: {
485
+ return {};
486
+ }
487
+ }
319
488
  }
320
489
  }
321
490
  }
@@ -326,7 +495,7 @@ var chainPresets = [
326
495
  {
327
496
  id: "dxos.org/prompt/translate",
328
497
  title: "Translate",
329
- createPrompt: () => (0, import_echo_schema.create)(import_chunk_JHKEVE65.ChainPromptType, {
498
+ createPrompt: () => (0, import_echo_schema.create)(import_chunk_SUMUWFZA.ChainPromptType, {
330
499
  command: "say",
331
500
  template: str(
332
501
  // prettier-ignore
@@ -338,12 +507,12 @@ var chainPresets = [
338
507
  ),
339
508
  inputs: [
340
509
  {
341
- type: import_chunk_JHKEVE65.ChainInputType.VALUE,
510
+ type: import_chunk_SUMUWFZA.ChainInputType.VALUE,
342
511
  name: "language",
343
512
  value: "japanese"
344
513
  },
345
514
  {
346
- type: import_chunk_JHKEVE65.ChainInputType.PASS_THROUGH,
515
+ type: import_chunk_SUMUWFZA.ChainInputType.PASS_THROUGH,
347
516
  name: "input"
348
517
  }
349
518
  ]
@@ -352,7 +521,7 @@ var chainPresets = [
352
521
  {
353
522
  id: "dxos.org/prompt/chess",
354
523
  title: "Chess",
355
- createPrompt: () => (0, import_echo_schema.create)(import_chunk_JHKEVE65.ChainPromptType, {
524
+ createPrompt: () => (0, import_echo_schema.create)(import_chunk_SUMUWFZA.ChainPromptType, {
356
525
  command: "hint",
357
526
  template: str(
358
527
  // prettier-ignore
@@ -364,7 +533,7 @@ var chainPresets = [
364
533
  ),
365
534
  inputs: [
366
535
  {
367
- type: import_chunk_JHKEVE65.ChainInputType.CONTEXT,
536
+ type: import_chunk_SUMUWFZA.ChainInputType.CONTEXT,
368
537
  name: "history",
369
538
  value: "object.pgn"
370
539
  }
@@ -374,7 +543,7 @@ var chainPresets = [
374
543
  {
375
544
  id: "dxos.org/prompt/mermaid",
376
545
  title: "Mermaid",
377
- createPrompt: () => (0, import_echo_schema.create)(import_chunk_JHKEVE65.ChainPromptType, {
546
+ createPrompt: () => (0, import_echo_schema.create)(import_chunk_SUMUWFZA.ChainPromptType, {
378
547
  command: "draw",
379
548
  template: str(
380
549
  // prettier-ignore
@@ -387,7 +556,7 @@ var chainPresets = [
387
556
  ),
388
557
  inputs: [
389
558
  {
390
- type: import_chunk_JHKEVE65.ChainInputType.PASS_THROUGH,
559
+ type: import_chunk_SUMUWFZA.ChainInputType.PASS_THROUGH,
391
560
  name: "input"
392
561
  }
393
562
  ]
@@ -396,7 +565,7 @@ var chainPresets = [
396
565
  {
397
566
  id: "dxos.org/prompt/list",
398
567
  title: "List",
399
- createPrompt: () => (0, import_echo_schema.create)(import_chunk_JHKEVE65.ChainPromptType, {
568
+ createPrompt: () => (0, import_echo_schema.create)(import_chunk_SUMUWFZA.ChainPromptType, {
400
569
  command: "list",
401
570
  template: str(
402
571
  // prettier-ignore
@@ -413,12 +582,12 @@ var chainPresets = [
413
582
  ),
414
583
  inputs: [
415
584
  {
416
- type: import_chunk_JHKEVE65.ChainInputType.SCHEMA,
585
+ type: import_chunk_SUMUWFZA.ChainInputType.SCHEMA,
417
586
  name: "schema",
418
587
  value: "example.com/type/project"
419
588
  },
420
589
  {
421
- type: import_chunk_JHKEVE65.ChainInputType.PASS_THROUGH,
590
+ type: import_chunk_SUMUWFZA.ChainInputType.PASS_THROUGH,
422
591
  name: "question"
423
592
  }
424
593
  ]
@@ -427,7 +596,7 @@ var chainPresets = [
427
596
  {
428
597
  id: "dxos.org/prompt/base",
429
598
  title: "RAG",
430
- createPrompt: () => (0, import_echo_schema.create)(import_chunk_JHKEVE65.ChainPromptType, {
599
+ createPrompt: () => (0, import_echo_schema.create)(import_chunk_SUMUWFZA.ChainPromptType, {
431
600
  command: "rag",
432
601
  template: str(
433
602
  // prettier-ignore
@@ -442,11 +611,11 @@ var chainPresets = [
442
611
  ),
443
612
  inputs: [
444
613
  {
445
- type: import_chunk_JHKEVE65.ChainInputType.RETRIEVER,
614
+ type: import_chunk_SUMUWFZA.ChainInputType.RETRIEVER,
446
615
  name: "context"
447
616
  },
448
617
  {
449
- type: import_chunk_JHKEVE65.ChainInputType.CONTEXT,
618
+ type: import_chunk_SUMUWFZA.ChainInputType.CONTEXT,
450
619
  name: "question",
451
620
  value: "object.text"
452
621
  }
@@ -456,7 +625,7 @@ var chainPresets = [
456
625
  {
457
626
  id: "dxos.org/prompt/lookup",
458
627
  title: "Lookup",
459
- createPrompt: () => (0, import_echo_schema.create)(import_chunk_JHKEVE65.ChainPromptType, {
628
+ createPrompt: () => (0, import_echo_schema.create)(import_chunk_SUMUWFZA.ChainPromptType, {
460
629
  command: "lookup",
461
630
  template: str(
462
631
  // prettier-ignore
@@ -468,7 +637,7 @@ var chainPresets = [
468
637
  ),
469
638
  inputs: [
470
639
  {
471
- type: import_chunk_JHKEVE65.ChainInputType.CONTEXT,
640
+ type: import_chunk_SUMUWFZA.ChainInputType.CONTEXT,
472
641
  name: "input",
473
642
  value: "text"
474
643
  }
@@ -478,7 +647,7 @@ var chainPresets = [
478
647
  {
479
648
  id: "dxos.org/prompt/extract",
480
649
  title: "Extract",
481
- createPrompt: () => (0, import_echo_schema.create)(import_chunk_JHKEVE65.ChainPromptType, {
650
+ createPrompt: () => (0, import_echo_schema.create)(import_chunk_SUMUWFZA.ChainPromptType, {
482
651
  command: "extract",
483
652
  template: str(
484
653
  // prettier-ignore
@@ -496,17 +665,17 @@ var chainPresets = [
496
665
  ),
497
666
  inputs: [
498
667
  {
499
- type: import_chunk_JHKEVE65.ChainInputType.SCHEMA,
668
+ type: import_chunk_SUMUWFZA.ChainInputType.SCHEMA,
500
669
  name: "contact",
501
670
  value: "example.com/type/contact"
502
671
  },
503
672
  {
504
- type: import_chunk_JHKEVE65.ChainInputType.SCHEMA,
673
+ type: import_chunk_SUMUWFZA.ChainInputType.SCHEMA,
505
674
  name: "company",
506
675
  value: "example.com/type/organization"
507
676
  },
508
677
  {
509
- type: import_chunk_JHKEVE65.ChainInputType.CONTEXT,
678
+ type: import_chunk_SUMUWFZA.ChainInputType.CONTEXT,
510
679
  name: "input",
511
680
  value: "text"
512
681
  }
@@ -516,7 +685,7 @@ var chainPresets = [
516
685
  {
517
686
  id: "dxos.org/prompt/discord",
518
687
  title: "Summarize",
519
- createPrompt: () => (0, import_echo_schema.create)(import_chunk_JHKEVE65.ChainPromptType, {
688
+ createPrompt: () => (0, import_echo_schema.create)(import_chunk_SUMUWFZA.ChainPromptType, {
520
689
  command: "summarize",
521
690
  template: str(
522
691
  // prettier-ignore
@@ -528,7 +697,7 @@ var chainPresets = [
528
697
  ),
529
698
  inputs: [
530
699
  {
531
- type: import_chunk_JHKEVE65.ChainInputType.RESOLVER,
700
+ type: import_chunk_SUMUWFZA.ChainInputType.RESOLVER,
532
701
  name: "context",
533
702
  value: "discord.messages.recent"
534
703
  }
@@ -539,7 +708,6 @@ var chainPresets = [
539
708
  var src_default = AutomationPlugin;
540
709
  // Annotate the CommonJS export names for ESM import in node:
541
710
  0 && (module.exports = {
542
- AssistantPanel,
543
711
  AutomationAction,
544
712
  AutomationPanel,
545
713
  AutomationPlugin,
@@ -547,6 +715,8 @@ var src_default = AutomationPlugin;
547
715
  ChainInputType,
548
716
  ChainPromptType,
549
717
  ChainType,
718
+ PromptEditor,
719
+ TriggerEditor,
550
720
  chainPresets,
551
721
  str
552
722
  });