@dxos/plugin-script 0.7.4 → 0.7.5-labs.401163d
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-PMTZROAZ.mjs → AutomationPanel-J3SZ5L3Y.mjs} +4 -11
- package/dist/lib/browser/AutomationPanel-J3SZ5L3Y.mjs.map +7 -0
- package/dist/lib/browser/ScriptContainer-JHAVO2KA.mjs +713 -0
- package/dist/lib/browser/ScriptContainer-JHAVO2KA.mjs.map +7 -0
- package/dist/lib/browser/artifact-YCIVHFSS.mjs +243 -0
- package/dist/lib/browser/artifact-YCIVHFSS.mjs.map +7 -0
- package/dist/lib/browser/{chunk-K7KY6YMG.mjs → chunk-45LXDWNF.mjs} +2 -2
- package/dist/lib/browser/chunk-6MOQ4BP3.mjs +15 -0
- package/dist/lib/browser/chunk-6MOQ4BP3.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-N46LE7FS.mjs +40 -0
- package/dist/lib/browser/chunk-N46LE7FS.mjs.map +7 -0
- package/dist/lib/browser/chunk-UDLKK74O.mjs +69 -0
- package/dist/lib/browser/chunk-UDLKK74O.mjs.map +7 -0
- package/dist/lib/browser/chunk-WAXHENSY.mjs +236 -0
- package/dist/lib/browser/chunk-WAXHENSY.mjs.map +7 -0
- package/dist/lib/browser/compiler-YY2XSKHQ.mjs +82 -0
- package/dist/lib/browser/compiler-YY2XSKHQ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +111 -359
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-RV3YXIVN.mjs +45 -0
- package/dist/lib/browser/intent-resolver-RV3YXIVN.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-ETY4XKFG.mjs +65 -0
- package/dist/lib/browser/react-surface-ETY4XKFG.mjs.map +7 -0
- package/dist/lib/browser/settings-SZCDKHWO.mjs +24 -0
- package/dist/lib/browser/settings-SZCDKHWO.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +10 -0
- package/dist/lib/node/{AutomationPanel-AAGQREH7.cjs → AutomationPanel-4M55FURO.cjs} +16 -17
- package/dist/lib/node/AutomationPanel-4M55FURO.cjs.map +7 -0
- package/dist/lib/node/ScriptContainer-EBIT6CT4.cjs +719 -0
- package/dist/lib/node/ScriptContainer-EBIT6CT4.cjs.map +7 -0
- package/dist/lib/node/artifact-IPGGY2Z2.cjs +262 -0
- package/dist/lib/node/artifact-IPGGY2Z2.cjs.map +7 -0
- package/dist/lib/node/chunk-3VDHZ54A.cjs +264 -0
- package/dist/lib/node/chunk-3VDHZ54A.cjs.map +7 -0
- package/dist/lib/node/{chunk-6LYX73ZT.cjs → chunk-5UH3F7TA.cjs} +11 -8
- package/dist/lib/node/chunk-5UH3F7TA.cjs.map +7 -0
- package/dist/lib/node/{meta.cjs → chunk-ALY3N6PW.cjs} +12 -8
- package/dist/lib/node/chunk-ALY3N6PW.cjs.map +7 -0
- package/dist/lib/node/chunk-DJGLGRQV.cjs +60 -0
- package/dist/lib/node/chunk-DJGLGRQV.cjs.map +7 -0
- package/dist/lib/node/{chunk-4INUJLXL.cjs → chunk-IID7WUQS.cjs} +6 -6
- package/dist/lib/node/chunk-JKPNBFU2.cjs +77 -0
- package/dist/lib/node/chunk-JKPNBFU2.cjs.map +7 -0
- package/dist/lib/node/compiler-UIBLKJKG.cjs +104 -0
- package/dist/lib/node/compiler-UIBLKJKG.cjs.map +7 -0
- package/dist/lib/node/index.cjs +108 -347
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/intent-resolver-WFLQNAID.cjs +59 -0
- package/dist/lib/node/intent-resolver-WFLQNAID.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/react-surface-OIQJFA7P.cjs +84 -0
- package/dist/lib/node/react-surface-OIQJFA7P.cjs.map +7 -0
- package/dist/lib/node/settings-SZFSMSKM.cjs +38 -0
- package/dist/lib/node/settings-SZFSMSKM.cjs.map +7 -0
- package/dist/lib/node/{types/index.cjs → types.cjs} +6 -8
- package/dist/lib/node/types.cjs.map +7 -0
- package/dist/lib/node-esm/{AutomationPanel-ETQEDY5I.mjs → AutomationPanel-W6SKG35R.mjs} +4 -11
- package/dist/lib/node-esm/AutomationPanel-W6SKG35R.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptContainer-QVFTCAML.mjs +714 -0
- package/dist/lib/node-esm/ScriptContainer-QVFTCAML.mjs.map +7 -0
- package/dist/lib/node-esm/artifact-7H4HGX5W.mjs +245 -0
- package/dist/lib/node-esm/artifact-7H4HGX5W.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-5CEKSMA5.mjs +71 -0
- package/dist/lib/node-esm/chunk-5CEKSMA5.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-OFYGBUNI.mjs → chunk-CGF7EOGD.mjs} +2 -2
- package/dist/lib/node-esm/chunk-CP5LXTK5.mjs +16 -0
- package/dist/lib/node-esm/chunk-CP5LXTK5.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-SLTZMY34.mjs → chunk-P2V2Y5LV.mjs} +7 -4
- package/dist/lib/node-esm/chunk-P2V2Y5LV.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-UNQFIERE.mjs +41 -0
- package/dist/lib/node-esm/chunk-UNQFIERE.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WCAUDRF4.mjs +237 -0
- package/dist/lib/node-esm/chunk-WCAUDRF4.mjs.map +7 -0
- package/dist/lib/node-esm/compiler-XTXFGZJM.mjs +83 -0
- package/dist/lib/node-esm/compiler-XTXFGZJM.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +111 -359
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-resolver-CYT6IYYH.mjs +46 -0
- package/dist/lib/node-esm/intent-resolver-CYT6IYYH.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-N67GNKC2.mjs +66 -0
- package/dist/lib/node-esm/react-surface-N67GNKC2.mjs.map +7 -0
- package/dist/lib/node-esm/settings-GR4O2WHZ.mjs +25 -0
- package/dist/lib/node-esm/settings-GR4O2WHZ.mjs.map +7 -0
- package/dist/lib/node-esm/types.mjs +11 -0
- package/dist/types/src/ScriptPlugin.d.ts +1 -3
- 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/capabilities.d.ts +5 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/compiler.d.ts +4 -0
- package/dist/types/src/capabilities/compiler.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +7 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +4 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings.d.ts +4 -0
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +2 -2
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/FrameContainer/FrameContainer.d.ts +2 -2
- package/dist/types/src/components/FrameContainer/FrameContainer.d.ts.map +1 -1
- package/dist/types/src/components/ScriptContainer.d.ts +10 -2
- package/dist/types/src/components/ScriptContainer.d.ts.map +1 -1
- package/dist/types/src/components/ScriptSettings/ScriptSettings.d.ts.map +1 -1
- package/dist/types/src/components/ScriptSettingsPanel.d.ts +1 -1
- package/dist/types/src/components/ScriptSettingsPanel.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts +11 -0
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -0
- package/dist/types/src/components/{Toolbar/Toolbar.stories.d.ts → ScriptToolbar/ScriptToolbar.stories.d.ts} +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts.map +1 -0
- package/dist/types/src/components/ScriptToolbar/index.d.ts +2 -0
- package/dist/types/src/components/ScriptToolbar/index.d.ts.map +1 -0
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts +4 -2
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.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 +48 -0
- package/dist/types/src/hooks/deploy.d.ts.map +1 -0
- package/dist/types/src/hooks/format.d.ts +25 -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/hooks/template.d.ts +31 -0
- package/dist/types/src/hooks/template.d.ts.map +1 -0
- package/dist/types/src/hooks/useToolbarAction.d.ts +14 -0
- package/dist/types/src/hooks/useToolbarAction.d.ts.map +1 -0
- package/dist/types/src/hooks/useToolbarState.d.ts +10 -0
- package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -0
- package/dist/types/src/hooks/view.d.ts +33 -0
- package/dist/types/src/hooks/view.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +2 -5
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/templates/discord.d.ts +3 -0
- package/dist/types/src/templates/discord.d.ts.map +1 -0
- package/dist/types/src/templates/echo.d.ts.map +1 -1
- package/dist/types/src/templates/email.d.ts +2 -1
- package/dist/types/src/templates/email.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.d.ts → templates/index.d.ts} +1 -1
- package/dist/types/src/templates/index.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +54 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +30 -0
- package/dist/types/src/types.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +45 -55
- package/src/ScriptPlugin.tsx +62 -145
- package/src/capabilities/artifact.ts +219 -0
- package/src/capabilities/capabilities.ts +12 -0
- package/src/capabilities/compiler.ts +33 -0
- package/src/capabilities/index.ts +13 -0
- package/src/capabilities/intent-resolver.ts +46 -0
- package/src/capabilities/react-surface.tsx +54 -0
- package/src/capabilities/settings.ts +14 -0
- package/src/compiler/compiler.browser.test.ts +1 -1
- package/src/components/AutomationPanel/AutomationPanel.tsx +2 -4
- package/src/components/FrameContainer/FrameContainer.tsx +5 -4
- package/src/components/ScriptContainer.tsx +69 -9
- package/src/components/ScriptSettings/ScriptSettings.tsx +28 -4
- package/src/components/ScriptSettingsPanel.tsx +140 -53
- package/src/components/{Toolbar/Toolbar.stories.tsx → ScriptToolbar/ScriptToolbar.stories.tsx} +2 -2
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +53 -0
- package/src/{bundler → components/ScriptToolbar}/index.ts +1 -1
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +2 -0
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +75 -10
- package/src/hooks/deploy.ts +169 -0
- package/src/hooks/format.ts +47 -0
- package/src/hooks/index.ts +11 -0
- package/src/hooks/template.ts +64 -0
- package/src/hooks/useToolbarAction.ts +54 -0
- package/src/hooks/useToolbarState.ts +16 -0
- package/src/hooks/view.ts +52 -0
- package/src/index.ts +2 -7
- package/src/meta.ts +4 -2
- package/src/templates/discord.ts +88 -0
- package/src/templates/echo.ts +5 -1
- package/src/templates/email.ts +26 -23
- package/src/templates/forex-effect.ts +44 -0
- package/src/templates/forex.ts +21 -13
- package/src/{templates.ts → templates/index.ts} +20 -5
- package/src/translations.ts +20 -1
- package/src/types.ts +39 -0
- package/dist/lib/browser/AutomationPanel-PMTZROAZ.mjs.map +0 -7
- package/dist/lib/browser/ScriptContainer-RYZFYCNK.mjs +0 -425
- package/dist/lib/browser/ScriptContainer-RYZFYCNK.mjs.map +0 -7
- package/dist/lib/browser/chunk-4UTRJLQ3.mjs +0 -286
- package/dist/lib/browser/chunk-4UTRJLQ3.mjs.map +0 -7
- package/dist/lib/browser/chunk-C7VBULMK.mjs +0 -18
- package/dist/lib/browser/chunk-C7VBULMK.mjs.map +0 -7
- package/dist/lib/browser/chunk-QFZUFT5G.mjs +0 -48
- package/dist/lib/browser/chunk-QFZUFT5G.mjs.map +0 -7
- package/dist/lib/browser/chunk-U3OP64V4.mjs +0 -123
- package/dist/lib/browser/chunk-U3OP64V4.mjs.map +0 -7
- package/dist/lib/browser/edge/index.mjs +0 -19
- package/dist/lib/browser/meta.mjs +0 -9
- package/dist/lib/browser/types/index.mjs +0 -12
- package/dist/lib/browser/types/index.mjs.map +0 -7
- package/dist/lib/node/AutomationPanel-AAGQREH7.cjs.map +0 -7
- package/dist/lib/node/ScriptContainer-FZ44UIRC.cjs +0 -427
- package/dist/lib/node/ScriptContainer-FZ44UIRC.cjs.map +0 -7
- package/dist/lib/node/chunk-6LYX73ZT.cjs.map +0 -7
- package/dist/lib/node/chunk-CS25QNKZ.cjs +0 -151
- package/dist/lib/node/chunk-CS25QNKZ.cjs.map +0 -7
- package/dist/lib/node/chunk-DQYAU2CJ.cjs +0 -67
- package/dist/lib/node/chunk-DQYAU2CJ.cjs.map +0 -7
- package/dist/lib/node/chunk-WPP65EYS.cjs +0 -298
- package/dist/lib/node/chunk-WPP65EYS.cjs.map +0 -7
- package/dist/lib/node/edge/index.cjs +0 -41
- package/dist/lib/node/edge/index.cjs.map +0 -7
- package/dist/lib/node/meta.cjs.map +0 -7
- package/dist/lib/node/types/index.cjs.map +0 -7
- package/dist/lib/node-esm/AutomationPanel-ETQEDY5I.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptContainer-3PKDW34A.mjs +0 -426
- package/dist/lib/node-esm/ScriptContainer-3PKDW34A.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-36DLLQ6E.mjs +0 -125
- package/dist/lib/node-esm/chunk-36DLLQ6E.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4SRPREUK.mjs +0 -288
- package/dist/lib/node-esm/chunk-4SRPREUK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GMVPKT6A.mjs +0 -49
- package/dist/lib/node-esm/chunk-GMVPKT6A.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SLTZMY34.mjs.map +0 -7
- package/dist/lib/node-esm/edge/index.mjs +0 -20
- package/dist/lib/node-esm/edge/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.mjs +0 -10
- package/dist/lib/node-esm/meta.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -13
- package/dist/lib/node-esm/types/index.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/ScriptBlock/ScriptBlock.d.ts +0 -12
- package/dist/types/src/components/ScriptBlock/ScriptBlock.d.ts.map +0 -1
- package/dist/types/src/components/ScriptBlock/ScriptBlock.stories.d.ts +0 -6
- package/dist/types/src/components/ScriptBlock/ScriptBlock.stories.d.ts.map +0 -1
- package/dist/types/src/components/ScriptBlock/index.d.ts +0 -2
- package/dist/types/src/components/ScriptBlock/index.d.ts.map +0 -1
- package/dist/types/src/components/ScriptEditor.d.ts +0 -9
- package/dist/types/src/components/ScriptEditor.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +0 -23
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/index.d.ts +0 -2
- package/dist/types/src/components/Toolbar/index.d.ts.map +0 -1
- package/dist/types/src/edge/functions.d.ts +0 -25
- package/dist/types/src/edge/functions.d.ts.map +0 -1
- package/dist/types/src/edge/index.d.ts +0 -2
- package/dist/types/src/edge/index.d.ts.map +0 -1
- package/dist/types/src/templates.d.ts.map +0 -1
- package/dist/types/src/types/index.d.ts +0 -3
- package/dist/types/src/types/index.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -71
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/dist/types/src/types/types.d.ts +0 -8
- package/dist/types/src/types/types.d.ts.map +0 -1
- package/src/bundler/bundler.test.ts +0 -54
- package/src/bundler/bundler.ts +0 -250
- package/src/components/ScriptBlock/ScriptBlock.stories.tsx +0 -52
- package/src/components/ScriptBlock/ScriptBlock.tsx +0 -102
- package/src/components/ScriptBlock/index.ts +0 -5
- package/src/components/ScriptEditor.tsx +0 -191
- package/src/components/Toolbar/Toolbar.tsx +0 -177
- package/src/components/Toolbar/index.ts +0 -5
- package/src/edge/functions.ts +0 -116
- package/src/edge/index.ts +0 -7
- package/src/types/index.ts +0 -6
- package/src/types/schema.ts +0 -44
- package/src/types/types.ts +0 -29
- /package/dist/lib/browser/{chunk-K7KY6YMG.mjs.map → chunk-45LXDWNF.mjs.map} +0 -0
- /package/dist/lib/browser/{edge/index.mjs.map → types.mjs.map} +0 -0
- /package/dist/lib/node/{chunk-4INUJLXL.cjs.map → chunk-IID7WUQS.cjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-OFYGBUNI.mjs.map → chunk-CGF7EOGD.mjs.map} +0 -0
- /package/dist/lib/{browser/meta.mjs.map → node-esm/types.mjs.map} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["raw-loader:./chat.ts?raw", "raw-loader:./chess.ts?raw", "raw-loader:./discord.ts?raw", "raw-loader:./echo.ts?raw", "raw-loader:./email.ts?raw", "raw-loader:./forex-effect.ts?raw", "raw-loader:./forex.ts?raw", "../../../src/templates/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\n// @ts-ignore\nimport { transformServerSentEvents } from 'https://esm.sh/@dxos/script-toolbox';\n\n/**\n * Chatbot that answers questions based on the context data.\n */\nexport default async ({\n event: {\n data: { request },\n },\n context: { space, ai },\n}: any) => {\n const textBody = await request.text();\n let parsedRequest: any;\n try {\n parsedRequest = JSON.parse(textBody);\n } catch (err) {\n const answer = await ai.run('@cf/meta/llama-3.1-8b-instruct', {\n stream: true,\n prompt: `\n Using only the context data below to answer the user's question.\n If you cannot answer the question from the provided content, then reply with \"I don't know.\"\n\n CONTEXT:\n ${await getContext({ space })}\n\n QUESTION:\n ${textBody}\n `,\n });\n return new Response(transformServerSentEvents(answer));\n }\n\n const promptId = parsedRequest.trigger.promptId;\n const promptObject = await space.crud.query({ id: promptId }).first();\n\n if (parsedRequest.data.objects.length !== 1) {\n return new Response('Message batches not supported.');\n }\n\n const messageId = parsedRequest.data.objects[0];\n let message;\n try {\n message = await space.crud.query({ id: messageId }).first();\n } catch (err) {\n return new Response('Message not replicated yet.', { status: 409 });\n }\n\n if (message.text.includes('--------')) {\n return new Response('Message was already processed.');\n }\n\n let prompt = promptObject.template;\n for (const input of promptObject.inputs) {\n let value: string | null = null;\n if (input.type === ChainInputType.VALUE) {\n value = String(input.value);\n } else if (input.type === ChainInputType.RETRIEVER) {\n value = await getContext({ space });\n } else if (input.type === ChainInputType.PASS_THROUGH) {\n value = message.text;\n }\n if (value) {\n prompt = prompt.replaceAll(`{${input.name}}`, value);\n }\n }\n\n const answer = await ai.run('@cf/meta/llama-3.1-8b-instruct', {\n stream: false,\n prompt,\n });\n const response = { response: answer.response, prompt, message };\n const textWithAnswer = message.text + '\\n--------\\n\\n' + answer.response;\n await space.crud.update({ id: messageId }, { text: textWithAnswer });\n\n return new Response(JSON.stringify(response));\n};\n\nconst getContext = async ({ space }: any) => {\n let context = '';\n const { objects: docs } = await space.crud.query({ __typename: 'dxos.org/type/Document' }).run();\n for (const doc of docs) {\n const { content } = await space.crud.query({ id: doc.content }).first();\n context += content + '\\n\\n';\n }\n return context;\n};\n\nenum ChainInputType {\n VALUE = 0,\n PASS_THROUGH = 1,\n RETRIEVER = 2,\n FUNCTION = 3,\n QUERY = 4,\n RESOLVER = 5,\n CONTEXT = 6,\n SCHEMA = 7,\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\n// @ts-ignore\nimport { Chess } from 'https://esm.sh/chess.js@0.13.1';\n\n/**\n * Plays a random move in a chess game.\n */\nexport default async ({\n event: {\n data: { request },\n },\n context: { space },\n}: any) => {\n const {\n data: {\n objects: [gameId],\n player = 'b',\n },\n } = await request.json();\n\n const { pgn } = await space.crud.query({ id: gameId }).first();\n const game = new Chess();\n game.load_pgn(pgn);\n if (game.turn() !== player) {\n return new Response('Invalid turn', { status: 409 });\n }\n\n const moves = game.moves();\n const move = moves[Math.floor(Math.random() * moves.length)];\n if (!move) {\n return new Response('No legal moves', { status: 406 });\n }\n\n game.move(move);\n const newPgn = game.pgn();\n await space.crud.update({ id: gameId }, { pgn: newPgn });\n return new Response(game.ascii());\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\n// @ts-ignore\nimport { createStatic, EchoObject, defineFunction, DXN, Filter, ObjectId, S } from 'dxos:functions';\nimport {\n FetchHttpClient,\n // @ts-ignore\n} from 'https://esm.sh/@effect/platform@0.77.2?deps=effect@3.13.3';\n// @ts-ignore\nimport { DiscordConfig, DiscordREST, DiscordRESTMemoryLive } from 'https://esm.sh/dfx@0.113.0?deps=effect@3.13.3';\n// @ts-ignore\nimport { Effect, Config, Redacted } from 'https://esm.sh/effect@3.13.3';\n\nconst MessageSchema = S.Struct({\n id: S.String,\n foreignId: S.Number,\n content: S.String,\n}).pipe(EchoObject('example.com/type/Message', '0.1.0'));\n\nexport default defineFunction({\n inputSchema: S.Struct({\n // TODO(wittjosiah): Remove. This is used to provide a terminal for a cron trigger.\n tick: S.optional(S.String),\n channelId: S.String,\n pageSize: S.optional(S.Number),\n queueId: S.String,\n }),\n\n outputSchema: S.Struct({\n newMessages: S.Number,\n }),\n\n handler: ({\n event: {\n data: { channelId, queueId, pageSize = 5 },\n },\n context: { space },\n }: any) =>\n Effect.gen(function* () {\n const { token } = yield* Effect.tryPromise(() =>\n space.db.query(Filter.typename('dxos.org/type/AccessToken', { source: 'discord.com' })).first(),\n );\n\n const enqueueMessages = Effect.gen(function* () {\n const rest = yield* DiscordREST;\n const { objects } = yield* Effect.tryPromise(() => space.queues.queryQueue(DXN.parse(queueId)));\n\n let newMessages = 0;\n let lastMessage = objects.at(-1);\n while (true) {\n // NOTE: If `after` is specified, the specified message is included in the results.\n const messages = yield* rest\n .getChannelMessages(channelId, { after: lastMessage?.foreignId, limit: pageSize })\n .pipe((res: any) => res.json);\n if (messages.length === 1) {\n break;\n }\n const queueMessages = messages\n .map((message: any) =>\n createStatic(MessageSchema, {\n id: ObjectId.random(),\n foreignId: parseInt(message.id),\n content: message.content,\n }),\n )\n .slice(lastMessage ? 1 : 0)\n .toReversed();\n yield* Effect.tryPromise(() => space.queues.insertIntoQueue(DXN.parse(queueId), queueMessages));\n newMessages += queueMessages.length;\n lastMessage = queueMessages.at(-1);\n }\n\n return { newMessages };\n }).pipe(\n Effect.provide(DiscordRESTMemoryLive),\n Effect.provide(\n DiscordConfig.layerConfig({\n token: Config.succeed(Redacted.make(token)),\n }),\n ),\n Effect.provide(FetchHttpClient.layer),\n );\n\n return yield* enqueueMessages;\n }),\n});\n", "//\n// Copyright 2024 DXOS.org\n//\n\n/**\n * Echos the request data.\n */\nexport default async ({\n event: {\n data: { request },\n },\n}: any) => {\n const data = await request.json();\n return new Response(JSON.stringify(data ?? {}), {\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\n/**\n * Appends a message to the end of a Document configured through a trigger.\n * Trigger must have a targetDocumentId field set in Meta.\n */\nexport default async ({\n event: {\n data: { request },\n },\n context: { space },\n}: any) => {\n const { data, trigger } = (await request.json()) as RequestPayload;\n\n const documentId = trigger.meta.targetDocumentId;\n const document = await space.db.query({ id: documentId }, { format: 'plain' }).first();\n\n const contentId = document.content['/'].split(':')[3];\n const documentContent = await space.db.query({ id: contentId }, { format: 'plain' }).first();\n const modifiedContent = [\n documentContent.content,\n '',\n '---',\n `**From:** ${data.from}`,\n `**Subject:** ${data.subject}`,\n `**Date:** ${data.created}`,\n '',\n data.body,\n ].join('\\n');\n\n await space.db.update({ id: contentId }, { content: modifiedContent });\n\n return new Response(JSON.stringify({ success: true }));\n};\n\ntype RequestPayload = {\n data: { from: string; subject: string; created: string; body: string };\n trigger: { meta: { targetDocumentId: string } };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\n// @ts-ignore\nimport { defineFunction, S } from 'dxos:functions';\nimport {\n HttpClient,\n HttpClientRequest,\n FetchHttpClient,\n // @ts-ignore\n} from 'https://esm.sh/@effect/platform@0.77.2?deps=effect@3.13.3';\n// @ts-ignore\nimport { Effect, Schedule } from 'https://esm.sh/effect@3.13.3';\n\n/**\n * Returns the exchange rate between two currencies.\n */\nexport default defineFunction({\n inputSchema: S.Struct({\n from: S.String.annotations({ description: 'The source currency' }),\n to: S.String.annotations({ description: 'The target currency' }),\n }),\n\n outputSchema: S.Struct({\n rate: S.Number,\n }),\n\n handler: async ({\n event: {\n data: { from, to },\n },\n }: any) =>\n Effect.gen(function* () {\n const res = yield* HttpClientRequest.get(`https://free.ratesdb.com/v1/rates?from=${from}&to=${to}`).pipe(\n HttpClient.execute,\n Effect.flatMap((res: any) => res.json),\n Effect.timeout('1 second'),\n Effect.retry(Schedule.exponential(1000).pipe(Schedule.compose(Schedule.recurs(3)))),\n Effect.scoped,\n );\n return { rate: res.data.rates[to].toString() };\n }).pipe(Effect.provide(FetchHttpClient.layer)),\n});\n", "//\n// Copyright 2025 DXOS.org\n//\n\n// @ts-ignore\nimport { defineFunction, S } from 'dxos:functions';\n\n/**\n * Returns the exchange rate between two currencies.\n */\nexport default defineFunction({\n inputSchema: S.Struct({\n from: S.String.annotations({ description: 'The source currency' }),\n to: S.String.annotations({ description: 'The target currency' }),\n }),\n\n handler: async ({\n event: {\n data: { from, to },\n },\n }: any) => {\n const res = await fetch(`https://free.ratesdb.com/v1/rates?from=${from}&to=${to}`);\n const {\n data: { rates },\n } = await res.json();\n\n return rates[to].toString();\n },\n});\n", "//\n// Copyright 2024 DXOS.org\n//\n\n// @ts-ignore\nimport chat from './chat.ts?raw';\n// @ts-ignore\nimport chess from './chess.ts?raw';\n// @ts-ignore\nimport discord from './discord.ts?raw';\n// @ts-ignore\nimport echo from './echo.ts?raw';\n// @ts-ignore\nimport email from './email.ts?raw';\n// @ts-ignore\nimport forexEffect from './forex-effect.ts?raw';\n// @ts-ignore\nimport forex from './forex.ts?raw';\n\nconst removeHeader = (str: string) => str.split('\\n').slice(4).join('\\n');\n\nexport type Template = {\n id: string;\n name: string;\n source: string;\n presetId?: string;\n};\n\nexport const templates: Template[] = [\n {\n id: 'dxos.org/script/echo',\n name: 'Echo',\n source: removeHeader(echo),\n },\n {\n id: 'dxos.org/script/forex',\n name: 'Forex',\n source: removeHeader(forex),\n },\n {\n id: 'dxos.org/script/forex-effect',\n name: 'Forex (Effect)',\n source: removeHeader(forexEffect),\n },\n {\n id: 'dxos.org/script/gpt',\n name: 'Gpt',\n source: removeHeader(chat),\n presetId: 'dxos.org/function/gpt',\n },\n {\n id: 'dxos.org/script/chess',\n name: 'Chess',\n source: removeHeader(chess),\n presetId: 'dxos.org/function/chess',\n },\n {\n id: 'dxos.org/script/email',\n name: 'Email',\n source: removeHeader(email),\n presetId: 'dxos.org/function/email',\n },\n {\n id: 'dxos.org/script/discord',\n name: 'Discord',\n source: removeHeader(discord),\n presetId: 'dxos.org/function/discord',\n },\n];\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,eAAA;ACAA,IAAA,gBAAA;ACAA,IAAA,kBAAA;ACAA,IAAA,eAAA;ACAA,IAAA,gBAAA;ACAA,IAAA,uBAAA;ACAA,IAAA,gBAAA;ACmBA,IAAMA,eAAe,CAACC,QAAgBA,IAAIC,MAAM,IAAA,EAAMC,MAAM,CAAA,EAAGC,KAAK,IAAA;AAS7D,IAAMC,YAAwB;EACnC;IACEC,IAAI;IACJC,MAAM;IACNC,QAAQR,aAAaS,YAAAA;EACvB;EACA;IACEH,IAAI;IACJC,MAAM;IACNC,QAAQR,aAAaU,aAAAA;EACvB;EACA;IACEJ,IAAI;IACJC,MAAM;IACNC,QAAQR,aAAaW,oBAAAA;EACvB;EACA;IACEL,IAAI;IACJC,MAAM;IACNC,QAAQR,aAAaY,YAAAA;IACrBC,UAAU;EACZ;EACA;IACEP,IAAI;IACJC,MAAM;IACNC,QAAQR,aAAac,aAAAA;IACrBD,UAAU;EACZ;EACA;IACEP,IAAI;IACJC,MAAM;IACNC,QAAQR,aAAae,aAAAA;IACrBF,UAAU;EACZ;EACA;IACEP,IAAI;IACJC,MAAM;IACNC,QAAQR,aAAagB,eAAAA;IACrBH,UAAU;EACZ;;",
|
|
6
|
+
"names": ["removeHeader", "str", "split", "slice", "join", "templates", "id", "name", "source", "echo", "forex", "forexEffect", "chat", "presetId", "chess", "email", "discord"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var compiler_UIBLKJKG_exports = {};
|
|
30
|
+
__export(compiler_UIBLKJKG_exports, {
|
|
31
|
+
default: () => compiler_default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(compiler_UIBLKJKG_exports);
|
|
34
|
+
var import_chunk_ALY3N6PW = require("./chunk-ALY3N6PW.cjs");
|
|
35
|
+
var import_chunk_5UH3F7TA = require("./chunk-5UH3F7TA.cjs");
|
|
36
|
+
var import_esbuild = __toESM(require("esbuild-wasm/esbuild.wasm?url"));
|
|
37
|
+
var import_app_framework = require("@dxos/app-framework");
|
|
38
|
+
var import_bundler = require("@dxos/functions/bundler");
|
|
39
|
+
var import_vfs = require("@typescript/vfs");
|
|
40
|
+
var import_typescript = __toESM(require("typescript"));
|
|
41
|
+
var import_invariant = require("@dxos/invariant");
|
|
42
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-script/src/compiler/compiler.ts";
|
|
43
|
+
var defaultOptions = {
|
|
44
|
+
lib: [
|
|
45
|
+
"DOM",
|
|
46
|
+
"es2022"
|
|
47
|
+
],
|
|
48
|
+
target: import_typescript.default.ScriptTarget.ES2022
|
|
49
|
+
};
|
|
50
|
+
var Compiler = class {
|
|
51
|
+
constructor(_options = defaultOptions) {
|
|
52
|
+
this._options = _options;
|
|
53
|
+
}
|
|
54
|
+
async initialize() {
|
|
55
|
+
if (this._env) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
this._fsMap = await (0, import_vfs.createDefaultMapFromCDN)(this._options, "5.5.4", true, import_typescript.default);
|
|
59
|
+
const system = (0, import_vfs.createSystem)(this._fsMap);
|
|
60
|
+
this._env = (0, import_vfs.createVirtualTypeScriptEnvironment)(system, [], import_typescript.default, this._options);
|
|
61
|
+
}
|
|
62
|
+
get environment() {
|
|
63
|
+
(0, import_invariant.invariant)(this._env, "Compiler environment not initialized.", {
|
|
64
|
+
F: __dxlog_file,
|
|
65
|
+
L: 39,
|
|
66
|
+
S: this,
|
|
67
|
+
A: [
|
|
68
|
+
"this._env",
|
|
69
|
+
"'Compiler environment not initialized.'"
|
|
70
|
+
]
|
|
71
|
+
});
|
|
72
|
+
return this._env;
|
|
73
|
+
}
|
|
74
|
+
setFile(fileName, content) {
|
|
75
|
+
(0, import_invariant.invariant)(this._fsMap, "File system map not initialized.", {
|
|
76
|
+
F: __dxlog_file,
|
|
77
|
+
L: 44,
|
|
78
|
+
S: this,
|
|
79
|
+
A: [
|
|
80
|
+
"this._fsMap",
|
|
81
|
+
"'File system map not initialized.'"
|
|
82
|
+
]
|
|
83
|
+
});
|
|
84
|
+
this.environment.createFile(fileName, content);
|
|
85
|
+
}
|
|
86
|
+
compile(fileName) {
|
|
87
|
+
return this.environment.languageService.getEmitOutput(fileName);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
var compiler_default = async () => {
|
|
91
|
+
const compiler = new Compiler();
|
|
92
|
+
await compiler.initialize();
|
|
93
|
+
compiler.setFile("/src/typings.d.ts", "declare module 'https://*';");
|
|
94
|
+
compiler.setFile("/src/runtime.ts", `
|
|
95
|
+
export const Filter: any = {};
|
|
96
|
+
export type FunctionHandler = ({ event, context }: { event: any; context: any }) => Promise<Response>;
|
|
97
|
+
export const functionHandler = (handler: FunctionHandler) => handler;
|
|
98
|
+
`);
|
|
99
|
+
await (0, import_bundler.initializeBundler)({
|
|
100
|
+
wasmUrl: import_esbuild.default
|
|
101
|
+
});
|
|
102
|
+
return (0, import_app_framework.contributes)(import_chunk_ALY3N6PW.ScriptCapabilities.Compiler, compiler);
|
|
103
|
+
};
|
|
104
|
+
//# sourceMappingURL=compiler-UIBLKJKG.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/compiler.ts", "../../../src/compiler/compiler.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\n// @ts-ignore\nimport wasmUrl from 'esbuild-wasm/esbuild.wasm?url';\n\nimport { contributes } from '@dxos/app-framework';\nimport { initializeBundler } from '@dxos/functions/bundler';\n\nimport { ScriptCapabilities } from './capabilities';\nimport { Compiler } from '../compiler';\n\nexport default async () => {\n const compiler = new Compiler();\n\n await compiler.initialize();\n // TODO(wittjosiah): Fetch types for https modules.\n compiler.setFile('/src/typings.d.ts', \"declare module 'https://*';\");\n // TODO(wittjosiah): Proper function handler types.\n // TODO(wittjosiah): Remove.\n compiler.setFile(\n '/src/runtime.ts',\n `\n export const Filter: any = {};\n export type FunctionHandler = ({ event, context }: { event: any; context: any }) => Promise<Response>;\n export const functionHandler = (handler: FunctionHandler) => handler;\n `,\n );\n await initializeBundler({ wasmUrl });\n\n return contributes(ScriptCapabilities.Compiler, compiler);\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport {\n createDefaultMapFromCDN,\n createSystem,\n createVirtualTypeScriptEnvironment,\n type VirtualTypeScriptEnvironment,\n} from '@typescript/vfs';\nimport ts from 'typescript';\n\nimport { invariant } from '@dxos/invariant';\n\nconst defaultOptions: ts.CompilerOptions = {\n lib: ['DOM', 'es2022'],\n target: ts.ScriptTarget.ES2022,\n};\n\nexport class Compiler {\n private _env: VirtualTypeScriptEnvironment | undefined;\n private _fsMap: Map<string, string> | undefined;\n\n constructor(private readonly _options: ts.CompilerOptions = defaultOptions) {}\n\n async initialize() {\n if (this._env) {\n return;\n }\n\n // TODO(wittjosiah): Figure out how to get workers working in plugin packages.\n // https://github.com/val-town/codemirror-ts?tab=readme-ov-file#setup-worker\n this._fsMap = await createDefaultMapFromCDN(this._options, '5.5.4', true, ts);\n const system = createSystem(this._fsMap);\n this._env = createVirtualTypeScriptEnvironment(system, [], ts, this._options);\n }\n\n get environment() {\n invariant(this._env, 'Compiler environment not initialized.');\n return this._env;\n }\n\n setFile(fileName: string, content: string) {\n invariant(this._fsMap, 'File system map not initialized.');\n this.environment.createFile(fileName, content);\n }\n\n compile(fileName: string) {\n return this.environment.languageService.getEmitOutput(fileName);\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,qBAAoB;AAEpB,2BAA4B;AAC5B,qBAAkC;ACJlC,iBAKO;AACP,wBAAe;AAEf,uBAA0B;;AAE1B,IAAMA,iBAAqC;EACzCC,KAAK;IAAC;IAAO;;EACbC,QAAQC,kBAAAA,QAAGC,aAAaC;AAC1B;AAEO,IAAMC,WAAN,MAAMA;EAIXC,YAA6BC,WAA+BR,gBAAgB;SAA/CQ,WAAAA;EAAgD;EAE7E,MAAMC,aAAa;AACjB,QAAI,KAAKC,MAAM;AACb;IACF;AAIA,SAAKC,SAAS,UAAMC,oCAAwB,KAAKJ,UAAU,SAAS,MAAML,kBAAAA,OAAAA;AAC1E,UAAMU,aAASC,yBAAa,KAAKH,MAAM;AACvC,SAAKD,WAAOK,+CAAmCF,QAAQ,CAAA,GAAIV,kBAAAA,SAAI,KAAKK,QAAQ;EAC9E;EAEA,IAAIQ,cAAc;AAChBC,oCAAU,KAAKP,MAAM,yCAAA;;;;;;;;;AACrB,WAAO,KAAKA;EACd;EAEAQ,QAAQC,UAAkBC,SAAiB;AACzCH,oCAAU,KAAKN,QAAQ,oCAAA;;;;;;;;;AACvB,SAAKK,YAAYK,WAAWF,UAAUC,OAAAA;EACxC;EAEAE,QAAQH,UAAkB;AACxB,WAAO,KAAKH,YAAYO,gBAAgBC,cAAcL,QAAAA;EACxD;AACF;ADrCA,IAAA,mBAAe,YAAA;AACb,QAAMM,WAAW,IAAInB,SAAAA;AAErB,QAAMmB,SAAShB,WAAU;AAEzBgB,WAASP,QAAQ,qBAAqB,6BAAA;AAGtCO,WAASP,QACP,mBACA;;;;OAIG;AAEL,YAAMQ,kCAAkB;IAAEC,wBAAAA;EAAQ,CAAA;AAElC,aAAOC,kCAAYC,yCAAmBvB,UAAUmB,QAAAA;AAClD;",
|
|
6
|
+
"names": ["defaultOptions", "lib", "target", "ts", "ScriptTarget", "ES2022", "Compiler", "constructor", "_options", "initialize", "_env", "_fsMap", "createDefaultMapFromCDN", "system", "createSystem", "createVirtualTypeScriptEnvironment", "environment", "invariant", "setFile", "fileName", "content", "createFile", "compile", "languageService", "getEmitOutput", "compiler", "initializeBundler", "wasmUrl", "contributes", "ScriptCapabilities"]
|
|
7
|
+
}
|
package/dist/lib/node/index.cjs
CHANGED
|
@@ -28,206 +28,44 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var node_exports = {};
|
|
30
30
|
__export(node_exports, {
|
|
31
|
-
AutomationPanel: () => AutomationPanel,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
ScriptAction: () => import_chunk_DQYAU2CJ.ScriptAction,
|
|
36
|
-
ScriptContainer: () => ScriptContainer,
|
|
31
|
+
AutomationPanel: () => import_chunk_3VDHZ54A.AutomationPanel,
|
|
32
|
+
SCRIPT_PLUGIN: () => import_chunk_5UH3F7TA.SCRIPT_PLUGIN,
|
|
33
|
+
ScriptCapabilities: () => import_chunk_ALY3N6PW.ScriptCapabilities,
|
|
34
|
+
ScriptContainer: () => import_chunk_3VDHZ54A.ScriptContainer,
|
|
37
35
|
ScriptPlugin: () => ScriptPlugin,
|
|
38
|
-
ScriptSettings: () => ScriptSettings,
|
|
39
|
-
ScriptSettingsPanel: () => ScriptSettingsPanel,
|
|
40
|
-
|
|
41
|
-
default: () => src_default,
|
|
42
|
-
initializeBundler: () => import_chunk_WPP65EYS.initializeBundler
|
|
36
|
+
ScriptSettings: () => import_chunk_3VDHZ54A.ScriptSettings,
|
|
37
|
+
ScriptSettingsPanel: () => import_chunk_3VDHZ54A.ScriptSettingsPanel,
|
|
38
|
+
meta: () => import_chunk_5UH3F7TA.meta
|
|
43
39
|
});
|
|
44
40
|
module.exports = __toCommonJS(node_exports);
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
var import_esbuild = __toESM(require("esbuild-wasm/esbuild.wasm?url"));
|
|
50
|
-
var import_react = __toESM(require("react"));
|
|
41
|
+
var import_chunk_3VDHZ54A = require("./chunk-3VDHZ54A.cjs");
|
|
42
|
+
var import_chunk_ALY3N6PW = require("./chunk-ALY3N6PW.cjs");
|
|
43
|
+
var import_chunk_DJGLGRQV = require("./chunk-DJGLGRQV.cjs");
|
|
44
|
+
var import_chunk_5UH3F7TA = require("./chunk-5UH3F7TA.cjs");
|
|
51
45
|
var import_app_framework = require("@dxos/app-framework");
|
|
46
|
+
var import_app_framework2 = require("@dxos/app-framework");
|
|
47
|
+
var import_functions = require("@dxos/functions");
|
|
52
48
|
var import_live_object = require("@dxos/live-object");
|
|
53
49
|
var import_plugin_client = require("@dxos/plugin-client");
|
|
54
|
-
var
|
|
55
|
-
var
|
|
56
|
-
var
|
|
57
|
-
var
|
|
58
|
-
var
|
|
59
|
-
var
|
|
60
|
-
var import_invariant = require("@dxos/invariant");
|
|
61
|
-
var import_react2 = require("react");
|
|
62
|
-
var import_react3 = __toESM(require("react"));
|
|
63
|
-
var import_react_client = require("@dxos/react-client");
|
|
64
|
-
var import_react_ui = require("@dxos/react-ui");
|
|
65
|
-
var import_react_ui_form = require("@dxos/react-ui-form");
|
|
66
|
-
var import_react4 = __toESM(require("react"));
|
|
67
|
-
var import_react_client2 = require("@dxos/react-client");
|
|
68
|
-
var import_echo2 = require("@dxos/react-client/echo");
|
|
69
|
-
var import_react_ui2 = require("@dxos/react-ui");
|
|
70
|
-
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-script/src/compiler/compiler.ts";
|
|
71
|
-
var defaultOptions = {
|
|
72
|
-
lib: [
|
|
73
|
-
"DOM",
|
|
74
|
-
"es2022"
|
|
75
|
-
],
|
|
76
|
-
target: import_typescript.default.ScriptTarget.ES2022
|
|
77
|
-
};
|
|
78
|
-
var Compiler = class {
|
|
79
|
-
constructor(_options = defaultOptions) {
|
|
80
|
-
this._options = _options;
|
|
81
|
-
}
|
|
82
|
-
async initialize() {
|
|
83
|
-
if (this._env) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
this._fsMap = await (0, import_vfs.createDefaultMapFromCDN)(this._options, "5.5.4", true, import_typescript.default);
|
|
87
|
-
const system = (0, import_vfs.createSystem)(this._fsMap);
|
|
88
|
-
this._env = (0, import_vfs.createVirtualTypeScriptEnvironment)(system, [], import_typescript.default, this._options);
|
|
89
|
-
}
|
|
90
|
-
get environment() {
|
|
91
|
-
(0, import_invariant.invariant)(this._env, "Compiler environment not initialized.", {
|
|
92
|
-
F: __dxlog_file,
|
|
93
|
-
L: 39,
|
|
94
|
-
S: this,
|
|
95
|
-
A: [
|
|
96
|
-
"this._env",
|
|
97
|
-
"'Compiler environment not initialized.'"
|
|
98
|
-
]
|
|
99
|
-
});
|
|
100
|
-
return this._env;
|
|
101
|
-
}
|
|
102
|
-
setFile(fileName, content) {
|
|
103
|
-
(0, import_invariant.invariant)(this._fsMap, "File system map not initialized.", {
|
|
104
|
-
F: __dxlog_file,
|
|
105
|
-
L: 44,
|
|
106
|
-
S: this,
|
|
107
|
-
A: [
|
|
108
|
-
"this._fsMap",
|
|
109
|
-
"'File system map not initialized.'"
|
|
110
|
-
]
|
|
111
|
-
});
|
|
112
|
-
this.environment.createFile(fileName, content);
|
|
113
|
-
}
|
|
114
|
-
compile(fileName) {
|
|
115
|
-
return this.environment.languageService.getEmitOutput(fileName);
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
var ScriptSettings = ({ settings }) => {
|
|
119
|
-
const { t } = (0, import_react_ui.useTranslation)(import_chunk_6LYX73ZT.SCRIPT_PLUGIN);
|
|
120
|
-
const client = (0, import_react_client.useClient)();
|
|
121
|
-
const handleAuthenticate = async () => {
|
|
122
|
-
const { identityKey } = client.halo.identity.get();
|
|
123
|
-
await client.halo.writeCredentials([
|
|
124
|
-
{
|
|
125
|
-
issuer: identityKey,
|
|
126
|
-
issuanceDate: /* @__PURE__ */ new Date(),
|
|
127
|
-
subject: {
|
|
128
|
-
id: identityKey,
|
|
129
|
-
assertion: {
|
|
130
|
-
"@type": "dxos.halo.credentials.ServiceAccess",
|
|
131
|
-
serverName: "hub.dxos.network",
|
|
132
|
-
serverKey: identityKey,
|
|
133
|
-
identityKey,
|
|
134
|
-
capabilities: [
|
|
135
|
-
"composer:beta"
|
|
136
|
-
]
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
]);
|
|
141
|
-
};
|
|
142
|
-
return /* @__PURE__ */ import_react3.default.createElement(import_react3.default.Fragment, null, /* @__PURE__ */ import_react3.default.createElement(import_react_ui_form.DeprecatedFormInput, {
|
|
143
|
-
label: t("authenticate action label")
|
|
144
|
-
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui.Button, {
|
|
145
|
-
onClick: handleAuthenticate
|
|
146
|
-
}, t("authenticate button label"))));
|
|
147
|
-
};
|
|
148
|
-
var ScriptSettingsPanel = ({ script }) => {
|
|
149
|
-
const { t } = (0, import_react_ui2.useTranslation)(import_chunk_6LYX73ZT.SCRIPT_PLUGIN);
|
|
150
|
-
const client = (0, import_react_client2.useClient)();
|
|
151
|
-
const space = (0, import_echo2.getSpace)(script);
|
|
152
|
-
const [fn] = (0, import_echo2.useQuery)(space, import_echo2.Filter.schema(import_chunk_DQYAU2CJ.FunctionType, {
|
|
153
|
-
source: script
|
|
154
|
-
}));
|
|
155
|
-
const handleNameChange = (0, import_react4.useCallback)((event) => {
|
|
156
|
-
script.name = event.target.value;
|
|
157
|
-
}, [
|
|
158
|
-
script
|
|
159
|
-
]);
|
|
160
|
-
const [binding, setBinding] = (0, import_react_ui2.useControlledValue)(fn?.binding ?? "");
|
|
161
|
-
const handleBindingChange = (0, import_react4.useCallback)((event) => {
|
|
162
|
-
setBinding(event.target.value);
|
|
163
|
-
}, [
|
|
164
|
-
setBinding
|
|
165
|
-
]);
|
|
166
|
-
const handleBindingBlur = (0, import_react4.useCallback)(() => {
|
|
167
|
-
fn.binding = binding;
|
|
168
|
-
}, [
|
|
169
|
-
fn,
|
|
170
|
-
binding
|
|
171
|
-
]);
|
|
172
|
-
const functionPath = fn && (0, import_chunk_CS25QNKZ.getUserFunctionUrlInMetadata)((0, import_echo2.getMeta)(fn));
|
|
173
|
-
const functionUrl = functionPath && (0, import_chunk_CS25QNKZ.getInvocationUrl)(functionPath, client.config.values.runtime?.services?.edge?.url ?? "", {
|
|
174
|
-
spaceId: space?.id
|
|
175
|
-
});
|
|
176
|
-
const handleCopy = (0, import_react4.useCallback)(() => functionUrl && navigator.clipboard.writeText(functionUrl), [
|
|
177
|
-
functionUrl
|
|
178
|
-
]);
|
|
179
|
-
return /* @__PURE__ */ import_react4.default.createElement("div", {
|
|
180
|
-
role: "form",
|
|
181
|
-
className: "flex flex-col w-full p-2 gap-4"
|
|
182
|
-
}, /* @__PURE__ */ import_react4.default.createElement(import_react_ui2.Input.Root, null, /* @__PURE__ */ import_react4.default.createElement("div", {
|
|
183
|
-
role: "none",
|
|
184
|
-
className: "flex flex-col gap-1"
|
|
185
|
-
}, /* @__PURE__ */ import_react4.default.createElement(import_react_ui2.Input.Label, null, t("name label")), /* @__PURE__ */ import_react4.default.createElement(import_react_ui2.Input.TextInput, {
|
|
186
|
-
placeholder: t("object title placeholder"),
|
|
187
|
-
value: script.name ?? "",
|
|
188
|
-
onChange: handleNameChange
|
|
189
|
-
}))), fn && /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement("hr", {
|
|
190
|
-
className: "border-separator"
|
|
191
|
-
}), /* @__PURE__ */ import_react4.default.createElement("h2", null, t("remote function settings heading")), /* @__PURE__ */ import_react4.default.createElement(import_react_ui2.Input.Root, null, /* @__PURE__ */ import_react4.default.createElement("div", {
|
|
192
|
-
role: "none",
|
|
193
|
-
className: "flex flex-col gap-1"
|
|
194
|
-
}, /* @__PURE__ */ import_react4.default.createElement(import_react_ui2.Input.Label, null, t("function url label")), /* @__PURE__ */ import_react4.default.createElement("div", {
|
|
195
|
-
role: "none",
|
|
196
|
-
className: "flex gap-1"
|
|
197
|
-
}, /* @__PURE__ */ import_react4.default.createElement(import_react_ui2.Input.TextInput, {
|
|
198
|
-
disabled: true,
|
|
199
|
-
value: functionUrl,
|
|
200
|
-
onChange: (event) => {
|
|
201
|
-
fn.name = event.target.value;
|
|
202
|
-
}
|
|
203
|
-
}), /* @__PURE__ */ import_react4.default.createElement(import_react_ui2.Button, {
|
|
204
|
-
onClick: handleCopy
|
|
205
|
-
}, /* @__PURE__ */ import_react4.default.createElement(import_react_ui2.Icon, {
|
|
206
|
-
icon: "ph--copy--regular",
|
|
207
|
-
size: 4
|
|
208
|
-
}))))), /* @__PURE__ */ import_react4.default.createElement(import_react_ui2.Input.Root, null, /* @__PURE__ */ import_react4.default.createElement("div", {
|
|
209
|
-
role: "none",
|
|
210
|
-
className: "flex flex-col gap-1"
|
|
211
|
-
}, /* @__PURE__ */ import_react4.default.createElement(import_react_ui2.Input.Label, null, t("function binding label")), /* @__PURE__ */ import_react4.default.createElement(import_react_ui2.Input.TextInput, {
|
|
212
|
-
placeholder: t("function binding placeholder"),
|
|
213
|
-
value: binding,
|
|
214
|
-
onChange: handleBindingChange,
|
|
215
|
-
onBlur: handleBindingBlur
|
|
216
|
-
})))));
|
|
217
|
-
};
|
|
218
|
-
var AutomationPanel = (0, import_react2.lazy)(() => import("./AutomationPanel-AAGQREH7.cjs"));
|
|
219
|
-
var ScriptContainer = (0, import_react2.lazy)(() => import("./ScriptContainer-FZ44UIRC.cjs"));
|
|
50
|
+
var import_functions2 = require("@dxos/functions");
|
|
51
|
+
var Compiler = (0, import_app_framework.lazy)(() => import("./compiler-UIBLKJKG.cjs"));
|
|
52
|
+
var IntentResolver = (0, import_app_framework.lazy)(() => import("./intent-resolver-WFLQNAID.cjs"));
|
|
53
|
+
var ReactSurface = (0, import_app_framework.lazy)(() => import("./react-surface-OIQJFA7P.cjs"));
|
|
54
|
+
var ScriptSettings2 = (0, import_app_framework.lazy)(() => import("./settings-SZFSMSKM.cjs"));
|
|
55
|
+
var Artifact = (0, import_app_framework.lazy)(() => import("./artifact-IPGGY2Z2.cjs"));
|
|
220
56
|
var translations_default = [
|
|
221
57
|
{
|
|
222
58
|
"en-US": {
|
|
223
|
-
[
|
|
59
|
+
[import_functions2.ScriptType.typename]: {
|
|
224
60
|
"typename label": "Script"
|
|
225
61
|
},
|
|
226
|
-
[
|
|
62
|
+
[import_chunk_5UH3F7TA.SCRIPT_PLUGIN]: {
|
|
227
63
|
"plugin name": "Scripts",
|
|
228
64
|
"object title placeholder": "New script",
|
|
229
65
|
"create object label": "Create script",
|
|
230
66
|
"create stack section label": "Create script",
|
|
67
|
+
"description label": "Description",
|
|
68
|
+
"description placeholder": "Describe what the script does.",
|
|
231
69
|
"binding placeholder": "Function name",
|
|
232
70
|
"function request placeholder": "Function request",
|
|
233
71
|
"deploy label": "Deploy",
|
|
@@ -242,182 +80,105 @@ var translations_default = [
|
|
|
242
80
|
"remote function settings heading": "Remote Function",
|
|
243
81
|
"function url label": "Invocation URL",
|
|
244
82
|
"function binding label": "Function binding",
|
|
245
|
-
"function binding placeholder": "BINDING"
|
|
83
|
+
"function binding placeholder": "BINDING",
|
|
84
|
+
"script publish settings label": "Publishing",
|
|
85
|
+
"script publish settings description": "Scripts can be shared publicly as Github gists.",
|
|
86
|
+
"no github token label": "This space has no Github access token available.",
|
|
87
|
+
"open token manager label": "Open Token Manager",
|
|
88
|
+
"publish label": "Publish",
|
|
89
|
+
"publishing label": "Publishing",
|
|
90
|
+
"editor input mode label": "Editor input mode",
|
|
91
|
+
"select editor input mode placeholder": "Select editor input mode\u2026",
|
|
92
|
+
"settings editor input mode default label": "Default",
|
|
93
|
+
"settings editor input mode vim label": "Vim",
|
|
94
|
+
"settings editor input mode vscode label": "VS Code",
|
|
95
|
+
"view group label": "View",
|
|
96
|
+
"view editor label": "Editor",
|
|
97
|
+
"view split label": "Split",
|
|
98
|
+
"view debug label": "Debug",
|
|
99
|
+
"template select group label": "Select template"
|
|
246
100
|
}
|
|
247
101
|
}
|
|
248
102
|
}
|
|
249
103
|
];
|
|
250
|
-
var ScriptPlugin = () =>
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
104
|
+
var ScriptPlugin = () => (0, import_app_framework2.definePlugin)(import_chunk_5UH3F7TA.meta, [
|
|
105
|
+
(0, import_app_framework2.defineModule)({
|
|
106
|
+
id: `${import_chunk_5UH3F7TA.meta.id}/module/settings`,
|
|
107
|
+
activatesOn: import_app_framework2.Events.SetupSettings,
|
|
108
|
+
activate: ScriptSettings2
|
|
109
|
+
}),
|
|
110
|
+
(0, import_app_framework2.defineModule)({
|
|
111
|
+
id: `${import_chunk_5UH3F7TA.meta.id}/module/compiler`,
|
|
112
|
+
activatesOn: import_app_framework2.Events.Startup,
|
|
113
|
+
activate: Compiler
|
|
114
|
+
}),
|
|
115
|
+
(0, import_app_framework2.defineModule)({
|
|
116
|
+
id: `${import_chunk_5UH3F7TA.meta.id}/module/translations`,
|
|
117
|
+
activatesOn: import_app_framework2.Events.SetupTranslations,
|
|
118
|
+
activate: () => (0, import_app_framework2.contributes)(import_app_framework2.Capabilities.Translations, translations_default)
|
|
119
|
+
}),
|
|
120
|
+
(0, import_app_framework2.defineModule)({
|
|
121
|
+
id: `${import_chunk_5UH3F7TA.meta.id}/module/metadata`,
|
|
122
|
+
activatesOn: import_app_framework2.Events.SetupMetadata,
|
|
123
|
+
activate: () => (0, import_app_framework2.contributes)(import_app_framework2.Capabilities.Metadata, {
|
|
124
|
+
id: import_functions.ScriptType.typename,
|
|
268
125
|
metadata: {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
icon: "ph--code--regular",
|
|
279
|
-
// TODO(wittjosiah): Move out of metadata.
|
|
280
|
-
loadReferences: (script) => (0, import_echo.loadObjectReferences)(script, (script2) => [
|
|
281
|
-
script2.source
|
|
282
|
-
])
|
|
126
|
+
creationSchema: import_chunk_DJGLGRQV.ScriptAction.CreateScriptSchema,
|
|
127
|
+
createObject: (props, { space }) => (0, import_app_framework2.createIntent)(import_chunk_DJGLGRQV.ScriptAction.Create, {
|
|
128
|
+
...props,
|
|
129
|
+
space
|
|
130
|
+
}),
|
|
131
|
+
placeholder: [
|
|
132
|
+
"object title placeholder",
|
|
133
|
+
{
|
|
134
|
+
ns: import_chunk_5UH3F7TA.SCRIPT_PLUGIN
|
|
283
135
|
}
|
|
284
|
-
}
|
|
285
|
-
},
|
|
286
|
-
translations: translations_default,
|
|
287
|
-
echo: {
|
|
288
|
-
schema: [
|
|
289
|
-
import_chunk_DQYAU2CJ.ScriptType
|
|
290
136
|
],
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
builder: (plugins) => {
|
|
297
|
-
const client = (0, import_app_framework.resolvePlugin)(plugins, import_plugin_client.parseClientPlugin)?.provides.client;
|
|
298
|
-
const dispatch = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseIntentPlugin)?.provides.intent.dispatch;
|
|
299
|
-
if (!client || !dispatch) {
|
|
300
|
-
return [];
|
|
301
|
-
}
|
|
302
|
-
return (0, import_plugin_graph.createExtension)({
|
|
303
|
-
id: import_chunk_DQYAU2CJ.ScriptAction.CREATE,
|
|
304
|
-
filter: (node) => (0, import_plugin_graph.isActionGroup)(node) && node.id.startsWith(import_plugin_space.SpaceAction.ADD_OBJECT),
|
|
305
|
-
actions: ({ node }) => {
|
|
306
|
-
const id = node.id.split("/").at(-1);
|
|
307
|
-
const [spaceId, objectId] = id?.split(":") ?? [];
|
|
308
|
-
const space = client.spaces.get().find((space2) => space2.id === spaceId);
|
|
309
|
-
const object = objectId && space?.db.getObjectById(objectId);
|
|
310
|
-
const target = objectId ? object : space;
|
|
311
|
-
if (!target) {
|
|
312
|
-
return;
|
|
313
|
-
}
|
|
314
|
-
return [
|
|
315
|
-
{
|
|
316
|
-
id: `${import_chunk_6LYX73ZT.SCRIPT_PLUGIN}/create/${node.id}`,
|
|
317
|
-
data: async () => {
|
|
318
|
-
await dispatch([
|
|
319
|
-
{
|
|
320
|
-
plugin: import_chunk_6LYX73ZT.SCRIPT_PLUGIN,
|
|
321
|
-
action: import_chunk_DQYAU2CJ.ScriptAction.CREATE
|
|
322
|
-
},
|
|
323
|
-
{
|
|
324
|
-
action: import_plugin_space.SpaceAction.ADD_OBJECT,
|
|
325
|
-
data: {
|
|
326
|
-
target
|
|
327
|
-
}
|
|
328
|
-
},
|
|
329
|
-
{
|
|
330
|
-
action: import_app_framework.NavigationAction.OPEN
|
|
331
|
-
}
|
|
332
|
-
]);
|
|
333
|
-
},
|
|
334
|
-
properties: {
|
|
335
|
-
label: [
|
|
336
|
-
"create object label",
|
|
337
|
-
{
|
|
338
|
-
ns: import_chunk_6LYX73ZT.SCRIPT_PLUGIN
|
|
339
|
-
}
|
|
340
|
-
],
|
|
341
|
-
icon: "ph--code--regular",
|
|
342
|
-
testId: "scriptPlugin.createObject"
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
];
|
|
346
|
-
}
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
},
|
|
350
|
-
surface: {
|
|
351
|
-
component: ({ data, role }) => {
|
|
352
|
-
switch (role) {
|
|
353
|
-
case "settings": {
|
|
354
|
-
return data.plugin === import_chunk_6LYX73ZT.meta_default.id ? /* @__PURE__ */ import_react.default.createElement(ScriptSettings, {
|
|
355
|
-
settings: {}
|
|
356
|
-
}) : null;
|
|
357
|
-
}
|
|
358
|
-
case "article": {
|
|
359
|
-
if (data.object instanceof import_chunk_DQYAU2CJ.ScriptType) {
|
|
360
|
-
return /* @__PURE__ */ import_react.default.createElement(ScriptContainer, {
|
|
361
|
-
script: data.object,
|
|
362
|
-
env: compiler.environment
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
break;
|
|
366
|
-
}
|
|
367
|
-
case "complementary--automation": {
|
|
368
|
-
if (data.subject instanceof import_chunk_DQYAU2CJ.ScriptType) {
|
|
369
|
-
return {
|
|
370
|
-
node: /* @__PURE__ */ import_react.default.createElement(AutomationPanel, {
|
|
371
|
-
subject: data.subject
|
|
372
|
-
}),
|
|
373
|
-
disposition: "hoist"
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
|
-
break;
|
|
377
|
-
}
|
|
378
|
-
case "complementary--settings": {
|
|
379
|
-
if (data.subject instanceof import_chunk_DQYAU2CJ.ScriptType) {
|
|
380
|
-
return /* @__PURE__ */ import_react.default.createElement(ScriptSettingsPanel, {
|
|
381
|
-
script: data.subject
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
break;
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
return null;
|
|
388
|
-
}
|
|
389
|
-
},
|
|
390
|
-
intent: {
|
|
391
|
-
resolver: (intent) => {
|
|
392
|
-
switch (intent.action) {
|
|
393
|
-
case import_chunk_DQYAU2CJ.ScriptAction.CREATE: {
|
|
394
|
-
return {
|
|
395
|
-
data: (0, import_live_object.create)(import_chunk_DQYAU2CJ.ScriptType, {
|
|
396
|
-
source: (0, import_live_object.create)(import_types.TextType, {
|
|
397
|
-
content: import_chunk_WPP65EYS.templates[0].source
|
|
398
|
-
})
|
|
399
|
-
})
|
|
400
|
-
};
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
}
|
|
137
|
+
icon: "ph--code--regular",
|
|
138
|
+
// TODO(wittjosiah): Move out of metadata.
|
|
139
|
+
loadReferences: async (script) => await import_live_object.RefArray.loadAll([
|
|
140
|
+
script.source
|
|
141
|
+
])
|
|
404
142
|
}
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
|
|
143
|
+
})
|
|
144
|
+
}),
|
|
145
|
+
(0, import_app_framework2.defineModule)({
|
|
146
|
+
id: `${import_chunk_5UH3F7TA.meta.id}/module/schema`,
|
|
147
|
+
activatesOn: import_plugin_client.ClientEvents.SetupSchema,
|
|
148
|
+
activate: () => [
|
|
149
|
+
(0, import_app_framework2.contributes)(import_plugin_client.ClientCapabilities.SystemSchema, [
|
|
150
|
+
import_functions.FunctionType
|
|
151
|
+
]),
|
|
152
|
+
(0, import_app_framework2.contributes)(import_plugin_client.ClientCapabilities.Schema, [
|
|
153
|
+
import_functions.ScriptType
|
|
154
|
+
])
|
|
155
|
+
]
|
|
156
|
+
}),
|
|
157
|
+
(0, import_app_framework2.defineModule)({
|
|
158
|
+
id: `${import_chunk_5UH3F7TA.meta.id}/module/react-surface`,
|
|
159
|
+
activatesOn: import_app_framework2.Events.SetupSurfaces,
|
|
160
|
+
activate: ReactSurface
|
|
161
|
+
}),
|
|
162
|
+
(0, import_app_framework2.defineModule)({
|
|
163
|
+
id: `${import_chunk_5UH3F7TA.meta.id}/module/intent-resolver`,
|
|
164
|
+
activatesOn: import_app_framework2.Events.SetupIntents,
|
|
165
|
+
activate: IntentResolver
|
|
166
|
+
}),
|
|
167
|
+
(0, import_app_framework2.defineModule)({
|
|
168
|
+
id: `${import_chunk_5UH3F7TA.meta.id}/module/artifact`,
|
|
169
|
+
activatesOn: import_app_framework2.Events.Startup,
|
|
170
|
+
activate: Artifact
|
|
171
|
+
})
|
|
172
|
+
]);
|
|
409
173
|
// Annotate the CommonJS export names for ESM import in node:
|
|
410
174
|
0 && (module.exports = {
|
|
411
175
|
AutomationPanel,
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
FunctionType,
|
|
415
|
-
ScriptAction,
|
|
176
|
+
SCRIPT_PLUGIN,
|
|
177
|
+
ScriptCapabilities,
|
|
416
178
|
ScriptContainer,
|
|
417
179
|
ScriptPlugin,
|
|
418
180
|
ScriptSettings,
|
|
419
181
|
ScriptSettingsPanel,
|
|
420
|
-
|
|
421
|
-
initializeBundler
|
|
182
|
+
meta
|
|
422
183
|
});
|
|
423
184
|
//# sourceMappingURL=index.cjs.map
|