@dxos/plugin-automation 0.7.5-main.9d26e3a → 0.7.5-main.e9bb01b
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-32FH2RA6.mjs → AssistantPanel-NTOUHOWA.mjs} +3 -3
- package/dist/lib/browser/{AssistantPanel-32FH2RA6.mjs.map → AssistantPanel-NTOUHOWA.mjs.map} +2 -2
- package/dist/lib/browser/AutomationPanel-KT3YFV56.mjs +231 -0
- package/dist/lib/browser/AutomationPanel-KT3YFV56.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-6FSMLMT4.mjs +131 -0
- package/dist/lib/browser/app-graph-builder-6FSMLMT4.mjs.map +7 -0
- package/dist/lib/browser/chunk-4ODBJDXM.mjs +10 -0
- package/dist/lib/browser/chunk-4ODBJDXM.mjs.map +7 -0
- package/dist/lib/browser/{chunk-DN5M2QL5.mjs → chunk-DL6LB2NI.mjs} +2 -8
- package/dist/lib/browser/{chunk-DN5M2QL5.mjs.map → chunk-DL6LB2NI.mjs.map} +4 -4
- package/dist/lib/browser/{chunk-X5KMOH3I.mjs → chunk-DQ7ZSYJJ.mjs} +4 -4
- package/dist/lib/browser/chunk-DQ7ZSYJJ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +89 -236
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-5YTE5MRE.mjs +34 -0
- package/dist/lib/browser/react-surface-5YTE5MRE.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +1 -3
- package/dist/lib/node/{AssistantPanel-XANI7YNV.cjs → AssistantPanel-U7GDWPRC.cjs} +7 -7
- package/dist/lib/node/{AssistantPanel-XANI7YNV.cjs.map → AssistantPanel-U7GDWPRC.cjs.map} +2 -2
- package/dist/lib/node/{AutomationPanel-VADY3HMP.cjs → AutomationPanel-H5WE4FIU.cjs} +112 -32
- package/dist/lib/node/AutomationPanel-H5WE4FIU.cjs.map +7 -0
- package/dist/lib/node/app-graph-builder-65TBXO3I.cjs +147 -0
- package/dist/lib/node/app-graph-builder-65TBXO3I.cjs.map +7 -0
- package/dist/lib/node/{chunk-NIL4TP6U.cjs → chunk-JNDMZQH7.cjs} +4 -9
- package/dist/lib/node/chunk-JNDMZQH7.cjs.map +7 -0
- package/dist/lib/node/chunk-JUSXT4U5.cjs +43 -0
- package/dist/lib/node/chunk-JUSXT4U5.cjs.map +7 -0
- package/dist/lib/node/{chunk-DTJ7XVO2.cjs → chunk-TQEDPRY5.cjs} +8 -8
- package/dist/lib/node/chunk-TQEDPRY5.cjs.map +7 -0
- package/dist/lib/node/index.cjs +112 -258
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/react-surface-S6U5ISJ6.cjs +57 -0
- package/dist/lib/node/react-surface-S6U5ISJ6.cjs.map +7 -0
- package/dist/lib/node/types/index.cjs +5 -7
- package/dist/lib/node/types/index.cjs.map +2 -2
- package/dist/lib/node-esm/{AssistantPanel-5M6O6JV7.mjs → AssistantPanel-M67P24GS.mjs} +3 -3
- package/dist/lib/node-esm/{AssistantPanel-5M6O6JV7.mjs.map → AssistantPanel-M67P24GS.mjs.map} +2 -2
- package/dist/lib/node-esm/AutomationPanel-MW42U6I4.mjs +232 -0
- package/dist/lib/node-esm/AutomationPanel-MW42U6I4.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-4SD4F3KN.mjs +132 -0
- package/dist/lib/node-esm/app-graph-builder-4SD4F3KN.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-GCHXTXVT.mjs → chunk-GIAYUM5I.mjs} +2 -8
- package/dist/lib/node-esm/{chunk-GCHXTXVT.mjs.map → chunk-GIAYUM5I.mjs.map} +4 -4
- package/dist/lib/node-esm/{chunk-HNOBZHWK.mjs → chunk-JFHI22MF.mjs} +4 -4
- package/dist/lib/node-esm/chunk-JFHI22MF.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-XVIEXSEZ.mjs +12 -0
- package/dist/lib/node-esm/chunk-XVIEXSEZ.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +89 -236
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-RWTR3TKT.mjs +35 -0
- package/dist/lib/node-esm/react-surface-RWTR3TKT.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +1 -3
- package/dist/types/src/AutomationPlugin.d.ts +1 -3
- package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +180 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +179 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +4 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +1 -2
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +7 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +0 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +38 -46
- package/src/AutomationPlugin.tsx +55 -193
- package/src/capabilities/app-graph-builder.ts +127 -0
- package/src/capabilities/index.ts +8 -0
- package/src/capabilities/react-surface.tsx +27 -0
- package/src/components/AssistantPanel/AssistantPanel.tsx +1 -4
- package/src/components/AutomationPanel/AutomationPanel.tsx +54 -37
- package/src/components/TriggerEditor/TriggerEditor.tsx +65 -8
- package/src/index.ts +1 -4
- package/src/meta.ts +3 -2
- package/src/translations.ts +9 -0
- package/src/types/index.ts +0 -1
- package/dist/lib/browser/AutomationPanel-ABGPG5LE.mjs +0 -151
- package/dist/lib/browser/AutomationPanel-ABGPG5LE.mjs.map +0 -7
- package/dist/lib/browser/chunk-X5KMOH3I.mjs.map +0 -7
- package/dist/lib/browser/meta.mjs +0 -9
- package/dist/lib/browser/meta.mjs.map +0 -7
- package/dist/lib/node/AutomationPanel-VADY3HMP.cjs.map +0 -7
- package/dist/lib/node/chunk-DTJ7XVO2.cjs.map +0 -7
- package/dist/lib/node/chunk-NIL4TP6U.cjs.map +0 -7
- package/dist/lib/node/meta.cjs +0 -30
- package/dist/lib/node/meta.cjs.map +0 -7
- package/dist/lib/node-esm/AutomationPanel-EETYIDPA.mjs +0 -152
- package/dist/lib/node-esm/AutomationPanel-EETYIDPA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HNOBZHWK.mjs.map +0 -7
- package/dist/lib/node-esm/meta.mjs +0 -10
- package/dist/lib/node-esm/meta.mjs.map +0 -7
- package/dist/types/src/types/types.d.ts +0 -7
- package/dist/types/src/types/types.d.ts.map +0 -1
- package/src/types/types.ts +0 -27
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/plugins/experimental/plugin-automation/src/components/AssistantPanel/system-instructions.ts":{"bytes":16049,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/meta.ts":{"bytes":1626,"imports":[],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/components/AssistantPanel/AssistantPanel.tsx":{"bytes":28000,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/assistant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/react-client","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-syntax-highlighter","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-automation/src/components/AssistantPanel/system-instructions.ts","kind":"import-statement","original":"./system-instructions"},{"path":"packages/plugins/experimental/plugin-automation/src/meta.ts","kind":"import-statement","original":"../../meta"}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/components/AssistantPanel/index.ts":{"bytes":739,"imports":[{"path":"packages/plugins/experimental/plugin-automation/src/components/AssistantPanel/AssistantPanel.tsx","kind":"import-statement","original":"./AssistantPanel"}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/components/TriggerEditor/TriggerEditor.tsx":{"bytes":7128,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-form","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-automation/src/meta.ts","kind":"import-statement","original":"../../meta"}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/components/TriggerEditor/index.ts":{"bytes":557,"imports":[{"path":"packages/plugins/experimental/plugin-automation/src/components/TriggerEditor/TriggerEditor.tsx","kind":"import-statement","original":"./TriggerEditor"}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/components/AutomationPanel/AutomationPanel.tsx":{"bytes":16783,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/react-client","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-list","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-automation/src/meta.ts","kind":"import-statement","original":"../../meta"},{"path":"packages/plugins/experimental/plugin-automation/src/components/TriggerEditor/index.ts","kind":"import-statement","original":"../TriggerEditor"}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/components/AutomationPanel/index.ts":{"bytes":751,"imports":[{"path":"packages/plugins/experimental/plugin-automation/src/components/AutomationPanel/AutomationPanel.tsx","kind":"import-statement","original":"./AutomationPanel"}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/components/index.ts":{"bytes":1078,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-automation/src/components/AssistantPanel/index.ts","kind":"dynamic-import","original":"./AssistantPanel"},{"path":"packages/plugins/experimental/plugin-automation/src/components/AutomationPanel/index.ts","kind":"dynamic-import","original":"./AutomationPanel"}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/translations.ts":{"bytes":4459,"imports":[{"path":"packages/plugins/experimental/plugin-automation/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/types/schema.ts":{"bytes":4248,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/types/types.ts":{"bytes":1464,"imports":[],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/types/index.ts":{"bytes":604,"imports":[{"path":"packages/plugins/experimental/plugin-automation/src/types/schema.ts","kind":"import-statement","original":"./schema"},{"path":"packages/plugins/experimental/plugin-automation/src/types/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/AutomationPlugin.tsx":{"bytes":29041,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/plugin-client/types","kind":"import-statement","external":true},{"path":"@dxos/plugin-graph","kind":"import-statement","external":true},{"path":"@dxos/plugin-space","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui-form","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-automation/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/plugins/experimental/plugin-automation/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/experimental/plugin-automation/src/translations.ts","kind":"import-statement","original":"./translations"},{"path":"packages/plugins/experimental/plugin-automation/src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/presets.ts":{"bytes":19268,"imports":[{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-automation/src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/index.ts":{"bytes":1109,"imports":[{"path":"packages/plugins/experimental/plugin-automation/src/AutomationPlugin.tsx","kind":"import-statement","original":"./AutomationPlugin"},{"path":"packages/plugins/experimental/plugin-automation/src/AutomationPlugin.tsx","kind":"import-statement","original":"./AutomationPlugin"},{"path":"packages/plugins/experimental/plugin-automation/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/plugins/experimental/plugin-automation/src/presets.ts","kind":"import-statement","original":"./presets"},{"path":"packages/plugins/experimental/plugin-automation/src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"}},"outputs":{"packages/plugins/experimental/plugin-automation/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":23991},"packages/plugins/experimental/plugin-automation/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-automation/dist/lib/browser/chunk-DN5M2QL5.mjs","kind":"import-statement"},{"path":"packages/plugins/experimental/plugin-automation/dist/lib/browser/chunk-X5KMOH3I.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/plugin-client/types","kind":"import-statement","external":true},{"path":"@dxos/plugin-graph","kind":"import-statement","external":true},{"path":"@dxos/plugin-space","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui-form","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-automation/dist/lib/browser/AssistantPanel-32FH2RA6.mjs","kind":"dynamic-import"},{"path":"packages/plugins/experimental/plugin-automation/dist/lib/browser/AutomationPanel-ABGPG5LE.mjs","kind":"dynamic-import"},{"path":"@dxos/live-object","kind":"import-statement","external":true}],"exports":["AssistantPanel","AutomationAction","AutomationPanel","AutomationPlugin","ChainInputSchema","ChainInputType","ChainPromptType","ChainType","chainPresets","default","str"],"entryPoint":"packages/plugins/experimental/plugin-automation/src/index.ts","inputs":{"packages/plugins/experimental/plugin-automation/src/AutomationPlugin.tsx":{"bytesInOutput":7755},"packages/plugins/experimental/plugin-automation/src/components/index.ts":{"bytesInOutput":180},"packages/plugins/experimental/plugin-automation/src/translations.ts":{"bytesInOutput":1277},"packages/plugins/experimental/plugin-automation/src/index.ts":{"bytesInOutput":36},"packages/plugins/experimental/plugin-automation/src/presets.ts":{"bytesInOutput":5489}},"bytes":15618},"packages/plugins/experimental/plugin-automation/dist/lib/browser/meta.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/experimental/plugin-automation/dist/lib/browser/meta.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-automation/dist/lib/browser/chunk-X5KMOH3I.mjs","kind":"import-statement"}],"exports":["AUTOMATION_PLUGIN","default"],"entryPoint":"packages/plugins/experimental/plugin-automation/src/meta.ts","inputs":{},"bytes":169},"packages/plugins/experimental/plugin-automation/dist/lib/browser/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/experimental/plugin-automation/dist/lib/browser/types/index.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-automation/dist/lib/browser/chunk-DN5M2QL5.mjs","kind":"import-statement"}],"exports":["AutomationAction","ChainInputSchema","ChainInputType","ChainPromptType","ChainType"],"entryPoint":"packages/plugins/experimental/plugin-automation/src/types/index.ts","inputs":{},"bytes":266},"packages/plugins/experimental/plugin-automation/dist/lib/browser/chunk-DN5M2QL5.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2879},"packages/plugins/experimental/plugin-automation/dist/lib/browser/chunk-DN5M2QL5.mjs":{"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"exports":["AutomationAction","ChainInputSchema","ChainInputType","ChainPromptType","ChainType"],"inputs":{"packages/plugins/experimental/plugin-automation/src/types/schema.ts":{"bytesInOutput":1247},"packages/plugins/experimental/plugin-automation/src/types/index.ts":{"bytesInOutput":0},"packages/plugins/experimental/plugin-automation/src/types/types.ts":{"bytesInOutput":118}},"bytes":1653},"packages/plugins/experimental/plugin-automation/dist/lib/browser/AssistantPanel-32FH2RA6.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":22398},"packages/plugins/experimental/plugin-automation/dist/lib/browser/AssistantPanel-32FH2RA6.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-automation/dist/lib/browser/chunk-X5KMOH3I.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/assistant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/react-client","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-syntax-highlighter","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/experimental/plugin-automation/src/components/AssistantPanel/index.ts","inputs":{"packages/plugins/experimental/plugin-automation/src/components/AssistantPanel/AssistantPanel.tsx":{"bytesInOutput":7244},"packages/plugins/experimental/plugin-automation/src/components/AssistantPanel/system-instructions.ts":{"bytesInOutput":4067},"packages/plugins/experimental/plugin-automation/src/components/AssistantPanel/index.ts":{"bytesInOutput":45}},"bytes":11915},"packages/plugins/experimental/plugin-automation/dist/lib/browser/AutomationPanel-ABGPG5LE.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":13284},"packages/plugins/experimental/plugin-automation/dist/lib/browser/AutomationPanel-ABGPG5LE.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-automation/dist/lib/browser/chunk-X5KMOH3I.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/react-client","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-list","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-form","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/experimental/plugin-automation/src/components/AutomationPanel/index.ts","inputs":{"packages/plugins/experimental/plugin-automation/src/components/AutomationPanel/AutomationPanel.tsx":{"bytesInOutput":4160},"packages/plugins/experimental/plugin-automation/src/components/TriggerEditor/TriggerEditor.tsx":{"bytesInOutput":1456},"packages/plugins/experimental/plugin-automation/src/components/TriggerEditor/index.ts":{"bytesInOutput":0},"packages/plugins/experimental/plugin-automation/src/components/AutomationPanel/index.ts":{"bytesInOutput":47}},"bytes":6223},"packages/plugins/experimental/plugin-automation/dist/lib/browser/chunk-X5KMOH3I.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":763},"packages/plugins/experimental/plugin-automation/dist/lib/browser/chunk-X5KMOH3I.mjs":{"imports":[],"exports":["AUTOMATION_PLUGIN","meta_default"],"inputs":{"packages/plugins/experimental/plugin-automation/src/meta.ts":{"bytesInOutput":333}},"bytes":489}}}
|
|
1
|
+
{"inputs":{"packages/plugins/experimental/plugin-automation/src/meta.ts":{"bytes":1924,"imports":[],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/capabilities/app-graph-builder.ts":{"bytes":16198,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/plugin-graph","kind":"import-statement","external":true},{"path":"@dxos/plugin-space","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-automation/src/meta.ts","kind":"import-statement","original":"../meta"}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/components/AssistantPanel/system-instructions.ts":{"bytes":16049,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/components/AssistantPanel/AssistantPanel.tsx":{"bytes":27867,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/assistant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/react-client","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-syntax-highlighter","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-automation/src/components/AssistantPanel/system-instructions.ts","kind":"import-statement","original":"./system-instructions"},{"path":"packages/plugins/experimental/plugin-automation/src/meta.ts","kind":"import-statement","original":"../../meta"}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/components/AssistantPanel/index.ts":{"bytes":739,"imports":[{"path":"packages/plugins/experimental/plugin-automation/src/components/AssistantPanel/AssistantPanel.tsx","kind":"import-statement","original":"./AssistantPanel"}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/components/TriggerEditor/TriggerEditor.tsx":{"bytes":15243,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-form","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-automation/src/meta.ts","kind":"import-statement","original":"../../meta"}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/components/TriggerEditor/index.ts":{"bytes":557,"imports":[{"path":"packages/plugins/experimental/plugin-automation/src/components/TriggerEditor/TriggerEditor.tsx","kind":"import-statement","original":"./TriggerEditor"}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/components/AutomationPanel/AutomationPanel.tsx":{"bytes":19445,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/react-client","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-list","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-automation/src/meta.ts","kind":"import-statement","original":"../../meta"},{"path":"packages/plugins/experimental/plugin-automation/src/components/TriggerEditor/index.ts","kind":"import-statement","original":"../TriggerEditor"}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/components/AutomationPanel/index.ts":{"bytes":751,"imports":[{"path":"packages/plugins/experimental/plugin-automation/src/components/AutomationPanel/AutomationPanel.tsx","kind":"import-statement","original":"./AutomationPanel"}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/components/index.ts":{"bytes":1078,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-automation/src/components/AssistantPanel/index.ts","kind":"dynamic-import","original":"./AssistantPanel"},{"path":"packages/plugins/experimental/plugin-automation/src/components/AutomationPanel/index.ts","kind":"dynamic-import","original":"./AutomationPanel"}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/capabilities/react-surface.tsx":{"bytes":3922,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-automation/src/components/index.ts","kind":"import-statement","original":"../components"},{"path":"packages/plugins/experimental/plugin-automation/src/meta.ts","kind":"import-statement","original":"../meta"}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/capabilities/index.ts":{"bytes":1109,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-automation/src/capabilities/app-graph-builder.ts","kind":"dynamic-import","original":"./app-graph-builder"},{"path":"packages/plugins/experimental/plugin-automation/src/capabilities/react-surface.tsx","kind":"dynamic-import","original":"./react-surface"}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/translations.ts":{"bytes":5419,"imports":[{"path":"packages/plugins/experimental/plugin-automation/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/types/schema.ts":{"bytes":4248,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/types/index.ts":{"bytes":519,"imports":[{"path":"packages/plugins/experimental/plugin-automation/src/types/schema.ts","kind":"import-statement","original":"./schema"}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/AutomationPlugin.tsx":{"bytes":10038,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/plugin-deck","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-automation/src/capabilities/index.ts","kind":"import-statement","original":"./capabilities"},{"path":"packages/plugins/experimental/plugin-automation/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/experimental/plugin-automation/src/translations.ts","kind":"import-statement","original":"./translations"},{"path":"packages/plugins/experimental/plugin-automation/src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/presets.ts":{"bytes":19268,"imports":[{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-automation/src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/experimental/plugin-automation/src/index.ts":{"bytes":885,"imports":[{"path":"packages/plugins/experimental/plugin-automation/src/AutomationPlugin.tsx","kind":"import-statement","original":"./AutomationPlugin"},{"path":"packages/plugins/experimental/plugin-automation/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/plugins/experimental/plugin-automation/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/experimental/plugin-automation/src/presets.ts","kind":"import-statement","original":"./presets"},{"path":"packages/plugins/experimental/plugin-automation/src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"}},"outputs":{"packages/plugins/experimental/plugin-automation/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":16189},"packages/plugins/experimental/plugin-automation/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-automation/dist/lib/browser/chunk-DL6LB2NI.mjs","kind":"import-statement"},{"path":"packages/plugins/experimental/plugin-automation/dist/lib/browser/chunk-4ODBJDXM.mjs","kind":"import-statement"},{"path":"packages/plugins/experimental/plugin-automation/dist/lib/browser/chunk-DQ7ZSYJJ.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/plugin-deck","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-automation/dist/lib/browser/app-graph-builder-6FSMLMT4.mjs","kind":"dynamic-import"},{"path":"packages/plugins/experimental/plugin-automation/dist/lib/browser/react-surface-5YTE5MRE.mjs","kind":"dynamic-import"},{"path":"@dxos/live-object","kind":"import-statement","external":true}],"exports":["AUTOMATION_PLUGIN","AssistantPanel","AutomationPanel","AutomationPlugin","ChainInputSchema","ChainInputType","ChainPromptType","ChainType","chainPresets","meta","str"],"entryPoint":"packages/plugins/experimental/plugin-automation/src/index.ts","inputs":{"packages/plugins/experimental/plugin-automation/src/AutomationPlugin.tsx":{"bytesInOutput":2237},"packages/plugins/experimental/plugin-automation/src/capabilities/index.ts":{"bytesInOutput":193},"packages/plugins/experimental/plugin-automation/src/translations.ts":{"bytesInOutput":1597},"packages/plugins/experimental/plugin-automation/src/index.ts":{"bytesInOutput":0},"packages/plugins/experimental/plugin-automation/src/presets.ts":{"bytesInOutput":5489}},"bytes":10365},"packages/plugins/experimental/plugin-automation/dist/lib/browser/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/experimental/plugin-automation/dist/lib/browser/types/index.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-automation/dist/lib/browser/chunk-DL6LB2NI.mjs","kind":"import-statement"}],"exports":["ChainInputSchema","ChainInputType","ChainPromptType","ChainType"],"entryPoint":"packages/plugins/experimental/plugin-automation/src/types/index.ts","inputs":{},"bytes":226},"packages/plugins/experimental/plugin-automation/dist/lib/browser/chunk-DL6LB2NI.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2081},"packages/plugins/experimental/plugin-automation/dist/lib/browser/chunk-DL6LB2NI.mjs":{"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"exports":["ChainInputSchema","ChainInputType","ChainPromptType","ChainType"],"inputs":{"packages/plugins/experimental/plugin-automation/src/types/schema.ts":{"bytesInOutput":1247},"packages/plugins/experimental/plugin-automation/src/types/index.ts":{"bytesInOutput":0}},"bytes":1444},"packages/plugins/experimental/plugin-automation/dist/lib/browser/app-graph-builder-6FSMLMT4.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7468},"packages/plugins/experimental/plugin-automation/dist/lib/browser/app-graph-builder-6FSMLMT4.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-automation/dist/lib/browser/chunk-DQ7ZSYJJ.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/plugin-graph","kind":"import-statement","external":true},{"path":"@dxos/plugin-space","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/experimental/plugin-automation/src/capabilities/app-graph-builder.ts","inputs":{"packages/plugins/experimental/plugin-automation/src/capabilities/app-graph-builder.ts":{"bytesInOutput":3950}},"bytes":4207},"packages/plugins/experimental/plugin-automation/dist/lib/browser/AssistantPanel-NTOUHOWA.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":22315},"packages/plugins/experimental/plugin-automation/dist/lib/browser/AssistantPanel-NTOUHOWA.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-automation/dist/lib/browser/chunk-DQ7ZSYJJ.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/assistant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/react-client","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-syntax-highlighter","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/experimental/plugin-automation/src/components/AssistantPanel/index.ts","inputs":{"packages/plugins/experimental/plugin-automation/src/components/AssistantPanel/AssistantPanel.tsx":{"bytesInOutput":7219},"packages/plugins/experimental/plugin-automation/src/components/AssistantPanel/system-instructions.ts":{"bytesInOutput":4067},"packages/plugins/experimental/plugin-automation/src/components/AssistantPanel/index.ts":{"bytesInOutput":45}},"bytes":11890},"packages/plugins/experimental/plugin-automation/dist/lib/browser/AutomationPanel-KT3YFV56.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":18642},"packages/plugins/experimental/plugin-automation/dist/lib/browser/AutomationPanel-KT3YFV56.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-automation/dist/lib/browser/chunk-DQ7ZSYJJ.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/react-client","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-list","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-form","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/experimental/plugin-automation/src/components/AutomationPanel/index.ts","inputs":{"packages/plugins/experimental/plugin-automation/src/components/AutomationPanel/AutomationPanel.tsx":{"bytesInOutput":4886},"packages/plugins/experimental/plugin-automation/src/components/TriggerEditor/TriggerEditor.tsx":{"bytesInOutput":3869},"packages/plugins/experimental/plugin-automation/src/components/TriggerEditor/index.ts":{"bytesInOutput":0},"packages/plugins/experimental/plugin-automation/src/components/AutomationPanel/index.ts":{"bytesInOutput":47}},"bytes":9362},"packages/plugins/experimental/plugin-automation/dist/lib/browser/react-surface-5YTE5MRE.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1915},"packages/plugins/experimental/plugin-automation/dist/lib/browser/react-surface-5YTE5MRE.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-automation/dist/lib/browser/chunk-4ODBJDXM.mjs","kind":"import-statement"},{"path":"packages/plugins/experimental/plugin-automation/dist/lib/browser/chunk-DQ7ZSYJJ.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/experimental/plugin-automation/src/capabilities/react-surface.tsx","inputs":{"packages/plugins/experimental/plugin-automation/src/capabilities/react-surface.tsx":{"bytesInOutput":812}},"bytes":1134},"packages/plugins/experimental/plugin-automation/dist/lib/browser/chunk-4ODBJDXM.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":503},"packages/plugins/experimental/plugin-automation/dist/lib/browser/chunk-4ODBJDXM.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-automation/dist/lib/browser/AssistantPanel-NTOUHOWA.mjs","kind":"dynamic-import"},{"path":"packages/plugins/experimental/plugin-automation/dist/lib/browser/AutomationPanel-KT3YFV56.mjs","kind":"dynamic-import"}],"exports":["AssistantPanel","AutomationPanel"],"inputs":{"packages/plugins/experimental/plugin-automation/src/components/index.ts":{"bytesInOutput":180}},"bytes":348},"packages/plugins/experimental/plugin-automation/dist/lib/browser/chunk-DQ7ZSYJJ.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":892},"packages/plugins/experimental/plugin-automation/dist/lib/browser/chunk-DQ7ZSYJJ.mjs":{"imports":[],"exports":["AUTOMATION_PLUGIN","meta"],"inputs":{"packages/plugins/experimental/plugin-automation/src/meta.ts":{"bytesInOutput":434}},"bytes":582}}}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AssistantPanel,
|
|
3
|
+
AutomationPanel
|
|
4
|
+
} from "./chunk-4ODBJDXM.mjs";
|
|
5
|
+
import {
|
|
6
|
+
AUTOMATION_PLUGIN
|
|
7
|
+
} from "./chunk-DQ7ZSYJJ.mjs";
|
|
8
|
+
|
|
9
|
+
// packages/plugins/experimental/plugin-automation/src/capabilities/react-surface.tsx
|
|
10
|
+
import React from "react";
|
|
11
|
+
import { Capabilities, contributes, createSurface } from "@dxos/app-framework";
|
|
12
|
+
import { getSpace, isEchoObject } from "@dxos/react-client/echo";
|
|
13
|
+
var react_surface_default = () => contributes(Capabilities.ReactSurface, [
|
|
14
|
+
createSurface({
|
|
15
|
+
id: `${AUTOMATION_PLUGIN}/assistant`,
|
|
16
|
+
role: "complementary--assistant",
|
|
17
|
+
component: ({ data }) => /* @__PURE__ */ React.createElement(AssistantPanel, {
|
|
18
|
+
subject: data.subject
|
|
19
|
+
})
|
|
20
|
+
}),
|
|
21
|
+
createSurface({
|
|
22
|
+
id: `${AUTOMATION_PLUGIN}/automation`,
|
|
23
|
+
role: "complementary--automation",
|
|
24
|
+
filter: (data) => isEchoObject(data.subject) && !!getSpace(data.subject),
|
|
25
|
+
component: ({ data }) => /* @__PURE__ */ React.createElement(AutomationPanel, {
|
|
26
|
+
space: getSpace(data.subject),
|
|
27
|
+
object: data.subject
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
]);
|
|
31
|
+
export {
|
|
32
|
+
react_surface_default as default
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=react-surface-5YTE5MRE.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/react-surface.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Capabilities, contributes, createSurface } from '@dxos/app-framework';\nimport { getSpace, isEchoObject, type ReactiveEchoObject } from '@dxos/react-client/echo';\n\nimport { AssistantPanel, AutomationPanel } from '../components';\nimport { AUTOMATION_PLUGIN } from '../meta';\n\nexport default () =>\n contributes(Capabilities.ReactSurface, [\n createSurface({\n id: `${AUTOMATION_PLUGIN}/assistant`,\n role: 'complementary--assistant',\n component: ({ data }) => <AssistantPanel subject={data.subject} />,\n }),\n createSurface({\n id: `${AUTOMATION_PLUGIN}/automation`,\n role: 'complementary--automation',\n filter: (data): data is { subject: ReactiveEchoObject<any> } =>\n isEchoObject(data.subject) && !!getSpace(data.subject),\n component: ({ data }) => <AutomationPanel space={getSpace(data.subject)!} object={data.subject} />,\n }),\n ]);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,cAAcC,aAAaC,qBAAqB;AACzD,SAASC,UAAUC,oBAA6C;AAKhE,IAAA,wBAAe,MACbC,YAAYC,aAAaC,cAAc;EACrCC,cAAc;IACZC,IAAI,GAAGC,iBAAAA;IACPC,MAAM;IACNC,WAAW,CAAC,EAAEC,KAAI,MAAO,sBAAA,cAACC,gBAAAA;MAAeC,SAASF,KAAKE;;EACzD,CAAA;EACAP,cAAc;IACZC,IAAI,GAAGC,iBAAAA;IACPC,MAAM;IACNK,QAAQ,CAACH,SACPI,aAAaJ,KAAKE,OAAO,KAAK,CAAC,CAACG,SAASL,KAAKE,OAAO;IACvDH,WAAW,CAAC,EAAEC,KAAI,MAAO,sBAAA,cAACM,iBAAAA;MAAgBC,OAAOF,SAASL,KAAKE,OAAO;MAAIM,QAAQR,KAAKE;;EACzF,CAAA;CACD;",
|
|
6
|
+
"names": ["React", "Capabilities", "contributes", "createSurface", "getSpace", "isEchoObject", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "AUTOMATION_PLUGIN", "role", "component", "data", "AssistantPanel", "subject", "filter", "isEchoObject", "getSpace", "AutomationPanel", "space", "object"]
|
|
7
|
+
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
AutomationAction,
|
|
3
2
|
ChainInputSchema,
|
|
4
3
|
ChainInputType,
|
|
5
4
|
ChainPromptType,
|
|
6
5
|
ChainType
|
|
7
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-DL6LB2NI.mjs";
|
|
8
7
|
export {
|
|
9
|
-
AutomationAction,
|
|
10
8
|
ChainInputSchema,
|
|
11
9
|
ChainInputType,
|
|
12
10
|
ChainPromptType,
|
|
@@ -26,12 +26,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var AssistantPanel_U7GDWPRC_exports = {};
|
|
30
|
+
__export(AssistantPanel_U7GDWPRC_exports, {
|
|
31
31
|
default: () => AssistantPanel_default
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
var
|
|
33
|
+
module.exports = __toCommonJS(AssistantPanel_U7GDWPRC_exports);
|
|
34
|
+
var import_chunk_TQEDPRY5 = require("./chunk-TQEDPRY5.cjs");
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
36
|
var import_assistant = require("@dxos/assistant");
|
|
37
37
|
var import_keys = require("@dxos/keys");
|
|
@@ -188,7 +188,7 @@ var RE_OPEN_TAG_LINE = /^[ ]*<[a-zA-Z0-9\-_]+>[ ]*$/;
|
|
|
188
188
|
var RE_CLOSE_TAG_LINE = /^[ ]*<\/[a-zA-Z0-9\-_]+>[ ]*$/;
|
|
189
189
|
var PROPERTIES_ASSISTANT_KEY = "dxos.assistant.beta.properties";
|
|
190
190
|
var AssistantPanel = ({ subject, classNames }) => {
|
|
191
|
-
const { t } = (0, import_react_ui2.useTranslation)(
|
|
191
|
+
const { t } = (0, import_react_ui2.useTranslation)(import_chunk_TQEDPRY5.AUTOMATION_PLUGIN);
|
|
192
192
|
const config = (0, import_react_client.useConfig)();
|
|
193
193
|
const client = (0, import_react_client.useClient)();
|
|
194
194
|
const aiClient = (0, import_react.useRef)();
|
|
@@ -316,7 +316,7 @@ var MessageItem = ({ classNames, message }) => {
|
|
|
316
316
|
return /* @__PURE__ */ import_react.default.createElement("div", {
|
|
317
317
|
key: i,
|
|
318
318
|
role: "none",
|
|
319
|
-
className: (0, import_react_ui_theme.mx)(styleContainer, role === "user" ? "bg-
|
|
319
|
+
className: (0, import_react_ui_theme.mx)(styleContainer, role === "user" ? "bg-accentSurface" : "bg-input")
|
|
320
320
|
}, cot && /* @__PURE__ */ import_react.default.createElement("div", {
|
|
321
321
|
className: "p-2 whitespace-pre-wrap text-xs text-subdued"
|
|
322
322
|
}, cot), /* @__PURE__ */ import_react.default.createElement("div", {
|
|
@@ -356,4 +356,4 @@ var parseMessage = (text) => {
|
|
|
356
356
|
};
|
|
357
357
|
};
|
|
358
358
|
var AssistantPanel_default = AssistantPanel;
|
|
359
|
-
//# sourceMappingURL=AssistantPanel-
|
|
359
|
+
//# sourceMappingURL=AssistantPanel-U7GDWPRC.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/AssistantPanel/AssistantPanel.tsx", "../../../src/components/AssistantPanel/system-instructions.ts", "../../../src/components/AssistantPanel/index.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\n/* eslint-disable no-console */\n\nimport React, { useEffect, useRef, useState } from 'react';\n\nimport { type AIServiceClient, AIServiceClientImpl, ObjectId, type Message } from '@dxos/assistant';\nimport type { ReactiveEchoObject } from '@dxos/echo-db';\nimport { SpaceId } from '@dxos/keys';\nimport { useClient, useConfig } from '@dxos/react-client';\nimport { ContextMenu, type ThemedClassName } from '@dxos/react-ui';\nimport { Icon, Input, Toolbar, useTranslation } from '@dxos/react-ui';\nimport { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { createSystemInstructions } from './system-instructions';\nimport { AUTOMATION_PLUGIN } from '../../meta';\n\nconst PROPERTIES_ASSISTANT_KEY = 'dxos.assistant.beta.properties';\n\nexport type AssistantPanelProps = ThemedClassName<{\n subject?: ReactiveEchoObject<any>;\n}>;\n\nexport const AssistantPanel = ({ subject, classNames }: AssistantPanelProps) => {\n const { t } = useTranslation(AUTOMATION_PLUGIN);\n const config = useConfig();\n const client = useClient();\n const aiClient = useRef<AIServiceClient>();\n const [contextSpaceId, setContextSpaceId] = useState<SpaceId | undefined>();\n const [threadId, setThreadId] = useState<ObjectId | undefined>();\n const [history, setHistory] = useState<Message[]>([]);\n const [input, setInput] = useState('');\n\n useEffect(() => {\n if (!aiClient.current) {\n const endpoint = config.values.runtime?.services?.ai?.server;\n if (!endpoint) {\n throw new Error('AI service endpoint is not configured');\n }\n aiClient.current = new AIServiceClientImpl({\n endpoint,\n });\n }\n\n queueMicrotask(async () => {\n const properties = client.spaces.default.properties;\n\n properties[PROPERTIES_ASSISTANT_KEY] ??= {};\n properties[PROPERTIES_ASSISTANT_KEY].contextSpaceId ??= SpaceId.random();\n properties[PROPERTIES_ASSISTANT_KEY].threadId ??= ObjectId.random();\n\n const contextSpaceId = properties[PROPERTIES_ASSISTANT_KEY].contextSpaceId;\n const threadId = properties[PROPERTIES_ASSISTANT_KEY].threadId;\n\n setContextSpaceId(contextSpaceId);\n setThreadId(threadId);\n\n const messages = await aiClient.current!.getMessagesInThread(contextSpaceId, threadId);\n setHistory(messages);\n });\n }, []);\n\n const handleRequest = async (input: string) => {\n if (input === '') {\n return;\n }\n\n setInput('');\n\n // TODO(dmaretskyi): Can we call `create(Message, { ... })` here?\n const userMessage: Message = {\n id: ObjectId.random(),\n spaceId: contextSpaceId!,\n threadId: threadId!,\n role: 'user',\n content: [{ type: 'text', text: input }],\n };\n await aiClient.current!.insertMessages([userMessage]);\n setHistory([...history, userMessage]);\n\n const generationStream = await aiClient.current!.generate({\n model: '@anthropic/claude-3-5-sonnet-20241022',\n spaceId: contextSpaceId!,\n threadId: threadId!,\n tools: [],\n systemPrompt: await getSystemPrompt(),\n });\n\n const historyBefore = [...history, userMessage];\n for await (const _event of generationStream) {\n setHistory([...historyBefore, ...generationStream.accumulatedMessages]);\n }\n\n await aiClient.current!.insertMessages(await generationStream.complete());\n };\n\n const getSystemPrompt = async () => {\n return createSystemInstructions({ subject });\n };\n\n const clearThread = async () => {\n const properties = client.spaces.default.properties;\n\n properties[PROPERTIES_ASSISTANT_KEY] ??= {};\n // properties[PROPERTIES_ASSISTANT_KEY].contextSpaceId ??= SpaceId.random();\n properties[PROPERTIES_ASSISTANT_KEY].threadId = ObjectId.random();\n\n // const contextSpaceId = properties[PROPERTIES_ASSISTANT_KEY].contextSpaceId;\n const threadId = properties[PROPERTIES_ASSISTANT_KEY].threadId;\n\n // setContextSpaceId(contextSpaceId);\n setThreadId(threadId);\n\n const messages = await aiClient.current!.getMessagesInThread(contextSpaceId!, threadId);\n setHistory(messages);\n };\n\n // TODO(burdon): Factor out with script plugin.\n return (\n <div className={mx('flex flex-col h-full overflow-hidden', classNames)}>\n {history.length > 0 && (\n <div className='flex flex-col gap-6 h-full p-2 overflow-x-hidden overflow-y-auto'>\n {history.map((message) => (\n <MessageItem key={message.id} message={message} />\n ))}\n </div>\n )}\n\n <Toolbar.Root classNames='p-1'>\n <Input.Root>\n <Input.TextInput\n autoFocus\n placeholder={t('ask me anything')}\n value={input}\n onChange={(ev) => setInput(ev.target.value)}\n onKeyDown={(ev) => ev.key === 'Enter' && handleRequest(input)}\n />\n </Input.Root>\n <ContextMenu.Root>\n <ContextMenu.Trigger asChild>\n <Toolbar.Button onClick={() => handleRequest(input)}>\n <Icon icon='ph--play--regular' size={4} />\n </Toolbar.Button>\n </ContextMenu.Trigger>\n <ContextMenu.Portal>\n <ContextMenu.Content>\n <ContextMenu.Viewport>\n <ContextMenu.Item onClick={clearThread}>Clear thread</ContextMenu.Item>\n <ContextMenu.Item onClick={async () => console.log(await getSystemPrompt())}>\n Print instructions to console\n </ContextMenu.Item>\n </ContextMenu.Viewport>\n </ContextMenu.Content>\n </ContextMenu.Portal>\n </ContextMenu.Root>\n\n {/* <Toolbar.Button onClick={() => (state ? handleStop() : handleClear())}>\n <Icon icon={state ? 'ph--stop--regular' : 'ph--trash--regular'} size={4} />\n </Toolbar.Button> */}\n </Toolbar.Root>\n </div>\n );\n};\n\nconst MessageItem = ({ classNames, message }: ThemedClassName<{ message: Message }>) => {\n const { id: _, role, content } = message;\n const styleContainer = 'flex flex-col overflow-x-hidden overflow-y-auto rounded-md gap-2 divide-y divide-separator';\n\n return (\n <div className={mx('flex', role === 'user' ? 'ml-[1rem] justify-end' : 'mr-[1rem]', classNames)}>\n {content.map((content, i) => {\n switch (content.type) {\n case 'text': {\n const { cot, message } = parseMessage(content.text);\n return (\n <div\n key={i}\n role='none'\n className={mx(\n styleContainer,\n role === 'user' ? 'bg-primary-400 dark:bg-primary-600' : 'bg-hoverSurface',\n )}\n >\n {cot && <div className='p-2 whitespace-pre-wrap text-xs text-subdued'>{cot}</div>}\n <div className='p-2 whitespace-pre-wrap'>{message}</div>\n </div>\n );\n }\n\n case 'tool_use': {\n return (\n <div key={i} className={mx(styleContainer, 'text-xs')}>\n <div>\n <span className='p-2 text-primary'>Tool use</span>: {content.name} {content.id}\n </div>\n <SyntaxHighlighter language='json'>{content.inputJson}</SyntaxHighlighter>\n </div>\n );\n }\n\n case 'tool_result': {\n return (\n <div key={i} className={mx(styleContainer, 'text-xs', content.isError && 'text-error')}>\n <div>\n <span className='p-2 text-primary'>Tool result</span>: {content.toolUseId}\n </div>\n <SyntaxHighlighter language='json'>{content.content}</SyntaxHighlighter>\n </div>\n );\n }\n }\n\n return null;\n })}\n </div>\n );\n};\n\n// TODO(burdon): Move to server-side parsing.\nconst parseMessage = (text: string): { cot?: string; message: string } => {\n const regex = /<cot>([\\s\\S]*?)<\\/cot>\\s*([\\s\\S]*)/;\n const match = text.match(regex);\n return {\n cot: match?.[1].trim(),\n message: match?.[2] ?? text ?? '\\u00D8',\n };\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { asyncTimeout } from '@dxos/async';\nimport type { ReactiveEchoObject } from '@dxos/echo-db';\nimport { getTypename } from '@dxos/echo-schema';\nimport { log } from '@dxos/log';\nimport { Filter, getSpace, ResultFormat } from '@dxos/react-client/echo';\n\n// TODO(burdon): Move into assistant-protocol.\nexport type ThreadContext = {\n subject?: ReactiveEchoObject<any>;\n};\n\nexport const createSystemInstructions = async (context: ThreadContext): Promise<string> => {\n let instructions = `\n <instructions>\n Before replying always think step-by-step on how to proceed.\n Print your thoughts inside <cot> tags.\n\n <example>\n <cot>To answer the question I need to ...</cot>\n </example>\n </instructions>\n\n <current_time>${new Date().toLocaleString()}</current_time>\n `;\n\n if (context.subject) {\n instructions += `\n <user_attention>\n The user is currently interacting with an object in Composer application:\n\n ${await formatContextObject(context.subject)}\n </user_attention>\n `;\n }\n\n return looseFormatXml(instructions);\n};\n\nconst formatContextObject = async (object: ReactiveEchoObject<any>): Promise<string> => {\n let data;\n try {\n data = await asyncTimeout(preprocessContextObject(object), CONTEXT_OBJECT_QUERY_TIMEOUT);\n } catch (err: any) {\n log.error('Failed to preprocess context object:', { err });\n data = object;\n }\n\n if (typeof data === 'string') {\n return data;\n } else {\n return `\n <object>\n <type>${getTypename(object)}</type>\n <id>${object.id}</id>\n ${formatObjectAsXMLTags(data)}\n </object>\n `;\n }\n};\n\nconst preprocessContextObject = async (object: ReactiveEchoObject<any>): Promise<Record<string, any> | string> => {\n const space = getSpace(object);\n if (!space) {\n return { ...object };\n }\n\n // TODO(dmaretskyi): Serialize based on schema annotations.\n switch (getTypename(object)) {\n // TODO(dmaretskyi): Reference types somehow without plugin-automation depending on other plugins.\n case 'dxos.org/type/Document': {\n const data = space.db\n .query({ id: object.id }, { format: ResultFormat.Plain, include: { content: true } })\n .first() ?? { content: { content: '' } };\n\n return {\n ...data,\n threads: undefined,\n };\n }\n\n case 'dxos.org/type/Table': {\n // TODO(dmaretskyi): Load references.\n const schema = object.view ? space?.db.schemaRegistry.getSchema(object.view.query.type) : undefined;\n const { objects: rows } =\n (schema &&\n (await space.db\n .query(Filter.schema(schema), { format: ResultFormat.Plain, limit: TABLE_ROWS_LIMIT })\n .run())) ??\n {};\n\n // TODO(dmaretskyi): Format table schema.\n return `\n <object>\n <id>${object.id}</id>\n <type>${getTypename(object)}</type>\n ${formatObjectAsXMLTags(object)}\n\n <rows>\n <!-- Limited to first ${TABLE_ROWS_LIMIT} rows. -->\n ${rows\n ?.map(\n (row: any) => `<row>\n ${formatObjectAsXMLTags(row)}\n </row>`,\n )\n .join('\\n')}\n </rows>\n\n `;\n }\n\n default:\n return { ...object };\n }\n};\n\nconst formatObjectAsXMLTags = (object: any, depth = 1): string => {\n return Object.entries(object)\n .filter(([key, value]) => ['string', 'number', 'boolean', 'object'].includes(typeof value))\n .map(([key, value]) => {\n if (typeof value === 'object' && value !== null) {\n if (depth === 0) {\n return '';\n } else {\n return `<${key}>\n ${formatObjectAsXMLTags(value, depth - 1)}\n </${key}>`;\n }\n }\n\n return `<${key}>${value}</${key}>`;\n })\n .join('\\n');\n};\n\nconst CONTEXT_OBJECT_QUERY_TIMEOUT = 5_000;\n\nconst TABLE_ROWS_LIMIT = 10;\n\n/**\n * Formats XML indentation for instructions so they are easier to read during debugging.\n */\nconst looseFormatXml = (xml: string): string => {\n let currentIndent = 0;\n\n return xml\n .split('\\n')\n .map((line) => {\n if (line.match(RE_CLOSE_TAG_LINE)) {\n currentIndent--;\n }\n const indent = currentIndent;\n if (line.match(RE_OPEN_TAG_LINE)) {\n currentIndent++;\n }\n return ' '.repeat(indent * 2) + line.trimStart();\n })\n .join('\\n');\n};\n\nconst RE_OPEN_TAG_LINE = /^[ ]*<[a-zA-Z0-9\\-_]+>[ ]*$/;\nconst RE_CLOSE_TAG_LINE = /^[ ]*<\\/[a-zA-Z0-9\\-_]+>[ ]*$/;\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { AssistantPanel } from './AssistantPanel';\n\nexport default AssistantPanel;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,mBAAmD;AAEnD,uBAAkF;AAElF,kBAAwB;AACxB,0BAAqC;AACrC,sBAAkD;AAClD,IAAAA,mBAAqD;AACrD,yCAAkC;AAClC,4BAAmB;ACXnB,mBAA6B;AAE7B,yBAA4B;AAC5B,iBAAoB;AACpB,kBAA+C;;AAOxC,IAAMC,2BAA2B,OAAOC,YAAAA;AAC7C,MAAIC,eAAe;;;;;;;;;;qBAUD,oBAAIC,KAAAA,GAAOC,eAAc,CAAA;;AAG3C,MAAIH,QAAQI,SAAS;AACnBH,oBAAgB;;;;UAIV,MAAMI,oBAAoBL,QAAQI,OAAO,CAAA;;;EAGjD;AAEA,SAAOE,eAAeL,YAAAA;AACxB;AAEA,IAAMI,sBAAsB,OAAOE,WAAAA;AACjC,MAAIC;AACJ,MAAI;AACFA,WAAO,UAAMC,2BAAaC,wBAAwBH,MAAAA,GAASI,4BAAAA;EAC7D,SAASC,KAAU;AACjBC,mBAAIC,MAAM,wCAAwC;MAAEF;IAAI,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AQ,WAAWqD,cAAcrB,KAAAA;OAG3D,6BAAAsC,QAAA,cAACiB,4BAAYT,MAAI,MACf,6BAAAR,QAAA,cAACiB,4BAAYC,SAAO;IAACC,SAAAA;KACnB,6BAAAnB,QAAA,cAACO,yBAAQa,QAAM;IAACC,SAAS,MAAMtC,cAAcrB,KAAAA;KAC3C,6BAAAsC,QAAA,cAACsB,uBAAAA;IAAKC,MAAK;IAAoBC,MAAM;QAGzC,6BAAAxB,QAAA,cAACiB,4BAAYQ,QAAM,MACjB,6BAAAzB,QAAA,cAACiB,4BAAYS,SAAO,MAClB,6BAAA1B,QAAA,cAACiB,4BAAYU,UAAQ,MACnB,6BAAA3B,QAAA,cAACiB,4BAAYW,MAAI;IAACP,SAAStB;KAAa,cAAA,GACxC,6BAAAC,QAAA,cAACiB,4BAAYW,MAAI;IAACP,SAAS,YAAYQ,QAAQtI,IAAI,MAAMmG,gBAAAA,CAAAA;KAAoB,+BAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAc7F;AAEA,IAAMY,cAAc,CAAC,EAAE7D,YAAY4D,QAAO,MAAyC;AACjF,QAAM,EAAE3G,IAAIoI,GAAG5C,MAAM9E,QAAO,IAAKiG;AACjC,QAAM0B,iBAAiB;AAEvB,SACE,6BAAA/B,QAAA,cAACC,OAAAA;IAAIC,eAAWC,0BAAG,QAAQjB,SAAS,SAAS,0BAA0B,aAAazC,UAAAA;KACjFrC,QAAQe,IAAI,CAACf,UAAS4H,MAAAA;AACrB,YAAQ5H,SAAQQ,MAAI;MAClB,KAAK,QAAQ;AACX,cAAM,EAAEqH,KAAK5B,SAAAA,SAAO,IAAK6B,aAAa9H,SAAQ+E,IAAI;AAClD,eACE,6BAAAa,QAAA,cAACC,OAAAA;UACCvE,KAAKsG;UACL9C,MAAK;UACLgB,eAAWC,
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\n/* eslint-disable no-console */\n\nimport React, { useEffect, useRef, useState } from 'react';\n\nimport { type AIServiceClient, AIServiceClientImpl, ObjectId, type Message } from '@dxos/assistant';\nimport type { ReactiveEchoObject } from '@dxos/echo-db';\nimport { SpaceId } from '@dxos/keys';\nimport { useClient, useConfig } from '@dxos/react-client';\nimport { ContextMenu, type ThemedClassName } from '@dxos/react-ui';\nimport { Icon, Input, Toolbar, useTranslation } from '@dxos/react-ui';\nimport { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { createSystemInstructions } from './system-instructions';\nimport { AUTOMATION_PLUGIN } from '../../meta';\n\nconst PROPERTIES_ASSISTANT_KEY = 'dxos.assistant.beta.properties';\n\nexport type AssistantPanelProps = ThemedClassName<{\n subject?: ReactiveEchoObject<any>;\n}>;\n\nexport const AssistantPanel = ({ subject, classNames }: AssistantPanelProps) => {\n const { t } = useTranslation(AUTOMATION_PLUGIN);\n const config = useConfig();\n const client = useClient();\n const aiClient = useRef<AIServiceClient>();\n const [contextSpaceId, setContextSpaceId] = useState<SpaceId | undefined>();\n const [threadId, setThreadId] = useState<ObjectId | undefined>();\n const [history, setHistory] = useState<Message[]>([]);\n const [input, setInput] = useState('');\n\n useEffect(() => {\n if (!aiClient.current) {\n const endpoint = config.values.runtime?.services?.ai?.server;\n if (!endpoint) {\n throw new Error('AI service endpoint is not configured');\n }\n aiClient.current = new AIServiceClientImpl({\n endpoint,\n });\n }\n\n queueMicrotask(async () => {\n const properties = client.spaces.default.properties;\n\n properties[PROPERTIES_ASSISTANT_KEY] ??= {};\n properties[PROPERTIES_ASSISTANT_KEY].contextSpaceId ??= SpaceId.random();\n properties[PROPERTIES_ASSISTANT_KEY].threadId ??= ObjectId.random();\n\n const contextSpaceId = properties[PROPERTIES_ASSISTANT_KEY].contextSpaceId;\n const threadId = properties[PROPERTIES_ASSISTANT_KEY].threadId;\n\n setContextSpaceId(contextSpaceId);\n setThreadId(threadId);\n\n const messages = await aiClient.current!.getMessagesInThread(contextSpaceId, threadId);\n setHistory(messages);\n });\n }, []);\n\n const handleRequest = async (input: string) => {\n if (input === '') {\n return;\n }\n\n setInput('');\n\n // TODO(dmaretskyi): Can we call `create(Message, { ... })` here?\n const userMessage: Message = {\n id: ObjectId.random(),\n spaceId: contextSpaceId!,\n threadId: threadId!,\n role: 'user',\n content: [{ type: 'text', text: input }],\n };\n await aiClient.current!.insertMessages([userMessage]);\n setHistory([...history, userMessage]);\n\n const generationStream = await aiClient.current!.generate({\n model: '@anthropic/claude-3-5-sonnet-20241022',\n spaceId: contextSpaceId!,\n threadId: threadId!,\n tools: [],\n systemPrompt: await getSystemPrompt(),\n });\n\n const historyBefore = [...history, userMessage];\n for await (const _event of generationStream) {\n setHistory([...historyBefore, ...generationStream.accumulatedMessages]);\n }\n\n await aiClient.current!.insertMessages(await generationStream.complete());\n };\n\n const getSystemPrompt = async () => {\n return createSystemInstructions({ subject });\n };\n\n const clearThread = async () => {\n const properties = client.spaces.default.properties;\n\n properties[PROPERTIES_ASSISTANT_KEY] ??= {};\n // properties[PROPERTIES_ASSISTANT_KEY].contextSpaceId ??= SpaceId.random();\n properties[PROPERTIES_ASSISTANT_KEY].threadId = ObjectId.random();\n\n // const contextSpaceId = properties[PROPERTIES_ASSISTANT_KEY].contextSpaceId;\n const threadId = properties[PROPERTIES_ASSISTANT_KEY].threadId;\n\n // setContextSpaceId(contextSpaceId);\n setThreadId(threadId);\n\n const messages = await aiClient.current!.getMessagesInThread(contextSpaceId!, threadId);\n setHistory(messages);\n };\n\n // TODO(burdon): Factor out with script plugin.\n return (\n <div className={mx('flex flex-col h-full overflow-hidden', classNames)}>\n {history.length > 0 && (\n <div className='flex flex-col gap-6 h-full p-2 overflow-x-hidden overflow-y-auto'>\n {history.map((message) => (\n <MessageItem key={message.id} message={message} />\n ))}\n </div>\n )}\n\n <Toolbar.Root classNames='p-1'>\n <Input.Root>\n <Input.TextInput\n autoFocus\n placeholder={t('ask me anything')}\n value={input}\n onChange={(ev) => setInput(ev.target.value)}\n onKeyDown={(ev) => ev.key === 'Enter' && handleRequest(input)}\n />\n </Input.Root>\n <ContextMenu.Root>\n <ContextMenu.Trigger asChild>\n <Toolbar.Button onClick={() => handleRequest(input)}>\n <Icon icon='ph--play--regular' size={4} />\n </Toolbar.Button>\n </ContextMenu.Trigger>\n <ContextMenu.Portal>\n <ContextMenu.Content>\n <ContextMenu.Viewport>\n <ContextMenu.Item onClick={clearThread}>Clear thread</ContextMenu.Item>\n <ContextMenu.Item onClick={async () => console.log(await getSystemPrompt())}>\n Print instructions to console\n </ContextMenu.Item>\n </ContextMenu.Viewport>\n </ContextMenu.Content>\n </ContextMenu.Portal>\n </ContextMenu.Root>\n\n {/* <Toolbar.Button onClick={() => (state ? handleStop() : handleClear())}>\n <Icon icon={state ? 'ph--stop--regular' : 'ph--trash--regular'} size={4} />\n </Toolbar.Button> */}\n </Toolbar.Root>\n </div>\n );\n};\n\nconst MessageItem = ({ classNames, message }: ThemedClassName<{ message: Message }>) => {\n const { id: _, role, content } = message;\n const styleContainer = 'flex flex-col overflow-x-hidden overflow-y-auto rounded-md gap-2 divide-y divide-separator';\n\n return (\n <div className={mx('flex', role === 'user' ? 'ml-[1rem] justify-end' : 'mr-[1rem]', classNames)}>\n {content.map((content, i) => {\n switch (content.type) {\n case 'text': {\n const { cot, message } = parseMessage(content.text);\n return (\n <div\n key={i}\n role='none'\n className={mx(styleContainer, role === 'user' ? 'bg-accentSurface' : 'bg-input')}\n >\n {cot && <div className='p-2 whitespace-pre-wrap text-xs text-subdued'>{cot}</div>}\n <div className='p-2 whitespace-pre-wrap'>{message}</div>\n </div>\n );\n }\n\n case 'tool_use': {\n return (\n <div key={i} className={mx(styleContainer, 'text-xs')}>\n <div>\n <span className='p-2 text-primary'>Tool use</span>: {content.name} {content.id}\n </div>\n <SyntaxHighlighter language='json'>{content.inputJson}</SyntaxHighlighter>\n </div>\n );\n }\n\n case 'tool_result': {\n return (\n <div key={i} className={mx(styleContainer, 'text-xs', content.isError && 'text-error')}>\n <div>\n <span className='p-2 text-primary'>Tool result</span>: {content.toolUseId}\n </div>\n <SyntaxHighlighter language='json'>{content.content}</SyntaxHighlighter>\n </div>\n );\n }\n }\n\n return null;\n })}\n </div>\n );\n};\n\n// TODO(burdon): Move to server-side parsing.\nconst parseMessage = (text: string): { cot?: string; message: string } => {\n const regex = /<cot>([\\s\\S]*?)<\\/cot>\\s*([\\s\\S]*)/;\n const match = text.match(regex);\n return {\n cot: match?.[1].trim(),\n message: match?.[2] ?? text ?? '\\u00D8',\n };\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { asyncTimeout } from '@dxos/async';\nimport type { ReactiveEchoObject } from '@dxos/echo-db';\nimport { getTypename } from '@dxos/echo-schema';\nimport { log } from '@dxos/log';\nimport { Filter, getSpace, ResultFormat } from '@dxos/react-client/echo';\n\n// TODO(burdon): Move into assistant-protocol.\nexport type ThreadContext = {\n subject?: ReactiveEchoObject<any>;\n};\n\nexport const createSystemInstructions = async (context: ThreadContext): Promise<string> => {\n let instructions = `\n <instructions>\n Before replying always think step-by-step on how to proceed.\n Print your thoughts inside <cot> tags.\n\n <example>\n <cot>To answer the question I need to ...</cot>\n </example>\n </instructions>\n\n <current_time>${new Date().toLocaleString()}</current_time>\n `;\n\n if (context.subject) {\n instructions += `\n <user_attention>\n The user is currently interacting with an object in Composer application:\n\n ${await formatContextObject(context.subject)}\n </user_attention>\n `;\n }\n\n return looseFormatXml(instructions);\n};\n\nconst formatContextObject = async (object: ReactiveEchoObject<any>): Promise<string> => {\n let data;\n try {\n data = await asyncTimeout(preprocessContextObject(object), CONTEXT_OBJECT_QUERY_TIMEOUT);\n } catch (err: any) {\n log.error('Failed to preprocess context object:', { err });\n data = object;\n }\n\n if (typeof data === 'string') {\n return data;\n } else {\n return `\n <object>\n <type>${getTypename(object)}</type>\n <id>${object.id}</id>\n ${formatObjectAsXMLTags(data)}\n </object>\n `;\n }\n};\n\nconst preprocessContextObject = async (object: ReactiveEchoObject<any>): Promise<Record<string, any> | string> => {\n const space = getSpace(object);\n if (!space) {\n return { ...object };\n }\n\n // TODO(dmaretskyi): Serialize based on schema annotations.\n switch (getTypename(object)) {\n // TODO(dmaretskyi): Reference types somehow without plugin-automation depending on other plugins.\n case 'dxos.org/type/Document': {\n const data = space.db\n .query({ id: object.id }, { format: ResultFormat.Plain, include: { content: true } })\n .first() ?? { content: { content: '' } };\n\n return {\n ...data,\n threads: undefined,\n };\n }\n\n case 'dxos.org/type/Table': {\n // TODO(dmaretskyi): Load references.\n const schema = object.view ? space?.db.schemaRegistry.getSchema(object.view.query.type) : undefined;\n const { objects: rows } =\n (schema &&\n (await space.db\n .query(Filter.schema(schema), { format: ResultFormat.Plain, limit: TABLE_ROWS_LIMIT })\n .run())) ??\n {};\n\n // TODO(dmaretskyi): Format table schema.\n return `\n <object>\n <id>${object.id}</id>\n <type>${getTypename(object)}</type>\n ${formatObjectAsXMLTags(object)}\n\n <rows>\n <!-- Limited to first ${TABLE_ROWS_LIMIT} rows. -->\n ${rows\n ?.map(\n (row: any) => `<row>\n ${formatObjectAsXMLTags(row)}\n </row>`,\n )\n .join('\\n')}\n </rows>\n\n `;\n }\n\n default:\n return { ...object };\n }\n};\n\nconst formatObjectAsXMLTags = (object: any, depth = 1): string => {\n return Object.entries(object)\n .filter(([key, value]) => ['string', 'number', 'boolean', 'object'].includes(typeof value))\n .map(([key, value]) => {\n if (typeof value === 'object' && value !== null) {\n if (depth === 0) {\n return '';\n } else {\n return `<${key}>\n ${formatObjectAsXMLTags(value, depth - 1)}\n </${key}>`;\n }\n }\n\n return `<${key}>${value}</${key}>`;\n })\n .join('\\n');\n};\n\nconst CONTEXT_OBJECT_QUERY_TIMEOUT = 5_000;\n\nconst TABLE_ROWS_LIMIT = 10;\n\n/**\n * Formats XML indentation for instructions so they are easier to read during debugging.\n */\nconst looseFormatXml = (xml: string): string => {\n let currentIndent = 0;\n\n return xml\n .split('\\n')\n .map((line) => {\n if (line.match(RE_CLOSE_TAG_LINE)) {\n currentIndent--;\n }\n const indent = currentIndent;\n if (line.match(RE_OPEN_TAG_LINE)) {\n currentIndent++;\n }\n return ' '.repeat(indent * 2) + line.trimStart();\n })\n .join('\\n');\n};\n\nconst RE_OPEN_TAG_LINE = /^[ ]*<[a-zA-Z0-9\\-_]+>[ ]*$/;\nconst RE_CLOSE_TAG_LINE = /^[ ]*<\\/[a-zA-Z0-9\\-_]+>[ ]*$/;\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { AssistantPanel } from './AssistantPanel';\n\nexport default AssistantPanel;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,mBAAmD;AAEnD,uBAAkF;AAElF,kBAAwB;AACxB,0BAAqC;AACrC,sBAAkD;AAClD,IAAAA,mBAAqD;AACrD,yCAAkC;AAClC,4BAAmB;ACXnB,mBAA6B;AAE7B,yBAA4B;AAC5B,iBAAoB;AACpB,kBAA+C;;AAOxC,IAAMC,2BAA2B,OAAOC,YAAAA;AAC7C,MAAIC,eAAe;;;;;;;;;;qBAUD,oBAAIC,KAAAA,GAAOC,eAAc,CAAA;;AAG3C,MAAIH,QAAQI,SAAS;AACnBH,oBAAgB;;;;UAIV,MAAMI,oBAAoBL,QAAQI,OAAO,CAAA;;;EAGjD;AAEA,SAAOE,eAAeL,YAAAA;AACxB;AAEA,IAAMI,sBAAsB,OAAOE,WAAAA;AACjC,MAAIC;AACJ,MAAI;AACFA,WAAO,UAAMC,2BAAaC,wBAAwBH,MAAAA,GAASI,4BAAAA;EAC7D,SAASC,KAAU;AACjBC,mBAAIC,MAAM,wCAAwC;MAAEF;IAAI,GAAA;;;;;;AACxDJ,WAAOD;EACT;AAEA,MAAI,OAAOC,SAAS,UAAU;AAC5B,WAAOA;EACT,OAAO;AACL,WAAO;;oBAEKO,gCAAYR,MAAAA,CAAAA;cACdA,OAAOS,EAAE;UACbC,sBAAsBT,IAAAA,CAAAA;;;EAG9B;AACF;AAEA,IAAME,0BAA0B,OAAOH,WAAAA;AACr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AAA,MACC,6BAAAD,QAAA,cAACmC,QAAAA;UAAKjC,WAAU;WAAmB,UAAA,GAAe,MAAG9F,SAAQgI,MAAK,KAAEhI,SAAQV,EAAE,GAEhF,6BAAAsG,QAAA,cAACqC,sDAAAA;UAAkBC,UAAS;WAAQlI,SAAQmI,SAAS,CAAA;MAG3D;MAEA,KAAK,eAAe;AAClB,eACE,6BAAAvC,QAAA,cAACC,OAAAA;UAAIvE,KAAKsG;UAAG9B,eAAWC,0BAAG4B,gBAAgB,WAAW3H,SAAQoI,WAAW,YAAA;WACvE,6BAAAxC,QAAA,cAACC,OAAAA,MACC,6BAAAD,QAAA,cAACmC,QAAAA;UAAKjC,WAAU;WAAmB,aAAA,GAAkB,MAAG9F,SAAQqI,SAAS,GAE3E,6BAAAzC,QAAA,cAACqC,sDAAAA;UAAkBC,UAAS;WAAQlI,SAAQA,OAAO,CAAA;MAGzD;IACF;AAEA,WAAO;EACT,CAAA,CAAA;AAGN;AAGA,IAAM8H,eAAe,CAAC/C,SAAAA;AACpB,QAAMuD,QAAQ;AACd,QAAMzG,QAAQkD,KAAKlD,MAAMyG,KAAAA;AACzB,SAAO;IACLT,KAAKhG,QAAQ,CAAA,EAAG0G,KAAAA;IAChBtC,SAASpE,QAAQ,CAAA,KAAMkD,QAAQ;EACjC;AACF;AE5NA,IAAA,yBAAe3C;",
|
|
6
6
|
"names": ["import_react_ui", "createSystemInstructions", "context", "instructions", "Date", "toLocaleString", "subject", "formatContextObject", "looseFormatXml", "object", "data", "asyncTimeout", "preprocessContextObject", "CONTEXT_OBJECT_QUERY_TIMEOUT", "err", "log", "error", "getTypename", "id", "formatObjectAsXMLTags", "space", "getSpace", "db", "query", "format", "ResultFormat", "Plain", "include", "content", "first", "threads", "undefined", "schema", "view", "schemaRegistry", "getSchema", "type", "objects", "rows", "Filter", "limit", "TABLE_ROWS_LIMIT", "run", "map", "row", "join", "depth", "Object", "entries", "filter", "key", "value", "includes", "xml", "currentIndent", "split", "line", "match", "RE_CLOSE_TAG_LINE", "indent", "RE_OPEN_TAG_LINE", "repeat", "trimStart", "PROPERTIES_ASSISTANT_KEY", "AssistantPanel", "classNames", "t", "useTranslation", "AUTOMATION_PLUGIN", "config", "useConfig", "client", "useClient", "aiClient", "useRef", "contextSpaceId", "setContextSpaceId", "useState", "threadId", "setThreadId", "history", "setHistory", "input", "setInput", "useEffect", "current", "endpoint", "values", "runtime", "services", "ai", "server", "Error", "AIServiceClientImpl", "queueMicrotask", "properties", "spaces", "default", "SpaceId", "random", "ObjectId", "messages", "getMessagesInThread", "handleRequest", "userMessage", "spaceId", "role", "text", "insertMessages", "generationStream", "generate", "model", "tools", "systemPrompt", "getSystemPrompt", "historyBefore", "_event", "accumulatedMessages", "complete", "clearThread", "React", "div", "className", "mx", "length", "message", "MessageItem", "Toolbar", "Root", "Input", "TextInput", "autoFocus", "placeholder", "onChange", "ev", "target", "onKeyDown", "ContextMenu", "Trigger", "asChild", "Button", "onClick", "Icon", "icon", "size", "Portal", "Content", "Viewport", "Item", "console", "_", "styleContainer", "i", "cot", "parseMessage", "span", "name", "SyntaxHighlighter", "language", "inputJson", "isError", "toolUseId", "regex", "trim"]
|
|
7
7
|
}
|
|
@@ -26,12 +26,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var AutomationPanel_H5WE4FIU_exports = {};
|
|
30
|
+
__export(AutomationPanel_H5WE4FIU_exports, {
|
|
31
31
|
default: () => AutomationPanel_default
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
var
|
|
33
|
+
module.exports = __toCommonJS(AutomationPanel_H5WE4FIU_exports);
|
|
34
|
+
var import_chunk_TQEDPRY5 = require("./chunk-TQEDPRY5.cjs");
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
36
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
37
37
|
var import_functions = require("@dxos/functions");
|
|
@@ -45,8 +45,8 @@ var import_functions2 = require("@dxos/functions");
|
|
|
45
45
|
var import_echo2 = require("@dxos/react-client/echo");
|
|
46
46
|
var import_react_ui2 = require("@dxos/react-ui");
|
|
47
47
|
var import_react_ui_form = require("@dxos/react-ui-form");
|
|
48
|
-
var TriggerEditor = ({ space, trigger, onSave, onCancel
|
|
49
|
-
const { t } = (0, import_react_ui2.useTranslation)(
|
|
48
|
+
var TriggerEditor = ({ space, trigger, onSave, onCancel }) => {
|
|
49
|
+
const { t } = (0, import_react_ui2.useTranslation)(import_chunk_TQEDPRY5.AUTOMATION_PLUGIN);
|
|
50
50
|
const functions = (0, import_echo2.useQuery)(space, import_echo2.Filter.schema(import_functions2.FunctionType));
|
|
51
51
|
const scripts = (0, import_echo2.useQuery)(space, import_echo2.Filter.schema(import_functions2.ScriptType));
|
|
52
52
|
const handleSave = (values) => {
|
|
@@ -55,7 +55,6 @@ var TriggerEditor = ({ space, trigger, onSave, onCancel, storedTrigger }) => {
|
|
|
55
55
|
return /* @__PURE__ */ import_react2.default.createElement(import_react_ui_form.Form, {
|
|
56
56
|
schema: import_functions2.FunctionTriggerSchema,
|
|
57
57
|
values: trigger,
|
|
58
|
-
filter: (props) => props.filter((p) => p.name !== "meta"),
|
|
59
58
|
onSave: handleSave,
|
|
60
59
|
onCancel,
|
|
61
60
|
Custom: {
|
|
@@ -72,7 +71,68 @@ var TriggerEditor = ({ space, trigger, onSave, onCancel, storedTrigger }) => {
|
|
|
72
71
|
value: kind,
|
|
73
72
|
label: t(`trigger type ${kind}`)
|
|
74
73
|
}))
|
|
75
|
-
})
|
|
74
|
+
}),
|
|
75
|
+
["meta"]: (props) => {
|
|
76
|
+
const meta = props.getValue();
|
|
77
|
+
const [newMetaFieldName, setNewMetaFieldName] = (0, import_react2.useState)("");
|
|
78
|
+
import_react2.default.useEffect(() => props.onValueChange("object", {
|
|
79
|
+
...meta
|
|
80
|
+
}), []);
|
|
81
|
+
return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement("div", null, props.label), [
|
|
82
|
+
...Object.keys(meta)
|
|
83
|
+
].map((key) => {
|
|
84
|
+
const compositeKey = `meta.${key}`;
|
|
85
|
+
return /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
86
|
+
key: compositeKey,
|
|
87
|
+
role: "none",
|
|
88
|
+
className: "flex items-center mt-2 gap-1"
|
|
89
|
+
}, /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
90
|
+
role: "none",
|
|
91
|
+
className: "flex-1"
|
|
92
|
+
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui_form.TextInput, {
|
|
93
|
+
...props,
|
|
94
|
+
type: "string",
|
|
95
|
+
label: key
|
|
96
|
+
})), /* @__PURE__ */ import_react2.default.createElement(import_react_ui2.IconButton, {
|
|
97
|
+
icon: "ph--trash--regular",
|
|
98
|
+
iconOnly: true,
|
|
99
|
+
classNames: "mt-6",
|
|
100
|
+
label: t("trigger meta remove"),
|
|
101
|
+
onClick: () => {
|
|
102
|
+
const newValues = {
|
|
103
|
+
...props.getValue()
|
|
104
|
+
};
|
|
105
|
+
delete newValues[key];
|
|
106
|
+
props.onValueChange("object", newValues);
|
|
107
|
+
}
|
|
108
|
+
}));
|
|
109
|
+
}), /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
110
|
+
role: "none",
|
|
111
|
+
className: "flex items-center mt-2 gap-1 plb-1"
|
|
112
|
+
}, /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
113
|
+
role: "none",
|
|
114
|
+
className: "flex-1"
|
|
115
|
+
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui2.Input.Root, null, /* @__PURE__ */ import_react2.default.createElement(import_react_ui2.Input.TextInput, {
|
|
116
|
+
placeholder: t("trigger meta prop name placeholder"),
|
|
117
|
+
value: newMetaFieldName,
|
|
118
|
+
onChange: (event) => setNewMetaFieldName(event.target.value)
|
|
119
|
+
}))), /* @__PURE__ */ import_react2.default.createElement(import_react_ui2.IconButton, {
|
|
120
|
+
icon: "ph--plus--regular",
|
|
121
|
+
iconOnly: true,
|
|
122
|
+
label: t("trigger meta add"),
|
|
123
|
+
onClick: () => {
|
|
124
|
+
if (newMetaFieldName.length) {
|
|
125
|
+
const meta2 = props.getValue() ?? {};
|
|
126
|
+
const metaWithNewProp = {
|
|
127
|
+
...meta2,
|
|
128
|
+
[newMetaFieldName]: ""
|
|
129
|
+
};
|
|
130
|
+
setNewMetaFieldName("");
|
|
131
|
+
props.onValueChange("object", metaWithNewProp);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
})));
|
|
135
|
+
}
|
|
76
136
|
}
|
|
77
137
|
});
|
|
78
138
|
};
|
|
@@ -80,8 +140,8 @@ var getFunctionName = (scripts, fn) => {
|
|
|
80
140
|
return scripts.find((s) => fn.source?.target?.id === s.id)?.name ?? fn.name;
|
|
81
141
|
};
|
|
82
142
|
var grid = "grid grid-cols-[40px_1fr_32px] min-bs-[2.5rem]";
|
|
83
|
-
var AutomationPanel = ({ space }) => {
|
|
84
|
-
const { t } = (0, import_react_ui.useTranslation)(
|
|
143
|
+
var AutomationPanel = ({ space, object }) => {
|
|
144
|
+
const { t } = (0, import_react_ui.useTranslation)(import_chunk_TQEDPRY5.AUTOMATION_PLUGIN);
|
|
85
145
|
const client = (0, import_react_client.useClient)();
|
|
86
146
|
const triggers = (0, import_echo.useQuery)(space, import_echo.Filter.schema(import_functions.FunctionTrigger));
|
|
87
147
|
const functions = (0, import_echo.useQuery)(space, import_echo.Filter.schema(import_functions.FunctionType));
|
|
@@ -94,7 +154,9 @@ var AutomationPanel = ({ space }) => {
|
|
|
94
154
|
setSelected(trigger2);
|
|
95
155
|
};
|
|
96
156
|
const handleAdd = () => {
|
|
97
|
-
setTrigger((0, import_echo.create)(import_functions.FunctionTriggerSchema, {
|
|
157
|
+
setTrigger((0, import_echo.create)(import_functions.FunctionTriggerSchema, {
|
|
158
|
+
meta: {}
|
|
159
|
+
}));
|
|
98
160
|
setSelected(void 0);
|
|
99
161
|
};
|
|
100
162
|
const handleDelete = (trigger2) => {
|
|
@@ -123,25 +185,27 @@ var AutomationPanel = ({ space }) => {
|
|
|
123
185
|
}, ({ items: triggers2 }) => /* @__PURE__ */ import_react.default.createElement("div", {
|
|
124
186
|
role: "list",
|
|
125
187
|
className: "flex flex-col w-full"
|
|
126
|
-
}, triggers2?.map((trigger2) =>
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
188
|
+
}, triggers2?.map((trigger2) => {
|
|
189
|
+
const copyAction = getCopyAction(client, trigger2);
|
|
190
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react_ui_list.List.Item, {
|
|
191
|
+
key: trigger2.id,
|
|
192
|
+
item: trigger2,
|
|
193
|
+
classNames: (0, import_react_ui_theme.mx)(grid, import_react_ui_theme.ghostHover, "items-center", "px-2")
|
|
194
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_react_ui.Input.Root, null, /* @__PURE__ */ import_react.default.createElement(import_react_ui.Input.Switch, {
|
|
195
|
+
checked: trigger2.enabled,
|
|
196
|
+
onCheckedChange: (checked) => trigger2.enabled = checked
|
|
197
|
+
})), /* @__PURE__ */ import_react.default.createElement("div", {
|
|
198
|
+
className: "flex"
|
|
199
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_react_ui_list.List.ItemTitle, {
|
|
200
|
+
classNames: "px-1 cursor-pointer w-0 shrink truncate",
|
|
201
|
+
onClick: () => handleSelect(trigger2)
|
|
202
|
+
}, getFunctionName2(scripts, functions, trigger2) ?? "\u2205"), copyAction && /* @__PURE__ */ import_react.default.createElement(import_react_ui.Button, {
|
|
203
|
+
onClick: () => navigator.clipboard.writeText(copyAction.contentProvider())
|
|
204
|
+
}, t(copyAction.translationKey))), /* @__PURE__ */ import_react.default.createElement(import_react_ui_list.List.ItemDeleteButton, {
|
|
205
|
+
onClick: () => handleDelete(trigger2)
|
|
206
|
+
}));
|
|
207
|
+
}))), trigger && /* @__PURE__ */ import_react.default.createElement(TriggerEditor, {
|
|
143
208
|
space,
|
|
144
|
-
storedTrigger: selected,
|
|
145
209
|
trigger,
|
|
146
210
|
onSave: handleSave,
|
|
147
211
|
onCancel: handleCancel
|
|
@@ -153,6 +217,21 @@ var AutomationPanel = ({ space }) => {
|
|
|
153
217
|
onClick: handleAdd
|
|
154
218
|
})));
|
|
155
219
|
};
|
|
220
|
+
var getCopyAction = (client, trigger) => {
|
|
221
|
+
if (trigger?.spec?.type === import_functions.TriggerKind.Email) {
|
|
222
|
+
return {
|
|
223
|
+
translationKey: "trigger copy email",
|
|
224
|
+
contentProvider: () => `${(0, import_echo.getSpace)(trigger).id}@dxos.network`
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
if (trigger?.spec?.type === import_functions.TriggerKind.Webhook) {
|
|
228
|
+
return {
|
|
229
|
+
translationKey: "trigger copy url",
|
|
230
|
+
contentProvider: () => getWebhookUrl(client, trigger)
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
return void 0;
|
|
234
|
+
};
|
|
156
235
|
var getWebhookUrl = (client, trigger) => {
|
|
157
236
|
const spaceId = (0, import_echo.getSpace)(trigger).id;
|
|
158
237
|
const edgeUrl = new URL(client.config.values.runtime.services.edge.url);
|
|
@@ -161,11 +240,12 @@ var getWebhookUrl = (client, trigger) => {
|
|
|
161
240
|
return new URL(`/webhook/${spaceId}:${trigger.id}`, edgeUrl).toString();
|
|
162
241
|
};
|
|
163
242
|
var getFunctionName2 = (scripts, functions, trigger) => {
|
|
243
|
+
const shortId = trigger.function && `${trigger.function?.slice(0, 16)}\u2026`;
|
|
164
244
|
const functionObject = functions.find((fn) => fn.name === trigger.function);
|
|
165
245
|
if (!functionObject) {
|
|
166
|
-
return
|
|
246
|
+
return shortId;
|
|
167
247
|
}
|
|
168
|
-
return scripts.find((s) => functionObject.source?.target?.id === s.id)?.name ??
|
|
248
|
+
return scripts.find((s) => functionObject.source?.target?.id === s.id)?.name ?? shortId;
|
|
169
249
|
};
|
|
170
250
|
var AutomationPanel_default = AutomationPanel;
|
|
171
|
-
//# sourceMappingURL=AutomationPanel-
|
|
251
|
+
//# sourceMappingURL=AutomationPanel-H5WE4FIU.cjs.map
|