@dxos/plugin-script 0.7.5-labs.e27f9b9 → 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-EBER222J.mjs → ScriptContainer-AL4ZLJID.mjs} +91 -66
- 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-PEYUXEY6.mjs → chunk-ALQHMUJN.mjs} +6 -6
- package/dist/lib/browser/{chunk-PEYUXEY6.mjs.map → chunk-ALQHMUJN.mjs.map} +2 -2
- 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/{compiler-HT53ILG7.mjs → compiler-YY2XSKHQ.mjs} +4 -6
- package/dist/lib/browser/compiler-YY2XSKHQ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +14 -14
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-G2REMZHC.mjs → intent-resolver-CMKQTLBG.mjs} +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-GH4LL6CF.mjs → react-surface-YELZNYPR.mjs} +5 -5
- package/dist/lib/browser/{react-surface-GH4LL6CF.mjs.map → react-surface-YELZNYPR.mjs.map} +2 -2
- 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-UXMQLKDV.cjs → ScriptContainer-FKCNWHBW.cjs} +93 -66
- 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-UAHKFS7F.cjs → chunk-F5Z3DMHA.cjs} +10 -10
- package/dist/lib/node/{chunk-UAHKFS7F.cjs.map → chunk-F5Z3DMHA.cjs.map} +2 -2
- package/dist/lib/node/{chunk-DQRAVZM7.cjs → chunk-IID7WUQS.cjs} +6 -6
- 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 +33 -32
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/{intent-resolver-IWGK77AZ.cjs → intent-resolver-V5ASU5DW.cjs} +7 -7
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-3JKCVT5O.cjs → react-surface-SMMFAPZD.cjs} +18 -18
- package/dist/lib/node/{react-surface-3JKCVT5O.cjs.map → react-surface-SMMFAPZD.cjs.map} +2 -2
- 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-56ES2HQ5.mjs → ScriptContainer-52KVAFUY.mjs} +91 -66
- 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-TYGM5YLW.mjs → chunk-GXRS4YIV.mjs} +6 -6
- package/dist/lib/node-esm/{chunk-TYGM5YLW.mjs.map → chunk-GXRS4YIV.mjs.map} +2 -2
- 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 +14 -14
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-KGADFH3H.mjs → intent-resolver-75BHFRUK.mjs} +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-JW776PVP.mjs → react-surface-7PHSWVOU.mjs} +5 -5
- package/dist/lib/node-esm/{react-surface-JW776PVP.mjs.map → react-surface-7PHSWVOU.mjs.map} +2 -2
- 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 +1 -0
- package/dist/types/src/capabilities/index.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/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/package.json +43 -42
- package/src/ScriptPlugin.tsx +6 -1
- package/src/capabilities/artifact.ts +219 -0
- package/src/capabilities/compiler.ts +1 -1
- package/src/capabilities/index.ts +1 -0
- package/src/capabilities/react-surface.tsx +2 -1
- package/src/components/FrameContainer/FrameContainer.tsx +1 -2
- package/src/components/ScriptContainer.tsx +10 -5
- package/src/components/ScriptSettingsPanel.tsx +2 -2
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +8 -6
- package/src/{components/ScriptToolbar → hooks}/deploy.ts +14 -3
- 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/dist/lib/browser/ScriptContainer-EBER222J.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-SDHKTS6H.mjs +0 -237
- package/dist/lib/browser/chunk-SDHKTS6H.mjs.map +0 -7
- package/dist/lib/browser/compiler-HT53ILG7.mjs.map +0 -7
- package/dist/lib/node/ScriptContainer-UXMQLKDV.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/compiler-457ZR24G.cjs.map +0 -7
- package/dist/lib/node-esm/ScriptContainer-56ES2HQ5.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/compiler-PEARFTFR.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/{intent-resolver-G2REMZHC.mjs.map → intent-resolver-CMKQTLBG.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/{intent-resolver-IWGK77AZ.cjs.map → intent-resolver-V5ASU5DW.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/{intent-resolver-KGADFH3H.mjs.map → intent-resolver-75BHFRUK.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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAMA,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AAEtC,eAAO,MAAM,eAAe,qIAA0C,CAAC;AACvE,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAMA,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AAEtC,eAAO,MAAM,eAAe,qIAA0C,CAAC;AACvE,eAAO,MAAM,eAAe,mKAA0C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../../src/hooks/deploy.ts"],"names":[],"mappings":"AAMA,OAAO,EAKL,KAAK,UAAU,EAGhB,MAAM,iBAAiB,CAAC;AAQzB,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAGxC,MAAM,MAAM,sBAAsB,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3E,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,YAAY,UAAW,OAAO,CAAC,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;CA8BvD,CAAC;AAUF,eAAO,MAAM,cAAc,sBAAuB;IAAE,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,SAepG,CAAC;AAEF,eAAO,MAAM,gBAAgB,sBAAuB;IAAE,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,wBAqEtG,CAAC;AAEF,eAAO,MAAM,cAAc,cAAe;IAAE,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;CAAE,wBAMhD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../src/hooks/format.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAMlD,MAAM,MAAM,sBAAsB,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;AAExD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;CAUxB,CAAC;AAEF,eAAO,MAAM,gBAAgB,eAAgB;IAAE,MAAM,EAAE,UAAU,CAAA;CAAE,wBAiB9C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AAEvB,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../../src/hooks/template.ts"],"names":[],"mappings":"AAMA,OAAO,EAA6B,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAO7E,MAAM,MAAM,wBAAwB,GAAG;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAmB3E,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;CAUhC,CAAC;AAEF,eAAO,MAAM,wBAAwB,eAAgB;IAAE,MAAM,EAAE,UAAU,CAAA;CAAE,kBAE1D,MAAM,SAiBtB,CAAC"}
|
|
@@ -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"}
|
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,39 +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/
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/
|
|
65
|
-
"@dxos/
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/
|
|
68
|
-
"@dxos/
|
|
69
|
-
"@dxos/
|
|
70
|
-
"@dxos/plugin-
|
|
71
|
-
"@dxos/plugin-
|
|
72
|
-
"@dxos/plugin-markdown": "0.7.5-labs.
|
|
73
|
-
"@dxos/plugin-graph": "0.7.5-labs.
|
|
74
|
-
"@dxos/
|
|
75
|
-
"@dxos/plugin-
|
|
76
|
-
"@dxos/plugin-
|
|
77
|
-
"@dxos/protocols": "0.7.5-labs.
|
|
78
|
-
"@dxos/react-
|
|
79
|
-
"@dxos/react-
|
|
80
|
-
"@dxos/react-ui-editor": "0.7.5-labs.
|
|
81
|
-
"@dxos/react-ui-
|
|
82
|
-
"@dxos/react-ui-
|
|
83
|
-
"@dxos/
|
|
84
|
-
"@dxos/
|
|
85
|
-
"@dxos/
|
|
86
|
-
"@dxos/
|
|
87
|
-
"@dxos/
|
|
88
|
-
"@dxos/schema": "0.7.5-labs.
|
|
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"
|
|
89
90
|
},
|
|
90
91
|
"devDependencies": {
|
|
91
92
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -95,19 +96,19 @@
|
|
|
95
96
|
"react": "~18.2.0",
|
|
96
97
|
"react-dom": "~18.2.0",
|
|
97
98
|
"vite": "5.4.7",
|
|
98
|
-
"@dxos/react-ui": "0.7.5-labs.
|
|
99
|
-
"@dxos/random": "0.7.5-labs.
|
|
100
|
-
"@dxos/react-ui-mosaic": "0.7.5-labs.
|
|
101
|
-
"@dxos/react-ui-theme": "0.7.5-labs.
|
|
102
|
-
"@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"
|
|
103
104
|
},
|
|
104
105
|
"peerDependencies": {
|
|
105
106
|
"@phosphor-icons/react": "^2.1.5",
|
|
106
107
|
"react": "~18.2.0",
|
|
107
108
|
"react-dom": "~18.2.0",
|
|
108
|
-
"@dxos/react-ui
|
|
109
|
-
"@dxos/react-ui": "0.7.5-labs.
|
|
110
|
-
"@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"
|
|
111
112
|
},
|
|
112
113
|
"publishConfig": {
|
|
113
114
|
"access": "public"
|
package/src/ScriptPlugin.tsx
CHANGED
|
@@ -10,7 +10,7 @@ import { FunctionType, ScriptType } from '@dxos/functions';
|
|
|
10
10
|
import { RefArray } from '@dxos/live-object';
|
|
11
11
|
import { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';
|
|
12
12
|
|
|
13
|
-
import { Compiler, IntentResolver, ReactSurface, ScriptSettings } from './capabilities';
|
|
13
|
+
import { Artifact, Compiler, IntentResolver, ReactSurface, ScriptSettings } from './capabilities';
|
|
14
14
|
import { meta, SCRIPT_PLUGIN } from './meta';
|
|
15
15
|
import translations from './translations';
|
|
16
16
|
import { ScriptAction } from './types';
|
|
@@ -67,4 +67,9 @@ export const ScriptPlugin = () =>
|
|
|
67
67
|
activatesOn: Events.SetupIntents,
|
|
68
68
|
activate: IntentResolver,
|
|
69
69
|
}),
|
|
70
|
+
defineModule({
|
|
71
|
+
id: `${meta.id}/module/artifact`,
|
|
72
|
+
activatesOn: Events.Startup,
|
|
73
|
+
activate: Artifact,
|
|
74
|
+
}),
|
|
70
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';
|
|
@@ -29,7 +29,8 @@ export default () =>
|
|
|
29
29
|
filter: (data): data is { subject: ScriptType } => data.subject instanceof ScriptType,
|
|
30
30
|
component: ({ data, role }) => {
|
|
31
31
|
const compiler = useCapability(ScriptCapabilities.Compiler);
|
|
32
|
-
|
|
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;
|
|
33
34
|
return <ScriptContainer role={role} script={data.subject} settings={settings} env={compiler.environment} />;
|
|
34
35
|
},
|
|
35
36
|
}),
|
|
@@ -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;
|
|
@@ -14,19 +14,24 @@ import { mx } from '@dxos/react-ui-theme';
|
|
|
14
14
|
|
|
15
15
|
import { DebugPanel } from './DebugPanel';
|
|
16
16
|
import { ScriptToolbar } from './ScriptToolbar';
|
|
17
|
-
import { useDeployState } from './ScriptToolbar/deploy';
|
|
18
|
-
import { useToolbarState } from './ScriptToolbar/useToolbarState';
|
|
19
17
|
import { TypescriptEditor, type TypescriptEditorProps } from './TypescriptEditor';
|
|
18
|
+
import { useDeployState, useToolbarState } from '../hooks';
|
|
20
19
|
import { type ScriptSettingsProps } from '../types';
|
|
21
20
|
|
|
22
21
|
export type ScriptEditorProps = ThemedClassName<{
|
|
23
22
|
script: ScriptType;
|
|
24
|
-
settings
|
|
23
|
+
settings?: ScriptSettingsProps;
|
|
25
24
|
role?: string;
|
|
26
25
|
}> &
|
|
27
26
|
Pick<TypescriptEditorProps, 'env'>;
|
|
28
27
|
|
|
29
|
-
export const ScriptContainer = ({
|
|
28
|
+
export const ScriptContainer = ({
|
|
29
|
+
role,
|
|
30
|
+
classNames,
|
|
31
|
+
script,
|
|
32
|
+
settings = { editorInputMode: 'vscode' },
|
|
33
|
+
env,
|
|
34
|
+
}: ScriptEditorProps) => {
|
|
30
35
|
const identity = useIdentity();
|
|
31
36
|
const space = getSpace(script);
|
|
32
37
|
|
|
@@ -49,7 +54,7 @@ export const ScriptContainer = ({ role, classNames, script, settings, env }: Scr
|
|
|
49
54
|
[script, script.source.target, space, identity],
|
|
50
55
|
);
|
|
51
56
|
|
|
52
|
-
const state = useToolbarState({ view: '
|
|
57
|
+
const state = useToolbarState({ view: 'editor' });
|
|
53
58
|
useDeployState({ state, script });
|
|
54
59
|
|
|
55
60
|
return (
|
|
@@ -10,7 +10,7 @@ import { FunctionType, type ScriptType, getInvocationUrl, getUserFunctionUrlInMe
|
|
|
10
10
|
import { log } from '@dxos/log';
|
|
11
11
|
import { useClient } from '@dxos/react-client';
|
|
12
12
|
import { Filter, getMeta, getSpace, useQuery } from '@dxos/react-client/echo';
|
|
13
|
-
import { Button, Clipboard, Input, Separator,
|
|
13
|
+
import { Button, Clipboard, Input, Separator, useControlledState, useTranslation } from '@dxos/react-ui';
|
|
14
14
|
import { AccessTokenType } from '@dxos/schema';
|
|
15
15
|
|
|
16
16
|
import { SCRIPT_PLUGIN } from '../meta';
|
|
@@ -57,7 +57,7 @@ export const ScriptSettingsPanel = ({ script }: ScriptSettingsPanelProps) => {
|
|
|
57
57
|
return () => clearTimeout(timeout);
|
|
58
58
|
}, [githubToken, gistKey]);
|
|
59
59
|
|
|
60
|
-
const [binding, setBinding] =
|
|
60
|
+
const [binding, setBinding] = useControlledState(fn?.binding ?? '');
|
|
61
61
|
const handleBindingChange = useCallback(
|
|
62
62
|
(event: ChangeEvent<HTMLInputElement>) => {
|
|
63
63
|
setBinding(event.target.value);
|
|
@@ -10,12 +10,14 @@ import { ElevationProvider, type ThemedClassName } from '@dxos/react-ui';
|
|
|
10
10
|
import { stackItemContentToolbarClassNames } from '@dxos/react-ui-editor';
|
|
11
11
|
import { createGapSeparator, MenuProvider, ToolbarMenu, useMenuActions } from '@dxos/react-ui-menu';
|
|
12
12
|
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
import {
|
|
14
|
+
type ScriptToolbarState,
|
|
15
|
+
createDeploy,
|
|
16
|
+
createFormat,
|
|
17
|
+
createTemplateSelect,
|
|
18
|
+
createView,
|
|
19
|
+
useToolbarAction,
|
|
20
|
+
} from '../../hooks';
|
|
19
21
|
|
|
20
22
|
export type ScriptToolbarProps = ThemedClassName<{
|
|
21
23
|
role?: string;
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
setUserFunctionUrlInMetadata,
|
|
14
14
|
uploadWorkerFunction,
|
|
15
15
|
} from '@dxos/functions';
|
|
16
|
+
import { Bundler } from '@dxos/functions/bundler';
|
|
16
17
|
import { log } from '@dxos/log';
|
|
17
18
|
import { useClient } from '@dxos/react-client';
|
|
18
19
|
import { Filter, create, getMeta, getSpace, makeRef, useQuery } from '@dxos/react-client/echo';
|
|
@@ -20,8 +21,7 @@ import { useTranslation } from '@dxos/react-ui';
|
|
|
20
21
|
import { createMenuAction } from '@dxos/react-ui-menu';
|
|
21
22
|
|
|
22
23
|
import { type ViewState } from './view';
|
|
23
|
-
import {
|
|
24
|
-
import { SCRIPT_PLUGIN } from '../../meta';
|
|
24
|
+
import { SCRIPT_PLUGIN } from '../meta';
|
|
25
25
|
|
|
26
26
|
export type DeployActionProperties = { type: 'deploy' } | { type: 'copy' };
|
|
27
27
|
|
|
@@ -130,13 +130,24 @@ export const useDeployHandler = ({ state, script }: { state: Partial<DeployState
|
|
|
130
130
|
fn ?? space.db.add(create(FunctionType, { name: functionId, version, source: makeRef(script) }));
|
|
131
131
|
|
|
132
132
|
script.changed = false;
|
|
133
|
-
|
|
133
|
+
if (script.description !== undefined && script.description.trim() !== '') {
|
|
134
|
+
deployedFunction.description = script.description;
|
|
135
|
+
} else if (meta.description) {
|
|
136
|
+
deployedFunction.description = meta.description;
|
|
137
|
+
} else {
|
|
138
|
+
log.verbose('no description in function metadata', { functionId });
|
|
139
|
+
}
|
|
134
140
|
|
|
135
141
|
if (meta.inputSchema) {
|
|
136
142
|
deployedFunction.inputSchema = meta.inputSchema;
|
|
137
143
|
} else {
|
|
138
144
|
log.verbose('no input schema in function metadata', { functionId });
|
|
139
145
|
}
|
|
146
|
+
if (meta.outputSchema) {
|
|
147
|
+
deployedFunction.outputSchema = meta.outputSchema;
|
|
148
|
+
} else {
|
|
149
|
+
log.verbose('no output schema in function metadata', { functionId });
|
|
150
|
+
}
|
|
140
151
|
|
|
141
152
|
setUserFunctionUrlInMetadata(getMeta(deployedFunction), `/${space.id}/${functionId}`);
|
|
142
153
|
|
|
@@ -11,7 +11,7 @@ import { type ScriptType } from '@dxos/functions';
|
|
|
11
11
|
import { log } from '@dxos/log';
|
|
12
12
|
import { createMenuAction } from '@dxos/react-ui-menu';
|
|
13
13
|
|
|
14
|
-
import { SCRIPT_PLUGIN } from '
|
|
14
|
+
import { SCRIPT_PLUGIN } from '../meta';
|
|
15
15
|
|
|
16
16
|
export type FormatActionProperties = { type: 'format' };
|
|
17
17
|
|
|
@@ -8,8 +8,8 @@ import { FUNCTIONS_PRESET_META_KEY, type ScriptType } from '@dxos/functions';
|
|
|
8
8
|
import { getMeta } from '@dxos/live-object';
|
|
9
9
|
import { createMenuItemGroup, createMenuAction } from '@dxos/react-ui-menu';
|
|
10
10
|
|
|
11
|
-
import { SCRIPT_PLUGIN } from '
|
|
12
|
-
import { templates } from '
|
|
11
|
+
import { SCRIPT_PLUGIN } from '../meta';
|
|
12
|
+
import { templates } from '../templates';
|
|
13
13
|
|
|
14
14
|
export type TemplateActionProperties = { type: 'template'; value: string };
|
|
15
15
|
|