@dxos/plugin-automation 0.7.5-main.9d2a38b → 0.7.5-main.e94eead

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 (169) hide show
  1. package/dist/lib/browser/AutomationPanel-ITYXSN5Z.mjs +132 -0
  2. package/dist/lib/browser/AutomationPanel-ITYXSN5Z.mjs.map +7 -0
  3. package/dist/lib/browser/{chunk-HKX3D3ZP.mjs → chunk-OFDNNRLE.mjs} +4 -7
  4. package/dist/lib/browser/{chunk-HKX3D3ZP.mjs.map → chunk-OFDNNRLE.mjs.map} +3 -3
  5. package/dist/lib/browser/chunk-U7QLNY2S.mjs +8 -0
  6. package/dist/lib/browser/chunk-U7QLNY2S.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-WY2C7JY4.mjs +119 -0
  8. package/dist/lib/browser/chunk-WY2C7JY4.mjs.map +7 -0
  9. package/dist/lib/browser/complementary-panel-4CPOJL4Y.mjs +56 -0
  10. package/dist/lib/browser/complementary-panel-4CPOJL4Y.mjs.map +7 -0
  11. package/dist/lib/browser/index.mjs +21 -313
  12. package/dist/lib/browser/index.mjs.map +4 -4
  13. package/dist/lib/browser/meta.json +1 -1
  14. package/dist/lib/browser/{react-surface-LL72F3F4.mjs → react-surface-SAPMN4PF.mjs} +4 -11
  15. package/dist/lib/browser/react-surface-SAPMN4PF.mjs.map +7 -0
  16. package/dist/lib/node/{AutomationPanel-PPODB5XA.cjs → AutomationPanel-X33HHDMQ.cjs} +19 -117
  17. package/dist/lib/node/AutomationPanel-X33HHDMQ.cjs.map +7 -0
  18. package/dist/lib/node/chunk-7Q5SNGCL.cjs +148 -0
  19. package/dist/lib/node/chunk-7Q5SNGCL.cjs.map +7 -0
  20. package/dist/lib/node/{chunk-25AQIF3L.cjs → chunk-CB5OB6JH.cjs} +5 -8
  21. package/dist/lib/node/chunk-CB5OB6JH.cjs.map +7 -0
  22. package/dist/lib/node/{chunk-5VF5JKUN.cjs → chunk-ORMEYEBE.cjs} +7 -10
  23. package/dist/lib/node/{chunk-5VF5JKUN.cjs.map → chunk-ORMEYEBE.cjs.map} +3 -3
  24. package/dist/lib/node/complementary-panel-ZYJJ42ZU.cjs +72 -0
  25. package/dist/lib/node/complementary-panel-ZYJJ42ZU.cjs.map +7 -0
  26. package/dist/lib/node/index.cjs +26 -318
  27. package/dist/lib/node/index.cjs.map +4 -4
  28. package/dist/lib/node/meta.json +1 -1
  29. package/dist/lib/node/{react-surface-DVAU4MGD.cjs → react-surface-2WRVAPGR.cjs} +9 -15
  30. package/dist/lib/node/react-surface-2WRVAPGR.cjs.map +7 -0
  31. package/dist/lib/node-esm/AutomationPanel-HY3GB4BT.mjs +133 -0
  32. package/dist/lib/node-esm/AutomationPanel-HY3GB4BT.mjs.map +7 -0
  33. package/dist/lib/node-esm/{chunk-X3LPRWIL.mjs → chunk-6MUUH67V.mjs} +4 -7
  34. package/dist/lib/node-esm/{chunk-X3LPRWIL.mjs.map → chunk-6MUUH67V.mjs.map} +3 -3
  35. package/dist/lib/node-esm/{chunk-XW7TEQA3.mjs → chunk-R3P2WPBQ.mjs} +2 -4
  36. package/dist/lib/node-esm/chunk-R3P2WPBQ.mjs.map +7 -0
  37. package/dist/lib/node-esm/chunk-UDD2VA6G.mjs +120 -0
  38. package/dist/lib/node-esm/chunk-UDD2VA6G.mjs.map +7 -0
  39. package/dist/lib/node-esm/complementary-panel-S42RIIAY.mjs +57 -0
  40. package/dist/lib/node-esm/complementary-panel-S42RIIAY.mjs.map +7 -0
  41. package/dist/lib/node-esm/index.mjs +21 -313
  42. package/dist/lib/node-esm/index.mjs.map +4 -4
  43. package/dist/lib/node-esm/meta.json +1 -1
  44. package/dist/lib/node-esm/{react-surface-4BED2PZ4.mjs → react-surface-QWLPOYXO.mjs} +4 -11
  45. package/dist/lib/node-esm/react-surface-QWLPOYXO.mjs.map +7 -0
  46. package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
  47. package/dist/types/src/capabilities/complementary-panel.d.ts +4 -0
  48. package/dist/types/src/capabilities/complementary-panel.d.ts.map +1 -0
  49. package/dist/types/src/capabilities/index.d.ts +2 -178
  50. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  51. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  52. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +1 -2
  53. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
  54. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
  55. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +1 -2
  56. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
  57. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
  58. package/dist/types/src/components/index.d.ts +2 -2
  59. package/dist/types/src/components/index.d.ts.map +1 -1
  60. package/dist/types/src/index.d.ts +1 -3
  61. package/dist/types/src/index.d.ts.map +1 -1
  62. package/dist/types/src/meta.d.ts +0 -1
  63. package/dist/types/src/meta.d.ts.map +1 -1
  64. package/dist/types/src/testing/index.d.ts +1 -1
  65. package/dist/types/src/testing/index.d.ts.map +1 -1
  66. package/dist/types/src/testing/{testing.d.ts → test-functions.d.ts} +1 -1
  67. package/dist/types/src/testing/test-functions.d.ts.map +1 -0
  68. package/dist/types/src/translations.d.ts +2 -20
  69. package/dist/types/src/translations.d.ts.map +1 -1
  70. package/package.json +23 -57
  71. package/src/AutomationPlugin.tsx +10 -42
  72. package/src/capabilities/complementary-panel.ts +56 -0
  73. package/src/capabilities/index.ts +1 -1
  74. package/src/capabilities/react-surface.tsx +1 -6
  75. package/src/components/AutomationPanel/AutomationPanel.stories.tsx +1 -2
  76. package/src/components/AutomationPanel/AutomationPanel.tsx +56 -49
  77. package/src/components/TriggerEditor/TriggerEditor.stories.tsx +1 -2
  78. package/src/components/TriggerEditor/TriggerEditor.tsx +25 -18
  79. package/src/components/index.ts +2 -1
  80. package/src/index.ts +2 -3
  81. package/src/meta.ts +3 -3
  82. package/src/testing/index.ts +1 -1
  83. package/src/testing/{testing.ts → test-functions.ts} +2 -2
  84. package/src/translations.ts +2 -23
  85. package/dist/lib/browser/AssistantPanel-N276BTPV.mjs +0 -339
  86. package/dist/lib/browser/AssistantPanel-N276BTPV.mjs.map +0 -7
  87. package/dist/lib/browser/AutomationPanel-IHZ4JKVS.mjs +0 -232
  88. package/dist/lib/browser/AutomationPanel-IHZ4JKVS.mjs.map +0 -7
  89. package/dist/lib/browser/app-graph-builder-IJTTULDP.mjs +0 -131
  90. package/dist/lib/browser/app-graph-builder-IJTTULDP.mjs.map +0 -7
  91. package/dist/lib/browser/chunk-4AIMDHKY.mjs +0 -10
  92. package/dist/lib/browser/chunk-4AIMDHKY.mjs.map +0 -7
  93. package/dist/lib/browser/chunk-DL6LB2NI.mjs +0 -43
  94. package/dist/lib/browser/chunk-DL6LB2NI.mjs.map +0 -7
  95. package/dist/lib/browser/react-surface-LL72F3F4.mjs.map +0 -7
  96. package/dist/lib/browser/types/index.mjs +0 -13
  97. package/dist/lib/browser/types/index.mjs.map +0 -7
  98. package/dist/lib/node/AssistantPanel-Z4GVHUF3.cjs +0 -359
  99. package/dist/lib/node/AssistantPanel-Z4GVHUF3.cjs.map +0 -7
  100. package/dist/lib/node/AutomationPanel-PPODB5XA.cjs.map +0 -7
  101. package/dist/lib/node/app-graph-builder-MF5M4QRS.cjs +0 -147
  102. package/dist/lib/node/app-graph-builder-MF5M4QRS.cjs.map +0 -7
  103. package/dist/lib/node/chunk-25AQIF3L.cjs.map +0 -7
  104. package/dist/lib/node/chunk-JNDMZQH7.cjs +0 -68
  105. package/dist/lib/node/chunk-JNDMZQH7.cjs.map +0 -7
  106. package/dist/lib/node/react-surface-DVAU4MGD.cjs.map +0 -7
  107. package/dist/lib/node/types/index.cjs +0 -35
  108. package/dist/lib/node/types/index.cjs.map +0 -7
  109. package/dist/lib/node-esm/AssistantPanel-DDCQHBJX.mjs +0 -340
  110. package/dist/lib/node-esm/AssistantPanel-DDCQHBJX.mjs.map +0 -7
  111. package/dist/lib/node-esm/AutomationPanel-R3D6CRF5.mjs +0 -233
  112. package/dist/lib/node-esm/AutomationPanel-R3D6CRF5.mjs.map +0 -7
  113. package/dist/lib/node-esm/app-graph-builder-5N7OK23B.mjs +0 -132
  114. package/dist/lib/node-esm/app-graph-builder-5N7OK23B.mjs.map +0 -7
  115. package/dist/lib/node-esm/chunk-GIAYUM5I.mjs +0 -45
  116. package/dist/lib/node-esm/chunk-GIAYUM5I.mjs.map +0 -7
  117. package/dist/lib/node-esm/chunk-XW7TEQA3.mjs.map +0 -7
  118. package/dist/lib/node-esm/react-surface-4BED2PZ4.mjs.map +0 -7
  119. package/dist/lib/node-esm/types/index.mjs +0 -14
  120. package/dist/lib/node-esm/types/index.mjs.map +0 -7
  121. package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -180
  122. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  123. package/dist/types/src/components/AssistantPanel/AssistantPanel.d.ts +0 -8
  124. package/dist/types/src/components/AssistantPanel/AssistantPanel.d.ts.map +0 -1
  125. package/dist/types/src/components/AssistantPanel/index.d.ts +0 -3
  126. package/dist/types/src/components/AssistantPanel/index.d.ts.map +0 -1
  127. package/dist/types/src/components/AssistantPanel/system-instructions.d.ts +0 -6
  128. package/dist/types/src/components/AssistantPanel/system-instructions.d.ts.map +0 -1
  129. package/dist/types/src/components/PromptEditor/PromptEditor.d.ts +0 -10
  130. package/dist/types/src/components/PromptEditor/PromptEditor.d.ts.map +0 -1
  131. package/dist/types/src/components/PromptEditor/PromptEditor.stories.d.ts +0 -6
  132. package/dist/types/src/components/PromptEditor/PromptEditor.stories.d.ts.map +0 -1
  133. package/dist/types/src/components/PromptEditor/index.d.ts +0 -2
  134. package/dist/types/src/components/PromptEditor/index.d.ts.map +0 -1
  135. package/dist/types/src/components/PromptEditor/prompt-extension.d.ts +0 -4
  136. package/dist/types/src/components/PromptEditor/prompt-extension.d.ts.map +0 -1
  137. package/dist/types/src/components/PromptEditor/types.d.ts +0 -18
  138. package/dist/types/src/components/PromptEditor/types.d.ts.map +0 -1
  139. package/dist/types/src/hooks/email.d.ts +0 -4
  140. package/dist/types/src/hooks/email.d.ts.map +0 -1
  141. package/dist/types/src/hooks/index.d.ts +0 -2
  142. package/dist/types/src/hooks/index.d.ts.map +0 -1
  143. package/dist/types/src/hooks/invocation-handler.d.ts +0 -5
  144. package/dist/types/src/hooks/invocation-handler.d.ts.map +0 -1
  145. package/dist/types/src/hooks/useLocalTriggerManager.d.ts +0 -3
  146. package/dist/types/src/hooks/useLocalTriggerManager.d.ts.map +0 -1
  147. package/dist/types/src/presets.d.ts +0 -9
  148. package/dist/types/src/presets.d.ts.map +0 -1
  149. package/dist/types/src/testing/testing.d.ts.map +0 -1
  150. package/dist/types/src/types/index.d.ts +0 -2
  151. package/dist/types/src/types/index.d.ts.map +0 -1
  152. package/dist/types/src/types/schema.d.ts +0 -63
  153. package/dist/types/src/types/schema.d.ts.map +0 -1
  154. package/src/capabilities/app-graph-builder.ts +0 -127
  155. package/src/components/AssistantPanel/AssistantPanel.tsx +0 -230
  156. package/src/components/AssistantPanel/index.ts +0 -7
  157. package/src/components/AssistantPanel/system-instructions.ts +0 -166
  158. package/src/components/PromptEditor/PromptEditor.stories.tsx +0 -64
  159. package/src/components/PromptEditor/PromptEditor.tsx +0 -222
  160. package/src/components/PromptEditor/index.ts +0 -5
  161. package/src/components/PromptEditor/prompt-extension.ts +0 -43
  162. package/src/components/PromptEditor/types.tsx +0 -28
  163. package/src/hooks/email.ts +0 -49
  164. package/src/hooks/index.ts +0 -5
  165. package/src/hooks/invocation-handler.ts +0 -109
  166. package/src/hooks/useLocalTriggerManager.ts +0 -82
  167. package/src/presets.ts +0 -248
  168. package/src/types/index.ts +0 -5
  169. package/src/types/schema.ts +0 -38
@@ -7,16 +7,11 @@ import React from 'react';
7
7
  import { Capabilities, contributes, createSurface } from '@dxos/app-framework';
8
8
  import { getSpace, isEchoObject, type ReactiveEchoObject } from '@dxos/react-client/echo';
9
9
 
10
- import { AssistantPanel, AutomationPanel } from '../components';
10
+ import { AutomationPanel } from '../components';
11
11
  import { AUTOMATION_PLUGIN } from '../meta';
12
12
 
13
13
  export default () =>
14
14
  contributes(Capabilities.ReactSurface, [
15
- createSurface({
16
- id: `${AUTOMATION_PLUGIN}/assistant`,
17
- role: 'complementary--assistant',
18
- component: ({ data }) => <AssistantPanel subject={data.subject} />,
19
- }),
20
15
  createSurface({
21
16
  id: `${AUTOMATION_PLUGIN}/automation`,
22
17
  role: 'complementary--automation',
@@ -15,7 +15,6 @@ import { withLayout, withTheme } from '@dxos/storybook-utils';
15
15
  import { AutomationPanel } from './AutomationPanel';
16
16
  import { functions } from '../../testing';
17
17
  import translations from '../../translations';
18
- import { ChainPromptType } from '../../types';
19
18
 
20
19
  const DefaultStory = () => {
21
20
  const spaces = useSpaces();
@@ -36,7 +35,7 @@ const meta: Meta = {
36
35
  withClientProvider({
37
36
  createIdentity: true,
38
37
  createSpace: true,
39
- types: [FunctionType, FunctionTrigger, ChainPromptType],
38
+ types: [FunctionType, FunctionTrigger],
40
39
  onSpaceCreated: ({ space }) => {
41
40
  for (const fn of functions) {
42
41
  space.db.add(create(FunctionType, fn));
@@ -15,7 +15,7 @@ import {
15
15
  } from '@dxos/functions';
16
16
  import { type Client, useClient } from '@dxos/react-client';
17
17
  import { create, Filter, useQuery, type Space, type ReactiveObject, getSpace } from '@dxos/react-client/echo';
18
- import { IconButton, Input, useTranslation, Button } from '@dxos/react-ui';
18
+ import { Clipboard, IconButton, Input, useTranslation } from '@dxos/react-ui';
19
19
  import { List } from '@dxos/react-ui-list';
20
20
  import { ghostHover, mx } from '@dxos/react-ui-theme';
21
21
 
@@ -73,57 +73,62 @@ export const AutomationPanel = ({ space, object }: AutomationPanelProps) => {
73
73
  };
74
74
 
75
75
  return (
76
- <div className='flex flex-col w-full divide-y divide-separator overflow-y-auto'>
77
- <List.Root<FunctionTrigger> items={triggers} isItem={S.is(FunctionTrigger)} getId={(field) => field.id}>
78
- {({ items: triggers }) => (
79
- <div role='list' className='flex flex-col w-full'>
80
- {triggers?.map((trigger) => {
81
- const copyAction = getCopyAction(client, trigger);
82
- return (
83
- <List.Item<FunctionTrigger>
84
- key={trigger.id}
85
- item={trigger}
86
- classNames={mx(grid, ghostHover, 'items-center', 'px-2')}
87
- >
88
- <Input.Root>
89
- <Input.Switch
90
- checked={trigger.enabled}
91
- onCheckedChange={(checked) => (trigger.enabled = checked)}
92
- />
93
- </Input.Root>
94
-
95
- <div className={'flex'}>
96
- <List.ItemTitle
97
- classNames='px-1 cursor-pointer w-0 shrink truncate'
98
- onClick={() => handleSelect(trigger)}
76
+ <Clipboard.Provider>
77
+ <div className='flex flex-col w-full'>
78
+ {!trigger && (
79
+ <List.Root<FunctionTrigger> items={triggers} isItem={S.is(FunctionTrigger)} getId={(field) => field.id}>
80
+ {({ items: triggers }) => (
81
+ <div role='list' className='flex flex-col w-full'>
82
+ {triggers?.map((trigger) => {
83
+ const copyAction = getCopyAction(client, trigger);
84
+ return (
85
+ <List.Item<FunctionTrigger>
86
+ key={trigger.id}
87
+ item={trigger}
88
+ classNames={mx(grid, ghostHover, 'items-center', 'px-2')}
99
89
  >
100
- {getFunctionName(scripts, functions, trigger) ?? '∅'}
101
- </List.ItemTitle>
102
-
103
- {/* TODO: a better way to expose copy action */}
104
- {copyAction && (
105
- <Button onClick={() => navigator.clipboard.writeText(copyAction.contentProvider())}>
106
- {t(copyAction.translationKey)}
107
- </Button>
108
- )}
109
- </div>
110
-
111
- <List.ItemDeleteButton onClick={() => handleDelete(trigger)} />
112
- </List.Item>
113
- );
114
- })}
115
- </div>
90
+ <Input.Root>
91
+ <Input.Switch
92
+ checked={trigger.enabled}
93
+ onCheckedChange={(checked) => (trigger.enabled = checked)}
94
+ />
95
+ </Input.Root>
96
+
97
+ <div className={'flex'}>
98
+ <List.ItemTitle
99
+ classNames='px-1 cursor-pointer w-0 shrink truncate'
100
+ onClick={() => handleSelect(trigger)}
101
+ >
102
+ {getFunctionName(scripts, functions, trigger) ?? '∅'}
103
+ </List.ItemTitle>
104
+
105
+ {/* TODO: a better way to expose copy action */}
106
+ {copyAction && (
107
+ <Clipboard.IconButton
108
+ label={t(copyAction.translationKey)}
109
+ value={copyAction.contentProvider()}
110
+ />
111
+ )}
112
+ </div>
113
+
114
+ <List.ItemDeleteButton onClick={() => handleDelete(trigger)} />
115
+ </List.Item>
116
+ );
117
+ })}
118
+ </div>
119
+ )}
120
+ </List.Root>
116
121
  )}
117
- </List.Root>
118
122
 
119
- {trigger && <TriggerEditor space={space} trigger={trigger} onSave={handleSave} onCancel={handleCancel} />}
123
+ {trigger && <TriggerEditor space={space} trigger={trigger} onSave={handleSave} onCancel={handleCancel} />}
120
124
 
121
- {!trigger && (
122
- <div className='flex p-2 justify-center'>
123
- <IconButton icon='ph--plus--regular' label={t('new trigger')} onClick={handleAdd} />
124
- </div>
125
- )}
126
- </div>
125
+ {!trigger && (
126
+ <div className='flex p-2 justify-center'>
127
+ <IconButton icon='ph--plus--regular' label={t('new trigger label')} onClick={handleAdd} />
128
+ </div>
129
+ )}
130
+ </div>
131
+ </Clipboard.Provider>
127
132
  );
128
133
  };
129
134
 
@@ -148,8 +153,10 @@ const getWebhookUrl = (client: Client, trigger: FunctionTrigger) => {
148
153
  };
149
154
 
150
155
  const getFunctionName = (scripts: ScriptType[], functions: FunctionType[], trigger: FunctionTriggerType) => {
156
+ // TODO(wittjosiah): Truncation should be done in the UI.
157
+ // Warning that the List component is currently a can of worms.
151
158
  const shortId = trigger.function && `${trigger.function?.slice(0, 16)}…`;
152
- const functionObject = functions.find((fn) => fn.name === trigger.function);
159
+ const functionObject = functions.find((fn) => `dxn:worker:${fn.name}` === trigger.function);
153
160
  if (!functionObject) {
154
161
  return shortId;
155
162
  }
@@ -16,7 +16,6 @@ import { withLayout, withTheme } from '@dxos/storybook-utils';
16
16
  import { TriggerEditor } from './TriggerEditor';
17
17
  import { functions } from '../../testing';
18
18
  import translations from '../../translations';
19
- import { ChainPromptType } from '../../types';
20
19
 
21
20
  const DefaultStory = () => {
22
21
  const spaces = useSpaces();
@@ -50,7 +49,7 @@ const meta: Meta = {
50
49
  withClientProvider({
51
50
  createIdentity: true,
52
51
  createSpace: true,
53
- types: [FunctionType, FunctionTrigger, ChainPromptType],
52
+ types: [FunctionType, FunctionTrigger],
54
53
  onSpaceCreated: ({ space }) => {
55
54
  for (const fn of functions) {
56
55
  space.db.add(create(FunctionType, fn));
@@ -2,8 +2,9 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import React, { useState } from 'react';
5
+ import React, { useEffect, useState } from 'react';
6
6
 
7
+ import { ComputeGraph } from '@dxos/conductor';
7
8
  import {
8
9
  FunctionType,
9
10
  FunctionTriggerSchema,
@@ -29,6 +30,7 @@ export const TriggerEditor = ({ space, trigger, onSave, onCancel }: TriggerEdito
29
30
  const { t } = useTranslation(AUTOMATION_PLUGIN);
30
31
 
31
32
  const functions = useQuery(space, Filter.schema(FunctionType));
33
+ const workflows = useQuery(space, Filter.schema(ComputeGraph));
32
34
  const scripts = useQuery(space, Filter.schema(ScriptType));
33
35
 
34
36
  const handleSave = (values: FunctionTriggerType) => {
@@ -43,16 +45,13 @@ export const TriggerEditor = ({ space, trigger, onSave, onCancel }: TriggerEdito
43
45
  onCancel={onCancel}
44
46
  Custom={{
45
47
  ['function' satisfies keyof FunctionTriggerType]: (props) => (
46
- <SelectInput<FunctionTriggerType>
48
+ <SelectInput
47
49
  {...props}
48
- options={functions.map((fn) => ({
49
- value: fn.name,
50
- label: getFunctionName(scripts, fn),
51
- }))}
50
+ options={getWorkflowOptions(workflows).concat(getFunctionOptions(scripts, functions))}
52
51
  />
53
52
  ),
54
53
  ['spec.type' as const]: (props) => (
55
- <SelectInput<FunctionTriggerType>
54
+ <SelectInput
56
55
  {...props}
57
56
  options={Object.values(TriggerKind).map((kind) => ({
58
57
  value: kind,
@@ -61,12 +60,10 @@ export const TriggerEditor = ({ space, trigger, onSave, onCancel }: TriggerEdito
61
60
  />
62
61
  ),
63
62
  ['meta' as const]: (props) => {
64
- const meta = props.getValue('meta')!;
65
-
63
+ const meta = props.getValue()!;
64
+ useEffect(() => props.onValueChange('object', { ...meta }), []);
66
65
  const [newMetaFieldName, setNewMetaFieldName] = useState('');
67
66
 
68
- React.useEffect(() => props.onValueChange('meta', 'object', { ...meta }), []);
69
-
70
67
  return (
71
68
  <>
72
69
  <div>{props.label}</div>
@@ -75,7 +72,12 @@ export const TriggerEditor = ({ space, trigger, onSave, onCancel }: TriggerEdito
75
72
  return (
76
73
  <div key={compositeKey} role='none' className='flex items-center mt-2 gap-1'>
77
74
  <div role='none' className='flex-1'>
78
- <TextInput {...props} property={compositeKey} type={'string'} label={key} />
75
+ <TextInput
76
+ {...props}
77
+ getValue={() => (props.getValue() as any)[key]}
78
+ type={'string'}
79
+ label={key}
80
+ />
79
81
  </div>
80
82
  <IconButton
81
83
  icon='ph--trash--regular'
@@ -83,9 +85,9 @@ export const TriggerEditor = ({ space, trigger, onSave, onCancel }: TriggerEdito
83
85
  classNames={'mt-6'}
84
86
  label={t('trigger meta remove')}
85
87
  onClick={() => {
86
- const newValues: any = { ...props.getValue('meta') };
88
+ const newValues: any = { ...props.getValue() };
87
89
  delete newValues[key];
88
- props.onValueChange('meta', 'object', newValues);
90
+ props.onValueChange('object', newValues);
89
91
  }}
90
92
  />
91
93
  </div>
@@ -107,10 +109,10 @@ export const TriggerEditor = ({ space, trigger, onSave, onCancel }: TriggerEdito
107
109
  label={t('trigger meta add')}
108
110
  onClick={() => {
109
111
  if (newMetaFieldName.length) {
110
- const meta = props.getValue('meta') ?? {};
112
+ const meta = props.getValue() ?? {};
111
113
  const metaWithNewProp = { ...meta, [newMetaFieldName]: '' };
112
114
  setNewMetaFieldName('');
113
- props.onValueChange('meta', 'object', metaWithNewProp);
115
+ props.onValueChange('object', metaWithNewProp);
114
116
  }
115
117
  }}
116
118
  />
@@ -123,6 +125,11 @@ export const TriggerEditor = ({ space, trigger, onSave, onCancel }: TriggerEdito
123
125
  );
124
126
  };
125
127
 
126
- const getFunctionName = (scripts: ScriptType[], fn: FunctionType) => {
127
- return scripts.find((s) => fn.source?.target?.id === s.id)?.name ?? fn.name;
128
+ const getWorkflowOptions = (graphs: ComputeGraph[]) => {
129
+ return graphs.map((graph) => ({ label: `compute-${graph.id}`, value: `dxn:echo:@:${graph.id}` }));
130
+ };
131
+
132
+ const getFunctionOptions = (scripts: ScriptType[], functions: FunctionType[]) => {
133
+ const getLabel = (fn: FunctionType) => scripts.find((s) => fn.source?.target?.id === s.id)?.name ?? fn.name;
134
+ return functions.map((fn) => ({ label: getLabel(fn), value: `dxn:worker:${fn.name}` }));
128
135
  };
@@ -4,5 +4,6 @@
4
4
 
5
5
  import { lazy } from 'react';
6
6
 
7
- export const AssistantPanel = lazy(() => import('./AssistantPanel'));
7
+ export * from './TriggerEditor';
8
+
8
9
  export const AutomationPanel = lazy(() => import('./AutomationPanel'));
package/src/index.ts CHANGED
@@ -2,8 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- export * from './AutomationPlugin';
6
5
  export * from './components';
7
6
  export * from './meta';
8
- export * from './presets';
9
- export * from './types';
7
+
8
+ export * from './AutomationPlugin';
package/src/meta.ts CHANGED
@@ -9,8 +9,8 @@ export const AUTOMATION_PLUGIN = 'dxos.org/plugin/automation';
9
9
  export const meta = {
10
10
  id: AUTOMATION_PLUGIN,
11
11
  name: 'Automation',
12
- description: 'Automation workflows.',
13
- icon: 'ph--magic-wand--regular',
12
+ description:
13
+ 'The Automation tab allows you to trigger pre-defined workflows related to the element you are interacting with inside of Composer.',
14
+ icon: 'ph--robot--regular',
14
15
  source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/experimental/plugin-automation',
15
- tags: ['experimental'],
16
16
  } satisfies PluginMeta;
@@ -2,4 +2,4 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- export * from './testing';
5
+ export * from './test-functions';
@@ -7,7 +7,7 @@ import { AST, S, toJsonSchema } from '@dxos/echo-schema';
7
7
  export const functions = [
8
8
  {
9
9
  name: 'example.com/function/chess',
10
- version: '0.0.1',
10
+ version: '0.1.0',
11
11
  inputSchema: toJsonSchema(
12
12
  S.Struct({
13
13
  level: S.Number.annotations({
@@ -18,7 +18,7 @@ export const functions = [
18
18
  },
19
19
  {
20
20
  name: 'example.com/function/forex',
21
- version: '0.0.1',
21
+ version: '0.1.0',
22
22
  binding: 'FOREX',
23
23
  inputSchema: toJsonSchema(
24
24
  S.Struct({
@@ -9,33 +9,15 @@ export default [
9
9
  'en-US': {
10
10
  [AUTOMATION_PLUGIN]: {
11
11
  'plugin name': 'Automation',
12
- 'object placeholder': 'New prompt',
13
- 'create object label': 'Create prompt',
14
- 'create trigger label': 'Create trigger',
15
- 'create stack section label': 'Create prompt',
16
- 'command placeholder': 'Enter slash command...',
17
- 'template placeholder': 'Enter template...',
18
- 'value placeholder': 'Enter value...',
19
- 'select preset template placeholder': 'Select preset',
20
- 'open automation panel label': 'Show Automations',
21
12
  'automation panel label': 'Automations',
22
13
 
23
- 'function select label': 'Function',
24
- 'function select placeholder': 'Select function',
25
- 'function enabled': 'Enabled',
26
- 'trigger select label': 'Trigger',
27
- 'trigger select placeholder': 'Trigger type',
28
-
14
+ 'new trigger label': 'New Trigger',
29
15
  'trigger type timer': 'Timer',
30
16
  'trigger type webhook': 'Webhook',
31
17
  'trigger type websocket': 'Websocket',
32
18
  'trigger type subscription': 'Subscription',
33
19
  'trigger type email': 'Email',
34
-
35
- 'trigger filter': 'Filter',
36
- 'trigger cron': 'Cron',
37
- 'trigger method': 'Method',
38
- 'trigger endpoint': 'Endpoint',
20
+ 'trigger type queue': 'Queue',
39
21
 
40
22
  'trigger copy url': 'Copy URL',
41
23
  'trigger copy email': 'Copy Email',
@@ -43,9 +25,6 @@ export default [
43
25
  'trigger meta add': 'Add',
44
26
  'trigger meta remove': 'Remove',
45
27
  'trigger meta prop name placeholder': 'New meta property name',
46
-
47
- 'open assistant panel label': 'Show Assistant',
48
- 'assistant panel label': 'Assistant',
49
28
  },
50
29
  },
51
30
  },