@dxos/plugin-script 0.9.1-main.c7dcc2e112 → 0.10.0
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/PLUGIN.mdl +9 -9
- package/dist/lib/neutral/{NotebookArticle-E35G2Y2I.mjs → NotebookArticle-AOBB3XGD.mjs} +27 -45
- package/dist/lib/neutral/NotebookArticle-AOBB3XGD.mjs.map +7 -0
- package/dist/lib/neutral/{ScriptArticle-QW26LOKU.mjs → ScriptArticle-I3DOJARR.mjs} +4 -4
- package/dist/lib/neutral/ScriptArticle-I3DOJARR.mjs.map +7 -0
- package/dist/lib/neutral/ScriptPlugin.mjs +4 -4
- package/dist/lib/neutral/ScriptPlugin.mjs.map +3 -3
- package/dist/lib/neutral/ScriptPlugin.node.mjs +3 -3
- package/dist/lib/neutral/ScriptPlugin.node.mjs.map +3 -3
- package/dist/lib/neutral/{ScriptProperties-ADTWXG6O.mjs → ScriptProperties-RHDQGMGT.mjs} +148 -148
- package/dist/lib/neutral/ScriptProperties-RHDQGMGT.mjs.map +7 -0
- package/dist/lib/neutral/ScriptSettings-NS3ZY7ZR.mjs +35 -0
- package/dist/lib/neutral/ScriptSettings-NS3ZY7ZR.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +6 -6
- package/dist/lib/neutral/capabilities/index.mjs.map +3 -3
- package/dist/lib/neutral/capabilities/node.mjs +5 -5
- package/dist/lib/neutral/capabilities/node.mjs.map +3 -3
- package/dist/lib/neutral/{chunk-ZPFRRBZW.mjs → chunk-652CIABA.mjs} +10 -9
- package/dist/lib/neutral/chunk-652CIABA.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-TRKXIP2Q.mjs → chunk-6DOWVKIW.mjs} +4 -5
- package/dist/lib/neutral/chunk-6DOWVKIW.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-BDHDBPVM.mjs → chunk-CHNFYLKW.mjs} +12 -12
- package/dist/lib/neutral/chunk-CHNFYLKW.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-VXDJH6OL.mjs → chunk-INFWOSTM.mjs} +14 -8
- package/dist/lib/neutral/chunk-INFWOSTM.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-JAJ64B3E.mjs → chunk-KSVKXCTX.mjs} +2 -2
- package/dist/lib/neutral/chunk-USJ44FIU.mjs +8 -0
- package/dist/lib/neutral/{chunk-O6A5PTB3.mjs.map → chunk-USJ44FIU.mjs.map} +1 -1
- package/dist/lib/neutral/{chunk-QV6NCUGM.mjs → chunk-WAGQ77UQ.mjs} +6 -6
- package/dist/lib/neutral/chunk-WAGQ77UQ.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +120 -91
- package/dist/lib/neutral/components/index.mjs.map +4 -4
- package/dist/lib/neutral/containers/index.mjs +5 -3
- package/dist/lib/neutral/containers/index.mjs.map +3 -3
- package/dist/lib/neutral/{create-6LC57CCC.mjs → create-SGHWWTET.mjs} +4 -4
- package/dist/lib/neutral/{create-6LC57CCC.mjs.map → create-SGHWWTET.mjs.map} +4 -4
- package/dist/lib/neutral/{create-object-FZM5ASWM.mjs → create-object-QW66KQWS.mjs} +1 -3
- package/dist/lib/neutral/{create-object-FZM5ASWM.mjs.map → create-object-QW66KQWS.mjs.map} +3 -3
- package/dist/lib/neutral/{create-script-YW437XYZ.mjs → create-script-CIEJOBIU.mjs} +4 -4
- package/dist/lib/neutral/{create-script-YW437XYZ.mjs.map → create-script-CIEJOBIU.mjs.map} +3 -3
- package/dist/lib/neutral/{delete-HCQIQFVP.mjs → delete-72RXVLVI.mjs} +3 -3
- package/dist/lib/neutral/{delete-HCQIQFVP.mjs.map → delete-72RXVLVI.mjs.map} +1 -1
- package/dist/lib/neutral/{deploy-7JVMMHSH.mjs → deploy-PJTJAQZY.mjs} +10 -6
- package/dist/lib/neutral/deploy-PJTJAQZY.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +2 -2
- package/dist/lib/neutral/hooks/index.mjs.map +2 -2
- package/dist/lib/neutral/index.mjs +8 -8
- package/dist/lib/neutral/{inspect-invocations-TAOYDT4H.mjs → inspect-invocations-ZUXVUAML.mjs} +5 -5
- package/dist/lib/neutral/inspect-invocations-ZUXVUAML.mjs.map +7 -0
- package/dist/lib/neutral/{install-function-FJIE2JAI.mjs → install-function-YFDZLVMJ.mjs} +4 -4
- package/dist/lib/neutral/{install-function-FJIE2JAI.mjs.map → install-function-YFDZLVMJ.mjs.map} +1 -1
- package/dist/lib/neutral/{invoke-3HVWY2KF.mjs → invoke-CDRBQ2WA.mjs} +4 -4
- package/dist/lib/neutral/{invoke-3HVWY2KF.mjs.map → invoke-CDRBQ2WA.mjs.map} +1 -1
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/lib/neutral/{operation-handler-6IZ7L4L2.mjs → operation-handler-M3B6IRMV.mjs} +3 -3
- package/dist/lib/neutral/{operation-handler-6IZ7L4L2.mjs.map → operation-handler-M3B6IRMV.mjs.map} +1 -1
- package/dist/lib/neutral/operations/index.mjs +1 -1
- package/dist/lib/neutral/plugin.mjs +1 -1
- package/dist/lib/neutral/{query-deployed-functions-F4FHJNWO.mjs → query-deployed-functions-RBQMGON2.mjs} +4 -4
- package/dist/lib/neutral/{query-deployed-functions-F4FHJNWO.mjs.map → query-deployed-functions-RBQMGON2.mjs.map} +1 -1
- package/dist/lib/neutral/{react-surface-2TZDZQYA.mjs → react-surface-GEXOZLBC.mjs} +4 -5
- package/dist/lib/neutral/react-surface-GEXOZLBC.mjs.map +7 -0
- package/dist/lib/neutral/{read-RQESBAQI.mjs → read-OY3K5R3V.mjs} +3 -3
- package/dist/lib/neutral/{read-RQESBAQI.mjs.map → read-OY3K5R3V.mjs.map} +3 -3
- package/dist/lib/neutral/skill-definition-JZ7UYBT7.mjs +15 -0
- package/dist/lib/neutral/skill-definition-JZ7UYBT7.mjs.map +7 -0
- package/dist/lib/neutral/skills/index.mjs +10 -0
- package/dist/lib/neutral/templates/index.mjs +1 -1
- package/dist/lib/neutral/translations.mjs +6 -7
- package/dist/lib/neutral/translations.mjs.map +2 -2
- package/dist/lib/neutral/types/index.mjs +2 -2
- package/dist/lib/neutral/update-Z5VGOLBN.mjs +44 -0
- package/dist/lib/neutral/update-Z5VGOLBN.mjs.map +7 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/compiler.d.ts +1 -2
- package/dist/types/src/capabilities/compiler.d.ts.map +1 -1
- package/dist/types/src/capabilities/create-object.d.ts +1 -12
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +1 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/node.d.ts +1 -1
- package/dist/types/src/capabilities/node.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/settings.d.ts +1 -3
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- package/dist/types/src/capabilities/skill-definition.d.ts +5 -0
- package/dist/types/src/capabilities/skill-definition.d.ts.map +1 -0
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts +2 -3
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts +18 -21
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts.map +1 -1
- package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +18 -21
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.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 +0 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts +18 -21
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts.map +1 -1
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.stories.d.ts +20 -23
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.stories.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.stories.d.ts +20 -23
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.stories.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptProperties/SkillEditor.d.ts +7 -0
- package/dist/types/src/containers/ScriptProperties/SkillEditor.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptSettings/ScriptSettings.d.ts +8 -0
- package/dist/types/src/containers/ScriptSettings/ScriptSettings.d.ts.map +1 -0
- package/dist/types/src/{components/ScriptPluginSettings/ScriptPluginSettings.stories.d.ts → containers/ScriptSettings/ScriptSettings.stories.d.ts} +20 -23
- package/dist/types/src/containers/ScriptSettings/ScriptSettings.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptSettings/index.d.ts +2 -0
- package/dist/types/src/containers/ScriptSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +1 -0
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/hooks/deploy.d.ts +6 -15
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/hooks/format.d.ts +2 -1
- package/dist/types/src/hooks/format.d.ts.map +1 -1
- package/dist/types/src/hooks/template.d.ts +2 -1
- package/dist/types/src/hooks/template.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +4 -0
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/create-script.d.ts.map +1 -1
- package/dist/types/src/skills/functions/create.d.ts.map +1 -0
- package/dist/types/src/skills/functions/definitions.d.ts +75 -0
- package/dist/types/src/skills/functions/definitions.d.ts.map +1 -0
- package/dist/types/src/skills/functions/delete.d.ts +7 -0
- package/dist/types/src/skills/functions/delete.d.ts.map +1 -0
- package/dist/types/src/skills/functions/deploy.d.ts +11 -0
- package/dist/types/src/skills/functions/deploy.d.ts.map +1 -0
- package/dist/types/src/skills/functions/index.d.ts.map +1 -0
- package/dist/types/src/skills/functions/inspect-invocations.d.ts +18 -0
- package/dist/types/src/skills/functions/inspect-invocations.d.ts.map +1 -0
- package/dist/types/src/skills/functions/install-function.d.ts.map +1 -0
- package/dist/types/src/skills/functions/invoke.d.ts +11 -0
- package/dist/types/src/skills/functions/invoke.d.ts.map +1 -0
- package/dist/types/src/skills/functions/query-deployed-functions.d.ts.map +1 -0
- package/dist/types/src/skills/functions/read.d.ts +11 -0
- package/dist/types/src/skills/functions/read.d.ts.map +1 -0
- package/dist/types/src/skills/functions/update.d.ts +16 -0
- package/dist/types/src/skills/functions/update.d.ts.map +1 -0
- package/dist/types/src/skills/index.d.ts +2 -0
- package/dist/types/src/skills/index.d.ts.map +1 -0
- package/dist/types/src/skills/script-skill.d.ts +4 -0
- package/dist/types/src/skills/script-skill.d.ts.map +1 -0
- package/dist/types/src/templates/chess-bot.d.ts +1 -4
- package/dist/types/src/templates/chess-bot.d.ts.map +1 -1
- package/dist/types/src/templates/commentary.d.ts +1 -4
- package/dist/types/src/templates/commentary.d.ts.map +1 -1
- package/dist/types/src/testing/test-script.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +18 -21
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Notebook.d.ts +11 -81
- package/dist/types/src/types/Notebook.d.ts.map +1 -1
- package/dist/types/src/types/ScriptOperation.d.ts +2 -10
- package/dist/types/src/types/ScriptOperation.d.ts.map +1 -1
- package/dist/types/src/util/deploy.d.ts +1 -1
- package/dist/types/src/util/deploy.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +75 -74
- package/src/ScriptPlugin.node.ts +2 -2
- package/src/ScriptPlugin.test.ts +1 -1
- package/src/ScriptPlugin.tsx +2 -2
- package/src/capabilities/create-object.ts +0 -2
- package/src/capabilities/index.ts +1 -1
- package/src/capabilities/node.ts +1 -1
- package/src/capabilities/operation-handler.ts +1 -1
- package/src/capabilities/react-surface.tsx +9 -7
- package/src/capabilities/skill-definition.ts +14 -0
- package/src/components/NotebookStack/NotebookCell.tsx +11 -29
- package/src/components/NotebookStack/NotebookStack.stories.tsx +3 -3
- package/src/components/NotebookStack/NotebookStack.tsx +101 -43
- package/src/components/QueryEditor/QueryEditor.stories.tsx +2 -7
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +2 -2
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +7 -8
- package/src/components/index.ts +0 -4
- package/src/containers/NotebookArticle/NotebookArticle.stories.tsx +4 -4
- package/src/containers/NotebookArticle/NotebookArticle.tsx +20 -42
- package/src/containers/ScriptArticle/ScriptArticle.stories.tsx +5 -5
- package/src/containers/ScriptArticle/ScriptArticle.tsx +3 -3
- package/src/containers/ScriptProperties/FunctionBinding.tsx +1 -1
- package/src/containers/ScriptProperties/FunctionPublishing.tsx +1 -1
- package/src/containers/ScriptProperties/ScriptProperties.stories.tsx +5 -5
- package/src/containers/ScriptProperties/ScriptProperties.tsx +2 -2
- package/src/containers/ScriptProperties/{BlueprintEditor.tsx → SkillEditor.tsx} +22 -22
- package/src/{components/ScriptPluginSettings/ScriptPluginSettings.stories.tsx → containers/ScriptSettings/ScriptSettings.stories.tsx} +4 -4
- package/src/containers/ScriptSettings/ScriptSettings.tsx +47 -0
- package/src/containers/ScriptSettings/index.ts +5 -0
- package/src/containers/index.ts +1 -0
- package/src/e2e/ai.test.ts +14 -11
- package/src/e2e/deploy.test.ts +5 -1
- package/src/hooks/deploy.ts +1 -1
- package/src/index.ts +1 -1
- package/src/operations/create-script.ts +1 -1
- package/src/{blueprints → skills}/functions/create.ts +1 -1
- package/src/{blueprints → skills}/functions/definitions.ts +4 -2
- package/src/{blueprints → skills}/functions/deploy.ts +7 -2
- package/src/{blueprints → skills}/functions/inspect-invocations.ts +2 -2
- package/src/{blueprints → skills}/functions/read.ts +1 -1
- package/src/skills/functions/update.ts +48 -0
- package/src/skills/index.ts +5 -0
- package/src/{blueprints/script-blueprint.ts → skills/script-skill.ts} +12 -12
- package/src/templates/anthropic.ts +1 -1
- package/src/templates/chess-bot.ts +2 -2
- package/src/templates/commentary.ts +4 -4
- package/src/templates/discord.ts +1 -1
- package/src/templates/gmail.ts +1 -1
- package/src/testing/test-notebook.ts +5 -5
- package/src/testing/test-script.ts +1 -1
- package/src/translations.ts +6 -7
- package/src/types/Notebook.ts +9 -13
- package/src/types/ScriptOperation.ts +2 -2
- package/src/util/deploy.ts +7 -3
- package/src/util/functions.ts +3 -3
- package/dist/lib/neutral/NotebookArticle-E35G2Y2I.mjs.map +0 -7
- package/dist/lib/neutral/ScriptArticle-QW26LOKU.mjs.map +0 -7
- package/dist/lib/neutral/ScriptPluginSettings-5AURDJTI.mjs +0 -31
- package/dist/lib/neutral/ScriptPluginSettings-5AURDJTI.mjs.map +0 -7
- package/dist/lib/neutral/ScriptProperties-ADTWXG6O.mjs.map +0 -7
- package/dist/lib/neutral/blueprint-definition-PJ7I3JIQ.mjs +0 -15
- package/dist/lib/neutral/blueprint-definition-PJ7I3JIQ.mjs.map +0 -7
- package/dist/lib/neutral/blueprints/index.mjs +0 -10
- package/dist/lib/neutral/chunk-BDHDBPVM.mjs.map +0 -7
- package/dist/lib/neutral/chunk-O6A5PTB3.mjs +0 -8
- package/dist/lib/neutral/chunk-QV6NCUGM.mjs.map +0 -7
- package/dist/lib/neutral/chunk-TRKXIP2Q.mjs.map +0 -7
- package/dist/lib/neutral/chunk-VXDJH6OL.mjs.map +0 -7
- package/dist/lib/neutral/chunk-ZPFRRBZW.mjs.map +0 -7
- package/dist/lib/neutral/deploy-7JVMMHSH.mjs.map +0 -7
- package/dist/lib/neutral/inspect-invocations-TAOYDT4H.mjs.map +0 -7
- package/dist/lib/neutral/react-surface-2TZDZQYA.mjs.map +0 -7
- package/dist/lib/neutral/update-CO7B6UBS.mjs +0 -63
- package/dist/lib/neutral/update-CO7B6UBS.mjs.map +0 -7
- package/dist/types/src/blueprints/functions/create.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/definitions.d.ts +0 -135
- package/dist/types/src/blueprints/functions/definitions.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/delete.d.ts +0 -17
- package/dist/types/src/blueprints/functions/delete.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/deploy.d.ts +0 -21
- package/dist/types/src/blueprints/functions/deploy.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/index.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/inspect-invocations.d.ts +0 -28
- package/dist/types/src/blueprints/functions/inspect-invocations.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/install-function.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/invoke.d.ts +0 -21
- package/dist/types/src/blueprints/functions/invoke.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/query-deployed-functions.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/read.d.ts +0 -21
- package/dist/types/src/blueprints/functions/read.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/update.d.ts +0 -26
- package/dist/types/src/blueprints/functions/update.d.ts.map +0 -1
- package/dist/types/src/blueprints/index.d.ts +0 -2
- package/dist/types/src/blueprints/index.d.ts.map +0 -1
- package/dist/types/src/blueprints/script-blueprint.d.ts +0 -4
- package/dist/types/src/blueprints/script-blueprint.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +0 -6
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.d.ts +0 -8
- package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.d.ts.map +0 -1
- package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.stories.d.ts.map +0 -1
- package/dist/types/src/components/ScriptPluginSettings/index.d.ts +0 -2
- package/dist/types/src/components/ScriptPluginSettings/index.d.ts.map +0 -1
- package/dist/types/src/containers/ScriptProperties/BlueprintEditor.d.ts +0 -7
- package/dist/types/src/containers/ScriptProperties/BlueprintEditor.d.ts.map +0 -1
- package/src/blueprints/functions/update.ts +0 -68
- package/src/blueprints/index.ts +0 -5
- package/src/capabilities/blueprint-definition.ts +0 -19
- package/src/components/ScriptPluginSettings/ScriptPluginSettings.tsx +0 -42
- package/src/components/ScriptPluginSettings/index.ts +0 -5
- /package/dist/lib/neutral/{chunk-JAJ64B3E.mjs.map → chunk-KSVKXCTX.mjs.map} +0 -0
- /package/dist/lib/neutral/{blueprints → skills}/index.mjs.map +0 -0
- /package/dist/types/src/{blueprints → skills}/functions/create.d.ts +0 -0
- /package/dist/types/src/{blueprints → skills}/functions/index.d.ts +0 -0
- /package/dist/types/src/{blueprints → skills}/functions/install-function.d.ts +0 -0
- /package/dist/types/src/{blueprints → skills}/functions/query-deployed-functions.d.ts +0 -0
- /package/src/{blueprints → skills}/functions/delete.ts +0 -0
- /package/src/{blueprints → skills}/functions/index.ts +0 -0
- /package/src/{blueprints → skills}/functions/install-function.ts +0 -0
- /package/src/{blueprints → skills}/functions/invoke.ts +0 -0
- /package/src/{blueprints → skills}/functions/query-deployed-functions.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/ScriptPlugin.node.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\nimport { Script } from '@dxos/compute';\n\nimport { AppGraphBuilder,
|
|
5
|
-
"mappings": ";;;AAIA,SAASA,cAAc;AACvB,SAASC,iBAAiB;AAC1B,SAASC,cAAc;AAEvB,SAASC,iBAAiBC,
|
|
6
|
-
"names": ["Plugin", "AppPlugin", "Script", "AppGraphBuilder", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\nimport { Script } from '@dxos/compute';\n\nimport { AppGraphBuilder, CreateObject, OperationHandler, SkillDefinition } from '#capabilities';\nimport { meta } from '#meta';\n\nexport const ScriptPlugin = Plugin.define(meta).pipe(\n AppPlugin.addAppGraphModule({ activate: AppGraphBuilder }),\n AppPlugin.addSkillDefinitionModule({ activate: SkillDefinition }),\n AppPlugin.addCreateObjectModule({ activate: CreateObject }),\n AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),\n AppPlugin.addSchemaModule({ schema: [Script.Script] }),\n Plugin.make,\n);\n\nexport default ScriptPlugin;\n"],
|
|
5
|
+
"mappings": ";;;AAIA,SAASA,cAAc;AACvB,SAASC,iBAAiB;AAC1B,SAASC,cAAc;AAEvB,SAASC,iBAAiBC,cAAcC,kBAAkBC,uBAAuB;AACjF,SAASC,YAAY;AAEd,IAAMC,eAAeR,OAAOS,OAAOF,IAAAA,EAAMG,KAC9CT,UAAUU,kBAAkB;EAAEC,UAAUT;AAAgB,CAAA,GACxDF,UAAUY,yBAAyB;EAAED,UAAUN;AAAgB,CAAA,GAC/DL,UAAUa,sBAAsB;EAAEF,UAAUR;AAAa,CAAA,GACzDH,UAAUc,0BAA0B;EAAEH,UAAUP;AAAiB,CAAA,GACjEJ,UAAUe,gBAAgB;EAAEC,QAAQ;IAACf,OAAOA;;AAAQ,CAAA,GACpDF,OAAOkB,IAAI;AAGb,IAAA,4BAAeV;",
|
|
6
|
+
"names": ["Plugin", "AppPlugin", "Script", "AppGraphBuilder", "CreateObject", "OperationHandler", "SkillDefinition", "meta", "ScriptPlugin", "define", "pipe", "addAppGraphModule", "activate", "addSkillDefinitionModule", "addCreateObjectModule", "addOperationHandlerModule", "addSchemaModule", "schema", "make"]
|
|
7
7
|
}
|
|
@@ -4,132 +4,35 @@ import "./chunk-J5LGTIGS.mjs";
|
|
|
4
4
|
import React4 from "react";
|
|
5
5
|
import { Form as Form4 } from "@dxos/react-ui-form";
|
|
6
6
|
|
|
7
|
-
// src/containers/ScriptProperties/
|
|
8
|
-
import React, { useCallback
|
|
9
|
-
import { ToolId } from "@dxos/ai";
|
|
10
|
-
import { Blueprint, Template } from "@dxos/compute";
|
|
7
|
+
// src/containers/ScriptProperties/FunctionBinding.tsx
|
|
8
|
+
import React, { useCallback } from "react";
|
|
11
9
|
import { Operation } from "@dxos/compute";
|
|
12
10
|
import { Filter, Obj, Ref } from "@dxos/echo";
|
|
11
|
+
import { getUserFunctionIdInMetadata } from "@dxos/functions";
|
|
12
|
+
import { getInvocationUrl } from "@dxos/functions-runtime";
|
|
13
|
+
import { useClient } from "@dxos/react-client";
|
|
13
14
|
import { useQuery } from "@dxos/react-client/echo";
|
|
14
|
-
import {
|
|
15
|
+
import { Clipboard, Input, useControlledState, useTranslation } from "@dxos/react-ui";
|
|
15
16
|
import { Form } from "@dxos/react-ui-form";
|
|
16
|
-
import { kebabize } from "@dxos/util";
|
|
17
17
|
import { meta } from "#meta";
|
|
18
|
-
var
|
|
18
|
+
var FunctionBinding = ({ object }) => {
|
|
19
19
|
const { t } = useTranslation(meta.profile.key);
|
|
20
|
+
const client = useClient();
|
|
20
21
|
const db = Obj.getDatabase(object);
|
|
21
22
|
const [fn] = useQuery(db, Filter.type(Operation.PersistentOperation, {
|
|
22
23
|
source: Ref.make(object)
|
|
23
24
|
}));
|
|
24
|
-
const
|
|
25
|
-
const [creating, setCreating] = useState(false);
|
|
26
|
-
const [instructions, setInstructions] = useState(`You can run the script "${object.name ?? "script"}".`);
|
|
27
|
-
const blueprintKey = `org.dxos.blueprint.${kebabize(object.name ?? "script")}`;
|
|
28
|
-
const existingBlueprint = blueprints.find((bp) => Obj.getMeta(bp).key === blueprintKey);
|
|
29
|
-
const fnKey = fn ? Obj.getMeta(fn).key : void 0;
|
|
30
|
-
useAsyncEffect(async () => {
|
|
31
|
-
if (!existingBlueprint) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const source = await existingBlueprint.instructions.source.load();
|
|
35
|
-
setInstructions(source.content ?? "");
|
|
36
|
-
}, [
|
|
37
|
-
existingBlueprint
|
|
38
|
-
]);
|
|
39
|
-
const handleSave = useCallback(async () => {
|
|
40
|
-
if (!db) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
setCreating(true);
|
|
44
|
-
try {
|
|
45
|
-
if (existingBlueprint) {
|
|
46
|
-
const text = await existingBlueprint.instructions.source.load();
|
|
47
|
-
Obj.update(text, (text2) => {
|
|
48
|
-
text2.content = instructions;
|
|
49
|
-
});
|
|
50
|
-
if (fnKey) {
|
|
51
|
-
const toolId = ToolId.make(fnKey);
|
|
52
|
-
if (!existingBlueprint.tools?.includes(toolId)) {
|
|
53
|
-
Obj.update(existingBlueprint, (existingBlueprint2) => {
|
|
54
|
-
existingBlueprint2.tools = [
|
|
55
|
-
...existingBlueprint2.tools ?? [],
|
|
56
|
-
toolId
|
|
57
|
-
];
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
} else if (fnKey) {
|
|
62
|
-
db.add(Blueprint.make({
|
|
63
|
-
key: blueprintKey,
|
|
64
|
-
name: object.name ?? "Script",
|
|
65
|
-
instructions: Template.make({
|
|
66
|
-
source: instructions
|
|
67
|
-
}),
|
|
68
|
-
tools: [
|
|
69
|
-
ToolId.make(fnKey)
|
|
70
|
-
]
|
|
71
|
-
}));
|
|
72
|
-
}
|
|
73
|
-
await db.flush();
|
|
74
|
-
} finally {
|
|
75
|
-
setCreating(false);
|
|
76
|
-
}
|
|
77
|
-
}, [
|
|
78
|
-
db,
|
|
79
|
-
existingBlueprint,
|
|
80
|
-
fnKey,
|
|
81
|
-
blueprintKey,
|
|
82
|
-
object.name,
|
|
83
|
-
instructions
|
|
84
|
-
]);
|
|
85
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
86
|
-
className: "flex flex-col"
|
|
87
|
-
}, /* @__PURE__ */ React.createElement(Form.Section, {
|
|
88
|
-
label: t("blueprint-editor.label"),
|
|
89
|
-
description: t("blueprint-editor.description")
|
|
90
|
-
}), /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Label, null, t("blueprint-instructions.label")), /* @__PURE__ */ React.createElement(Input.TextArea, {
|
|
91
|
-
placeholder: t("blueprint-instructions.placeholder"),
|
|
92
|
-
rows: 6,
|
|
93
|
-
value: instructions,
|
|
94
|
-
onChange: (event) => setInstructions(event.target.value),
|
|
95
|
-
classNames: "resize-y"
|
|
96
|
-
})), /* @__PURE__ */ React.createElement("div", {
|
|
97
|
-
className: "pt-2"
|
|
98
|
-
}, /* @__PURE__ */ React.createElement(Button, {
|
|
99
|
-
disabled: !existingBlueprint && !fnKey || creating,
|
|
100
|
-
onClick: handleSave
|
|
101
|
-
}, t(existingBlueprint ? "update-blueprint.label" : "create-blueprint.label"))));
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
// src/containers/ScriptProperties/FunctionBinding.tsx
|
|
105
|
-
import React2, { useCallback as useCallback2 } from "react";
|
|
106
|
-
import { Operation as Operation2 } from "@dxos/compute";
|
|
107
|
-
import { Filter as Filter2, Obj as Obj2, Ref as Ref2 } from "@dxos/echo";
|
|
108
|
-
import { getUserFunctionIdInMetadata } from "@dxos/functions";
|
|
109
|
-
import { getInvocationUrl } from "@dxos/functions-runtime";
|
|
110
|
-
import { useClient } from "@dxos/react-client";
|
|
111
|
-
import { useQuery as useQuery2 } from "@dxos/react-client/echo";
|
|
112
|
-
import { Clipboard, Input as Input2, useControlledState, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
113
|
-
import { Form as Form2 } from "@dxos/react-ui-form";
|
|
114
|
-
import { meta as meta2 } from "#meta";
|
|
115
|
-
var FunctionBinding = ({ object }) => {
|
|
116
|
-
const { t } = useTranslation2(meta2.profile.key);
|
|
117
|
-
const client = useClient();
|
|
118
|
-
const db = Obj2.getDatabase(object);
|
|
119
|
-
const [fn] = useQuery2(db, Filter2.type(Operation2.PersistentOperation, {
|
|
120
|
-
source: Ref2.make(object)
|
|
121
|
-
}));
|
|
122
|
-
const functionId = fn && getUserFunctionIdInMetadata(Obj2.getMeta(fn));
|
|
25
|
+
const functionId = fn && getUserFunctionIdInMetadata(Obj.getMeta(fn));
|
|
123
26
|
const functionUrl = functionId && getInvocationUrl(functionId, client.config.values.runtime?.services?.edge?.url ?? "", {
|
|
124
27
|
spaceId: db?.spaceId
|
|
125
28
|
});
|
|
126
29
|
const [binding, setBinding] = useControlledState(fn?.binding ?? "");
|
|
127
|
-
const handleBindingChange =
|
|
30
|
+
const handleBindingChange = useCallback((event) => setBinding(event.target.value), [
|
|
128
31
|
setBinding
|
|
129
32
|
]);
|
|
130
|
-
const handleBindingBlur =
|
|
33
|
+
const handleBindingBlur = useCallback(() => {
|
|
131
34
|
if (fn) {
|
|
132
|
-
|
|
35
|
+
Obj.update(fn, (fn2) => {
|
|
133
36
|
fn2.binding = binding;
|
|
134
37
|
});
|
|
135
38
|
}
|
|
@@ -140,21 +43,21 @@ var FunctionBinding = ({ object }) => {
|
|
|
140
43
|
if (!fn) {
|
|
141
44
|
return null;
|
|
142
45
|
}
|
|
143
|
-
return /* @__PURE__ */
|
|
46
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
144
47
|
className: "flex flex-col"
|
|
145
|
-
}, /* @__PURE__ */
|
|
146
|
-
|
|
147
|
-
}), functionUrl && /* @__PURE__ */
|
|
48
|
+
}, /* @__PURE__ */ React.createElement(Form.Section, {
|
|
49
|
+
title: t("remote-function-settings.heading")
|
|
50
|
+
}), functionUrl && /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Label, null, t("function-url.label")), /* @__PURE__ */ React.createElement(Input.TextInput, {
|
|
148
51
|
disabled: true,
|
|
149
52
|
value: functionUrl,
|
|
150
53
|
onChange: (event) => {
|
|
151
|
-
|
|
54
|
+
Obj.update(fn, (fn2) => {
|
|
152
55
|
fn2.name = event.target.value;
|
|
153
56
|
});
|
|
154
57
|
}
|
|
155
|
-
}), /* @__PURE__ */
|
|
58
|
+
}), /* @__PURE__ */ React.createElement(Clipboard.IconButton, {
|
|
156
59
|
value: functionUrl
|
|
157
|
-
})), /* @__PURE__ */
|
|
60
|
+
})), /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Label, null, t("function-binding.label")), /* @__PURE__ */ React.createElement(Input.TextInput, {
|
|
158
61
|
placeholder: t("function-binding.placeholder"),
|
|
159
62
|
value: binding,
|
|
160
63
|
onChange: handleBindingChange,
|
|
@@ -164,28 +67,28 @@ var FunctionBinding = ({ object }) => {
|
|
|
164
67
|
|
|
165
68
|
// src/containers/ScriptProperties/FunctionPublishing.tsx
|
|
166
69
|
import { Octokit } from "@octokit/core";
|
|
167
|
-
import
|
|
70
|
+
import React2, { useCallback as useCallback2, useState } from "react";
|
|
168
71
|
import { useOperationInvoker } from "@dxos/app-framework/ui";
|
|
169
72
|
import { SettingsOperation } from "@dxos/app-toolkit";
|
|
170
|
-
import { Filter as
|
|
73
|
+
import { Filter as Filter2, Obj as Obj2 } from "@dxos/echo";
|
|
171
74
|
import { log } from "@dxos/log";
|
|
172
|
-
import { useQuery as
|
|
173
|
-
import { Button
|
|
174
|
-
import { Form as
|
|
75
|
+
import { useQuery as useQuery2 } from "@dxos/react-client/echo";
|
|
76
|
+
import { Button, Clipboard as Clipboard2, Message, useAsyncEffect, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
77
|
+
import { Form as Form2 } from "@dxos/react-ui-form";
|
|
175
78
|
import { AccessToken } from "@dxos/types";
|
|
176
|
-
import { kebabize
|
|
177
|
-
import { meta as
|
|
79
|
+
import { kebabize } from "@dxos/util";
|
|
80
|
+
import { meta as meta2 } from "#meta";
|
|
178
81
|
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-script/src/containers/ScriptProperties/FunctionPublishing.tsx";
|
|
179
82
|
var FunctionPublishing = ({ object }) => {
|
|
180
|
-
const { t } =
|
|
83
|
+
const { t } = useTranslation2(meta2.profile.key);
|
|
181
84
|
const { invokePromise } = useOperationInvoker();
|
|
182
|
-
const db =
|
|
183
|
-
const [githubToken] =
|
|
85
|
+
const db = Obj2.getDatabase(object);
|
|
86
|
+
const [githubToken] = useQuery2(db, Filter2.type(AccessToken.AccessToken, {
|
|
184
87
|
source: "github.com"
|
|
185
88
|
}));
|
|
186
|
-
const gistKey =
|
|
187
|
-
const [gistUrl, setGistUrl] =
|
|
188
|
-
|
|
89
|
+
const gistKey = Obj2.getMeta(object).keys.find(({ source }) => source === "github.com");
|
|
90
|
+
const [gistUrl, setGistUrl] = useState();
|
|
91
|
+
useAsyncEffect(async () => {
|
|
189
92
|
const token = githubToken?.token;
|
|
190
93
|
const gistId = gistKey?.id;
|
|
191
94
|
if (!token || !gistId) {
|
|
@@ -208,26 +111,26 @@ var FunctionPublishing = ({ object }) => {
|
|
|
208
111
|
githubToken,
|
|
209
112
|
gistKey
|
|
210
113
|
]);
|
|
211
|
-
const handleOpenTokenManager =
|
|
114
|
+
const handleOpenTokenManager = useCallback2(() => invokePromise(SettingsOperation.Open, {
|
|
212
115
|
plugin: "org.dxos.plugin.token-manager"
|
|
213
116
|
}), [
|
|
214
117
|
invokePromise
|
|
215
118
|
]);
|
|
216
|
-
const [publishing, setPublishing] =
|
|
217
|
-
const handlePublish =
|
|
119
|
+
const [publishing, setPublishing] = useState(false);
|
|
120
|
+
const handlePublish = useCallback2(async () => {
|
|
218
121
|
setPublishing(true);
|
|
219
122
|
const octokit = new Octokit({
|
|
220
123
|
auth: githubToken.token
|
|
221
124
|
});
|
|
222
125
|
const source = await object.source.load();
|
|
223
|
-
const filename = object.name ?
|
|
126
|
+
const filename = object.name ? kebabize(object.name) : "composer-script";
|
|
224
127
|
const files = {
|
|
225
128
|
[`${filename}.ts`]: {
|
|
226
129
|
content: source.content
|
|
227
130
|
}
|
|
228
131
|
};
|
|
229
132
|
try {
|
|
230
|
-
const meta4 =
|
|
133
|
+
const meta4 = Obj2.getMeta(object);
|
|
231
134
|
const githubKey = meta4.keys.find(({ source: source2 }) => source2 === "github.com");
|
|
232
135
|
const gistId = githubKey?.id;
|
|
233
136
|
if (gistId) {
|
|
@@ -242,8 +145,8 @@ var FunctionPublishing = ({ object }) => {
|
|
|
242
145
|
});
|
|
243
146
|
const gistId2 = response.data.id;
|
|
244
147
|
if (gistId2) {
|
|
245
|
-
|
|
246
|
-
|
|
148
|
+
Obj2.update(object, (object2) => {
|
|
149
|
+
Obj2.getMeta(object2).keys.push({
|
|
247
150
|
source: "github.com",
|
|
248
151
|
id: gistId2
|
|
249
152
|
});
|
|
@@ -257,34 +160,131 @@ var FunctionPublishing = ({ object }) => {
|
|
|
257
160
|
object,
|
|
258
161
|
githubToken
|
|
259
162
|
]);
|
|
260
|
-
return /* @__PURE__ */
|
|
163
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
261
164
|
className: "flex flex-col"
|
|
262
|
-
}, /* @__PURE__ */
|
|
263
|
-
|
|
165
|
+
}, /* @__PURE__ */ React2.createElement(Form2.Section, {
|
|
166
|
+
title: t("script-publish-settings.label"),
|
|
264
167
|
description: t("script-publish-settings.description")
|
|
265
|
-
}), !githubToken && /* @__PURE__ */
|
|
168
|
+
}), !githubToken && /* @__PURE__ */ React2.createElement("div", {
|
|
266
169
|
className: "flex flex-col py-form-gap"
|
|
267
|
-
}, /* @__PURE__ */
|
|
170
|
+
}, /* @__PURE__ */ React2.createElement(Message.Root, {
|
|
268
171
|
valence: "info"
|
|
269
|
-
}, /* @__PURE__ */
|
|
172
|
+
}, /* @__PURE__ */ React2.createElement(Message.Title, null, t("no-github-token.label"))), /* @__PURE__ */ React2.createElement("div", {
|
|
270
173
|
className: "flex pt-form-gap"
|
|
271
|
-
}, /* @__PURE__ */
|
|
174
|
+
}, /* @__PURE__ */ React2.createElement(Button, {
|
|
272
175
|
onClick: handleOpenTokenManager
|
|
273
|
-
}, t("open-token-manager.label")))), githubToken && /* @__PURE__ */
|
|
176
|
+
}, t("open-token-manager.label")))), githubToken && /* @__PURE__ */ React2.createElement("div", {
|
|
274
177
|
className: "flex justify-end gap-2"
|
|
275
|
-
}, gistUrl && /* @__PURE__ */
|
|
178
|
+
}, gistUrl && /* @__PURE__ */ React2.createElement(Clipboard2.IconButton, {
|
|
276
179
|
value: gistUrl
|
|
277
|
-
}), /* @__PURE__ */
|
|
180
|
+
}), /* @__PURE__ */ React2.createElement(Button, {
|
|
278
181
|
disabled: publishing,
|
|
279
182
|
onClick: handlePublish
|
|
280
183
|
}, t("publish.label"))));
|
|
281
184
|
};
|
|
282
185
|
|
|
186
|
+
// src/containers/ScriptProperties/SkillEditor.tsx
|
|
187
|
+
import React3, { useCallback as useCallback3, useState as useState2 } from "react";
|
|
188
|
+
import { ToolId } from "@dxos/ai";
|
|
189
|
+
import { Skill, Template } from "@dxos/compute";
|
|
190
|
+
import { Operation as Operation2 } from "@dxos/compute";
|
|
191
|
+
import { Filter as Filter3, Obj as Obj3, Ref as Ref2 } from "@dxos/echo";
|
|
192
|
+
import { useQuery as useQuery3 } from "@dxos/react-client/echo";
|
|
193
|
+
import { Button as Button2, Input as Input2, useAsyncEffect as useAsyncEffect2, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
194
|
+
import { Form as Form3 } from "@dxos/react-ui-form";
|
|
195
|
+
import { kebabize as kebabize2 } from "@dxos/util";
|
|
196
|
+
import { meta as meta3 } from "#meta";
|
|
197
|
+
var SkillEditor = ({ object }) => {
|
|
198
|
+
const { t } = useTranslation3(meta3.profile.key);
|
|
199
|
+
const db = Obj3.getDatabase(object);
|
|
200
|
+
const [fn] = useQuery3(db, Filter3.type(Operation2.PersistentOperation, {
|
|
201
|
+
source: Ref2.make(object)
|
|
202
|
+
}));
|
|
203
|
+
const skills = useQuery3(db, Filter3.type(Skill.Skill));
|
|
204
|
+
const [creating, setCreating] = useState2(false);
|
|
205
|
+
const [instructions, setInstructions] = useState2(`You can run the script "${object.name ?? "script"}".`);
|
|
206
|
+
const skillKey = `org.dxos.skill.${kebabize2(object.name ?? "script")}`;
|
|
207
|
+
const existingSkill = skills.find((bp) => Obj3.getMeta(bp).key === skillKey);
|
|
208
|
+
const fnKey = fn ? Obj3.getMeta(fn).key : void 0;
|
|
209
|
+
useAsyncEffect2(async () => {
|
|
210
|
+
if (!existingSkill) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
const source = await existingSkill.instructions.source.load();
|
|
214
|
+
setInstructions(source.content ?? "");
|
|
215
|
+
}, [
|
|
216
|
+
existingSkill
|
|
217
|
+
]);
|
|
218
|
+
const handleSave = useCallback3(async () => {
|
|
219
|
+
if (!db) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
setCreating(true);
|
|
223
|
+
try {
|
|
224
|
+
if (existingSkill) {
|
|
225
|
+
const text = await existingSkill.instructions.source.load();
|
|
226
|
+
Obj3.update(text, (text2) => {
|
|
227
|
+
text2.content = instructions;
|
|
228
|
+
});
|
|
229
|
+
if (fnKey) {
|
|
230
|
+
const toolId = ToolId.make(fnKey);
|
|
231
|
+
if (!existingSkill.tools?.includes(toolId)) {
|
|
232
|
+
Obj3.update(existingSkill, (existingSkill2) => {
|
|
233
|
+
existingSkill2.tools = [
|
|
234
|
+
...existingSkill2.tools ?? [],
|
|
235
|
+
toolId
|
|
236
|
+
];
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
} else if (fnKey) {
|
|
241
|
+
db.add(Skill.make({
|
|
242
|
+
key: skillKey,
|
|
243
|
+
name: object.name ?? "Script",
|
|
244
|
+
instructions: Template.make({
|
|
245
|
+
source: instructions
|
|
246
|
+
}),
|
|
247
|
+
tools: [
|
|
248
|
+
ToolId.make(fnKey)
|
|
249
|
+
]
|
|
250
|
+
}));
|
|
251
|
+
}
|
|
252
|
+
await db.flush();
|
|
253
|
+
} finally {
|
|
254
|
+
setCreating(false);
|
|
255
|
+
}
|
|
256
|
+
}, [
|
|
257
|
+
db,
|
|
258
|
+
existingSkill,
|
|
259
|
+
fnKey,
|
|
260
|
+
skillKey,
|
|
261
|
+
object.name,
|
|
262
|
+
instructions
|
|
263
|
+
]);
|
|
264
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
265
|
+
className: "flex flex-col"
|
|
266
|
+
}, /* @__PURE__ */ React3.createElement(Form3.Section, {
|
|
267
|
+
title: t("skill-editor.label"),
|
|
268
|
+
description: t("skill-editor.description")
|
|
269
|
+
}), /* @__PURE__ */ React3.createElement(Input2.Root, null, /* @__PURE__ */ React3.createElement(Input2.Label, null, t("skill-instructions.label")), /* @__PURE__ */ React3.createElement(Input2.TextArea, {
|
|
270
|
+
placeholder: t("skill-instructions.placeholder"),
|
|
271
|
+
rows: 6,
|
|
272
|
+
value: instructions,
|
|
273
|
+
onChange: (event) => setInstructions(event.target.value),
|
|
274
|
+
classNames: "resize-y"
|
|
275
|
+
})), /* @__PURE__ */ React3.createElement("div", {
|
|
276
|
+
className: "pt-2"
|
|
277
|
+
}, /* @__PURE__ */ React3.createElement(Button2, {
|
|
278
|
+
disabled: !existingSkill && !fnKey || creating,
|
|
279
|
+
onClick: handleSave
|
|
280
|
+
}, t(existingSkill ? "update-skill.label" : "create-skill.label"))));
|
|
281
|
+
};
|
|
282
|
+
|
|
283
283
|
// src/containers/ScriptProperties/ScriptProperties.tsx
|
|
284
284
|
var ScriptProperties = ({ subject: object }) => {
|
|
285
285
|
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(Form4.Section, null, /* @__PURE__ */ React4.createElement(FunctionBinding, {
|
|
286
286
|
object
|
|
287
|
-
})), /* @__PURE__ */ React4.createElement(Form4.Section, null, /* @__PURE__ */ React4.createElement(
|
|
287
|
+
})), /* @__PURE__ */ React4.createElement(Form4.Section, null, /* @__PURE__ */ React4.createElement(SkillEditor, {
|
|
288
288
|
object
|
|
289
289
|
})), /* @__PURE__ */ React4.createElement(Form4.Section, null, /* @__PURE__ */ React4.createElement(FunctionPublishing, {
|
|
290
290
|
object
|
|
@@ -293,4 +293,4 @@ var ScriptProperties = ({ subject: object }) => {
|
|
|
293
293
|
export {
|
|
294
294
|
ScriptProperties as default
|
|
295
295
|
};
|
|
296
|
-
//# sourceMappingURL=ScriptProperties-
|
|
296
|
+
//# sourceMappingURL=ScriptProperties-RHDQGMGT.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/containers/ScriptProperties/ScriptProperties.tsx", "../../../src/containers/ScriptProperties/FunctionBinding.tsx", "../../../src/containers/ScriptProperties/FunctionPublishing.tsx", "../../../src/containers/ScriptProperties/SkillEditor.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type AppSurface } from '@dxos/app-toolkit/ui';\nimport { type Script } from '@dxos/compute';\nimport { Form } from '@dxos/react-ui-form';\n\nimport { FunctionBinding } from './FunctionBinding';\nimport { FunctionPublishing } from './FunctionPublishing';\nimport { SkillEditor } from './SkillEditor';\n\nexport type ScriptPropertiesProps = AppSurface.ObjectPropertiesProps<Script.Script>;\n\nexport const ScriptProperties = ({ subject: object }: ScriptPropertiesProps) => {\n return (\n <>\n <Form.Section>\n <FunctionBinding object={object} />\n </Form.Section>\n <Form.Section>\n <SkillEditor object={object} />\n </Form.Section>\n <Form.Section>\n <FunctionPublishing object={object} />\n </Form.Section>\n </>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { type ChangeEvent, useCallback } from 'react';\n\nimport { type Script } from '@dxos/compute';\nimport { Operation } from '@dxos/compute';\nimport { Filter, Obj, Ref } from '@dxos/echo';\nimport { getUserFunctionIdInMetadata } from '@dxos/functions';\nimport { getInvocationUrl } from '@dxos/functions-runtime';\nimport { useClient } from '@dxos/react-client';\nimport { useQuery } from '@dxos/react-client/echo';\nimport { Clipboard, Input, useControlledState, useTranslation } from '@dxos/react-ui';\nimport { Form } from '@dxos/react-ui-form';\n\nimport { meta } from '#meta';\n\nexport type FunctionBindingProps = { object: Script.Script };\n\nexport const FunctionBinding = ({ object }: FunctionBindingProps) => {\n const { t } = useTranslation(meta.profile.key);\n const client = useClient();\n const db = Obj.getDatabase(object);\n\n const [fn] = useQuery(db, Filter.type(Operation.PersistentOperation, { source: Ref.make(object) }));\n const functionId = fn && getUserFunctionIdInMetadata(Obj.getMeta(fn));\n const functionUrl =\n functionId &&\n getInvocationUrl(functionId, client.config.values.runtime?.services?.edge?.url ?? '', {\n spaceId: db?.spaceId,\n });\n\n const [binding, setBinding] = useControlledState(fn?.binding ?? '');\n const handleBindingChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => setBinding(event.target.value),\n [setBinding],\n );\n\n const handleBindingBlur = useCallback(() => {\n if (fn) {\n Obj.update(fn, (fn) => {\n fn.binding = binding;\n });\n }\n }, [fn, binding]);\n\n if (!fn) {\n return null;\n }\n\n return (\n <div className='flex flex-col'>\n <Form.Section title={t('remote-function-settings.heading')} />\n\n {functionUrl && (\n <Input.Root>\n <Input.Label>{t('function-url.label')}</Input.Label>\n <Input.TextInput\n disabled\n value={functionUrl}\n onChange={(event) => {\n Obj.update(fn, (fn) => {\n fn.name = event.target.value;\n });\n }}\n />\n <Clipboard.IconButton value={functionUrl} />\n </Input.Root>\n )}\n\n <Input.Root>\n <Input.Label>{t('function-binding.label')}</Input.Label>\n <Input.TextInput\n placeholder={t('function-binding.placeholder')}\n value={binding}\n onChange={handleBindingChange}\n onBlur={handleBindingBlur}\n />\n </Input.Root>\n </div>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Octokit } from '@octokit/core';\nimport React, { useCallback, useState } from 'react';\n\nimport { useOperationInvoker } from '@dxos/app-framework/ui';\nimport { SettingsOperation } from '@dxos/app-toolkit';\nimport { type Script } from '@dxos/compute';\nimport { Filter, Obj } from '@dxos/echo';\nimport { log } from '@dxos/log';\nimport { useQuery } from '@dxos/react-client/echo';\nimport { Button, Clipboard, Message, useAsyncEffect, useTranslation } from '@dxos/react-ui';\nimport { Form } from '@dxos/react-ui-form';\nimport { AccessToken } from '@dxos/types';\nimport { kebabize } from '@dxos/util';\n\nimport { meta } from '#meta';\n\nexport type FunctionPublishingProps = { object: Script.Script };\n\n// TODO(burdon): Move to separate tab?\nexport const FunctionPublishing = ({ object }: FunctionPublishingProps) => {\n const { t } = useTranslation(meta.profile.key);\n const { invokePromise } = useOperationInvoker();\n const db = Obj.getDatabase(object);\n\n const [githubToken] = useQuery(db, Filter.type(AccessToken.AccessToken, { source: 'github.com' }));\n const gistKey = Obj.getMeta(object).keys.find(({ source }) => source === 'github.com');\n const [gistUrl, setGistUrl] = useState<string | undefined>();\n\n useAsyncEffect(async () => {\n const token = githubToken?.token;\n const gistId = gistKey?.id;\n if (!token || !gistId) {\n setGistUrl(undefined);\n return;\n }\n\n try {\n const octokit = new Octokit({ auth: githubToken.token });\n const response = await octokit.request('GET /gists/{gist_id}', {\n gist_id: gistId,\n });\n setGistUrl(response.data.html_url);\n } catch (err) {\n log.catch(err);\n setGistUrl(undefined);\n }\n }, [githubToken, gistKey]);\n\n const handleOpenTokenManager = useCallback(\n () =>\n invokePromise(SettingsOperation.Open, {\n plugin: 'org.dxos.plugin.token-manager',\n }),\n [invokePromise],\n );\n\n const [publishing, setPublishing] = useState(false);\n const handlePublish = useCallback(async () => {\n setPublishing(true);\n const octokit = new Octokit({ auth: githubToken.token });\n const source = await object.source.load();\n const filename = object.name ? kebabize(object.name) : 'composer-script';\n const files = { [`${filename}.ts`]: { content: source.content } };\n\n try {\n // TODO(wittjosiah): Factor out to intent.\n const meta = Obj.getMeta(object);\n const githubKey = meta.keys.find(({ source }) => source === 'github.com');\n const gistId = githubKey?.id;\n if (gistId) {\n await octokit.request('PATCH /gists/{gist_id}', {\n gist_id: gistId,\n files,\n });\n } else {\n const response = await octokit.request('POST /gists', {\n public: true,\n files,\n });\n const gistId = response.data.id;\n if (gistId) {\n Obj.update(object, (object) => {\n Obj.getMeta(object).keys.push({ source: 'github.com', id: gistId });\n });\n }\n }\n } finally {\n setPublishing(false);\n }\n }, [object, githubToken]);\n\n return (\n <div className='flex flex-col'>\n <Form.Section title={t('script-publish-settings.label')} description={t('script-publish-settings.description')} />\n\n {!githubToken && (\n <div className='flex flex-col py-form-gap'>\n <Message.Root valence='info'>\n <Message.Title>{t('no-github-token.label')}</Message.Title>\n </Message.Root>\n <div className='flex pt-form-gap'>\n <Button onClick={handleOpenTokenManager}>{t('open-token-manager.label')}</Button>\n </div>\n </div>\n )}\n\n {githubToken && (\n <div className='flex justify-end gap-2'>\n {gistUrl && <Clipboard.IconButton value={gistUrl} />}\n <Button disabled={publishing} onClick={handlePublish}>\n {t('publish.label')}\n </Button>\n </div>\n )}\n </div>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback, useState } from 'react';\n\nimport { ToolId } from '@dxos/ai';\nimport { Skill, Template } from '@dxos/compute';\nimport { type Script } from '@dxos/compute';\nimport { Operation } from '@dxos/compute';\nimport { Filter, Obj, Ref } from '@dxos/echo';\nimport { useQuery } from '@dxos/react-client/echo';\nimport { Button, Input, useAsyncEffect, useTranslation } from '@dxos/react-ui';\nimport { Form } from '@dxos/react-ui-form';\nimport { kebabize } from '@dxos/util';\n\nimport { meta } from '#meta';\n\nexport type SkillEditorProps = { object: Script.Script };\n\nexport const SkillEditor = ({ object }: SkillEditorProps) => {\n const { t } = useTranslation(meta.profile.key);\n const db = Obj.getDatabase(object);\n const [fn] = useQuery(db, Filter.type(Operation.PersistentOperation, { source: Ref.make(object) }));\n const skills = useQuery(db, Filter.type(Skill.Skill));\n\n const [creating, setCreating] = useState(false);\n // TODO(burdon): Remove?\n const [instructions, setInstructions] = useState<string>(`You can run the script \"${object.name ?? 'script'}\".`);\n const skillKey = `org.dxos.skill.${kebabize(object.name ?? 'script')}`;\n const existingSkill = skills.find((bp) => Obj.getMeta(bp).key === skillKey);\n const fnKey = fn ? Obj.getMeta(fn).key : undefined;\n\n useAsyncEffect(async () => {\n if (!existingSkill) {\n return;\n }\n\n const source = await existingSkill.instructions.source.load();\n setInstructions(source.content ?? '');\n }, [existingSkill]);\n\n const handleSave = useCallback(async () => {\n if (!db) {\n return;\n }\n\n setCreating(true);\n try {\n if (existingSkill) {\n const text = await existingSkill.instructions.source.load();\n Obj.update(text, (text) => {\n text.content = instructions;\n });\n\n if (fnKey) {\n const toolId = ToolId.make(fnKey);\n if (!existingSkill.tools?.includes(toolId)) {\n Obj.update(existingSkill, (existingSkill) => {\n existingSkill.tools = [...(existingSkill.tools ?? []), toolId];\n });\n }\n }\n } else if (fnKey) {\n db.add(\n Skill.make({\n key: skillKey,\n name: object.name ?? 'Script',\n instructions: Template.make({ source: instructions }),\n tools: [ToolId.make(fnKey)],\n }),\n );\n }\n await db.flush();\n } finally {\n setCreating(false);\n }\n }, [db, existingSkill, fnKey, skillKey, object.name, instructions]);\n\n return (\n <div className='flex flex-col'>\n <Form.Section title={t('skill-editor.label')} description={t('skill-editor.description')} />\n\n <Input.Root>\n <Input.Label>{t('skill-instructions.label')}</Input.Label>\n <Input.TextArea\n placeholder={t('skill-instructions.placeholder')}\n rows={6}\n value={instructions}\n onChange={(event) => setInstructions(event.target.value)}\n classNames='resize-y'\n />\n </Input.Root>\n\n <div className='pt-2'>\n <Button disabled={(!existingSkill && !fnKey) || creating} onClick={handleSave}>\n {t(existingSkill ? 'update-skill.label' : 'create-skill.label')}\n </Button>\n </div>\n </div>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;AAIA,OAAOA,YAAW;AAIlB,SAASC,QAAAA,aAAY;;;ACJrB,OAAOC,SAA2BC,mBAAmB;AAGrD,SAASC,iBAAiB;AAC1B,SAASC,QAAQC,KAAKC,WAAW;AACjC,SAASC,mCAAmC;AAC5C,SAASC,wB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AA,MACE,gBAAAA,OAAA,cAACC,MAAKC,SAAO,MACX,gBAAAF,OAAA,cAACG,iBAAAA;IAAgBJ;OAEnB,gBAAAC,OAAA,cAACC,MAAKC,SAAO,MACX,gBAAAF,OAAA,cAACI,aAAAA;IAAYL;OAEf,gBAAAC,OAAA,cAACC,MAAKC,SAAO,MACX,gBAAAF,OAAA,cAACK,oBAAAA;IAAmBN;;AAI5B;",
|
|
6
|
+
"names": ["React", "Form", "React", "useCallback", "Operation", "Filter", "Obj", "Ref", "getUserFunctionIdInMetadata", "getInvocationUrl", "useClient", "useQuery", "Clipboard", "Input", "useControlledState", "useTranslation", "Form", "meta", "FunctionBinding", "object", "t", "profile", "key", "client", "db", "getDatabase", "fn", "type", "PersistentOperation", "source", "make", "functionId", "getMeta", "functionUrl", "config", "values", "runtime", "services", "edge", "url", "spaceId", "binding", "setBinding", "handleBindingChange", "event", "target", "value", "handleBindingBlur", "update", "div", "className", "Section", "title", "Root", "Label", "TextInput", "disabled", "onChange", "name", "IconButton", "placeholder", "onBlur", "Octokit", "React", "useCallback", "useState", "useOperationInvoker", "SettingsOperation", "Filter", "Obj", "log", "useQuery", "Button", "Clipboard", "Message", "useAsyncEffect", "useTranslation", "Form", "AccessToken", "kebabize", "meta", "invokePromise", "db", "object", "githubToken", "source", "gistKey", "token", "gistId", "setGistUrl", "undefined", "response", "err", "setPublishing", "files", "content", "githubKey", "id", "octokit", "gist_id", "getMeta", "Section", "title", "t", "className", "valence", "Title", "onClick", "handleOpenTokenManager", "gistUrl", "IconButton", "value", "disabled", "handlePublish", "React", "useCallback", "useState", "ToolId", "Skill", "Template", "Operation", "Filter", "Obj", "Ref", "useQuery", "Button", "Input", "useAsyncEffect", "useTranslation", "Form", "kebabize", "meta", "SkillEditor", "object", "t", "profile", "key", "db", "getDatabase", "fn", "type", "PersistentOperation", "source", "make", "skills", "creating", "setCreating", "instructions", "setInstructions", "name", "skillKey", "existingSkill", "find", "bp", "getMeta", "fnKey", "undefined", "load", "content", "handleSave", "text", "update", "toolId", "tools", "includes", "add", "flush", "div", "className", "Section", "title", "description", "Root", "Label", "TextArea", "placeholder", "rows", "value", "onChange", "event", "target", "classNames", "disabled", "onClick", "ScriptProperties", "subject", "object", "React", "Form", "Section", "FunctionBinding", "SkillEditor", "FunctionPublishing"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import "./chunk-J5LGTIGS.mjs";
|
|
2
|
+
|
|
3
|
+
// src/containers/ScriptSettings/ScriptSettings.tsx
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { Button, useTranslation } from "@dxos/react-ui";
|
|
6
|
+
import { Form } from "@dxos/react-ui-form";
|
|
7
|
+
import { meta } from "#meta";
|
|
8
|
+
import { Settings } from "#types";
|
|
9
|
+
var ScriptSettings = ({ settings, onSettingsChange, onAuthenticate }) => {
|
|
10
|
+
const { t } = useTranslation(meta.profile.key);
|
|
11
|
+
return /* @__PURE__ */ React.createElement(Form.Root, {
|
|
12
|
+
schema: Settings.Settings,
|
|
13
|
+
values: settings,
|
|
14
|
+
variant: "settings",
|
|
15
|
+
readonly: !onSettingsChange,
|
|
16
|
+
onValuesChanged: (values) => onSettingsChange?.((current) => ({
|
|
17
|
+
...current,
|
|
18
|
+
...values
|
|
19
|
+
}))
|
|
20
|
+
}, /* @__PURE__ */ React.createElement(Form.Viewport, {
|
|
21
|
+
scroll: true
|
|
22
|
+
}, /* @__PURE__ */ React.createElement(Form.Content, null, /* @__PURE__ */ React.createElement(Form.Section, {
|
|
23
|
+
title: meta.profile.name ?? meta.profile.key
|
|
24
|
+
}, /* @__PURE__ */ React.createElement(Form.Row, {
|
|
25
|
+
label: t("authenticate-action.label"),
|
|
26
|
+
description: t("authenticate-action.description")
|
|
27
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
28
|
+
disabled: !onSettingsChange,
|
|
29
|
+
onClick: onAuthenticate
|
|
30
|
+
}, t("authenticate-button.label"))), /* @__PURE__ */ React.createElement(Form.FieldSet, null)))));
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
ScriptSettings as default
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=ScriptSettings-NS3ZY7ZR.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/containers/ScriptSettings/ScriptSettings.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type AppSurface } from '@dxos/app-toolkit/ui';\nimport { Button, useTranslation } from '@dxos/react-ui';\nimport { Form } from '@dxos/react-ui-form';\n\nimport { meta } from '#meta';\nimport { Settings } from '#types';\n\nexport type ScriptSettingsProps = AppSurface.SettingsProps<\n Settings.Settings,\n {\n onAuthenticate?: () => void;\n }\n>;\n\nexport const ScriptSettings = ({ settings, onSettingsChange, onAuthenticate }: ScriptSettingsProps) => {\n const { t } = useTranslation(meta.profile.key);\n\n return (\n <Form.Root\n schema={Settings.Settings}\n values={settings}\n variant='settings'\n readonly={!onSettingsChange}\n onValuesChanged={(values) => onSettingsChange?.((current) => ({ ...current, ...values }))}\n >\n <Form.Viewport scroll>\n <Form.Content>\n <Form.Section title={meta.profile.name ?? meta.profile.key}>\n {/* TODO(wittjosiah): Hide outside of dev environments. */}\n <Form.Row label={t('authenticate-action.label')} description={t('authenticate-action.description')}>\n <Button disabled={!onSettingsChange} onClick={onAuthenticate}>\n {t('authenticate-button.label')}\n </Button>\n </Form.Row>\n <Form.FieldSet />\n </Form.Section>\n </Form.Content>\n </Form.Viewport>\n </Form.Root>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;AAIA,OAAOA,WAAW;AAGlB,SAASC,QAAQC,sBAAsB;AACvC,SAASC,YAAY;AAErB,SAASC,YAAY;AACrB,SAASC,gBAAgB;AASlB,IAAMC,iBAAiB,CAAC,EAAEC,UAAUC,kBAAkBC,eAAc,MAAuB;AAChG,QAAM,EAAEC,EAAC,IAAKR,eAAeE,KAAKO,QAAQC,GAAG;AAE7C,SACE,sBAAA,cAACT,KAAKU,MAAI;IACRC,QAAQT,SAASA;IACjBU,QAAQR;IACRS,SAAQ;IACRC,UAAU,CAACT;IACXU,iBAAiB,CAACH,WAAWP,mBAAmB,CAACW,aAAa;MAAE,GAAGA;MAAS,GAAGJ;IAAO,EAAA;KAEtF,sBAAA,cAACZ,KAAKiB,UAAQ;IAACC,QAAAA;KACb,sBAAA,cAAClB,KAAKmB,SAAO,MACX,sBAAA,cAACnB,KAAKoB,SAAO;IAACC,OAAOpB,KAAKO,QAAQc,QAAQrB,KAAKO,QAAQC;KAErD,sBAAA,cAACT,KAAKuB,KAAG;IAACC,OAAOjB,EAAE,2BAAA;IAA8BkB,aAAalB,EAAE,iCAAA;KAC9D,sBAAA,cAACT,QAAAA;IAAO4B,UAAU,CAACrB;IAAkBsB,SAASrB;KAC3CC,EAAE,2BAAA,CAAA,CAAA,GAGP,sBAAA,cAACP,KAAK4B,UAAQ,IAAA,CAAA,CAAA,CAAA,CAAA;AAM1B;",
|
|
6
|
+
"names": ["React", "Button", "useTranslation", "Form", "meta", "Settings", "ScriptSettings", "settings", "onSettingsChange", "onAuthenticate", "t", "profile", "key", "Root", "schema", "values", "variant", "readonly", "onValuesChanged", "current", "Viewport", "scroll", "Content", "Section", "title", "name", "Row", "label", "description", "disabled", "onClick", "FieldSet"]
|
|
7
|
+
}
|
|
@@ -3,19 +3,19 @@ import "../chunk-J5LGTIGS.mjs";
|
|
|
3
3
|
// src/capabilities/index.ts
|
|
4
4
|
import { Capability } from "@dxos/app-framework";
|
|
5
5
|
var AppGraphBuilder = Capability.lazy("AppGraphBuilder", () => import("../app-graph-builder-POP3CX6G.mjs"));
|
|
6
|
-
var
|
|
7
|
-
var CreateObject = Capability.lazy("CreateObject", () => import("../create-object-
|
|
6
|
+
var SkillDefinition = Capability.lazy("SkillDefinition", () => import("../skill-definition-JZ7UYBT7.mjs"));
|
|
7
|
+
var CreateObject = Capability.lazy("CreateObject", () => import("../create-object-QW66KQWS.mjs"));
|
|
8
8
|
var Compiler = Capability.lazy("Compiler", () => import("../compiler-ODK4UA2N.mjs"));
|
|
9
|
-
var OperationHandler = Capability.lazy("OperationHandler", () => import("../operation-handler-
|
|
10
|
-
var ReactSurface = Capability.lazy("ReactSurface", () => import("../react-surface-
|
|
9
|
+
var OperationHandler = Capability.lazy("OperationHandler", () => import("../operation-handler-M3B6IRMV.mjs"));
|
|
10
|
+
var ReactSurface = Capability.lazy("ReactSurface", () => import("../react-surface-GEXOZLBC.mjs"));
|
|
11
11
|
var ScriptSettings = Capability.lazy("ScriptSettings", () => import("../settings-FD7HXEY6.mjs"));
|
|
12
12
|
export {
|
|
13
13
|
AppGraphBuilder,
|
|
14
|
-
BlueprintDefinition,
|
|
15
14
|
Compiler,
|
|
16
15
|
CreateObject,
|
|
17
16
|
OperationHandler,
|
|
18
17
|
ReactSurface,
|
|
19
|
-
ScriptSettings
|
|
18
|
+
ScriptSettings,
|
|
19
|
+
SkillDefinition
|
|
20
20
|
};
|
|
21
21
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/capabilities/index.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\nimport type { OperationHandlerSet } from '@dxos/compute';\n\nexport const AppGraphBuilder = Capability.lazy('AppGraphBuilder', () => import('./app-graph-builder'));\nexport const
|
|
5
|
-
"mappings": ";;;AAIA,SAASA,kBAAkB;AAGpB,IAAMC,kBAAkBD,WAAWE,KAAK,mBAAmB,MAAM,OAAO,mCAAA,CAAA;AACxE,IAAMC,
|
|
6
|
-
"names": ["Capability", "AppGraphBuilder", "lazy", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\nimport type { OperationHandlerSet } from '@dxos/compute';\n\nexport const AppGraphBuilder = Capability.lazy('AppGraphBuilder', () => import('./app-graph-builder'));\nexport const SkillDefinition = Capability.lazy('SkillDefinition', () => import('./skill-definition'));\nexport const CreateObject = Capability.lazy('CreateObject', () => import('./create-object'));\nexport const Compiler = Capability.lazy('Compiler', () => import('./compiler'));\nexport const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(\n 'OperationHandler',\n () => import('./operation-handler'),\n);\nexport const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));\nexport const ScriptSettings = Capability.lazy('ScriptSettings', () => import('./settings'));\n"],
|
|
5
|
+
"mappings": ";;;AAIA,SAASA,kBAAkB;AAGpB,IAAMC,kBAAkBD,WAAWE,KAAK,mBAAmB,MAAM,OAAO,mCAAA,CAAA;AACxE,IAAMC,kBAAkBH,WAAWE,KAAK,mBAAmB,MAAM,OAAO,kCAAA,CAAA;AACxE,IAAME,eAAeJ,WAAWE,KAAK,gBAAgB,MAAM,OAAO,+BAAA,CAAA;AAClE,IAAMG,WAAWL,WAAWE,KAAK,YAAY,MAAM,OAAO,0BAAA,CAAA;AAC1D,IAAMI,mBAAmBN,WAAWE,KACzC,oBACA,MAAM,OAAO,mCAAA,CAAA;AAER,IAAMK,eAAeP,WAAWE,KAAK,gBAAgB,MAAM,OAAO,+BAAA,CAAA;AAClE,IAAMM,iBAAiBR,WAAWE,KAAK,kBAAkB,MAAM,OAAO,0BAAA,CAAA;",
|
|
6
|
+
"names": ["Capability", "AppGraphBuilder", "lazy", "SkillDefinition", "CreateObject", "Compiler", "OperationHandler", "ReactSurface", "ScriptSettings"]
|
|
7
7
|
}
|
|
@@ -3,15 +3,15 @@ import "../chunk-J5LGTIGS.mjs";
|
|
|
3
3
|
// src/capabilities/node.ts
|
|
4
4
|
import { Capability } from "@dxos/app-framework";
|
|
5
5
|
var AppGraphBuilder = Capability.lazy("AppGraphBuilder", () => import("../app-graph-builder-POP3CX6G.mjs"));
|
|
6
|
-
var
|
|
7
|
-
var CreateObject = Capability.lazy("CreateObject", () => import("../create-object-
|
|
6
|
+
var SkillDefinition = Capability.lazy("SkillDefinition", () => import("../skill-definition-JZ7UYBT7.mjs"));
|
|
7
|
+
var CreateObject = Capability.lazy("CreateObject", () => import("../create-object-QW66KQWS.mjs"));
|
|
8
8
|
var Compiler = Capability.lazy("Compiler", () => import("../compiler-ODK4UA2N.mjs"));
|
|
9
|
-
var OperationHandler = Capability.lazy("OperationHandler", () => import("../operation-handler-
|
|
9
|
+
var OperationHandler = Capability.lazy("OperationHandler", () => import("../operation-handler-M3B6IRMV.mjs"));
|
|
10
10
|
export {
|
|
11
11
|
AppGraphBuilder,
|
|
12
|
-
BlueprintDefinition,
|
|
13
12
|
Compiler,
|
|
14
13
|
CreateObject,
|
|
15
|
-
OperationHandler
|
|
14
|
+
OperationHandler,
|
|
15
|
+
SkillDefinition
|
|
16
16
|
};
|
|
17
17
|
//# sourceMappingURL=node.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/capabilities/node.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\nimport type { OperationHandlerSet } from '@dxos/compute';\n\nexport const AppGraphBuilder = Capability.lazy('AppGraphBuilder', () => import('./app-graph-builder'));\nexport const
|
|
5
|
-
"mappings": ";;;AAIA,SAASA,kBAAkB;AAGpB,IAAMC,kBAAkBD,WAAWE,KAAK,mBAAmB,MAAM,OAAO,mCAAA,CAAA;AACxE,IAAMC,
|
|
6
|
-
"names": ["Capability", "AppGraphBuilder", "lazy", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\nimport type { OperationHandlerSet } from '@dxos/compute';\n\nexport const AppGraphBuilder = Capability.lazy('AppGraphBuilder', () => import('./app-graph-builder'));\nexport const SkillDefinition = Capability.lazy('SkillDefinition', () => import('./skill-definition'));\nexport const CreateObject = Capability.lazy('CreateObject', () => import('./create-object'));\nexport const Compiler = Capability.lazy('Compiler', () => import('./compiler'));\nexport const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(\n 'OperationHandler',\n () => import('./operation-handler'),\n);\n"],
|
|
5
|
+
"mappings": ";;;AAIA,SAASA,kBAAkB;AAGpB,IAAMC,kBAAkBD,WAAWE,KAAK,mBAAmB,MAAM,OAAO,mCAAA,CAAA;AACxE,IAAMC,kBAAkBH,WAAWE,KAAK,mBAAmB,MAAM,OAAO,kCAAA,CAAA;AACxE,IAAME,eAAeJ,WAAWE,KAAK,gBAAgB,MAAM,OAAO,+BAAA,CAAA;AAClE,IAAMG,WAAWL,WAAWE,KAAK,YAAY,MAAM,OAAO,0BAAA,CAAA;AAC1D,IAAMI,mBAAmBN,WAAWE,KACzC,oBACA,MAAM,OAAO,mCAAA,CAAA;",
|
|
6
|
+
"names": ["Capability", "AppGraphBuilder", "lazy", "SkillDefinition", "CreateObject", "Compiler", "OperationHandler"]
|
|
7
7
|
}
|