@dxos/plugin-script 0.8.2-staging.7ac8446 → 0.8.3-main.672df60
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/DeploymentDialog-NLWQHNKE.mjs +12 -0
- package/dist/lib/browser/ScriptContainer-NDMTQG2N.mjs +271 -0
- package/dist/lib/browser/ScriptContainer-NDMTQG2N.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-RRLY67QC.mjs → app-graph-builder-V3HPXJAD.mjs} +10 -10
- package/dist/lib/browser/app-graph-builder-V3HPXJAD.mjs.map +7 -0
- package/dist/lib/browser/{artifact-definition-WXFYD2V5.mjs → artifact-definition-L3AIY4XA.mjs} +45 -48
- package/dist/lib/browser/artifact-definition-L3AIY4XA.mjs.map +7 -0
- package/dist/lib/browser/{chunk-MQZQB5VD.mjs → chunk-6T64VQHF.mjs} +10 -10
- package/dist/lib/browser/chunk-6T64VQHF.mjs.map +7 -0
- package/dist/lib/browser/{chunk-WSK3YQXI.mjs → chunk-6ZHHWU6S.mjs} +4 -3
- package/dist/lib/browser/{chunk-WSK3YQXI.mjs.map → chunk-6ZHHWU6S.mjs.map} +2 -2
- package/dist/lib/browser/chunk-BMVT3XMV.mjs +557 -0
- package/dist/lib/browser/chunk-BMVT3XMV.mjs.map +7 -0
- package/dist/lib/browser/chunk-BTEFFA4C.mjs +153 -0
- package/dist/lib/browser/chunk-BTEFFA4C.mjs.map +7 -0
- package/dist/lib/browser/chunk-SH4MI7PU.mjs +364 -0
- package/dist/lib/browser/chunk-SH4MI7PU.mjs.map +7 -0
- package/dist/lib/browser/chunk-WB3X5Z7Q.mjs +40 -0
- package/dist/lib/browser/chunk-WB3X5Z7Q.mjs.map +7 -0
- package/dist/lib/browser/{chunk-4VD3K3PY.mjs → chunk-YSQMXTYO.mjs} +3 -3
- package/dist/lib/{node-esm/chunk-EB5DSAD4.mjs.map → browser/chunk-YSQMXTYO.mjs.map} +1 -1
- package/dist/lib/browser/{compiler-56LTBEQB.mjs → compiler-W4BYJYTL.mjs} +3 -3
- package/dist/lib/browser/compiler-W4BYJYTL.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +20 -16
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-WCVXKRBR.mjs → intent-resolver-BIJLOJU3.mjs} +14 -14
- package/dist/lib/browser/intent-resolver-BIJLOJU3.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-WXZVPNGI.mjs → react-surface-ZBCIYBGH.mjs} +16 -28
- package/dist/lib/browser/react-surface-ZBCIYBGH.mjs.map +7 -0
- package/dist/lib/browser/{settings-Z7B37V2I.mjs → settings-FU7NTENS.mjs} +5 -5
- package/dist/lib/browser/settings-FU7NTENS.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +2 -2
- package/dist/lib/node/{DeploymentDialog-O4MU4OMF.cjs → DeploymentDialog-PC5AL3BB.cjs} +10 -10
- package/dist/lib/node/DeploymentDialog-PC5AL3BB.cjs.map +7 -0
- package/dist/lib/node/ScriptContainer-CLW7YCIP.cjs +288 -0
- package/dist/lib/node/ScriptContainer-CLW7YCIP.cjs.map +7 -0
- package/dist/lib/node/{app-graph-builder-6I2BWD46.cjs → app-graph-builder-YE4OM4OC.cjs} +17 -17
- package/dist/lib/node/app-graph-builder-YE4OM4OC.cjs.map +7 -0
- package/dist/lib/node/{artifact-definition-6NVXEHJD.cjs → artifact-definition-6BD6CVOV.cjs} +55 -58
- package/dist/lib/node/artifact-definition-6BD6CVOV.cjs.map +7 -0
- package/dist/lib/node/{chunk-XFZPWFEG.cjs → chunk-HCRW6T3G.cjs} +19 -20
- package/dist/lib/node/chunk-HCRW6T3G.cjs.map +7 -0
- package/dist/lib/node/chunk-Q44SJXEN.cjs +369 -0
- package/dist/lib/node/chunk-Q44SJXEN.cjs.map +7 -0
- package/dist/lib/node/chunk-QCAKVK6S.cjs +580 -0
- package/dist/lib/node/chunk-QCAKVK6S.cjs.map +7 -0
- package/dist/lib/node/{chunk-YJQZHKKA.cjs → chunk-QG2X6J74.cjs} +7 -6
- package/dist/lib/node/{chunk-YJQZHKKA.cjs.map → chunk-QG2X6J74.cjs.map} +2 -2
- package/dist/lib/node/chunk-RARNZD62.cjs +179 -0
- package/dist/lib/node/chunk-RARNZD62.cjs.map +7 -0
- package/dist/lib/node/{chunk-VYBEBLDO.cjs → chunk-V6L73D7S.cjs} +14 -14
- package/dist/lib/node/chunk-V6L73D7S.cjs.map +7 -0
- package/dist/lib/node/{chunk-JICWAOWZ.cjs → chunk-ZEV3VARQ.cjs} +7 -7
- package/dist/lib/node/{chunk-JICWAOWZ.cjs.map → chunk-ZEV3VARQ.cjs.map} +1 -1
- package/dist/lib/node/{compiler-W2RU3M7U.cjs → compiler-TFSJRLL4.cjs} +7 -7
- package/dist/lib/node/{compiler-W2RU3M7U.cjs.map → compiler-TFSJRLL4.cjs.map} +3 -3
- package/dist/lib/node/index.cjs +49 -45
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/{intent-resolver-J4NBDNFH.cjs → intent-resolver-QKBCESXR.cjs} +21 -21
- package/dist/lib/node/intent-resolver-QKBCESXR.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-27KTUBIZ.cjs → react-surface-HZJOZHHG.cjs} +38 -47
- package/dist/lib/node/react-surface-HZJOZHHG.cjs.map +7 -0
- package/dist/lib/node/{settings-EI6VPNKN.cjs → settings-RRCQ7ZQD.cjs} +9 -9
- package/dist/lib/node/settings-RRCQ7ZQD.cjs.map +7 -0
- package/dist/lib/node/types.cjs +5 -5
- package/dist/lib/node/types.cjs.map +1 -1
- package/dist/lib/node-esm/{DeploymentDialog-SSQSWLHX.mjs → DeploymentDialog-QHB2BGNJ.mjs} +5 -5
- package/dist/lib/node-esm/ScriptContainer-PMRP7AJ5.mjs +272 -0
- package/dist/lib/node-esm/ScriptContainer-PMRP7AJ5.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-H5XLRVX3.mjs → app-graph-builder-4CN7URJQ.mjs} +10 -10
- package/dist/lib/node-esm/app-graph-builder-4CN7URJQ.mjs.map +7 -0
- package/dist/lib/node-esm/{artifact-definition-KQ64AYBP.mjs → artifact-definition-PPV2XKU7.mjs} +45 -48
- package/dist/lib/node-esm/artifact-definition-PPV2XKU7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-25GOLUXY.mjs +154 -0
- package/dist/lib/node-esm/chunk-25GOLUXY.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-EB5DSAD4.mjs → chunk-2KJYPUQD.mjs} +3 -3
- package/dist/lib/{browser/chunk-4VD3K3PY.mjs.map → node-esm/chunk-2KJYPUQD.mjs.map} +1 -1
- package/dist/lib/node-esm/{chunk-F4HA5C34.mjs → chunk-47MABIVX.mjs} +10 -10
- package/dist/lib/node-esm/chunk-47MABIVX.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-FDEAVT67.mjs → chunk-AEB5TPEW.mjs} +4 -3
- package/dist/lib/node-esm/{chunk-FDEAVT67.mjs.map → chunk-AEB5TPEW.mjs.map} +2 -2
- package/dist/lib/node-esm/chunk-IIPL3OKN.mjs +558 -0
- package/dist/lib/node-esm/chunk-IIPL3OKN.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-JFCZ3L27.mjs +365 -0
- package/dist/lib/node-esm/chunk-JFCZ3L27.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-UESZKXLR.mjs +41 -0
- package/dist/lib/node-esm/chunk-UESZKXLR.mjs.map +7 -0
- package/dist/lib/node-esm/{compiler-VT5C2Z3T.mjs → compiler-7PQ4D43R.mjs} +3 -3
- package/dist/lib/{browser/compiler-56LTBEQB.mjs.map → node-esm/compiler-7PQ4D43R.mjs.map} +3 -3
- package/dist/lib/node-esm/index.mjs +20 -16
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-PDZ2A26X.mjs → intent-resolver-UWYXAPLZ.mjs} +14 -14
- package/dist/lib/node-esm/intent-resolver-UWYXAPLZ.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-UCUVDVSH.mjs → react-surface-MHCPAP55.mjs} +16 -28
- package/dist/lib/node-esm/react-surface-MHCPAP55.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-HU5UEFRF.mjs → settings-NKNC32QC.mjs} +5 -5
- package/dist/lib/node-esm/settings-NKNC32QC.mjs.map +7 -0
- package/dist/lib/node-esm/types.mjs +2 -2
- package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +2 -179
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +1 -177
- 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/compiler/compiler.d.ts.map +1 -1
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.d.ts +2 -2
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.d.ts.map +1 -1
- package/dist/types/src/components/FrameContainer/FrameContainer.d.ts.map +1 -1
- package/dist/types/src/components/ScriptContainer.d.ts +1 -1
- 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/Settings/ScriptObjectSettings.d.ts +1 -1
- package/dist/types/src/components/Settings/ScriptObjectSettings.d.ts.map +1 -1
- package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/TestContainer.d.ts +7 -0
- package/dist/types/src/components/TestPanel/TestContainer.d.ts.map +1 -0
- package/dist/types/src/components/TestPanel/TestPanel.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/index.d.ts +1 -0
- package/dist/types/src/components/TestPanel/index.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/hooks/deploy.d.ts +22 -19
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/hooks/format.d.ts +2 -5
- package/dist/types/src/hooks/format.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +0 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/template.d.ts +2 -5
- package/dist/types/src/hooks/template.d.ts.map +1 -1
- package/dist/types/src/hooks/useCreateAndDeployScriptTemplates.d.ts.map +1 -1
- package/dist/types/src/hooks/useToolbarState.d.ts +1 -1
- package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/templates/chat.d.ts +1 -1
- package/dist/types/src/templates/chat.d.ts.map +1 -1
- package/dist/types/src/templates/chess.d.ts.map +1 -1
- package/dist/types/src/templates/data-generator.d.ts +0 -7
- package/dist/types/src/templates/data-generator.d.ts.map +1 -1
- package/dist/types/src/templates/discord.d.ts.map +1 -1
- package/dist/types/src/templates/echo.d.ts +1 -1
- package/dist/types/src/templates/echo.d.ts.map +1 -1
- package/dist/types/src/templates/email.d.ts +1 -1
- package/dist/types/src/templates/email.d.ts.map +1 -1
- package/dist/types/src/templates/forex-effect.d.ts.map +1 -1
- package/dist/types/src/templates/forex.d.ts.map +1 -1
- package/dist/types/src/templates/gmail.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -110
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +27 -26
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/util/deploy.d.ts.map +1 -1
- package/dist/types/src/util/functions.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +59 -53
- package/src/ScriptPlugin.tsx +4 -2
- package/src/capabilities/app-graph-builder.ts +46 -29
- package/src/capabilities/artifact-definition.ts +40 -38
- package/src/capabilities/intent-resolver.ts +7 -7
- package/src/capabilities/react-surface.tsx +7 -17
- package/src/capabilities/settings.ts +2 -2
- package/src/compiler/compiler.ts +3 -3
- package/src/components/DeploymentDialog/DeploymentDialog.stories.tsx +1 -1
- package/src/components/DeploymentDialog/DeploymentDialog.tsx +2 -2
- package/src/components/ScriptContainer.tsx +2 -2
- package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +1 -1
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +27 -18
- package/src/components/Settings/ScriptObjectSettings.tsx +5 -5
- package/src/components/TestPanel/TestContainer.tsx +21 -0
- package/src/components/TestPanel/index.ts +1 -0
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +0 -6
- package/src/hooks/deploy.ts +61 -55
- package/src/hooks/format.ts +26 -26
- package/src/hooks/index.ts +0 -1
- package/src/hooks/template.ts +24 -32
- package/src/hooks/useToolbarState.ts +2 -2
- package/src/meta.ts +3 -2
- package/src/templates/chat.ts +4 -10
- package/src/templates/chess.ts +2 -7
- package/src/templates/data-generator.ts +20 -45
- package/src/templates/discord.ts +17 -15
- package/src/templates/echo.ts +1 -12
- package/src/templates/email.ts +8 -14
- package/src/templates/forex-effect.ts +4 -8
- package/src/templates/forex.ts +1 -5
- package/src/templates/gmail.ts +37 -28
- package/src/translations.ts +1 -1
- package/src/types.ts +13 -14
- package/src/util/deploy.ts +6 -10
- package/dist/lib/browser/DeploymentDialog-AEPYJKPO.mjs +0 -12
- package/dist/lib/browser/ScriptContainer-R25PRK2D.mjs +0 -248
- package/dist/lib/browser/ScriptContainer-R25PRK2D.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-RRLY67QC.mjs.map +0 -7
- package/dist/lib/browser/artifact-definition-WXFYD2V5.mjs.map +0 -7
- package/dist/lib/browser/chunk-2CGZFDCR.mjs +0 -480
- package/dist/lib/browser/chunk-2CGZFDCR.mjs.map +0 -7
- package/dist/lib/browser/chunk-CSZXPLYY.mjs +0 -147
- package/dist/lib/browser/chunk-CSZXPLYY.mjs.map +0 -7
- package/dist/lib/browser/chunk-KLEOGVXY.mjs +0 -352
- package/dist/lib/browser/chunk-KLEOGVXY.mjs.map +0 -7
- package/dist/lib/browser/chunk-MQZQB5VD.mjs.map +0 -7
- package/dist/lib/browser/chunk-R2CHVWJ2.mjs +0 -41
- package/dist/lib/browser/chunk-R2CHVWJ2.mjs.map +0 -7
- package/dist/lib/browser/chunk-SUCBNCEQ.mjs +0 -87
- package/dist/lib/browser/chunk-SUCBNCEQ.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-WCVXKRBR.mjs.map +0 -7
- package/dist/lib/browser/react-surface-WXZVPNGI.mjs.map +0 -7
- package/dist/lib/browser/settings-Z7B37V2I.mjs.map +0 -7
- package/dist/lib/node/DeploymentDialog-O4MU4OMF.cjs.map +0 -7
- package/dist/lib/node/ScriptContainer-5KY6ZOQD.cjs +0 -267
- package/dist/lib/node/ScriptContainer-5KY6ZOQD.cjs.map +0 -7
- package/dist/lib/node/app-graph-builder-6I2BWD46.cjs.map +0 -7
- package/dist/lib/node/artifact-definition-6NVXEHJD.cjs.map +0 -7
- package/dist/lib/node/chunk-65MIJR3Q.cjs +0 -173
- package/dist/lib/node/chunk-65MIJR3Q.cjs.map +0 -7
- package/dist/lib/node/chunk-F4DP7WON.cjs +0 -372
- package/dist/lib/node/chunk-F4DP7WON.cjs.map +0 -7
- package/dist/lib/node/chunk-SLDJM45C.cjs +0 -507
- package/dist/lib/node/chunk-SLDJM45C.cjs.map +0 -7
- package/dist/lib/node/chunk-VYBEBLDO.cjs.map +0 -7
- package/dist/lib/node/chunk-X7MHLHHS.cjs +0 -91
- package/dist/lib/node/chunk-X7MHLHHS.cjs.map +0 -7
- package/dist/lib/node/chunk-XFZPWFEG.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-J4NBDNFH.cjs.map +0 -7
- package/dist/lib/node/react-surface-27KTUBIZ.cjs.map +0 -7
- package/dist/lib/node/settings-EI6VPNKN.cjs.map +0 -7
- package/dist/lib/node-esm/ScriptContainer-W2F4FGDV.mjs +0 -249
- package/dist/lib/node-esm/ScriptContainer-W2F4FGDV.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-H5XLRVX3.mjs.map +0 -7
- package/dist/lib/node-esm/artifact-definition-KQ64AYBP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4MTPYMV2.mjs +0 -481
- package/dist/lib/node-esm/chunk-4MTPYMV2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-F4HA5C34.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MU3JKVL2.mjs +0 -148
- package/dist/lib/node-esm/chunk-MU3JKVL2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PBGVTGL2.mjs +0 -353
- package/dist/lib/node-esm/chunk-PBGVTGL2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QDYGTY4L.mjs +0 -89
- package/dist/lib/node-esm/chunk-QDYGTY4L.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RW2APVMV.mjs +0 -42
- package/dist/lib/node-esm/chunk-RW2APVMV.mjs.map +0 -7
- package/dist/lib/node-esm/compiler-VT5C2Z3T.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-PDZ2A26X.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-UCUVDVSH.mjs.map +0 -7
- package/dist/lib/node-esm/settings-HU5UEFRF.mjs.map +0 -7
- package/dist/types/src/hooks/useToolbarAction.d.ts +0 -13
- package/dist/types/src/hooks/useToolbarAction.d.ts.map +0 -1
- package/src/hooks/useToolbarAction.ts +0 -50
- /package/dist/lib/browser/{DeploymentDialog-AEPYJKPO.mjs.map → DeploymentDialog-NLWQHNKE.mjs.map} +0 -0
- /package/dist/lib/node-esm/{DeploymentDialog-SSQSWLHX.mjs.map → DeploymentDialog-QHB2BGNJ.mjs.map} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/artifact-definition.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { createTool, ToolResult } from '@dxos/ai';\nimport { Capabilities, contributes, createIntent, type PromiseIntentDispatcher } from '@dxos/app-framework';\nimport { ArtifactId, defineArtifact } from '@dxos/artifact';\nimport { createArtifactElement } from '@dxos/assistant';\nimport { ScriptType } from '@dxos/functions';\nimport { invariant } from '@dxos/invariant';\nimport { SpaceAction } from '@dxos/plugin-space/types';\nimport { Filter, live, makeRef, type Space } from '@dxos/react-client/echo';\nimport { DataType } from '@dxos/schema';\n\nimport { meta } from '../meta';\n// TODO(burdon): Factor out.\ndeclare global {\n interface ToolContextExtensions {\n space?: Space;\n dispatch?: PromiseIntentDispatcher;\n }\n}\n\nexport default () => {\n const definition = defineArtifact({\n id: `artifact:${meta.id}`,\n name: meta.name,\n // TODO(dmaretskyi): Since writing scripts requires a lot of domain knowledge,\n // we should offload the work of synthesizing the code to a separate model.\n // The main reasoning model will give it a concrete task and the script model will synthesize the code, knowing all the docs.\n instructions: `\n If the user explicitly requests you to write a script, you can create one.\n If the user requests you to change one of the existing script, you can update it.\n You must not create a script unless the user explicitly requests it.\n Scripts are short code pieces of executable code that can be used to perform computations, integrate with external systems, and perform automated tasks.\n Each script must follow as strict shape for the definition but the body can contain any valid executable code.\n Scripts are written in JavaScript or TypeScript.\n Each script must define an input schema and output schema.\n Each script must have its own detailed description.\n\n Important: You cannot execute scripts. Scripts are only available as tools after the user deploys them. You must only call the available tools.\n\n Description:\n The description is a detailed description of the script.\n It is used to describe the script's purpose, input, and output.\n The description is used to generate the script's documentation.\n The description is also goes into the script metadata.\n The description is used by AI to understand the script and its purpose.\n The description must provide cases on when the script should be used.\n\n Schema: \n The schema is defined using a schema-DSL library called Effect Schema.\n The input schema describes the arguments that the script accepts.\n The output schema describes the result that the script produces.\n The schema is used to validate the script's input and output.\n The schema is also goes into the script metadata.\n The properties in the schema must have valid descriptions.\n The input and output schemas must both be a struct of fields.\n\n Restricts:\n The scripts can only import code from \"dxos:functions\" module. No other modules are allowed.\n Some web APIs are available - like fetch.\n\n Reasoning:\n Before writing a script, synthesize the following information:\n - Description\n - What APIs will be used.\n - Detailed input schema\n - Detailed output schema\n\n <apis>\n export function defineFunction(params: { \n description: string, \n inputSchema: Schema.Schema, \n outputSchema: Schema.Schema, \n handler: (params: { event: { data: TInput } }) => Promise<TOutput> \n }): FunctionDefinition\n /**\n * Effect Schema\n */\n export const Schema; \n\n // Examples: \n\n Schema.String\n Schema.Number\n Schema.Boolean\n Schema.Struct({\n from: Schema.String.annotations({ description: 'The source currency' }),\n to: Schema.String.annotations({ description: 'The target currency' }),\n })\n Schema.Array(Schema.String)\n Schema.Union(Schema.String, Schema.Number)\n Schema.optional(Schema.String)\n Schema.String.annotations({ description: 'The source currency' })\n </apis>\n\n <handler_function>\n Async function that takes the argument in the form of:\n\n type HandlerFunctionParam = {\n event: {\n data: T // The input schema\n },\n }\n\n The function must return the result that matches the output schema.\n </handler_function>\n \n <example>\n import { defineFunction, S } from 'dxos:functions';\n\n export default defineFunction({\n description: 'Returns the exchange rate between two currencies.',\n\n inputSchema: Schema.Struct({\n from: Schema.String.annotations({ description: 'The source currency' }),\n to: Schema.String.annotations({ description: 'The target currency' }),\n }),\n\n outputSchema: Schema.Struct({\n rate: Schema.String.annotations({ description: 'The exchange rate' }),\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 { rate: rates[to].toString() };\n },\n });\n </example>\n `,\n schema: ScriptType,\n tools: [\n createTool(meta.id, {\n name: 'create',\n description: 'Create a new script. Returns the artifact definition for the script',\n caption: 'Creating script...',\n schema: Schema.Struct({\n name: Schema.String.annotations({ description: 'The name of the script' }),\n code: Schema.String.annotations({\n description: 'The full code of the script in JavaScript or TypeScript. Must be valid executable code.',\n }),\n }),\n execute: async ({ name, code }, { extensions }) => {\n invariant(extensions?.space, 'No space');\n invariant(extensions?.dispatch, 'No intent dispatcher');\n const script = live(ScriptType, {\n name,\n source: makeRef(\n live(DataType.Text, {\n content: code,\n }),\n ),\n });\n extensions.space.db.add(script);\n await extensions.space.db.flush();\n\n const intent = createIntent(SpaceAction.AddObject, { target: extensions.space, object: script });\n const { data, error } = await extensions.dispatch(intent);\n if (!data || error) {\n return ToolResult.Error(error?.message ?? 'Failed to create chess game');\n }\n\n return ToolResult.Success(createArtifactElement(script.id));\n },\n }),\n createTool(meta.id, {\n name: 'inspect',\n description: 'Inspect a script. Returns the artifact definition for the script',\n caption: 'Inspecting script...',\n schema: Schema.Struct({\n id: ArtifactId,\n }),\n execute: async ({ id }, { extensions }) => {\n invariant(extensions?.space, 'No space');\n\n const script = (await extensions.space.db.query(Filter.ids(id)).first()) as ScriptType;\n const { content } = await script.source.load();\n\n return ToolResult.Success({\n name: script.name,\n code: content,\n });\n },\n }),\n createTool(meta.id, {\n name: 'update',\n description: 'Update a script. Returns the artifact definition for the script',\n caption: 'Updating script...',\n schema: Schema.Struct({\n id: ArtifactId,\n code: Schema.String.annotations({\n description: 'The full code of the script in JavaScript or TypeScript. Must be valid executable code.',\n }),\n }),\n execute: async ({ id, code }, { extensions }) => {\n invariant(extensions?.space, 'No space');\n\n const script = (await extensions.space.db.query(Filter.ids(id)).first()) as ScriptType;\n const source = await script.source.load();\n if (!source) {\n return ToolResult.Error('Script not found');\n }\n\n source.content = code;\n await extensions.space?.db.flush();\n\n return ToolResult.Success({\n name: script.name,\n });\n },\n }),\n ],\n });\n\n return contributes(Capabilities.ArtifactDefinition, definition);\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;AAIA,SAASA,cAAc;AAEvB,SA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AAWE,OAAOS,GAAGE,MAAAA;AAE3B,iBAAOS,WAAWG,QAAQ;YACxBvC,MAAMkB,OAAOlB;UACf,CAAA;QACF;MACF,CAAA;;EAEJ,CAAA;AAEA,SAAO+C,YAAYC,aAAaC,oBAAoBrD,UAAAA;AACtD;",
|
|
6
|
+
"names": ["Schema", "createTool", "ToolResult", "Capabilities", "contributes", "createIntent", "ArtifactId", "defineArtifact", "createArtifactElement", "ScriptType", "invariant", "SpaceAction", "Filter", "live", "makeRef", "DataType", "definition", "defineArtifact", "id", "meta", "name", "instructions", "schema", "ScriptType", "tools", "createTool", "description", "caption", "Schema", "Struct", "String", "annotations", "code", "execute", "extensions", "invariant", "space", "dispatch", "script", "live", "source", "makeRef", "DataType", "Text", "content", "db", "add", "flush", "intent", "createIntent", "SpaceAction", "AddObject", "target", "object", "data", "error", "ToolResult", "Error", "message", "Success", "createArtifactElement", "ArtifactId", "query", "Filter", "ids", "first", "load", "contributes", "Capabilities", "ArtifactDefinition"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
useCreateAndDeployScriptTemplates
|
|
4
|
+
} from "./chunk-47MABIVX.mjs";
|
|
5
|
+
import {
|
|
6
|
+
SCRIPT_PLUGIN
|
|
7
|
+
} from "./chunk-AEB5TPEW.mjs";
|
|
8
|
+
|
|
9
|
+
// packages/plugins/plugin-script/src/components/DeploymentDialog/DeploymentDialog.tsx
|
|
10
|
+
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
11
|
+
import React, { useEffect, useMemo } from "react";
|
|
12
|
+
import { createIntent, LayoutAction, useIntentDispatcher } from "@dxos/app-framework";
|
|
13
|
+
import { getSpace } from "@dxos/react-client/echo";
|
|
14
|
+
import { Button, Dialog, Icon, useTranslation } from "@dxos/react-ui";
|
|
15
|
+
var DEPLOYMENT_DIALOG = `${SCRIPT_PLUGIN}/deployment/dialog`;
|
|
16
|
+
var DeploymentDialog = ({ accessToken, scriptTemplates }) => {
|
|
17
|
+
var _effect = _useSignals();
|
|
18
|
+
try {
|
|
19
|
+
const { t } = useTranslation(SCRIPT_PLUGIN);
|
|
20
|
+
const space = useMemo(() => getSpace(accessToken), [
|
|
21
|
+
accessToken
|
|
22
|
+
]);
|
|
23
|
+
const { handleCreateAndDeployScripts, status } = useCreateAndDeployScriptTemplates(space, scriptTemplates);
|
|
24
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (status === "success") {
|
|
27
|
+
void dispatch(createIntent(LayoutAction.AddToast, {
|
|
28
|
+
part: "toast",
|
|
29
|
+
subject: {
|
|
30
|
+
id: `${SCRIPT_PLUGIN}/deployment-success`,
|
|
31
|
+
icon: "ph--check--regular",
|
|
32
|
+
duration: Infinity,
|
|
33
|
+
title: [
|
|
34
|
+
"script deployment toast label",
|
|
35
|
+
{
|
|
36
|
+
ns: SCRIPT_PLUGIN,
|
|
37
|
+
count: scriptTemplates.length
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
description: [
|
|
41
|
+
"script deployment toast description",
|
|
42
|
+
{
|
|
43
|
+
ns: SCRIPT_PLUGIN,
|
|
44
|
+
count: scriptTemplates.length
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
closeLabel: [
|
|
48
|
+
"script deployment toast close label",
|
|
49
|
+
{
|
|
50
|
+
ns: SCRIPT_PLUGIN,
|
|
51
|
+
count: scriptTemplates.length
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
}));
|
|
56
|
+
void dispatch(createIntent(LayoutAction.UpdateDialog, {
|
|
57
|
+
part: "dialog",
|
|
58
|
+
options: {
|
|
59
|
+
state: false
|
|
60
|
+
}
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
if (status === "error") {
|
|
64
|
+
void dispatch(createIntent(LayoutAction.UpdateDialog, {
|
|
65
|
+
part: "dialog",
|
|
66
|
+
options: {
|
|
67
|
+
state: false
|
|
68
|
+
}
|
|
69
|
+
}));
|
|
70
|
+
void dispatch(createIntent(LayoutAction.AddToast, {
|
|
71
|
+
part: "toast",
|
|
72
|
+
subject: {
|
|
73
|
+
id: `${SCRIPT_PLUGIN}/deployment-error`,
|
|
74
|
+
icon: "ph--warning--regular",
|
|
75
|
+
duration: Infinity,
|
|
76
|
+
title: [
|
|
77
|
+
"script deployment error toast label",
|
|
78
|
+
{
|
|
79
|
+
ns: SCRIPT_PLUGIN,
|
|
80
|
+
count: scriptTemplates.length
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
description: [
|
|
84
|
+
"script deployment error toast description",
|
|
85
|
+
{
|
|
86
|
+
ns: SCRIPT_PLUGIN,
|
|
87
|
+
count: scriptTemplates.length
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
closeLabel: [
|
|
91
|
+
"script deployment error toast close label",
|
|
92
|
+
{
|
|
93
|
+
ns: SCRIPT_PLUGIN,
|
|
94
|
+
count: scriptTemplates.length
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
}));
|
|
99
|
+
}
|
|
100
|
+
}, [
|
|
101
|
+
status,
|
|
102
|
+
dispatch
|
|
103
|
+
]);
|
|
104
|
+
return /* @__PURE__ */ React.createElement(Dialog.Content, null, /* @__PURE__ */ React.createElement("div", {
|
|
105
|
+
className: "flex justify-between items-center"
|
|
106
|
+
}, /* @__PURE__ */ React.createElement(Dialog.Title, null, t("deployment dialog title")), /* @__PURE__ */ React.createElement(Dialog.Close, {
|
|
107
|
+
asChild: true
|
|
108
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
109
|
+
density: "fine",
|
|
110
|
+
variant: "ghost"
|
|
111
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
112
|
+
icon: "ph--x--regular",
|
|
113
|
+
size: 4
|
|
114
|
+
})))), /* @__PURE__ */ React.createElement("div", {
|
|
115
|
+
role: "none",
|
|
116
|
+
className: "plb-4"
|
|
117
|
+
}, /* @__PURE__ */ React.createElement("p", null, t("deployment dialog scripts found message", {
|
|
118
|
+
count: scriptTemplates.length
|
|
119
|
+
})), /* @__PURE__ */ React.createElement("ul", {
|
|
120
|
+
className: "pbs-2"
|
|
121
|
+
}, scriptTemplates.map((template) => {
|
|
122
|
+
return /* @__PURE__ */ React.createElement("li", {
|
|
123
|
+
key: template.id
|
|
124
|
+
}, template.name);
|
|
125
|
+
}))), /* @__PURE__ */ React.createElement("div", {
|
|
126
|
+
role: "none",
|
|
127
|
+
className: "flex flex-row-reverse gap-1"
|
|
128
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
129
|
+
variant: "primary",
|
|
130
|
+
onClick: handleCreateAndDeployScripts,
|
|
131
|
+
disabled: status === "pending"
|
|
132
|
+
}, status === "pending" ? t("deployment dialog deploy functions pending button label", {
|
|
133
|
+
count: scriptTemplates.length
|
|
134
|
+
}) : t("deployment dialog deploy functions button label", {
|
|
135
|
+
count: scriptTemplates.length
|
|
136
|
+
})), /* @__PURE__ */ React.createElement(Dialog.Close, {
|
|
137
|
+
asChild: true,
|
|
138
|
+
disabled: status === "pending"
|
|
139
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
140
|
+
disabled: status === "pending"
|
|
141
|
+
}, t("deployment dialog skip button label")))));
|
|
142
|
+
} finally {
|
|
143
|
+
_effect.f();
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
// packages/plugins/plugin-script/src/components/DeploymentDialog/index.ts
|
|
148
|
+
var DeploymentDialog_default = DeploymentDialog;
|
|
149
|
+
|
|
150
|
+
export {
|
|
151
|
+
DEPLOYMENT_DIALOG,
|
|
152
|
+
DeploymentDialog_default
|
|
153
|
+
};
|
|
154
|
+
//# sourceMappingURL=chunk-25GOLUXY.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/DeploymentDialog/DeploymentDialog.tsx", "../../../src/components/DeploymentDialog/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useEffect, useMemo } from 'react';\n\nimport { createIntent, LayoutAction, useIntentDispatcher } from '@dxos/app-framework';\nimport { getSpace } from '@dxos/react-client/echo';\nimport { Button, Dialog, Icon, useTranslation } from '@dxos/react-ui';\nimport { type DataType } from '@dxos/schema';\n\nimport { useCreateAndDeployScriptTemplates } from '../../hooks/useCreateAndDeployScriptTemplates';\nimport { SCRIPT_PLUGIN } from '../../meta';\nimport { type Template } from '../../templates';\n\nexport const DEPLOYMENT_DIALOG = `${SCRIPT_PLUGIN}/deployment/dialog`;\n\n// TODO(ZaymonFC):\n// - Show activity and feedback to the user.\n// - Only take an array of templateIds and get the name from the data.\n// - Pending / onError states.\n\ntype DeploymentDialogProps = {\n accessToken: DataType.AccessToken;\n scriptTemplates: Template[];\n};\n\nexport const DeploymentDialog = ({ accessToken, scriptTemplates }: DeploymentDialogProps) => {\n const { t } = useTranslation(SCRIPT_PLUGIN);\n const space = useMemo(() => getSpace(accessToken), [accessToken]);\n\n // TODO(ZaymonFC): Thinking further. All of this should get moved to intents to run async in the background.\n // Deployment shouldn't be tied to the lifecycle of the dialogue component.\n const { handleCreateAndDeployScripts, status } = useCreateAndDeployScriptTemplates(space, scriptTemplates);\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n\n useEffect(() => {\n if (status === 'success') {\n // TODO(ZaymonFC): We can probably re-use this toast for normal script deployment.\n void dispatch(\n createIntent(LayoutAction.AddToast, {\n part: 'toast',\n subject: {\n id: `${SCRIPT_PLUGIN}/deployment-success`,\n icon: 'ph--check--regular',\n duration: Infinity,\n title: ['script deployment toast label', { ns: SCRIPT_PLUGIN, count: scriptTemplates.length }],\n description: ['script deployment toast description', { ns: SCRIPT_PLUGIN, count: scriptTemplates.length }],\n closeLabel: ['script deployment toast close label', { ns: SCRIPT_PLUGIN, count: scriptTemplates.length }],\n },\n }),\n );\n void dispatch(createIntent(LayoutAction.UpdateDialog, { part: 'dialog', options: { state: false } }));\n }\n if (status === 'error') {\n void dispatch(createIntent(LayoutAction.UpdateDialog, { part: 'dialog', options: { state: false } }));\n void dispatch(\n createIntent(LayoutAction.AddToast, {\n part: 'toast',\n subject: {\n id: `${SCRIPT_PLUGIN}/deployment-error`,\n icon: 'ph--warning--regular',\n duration: Infinity,\n title: ['script deployment error toast label', { ns: SCRIPT_PLUGIN, count: scriptTemplates.length }],\n description: [\n 'script deployment error toast description',\n { ns: SCRIPT_PLUGIN, count: scriptTemplates.length },\n ],\n closeLabel: [\n 'script deployment error toast close label',\n { ns: SCRIPT_PLUGIN, count: scriptTemplates.length },\n ],\n },\n }),\n );\n }\n }, [status, dispatch]);\n\n return (\n <Dialog.Content>\n <div className='flex justify-between items-center'>\n <Dialog.Title>{t('deployment dialog title')}</Dialog.Title>\n <Dialog.Close asChild>\n <Button density='fine' variant='ghost'>\n <Icon icon='ph--x--regular' size={4} />\n </Button>\n </Dialog.Close>\n </div>\n <div role='none' className='plb-4'>\n {/* TODO: Implement deployment logic and UI. */}\n <p>{t('deployment dialog scripts found message', { count: scriptTemplates.length })}</p>\n <ul className='pbs-2'>\n {scriptTemplates.map((template) => {\n return <li key={template.id}>{template.name}</li>;\n })}\n </ul>\n </div>\n <div role='none' className='flex flex-row-reverse gap-1'>\n <Button variant='primary' onClick={handleCreateAndDeployScripts} disabled={status === 'pending'}>\n {status === 'pending'\n ? t('deployment dialog deploy functions pending button label', { count: scriptTemplates.length })\n : t('deployment dialog deploy functions button label', { count: scriptTemplates.length })}\n </Button>\n <Dialog.Close asChild disabled={status === 'pending'}>\n <Button disabled={status === 'pending'}>{t('deployment dialog skip button label')}</Button>\n </Dialog.Close>\n </div>\n </Dialog.Content>\n );\n};\n\nexport default DeploymentDialog;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { DeploymentDialog, DEP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B;IAAO,CAAA,IAC7FxB,EAAE,mDAAmD;MAAEuB,OAAOxB,gBAAgByB;IAAO,CAAA,CAAA,GAE3F,sBAAA,cAACM,OAAOK,OAAK;MAACC,SAAAA;MAAQe,UAAU7C,WAAW;OACzC,sBAAA,cAAC+B,QAAAA;MAAOc,UAAU7C,WAAW;OAAYN,EAAE,qCAAA,CAAA,CAAA,CAAA,CAAA;;;;AAKrD;;;ACrGA,IAAA,2BAAeoD;",
|
|
6
|
+
"names": ["React", "useEffect", "useMemo", "createIntent", "LayoutAction", "useIntentDispatcher", "getSpace", "Button", "Dialog", "Icon", "useTranslation", "DEPLOYMENT_DIALOG", "SCRIPT_PLUGIN", "DeploymentDialog", "accessToken", "scriptTemplates", "t", "useTranslation", "space", "useMemo", "getSpace", "handleCreateAndDeployScripts", "status", "useCreateAndDeployScriptTemplates", "dispatchPromise", "dispatch", "useIntentDispatcher", "useEffect", "createIntent", "LayoutAction", "AddToast", "part", "subject", "id", "icon", "duration", "Infinity", "title", "ns", "count", "length", "description", "closeLabel", "UpdateDialog", "options", "state", "Dialog", "Content", "div", "className", "Title", "Close", "asChild", "Button", "density", "variant", "Icon", "size", "role", "p", "ul", "map", "template", "li", "key", "name", "onClick", "disabled", "DeploymentDialog"]
|
|
7
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
meta
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-AEB5TPEW.mjs";
|
|
5
5
|
|
|
6
6
|
// packages/plugins/plugin-script/src/capabilities/capabilities.ts
|
|
7
7
|
import { defineCapability } from "@dxos/app-framework";
|
|
8
|
-
var ScriptCapabilities;
|
|
9
8
|
(function(ScriptCapabilities2) {
|
|
10
9
|
ScriptCapabilities2.Compiler = defineCapability(`${meta.id}/capability/compiler`);
|
|
11
10
|
})(ScriptCapabilities || (ScriptCapabilities = {}));
|
|
11
|
+
var ScriptCapabilities;
|
|
12
12
|
|
|
13
13
|
export {
|
|
14
14
|
ScriptCapabilities
|
|
15
15
|
};
|
|
16
|
-
//# sourceMappingURL=chunk-
|
|
16
|
+
//# sourceMappingURL=chunk-2KJYPUQD.mjs.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/capabilities/capabilities.ts"],
|
|
4
4
|
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { defineCapability } from '@dxos/app-framework';\n\nimport { type Compiler } from '../compiler';\nimport { meta } from '../meta';\n\nexport namespace ScriptCapabilities {\n export const Compiler = defineCapability<Compiler>(`${meta.id}/capability/compiler`);\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;AAIA,SAASA,wBAAwB;UAKhBC,qBAAAA;sBACFC,WAAWC,iBAA2B,GAAGC,KAAKC,EAAE,sBAAsB;AACrF,GAFiBJ,uBAAAA,qBAAAA,CAAAA,EAAAA;;",
|
|
6
6
|
"names": ["defineCapability", "ScriptCapabilities", "Compiler", "defineCapability", "meta", "id"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
ScriptAction
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UESZKXLR.mjs";
|
|
5
5
|
|
|
6
6
|
// packages/plugins/plugin-script/src/util/functions.ts
|
|
7
7
|
import { getInvocationUrl, getUserFunctionUrlInMetadata } from "@dxos/functions";
|
|
@@ -60,10 +60,11 @@ var updateFunctionMetadata = (script, storedFunction, meta, functionId) => {
|
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
// packages/plugins/plugin-script/src/util/deploy.ts
|
|
63
|
-
import { FunctionType, getUserFunctionUrlInMetadata as getUserFunctionUrlInMetadata2,
|
|
63
|
+
import { FunctionType, getUserFunctionUrlInMetadata as getUserFunctionUrlInMetadata2, makeFunctionUrl, setUserFunctionUrlInMetadata } from "@dxos/functions";
|
|
64
64
|
import { Bundler } from "@dxos/functions/bundler";
|
|
65
|
+
import { incrementSemverPatch, uploadWorkerFunction } from "@dxos/functions/edge";
|
|
65
66
|
import { log as log2 } from "@dxos/log";
|
|
66
|
-
import {
|
|
67
|
+
import { live, getMeta as getMeta2, makeRef } from "@dxos/react-client/echo";
|
|
67
68
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-script/src/util/deploy.ts";
|
|
68
69
|
var isScriptDeployed = ({ script, fn }) => {
|
|
69
70
|
const existingFunctionUrl = fn && getUserFunctionUrlInMetadata2(getMeta2(fn));
|
|
@@ -85,7 +86,7 @@ var deployScript = async ({ script, client, space, fn, existingFunctionUrl }) =>
|
|
|
85
86
|
}
|
|
86
87
|
const { functionId, version, meta } = await uploadWorkerFunction({
|
|
87
88
|
client,
|
|
88
|
-
|
|
89
|
+
ownerPublicKey: space.key,
|
|
89
90
|
version: fn ? incrementSemverPatch(fn.version) : "0.0.1",
|
|
90
91
|
functionId: existingFunctionId,
|
|
91
92
|
source: bundle
|
|
@@ -99,7 +100,9 @@ var deployScript = async ({ script, client, space, fn, existingFunctionUrl }) =>
|
|
|
99
100
|
const storedFunction = createOrUpdateFunctionInSpace(space, fn, script, functionId, version);
|
|
100
101
|
script.changed = false;
|
|
101
102
|
updateFunctionMetadata(script, storedFunction, meta, functionId);
|
|
102
|
-
const functionUrl = makeFunctionUrl(
|
|
103
|
+
const functionUrl = makeFunctionUrl({
|
|
104
|
+
functionId
|
|
105
|
+
});
|
|
103
106
|
setUserFunctionUrlInMetadata(getMeta2(storedFunction), functionUrl);
|
|
104
107
|
return {
|
|
105
108
|
success: true,
|
|
@@ -150,16 +153,13 @@ var createOrUpdateFunctionInSpace = (space, fn, script, functionId, version) =>
|
|
|
150
153
|
fn.version = version;
|
|
151
154
|
return fn;
|
|
152
155
|
} else {
|
|
153
|
-
return space.db.add(
|
|
156
|
+
return space.db.add(live(FunctionType, {
|
|
154
157
|
name: functionId,
|
|
155
158
|
version,
|
|
156
159
|
source: makeRef(script)
|
|
157
160
|
}));
|
|
158
161
|
}
|
|
159
162
|
};
|
|
160
|
-
var makeFunctionUrl = (spaceId, functionId) => {
|
|
161
|
-
return `/${spaceId}/${functionId}`;
|
|
162
|
-
};
|
|
163
163
|
|
|
164
164
|
// packages/plugins/plugin-script/src/hooks/useCreateAndDeployScriptTemplates.ts
|
|
165
165
|
import { pipe } from "effect/Function";
|
|
@@ -231,4 +231,4 @@ export {
|
|
|
231
231
|
deployScript,
|
|
232
232
|
useCreateAndDeployScriptTemplates
|
|
233
233
|
};
|
|
234
|
-
//# sourceMappingURL=chunk-
|
|
234
|
+
//# sourceMappingURL=chunk-47MABIVX.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/util/functions.ts", "../../../src/util/deploy.ts", "../../../src/hooks/useCreateAndDeployScriptTemplates.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type ScriptType, getInvocationUrl, getUserFunctionUrlInMetadata } from '@dxos/functions';\nimport { log } from '@dxos/log';\nimport { getMeta, getSpace } from '@dxos/react-client/echo';\n\n/**\n * Get the function URL for a given script and client configuration\n */\nexport const getFunctionUrl = ({\n script,\n fn,\n edgeUrl,\n}: {\n script: ScriptType;\n fn: any;\n edgeUrl: string;\n}): string | undefined => {\n const space = getSpace(script);\n const existingFunctionUrl = fn && getUserFunctionUrlInMetadata(getMeta(fn));\n\n if (!existingFunctionUrl) {\n return undefined;\n }\n\n return getInvocationUrl(existingFunctionUrl, edgeUrl, {\n spaceId: space?.id,\n });\n};\n\nexport const updateFunctionMetadata = (script: ScriptType, storedFunction: any, meta: any, functionId: string) => {\n if (script.description !== undefined && script.description.trim() !== '') {\n storedFunction.description = script.description;\n } else if (meta.description) {\n storedFunction.description = meta.description;\n } else {\n log.verbose('no description in function metadata', { functionId });\n }\n\n if (meta.inputSchema) {\n storedFunction.inputSchema = meta.inputSchema;\n } else {\n log.verbose('no input schema in function metadata', { functionId });\n }\n\n if (meta.outputSchema) {\n storedFunction.outputSchema = meta.outputSchema;\n } else {\n log.verbose('no output schema in function metadata', { functionId });\n }\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Client } from '@dxos/client';\nimport {\n FunctionType,\n type ScriptType,\n getUserFunctionUrlInMetadata,\n makeFunctionUrl,\n setUserFunctionUrlInMetadata,\n} from '@dxos/functions';\nimport { Bundler } from '@dxos/functions/bundler';\nimport { incrementSemverPatch, uploadWorkerFunction } from '@dxos/functions/edge';\nimport { log } from '@dxos/log';\nimport { live, getMeta, makeRef, type Space } from '@dxos/react-client/echo';\n\nimport { updateFunctionMetadata } from './functions';\n\nexport const isScriptDeployed = ({ script, fn }: { script: ScriptType; fn: any }): boolean => {\n const existingFunctionUrl = fn && getUserFunctionUrlInMetadata(getMeta(fn));\n return Boolean(existingFunctionUrl) && !script.changed;\n};\n\ntype DeployScriptProps = {\n script: ScriptType;\n client: Client;\n space: Space;\n fn?: FunctionType;\n existingFunctionUrl?: string;\n};\n\ntype DeployScriptResult = { success: boolean; error?: Error; functionUrl?: string };\n\n/**\n * Deploy a script to a space, handling bundling and uploading to the FaaS infrastructure.\n */\nexport const deployScript = async ({\n script,\n client,\n space,\n fn,\n existingFunctionUrl,\n}: DeployScriptProps): Promise<DeployScriptResult> => {\n const validationError = validateDeployInputs(script, space);\n if (validationError) {\n return { success: false, error: validationError };\n }\n\n try {\n const existingFunctionId = extractFunctionId(existingFunctionUrl);\n\n const { bundle, error } = await bundleScript(script.source!.target!.content);\n if (error || !bundle) {\n throw error || new Error('Bundle creation failed');\n }\n\n const { functionId, version, meta } = await uploadWorkerFunction({\n client,\n ownerPublicKey: space.key,\n version: fn ? incrementSemverPatch(fn.version) : '0.0.1',\n functionId: existingFunctionId,\n source: bundle,\n });\n\n if (functionId === undefined || version === undefined) {\n throw new Error(`Upload didn't return expected data: ${JSON.stringify({ functionId, version })}`);\n }\n\n const storedFunction = createOrUpdateFunctionInSpace(space, fn, script, functionId, version);\n script.changed = false;\n updateFunctionMetadata(script, storedFunction, meta, functionId);\n\n const functionUrl = makeFunctionUrl({ functionId });\n setUserFunctionUrlInMetadata(getMeta(storedFunction), functionUrl);\n\n return { success: true, functionUrl };\n } catch (err: any) {\n log.catch(err);\n return { success: false, error: err };\n }\n};\n\n/**\n * Validate inputs for script deployment.\n */\nconst validateDeployInputs = (script: ScriptType, space: Space): Error | null => {\n if (!script.source || !space) {\n return new Error('Script source or space not available');\n }\n return null;\n};\n\nconst extractFunctionId = (functionUrl?: string): string | undefined => {\n return functionUrl?.split('/').at(-1);\n};\n\nconst bundleScript = async (source: string): Promise<{ bundle?: string; error?: Error }> => {\n const bundler = new Bundler({ platform: 'browser', sandboxedModules: [], remoteModules: {} });\n const buildResult = await bundler.bundle({ source });\n\n if (buildResult.error || !buildResult.bundle) {\n return { error: buildResult.error || new Error('Bundle creation failed') };\n }\n\n return { bundle: buildResult.bundle };\n};\n\nconst createOrUpdateFunctionInSpace = (\n space: Space,\n fn: FunctionType | undefined,\n script: ScriptType,\n functionId: string,\n version: string,\n): FunctionType => {\n if (fn) {\n fn.version = version;\n return fn;\n } else {\n return space.db.add(live(FunctionType, { name: functionId, version, source: makeRef(script) }));\n }\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { pipe } from 'effect/Function';\nimport { useCallback, useState } from 'react';\n\nimport { chain, createIntent, useIntentDispatcher } from '@dxos/app-framework';\nimport { isInstanceOf } from '@dxos/echo-schema';\nimport { ScriptType } from '@dxos/functions';\nimport { invariant } from '@dxos/invariant';\nimport { SpaceAction } from '@dxos/plugin-space/types';\nimport { useClient } from '@dxos/react-client';\nimport { type Space } from '@dxos/react-client/echo';\n\nimport { type Template } from '../templates';\nimport { ScriptAction } from '../types';\nimport { deployScript } from '../util';\n\ntype DeploymentStatus = 'idle' | 'pending' | 'success' | 'error';\n\n/**\n * Hook for creating and deploying multiple script templates concurrently.\n *\n * Takes a space and an array of script template IDs, then provides a callback\n * function that creates each script from its template and deploys it to the space.\n * All creation / deployment operations run concurrently for improved performance.\n */\nexport const useCreateAndDeployScriptTemplates = (space: Space | undefined, scriptTemplates: Template[]) => {\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n const client = useClient();\n const [status, setStatus] = useState<DeploymentStatus>('idle');\n const [error, setError] = useState<Error | undefined>(undefined);\n\n const handleCreateAndDeployScripts = useCallback(async () => {\n invariant(space);\n setStatus('pending');\n setError(undefined);\n\n const deploymentResults = await Promise.all(\n scriptTemplates.map(async (template) => {\n const result = await dispatch(\n pipe(\n createIntent(ScriptAction.Create, { space, initialTemplateId: template.id }),\n chain(SpaceAction.AddObject, { target: space }),\n ),\n );\n invariant(isInstanceOf(ScriptType, result.data?.object));\n\n return deployScript({ space, client, script: result.data.object });\n }),\n );\n\n const hasErrors = deploymentResults.some((result) => !result.success);\n setStatus(hasErrors ? 'error' : 'success');\n }, [space, dispatch, client, scriptTemplates]);\n\n return { handleCreateAndDeployScripts, status, error };\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;AAIA,SAA0BA,kBAAkBC,oCAAoC;AAChF,SAASC,WAAW;AACpB,SAASC,SAASC,gBAAgB;;AAK3B,IAAMC,iBAAiB,CAAC,EAC7BC,QACAC,IACAC,QAAO,MAKR;AACC,QAAMC,QAAQL,SAASE,MAAAA;AACvB,QAAMI,sBAAsBH,MAAMN,6BAA6BE,QAAQI,EAAAA,CAAAA;AAEvE,MAAI,CAACG,qBAAqB;AACxB,WAAOC;EACT;AAEA,SAAOX,iBAAiBU,qBAAqBF,SAAS;IACpDI,SAASH,OAAOI;EAClB,CAAA;AACF;AAEO,IAAMC,yBAAyB,CAACR,QAAoBS,gBAAqBC,MAAWC,eAAAA;AACzF,MAAIX,OAAOY,gBAAgBP,UAAaL,OAAOY,YAAYC,KAAI,MAAO,IA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C;QAAOK;QAAQgC,QAAQhB,OAAOa,KAAKC;MAAO,CAAA;IAClE,CAAA,CAAA;AAGF,UAAMG,YAAYtB,kBAAkBuB,KAAK,CAAClB,WAAW,CAACA,OAAOmB,OAAO;AACpEhC,cAAU8B,YAAY,UAAU,SAAA;EAClC,GAAG;IAACtC;IAAOG;IAAUE;IAAQJ;GAAgB;AAE7C,SAAO;IAAEY;IAA8BN;IAAQG;EAAM;AACvD;",
|
|
6
|
+
"names": ["getInvocationUrl", "getUserFunctionUrlInMetadata", "log", "getMeta", "getSpace", "getFunctionUrl", "script", "fn", "edgeUrl", "space", "existingFunctionUrl", "undefined", "spaceId", "id", "updateFunctionMetadata", "storedFunction", "meta", "functionId", "description", "trim", "verbose", "inputSchema", "outputSchema", "FunctionType", "getUserFunctionUrlInMetadata", "makeFunctionUrl", "setUserFunctionUrlInMetadata", "Bundler", "incrementSemverPatch", "uploadWorkerFunction", "log", "live", "getMeta", "makeRef", "isScriptDeployed", "script", "fn", "existingFunctionUrl", "getUserFunctionUrlInMetadata", "getMeta", "Boolean", "changed", "deployScript", "client", "space", "validationError", "validateDeployInputs", "success", "error", "existingFunctionId", "extractFunctionId", "bundle", "bundleScript", "source", "target", "content", "Error", "functionId", "version", "meta", "uploadWorkerFunction", "ownerPublicKey", "key", "incrementSemverPatch", "undefined", "JSON", "stringify", "storedFunction", "createOrUpdateFunctionInSpace", "updateFunctionMetadata", "functionUrl", "makeFunctionUrl", "setUserFunctionUrlInMetadata", "err", "log", "catch", "split", "at", "bundler", "Bundler", "platform", "sandboxedModules", "remoteModules", "buildResult", "db", "add", "live", "FunctionType", "name", "makeRef", "pipe", "useCallback", "useState", "chain", "createIntent", "useIntentDispatcher", "isInstanceOf", "ScriptType", "invariant", "SpaceAction", "useClient", "useCreateAndDeployScriptTemplates", "space", "scriptTemplates", "dispatchPromise", "dispatch", "useIntentDispatcher", "client", "useClient", "status", "setStatus", "useState", "error", "setError", "undefined", "handleCreateAndDeployScripts", "useCallback", "invariant", "deploymentResults", "Promise", "all", "map", "template", "result", "pipe", "createIntent", "ScriptAction", "Create", "initialTemplateId", "id", "chain", "SpaceAction", "AddObject", "target", "isInstanceOf", "ScriptType", "data", "object", "deployScript", "script", "hasErrors", "some", "success"]
|
|
7
|
+
}
|
|
@@ -7,15 +7,16 @@ var meta = {
|
|
|
7
7
|
name: "Scripts",
|
|
8
8
|
description: "Scripts in Composer allow you to deploy custom functions that run on the edge. These functions can be referenced by your AI agent and called inside of cells in any Sheet. Use scripts to interact with API\u2019s or external data inside of Composer.",
|
|
9
9
|
icon: "ph--code--regular",
|
|
10
|
-
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/
|
|
10
|
+
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-explorer",
|
|
11
11
|
tags: [
|
|
12
|
-
"
|
|
12
|
+
"labs"
|
|
13
13
|
],
|
|
14
14
|
screenshots: [
|
|
15
15
|
"https://dxos.network/plugin-details-scripts-dark.png"
|
|
16
16
|
]
|
|
17
17
|
};
|
|
18
18
|
var defaultScriptsForIntegration = {
|
|
19
|
+
// TODO(wittjosiah): Also include content extraction scripts in the default set.
|
|
19
20
|
"gmail.com": [
|
|
20
21
|
"dxos.org/script/gmail"
|
|
21
22
|
]
|
|
@@ -26,4 +27,4 @@ export {
|
|
|
26
27
|
meta,
|
|
27
28
|
defaultScriptsForIntegration
|
|
28
29
|
};
|
|
29
|
-
//# sourceMappingURL=chunk-
|
|
30
|
+
//# sourceMappingURL=chunk-AEB5TPEW.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const SCRIPT_PLUGIN = 'dxos.org/plugin/script';\n\nexport const meta: PluginMeta = {\n id: SCRIPT_PLUGIN,\n name: 'Scripts',\n description:\n 'Scripts in Composer allow you to deploy custom functions that run on the edge. These functions can be referenced by your AI agent and called inside of cells in any Sheet. Use scripts to interact with API’s or external data inside of Composer.',\n icon: 'ph--code--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/
|
|
5
|
-
"mappings": ";;;AAMO,IAAMA,gBAAgB;AAEtB,IAAMC,OAAmB;EAC9BC,IAAIF;EACJG,MAAM;EACNC,aACE;EACFC,MAAM;EACNC,QAAQ;EACRC,MAAM;IAAC;;EACPC,aAAa;IAAC;;AAChB;AAGO,IAAMC,+BAAyD
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const SCRIPT_PLUGIN = 'dxos.org/plugin/script';\n\nexport const meta: PluginMeta = {\n id: SCRIPT_PLUGIN,\n name: 'Scripts',\n description:\n 'Scripts in Composer allow you to deploy custom functions that run on the edge. These functions can be referenced by your AI agent and called inside of cells in any Sheet. Use scripts to interact with API’s or external data inside of Composer.',\n icon: 'ph--code--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-explorer',\n tags: ['labs'],\n screenshots: ['https://dxos.network/plugin-details-scripts-dark.png'],\n};\n\n// TODO(ZaymonFC): Configure by scopes?\nexport const defaultScriptsForIntegration: Record<string, string[]> = {\n // TODO(wittjosiah): Also include content extraction scripts in the default set.\n 'gmail.com': ['dxos.org/script/gmail'],\n};\n"],
|
|
5
|
+
"mappings": ";;;AAMO,IAAMA,gBAAgB;AAEtB,IAAMC,OAAmB;EAC9BC,IAAIF;EACJG,MAAM;EACNC,aACE;EACFC,MAAM;EACNC,QAAQ;EACRC,MAAM;IAAC;;EACPC,aAAa;IAAC;;AAChB;AAGO,IAAMC,+BAAyD;;EAEpE,aAAa;IAAC;;AAChB;",
|
|
6
6
|
"names": ["SCRIPT_PLUGIN", "meta", "id", "name", "description", "icon", "source", "tags", "screenshots", "defaultScriptsForIntegration"]
|
|
7
7
|
}
|