@dxos/plugin-automation 0.8.2-main.f11618f → 0.8.2-staging.7ac8446

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 (139) hide show
  1. package/dist/lib/browser/{chunk-NGG4ICAQ.mjs → AutomationPanel-YAHFXQX6.mjs} +12 -13
  2. package/dist/lib/browser/AutomationPanel-YAHFXQX6.mjs.map +7 -0
  3. package/dist/lib/browser/{app-graph-builder-ND64CHOM.mjs → app-graph-builder-K3BIQFWW.mjs} +1 -42
  4. package/dist/lib/browser/app-graph-builder-K3BIQFWW.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-MT3FZH4V.mjs +8 -0
  6. package/dist/lib/browser/chunk-MT3FZH4V.mjs.map +7 -0
  7. package/dist/lib/browser/index.mjs +17 -23
  8. package/dist/lib/browser/index.mjs.map +3 -3
  9. package/dist/lib/browser/meta.json +1 -1
  10. package/dist/lib/browser/react-surface-4QQSJR4A.mjs +42 -0
  11. package/dist/lib/browser/react-surface-4QQSJR4A.mjs.map +7 -0
  12. package/dist/lib/node/{chunk-SRXHHBDE.cjs → AutomationPanel-ZKAMIU6O.cjs} +14 -19
  13. package/dist/lib/node/AutomationPanel-ZKAMIU6O.cjs.map +7 -0
  14. package/dist/lib/node/{app-graph-builder-TVFR6RXO.cjs → app-graph-builder-HO4FPGZ5.cjs} +4 -45
  15. package/dist/lib/node/app-graph-builder-HO4FPGZ5.cjs.map +7 -0
  16. package/dist/lib/node/{chunk-L5TWLPGA.cjs → chunk-AGJ6XTDN.cjs} +7 -16
  17. package/dist/lib/node/chunk-AGJ6XTDN.cjs.map +7 -0
  18. package/dist/lib/node/index.cjs +17 -23
  19. package/dist/lib/node/index.cjs.map +3 -3
  20. package/dist/lib/node/meta.json +1 -1
  21. package/dist/lib/node/{react-surface-PCZCHIET.cjs → react-surface-52M54VWV.cjs} +12 -36
  22. package/dist/lib/node/react-surface-52M54VWV.cjs.map +7 -0
  23. package/dist/lib/node-esm/{chunk-HMYAQLGF.mjs → AutomationPanel-XF7YPSKM.mjs} +12 -13
  24. package/dist/lib/node-esm/AutomationPanel-XF7YPSKM.mjs.map +7 -0
  25. package/dist/lib/node-esm/{app-graph-builder-NYLOXWVV.mjs → app-graph-builder-XCJR33VS.mjs} +1 -42
  26. package/dist/lib/node-esm/app-graph-builder-XCJR33VS.mjs.map +7 -0
  27. package/dist/lib/node-esm/chunk-OA75PSGH.mjs +10 -0
  28. package/dist/lib/node-esm/chunk-OA75PSGH.mjs.map +7 -0
  29. package/dist/lib/node-esm/index.mjs +17 -23
  30. package/dist/lib/node-esm/index.mjs.map +3 -3
  31. package/dist/lib/node-esm/meta.json +1 -1
  32. package/dist/lib/node-esm/react-surface-MGKM3OO3.mjs +43 -0
  33. package/dist/lib/node-esm/react-surface-MGKM3OO3.mjs.map +7 -0
  34. package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
  35. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  36. package/dist/types/src/capabilities/index.d.ts +0 -1
  37. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  38. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  39. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +3 -6
  40. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
  41. package/dist/types/src/components/AutomationPanel/index.d.ts +0 -1
  42. package/dist/types/src/components/AutomationPanel/index.d.ts.map +1 -1
  43. package/dist/types/src/components/index.d.ts +1 -8
  44. package/dist/types/src/components/index.d.ts.map +1 -1
  45. package/dist/types/src/translations.d.ts +0 -8
  46. package/dist/types/src/translations.d.ts.map +1 -1
  47. package/package.json +24 -29
  48. package/src/AutomationPlugin.tsx +9 -4
  49. package/src/capabilities/app-graph-builder.ts +0 -31
  50. package/src/capabilities/index.ts +0 -1
  51. package/src/capabilities/react-surface.tsx +7 -31
  52. package/src/components/AutomationPanel/AutomationPanel.stories.tsx +4 -4
  53. package/src/components/AutomationPanel/AutomationPanel.tsx +63 -62
  54. package/src/components/AutomationPanel/index.ts +0 -2
  55. package/src/components/TriggerEditor/TriggerEditor.stories.tsx +3 -3
  56. package/src/components/index.ts +0 -3
  57. package/src/translations.ts +1 -10
  58. package/dist/lib/browser/AutomationContainer-KEQ5RNIW.mjs +0 -34
  59. package/dist/lib/browser/AutomationContainer-KEQ5RNIW.mjs.map +0 -7
  60. package/dist/lib/browser/AutomationPanel-G3OB6ELR.mjs +0 -11
  61. package/dist/lib/browser/AutomationPanel-G3OB6ELR.mjs.map +0 -7
  62. package/dist/lib/browser/FunctionsContainer-STXBW4CX.mjs +0 -33
  63. package/dist/lib/browser/FunctionsContainer-STXBW4CX.mjs.map +0 -7
  64. package/dist/lib/browser/FunctionsPanel-JJPLIAJW.mjs +0 -10
  65. package/dist/lib/browser/FunctionsPanel-JJPLIAJW.mjs.map +0 -7
  66. package/dist/lib/browser/app-graph-builder-ND64CHOM.mjs.map +0 -7
  67. package/dist/lib/browser/chunk-65VL4EYS.mjs +0 -88
  68. package/dist/lib/browser/chunk-65VL4EYS.mjs.map +0 -7
  69. package/dist/lib/browser/chunk-FCLWFVFX.mjs +0 -39
  70. package/dist/lib/browser/chunk-FCLWFVFX.mjs.map +0 -7
  71. package/dist/lib/browser/chunk-NGG4ICAQ.mjs.map +0 -7
  72. package/dist/lib/browser/chunk-QJPKWYTL.mjs +0 -14
  73. package/dist/lib/browser/chunk-QJPKWYTL.mjs.map +0 -7
  74. package/dist/lib/browser/intent-resolver-SNIAQ7V5.mjs +0 -78
  75. package/dist/lib/browser/intent-resolver-SNIAQ7V5.mjs.map +0 -7
  76. package/dist/lib/browser/react-surface-L22QIANU.mjs +0 -68
  77. package/dist/lib/browser/react-surface-L22QIANU.mjs.map +0 -7
  78. package/dist/lib/browser/types.mjs +0 -8
  79. package/dist/lib/browser/types.mjs.map +0 -7
  80. package/dist/lib/node/AutomationContainer-E5I76FPP.cjs +0 -62
  81. package/dist/lib/node/AutomationContainer-E5I76FPP.cjs.map +0 -7
  82. package/dist/lib/node/AutomationPanel-YLXAFJDP.cjs +0 -32
  83. package/dist/lib/node/AutomationPanel-YLXAFJDP.cjs.map +0 -7
  84. package/dist/lib/node/FunctionsContainer-3HCURMEB.cjs +0 -61
  85. package/dist/lib/node/FunctionsContainer-3HCURMEB.cjs.map +0 -7
  86. package/dist/lib/node/FunctionsPanel-SYIZHPGU.cjs +0 -31
  87. package/dist/lib/node/FunctionsPanel-SYIZHPGU.cjs.map +0 -7
  88. package/dist/lib/node/app-graph-builder-TVFR6RXO.cjs.map +0 -7
  89. package/dist/lib/node/chunk-BSK5SHTR.cjs +0 -116
  90. package/dist/lib/node/chunk-BSK5SHTR.cjs.map +0 -7
  91. package/dist/lib/node/chunk-L5TWLPGA.cjs.map +0 -7
  92. package/dist/lib/node/chunk-PSIJDHAX.cjs +0 -58
  93. package/dist/lib/node/chunk-PSIJDHAX.cjs.map +0 -7
  94. package/dist/lib/node/chunk-SRXHHBDE.cjs.map +0 -7
  95. package/dist/lib/node/intent-resolver-A44BNFEG.cjs +0 -94
  96. package/dist/lib/node/intent-resolver-A44BNFEG.cjs.map +0 -7
  97. package/dist/lib/node/react-surface-PCZCHIET.cjs.map +0 -7
  98. package/dist/lib/node/types.cjs +0 -30
  99. package/dist/lib/node/types.cjs.map +0 -7
  100. package/dist/lib/node-esm/AutomationContainer-22PUFPSE.mjs +0 -35
  101. package/dist/lib/node-esm/AutomationContainer-22PUFPSE.mjs.map +0 -7
  102. package/dist/lib/node-esm/AutomationPanel-6UXIAJVS.mjs +0 -12
  103. package/dist/lib/node-esm/AutomationPanel-6UXIAJVS.mjs.map +0 -7
  104. package/dist/lib/node-esm/FunctionsContainer-XG5WVAN3.mjs +0 -34
  105. package/dist/lib/node-esm/FunctionsContainer-XG5WVAN3.mjs.map +0 -7
  106. package/dist/lib/node-esm/FunctionsPanel-J3QGUESH.mjs +0 -11
  107. package/dist/lib/node-esm/FunctionsPanel-J3QGUESH.mjs.map +0 -7
  108. package/dist/lib/node-esm/app-graph-builder-NYLOXWVV.mjs.map +0 -7
  109. package/dist/lib/node-esm/chunk-4UPGANGV.mjs +0 -89
  110. package/dist/lib/node-esm/chunk-4UPGANGV.mjs.map +0 -7
  111. package/dist/lib/node-esm/chunk-HMYAQLGF.mjs.map +0 -7
  112. package/dist/lib/node-esm/chunk-TMMB5ETD.mjs +0 -16
  113. package/dist/lib/node-esm/chunk-TMMB5ETD.mjs.map +0 -7
  114. package/dist/lib/node-esm/chunk-YYBCQXB2.mjs +0 -40
  115. package/dist/lib/node-esm/chunk-YYBCQXB2.mjs.map +0 -7
  116. package/dist/lib/node-esm/intent-resolver-JFLTVJ7D.mjs +0 -79
  117. package/dist/lib/node-esm/intent-resolver-JFLTVJ7D.mjs.map +0 -7
  118. package/dist/lib/node-esm/react-surface-VSO4NWC6.mjs +0 -69
  119. package/dist/lib/node-esm/react-surface-VSO4NWC6.mjs.map +0 -7
  120. package/dist/lib/node-esm/types.mjs +0 -9
  121. package/dist/lib/node-esm/types.mjs.map +0 -7
  122. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  123. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  124. package/dist/types/src/components/AutomationContainer.d.ts +0 -7
  125. package/dist/types/src/components/AutomationContainer.d.ts.map +0 -1
  126. package/dist/types/src/components/FunctionsContainer.d.ts +0 -7
  127. package/dist/types/src/components/FunctionsContainer.d.ts.map +0 -1
  128. package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts +0 -7
  129. package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts.map +0 -1
  130. package/dist/types/src/components/FunctionsPanel/index.d.ts +0 -4
  131. package/dist/types/src/components/FunctionsPanel/index.d.ts.map +0 -1
  132. package/dist/types/src/types.d.ts +0 -25
  133. package/dist/types/src/types.d.ts.map +0 -1
  134. package/src/capabilities/intent-resolver.ts +0 -76
  135. package/src/components/AutomationContainer.tsx +0 -31
  136. package/src/components/FunctionsContainer.tsx +0 -31
  137. package/src/components/FunctionsPanel/FunctionsPanel.tsx +0 -95
  138. package/src/components/FunctionsPanel/index.ts +0 -8
  139. package/src/types.ts +0 -32
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/app-graph-builder.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities, contributes, type PluginsContext } from '@dxos/app-framework';\nimport { isInstanceOf } from '@dxos/echo-schema';\nimport { ScriptType } from '@dxos/functions';\nimport { PLANK_COMPANION_TYPE, ATTENDABLE_PATH_SEPARATOR } from '@dxos/plugin-deck/types';\nimport { createExtension, type Node } from '@dxos/plugin-graph';\nimport { SCRIPT_PLUGIN } from '@dxos/plugin-script/types';\nimport { SPACE_PLUGIN } from '@dxos/plugin-space';\n\nimport { meta } from '../meta';\n\nexport default (context: PluginsContext) =>\n contributes(Capabilities.AppGraphBuilder, [\n createExtension({\n id: `${meta.id}/space-settings-automation`,\n filter: (node): node is Node<null> => node.type === `${SPACE_PLUGIN}/settings`,\n connector: ({ node }) => [\n {\n id: `automation-${node.id}`,\n type: `${meta.id}/space-settings-automation`,\n data: `${meta.id}/space-settings-automation`,\n properties: {\n label: ['automation panel label', { ns: meta.id }],\n icon: 'ph--lightning--regular',\n },\n },\n ],\n }),\n createExtension({\n id: `${meta.id}/space-settings-functions`,\n filter: (node): node is Node<null> => node.type === `${SPACE_PLUGIN}/settings`,\n connector: ({ node }) => [\n {\n id: `functions-${node.id}`,\n type: `${meta.id}/space-settings-functions`,\n data: `${meta.id}/space-settings-functions`,\n properties: {\n label: ['functions panel label', { ns: meta.id }],\n icon: 'ph--function--regular',\n },\n },\n ],\n }),\n createExtension({\n id: `${SCRIPT_PLUGIN}/script-companion`,\n filter: (node): node is Node<ScriptType> => isInstanceOf(ScriptType, node.data),\n connector: ({ node }) => [\n {\n id: [node.id, 'automation'].join(ATTENDABLE_PATH_SEPARATOR),\n type: PLANK_COMPANION_TYPE,\n data: 'automation',\n properties: {\n label: ['script automation label', { ns: meta.id }],\n icon: 'ph--lightning--regular',\n },\n },\n ],\n }),\n ]);\n"],
5
- "mappings": ";;;;;;AAIA,SAASA,cAAcC,mBAAwC;AAC/D,SAASC,oBAAoB;AAC7B,SAASC,kBAAkB;AAC3B,SAASC,sBAAsBC,iCAAiC;AAChE,SAASC,uBAAkC;AAC3C,SAASC,qBAAqB;AAC9B,SAASC,oBAAoB;AAI7B,IAAA,4BAAe,CAACC,YACdC,YAAYC,aAAaC,iBAAiB;EACxCC,gBAAgB;IACdC,IAAI,GAAGC,KAAKD,EAAE;IACdE,QAAQ,CAACC,SAA6BA,KAAKC,SAAS,GAAGC,YAAAA;IACvDC,WAAW,CAAC,EAAEH,KAAI,MAAO;MACvB;QACEH,IAAI,cAAcG,KAAKH,EAAE;QACzBI,MAAM,GAAGH,KAAKD,EAAE;QAChBO,MAAM,GAAGN,KAAKD,EAAE;QAChBQ,YAAY;UACVC,OAAO;YAAC;YAA0B;cAAEC,IAAIT,KAAKD;YAAG;;UAChDW,MAAM;QACR;MACF;;EAEJ,CAAA;EACAZ,gBAAgB;IACdC,IAAI,GAAGC,KAAKD,EAAE;IACdE,QAAQ,CAACC,SAA6BA,KAAKC,SAAS,GAAGC,YAAAA;IACvDC,WAAW,CAAC,EAAEH,KAAI,MAAO;MACvB;QACEH,IAAI,aAAaG,KAAKH,EAAE;QACxBI,MAAM,GAAGH,KAAKD,EAAE;QAChBO,MAAM,GAAGN,KAAKD,EAAE;QAChBQ,YAAY;UACVC,OAAO;YAAC;YAAyB;cAAEC,IAAIT,KAAKD;YAAG;;UAC/CW,MAAM;QACR;MACF;;EAEJ,CAAA;EACAZ,gBAAgB;IACdC,IAAI,GAAGY,aAAAA;IACPV,QAAQ,CAACC,SAAmCU,aAAaC,YAAYX,KAAKI,IAAI;IAC9ED,WAAW,CAAC,EAAEH,KAAI,MAAO;MACvB;QACEH,IAAI;UAACG,KAAKH;UAAI;UAAce,KAAKC,yBAAAA;QACjCZ,MAAMa;QACNV,MAAM;QACNC,YAAY;UACVC,OAAO;YAAC;YAA2B;cAAEC,IAAIT,KAAKD;YAAG;;UACjDW,MAAM;QACR;MACF;;EAEJ,CAAA;CACD;",
6
- "names": ["Capabilities", "contributes", "isInstanceOf", "ScriptType", "PLANK_COMPANION_TYPE", "ATTENDABLE_PATH_SEPARATOR", "createExtension", "SCRIPT_PLUGIN", "SPACE_PLUGIN", "context", "contributes", "Capabilities", "AppGraphBuilder", "createExtension", "id", "meta", "filter", "node", "type", "SPACE_PLUGIN", "connector", "data", "properties", "label", "ns", "icon", "SCRIPT_PLUGIN", "isInstanceOf", "ScriptType", "join", "ATTENDABLE_PATH_SEPARATOR", "PLANK_COMPANION_TYPE"]
7
- }
@@ -1,89 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- AUTOMATION_PLUGIN
4
- } from "./chunk-DZ44LGYT.mjs";
5
-
6
- // packages/plugins/plugin-automation/src/components/FunctionsPanel/FunctionsPanel.tsx
7
- import React, { useCallback, useMemo } from "react";
8
- import { createIntent, LayoutAction, useIntentDispatcher } from "@dxos/app-framework";
9
- import { S } from "@dxos/echo-schema";
10
- import { FunctionType, ScriptType } from "@dxos/functions/types";
11
- import { Filter, fullyQualifiedId, useQuery } from "@dxos/react-client/echo";
12
- import { Button, useTranslation } from "@dxos/react-ui";
13
- import { controlItemClasses } from "@dxos/react-ui-form";
14
- import { List } from "@dxos/react-ui-list";
15
- import { ghostHover, mx } from "@dxos/react-ui-theme";
16
- var grid = "grid grid-cols-[1fr_auto] min-bs-[2.5rem]";
17
- var FunctionsPanel = ({ space }) => {
18
- const { t } = useTranslation(AUTOMATION_PLUGIN);
19
- const functions = useQuery(space, Filter.schema(FunctionType));
20
- const scripts = useQuery(space, Filter.schema(ScriptType));
21
- const { dispatchPromise: dispatch } = useIntentDispatcher();
22
- const functionToScriptMap = useMemo(() => functions.reduce((map, func) => {
23
- const scriptId = func.source?.target?.id;
24
- if (scriptId) {
25
- const script = scripts.find((s) => s.id === scriptId);
26
- if (script) {
27
- map[func.id] = script;
28
- }
29
- }
30
- return map;
31
- }, {}), [
32
- functions,
33
- scripts
34
- ]);
35
- const getScriptName = useCallback((func) => {
36
- const script = functionToScriptMap[func.id];
37
- return script?.name;
38
- }, [
39
- functionToScriptMap
40
- ]);
41
- const handleGoToScript = useCallback((func) => {
42
- const script = functionToScriptMap[func.id];
43
- if (script) {
44
- void dispatch(createIntent(LayoutAction.Open, {
45
- part: "main",
46
- subject: [
47
- fullyQualifiedId(script)
48
- ]
49
- }));
50
- }
51
- }, [
52
- functionToScriptMap,
53
- dispatch
54
- ]);
55
- return /* @__PURE__ */ React.createElement("div", {
56
- role: "none",
57
- className: mx(controlItemClasses)
58
- }, /* @__PURE__ */ React.createElement(List.Root, {
59
- items: functions,
60
- isItem: S.is(FunctionType),
61
- getId: (func) => func.id
62
- }, ({ items }) => /* @__PURE__ */ React.createElement("div", {
63
- role: "list",
64
- className: "flex flex-col w-full"
65
- }, items?.map((func) => /* @__PURE__ */ React.createElement(List.Item, {
66
- key: func.id,
67
- item: func,
68
- classNames: mx(grid, ghostHover, "items-center", "pli-2", "min-bs-[3rem]")
69
- }, /* @__PURE__ */ React.createElement("div", {
70
- className: "flex flex-col truncate"
71
- }, /* @__PURE__ */ React.createElement(List.ItemTitle, {
72
- classNames: "truncate"
73
- }, func.name), getScriptName(func) && /* @__PURE__ */ React.createElement("div", {
74
- className: "text-xs text-description truncate"
75
- }, getScriptName(func))), functionToScriptMap[func.id] && /* @__PURE__ */ React.createElement(Button, {
76
- onClick: () => handleGoToScript(func)
77
- }, t("go to function source button label")))))), functions.length === 0 && /* @__PURE__ */ React.createElement("div", {
78
- className: "text-center plb-4 text-gray-500"
79
- }, t("no functions found")));
80
- };
81
-
82
- // packages/plugins/plugin-automation/src/components/FunctionsPanel/index.ts
83
- var FunctionsPanel_default = FunctionsPanel;
84
-
85
- export {
86
- FunctionsPanel,
87
- FunctionsPanel_default
88
- };
89
- //# sourceMappingURL=chunk-4UPGANGV.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/FunctionsPanel/FunctionsPanel.tsx", "../../../src/components/FunctionsPanel/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback, useMemo } from 'react';\n\nimport { createIntent, LayoutAction, useIntentDispatcher } from '@dxos/app-framework';\nimport { S } from '@dxos/echo-schema';\nimport { FunctionType, ScriptType } from '@dxos/functions/types';\nimport { Filter, fullyQualifiedId, useQuery, type Space } from '@dxos/react-client/echo';\nimport { Button, useTranslation } from '@dxos/react-ui';\nimport { controlItemClasses } from '@dxos/react-ui-form';\nimport { List } from '@dxos/react-ui-list';\nimport { ghostHover, mx } from '@dxos/react-ui-theme';\n\nimport { AUTOMATION_PLUGIN } from '../../meta';\n\nconst grid = 'grid grid-cols-[1fr_auto] min-bs-[2.5rem]';\n\nexport type FunctionsPanelProps = {\n space: Space;\n};\n\nexport const FunctionsPanel = ({ space }: FunctionsPanelProps) => {\n const { t } = useTranslation(AUTOMATION_PLUGIN);\n const functions = useQuery(space, Filter.schema(FunctionType));\n const scripts = useQuery(space, Filter.schema(ScriptType));\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n\n const functionToScriptMap = useMemo(\n () =>\n functions.reduce(\n (map, func) => {\n const scriptId = func.source?.target?.id;\n if (scriptId) {\n const script = scripts.find((s) => s.id === scriptId);\n if (script) {\n map[func.id] = script;\n }\n }\n return map;\n },\n {} as Record<string, ScriptType>,\n ),\n [functions, scripts],\n );\n\n const getScriptName = useCallback(\n (func: FunctionType) => {\n const script = functionToScriptMap[func.id];\n return script?.name;\n },\n [functionToScriptMap],\n );\n\n const handleGoToScript = useCallback(\n (func: FunctionType) => {\n const script = functionToScriptMap[func.id];\n if (script) {\n void dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [fullyQualifiedId(script)] }));\n }\n },\n [functionToScriptMap, dispatch],\n );\n\n return (\n <div role='none' className={mx(controlItemClasses)}>\n <List.Root<FunctionType> items={functions} isItem={S.is(FunctionType)} getId={(func) => func.id}>\n {({ items }) => (\n <div role='list' className='flex flex-col w-full'>\n {items?.map((func) => (\n <List.Item<FunctionType>\n key={func.id}\n item={func}\n classNames={mx(grid, ghostHover, 'items-center', 'pli-2', 'min-bs-[3rem]')}\n >\n <div className='flex flex-col truncate'>\n <List.ItemTitle classNames='truncate'>{func.name}</List.ItemTitle>\n {getScriptName(func) && (\n <div className='text-xs text-description truncate'>{getScriptName(func)}</div>\n )}\n </div>\n {functionToScriptMap[func.id] && (\n <Button onClick={() => handleGoToScript(func)}>{t('go to function source button label')}</Button>\n )}\n </List.Item>\n ))}\n </div>\n )}\n </List.Root>\n\n {functions.length === 0 && <div className='text-center plb-4 text-gray-500'>{t('no functions found')}</div>}\n </div>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { FunctionsPanel } from './FunctionsPanel';\n\nexport * from './FunctionsPanel';\nexport default FunctionsPanel;\n"],
5
- "mappings": ";;;;;;AAIA,OAAOA,SAASC,aAAaC,eAAe;AAE5C,SAASC,cAAcC,cAAcC,2BAA2B;AAChE,SAASC,SAAS;AAClB,SAASC,cAAcC,kBAAkB;AACzC,SAASC,QAAQC,kBAAkBC,gBAA4B;AAC/D,SAASC,QAAQC,sBAAsB;AACvC,SAASC,0BAA0B;AACnC,SAASC,YAAY;AACrB,SAASC,YAAYC,UAAU;AAI/B,IAAMC,OAAO;AAMN,IAAMC,iBAAiB,CAAC,EAAEC,MAAK,MAAuB;AAC3D,QAAM,EAAEC,EAAC,IAAKC,eAAeC,iBAAAA;AAC7B,QAAMC,YAAYC,SAASL,OAAOM,OAAOC,OAAOC,YAAAA,CAAAA;AAChD,QAAMC,UAAUJ,SAASL,OAAOM,OAAOC,OAAOG,UAAAA,CAAAA;AAC9C,QAAM,EAAEC,iBAAiBC,SAAQ,IAAKC,oBAAAA;AAEtC,QAAMC,sBAAsBC,QAC1B,MACEX,UAAUY,OACR,CAACC,KAAKC,SAAAA;AACJ,UAAMC,WAAWD,KAAKE,QAAQC,QAAQC;AACtC,QAAIH,UAAU;AACZ,YAAMI,SAASd,QAAQe,KAAK,CAACC,MAAMA,EAAEH,OAAOH,QAAAA;AAC5C,UAAII,QAAQ;AACVN,YAAIC,KAAKI,EAAE,IAAIC;MACjB;IACF;AACA,WAAON;EACT,GACA,CAAC,CAAA,GAEL;IAACb;IAAWK;GAAQ;AAGtB,QAAMiB,gBAAgBC,YACpB,CAACT,SAAAA;AACC,UAAMK,SAAST,oBAAoBI,KAAKI,EAAE;AAC1C,WAAOC,QAAQK;EACjB,GACA;IAACd;GAAoB;AAGvB,QAAMe,mBAAmBF,YACvB,CAACT,SAAAA;AACC,UAAMK,SAAST,oBAAoBI,KAAKI,EAAE;AAC1C,QAAIC,QAAQ;AACV,WAAKX,SAASkB,aAAaC,aAAaC,MAAM;QAAEC,MAAM;QAAQC,SAAS;UAACC,iBAAiBZ,MAAAA;;MAAS,CAAA,CAAA;IACpG;EACF,GACA;IAACT;IAAqBF;GAAS;AAGjC,SACE,sBAAA,cAACwB,OAAAA;IAAIC,MAAK;IAAOC,WAAWC,GAAGC,kBAAAA;KAC7B,sBAAA,cAACC,KAAKC,MAAI;IAAeC,OAAOvC;IAAWwC,QAAQC,EAAEC,GAAGtC,YAAAA;IAAeuC,OAAO,CAAC7B,SAASA,KAAKI;KAC1F,CAAC,EAAEqB,MAAK,MACP,sBAAA,cAACP,OAAAA;IAAIC,MAAK;IAAOC,WAAU;KACxBK,OAAO1B,IAAI,CAACC,SACX,sBAAA,cAACuB,KAAKO,MAAI;IACRC,KAAK/B,KAAKI;IACV4B,MAAMhC;IACNiC,YAAYZ,GAAGzC,MAAMsD,YAAY,gBAAgB,SAAS,eAAA;KAE1D,sBAAA,cAAChB,OAAAA;IAAIE,WAAU;KACb,sBAAA,cAACG,KAAKY,WAAS;IAACF,YAAW;KAAYjC,KAAKU,IAAI,GAC/CF,cAAcR,IAAAA,KACb,sBAAA,cAACkB,OAAAA;IAAIE,WAAU;KAAqCZ,cAAcR,IAAAA,CAAAA,CAAAA,GAGrEJ,oBAAoBI,KAAKI,EAAE,KAC1B,sBAAA,cAACgC,QAAAA;IAAOC,SAAS,MAAM1B,iBAAiBX,IAAAA;KAAQjB,EAAE,oCAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAQ7DG,UAAUoD,WAAW,KAAK,sBAAA,cAACpB,OAAAA;IAAIE,WAAU;KAAmCrC,EAAE,oBAAA,CAAA,CAAA;AAGrF;;;ACvFA,IAAA,yBAAewD;",
6
- "names": ["React", "useCallback", "useMemo", "createIntent", "LayoutAction", "useIntentDispatcher", "S", "FunctionType", "ScriptType", "Filter", "fullyQualifiedId", "useQuery", "Button", "useTranslation", "controlItemClasses", "List", "ghostHover", "mx", "grid", "FunctionsPanel", "space", "t", "useTranslation", "AUTOMATION_PLUGIN", "functions", "useQuery", "Filter", "schema", "FunctionType", "scripts", "ScriptType", "dispatchPromise", "dispatch", "useIntentDispatcher", "functionToScriptMap", "useMemo", "reduce", "map", "func", "scriptId", "source", "target", "id", "script", "find", "s", "getScriptName", "useCallback", "name", "handleGoToScript", "createIntent", "LayoutAction", "Open", "part", "subject", "fullyQualifiedId", "div", "role", "className", "mx", "controlItemClasses", "List", "Root", "items", "isItem", "S", "is", "getId", "Item", "key", "item", "classNames", "ghostHover", "ItemTitle", "Button", "onClick", "length", "FunctionsPanel"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/AutomationPanel/AutomationPanel.tsx", "../../../src/components/AutomationPanel/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useState } from 'react';\n\nimport { S } from '@dxos/echo-schema';\nimport {\n FunctionType,\n FunctionTrigger,\n FunctionTriggerSchema,\n TriggerKind,\n type FunctionTriggerType,\n ScriptType,\n} from '@dxos/functions/types';\nimport { type Client, useClient } from '@dxos/react-client';\nimport { live, Filter, useQuery, type Space, type Live, getSpace } from '@dxos/react-client/echo';\nimport { Clipboard, IconButton, Input, Separator, useTranslation } from '@dxos/react-ui';\nimport { ControlItem, controlItemClasses } from '@dxos/react-ui-form';\nimport { List } from '@dxos/react-ui-list';\nimport { ghostHover, mx } from '@dxos/react-ui-theme';\n\nimport { AUTOMATION_PLUGIN } from '../../meta';\nimport { TriggerEditor, type TriggerEditorProps } from '../TriggerEditor';\n\nconst grid = 'grid grid-cols-[40px_1fr_32px] min-bs-[2.5rem]';\n\nexport type AutomationPanelProps = {\n space: Space;\n object?: Live<any>;\n initialTrigger?: FunctionTriggerType;\n onDone?: () => void;\n};\n\n// TODO(burdon): Factor out common layout with ViewEditor.\nexport const AutomationPanel = ({ space, object, initialTrigger, onDone }: AutomationPanelProps) => {\n const { t } = useTranslation(AUTOMATION_PLUGIN);\n const client = useClient();\n const triggers = useQuery(space, Filter.schema(FunctionTrigger));\n const functions = useQuery(space, Filter.schema(FunctionType));\n const scripts = useQuery(space, Filter.schema(ScriptType));\n\n const [trigger, setTrigger] = useState<FunctionTriggerType | undefined>(initialTrigger);\n const [selected, setSelected] = useState<FunctionTrigger>();\n\n const handleSelect = (trigger: FunctionTrigger) => {\n const { id: _, ...values } = trigger;\n setTrigger(values);\n setSelected(trigger);\n };\n\n const handleAdd = () => {\n setTrigger(live(FunctionTriggerSchema, {}));\n setSelected(undefined);\n };\n\n const handleDelete = (trigger: FunctionTrigger) => {\n space.db.remove(trigger);\n setTrigger(undefined);\n setSelected(undefined);\n };\n\n const handleSave: TriggerEditorProps['onSave'] = (trigger) => {\n if (selected) {\n Object.assign(selected, trigger);\n } else {\n space.db.add(live(FunctionTrigger, trigger));\n }\n\n setTrigger(undefined);\n setSelected(undefined);\n onDone?.();\n };\n\n const handleCancel: TriggerEditorProps['onCancel'] = () => {\n setTrigger(undefined);\n onDone?.();\n };\n\n return (\n <div className='flex flex-col w-full'>\n {trigger ? (\n <ControlItem title={t('trigger editor title')}>\n <TriggerEditor space={space} trigger={trigger} onSave={handleSave} onCancel={handleCancel} />\n </ControlItem>\n ) : (\n <div role='none' className={controlItemClasses}>\n <List.Root<FunctionTrigger> items={triggers} isItem={S.is(FunctionTrigger)} getId={(field) => field.id}>\n {({ items: triggers }) => (\n <div role='list' className='flex flex-col w-full'>\n {triggers?.map((trigger) => {\n const copyAction = getCopyAction(client, trigger);\n return (\n <List.Item<FunctionTrigger>\n key={trigger.id}\n item={trigger}\n classNames={mx(grid, ghostHover, 'items-center', 'px-2')}\n >\n <Input.Root>\n <Input.Switch\n checked={trigger.enabled}\n onCheckedChange={(checked) => (trigger.enabled = checked)}\n />\n </Input.Root>\n\n <div className={'flex'}>\n <List.ItemTitle\n classNames='px-1 cursor-pointer w-0 shrink truncate'\n onClick={() => handleSelect(trigger)}\n >\n {getFunctionName(scripts, functions, trigger) ?? '∅'}\n </List.ItemTitle>\n\n {/* TODO: a better way to expose copy action */}\n {copyAction && (\n <Clipboard.IconButton\n label={t(copyAction.translationKey)}\n value={copyAction.contentProvider()}\n />\n )}\n </div>\n\n <List.ItemDeleteButton onClick={() => handleDelete(trigger)} />\n </List.Item>\n );\n })}\n </div>\n )}\n </List.Root>\n {triggers.length > 0 && <Separator classNames='mlb-4' />}\n <IconButton icon='ph--plus--regular' label={t('new trigger label')} onClick={handleAdd} />\n </div>\n )}\n </div>\n );\n};\n\nconst getCopyAction = (client: Client, trigger: FunctionTrigger | undefined) => {\n if (trigger?.spec?.type === TriggerKind.Email) {\n return { translationKey: 'trigger copy email', contentProvider: () => `${getSpace(trigger)!.id}@dxos.network` };\n }\n\n if (trigger?.spec?.type === TriggerKind.Webhook) {\n return { translationKey: 'trigger copy url', contentProvider: () => getWebhookUrl(client, trigger) };\n }\n\n return undefined;\n};\n\nconst getWebhookUrl = (client: Client, trigger: FunctionTrigger) => {\n const spaceId = getSpace(trigger)!.id;\n const edgeUrl = new URL(client.config.values.runtime!.services!.edge!.url!);\n const isSecure = edgeUrl.protocol.startsWith('https') || edgeUrl.protocol.startsWith('wss');\n edgeUrl.protocol = isSecure ? 'https' : 'http';\n return new URL(`/webhook/${spaceId}:${trigger.id}`, edgeUrl).toString();\n};\n\nconst getFunctionName = (scripts: ScriptType[], functions: FunctionType[], trigger: FunctionTriggerType) => {\n // TODO(wittjosiah): Truncation should be done in the UI.\n // Warning that the List component is currently a can of worms.\n const shortId = trigger.function && `${trigger.function?.slice(0, 16)}…`;\n const functionObject = functions.find((fn) => `dxn:worker:${fn.name}` === trigger.function);\n if (!functionObject) {\n return shortId;\n }\n return scripts.find((s) => functionObject.source?.target?.id === s.id)?.name ?? shortId;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { AutomationPanel } from './AutomationPanel';\n\nexport * from './AutomationPanel';\n\nexport default AutomationPanel;\n"],
5
- "mappings": "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",
6
- "names": ["React", "useState", "S", "FunctionType", "FunctionTrigger", "FunctionTriggerSchema", "TriggerKind", "ScriptType", "useClient", "live", "Filter", "useQuery", "getSpace", "Clipboard", "IconButton", "Input", "Separator", "useTranslation", "ControlItem", "controlItemClasses", "List", "ghostHover", "mx", "grid", "AutomationPanel", "space", "object", "initialTrigger", "onDone", "t", "useTranslation", "AUTOMATION_PLUGIN", "client", "useClient", "triggers", "useQuery", "Filter", "schema", "FunctionTrigger", "functions", "FunctionType", "scripts", "ScriptType", "trigger", "setTrigger", "useState", "selected", "setSelected", "handleSelect", "id", "_", "values", "handleAdd", "live", "FunctionTriggerSchema", "undefined", "handleDelete", "db", "remove", "handleSave", "Object", "assign", "add", "handleCancel", "div", "className", "ControlItem", "title", "TriggerEditor", "onSave", "onCancel", "role", "controlItemClasses", "List", "Root", "items", "isItem", "S", "is", "getId", "field", "map", "copyAction", "getCopyAction", "Item", "key", "item", "classNames", "mx", "ghostHover", "Input", "Switch", "checked", "enabled", "onCheckedChange", "ItemTitle", "onClick", "getFunctionName", "Clipboard", "IconButton", "label", "translationKey", "value", "contentProvider", "ItemDeleteButton", "length", "Separator", "icon", "spec", "type", "TriggerKind", "Email", "getSpace", "Webhook", "getWebhookUrl", "spaceId", "edgeUrl", "URL", "config", "runtime", "services", "edge", "url", "isSecure", "protocol", "startsWith", "toString", "shortId", "function", "slice", "functionObject", "find", "fn", "name", "s", "source", "target", "AutomationPanel"]
7
- }
@@ -1,16 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
-
3
- // packages/plugins/plugin-automation/src/components/index.ts
4
- import { lazy } from "react";
5
- var AutomationContainer = lazy(() => import("./AutomationContainer-22PUFPSE.mjs"));
6
- var AutomationPanel = lazy(() => import("./AutomationPanel-6UXIAJVS.mjs"));
7
- var FunctionsContainer = lazy(() => import("./FunctionsContainer-XG5WVAN3.mjs"));
8
- var FunctionsPanel = lazy(() => import("./FunctionsPanel-J3QGUESH.mjs"));
9
-
10
- export {
11
- AutomationContainer,
12
- AutomationPanel,
13
- FunctionsContainer,
14
- FunctionsPanel
15
- };
16
- //# sourceMappingURL=chunk-TMMB5ETD.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { lazy } from 'react';\n\nexport * from './TriggerEditor';\n\nexport const AutomationContainer = lazy(() => import('./AutomationContainer'));\nexport const AutomationPanel = lazy(() => import('./AutomationPanel'));\nexport const FunctionsContainer = lazy(() => import('./FunctionsContainer'));\nexport const FunctionsPanel = lazy(() => import('./FunctionsPanel'));\n"],
5
- "mappings": ";;;AAIA,SAASA,YAAY;AAId,IAAMC,sBAAsBC,KAAK,MAAM,OAAO,oCAAA,CAAA;AAC9C,IAAMC,kBAAkBD,KAAK,MAAM,OAAO,gCAAA,CAAA;AAC1C,IAAME,qBAAqBF,KAAK,MAAM,OAAO,mCAAA,CAAA;AAC7C,IAAMG,iBAAiBH,KAAK,MAAM,OAAO,+BAAA,CAAA;",
6
- "names": ["lazy", "AutomationContainer", "lazy", "AutomationPanel", "FunctionsContainer", "FunctionsPanel"]
7
- }
@@ -1,40 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- AUTOMATION_PLUGIN
4
- } from "./chunk-DZ44LGYT.mjs";
5
-
6
- // packages/plugins/plugin-automation/src/types.ts
7
- import { S } from "@dxos/echo-schema";
8
- import { SpaceSchema } from "@dxos/react-client/echo";
9
- var TriggerTemplate = S.Union(S.Struct({
10
- type: S.Literal("timer"),
11
- cron: S.String
12
- }), S.Struct({
13
- type: S.Literal("queue"),
14
- queueDXN: S.Any
15
- }));
16
- var AutomationAction;
17
- (function(AutomationAction2) {
18
- const AUTOMATION_ACTION = `${AUTOMATION_PLUGIN}/action`;
19
- class CreateTriggerFromTemplate extends S.TaggedClass()(`${AUTOMATION_ACTION}/create-trigger-from-template`, {
20
- input: S.Struct({
21
- space: SpaceSchema,
22
- template: TriggerTemplate,
23
- enabled: S.optional(S.Boolean),
24
- // TODO(wittjosiah): Improve how this lookup is done.
25
- scriptName: S.optional(S.String),
26
- payload: S.optional(S.Record({
27
- key: S.String,
28
- value: S.Any
29
- }))
30
- }),
31
- output: S.Void
32
- }) {
33
- }
34
- AutomationAction2.CreateTriggerFromTemplate = CreateTriggerFromTemplate;
35
- })(AutomationAction || (AutomationAction = {}));
36
-
37
- export {
38
- AutomationAction
39
- };
40
- //# sourceMappingURL=chunk-YYBCQXB2.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/types.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { S } from '@dxos/echo-schema';\nimport { SpaceSchema } from '@dxos/react-client/echo';\n\nimport { AUTOMATION_PLUGIN } from './meta';\n\nconst TriggerTemplate = S.Union(\n S.Struct({ type: S.Literal('timer'), cron: S.String }),\n S.Struct({ type: S.Literal('queue'), queueDXN: S.Any }),\n);\n\nexport namespace AutomationAction {\n const AUTOMATION_ACTION = `${AUTOMATION_PLUGIN}/action`;\n\n export class CreateTriggerFromTemplate extends S.TaggedClass<CreateTriggerFromTemplate>()(\n `${AUTOMATION_ACTION}/create-trigger-from-template`,\n {\n input: S.Struct({\n space: SpaceSchema,\n template: TriggerTemplate,\n enabled: S.optional(S.Boolean),\n // TODO(wittjosiah): Improve how this lookup is done.\n scriptName: S.optional(S.String),\n payload: S.optional(S.Record({ key: S.String, value: S.Any })),\n }),\n output: S.Void,\n },\n ) {}\n}\n"],
5
- "mappings": ";;;;;;AAIA,SAASA,SAAS;AAClB,SAASC,mBAAmB;AAI5B,IAAMC,kBAAkBC,EAAEC,MACxBD,EAAEE,OAAO;EAAEC,MAAMH,EAAEI,QAAQ,OAAA;EAAUC,MAAML,EAAEM;AAAO,CAAA,GACpDN,EAAEE,OAAO;EAAEC,MAAMH,EAAEI,QAAQ,OAAA;EAAUG,UAAUP,EAAEQ;AAAI,CAAA,CAAA;;UAGtCC,mBAAAA;AACf,QAAMC,oBAAoB,GAAGC,iBAAAA;EAEtB,MAAMC,kCAAkCZ,EAAEa,YAAW,EAC1D,GAAGH,iBAAAA,iCACH;IACEI,OAAOd,EAAEE,OAAO;MACda,OAAOC;MACPC,UAAUlB;MACVmB,SAASlB,EAAEmB,SAASnB,EAAEoB,OAAO;;MAE7BC,YAAYrB,EAAEmB,SAASnB,EAAEM,MAAM;MAC/BgB,SAAStB,EAAEmB,SAASnB,EAAEuB,OAAO;QAAEC,KAAKxB,EAAEM;QAAQmB,OAAOzB,EAAEQ;MAAI,CAAA,CAAA;IAC7D,CAAA;IACAkB,QAAQ1B,EAAE2B;EACZ,CAAA,EAAA;EACC;oBAbUf,4BAAAA;AAcf,GAjBiBH,qBAAAA,mBAAAA,CAAAA,EAAAA;",
6
- "names": ["S", "SpaceSchema", "TriggerTemplate", "S", "Union", "Struct", "type", "Literal", "cron", "String", "queueDXN", "Any", "AutomationAction", "AUTOMATION_ACTION", "AUTOMATION_PLUGIN", "CreateTriggerFromTemplate", "TaggedClass", "input", "space", "SpaceSchema", "template", "enabled", "optional", "Boolean", "scriptName", "payload", "Record", "key", "value", "output", "Void"]
7
- }
@@ -1,79 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- AutomationAction
4
- } from "./chunk-YYBCQXB2.mjs";
5
- import "./chunk-DZ44LGYT.mjs";
6
-
7
- // packages/plugins/plugin-automation/src/capabilities/intent-resolver.ts
8
- import { contributes, Capabilities, createResolver, createIntent, LayoutAction } from "@dxos/app-framework";
9
- import { FunctionTrigger, FunctionType, ScriptType, TriggerKind } from "@dxos/functions";
10
- import { live } from "@dxos/live-object";
11
- import { ATTENDABLE_PATH_SEPARATOR } from "@dxos/plugin-deck/types";
12
- import { SpaceAction } from "@dxos/plugin-space/types";
13
- import { Filter } from "@dxos/react-client/echo";
14
- var intent_resolver_default = (context) => contributes(Capabilities.IntentResolver, [
15
- createResolver({
16
- intent: AutomationAction.CreateTriggerFromTemplate,
17
- resolve: async ({ space, template, enabled = false, scriptName, payload }) => {
18
- const trigger = live(FunctionTrigger, {
19
- enabled
20
- });
21
- if (scriptName) {
22
- const { objects: [script] } = await space.db.query(Filter.schema(ScriptType, {
23
- name: scriptName
24
- })).run();
25
- if (script) {
26
- const { objects: [fn] } = await space.db.query(Filter.schema(FunctionType, {
27
- source: script
28
- })).run();
29
- if (fn) {
30
- trigger.function = `dxn:worker:${fn.name}`;
31
- }
32
- }
33
- }
34
- if (payload) {
35
- trigger.meta = payload;
36
- }
37
- switch (template.type) {
38
- case "timer": {
39
- trigger.spec = {
40
- type: TriggerKind.Timer,
41
- cron: template.cron
42
- };
43
- break;
44
- }
45
- case "queue": {
46
- trigger.spec = {
47
- type: TriggerKind.Queue,
48
- queue: template.queueDXN.toString()
49
- };
50
- break;
51
- }
52
- default: {
53
- break;
54
- }
55
- }
56
- return {
57
- intents: [
58
- createIntent(SpaceAction.AddObject, {
59
- object: trigger,
60
- target: space
61
- }),
62
- createIntent(LayoutAction.Open, {
63
- part: "main",
64
- subject: [
65
- `automation-settings${ATTENDABLE_PATH_SEPARATOR}${space.id}`
66
- ],
67
- options: {
68
- workspace: space.id
69
- }
70
- })
71
- ]
72
- };
73
- }
74
- })
75
- ]);
76
- export {
77
- intent_resolver_default as default
78
- };
79
- //# sourceMappingURL=intent-resolver-JFLTVJ7D.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/intent-resolver.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport {\n contributes,\n Capabilities,\n createResolver,\n type PluginsContext,\n createIntent,\n LayoutAction,\n} from '@dxos/app-framework';\nimport { FunctionTrigger, FunctionType, ScriptType, TriggerKind } from '@dxos/functions';\nimport { type DXN } from '@dxos/keys';\nimport { live } from '@dxos/live-object';\nimport { ATTENDABLE_PATH_SEPARATOR } from '@dxos/plugin-deck/types';\nimport { SpaceAction } from '@dxos/plugin-space/types';\nimport { Filter } from '@dxos/react-client/echo';\n\nimport { AutomationAction } from '../types';\n\nexport default (context: PluginsContext) =>\n contributes(Capabilities.IntentResolver, [\n createResolver({\n intent: AutomationAction.CreateTriggerFromTemplate,\n resolve: async ({ space, template, enabled = false, scriptName, payload }) => {\n const trigger = live(FunctionTrigger, { enabled });\n\n // TODO(wittjosiah): Factor out function lookup by script name?\n if (scriptName) {\n const {\n objects: [script],\n } = await space.db.query(Filter.schema(ScriptType, { name: scriptName })).run();\n if (script) {\n const {\n objects: [fn],\n } = await space.db.query(Filter.schema(FunctionType, { source: script })).run();\n if (fn) {\n trigger.function = `dxn:worker:${fn.name}`;\n }\n }\n }\n\n if (payload) {\n trigger.meta = payload;\n }\n\n switch (template.type) {\n case 'timer': {\n trigger.spec = { type: TriggerKind.Timer, cron: template.cron };\n break;\n }\n case 'queue': {\n trigger.spec = { type: TriggerKind.Queue, queue: (template.queueDXN as DXN).toString() };\n break;\n }\n default: {\n break;\n }\n }\n\n return {\n intents: [\n createIntent(SpaceAction.AddObject, { object: trigger, target: space }),\n createIntent(LayoutAction.Open, {\n part: 'main',\n subject: [`automation-settings${ATTENDABLE_PATH_SEPARATOR}${space.id}`],\n options: {\n workspace: space.id,\n },\n }),\n ],\n };\n },\n }),\n ]);\n"],
5
- "mappings": ";;;;;;;AAIA,SACEA,aACAC,cACAC,gBAEAC,cACAC,oBACK;AACP,SAASC,iBAAiBC,cAAcC,YAAYC,mBAAmB;AAEvE,SAASC,YAAY;AACrB,SAASC,iCAAiC;AAC1C,SAASC,mBAAmB;AAC5B,SAASC,cAAc;AAIvB,IAAA,0BAAe,CAACC,YACdC,YAAYC,aAAaC,gBAAgB;EACvCC,eAAe;IACbC,QAAQC,iBAAiBC;IACzBC,SAAS,OAAO,EAAEC,OAAOC,UAAUC,UAAU,OAAOC,YAAYC,QAAO,MAAE;AACvE,YAAMC,UAAUC,KAAKC,iBAAiB;QAAEL;MAAQ,CAAA;AAGhD,UAAIC,YAAY;AACd,cAAM,EACJK,SAAS,CAACC,MAAAA,EAAO,IACf,MAAMT,MAAMU,GAAGC,MAAMC,OAAOC,OAAOC,YAAY;UAAEC,MAAMZ;QAAW,CAAA,CAAA,EAAIa,IAAG;AAC7E,YAAIP,QAAQ;AACV,gBAAM,EACJD,SAAS,CAACS,EAAAA,EAAG,IACX,MAAMjB,MAAMU,GAAGC,MAAMC,OAAOC,OAAOK,cAAc;YAAEC,QAAQV;UAAO,CAAA,CAAA,EAAIO,IAAG;AAC7E,cAAIC,IAAI;AACNZ,oBAAQe,WAAW,cAAcH,GAAGF,IAAI;UAC1C;QACF;MACF;AAEA,UAAIX,SAAS;AACXC,gBAAQgB,OAAOjB;MACjB;AAEA,cAAQH,SAASqB,MAAI;QACnB,KAAK,SAAS;AACZjB,kBAAQkB,OAAO;YAAED,MAAME,YAAYC;YAAOC,MAAMzB,SAASyB;UAAK;AAC9D;QACF;QACA,KAAK,SAAS;AACZrB,kBAAQkB,OAAO;YAAED,MAAME,YAAYG;YAAOC,OAAQ3B,SAAS4B,SAAiBC,SAAQ;UAAG;AACvF;QACF;QACA,SAAS;AACP;QACF;MACF;AAEA,aAAO;QACLC,SAAS;UACPC,aAAaC,YAAYC,WAAW;YAAEC,QAAQ9B;YAAS+B,QAAQpC;UAAM,CAAA;UACrEgC,aAAaK,aAAaC,MAAM;YAC9BC,MAAM;YACNC,SAAS;cAAC,sBAAsBC,yBAAAA,GAA4BzC,MAAM0C,EAAE;;YACpEC,SAAS;cACPC,WAAW5C,MAAM0C;YACnB;UACF,CAAA;;MAEJ;IACF;EACF,CAAA;CACD;",
6
- "names": ["contributes", "Capabilities", "createResolver", "createIntent", "LayoutAction", "FunctionTrigger", "FunctionType", "ScriptType", "TriggerKind", "live", "ATTENDABLE_PATH_SEPARATOR", "SpaceAction", "Filter", "context", "contributes", "Capabilities", "IntentResolver", "createResolver", "intent", "AutomationAction", "CreateTriggerFromTemplate", "resolve", "space", "template", "enabled", "scriptName", "payload", "trigger", "live", "FunctionTrigger", "objects", "script", "db", "query", "Filter", "schema", "ScriptType", "name", "run", "fn", "FunctionType", "source", "function", "meta", "type", "spec", "TriggerKind", "Timer", "cron", "Queue", "queue", "queueDXN", "toString", "intents", "createIntent", "SpaceAction", "AddObject", "object", "target", "LayoutAction", "Open", "part", "subject", "ATTENDABLE_PATH_SEPARATOR", "id", "options", "workspace"]
7
- }
@@ -1,69 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- AutomationContainer,
4
- AutomationPanel,
5
- FunctionsContainer
6
- } from "./chunk-TMMB5ETD.mjs";
7
- import "./chunk-M4QXMIIB.mjs";
8
- import {
9
- meta
10
- } from "./chunk-DZ44LGYT.mjs";
11
-
12
- // packages/plugins/plugin-automation/src/capabilities/react-surface.tsx
13
- import React from "react";
14
- import { Capabilities, contributes, createSurface, useLayout } from "@dxos/app-framework";
15
- import { isInstanceOf } from "@dxos/echo-schema";
16
- import { ScriptType } from "@dxos/functions/types";
17
- import { getSpace, parseId, useSpace } from "@dxos/react-client/echo";
18
- import { StackItem } from "@dxos/react-ui-stack";
19
- var react_surface_default = () => contributes(Capabilities.ReactSurface, [
20
- createSurface({
21
- id: `${meta.id}/space-settings-automation`,
22
- role: "article",
23
- filter: (data) => data.subject === `${meta.id}/space-settings-automation`,
24
- component: () => {
25
- const layout = useLayout();
26
- const { spaceId } = parseId(layout.workspace);
27
- const space = useSpace(spaceId);
28
- if (!space || !spaceId) {
29
- return null;
30
- }
31
- return /* @__PURE__ */ React.createElement(AutomationContainer, {
32
- space
33
- });
34
- }
35
- }),
36
- createSurface({
37
- id: `${meta.id}/space-settings-functions`,
38
- role: "article",
39
- filter: (data) => data.subject === `${meta.id}/space-settings-functions`,
40
- component: () => {
41
- const layout = useLayout();
42
- const { spaceId } = parseId(layout.workspace);
43
- const space = useSpace(spaceId);
44
- if (!space || !spaceId) {
45
- return null;
46
- }
47
- return /* @__PURE__ */ React.createElement(FunctionsContainer, {
48
- space
49
- });
50
- }
51
- }),
52
- createSurface({
53
- id: `${meta.id}/companion/automation`,
54
- role: "article",
55
- filter: (data) => isInstanceOf(ScriptType, data.companionTo) && data.subject === "automation",
56
- component: ({ data, role }) => {
57
- return /* @__PURE__ */ React.createElement(StackItem.Content, {
58
- role
59
- }, /* @__PURE__ */ React.createElement(AutomationPanel, {
60
- space: getSpace(data.companionTo),
61
- object: data.companionTo
62
- }));
63
- }
64
- })
65
- ]);
66
- export {
67
- react_surface_default as default
68
- };
69
- //# sourceMappingURL=react-surface-VSO4NWC6.mjs.map
@@ -1,7 +0,0 @@
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, useLayout } from '@dxos/app-framework';\nimport { isInstanceOf } from '@dxos/echo-schema';\nimport { ScriptType } from '@dxos/functions/types';\nimport { getSpace, parseId, useSpace } from '@dxos/react-client/echo';\nimport { StackItem } from '@dxos/react-ui-stack';\n\nimport { AutomationContainer, AutomationPanel, FunctionsContainer } from '../components';\nimport { meta } from '../meta';\n\nexport default () =>\n contributes(Capabilities.ReactSurface, [\n createSurface({\n id: `${meta.id}/space-settings-automation`,\n role: 'article',\n filter: (data): data is { subject: string } => data.subject === `${meta.id}/space-settings-automation`,\n component: () => {\n const layout = useLayout();\n const { spaceId } = parseId(layout.workspace);\n const space = useSpace(spaceId);\n if (!space || !spaceId) {\n return null;\n }\n\n return <AutomationContainer space={space} />;\n },\n }),\n createSurface({\n id: `${meta.id}/space-settings-functions`,\n role: 'article',\n filter: (data): data is { subject: string } => data.subject === `${meta.id}/space-settings-functions`,\n component: () => {\n const layout = useLayout();\n const { spaceId } = parseId(layout.workspace);\n const space = useSpace(spaceId);\n if (!space || !spaceId) {\n return null;\n }\n\n return <FunctionsContainer space={space} />;\n },\n }),\n createSurface({\n id: `${meta.id}/companion/automation`,\n role: 'article',\n filter: (data): data is { companionTo: ScriptType; subject: 'automation' } =>\n isInstanceOf(ScriptType, data.companionTo) && data.subject === 'automation',\n component: ({ data, role }) => {\n return (\n <StackItem.Content role={role}>\n <AutomationPanel space={getSpace(data.companionTo)!} object={data.companionTo} />\n </StackItem.Content>\n );\n },\n }),\n ]);\n"],
5
- "mappings": ";;;;;;;;;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,cAAcC,aAAaC,eAAeC,iBAAiB;AACpE,SAASC,oBAAoB;AAC7B,SAASC,kBAAkB;AAC3B,SAASC,UAAUC,SAASC,gBAAgB;AAC5C,SAASC,iBAAiB;AAK1B,IAAA,wBAAe,MACbC,YAAYC,aAAaC,cAAc;EACrCC,cAAc;IACZC,IAAI,GAAGC,KAAKD,EAAE;IACdE,MAAM;IACNC,QAAQ,CAACC,SAAsCA,KAAKC,YAAY,GAAGJ,KAAKD,EAAE;IAC1EM,WAAW,MAAA;AACT,YAAMC,SAASC,UAAAA;AACf,YAAM,EAAEC,QAAO,IAAKC,QAAQH,OAAOI,SAAS;AAC5C,YAAMC,QAAQC,SAASJ,OAAAA;AACvB,UAAI,CAACG,SAAS,CAACH,SAAS;AACtB,eAAO;MACT;AAEA,aAAO,sBAAA,cAACK,qBAAAA;QAAoBF;;IAC9B;EACF,CAAA;EACAb,cAAc;IACZC,IAAI,GAAGC,KAAKD,EAAE;IACdE,MAAM;IACNC,QAAQ,CAACC,SAAsCA,KAAKC,YAAY,GAAGJ,KAAKD,EAAE;IAC1EM,WAAW,MAAA;AACT,YAAMC,SAASC,UAAAA;AACf,YAAM,EAAEC,QAAO,IAAKC,QAAQH,OAAOI,SAAS;AAC5C,YAAMC,QAAQC,SAASJ,OAAAA;AACvB,UAAI,CAACG,SAAS,CAACH,SAAS;AACtB,eAAO;MACT;AAEA,aAAO,sBAAA,cAACM,oBAAAA;QAAmBH;;IAC7B;EACF,CAAA;EACAb,cAAc;IACZC,IAAI,GAAGC,KAAKD,EAAE;IACdE,MAAM;IACNC,QAAQ,CAACC,SACPY,aAAaC,YAAYb,KAAKc,WAAW,KAAKd,KAAKC,YAAY;IACjEC,WAAW,CAAC,EAAEF,MAAMF,KAAI,MAAE;AACxB,aACE,sBAAA,cAACiB,UAAUC,SAAO;QAAClB;SACjB,sBAAA,cAACmB,iBAAAA;QAAgBT,OAAOU,SAASlB,KAAKc,WAAW;QAAIK,QAAQnB,KAAKc;;IAGxE;EACF,CAAA;CACD;",
6
- "names": ["React", "Capabilities", "contributes", "createSurface", "useLayout", "isInstanceOf", "ScriptType", "getSpace", "parseId", "useSpace", "StackItem", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "meta", "role", "filter", "data", "subject", "component", "layout", "useLayout", "spaceId", "parseId", "workspace", "space", "useSpace", "AutomationContainer", "FunctionsContainer", "isInstanceOf", "ScriptType", "companionTo", "StackItem", "Content", "AutomationPanel", "getSpace", "object"]
7
- }
@@ -1,9 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- AutomationAction
4
- } from "./chunk-YYBCQXB2.mjs";
5
- import "./chunk-DZ44LGYT.mjs";
6
- export {
7
- AutomationAction
8
- };
9
- //# sourceMappingURL=types.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,4 +0,0 @@
1
- import { Capabilities, type PluginsContext } from '@dxos/app-framework';
2
- declare const _default: (context: PluginsContext) => import("@dxos/app-framework").Capability<Capabilities.IntentResolver>;
3
- export default _default;
4
- //# sourceMappingURL=intent-resolver.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"intent-resolver.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/intent-resolver.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,YAAY,EAEZ,KAAK,cAAc,EAGpB,MAAM,qBAAqB,CAAC;kCAUJ,cAAc;AAAvC,wBAsDK"}
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import { type Space } from '@dxos/react-client/echo';
3
- export declare const AutomationContainer: ({ space }: {
4
- space: Space;
5
- }) => React.JSX.Element;
6
- export default AutomationContainer;
7
- //# sourceMappingURL=AutomationContainer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AutomationContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/AutomationContainer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAQrD,eAAO,MAAM,mBAAmB,cAAe;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,sBAc9D,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import { type Space } from '@dxos/react-client/echo';
3
- export declare const FunctionsContainer: ({ space }: {
4
- space: Space;
5
- }) => React.JSX.Element;
6
- export default FunctionsContainer;
7
- //# sourceMappingURL=FunctionsContainer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FunctionsContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/FunctionsContainer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAQrD,eAAO,MAAM,kBAAkB,cAAe;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,sBAc7D,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import { type Space } from '@dxos/react-client/echo';
3
- export type FunctionsPanelProps = {
4
- space: Space;
5
- };
6
- export declare const FunctionsPanel: ({ space }: FunctionsPanelProps) => React.JSX.Element;
7
- //# sourceMappingURL=FunctionsPanel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FunctionsPanel.d.ts","sourceRoot":"","sources":["../../../../../src/components/FunctionsPanel/FunctionsPanel.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAKpD,OAAO,EAAsC,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAUzF,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,cAAc,cAAe,mBAAmB,sBAuE5D,CAAC"}
@@ -1,4 +0,0 @@
1
- import { FunctionsPanel } from './FunctionsPanel';
2
- export * from './FunctionsPanel';
3
- export default FunctionsPanel;
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/FunctionsPanel/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,cAAc,kBAAkB,CAAC;AACjC,eAAe,cAAc,CAAC"}
@@ -1,25 +0,0 @@
1
- import { S } from '@dxos/echo-schema';
2
- export declare namespace AutomationAction {
3
- const CreateTriggerFromTemplate_base: S.TaggedClass<CreateTriggerFromTemplate, "dxos.org/plugin/automation/action/create-trigger-from-template", {
4
- readonly _tag: S.tag<"dxos.org/plugin/automation/action/create-trigger-from-template">;
5
- } & {
6
- input: S.Struct<{
7
- space: S.Schema<import("@dxos/client-protocol").Space, import("@dxos/client-protocol").Space, never>;
8
- template: S.Union<[S.Struct<{
9
- type: S.Literal<["timer"]>;
10
- cron: typeof S.String;
11
- }>, S.Struct<{
12
- type: S.Literal<["queue"]>;
13
- queueDXN: typeof S.Any;
14
- }>]>;
15
- enabled: S.optional<typeof S.Boolean>;
16
- scriptName: S.optional<typeof S.String>;
17
- payload: S.optional<S.Record$<typeof S.String, typeof S.Any>>;
18
- }>;
19
- output: typeof S.Void;
20
- }>;
21
- export class CreateTriggerFromTemplate extends CreateTriggerFromTemplate_base {
22
- }
23
- export {};
24
- }
25
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAUtC,yBAAiB,gBAAgB,CAAC;;;;;;;;;;;;;;;;;;;IAGhC,MAAM,OAAO,yBAA0B,SAAQ,8BAa9C;KAAG;;CACL"}
@@ -1,76 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import {
6
- contributes,
7
- Capabilities,
8
- createResolver,
9
- type PluginsContext,
10
- createIntent,
11
- LayoutAction,
12
- } from '@dxos/app-framework';
13
- import { FunctionTrigger, FunctionType, ScriptType, TriggerKind } from '@dxos/functions';
14
- import { type DXN } from '@dxos/keys';
15
- import { live } from '@dxos/live-object';
16
- import { ATTENDABLE_PATH_SEPARATOR } from '@dxos/plugin-deck/types';
17
- import { SpaceAction } from '@dxos/plugin-space/types';
18
- import { Filter } from '@dxos/react-client/echo';
19
-
20
- import { AutomationAction } from '../types';
21
-
22
- export default (context: PluginsContext) =>
23
- contributes(Capabilities.IntentResolver, [
24
- createResolver({
25
- intent: AutomationAction.CreateTriggerFromTemplate,
26
- resolve: async ({ space, template, enabled = false, scriptName, payload }) => {
27
- const trigger = live(FunctionTrigger, { enabled });
28
-
29
- // TODO(wittjosiah): Factor out function lookup by script name?
30
- if (scriptName) {
31
- const {
32
- objects: [script],
33
- } = await space.db.query(Filter.schema(ScriptType, { name: scriptName })).run();
34
- if (script) {
35
- const {
36
- objects: [fn],
37
- } = await space.db.query(Filter.schema(FunctionType, { source: script })).run();
38
- if (fn) {
39
- trigger.function = `dxn:worker:${fn.name}`;
40
- }
41
- }
42
- }
43
-
44
- if (payload) {
45
- trigger.meta = payload;
46
- }
47
-
48
- switch (template.type) {
49
- case 'timer': {
50
- trigger.spec = { type: TriggerKind.Timer, cron: template.cron };
51
- break;
52
- }
53
- case 'queue': {
54
- trigger.spec = { type: TriggerKind.Queue, queue: (template.queueDXN as DXN).toString() };
55
- break;
56
- }
57
- default: {
58
- break;
59
- }
60
- }
61
-
62
- return {
63
- intents: [
64
- createIntent(SpaceAction.AddObject, { object: trigger, target: space }),
65
- createIntent(LayoutAction.Open, {
66
- part: 'main',
67
- subject: [`automation-settings${ATTENDABLE_PATH_SEPARATOR}${space.id}`],
68
- options: {
69
- workspace: space.id,
70
- },
71
- }),
72
- ],
73
- };
74
- },
75
- }),
76
- ]);