@dxos/plugin-script 0.7.5-labs.a279d8c → 0.7.5-labs.ea4b4c2
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/{AutomationPanel-OOIRJFPJ.mjs → AutomationPanel-J3SZ5L3Y.mjs} +3 -3
- package/dist/lib/browser/{ScriptContainer-T2AOMDT3.mjs → ScriptContainer-AL4ZLJID.mjs} +93 -67
- package/dist/lib/browser/ScriptContainer-AL4ZLJID.mjs.map +7 -0
- package/dist/lib/browser/artifact-UOESRBEZ.mjs +243 -0
- package/dist/lib/browser/artifact-UOESRBEZ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-SJ4J527G.mjs → chunk-45LXDWNF.mjs} +2 -2
- package/dist/lib/browser/{chunk-ZM6T4HPR.mjs → chunk-6MOQ4BP3.mjs} +2 -2
- package/dist/lib/browser/{chunk-SIOGRRPF.mjs → chunk-ALQHMUJN.mjs} +21 -9
- package/dist/lib/browser/chunk-ALQHMUJN.mjs.map +7 -0
- package/dist/lib/browser/chunk-FVVCAWNP.mjs +21 -0
- package/dist/lib/browser/chunk-FVVCAWNP.mjs.map +7 -0
- package/dist/lib/browser/{chunk-XPGBHZ3L.mjs → chunk-N46LE7FS.mjs} +2 -2
- package/dist/lib/browser/{chunk-REL2R7SB.mjs → chunk-VIX22OMB.mjs} +11 -3
- package/dist/lib/browser/chunk-VIX22OMB.mjs.map +7 -0
- package/dist/lib/browser/{compiler-HT53ILG7.mjs → compiler-YY2XSKHQ.mjs} +4 -6
- package/dist/lib/browser/compiler-YY2XSKHQ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +20 -18
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/intent-resolver-CMKQTLBG.mjs +45 -0
- package/dist/lib/browser/intent-resolver-CMKQTLBG.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-GAWVYTJ5.mjs → react-surface-YELZNYPR.mjs} +12 -14
- package/dist/lib/browser/react-surface-YELZNYPR.mjs.map +7 -0
- package/dist/lib/browser/{settings-YQQEU3DF.mjs → settings-SZCDKHWO.mjs} +3 -3
- package/dist/lib/browser/types.mjs +2 -2
- package/dist/lib/node/{AutomationPanel-EPRDDR3A.cjs → AutomationPanel-4M55FURO.cjs} +8 -8
- package/dist/lib/node/{ScriptContainer-BV56I4OL.cjs → ScriptContainer-FKCNWHBW.cjs} +97 -69
- package/dist/lib/node/ScriptContainer-FKCNWHBW.cjs.map +7 -0
- package/dist/lib/node/artifact-PDTB4LV4.cjs +262 -0
- package/dist/lib/node/artifact-PDTB4LV4.cjs.map +7 -0
- package/dist/lib/node/{chunk-EFTZN5X7.cjs → chunk-5UH3F7TA.cjs} +8 -5
- package/dist/lib/node/chunk-5UH3F7TA.cjs.map +7 -0
- package/dist/lib/node/{chunk-A2DI2G4D.cjs → chunk-ALY3N6PW.cjs} +6 -6
- package/dist/lib/node/{chunk-6VKZJ4MH.cjs → chunk-DJGLGRQV.cjs} +6 -6
- package/dist/lib/node/{chunk-5V3XGLTR.cjs → chunk-F5Z3DMHA.cjs} +24 -12
- package/dist/lib/node/chunk-F5Z3DMHA.cjs.map +7 -0
- package/dist/lib/node/{chunk-DQRAVZM7.cjs → chunk-IID7WUQS.cjs} +6 -6
- package/dist/lib/node/{chunk-TJ4BTPOS.cjs → chunk-PKT5DD3O.cjs} +12 -6
- package/dist/lib/node/chunk-PKT5DD3O.cjs.map +7 -0
- package/dist/lib/node/{compiler-457ZR24G.cjs → compiler-UIBLKJKG.cjs} +9 -9
- package/dist/lib/node/compiler-UIBLKJKG.cjs.map +7 -0
- package/dist/lib/node/index.cjs +38 -35
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/{intent-resolver-SUAPE7H3.cjs → intent-resolver-V5ASU5DW.cjs} +31 -28
- package/dist/lib/node/intent-resolver-V5ASU5DW.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-OMBMSFZT.cjs → react-surface-SMMFAPZD.cjs} +23 -25
- package/dist/lib/node/react-surface-SMMFAPZD.cjs.map +7 -0
- package/dist/lib/node/{settings-NGHDYAVK.cjs → settings-SZFSMSKM.cjs} +9 -9
- package/dist/lib/node/types.cjs +4 -4
- package/dist/lib/node/types.cjs.map +1 -1
- package/dist/lib/node-esm/{AutomationPanel-DMLAGQS5.mjs → AutomationPanel-W6SKG35R.mjs} +3 -3
- package/dist/lib/node-esm/{ScriptContainer-3S5VHJVR.mjs → ScriptContainer-52KVAFUY.mjs} +93 -67
- package/dist/lib/node-esm/ScriptContainer-52KVAFUY.mjs.map +7 -0
- package/dist/lib/node-esm/artifact-IX4ZCTUF.mjs +245 -0
- package/dist/lib/node-esm/artifact-IX4ZCTUF.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-XUWS7OTK.mjs → chunk-CGF7EOGD.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-675XSDRN.mjs → chunk-CP5LXTK5.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-XPIKUBGS.mjs → chunk-GXRS4YIV.mjs} +21 -9
- package/dist/lib/node-esm/chunk-GXRS4YIV.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-JJZYWSD7.mjs → chunk-NBAL5DXN.mjs} +11 -3
- package/dist/lib/node-esm/chunk-NBAL5DXN.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-BHP545D7.mjs → chunk-P2V2Y5LV.mjs} +5 -2
- package/dist/lib/node-esm/chunk-P2V2Y5LV.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-JHGOPQVO.mjs → chunk-UNQFIERE.mjs} +2 -2
- package/dist/lib/node-esm/{compiler-PEARFTFR.mjs → compiler-XTXFGZJM.mjs} +4 -6
- package/dist/lib/node-esm/compiler-XTXFGZJM.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +20 -18
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/intent-resolver-75BHFRUK.mjs +46 -0
- package/dist/lib/node-esm/intent-resolver-75BHFRUK.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-J7NLV2V4.mjs → react-surface-7PHSWVOU.mjs} +12 -14
- package/dist/lib/node-esm/react-surface-7PHSWVOU.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-XGXDY4NI.mjs → settings-GR4O2WHZ.mjs} +3 -3
- package/dist/lib/node-esm/types.mjs +2 -2
- package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/artifact.d.ts +11 -0
- package/dist/types/src/capabilities/artifact.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +5 -4
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/FrameContainer/FrameContainer.d.ts +1 -1
- package/dist/types/src/components/FrameContainer/FrameContainer.d.ts.map +1 -1
- package/dist/types/src/components/ScriptContainer.d.ts +2 -2
- package/dist/types/src/components/ScriptContainer.d.ts.map +1 -1
- package/dist/types/src/components/ScriptSettingsPanel.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.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/hooks/deploy.d.ts.map +1 -0
- package/dist/types/src/hooks/format.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +7 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -0
- package/dist/types/src/{components/ScriptToolbar/templateSelect.d.ts → hooks/template.d.ts} +1 -1
- package/dist/types/src/hooks/template.d.ts.map +1 -0
- package/dist/types/src/{components/ScriptToolbar → hooks}/useToolbarAction.d.ts +1 -1
- package/dist/types/src/hooks/useToolbarAction.d.ts.map +1 -0
- package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -0
- package/dist/types/src/hooks/view.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +0 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -0
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/templates/echo.d.ts.map +1 -1
- package/dist/types/src/templates/forex-effect.d.ts +6 -0
- package/dist/types/src/templates/forex-effect.d.ts.map +1 -0
- package/dist/types/src/templates/forex.d.ts +1 -1
- package/dist/types/src/templates/forex.d.ts.map +1 -1
- package/dist/types/src/templates/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +6 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +43 -41
- package/src/ScriptPlugin.tsx +10 -13
- package/src/capabilities/artifact.ts +219 -0
- package/src/capabilities/compiler.ts +1 -1
- package/src/capabilities/index.ts +1 -0
- package/src/capabilities/intent-resolver.ts +25 -22
- package/src/capabilities/react-surface.tsx +8 -8
- package/src/components/FrameContainer/FrameContainer.tsx +1 -2
- package/src/components/ScriptContainer.tsx +10 -5
- package/src/components/ScriptSettings/ScriptSettings.tsx +3 -3
- package/src/components/ScriptSettingsPanel.tsx +16 -2
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +8 -6
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +1 -1
- package/src/{components/ScriptToolbar → hooks}/deploy.ts +14 -2
- package/src/{components/ScriptToolbar → hooks}/format.ts +1 -1
- package/src/hooks/index.ts +11 -0
- package/src/{components/ScriptToolbar/templateSelect.ts → hooks/template.ts} +2 -2
- package/src/{components/ScriptToolbar → hooks}/useToolbarAction.ts +1 -1
- package/src/{components/ScriptToolbar → hooks}/view.ts +1 -1
- package/src/index.ts +0 -1
- package/src/meta.ts +3 -1
- package/src/templates/echo.ts +5 -1
- package/src/templates/forex-effect.ts +42 -0
- package/src/templates/forex.ts +21 -13
- package/src/templates/index.ts +7 -0
- package/src/translations.ts +2 -0
- package/dist/lib/browser/ScriptContainer-T2AOMDT3.mjs.map +0 -7
- package/dist/lib/browser/chunk-5BU5ERNU.mjs +0 -18
- package/dist/lib/browser/chunk-5BU5ERNU.mjs.map +0 -7
- package/dist/lib/browser/chunk-REL2R7SB.mjs.map +0 -7
- package/dist/lib/browser/chunk-SDHKTS6H.mjs +0 -237
- package/dist/lib/browser/chunk-SDHKTS6H.mjs.map +0 -7
- package/dist/lib/browser/chunk-SIOGRRPF.mjs.map +0 -7
- package/dist/lib/browser/compiler-HT53ILG7.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-YPHT6HDZ.mjs +0 -42
- package/dist/lib/browser/intent-resolver-YPHT6HDZ.mjs.map +0 -7
- package/dist/lib/browser/react-surface-GAWVYTJ5.mjs.map +0 -7
- package/dist/lib/node/ScriptContainer-BV56I4OL.cjs.map +0 -7
- package/dist/lib/node/chunk-5V3XGLTR.cjs.map +0 -7
- package/dist/lib/node/chunk-EFTZN5X7.cjs.map +0 -7
- package/dist/lib/node/chunk-T4TXCRN5.cjs +0 -260
- package/dist/lib/node/chunk-T4TXCRN5.cjs.map +0 -7
- package/dist/lib/node/chunk-TJ4BTPOS.cjs.map +0 -7
- package/dist/lib/node/compiler-457ZR24G.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-SUAPE7H3.cjs.map +0 -7
- package/dist/lib/node/react-surface-OMBMSFZT.cjs.map +0 -7
- package/dist/lib/node-esm/ScriptContainer-3S5VHJVR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BHP545D7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-G76M6O46.mjs +0 -239
- package/dist/lib/node-esm/chunk-G76M6O46.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JJZYWSD7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XPIKUBGS.mjs.map +0 -7
- package/dist/lib/node-esm/compiler-PEARFTFR.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-SZJXQ3CW.mjs +0 -43
- package/dist/lib/node-esm/intent-resolver-SZJXQ3CW.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-J7NLV2V4.mjs.map +0 -7
- package/dist/types/src/bundler/bundler.d.ts +0 -39
- package/dist/types/src/bundler/bundler.d.ts.map +0 -1
- package/dist/types/src/bundler/bundler.test.d.ts +0 -2
- package/dist/types/src/bundler/bundler.test.d.ts.map +0 -1
- package/dist/types/src/bundler/index.d.ts +0 -2
- package/dist/types/src/bundler/index.d.ts.map +0 -1
- package/dist/types/src/components/ScriptToolbar/deploy.d.ts.map +0 -1
- package/dist/types/src/components/ScriptToolbar/format.d.ts.map +0 -1
- package/dist/types/src/components/ScriptToolbar/templateSelect.d.ts.map +0 -1
- package/dist/types/src/components/ScriptToolbar/useToolbarAction.d.ts.map +0 -1
- package/dist/types/src/components/ScriptToolbar/useToolbarState.d.ts.map +0 -1
- package/dist/types/src/components/ScriptToolbar/view.d.ts.map +0 -1
- package/src/bundler/bundler.test.ts +0 -55
- package/src/bundler/bundler.ts +0 -250
- package/src/bundler/index.ts +0 -5
- /package/dist/lib/browser/{AutomationPanel-OOIRJFPJ.mjs.map → AutomationPanel-J3SZ5L3Y.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-SJ4J527G.mjs.map → chunk-45LXDWNF.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-ZM6T4HPR.mjs.map → chunk-6MOQ4BP3.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-XPGBHZ3L.mjs.map → chunk-N46LE7FS.mjs.map} +0 -0
- /package/dist/lib/browser/{settings-YQQEU3DF.mjs.map → settings-SZCDKHWO.mjs.map} +0 -0
- /package/dist/lib/node/{AutomationPanel-EPRDDR3A.cjs.map → AutomationPanel-4M55FURO.cjs.map} +0 -0
- /package/dist/lib/node/{chunk-A2DI2G4D.cjs.map → chunk-ALY3N6PW.cjs.map} +0 -0
- /package/dist/lib/node/{chunk-6VKZJ4MH.cjs.map → chunk-DJGLGRQV.cjs.map} +0 -0
- /package/dist/lib/node/{chunk-DQRAVZM7.cjs.map → chunk-IID7WUQS.cjs.map} +0 -0
- /package/dist/lib/node/{settings-NGHDYAVK.cjs.map → settings-SZFSMSKM.cjs.map} +0 -0
- /package/dist/lib/node-esm/{AutomationPanel-DMLAGQS5.mjs.map → AutomationPanel-W6SKG35R.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-XUWS7OTK.mjs.map → chunk-CGF7EOGD.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-675XSDRN.mjs.map → chunk-CP5LXTK5.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-JHGOPQVO.mjs.map → chunk-UNQFIERE.mjs.map} +0 -0
- /package/dist/lib/node-esm/{settings-XGXDY4NI.mjs.map → settings-GR4O2WHZ.mjs.map} +0 -0
- /package/dist/types/src/{components/ScriptToolbar → hooks}/deploy.d.ts +0 -0
- /package/dist/types/src/{components/ScriptToolbar → hooks}/format.d.ts +0 -0
- /package/dist/types/src/{components/ScriptToolbar → hooks}/useToolbarState.d.ts +0 -0
- /package/dist/types/src/{components/ScriptToolbar → hooks}/view.d.ts +0 -0
- /package/src/{components/ScriptToolbar → hooks}/useToolbarState.ts +0 -0
|
@@ -2,7 +2,7 @@ import { type ScriptType } from '@dxos/functions';
|
|
|
2
2
|
import { type MenuAction, type MenuActionHandler } from '@dxos/react-ui-menu';
|
|
3
3
|
import { type DeployActionProperties } from './deploy';
|
|
4
4
|
import { type FormatActionProperties } from './format';
|
|
5
|
-
import { type TemplateActionProperties } from './
|
|
5
|
+
import { type TemplateActionProperties } from './template';
|
|
6
6
|
import { type ScriptToolbarState } from './useToolbarState';
|
|
7
7
|
import { type ViewActionProperties } from './view';
|
|
8
8
|
export type ScriptToolbarActionProperties = TemplateActionProperties | ViewActionProperties | FormatActionProperties | DeployActionProperties;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useToolbarAction.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useToolbarAction.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE9E,OAAO,EAAE,KAAK,sBAAsB,EAAoC,MAAM,UAAU,CAAC;AACzF,OAAO,EAAE,KAAK,sBAAsB,EAAoB,MAAM,UAAU,CAAC;AACzE,OAAO,EAAE,KAAK,wBAAwB,EAA4B,MAAM,YAAY,CAAC;AACrF,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAEnD,MAAM,MAAM,6BAA6B,GACrC,wBAAwB,GACxB,oBAAoB,GACpB,sBAAsB,GACtB,sBAAsB,CAAC;AAE3B,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,6BAA6B,CAAC,CAAC;AAE5E,eAAO,MAAM,gBAAgB,UAAW;IAAE,KAAK,EAAE,kBAAkB,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,sBA6BxF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useToolbarState.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useToolbarState.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAExC,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAAC;AAElE,eAAO,MAAM,eAAe,kBAAkB,kBAAkB;;;;;GAE/D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../../../src/hooks/view.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;AAEpD,MAAM,MAAM,SAAS,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;AAE3C,MAAM,MAAM,oBAAoB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,CAAC;AA6BrE,eAAO,MAAM,UAAU,UAAW,OAAO,CAAC,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;CAUnD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AAEvB,cAAc,gBAAgB,CAAC"}
|
package/dist/types/src/meta.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa,2BAA2B,CAAC;AAEtD,eAAO,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa,2BAA2B,CAAC;AAEtD,eAAO,MAAM,IAAI;;;;;;;;CASK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"echo.d.ts","sourceRoot":"","sources":["../../../../src/templates/echo.ts"],"names":[],"mappings":"AAIA;;GAEG;6DAKA,GAAG;AAJN,
|
|
1
|
+
{"version":3,"file":"echo.d.ts","sourceRoot":"","sources":["../../../../src/templates/echo.ts"],"names":[],"mappings":"AAIA;;GAEG;6DAKA,GAAG;AAJN,wBAWE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forex-effect.d.ts","sourceRoot":"","sources":["../../../../src/templates/forex-effect.ts"],"names":[],"mappings":"AAkBA;;GAEG;;AACH,wBAoBG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forex.d.ts","sourceRoot":"","sources":["../../../../src/templates/forex.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"forex.d.ts","sourceRoot":"","sources":["../../../../src/templates/forex.ts"],"names":[],"mappings":"AAOA;;GAEG;;AACH,wBAkBG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/templates/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/templates/index.ts"],"names":[],"mappings":"AAmBA,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,QAAQ,EAkC/B,CAAC"}
|
|
@@ -6,6 +6,8 @@ declare const _default: {
|
|
|
6
6
|
'object title placeholder'?: undefined;
|
|
7
7
|
'create object label'?: undefined;
|
|
8
8
|
'create stack section label'?: undefined;
|
|
9
|
+
'description label'?: undefined;
|
|
10
|
+
'description placeholder'?: undefined;
|
|
9
11
|
'binding placeholder'?: undefined;
|
|
10
12
|
'function request placeholder'?: undefined;
|
|
11
13
|
'deploy label'?: undefined;
|
|
@@ -42,6 +44,8 @@ declare const _default: {
|
|
|
42
44
|
'object title placeholder': string;
|
|
43
45
|
'create object label': string;
|
|
44
46
|
'create stack section label': string;
|
|
47
|
+
'description label': string;
|
|
48
|
+
'description placeholder': string;
|
|
45
49
|
'binding placeholder': string;
|
|
46
50
|
'function request placeholder': string;
|
|
47
51
|
'deploy label': string;
|
|
@@ -80,6 +84,8 @@ declare const _default: {
|
|
|
80
84
|
'object title placeholder': string;
|
|
81
85
|
'create object label': string;
|
|
82
86
|
'create stack section label': string;
|
|
87
|
+
'description label': string;
|
|
88
|
+
'description placeholder': string;
|
|
83
89
|
'binding placeholder': string;
|
|
84
90
|
'function request placeholder': string;
|
|
85
91
|
'deploy label': string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,wBA+CE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"5.7.
|
|
1
|
+
{"version":"5.7.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-script",
|
|
3
|
-
"version": "0.7.5-labs.
|
|
3
|
+
"version": "0.7.5-labs.ea4b4c2",
|
|
4
4
|
"description": "Braneframe notebook plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -53,38 +53,40 @@
|
|
|
53
53
|
"prettier": "^3.2.4",
|
|
54
54
|
"react-syntax-highlighter": "^15.5.0",
|
|
55
55
|
"typescript": "^5.7.2",
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/client
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/
|
|
65
|
-
"@dxos/
|
|
66
|
-
"@dxos/live-object": "0.7.5-labs.
|
|
67
|
-
"@dxos/keys": "0.7.5-labs.
|
|
68
|
-
"@dxos/
|
|
69
|
-
"@dxos/
|
|
70
|
-
"@dxos/plugin-
|
|
71
|
-
"@dxos/plugin-
|
|
72
|
-
"@dxos/plugin-markdown": "0.7.5-labs.
|
|
73
|
-
"@dxos/plugin-
|
|
74
|
-
"@dxos/
|
|
75
|
-
"@dxos/plugin-
|
|
76
|
-
"@dxos/
|
|
77
|
-
"@dxos/
|
|
78
|
-
"@dxos/react-
|
|
79
|
-
"@dxos/react-ui-
|
|
80
|
-
"@dxos/react-ui-
|
|
81
|
-
"@dxos/
|
|
82
|
-
"@dxos/react-ui-stack": "0.7.5-labs.
|
|
83
|
-
"@dxos/react-ui-
|
|
84
|
-
"@dxos/rpc": "0.7.5-labs.
|
|
85
|
-
"@dxos/rpc-tunnel": "0.7.5-labs.
|
|
86
|
-
"@dxos/
|
|
87
|
-
"@dxos/
|
|
56
|
+
"@dxos/artifact": "0.7.5-labs.ea4b4c2",
|
|
57
|
+
"@dxos/app-framework": "0.7.5-labs.ea4b4c2",
|
|
58
|
+
"@dxos/assistant": "0.7.5-labs.ea4b4c2",
|
|
59
|
+
"@dxos/client": "0.7.5-labs.ea4b4c2",
|
|
60
|
+
"@dxos/async": "0.7.5-labs.ea4b4c2",
|
|
61
|
+
"@dxos/client-protocol": "0.7.5-labs.ea4b4c2",
|
|
62
|
+
"@dxos/compute": "0.7.5-labs.ea4b4c2",
|
|
63
|
+
"@dxos/debug": "0.7.5-labs.ea4b4c2",
|
|
64
|
+
"@dxos/echo-schema": "0.7.5-labs.ea4b4c2",
|
|
65
|
+
"@dxos/functions": "0.7.5-labs.ea4b4c2",
|
|
66
|
+
"@dxos/live-object": "0.7.5-labs.ea4b4c2",
|
|
67
|
+
"@dxos/keys": "0.7.5-labs.ea4b4c2",
|
|
68
|
+
"@dxos/invariant": "0.7.5-labs.ea4b4c2",
|
|
69
|
+
"@dxos/local-storage": "0.7.5-labs.ea4b4c2",
|
|
70
|
+
"@dxos/plugin-client": "0.7.5-labs.ea4b4c2",
|
|
71
|
+
"@dxos/plugin-explorer": "0.7.5-labs.ea4b4c2",
|
|
72
|
+
"@dxos/plugin-markdown": "0.7.5-labs.ea4b4c2",
|
|
73
|
+
"@dxos/plugin-graph": "0.7.5-labs.ea4b4c2",
|
|
74
|
+
"@dxos/log": "0.7.5-labs.ea4b4c2",
|
|
75
|
+
"@dxos/plugin-space": "0.7.5-labs.ea4b4c2",
|
|
76
|
+
"@dxos/plugin-stack": "0.7.5-labs.ea4b4c2",
|
|
77
|
+
"@dxos/protocols": "0.7.5-labs.ea4b4c2",
|
|
78
|
+
"@dxos/react-client": "0.7.5-labs.ea4b4c2",
|
|
79
|
+
"@dxos/react-ui-attention": "0.7.5-labs.ea4b4c2",
|
|
80
|
+
"@dxos/react-ui-editor": "0.7.5-labs.ea4b4c2",
|
|
81
|
+
"@dxos/react-ui-menu": "0.7.5-labs.ea4b4c2",
|
|
82
|
+
"@dxos/react-ui-stack": "0.7.5-labs.ea4b4c2",
|
|
83
|
+
"@dxos/react-ui-form": "0.7.5-labs.ea4b4c2",
|
|
84
|
+
"@dxos/rpc": "0.7.5-labs.ea4b4c2",
|
|
85
|
+
"@dxos/rpc-tunnel": "0.7.5-labs.ea4b4c2",
|
|
86
|
+
"@dxos/react-ui-syntax-highlighter": "0.7.5-labs.ea4b4c2",
|
|
87
|
+
"@dxos/plugin-theme": "0.7.5-labs.ea4b4c2",
|
|
88
|
+
"@dxos/schema": "0.7.5-labs.ea4b4c2",
|
|
89
|
+
"@dxos/util": "0.7.5-labs.ea4b4c2"
|
|
88
90
|
},
|
|
89
91
|
"devDependencies": {
|
|
90
92
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -94,19 +96,19 @@
|
|
|
94
96
|
"react": "~18.2.0",
|
|
95
97
|
"react-dom": "~18.2.0",
|
|
96
98
|
"vite": "5.4.7",
|
|
97
|
-
"@dxos/react-ui": "0.7.5-labs.
|
|
98
|
-
"@dxos/
|
|
99
|
-
"@dxos/react-ui-
|
|
100
|
-
"@dxos/
|
|
101
|
-
"@dxos/storybook-utils": "0.7.5-labs.
|
|
99
|
+
"@dxos/react-ui": "0.7.5-labs.ea4b4c2",
|
|
100
|
+
"@dxos/random": "0.7.5-labs.ea4b4c2",
|
|
101
|
+
"@dxos/react-ui-mosaic": "0.7.5-labs.ea4b4c2",
|
|
102
|
+
"@dxos/react-ui-theme": "0.7.5-labs.ea4b4c2",
|
|
103
|
+
"@dxos/storybook-utils": "0.7.5-labs.ea4b4c2"
|
|
102
104
|
},
|
|
103
105
|
"peerDependencies": {
|
|
104
106
|
"@phosphor-icons/react": "^2.1.5",
|
|
105
107
|
"react": "~18.2.0",
|
|
106
108
|
"react-dom": "~18.2.0",
|
|
107
|
-
"@dxos/react-ui": "0.7.5-labs.
|
|
108
|
-
"@dxos/react-ui-mosaic": "0.7.5-labs.
|
|
109
|
-
"@dxos/react-ui-theme": "0.7.5-labs.
|
|
109
|
+
"@dxos/react-ui": "0.7.5-labs.ea4b4c2",
|
|
110
|
+
"@dxos/react-ui-mosaic": "0.7.5-labs.ea4b4c2",
|
|
111
|
+
"@dxos/react-ui-theme": "0.7.5-labs.ea4b4c2"
|
|
110
112
|
},
|
|
111
113
|
"publishConfig": {
|
|
112
114
|
"access": "public"
|
package/src/ScriptPlugin.tsx
CHANGED
|
@@ -4,21 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
// @ts-ignore
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
Capabilities,
|
|
9
|
-
contributes,
|
|
10
|
-
createIntent,
|
|
11
|
-
defineModule,
|
|
12
|
-
definePlugin,
|
|
13
|
-
Events,
|
|
14
|
-
oneOf,
|
|
15
|
-
} from '@dxos/app-framework';
|
|
7
|
+
import { Capabilities, contributes, createIntent, defineModule, definePlugin, Events } from '@dxos/app-framework';
|
|
16
8
|
import { type Space } from '@dxos/client/echo';
|
|
17
9
|
import { FunctionType, ScriptType } from '@dxos/functions';
|
|
18
10
|
import { RefArray } from '@dxos/live-object';
|
|
19
11
|
import { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';
|
|
20
12
|
|
|
21
|
-
import { Compiler, IntentResolver, ReactSurface, ScriptSettings } from './capabilities';
|
|
13
|
+
import { Artifact, Compiler, IntentResolver, ReactSurface, ScriptSettings } from './capabilities';
|
|
22
14
|
import { meta, SCRIPT_PLUGIN } from './meta';
|
|
23
15
|
import translations from './translations';
|
|
24
16
|
import { ScriptAction } from './types';
|
|
@@ -42,7 +34,7 @@ export const ScriptPlugin = () =>
|
|
|
42
34
|
}),
|
|
43
35
|
defineModule({
|
|
44
36
|
id: `${meta.id}/module/metadata`,
|
|
45
|
-
activatesOn:
|
|
37
|
+
activatesOn: Events.SetupMetadata,
|
|
46
38
|
activate: () =>
|
|
47
39
|
contributes(Capabilities.Metadata, {
|
|
48
40
|
id: ScriptType.typename,
|
|
@@ -59,7 +51,7 @@ export const ScriptPlugin = () =>
|
|
|
59
51
|
}),
|
|
60
52
|
defineModule({
|
|
61
53
|
id: `${meta.id}/module/schema`,
|
|
62
|
-
activatesOn: ClientEvents.
|
|
54
|
+
activatesOn: ClientEvents.SetupSchema,
|
|
63
55
|
activate: () => [
|
|
64
56
|
contributes(ClientCapabilities.SystemSchema, [FunctionType]),
|
|
65
57
|
contributes(ClientCapabilities.Schema, [ScriptType]),
|
|
@@ -67,7 +59,7 @@ export const ScriptPlugin = () =>
|
|
|
67
59
|
}),
|
|
68
60
|
defineModule({
|
|
69
61
|
id: `${meta.id}/module/react-surface`,
|
|
70
|
-
activatesOn: Events.
|
|
62
|
+
activatesOn: Events.SetupSurfaces,
|
|
71
63
|
activate: ReactSurface,
|
|
72
64
|
}),
|
|
73
65
|
defineModule({
|
|
@@ -75,4 +67,9 @@ export const ScriptPlugin = () =>
|
|
|
75
67
|
activatesOn: Events.SetupIntents,
|
|
76
68
|
activate: IntentResolver,
|
|
77
69
|
}),
|
|
70
|
+
defineModule({
|
|
71
|
+
id: `${meta.id}/module/artifact`,
|
|
72
|
+
activatesOn: Events.Startup,
|
|
73
|
+
activate: Artifact,
|
|
74
|
+
}),
|
|
78
75
|
]);
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Capabilities, contributes, createIntent, type PromiseIntentDispatcher } from '@dxos/app-framework';
|
|
6
|
+
import { defineArtifact, defineTool, ToolResult } from '@dxos/artifact';
|
|
7
|
+
import { createArtifactElement } from '@dxos/assistant';
|
|
8
|
+
import { ObjectId, S } from '@dxos/echo-schema';
|
|
9
|
+
import { ScriptType } from '@dxos/functions';
|
|
10
|
+
import { invariant } from '@dxos/invariant';
|
|
11
|
+
import { create, makeRef, type Space } from '@dxos/react-client/echo';
|
|
12
|
+
import { TextType } from '@dxos/schema';
|
|
13
|
+
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
14
|
+
|
|
15
|
+
// TODO(burdon): Factor out.
|
|
16
|
+
declare global {
|
|
17
|
+
interface ToolContextExtensions {
|
|
18
|
+
space?: Space;
|
|
19
|
+
dispatch?: PromiseIntentDispatcher;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default () => {
|
|
24
|
+
const definition = defineArtifact({
|
|
25
|
+
id: 'plugin-script',
|
|
26
|
+
// TODO(dmaretskyi): Since writing scripts requires a lot of domain knowledge,
|
|
27
|
+
// we should offload the work of synthesizing the code to a separate model.
|
|
28
|
+
// The main reasoning model will give it a concrete task and the script model will synthesize the code, knowing all the docs.
|
|
29
|
+
instructions: `
|
|
30
|
+
If the user explicitly requests you to write a script, you can create one.
|
|
31
|
+
If the user requests you to change one of the existing script, you can update it.
|
|
32
|
+
Scripts are short code pieces of executable code that can be used to perform computations, integrate with external systems, and perform automated tasks.
|
|
33
|
+
Each script must follow as strict shape for the definition but the body can contain any valid executable code.
|
|
34
|
+
Scripts are written in JavaScript or TypeScript.
|
|
35
|
+
Each script must define an input schema and output schema.
|
|
36
|
+
Each script must have its own detailed description.
|
|
37
|
+
|
|
38
|
+
Important: You cannot execute scripts. Scripts are only available as tools after the user deploys them. You must only call the available tools.
|
|
39
|
+
|
|
40
|
+
Description:
|
|
41
|
+
The description is a detailed description of the script.
|
|
42
|
+
It is used to describe the script's purpose, input, and output.
|
|
43
|
+
The description is used to generate the script's documentation.
|
|
44
|
+
The description is also goes into the script metadata.
|
|
45
|
+
The description is used by AI to understand the script and its purpose.
|
|
46
|
+
The description must provide cases on when the script should be used.
|
|
47
|
+
|
|
48
|
+
Schema:
|
|
49
|
+
The schema is defined using a schema-DSL library called Effect Schema.
|
|
50
|
+
The input schema describes the arguments that the script accepts.
|
|
51
|
+
The output schema describes the result that the script produces.
|
|
52
|
+
The schema is used to validate the script's input and output.
|
|
53
|
+
The schema is also goes into the script metadata.
|
|
54
|
+
The properties in the schema must have valid descriptions.
|
|
55
|
+
The input and output schemas must both be a struct of fields.
|
|
56
|
+
|
|
57
|
+
Restricts:
|
|
58
|
+
The scripts can only import code from "dxos:functions" module. No other modules are allowed.
|
|
59
|
+
Some web APIs are available - like fetch.
|
|
60
|
+
|
|
61
|
+
Reasoning:
|
|
62
|
+
Before writing a script, synthesize the following information:
|
|
63
|
+
- Description
|
|
64
|
+
- What APIs will be used.
|
|
65
|
+
- Detailed input schema
|
|
66
|
+
- Detailed output schema
|
|
67
|
+
|
|
68
|
+
<apis>
|
|
69
|
+
export function defineFunction(params: {
|
|
70
|
+
description: string,
|
|
71
|
+
inputSchema: S.Schema,
|
|
72
|
+
outputSchema: S.Schema,
|
|
73
|
+
handler: (params: { event: { data: TInput } }) => Promise<TOutput>
|
|
74
|
+
}): FunctionDefinition
|
|
75
|
+
/**
|
|
76
|
+
* Effect Schema
|
|
77
|
+
*/
|
|
78
|
+
export const S;
|
|
79
|
+
|
|
80
|
+
// Examples:
|
|
81
|
+
|
|
82
|
+
S.String
|
|
83
|
+
S.Number
|
|
84
|
+
S.Boolean
|
|
85
|
+
S.Struct({
|
|
86
|
+
from: S.String.annotations({ description: 'The source currency' }),
|
|
87
|
+
to: S.String.annotations({ description: 'The target currency' }),
|
|
88
|
+
})
|
|
89
|
+
S.Array(S.String)
|
|
90
|
+
S.Union(S.String, S.Number)
|
|
91
|
+
S.optional(S.String)
|
|
92
|
+
S.String.annotations({ description: 'The source currency' })
|
|
93
|
+
</apis>
|
|
94
|
+
|
|
95
|
+
<handler_function>
|
|
96
|
+
Async function that takes the argument in the form of:
|
|
97
|
+
|
|
98
|
+
type HandlerFunctionParam = {
|
|
99
|
+
event: {
|
|
100
|
+
data: T // The input schema
|
|
101
|
+
},
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
The function must return the result that matches the output schema.
|
|
105
|
+
</handler_function>
|
|
106
|
+
|
|
107
|
+
<example>
|
|
108
|
+
import { defineFunction, S } from 'dxos:functions';
|
|
109
|
+
|
|
110
|
+
export default defineFunction({
|
|
111
|
+
description: 'Returns the exchange rate between two currencies.',
|
|
112
|
+
|
|
113
|
+
inputSchema: S.Struct({
|
|
114
|
+
from: S.String.annotations({ description: 'The source currency' }),
|
|
115
|
+
to: S.String.annotations({ description: 'The target currency' }),
|
|
116
|
+
}),
|
|
117
|
+
|
|
118
|
+
outputSchema: S.Struct({
|
|
119
|
+
rate: S.String.annotations({ description: 'The exchange rate' }),
|
|
120
|
+
}),
|
|
121
|
+
|
|
122
|
+
handler: async ({
|
|
123
|
+
event: {
|
|
124
|
+
data: { from, to },
|
|
125
|
+
},
|
|
126
|
+
}: any) => {
|
|
127
|
+
const res = await fetch(\`https://free.ratesdb.com/v1/rates?from=\${from}&to=\${to}\`);
|
|
128
|
+
const {
|
|
129
|
+
data: { rates },
|
|
130
|
+
} = await res.json();
|
|
131
|
+
|
|
132
|
+
return { rate: rates[to].toString() };
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
</example>
|
|
136
|
+
`,
|
|
137
|
+
schema: ScriptType,
|
|
138
|
+
tools: [
|
|
139
|
+
defineTool({
|
|
140
|
+
name: 'script_new',
|
|
141
|
+
description: 'Create a new script. Returns the artifact definition for the script',
|
|
142
|
+
schema: S.Struct({
|
|
143
|
+
name: S.String.annotations({ description: 'The name of the script' }),
|
|
144
|
+
code: S.String.annotations({
|
|
145
|
+
description: 'The full code of the script in JavaScript or TypeScript. Must be valid executable code.',
|
|
146
|
+
}),
|
|
147
|
+
}),
|
|
148
|
+
execute: async ({ name, code }, { extensions }) => {
|
|
149
|
+
invariant(extensions?.space, 'No space');
|
|
150
|
+
invariant(extensions?.dispatch, 'No intent dispatcher');
|
|
151
|
+
const script = create(ScriptType, {
|
|
152
|
+
name,
|
|
153
|
+
source: makeRef(
|
|
154
|
+
create(TextType, {
|
|
155
|
+
content: code,
|
|
156
|
+
}),
|
|
157
|
+
),
|
|
158
|
+
});
|
|
159
|
+
extensions.space.db.add(script);
|
|
160
|
+
await extensions.space.db.flush();
|
|
161
|
+
|
|
162
|
+
const intent = createIntent(SpaceAction.AddObject, { target: extensions.space, object: script });
|
|
163
|
+
const { data, error } = await extensions.dispatch(intent);
|
|
164
|
+
if (!data || error) {
|
|
165
|
+
return ToolResult.Error(error?.message ?? 'Failed to create chess game');
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return ToolResult.Success(createArtifactElement(script.id));
|
|
169
|
+
},
|
|
170
|
+
}),
|
|
171
|
+
defineTool({
|
|
172
|
+
name: 'script_inspect',
|
|
173
|
+
description: 'Inspect a script. Returns the artifact definition for the script',
|
|
174
|
+
schema: S.Struct({
|
|
175
|
+
id: ObjectId,
|
|
176
|
+
}),
|
|
177
|
+
execute: async ({ id }, { extensions }) => {
|
|
178
|
+
invariant(extensions?.space, 'No space');
|
|
179
|
+
|
|
180
|
+
const script = (await extensions.space.db.query({ id }).first()) as ScriptType;
|
|
181
|
+
const { content } = await script.source.load();
|
|
182
|
+
|
|
183
|
+
return ToolResult.Success({
|
|
184
|
+
name: script.name,
|
|
185
|
+
code: content,
|
|
186
|
+
});
|
|
187
|
+
},
|
|
188
|
+
}),
|
|
189
|
+
defineTool({
|
|
190
|
+
name: 'script_update',
|
|
191
|
+
description: 'Update a script. Returns the artifact definition for the script',
|
|
192
|
+
schema: S.Struct({
|
|
193
|
+
id: ObjectId,
|
|
194
|
+
code: S.String.annotations({
|
|
195
|
+
description: 'The full code of the script in JavaScript or TypeScript. Must be valid executable code.',
|
|
196
|
+
}),
|
|
197
|
+
}),
|
|
198
|
+
execute: async ({ id, code }, { extensions }) => {
|
|
199
|
+
invariant(extensions?.space, 'No space');
|
|
200
|
+
|
|
201
|
+
const script = (await extensions.space.db.query({ id }).first()) as ScriptType;
|
|
202
|
+
const source = await script.source.load();
|
|
203
|
+
if (!source) {
|
|
204
|
+
return ToolResult.Error('Script not found');
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
source.content = code;
|
|
208
|
+
await extensions.space?.db.flush();
|
|
209
|
+
|
|
210
|
+
return ToolResult.Success({
|
|
211
|
+
name: script.name,
|
|
212
|
+
});
|
|
213
|
+
},
|
|
214
|
+
}),
|
|
215
|
+
],
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
return contributes(Capabilities.ArtifactDefinition, definition);
|
|
219
|
+
};
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
import wasmUrl from 'esbuild-wasm/esbuild.wasm?url';
|
|
7
7
|
|
|
8
8
|
import { contributes } from '@dxos/app-framework';
|
|
9
|
+
import { initializeBundler } from '@dxos/functions/bundler';
|
|
9
10
|
|
|
10
11
|
import { ScriptCapabilities } from './capabilities';
|
|
11
|
-
import { initializeBundler } from '../bundler';
|
|
12
12
|
import { Compiler } from '../compiler';
|
|
13
13
|
|
|
14
14
|
export default async () => {
|
|
@@ -8,5 +8,6 @@ export const Compiler = lazy(() => import('./compiler'));
|
|
|
8
8
|
export const IntentResolver = lazy(() => import('./intent-resolver'));
|
|
9
9
|
export const ReactSurface = lazy(() => import('./react-surface'));
|
|
10
10
|
export const ScriptSettings = lazy(() => import('./settings'));
|
|
11
|
+
export const Artifact = lazy(() => import('./artifact'));
|
|
11
12
|
|
|
12
13
|
export * from './capabilities';
|
|
@@ -15,29 +15,32 @@ import { ScriptAction } from '../types';
|
|
|
15
15
|
export default () =>
|
|
16
16
|
contributes(
|
|
17
17
|
Capabilities.IntentResolver,
|
|
18
|
-
createResolver(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
createResolver({
|
|
19
|
+
intent: ScriptAction.Create,
|
|
20
|
+
resolve: async ({ name, gistUrl }) => {
|
|
21
|
+
let content = templates[0].source;
|
|
22
|
+
const gistId = gistUrl?.split('/').at(-1);
|
|
23
|
+
if (gistId) {
|
|
24
|
+
// TODO(wittjosiah): Capability which contributes Octokit?
|
|
25
|
+
// NOTE: AccessToken not needed to read public gists.
|
|
26
|
+
const octokit = new Octokit();
|
|
27
|
+
const response = await octokit.request('GET /gists/{gist_id}', {
|
|
28
|
+
gist_id: gistId,
|
|
29
|
+
});
|
|
30
|
+
const gistContent = Object.values(response.data.files ?? {})[0]?.content;
|
|
31
|
+
if (gistContent) {
|
|
32
|
+
content = gistContent;
|
|
33
|
+
}
|
|
31
34
|
}
|
|
32
|
-
}
|
|
33
35
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
return {
|
|
37
|
+
data: {
|
|
38
|
+
object: create(ScriptType, {
|
|
39
|
+
name,
|
|
40
|
+
source: makeRef(create(TextType, { content })),
|
|
41
|
+
}),
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
},
|
|
42
45
|
}),
|
|
43
46
|
);
|
|
@@ -6,6 +6,7 @@ import React from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { Capabilities, contributes, createSurface, useCapability } from '@dxos/app-framework';
|
|
8
8
|
import { ScriptType } from '@dxos/functions';
|
|
9
|
+
import { SettingsStore } from '@dxos/local-storage';
|
|
9
10
|
import { Clipboard } from '@dxos/react-ui';
|
|
10
11
|
|
|
11
12
|
import { ScriptCapabilities } from './capabilities';
|
|
@@ -17,12 +18,10 @@ export default () =>
|
|
|
17
18
|
contributes(Capabilities.ReactSurface, [
|
|
18
19
|
createSurface({
|
|
19
20
|
id: `${SCRIPT_PLUGIN}/settings`,
|
|
20
|
-
role: '
|
|
21
|
-
filter: (data): data is
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return <ScriptSettings settings={settings} />;
|
|
25
|
-
},
|
|
21
|
+
role: 'article',
|
|
22
|
+
filter: (data): data is { subject: SettingsStore<ScriptSettingsProps> } =>
|
|
23
|
+
data.subject instanceof SettingsStore && data.subject.prefix === SCRIPT_PLUGIN,
|
|
24
|
+
component: ({ data: { subject } }) => <ScriptSettings settings={subject.value} />,
|
|
26
25
|
}),
|
|
27
26
|
createSurface({
|
|
28
27
|
id: `${SCRIPT_PLUGIN}/article`,
|
|
@@ -30,14 +29,15 @@ export default () =>
|
|
|
30
29
|
filter: (data): data is { subject: ScriptType } => data.subject instanceof ScriptType,
|
|
31
30
|
component: ({ data, role }) => {
|
|
32
31
|
const compiler = useCapability(ScriptCapabilities.Compiler);
|
|
33
|
-
|
|
32
|
+
// TODO(dmaretskyi): Since settings store is not reactive, this would break on the script plugin being enabled without a page reload.
|
|
33
|
+
const settings = useCapability(Capabilities.SettingsStore).getStore<ScriptSettingsProps>(SCRIPT_PLUGIN)?.value;
|
|
34
34
|
return <ScriptContainer role={role} script={data.subject} settings={settings} env={compiler.environment} />;
|
|
35
35
|
},
|
|
36
36
|
}),
|
|
37
37
|
createSurface({
|
|
38
38
|
id: `${SCRIPT_PLUGIN}/automation`,
|
|
39
39
|
role: 'complementary--automation',
|
|
40
|
-
|
|
40
|
+
position: 'hoist',
|
|
41
41
|
filter: (data): data is { subject: ScriptType } => data.subject instanceof ScriptType,
|
|
42
42
|
component: ({ data }) => <AutomationPanel subject={data.subject} />,
|
|
43
43
|
}),
|
|
@@ -5,14 +5,13 @@
|
|
|
5
5
|
import React, { useEffect, useRef } from 'react';
|
|
6
6
|
|
|
7
7
|
import { clientServiceBundle } from '@dxos/client-protocol';
|
|
8
|
+
import { type BundlerResult } from '@dxos/functions/bundler';
|
|
8
9
|
import { log } from '@dxos/log';
|
|
9
10
|
import { useClient } from '@dxos/react-client';
|
|
10
11
|
import { baseSurface, mx } from '@dxos/react-ui-theme';
|
|
11
12
|
import { createProtoRpcPeer } from '@dxos/rpc';
|
|
12
13
|
import { createIFramePort } from '@dxos/rpc-tunnel';
|
|
13
14
|
|
|
14
|
-
import { type BundlerResult } from '../../bundler';
|
|
15
|
-
|
|
16
15
|
export type FrameContainerProps = {
|
|
17
16
|
containerUrl: string;
|
|
18
17
|
result: BundlerResult;
|