@dxos/plugin-script 0.8.4-main.3fbcb4aa9b → 0.8.4-main.43cb759274
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/LICENSE +102 -5
- package/PLUGIN.mdl +515 -0
- package/dist/lib/neutral/{DeploymentDialog-6DBF3V6C.mjs → DeploymentDialog-M3AFYQHC.mjs} +4 -2
- package/dist/lib/neutral/{DeploymentDialog-6DBF3V6C.mjs.map → DeploymentDialog-M3AFYQHC.mjs.map} +3 -3
- package/dist/lib/neutral/{NotebookContainer-FIAQI3A2.mjs → NotebookArticle-NV4AHOOS.mjs} +15 -12
- package/dist/lib/neutral/NotebookArticle-NV4AHOOS.mjs.map +7 -0
- package/dist/lib/neutral/{ScriptContainer-2OPBAXFB.mjs → ScriptArticle-UBT27SB6.mjs} +4 -4
- package/dist/lib/neutral/{ScriptContainer-2OPBAXFB.mjs.map → ScriptArticle-UBT27SB6.mjs.map} +4 -4
- package/dist/lib/neutral/ScriptPlugin.mjs +12 -0
- package/dist/lib/neutral/ScriptPlugin.mjs.map +4 -4
- package/dist/lib/neutral/ScriptPlugin.workerd.mjs +21 -0
- package/dist/lib/neutral/ScriptPlugin.workerd.mjs.map +7 -0
- package/dist/lib/neutral/{ScriptProperties-F6NE6M4H.mjs → ScriptProperties-RLXNAN3N.mjs} +9 -8
- package/dist/lib/neutral/ScriptProperties-RLXNAN3N.mjs.map +7 -0
- package/dist/lib/neutral/{TestContainer-JNFPLAJX.mjs → TestContainer-AFVTBYSJ.mjs} +5 -5
- package/dist/lib/neutral/TestContainer-AFVTBYSJ.mjs.map +7 -0
- package/dist/lib/neutral/blueprints/index.mjs +3 -3
- package/dist/lib/neutral/capabilities/index.mjs +4 -4
- package/dist/lib/neutral/capabilities/node.mjs +3 -3
- package/dist/lib/neutral/{chunk-D7DFASAE.mjs → chunk-2REUEDUA.mjs} +8 -4
- package/dist/lib/neutral/chunk-2REUEDUA.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-BDRB6ZX2.mjs → chunk-BDHDBPVM.mjs} +2 -2
- package/dist/lib/neutral/{chunk-PDB6UOSB.mjs → chunk-C4O7EV6M.mjs} +11 -13
- package/dist/lib/neutral/chunk-C4O7EV6M.mjs.map +7 -0
- package/dist/lib/neutral/chunk-H2BRWQMY.mjs +96 -0
- package/dist/lib/neutral/chunk-H2BRWQMY.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-B4FVQEHV.mjs → chunk-LHEJXJEL.mjs} +2 -2
- package/dist/lib/neutral/{chunk-B4FVQEHV.mjs.map → chunk-LHEJXJEL.mjs.map} +2 -2
- package/dist/lib/neutral/chunk-NQOIENTU.mjs +8 -0
- package/dist/lib/neutral/{chunk-MI6X5CTJ.mjs → chunk-TRKXIP2Q.mjs} +30 -21
- package/dist/lib/neutral/chunk-TRKXIP2Q.mjs.map +7 -0
- package/dist/lib/neutral/chunk-UA3BWOCZ.mjs +38 -0
- package/dist/lib/neutral/chunk-UA3BWOCZ.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-4RJALG6K.mjs → chunk-VXDJH6OL.mjs} +9 -10
- package/dist/lib/neutral/chunk-VXDJH6OL.mjs.map +7 -0
- package/dist/lib/neutral/{compiler-SMVIP5UN.mjs → compiler-ODK4UA2N.mjs} +2 -2
- package/dist/lib/neutral/components/index.mjs +93 -148
- package/dist/lib/neutral/components/index.mjs.map +4 -4
- package/dist/lib/neutral/containers/index.mjs +7 -7
- package/dist/lib/neutral/containers/index.mjs.map +3 -3
- package/dist/lib/neutral/{create-OZRIZ7RN.mjs → create-WQJXMOUE.mjs} +7 -5
- package/dist/lib/neutral/create-WQJXMOUE.mjs.map +7 -0
- package/dist/lib/neutral/{create-object-F2NWICFV.mjs → create-object-FZM5ASWM.mjs} +4 -3
- package/dist/lib/neutral/create-object-FZM5ASWM.mjs.map +7 -0
- package/dist/lib/neutral/{create-script-VBA3SLSU.mjs → create-script-66DO3UJO.mjs} +3 -3
- package/dist/lib/neutral/{delete-PAUWA2QM.mjs → delete-HCQIQFVP.mjs} +2 -2
- package/dist/lib/neutral/{deploy-CXVW54JJ.mjs → deploy-7JVMMHSH.mjs} +6 -5
- package/dist/lib/neutral/{deploy-CXVW54JJ.mjs.map → deploy-7JVMMHSH.mjs.map} +3 -3
- package/dist/lib/neutral/hooks/index.mjs +2 -2
- package/dist/lib/neutral/index.mjs +7 -7
- package/dist/lib/neutral/{inspect-invocations-LEOEP5I2.mjs → inspect-invocations-6MW73SDV.mjs} +3 -3
- package/dist/lib/neutral/{inspect-invocations-LEOEP5I2.mjs.map → inspect-invocations-6MW73SDV.mjs.map} +3 -3
- package/dist/lib/neutral/{install-function-5N24Q45W.mjs → install-function-FJIE2JAI.mjs} +7 -9
- package/dist/lib/neutral/install-function-FJIE2JAI.mjs.map +7 -0
- package/dist/lib/neutral/{invoke-5QVEZ3X5.mjs → invoke-3HVWY2KF.mjs} +7 -8
- package/dist/lib/neutral/invoke-3HVWY2KF.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/lib/neutral/meta.mjs +1 -1
- package/dist/lib/neutral/{operation-handler-OTCWYDFI.mjs → operation-handler-X44IGZXS.mjs} +3 -3
- package/dist/lib/neutral/operations/index.mjs +1 -1
- package/dist/lib/neutral/plugin.mjs +2 -2
- package/dist/lib/neutral/{query-deployed-functions-FVD7NYPA.mjs → query-deployed-functions-F4FHJNWO.mjs} +14 -10
- package/dist/lib/neutral/query-deployed-functions-F4FHJNWO.mjs.map +7 -0
- package/dist/lib/neutral/{react-surface-JH2AOK7V.mjs → react-surface-ACNZ35FV.mjs} +17 -13
- package/dist/lib/neutral/react-surface-ACNZ35FV.mjs.map +7 -0
- package/dist/lib/neutral/{read-FFOSK6A3.mjs → read-RQESBAQI.mjs} +2 -2
- package/dist/lib/neutral/templates/index.mjs +1 -1
- package/dist/lib/neutral/translations.mjs +3 -2
- package/dist/lib/neutral/translations.mjs.map +3 -3
- package/dist/lib/neutral/types/index.mjs +2 -2
- package/dist/lib/neutral/{update-PJS5GG3Y.mjs → update-JZUNJYZM.mjs} +3 -3
- package/dist/lib/neutral/{update-PJS5GG3Y.mjs.map → update-JZUNJYZM.mjs.map} +3 -3
- package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
- package/dist/types/src/ScriptPlugin.workerd.d.ts +4 -0
- package/dist/types/src/ScriptPlugin.workerd.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/create.d.ts.map +1 -1
- package/dist/types/src/blueprints/functions/definitions.d.ts +24 -30
- package/dist/types/src/blueprints/functions/definitions.d.ts.map +1 -1
- package/dist/types/src/blueprints/functions/delete.d.ts +4 -5
- package/dist/types/src/blueprints/functions/deploy.d.ts +4 -5
- package/dist/types/src/blueprints/functions/inspect-invocations.d.ts +4 -5
- package/dist/types/src/blueprints/functions/invoke.d.ts +5 -6
- package/dist/types/src/blueprints/functions/invoke.d.ts.map +1 -1
- package/dist/types/src/blueprints/functions/read.d.ts +4 -5
- package/dist/types/src/blueprints/functions/update.d.ts +4 -5
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -1
- package/dist/types/src/compiler/compiler.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
- package/dist/types/src/components/QueryEditor/QueryEditor.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/TestPanel.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 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/constants.d.ts +2 -1
- package/dist/types/src/constants.d.ts.map +1 -1
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.d.ts +7 -0
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.d.ts.map +1 -0
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.stories.d.ts +7 -0
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/NotebookArticle/index.d.ts +2 -0
- package/dist/types/src/containers/{ScriptContainer → NotebookArticle}/index.d.ts.map +1 -1
- package/dist/types/src/containers/{ScriptContainer/ScriptContainer.d.ts → ScriptArticle/ScriptArticle.d.ts} +2 -2
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.d.ts.map +1 -0
- package/dist/types/src/containers/{ScriptContainer/ScriptContainer.stories.d.ts → ScriptArticle/ScriptArticle.stories.d.ts} +1 -1
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptArticle/index.d.ts +2 -0
- package/dist/types/src/containers/ScriptArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/BlueprintEditor.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.stories.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +2 -2
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/hooks/deploy.d.ts +5 -6
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/index.d.ts.map +1 -1
- package/dist/types/src/templates/chess-bot.d.ts +4 -2
- package/dist/types/src/templates/chess-bot.d.ts.map +1 -1
- package/dist/types/src/templates/commentary.d.ts +6 -4
- package/dist/types/src/templates/commentary.d.ts.map +1 -1
- package/dist/types/src/templates/index.d.ts +0 -5
- package/dist/types/src/templates/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-script.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Notebook.d.ts +28 -47
- package/dist/types/src/types/Notebook.d.ts.map +1 -1
- package/dist/types/src/types/ScriptOperation.d.ts +6 -6
- package/dist/types/src/types/ScriptOperation.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +90 -90
- package/src/ScriptPlugin.tsx +6 -0
- package/src/ScriptPlugin.workerd.ts +18 -0
- package/src/blueprints/functions/create.ts +3 -3
- package/src/blueprints/functions/definitions.ts +20 -11
- package/src/blueprints/functions/deploy.ts +3 -2
- package/src/blueprints/functions/inspect-invocations.ts +1 -1
- package/src/blueprints/functions/install-function.ts +5 -5
- package/src/blueprints/functions/invoke.ts +4 -5
- package/src/blueprints/functions/query-deployed-functions.ts +11 -7
- package/src/blueprints/functions/update.ts +1 -1
- package/src/capabilities/create-object.ts +3 -2
- package/src/capabilities/react-surface.tsx +6 -6
- package/src/compiler/compiler.ts +4 -0
- package/src/components/NotebookStack/NotebookCell.tsx +2 -2
- package/src/components/NotebookStack/NotebookStack.stories.tsx +2 -2
- package/src/components/NotebookStack/NotebookStack.tsx +1 -1
- package/src/components/QueryEditor/QueryEditor.tsx +3 -1
- package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +3 -3
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +1 -1
- package/src/components/TestPanel/TestPanel.tsx +2 -1
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +1 -1
- package/src/components/index.ts +0 -1
- package/src/constants.ts +3 -1
- package/src/containers/DeploymentDialog/DeploymentDialog.stories.tsx +3 -3
- package/src/containers/DeploymentDialog/DeploymentDialog.tsx +1 -1
- package/src/containers/{NotebookContainer/NotebookContainer.stories.tsx → NotebookArticle/NotebookArticle.stories.tsx} +10 -10
- package/src/containers/{NotebookContainer/NotebookContainer.tsx → NotebookArticle/NotebookArticle.tsx} +10 -9
- package/src/containers/NotebookArticle/index.ts +5 -0
- package/src/containers/{ScriptContainer/ScriptContainer.stories.tsx → ScriptArticle/ScriptArticle.stories.tsx} +6 -5
- package/src/containers/{ScriptContainer/ScriptContainer.tsx → ScriptArticle/ScriptArticle.tsx} +1 -1
- package/src/containers/ScriptArticle/index.ts +5 -0
- package/src/containers/ScriptProperties/BlueprintEditor.tsx +8 -7
- package/src/containers/ScriptProperties/ScriptProperties.stories.tsx +3 -2
- package/src/containers/TestContainer/TestContainer.tsx +4 -4
- package/src/containers/index.ts +2 -2
- package/src/meta.ts +13 -7
- package/src/operations/index.ts +1 -4
- package/src/templates/anthropic.ts +2 -1
- package/src/templates/chess-bot.ts +2 -2
- package/src/templates/commentary.ts +19 -17
- package/src/templates/data-generator.ts +1 -1
- package/src/templates/discord.ts +5 -5
- package/src/templates/forex-effect.ts +2 -1
- package/src/templates/forex.ts +2 -1
- package/src/templates/gmail.ts +5 -5
- package/src/templates/index.ts +0 -7
- package/src/templates/ping.ts +2 -1
- package/src/testing/test-notebook.ts +2 -2
- package/src/testing/test-script.ts +1 -2
- package/src/translations.ts +3 -2
- package/src/types/Notebook.ts +5 -11
- package/src/types/ScriptOperation.ts +4 -4
- package/src/util/deploy.ts +1 -1
- package/src/util/functions.ts +4 -4
- package/src/vite-env.d.ts +5 -0
- package/dist/lib/neutral/NotebookContainer-FIAQI3A2.mjs.map +0 -7
- package/dist/lib/neutral/ScriptProperties-F6NE6M4H.mjs.map +0 -7
- package/dist/lib/neutral/TestContainer-JNFPLAJX.mjs.map +0 -7
- package/dist/lib/neutral/access-token-created-ENMCEGVU.mjs +0 -34
- package/dist/lib/neutral/access-token-created-ENMCEGVU.mjs.map +0 -7
- package/dist/lib/neutral/chunk-2DMPFVUM.mjs +0 -8
- package/dist/lib/neutral/chunk-4RJALG6K.mjs.map +0 -7
- package/dist/lib/neutral/chunk-BUKQITZT.mjs +0 -105
- package/dist/lib/neutral/chunk-BUKQITZT.mjs.map +0 -7
- package/dist/lib/neutral/chunk-D7DFASAE.mjs.map +0 -7
- package/dist/lib/neutral/chunk-MI6X5CTJ.mjs.map +0 -7
- package/dist/lib/neutral/chunk-P2F3STZN.mjs +0 -8
- package/dist/lib/neutral/chunk-P2F3STZN.mjs.map +0 -7
- package/dist/lib/neutral/chunk-PDB6UOSB.mjs.map +0 -7
- package/dist/lib/neutral/chunk-UYR3YH4Q.mjs +0 -31
- package/dist/lib/neutral/chunk-UYR3YH4Q.mjs.map +0 -7
- package/dist/lib/neutral/create-OZRIZ7RN.mjs.map +0 -7
- package/dist/lib/neutral/create-object-F2NWICFV.mjs.map +0 -7
- package/dist/lib/neutral/install-function-5N24Q45W.mjs.map +0 -7
- package/dist/lib/neutral/invoke-5QVEZ3X5.mjs.map +0 -7
- package/dist/lib/neutral/query-deployed-functions-FVD7NYPA.mjs.map +0 -7
- package/dist/lib/neutral/react-surface-JH2AOK7V.mjs.map +0 -7
- package/dist/types/src/capabilities/artifact-definition.d.ts +0 -12
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/components/FramePanel/FramePanel.d.ts +0 -12
- package/dist/types/src/components/FramePanel/FramePanel.d.ts.map +0 -1
- package/dist/types/src/components/FramePanel/index.d.ts +0 -2
- package/dist/types/src/components/FramePanel/index.d.ts.map +0 -1
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.d.ts +0 -7
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.d.ts.map +0 -1
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.stories.d.ts +0 -7
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.stories.d.ts.map +0 -1
- package/dist/types/src/containers/NotebookContainer/index.d.ts +0 -2
- package/dist/types/src/containers/NotebookContainer/index.d.ts.map +0 -1
- package/dist/types/src/containers/ScriptContainer/ScriptContainer.d.ts.map +0 -1
- package/dist/types/src/containers/ScriptContainer/ScriptContainer.stories.d.ts.map +0 -1
- package/dist/types/src/containers/ScriptContainer/index.d.ts +0 -2
- package/dist/types/src/operations/access-token-created.d.ts +0 -5
- package/dist/types/src/operations/access-token-created.d.ts.map +0 -1
- package/dist/types/src/templates/chat.d.ts +0 -6
- package/dist/types/src/templates/chat.d.ts.map +0 -1
- package/src/capabilities/artifact-definition.ts +0 -226
- package/src/components/FramePanel/FramePanel.tsx +0 -85
- package/src/components/FramePanel/index.ts +0 -5
- package/src/containers/NotebookContainer/index.ts +0 -5
- package/src/containers/ScriptContainer/index.ts +0 -5
- package/src/operations/access-token-created.ts +0 -37
- package/src/templates/chat.ts +0 -96
- /package/dist/lib/neutral/{chunk-BDRB6ZX2.mjs.map → chunk-BDHDBPVM.mjs.map} +0 -0
- /package/dist/lib/neutral/{chunk-2DMPFVUM.mjs.map → chunk-NQOIENTU.mjs.map} +0 -0
- /package/dist/lib/neutral/{compiler-SMVIP5UN.mjs.map → compiler-ODK4UA2N.mjs.map} +0 -0
- /package/dist/lib/neutral/{create-script-VBA3SLSU.mjs.map → create-script-66DO3UJO.mjs.map} +0 -0
- /package/dist/lib/neutral/{delete-PAUWA2QM.mjs.map → delete-HCQIQFVP.mjs.map} +0 -0
- /package/dist/lib/neutral/{operation-handler-OTCWYDFI.mjs.map → operation-handler-X44IGZXS.mjs.map} +0 -0
- /package/dist/lib/neutral/{read-FFOSK6A3.mjs.map → read-RQESBAQI.mjs.map} +0 -0
|
@@ -16,7 +16,7 @@ import { getSpace } from '@dxos/react-client/echo';
|
|
|
16
16
|
import { Panel } from '@dxos/react-ui';
|
|
17
17
|
|
|
18
18
|
import { ScriptPluginSettings } from '#components';
|
|
19
|
-
import { DeploymentDialog,
|
|
19
|
+
import { DeploymentDialog, NotebookArticle, ScriptArticle, ScriptProperties, TestContainer } from '#containers';
|
|
20
20
|
import { useCompiler } from '#hooks';
|
|
21
21
|
import { meta } from '#meta';
|
|
22
22
|
import { Notebook, ScriptCapabilities, type Settings } from '#types';
|
|
@@ -28,7 +28,7 @@ export default Capability.makeModule(() =>
|
|
|
28
28
|
Effect.succeed(
|
|
29
29
|
Capability.contributes(Capabilities.ReactSurface, [
|
|
30
30
|
Surface.create({
|
|
31
|
-
id: '
|
|
31
|
+
id: 'pluginSettings',
|
|
32
32
|
filter: AppSurface.settings(AppSurface.Article, meta.id),
|
|
33
33
|
component: ({ data: { subject } }) => {
|
|
34
34
|
const { settings, updateSettings } = useSettingsState<Settings.Settings>(subject.atom);
|
|
@@ -58,7 +58,7 @@ export default Capability.makeModule(() =>
|
|
|
58
58
|
const compiler = useCompiler();
|
|
59
59
|
const settings = useAtomCapability(ScriptCapabilities.Settings);
|
|
60
60
|
return (
|
|
61
|
-
<
|
|
61
|
+
<ScriptArticle
|
|
62
62
|
role={role}
|
|
63
63
|
subject={data.subject}
|
|
64
64
|
attendableId={data.attendableId}
|
|
@@ -74,7 +74,7 @@ export default Capability.makeModule(() =>
|
|
|
74
74
|
component: ({ data, role }) => {
|
|
75
75
|
const compiler = useCompiler();
|
|
76
76
|
return (
|
|
77
|
-
<
|
|
77
|
+
<NotebookArticle
|
|
78
78
|
role={role}
|
|
79
79
|
subject={data.subject}
|
|
80
80
|
attendableId={data.attendableId}
|
|
@@ -105,13 +105,13 @@ export default Capability.makeModule(() =>
|
|
|
105
105
|
component: ({ data, role }) => {
|
|
106
106
|
const space = getSpace(data.companionTo);
|
|
107
107
|
const feed = space?.properties.invocationTraceFeed?.target;
|
|
108
|
-
const
|
|
108
|
+
const feedDXN = feed ? Feed.getQueueUri(feed) : undefined;
|
|
109
109
|
return (
|
|
110
110
|
<Panel.Root role={role}>
|
|
111
111
|
<Panel.Content>
|
|
112
112
|
<InvocationTraceContainer
|
|
113
113
|
db={space?.db}
|
|
114
|
-
|
|
114
|
+
feedDXN={feedDXN}
|
|
115
115
|
target={data.companionTo}
|
|
116
116
|
detailAxis='block'
|
|
117
117
|
/>
|
package/src/compiler/compiler.ts
CHANGED
|
@@ -24,6 +24,10 @@ const CDN_TS_VERSION = '5.6.3';
|
|
|
24
24
|
const defaultOptions: ts.CompilerOptions = {
|
|
25
25
|
lib: ['DOM', 'es2022'],
|
|
26
26
|
target: ts.ScriptTarget.ES2022,
|
|
27
|
+
// Override `@typescript/vfs`'s default of `NodeJs` (== deprecated `node10`).
|
|
28
|
+
// TypeScript 6 throws on that as a `getCompilerOptionsDiagnostics()` error,
|
|
29
|
+
// which surfaces as an unhandled rejection inside the storybook task.
|
|
30
|
+
moduleResolution: ts.ModuleResolutionKind.Bundler,
|
|
27
31
|
};
|
|
28
32
|
|
|
29
33
|
export class Compiler {
|
|
@@ -143,7 +143,7 @@ export const NotebookCell = ({ db, graph, dragging, cell, promptResults, env }:
|
|
|
143
143
|
<>
|
|
144
144
|
<TemplateEditor
|
|
145
145
|
id={cell.id}
|
|
146
|
-
|
|
146
|
+
source={cell.prompt.target.instructions}
|
|
147
147
|
lineNumbers={false}
|
|
148
148
|
classNames={editorStyles}
|
|
149
149
|
/>
|
|
@@ -186,7 +186,7 @@ const NotebookPromptResult = ({ cell, promptResults }: NotebookCellProps) => {
|
|
|
186
186
|
return null;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
const value = promptResults?.[cell.prompt.
|
|
189
|
+
const value = promptResults?.[cell.prompt.uri];
|
|
190
190
|
if (value == null) {
|
|
191
191
|
return null;
|
|
192
192
|
}
|
|
@@ -7,8 +7,8 @@ import * as Effect from 'effect/Effect';
|
|
|
7
7
|
import React, { useMemo } from 'react';
|
|
8
8
|
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
-
import { AutomationPlugin } from '@dxos/plugin-automation/
|
|
11
|
-
import { ClientPlugin } from '@dxos/plugin-client/
|
|
10
|
+
import { AutomationPlugin } from '@dxos/plugin-automation/testing';
|
|
11
|
+
import { ClientPlugin } from '@dxos/plugin-client/testing';
|
|
12
12
|
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
13
13
|
import { corePlugins } from '@dxos/plugin-testing';
|
|
14
14
|
import { withLayout } from '@dxos/react-ui/testing';
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { DropdownMenu, IconButton, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
8
|
+
import { composable, composableProps } from '@dxos/react-ui';
|
|
8
9
|
import { Stack, StackItem, type StackProps } from '@dxos/react-ui-stack';
|
|
9
|
-
import { composable, composableProps } from '@dxos/ui-theme';
|
|
10
10
|
|
|
11
11
|
import { meta } from '#meta';
|
|
12
12
|
import { type Notebook } from '#types';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import React, { useState } from 'react';
|
|
6
|
-
import { ScriptTarget } from 'typescript';
|
|
6
|
+
import { ModuleResolutionKind, ScriptTarget } from 'typescript';
|
|
7
7
|
|
|
8
8
|
import queryApi from '@dxos/echo-query/api.d.ts?raw';
|
|
9
9
|
import { useAsyncEffect } from '@dxos/react-ui';
|
|
@@ -34,6 +34,8 @@ export const QueryEditor = (props: QueryEditorProps) => {
|
|
|
34
34
|
const compiler = new Compiler({
|
|
35
35
|
lib: ['ES5'],
|
|
36
36
|
target: ScriptTarget.ES2022,
|
|
37
|
+
// Avoid `@typescript/vfs`'s deprecated `node10` default (rejected by TS 6).
|
|
38
|
+
moduleResolution: ModuleResolutionKind.Bundler,
|
|
37
39
|
});
|
|
38
40
|
await compiler.initialize(GLOBALS);
|
|
39
41
|
setCompiler(compiler);
|
|
@@ -6,10 +6,10 @@ import { Atom, Registry } from '@effect-atom/atom-react';
|
|
|
6
6
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
7
|
import React, { useMemo } from 'react';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { ProcessManagerPlugin } from '@dxos/app-framework';
|
|
10
10
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
11
11
|
import { Script } from '@dxos/compute';
|
|
12
|
-
import { ClientPlugin } from '@dxos/plugin-client/
|
|
12
|
+
import { ClientPlugin } from '@dxos/plugin-client/testing';
|
|
13
13
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
14
14
|
|
|
15
15
|
import { type ScriptToolbarState, type ScriptToolbarStateStore } from '#hooks';
|
|
@@ -53,7 +53,7 @@ const meta = {
|
|
|
53
53
|
withTheme(),
|
|
54
54
|
withLayout({ classNames: 'w-document-max-width' }),
|
|
55
55
|
withPluginManager({
|
|
56
|
-
plugins: [
|
|
56
|
+
plugins: [ProcessManagerPlugin(), ClientPlugin({})],
|
|
57
57
|
}),
|
|
58
58
|
],
|
|
59
59
|
parameters: {
|
|
@@ -7,8 +7,8 @@ import React, { useMemo } from 'react';
|
|
|
7
7
|
|
|
8
8
|
import { type Script } from '@dxos/compute';
|
|
9
9
|
import { ElevationProvider, useTranslation } from '@dxos/react-ui';
|
|
10
|
+
import { composable, composableProps } from '@dxos/react-ui';
|
|
10
11
|
import { type ActionGraphProps, Menu, MenuRootProps, createGapSeparator, useMenuActions } from '@dxos/react-ui-menu';
|
|
11
|
-
import { composable, composableProps } from '@dxos/ui-theme';
|
|
12
12
|
|
|
13
13
|
import {
|
|
14
14
|
type CreateDeployOptions,
|
|
@@ -6,8 +6,9 @@ import React, { forwardRef, useRef, useState } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { log } from '@dxos/log';
|
|
8
8
|
import { Avatar, Icon, Input, ScrollArea, type ThemedClassName, Toolbar, useTranslation } from '@dxos/react-ui';
|
|
9
|
+
import { composable, composableProps } from '@dxos/react-ui';
|
|
9
10
|
import { JsonHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
10
|
-
import {
|
|
11
|
+
import { mx } from '@dxos/ui-theme';
|
|
11
12
|
|
|
12
13
|
import { meta } from '#meta';
|
|
13
14
|
|
|
@@ -16,6 +16,7 @@ import { type HoverInfo, tsAutocomplete, tsFacet, tsHover, tsLinter, tsSync } fr
|
|
|
16
16
|
import React from 'react';
|
|
17
17
|
|
|
18
18
|
import { type ThemeMode, type ThemedClassName, useThemeContext } from '@dxos/react-ui';
|
|
19
|
+
import { composable, composableProps } from '@dxos/react-ui';
|
|
19
20
|
import { type UseTextEditorProps, useTextEditor } from '@dxos/react-ui-editor';
|
|
20
21
|
import { Domino } from '@dxos/ui';
|
|
21
22
|
import {
|
|
@@ -26,7 +27,6 @@ import {
|
|
|
26
27
|
defaultStyles,
|
|
27
28
|
} from '@dxos/ui-editor';
|
|
28
29
|
import { type EditorInputMode } from '@dxos/ui-editor/types';
|
|
29
|
-
import { composable, composableProps } from '@dxos/ui-theme';
|
|
30
30
|
import { isNonNullable } from '@dxos/util';
|
|
31
31
|
|
|
32
32
|
export type TypescriptEditorProps = ThemedClassName<
|
package/src/components/index.ts
CHANGED
package/src/constants.ts
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React, { useMemo } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { ProcessManagerPlugin } from '@dxos/app-framework';
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
10
|
import { Obj } from '@dxos/echo';
|
|
11
|
-
import { ClientPlugin } from '@dxos/plugin-client/
|
|
11
|
+
import { ClientPlugin } from '@dxos/plugin-client/testing';
|
|
12
12
|
import { Dialog } from '@dxos/react-ui';
|
|
13
13
|
import { withTheme } from '@dxos/react-ui/testing';
|
|
14
14
|
import { AccessToken } from '@dxos/types';
|
|
@@ -51,7 +51,7 @@ const meta = {
|
|
|
51
51
|
decorators: [
|
|
52
52
|
withTheme(),
|
|
53
53
|
withPluginManager({
|
|
54
|
-
plugins: [
|
|
54
|
+
plugins: [ProcessManagerPlugin(), ClientPlugin({})],
|
|
55
55
|
}),
|
|
56
56
|
],
|
|
57
57
|
} satisfies Meta<typeof DeploymentDialogStory>;
|
|
@@ -65,7 +65,7 @@ export const DeploymentDialog = ({ accessToken, scriptTemplates }: DeploymentDia
|
|
|
65
65
|
<Dialog.Header>
|
|
66
66
|
<Dialog.Title>{t('deployment-dialog.title')}</Dialog.Title>
|
|
67
67
|
<Dialog.Close asChild>
|
|
68
|
-
<Dialog.
|
|
68
|
+
<Dialog.ActionIconButton action='close' />
|
|
69
69
|
</Dialog.Close>
|
|
70
70
|
</Dialog.Header>
|
|
71
71
|
<Dialog.Body>
|
|
@@ -11,13 +11,13 @@ import { withPluginManager } from '@dxos/app-framework/testing';
|
|
|
11
11
|
import { AgentPrompt } from '@dxos/assistant-toolkit';
|
|
12
12
|
import { Operation } from '@dxos/compute';
|
|
13
13
|
import { Filter } from '@dxos/echo';
|
|
14
|
-
import { AssistantPlugin } from '@dxos/plugin-assistant/
|
|
15
|
-
import { AutomationPlugin } from '@dxos/plugin-automation/
|
|
16
|
-
import { ClientPlugin } from '@dxos/plugin-client/
|
|
14
|
+
import { AssistantPlugin } from '@dxos/plugin-assistant/testing';
|
|
15
|
+
import { AutomationPlugin } from '@dxos/plugin-automation/testing';
|
|
16
|
+
import { ClientPlugin } from '@dxos/plugin-client/testing';
|
|
17
17
|
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
18
|
-
import { ExplorerPlugin } from '@dxos/plugin-explorer/
|
|
18
|
+
import { ExplorerPlugin } from '@dxos/plugin-explorer/testing';
|
|
19
19
|
import { Markdown } from '@dxos/plugin-markdown';
|
|
20
|
-
import { MarkdownPlugin } from '@dxos/plugin-markdown/
|
|
20
|
+
import { MarkdownPlugin } from '@dxos/plugin-markdown/testing';
|
|
21
21
|
import { corePlugins } from '@dxos/plugin-testing';
|
|
22
22
|
import { Config, useClient } from '@dxos/react-client';
|
|
23
23
|
import { useQuery } from '@dxos/react-client/echo';
|
|
@@ -28,16 +28,16 @@ import { createNotebook } from '#testing';
|
|
|
28
28
|
import { translations } from '#translations';
|
|
29
29
|
import { Notebook } from '#types';
|
|
30
30
|
|
|
31
|
-
import {
|
|
31
|
+
import { NotebookArticle } from './NotebookArticle';
|
|
32
32
|
|
|
33
|
-
const meta: Meta<typeof
|
|
34
|
-
title: 'plugins/plugin-script/containers/
|
|
35
|
-
component:
|
|
33
|
+
const meta: Meta<typeof NotebookArticle> = {
|
|
34
|
+
title: 'plugins/plugin-script/containers/NotebookArticle',
|
|
35
|
+
component: NotebookArticle,
|
|
36
36
|
render: (args) => {
|
|
37
37
|
const client = useClient();
|
|
38
38
|
const space = client.spaces.get()[0];
|
|
39
39
|
const notebooks = useQuery(space?.db, Filter.type(Notebook.Notebook));
|
|
40
|
-
return <
|
|
40
|
+
return <NotebookArticle {...args} subject={notebooks[0]} attendableId='test' />;
|
|
41
41
|
},
|
|
42
42
|
decorators: [
|
|
43
43
|
withLayout({ layout: 'column', classNames: 'w-document-max-width' }),
|
|
@@ -9,6 +9,7 @@ import * as Exit from 'effect/Exit';
|
|
|
9
9
|
import type * as Types from 'effect/Types';
|
|
10
10
|
import React, { useCallback, useContext, useMemo, useState } from 'react';
|
|
11
11
|
|
|
12
|
+
import { useSpaceCallback } from '@dxos/app-framework/ui';
|
|
12
13
|
import { type AppSurface } from '@dxos/app-toolkit/ui';
|
|
13
14
|
import { AgentPrompt } from '@dxos/assistant-toolkit';
|
|
14
15
|
import { Blueprint, Routine } from '@dxos/compute';
|
|
@@ -17,7 +18,6 @@ import { Filter, Obj, Query, Ref } from '@dxos/echo';
|
|
|
17
18
|
import { QueryBuilder } from '@dxos/echo-query';
|
|
18
19
|
import { invariant } from '@dxos/invariant';
|
|
19
20
|
import { log } from '@dxos/log';
|
|
20
|
-
import { useComputeRuntimeCallback } from '@dxos/plugin-automation/hooks';
|
|
21
21
|
import { Graph } from '@dxos/plugin-explorer';
|
|
22
22
|
import { DropdownMenu, IconButton, Panel, Toolbar, useTranslation } from '@dxos/react-ui';
|
|
23
23
|
import { useAttention } from '@dxos/react-ui-attention';
|
|
@@ -38,12 +38,9 @@ const INCLUDE_BLUEPRINTS = [
|
|
|
38
38
|
|
|
39
39
|
// TODO(burdon): Support calling named deployed functions (as with sheet).
|
|
40
40
|
|
|
41
|
-
export type
|
|
42
|
-
Notebook.Notebook,
|
|
43
|
-
Pick<TypescriptEditorProps, 'env'>
|
|
44
|
-
>;
|
|
41
|
+
export type NotebookArticleProps = AppSurface.ObjectArticleProps<Notebook.Notebook, Pick<TypescriptEditorProps, 'env'>>;
|
|
45
42
|
|
|
46
|
-
export const
|
|
43
|
+
export const NotebookArticle = ({ role, subject: notebook, attendableId, env }: NotebookArticleProps) => {
|
|
47
44
|
const { t } = useTranslation(meta.id);
|
|
48
45
|
const registry = useContext(RegistryContext);
|
|
49
46
|
const db = Obj.getDatabase(notebook);
|
|
@@ -96,8 +93,9 @@ export const NotebookContainer = ({ role, subject: notebook, attendableId, env }
|
|
|
96
93
|
}, [db, notebook, graph]);
|
|
97
94
|
|
|
98
95
|
const [promptResults, setPromptResults] = useState<Record<string, string>>({});
|
|
99
|
-
const handleExecPrompts =
|
|
96
|
+
const handleExecPrompts = useSpaceCallback(
|
|
100
97
|
db?.spaceId,
|
|
98
|
+
[] as const,
|
|
101
99
|
Effect.fnUntraced(function* () {
|
|
102
100
|
invariant(graph);
|
|
103
101
|
|
|
@@ -114,7 +112,7 @@ export const NotebookContainer = ({ role, subject: notebook, attendableId, env }
|
|
|
114
112
|
onResult: (result) =>
|
|
115
113
|
setPromptResults((prev) => ({
|
|
116
114
|
...prev,
|
|
117
|
-
[prompt.
|
|
115
|
+
[prompt.uri]: result,
|
|
118
116
|
})),
|
|
119
117
|
});
|
|
120
118
|
}
|
|
@@ -163,7 +161,10 @@ export const NotebookContainer = ({ role, subject: notebook, attendableId, env }
|
|
|
163
161
|
if (db) {
|
|
164
162
|
const objects = await db.query(Query.select(Filter.type(Blueprint.Blueprint))).run();
|
|
165
163
|
const blueprints = objects
|
|
166
|
-
.filter((blueprint) =>
|
|
164
|
+
.filter((blueprint) => {
|
|
165
|
+
const key = Obj.getMeta(blueprint).key;
|
|
166
|
+
return key !== undefined && INCLUDE_BLUEPRINTS.includes(key);
|
|
167
|
+
})
|
|
167
168
|
.map((blueprint) => Ref.make(blueprint));
|
|
168
169
|
cell.prompt = Ref.make(Routine.make({ instructions: '', blueprints }));
|
|
169
170
|
}
|
|
@@ -11,18 +11,19 @@ import { withPluginManager } from '@dxos/app-framework/testing';
|
|
|
11
11
|
import { Blueprint } from '@dxos/compute';
|
|
12
12
|
import { Script } from '@dxos/compute';
|
|
13
13
|
import { Operation } from '@dxos/compute';
|
|
14
|
-
import {
|
|
14
|
+
import { Filter } from '@dxos/echo';
|
|
15
|
+
import { ClientPlugin } from '@dxos/plugin-client/testing';
|
|
15
16
|
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
16
17
|
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
17
18
|
import { Config } from '@dxos/react-client';
|
|
18
|
-
import {
|
|
19
|
+
import { useQuery, useSpaces } from '@dxos/react-client/echo';
|
|
19
20
|
import { Loading, withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
20
21
|
import { Text } from '@dxos/schema';
|
|
21
22
|
|
|
22
23
|
import { createScript } from '#testing';
|
|
23
24
|
import { translations } from '#translations';
|
|
24
25
|
|
|
25
|
-
import {
|
|
26
|
+
import { ScriptArticle } from './ScriptArticle';
|
|
26
27
|
|
|
27
28
|
type DefaultStoryProps = {};
|
|
28
29
|
|
|
@@ -59,13 +60,13 @@ const DefaultStory = (_: DefaultStoryProps) => {
|
|
|
59
60
|
|
|
60
61
|
return (
|
|
61
62
|
<div className='flex flex-col min-h-[80vh] w-document-max-width'>
|
|
62
|
-
<
|
|
63
|
+
<ScriptArticle role='article' subject={script} attendableId='story-script' />
|
|
63
64
|
</div>
|
|
64
65
|
);
|
|
65
66
|
};
|
|
66
67
|
|
|
67
68
|
const meta = {
|
|
68
|
-
title: 'plugins/plugin-script/containers/
|
|
69
|
+
title: 'plugins/plugin-script/containers/ScriptArticle',
|
|
69
70
|
render: DefaultStory,
|
|
70
71
|
decorators: [
|
|
71
72
|
withTheme(),
|
|
@@ -28,7 +28,8 @@ export const BlueprintEditor = ({ object }: BlueprintEditorProps) => {
|
|
|
28
28
|
// TODO(burdon): Remove?
|
|
29
29
|
const [instructions, setInstructions] = useState<string>(`You can run the script "${object.name ?? 'script'}".`);
|
|
30
30
|
const blueprintKey = `org.dxos.blueprint.${kebabize(object.name ?? 'script')}`;
|
|
31
|
-
const existingBlueprint = blueprints.find((bp) => bp.key === blueprintKey);
|
|
31
|
+
const existingBlueprint = blueprints.find((bp) => Obj.getMeta(bp).key === blueprintKey);
|
|
32
|
+
const fnKey = fn ? Obj.getMeta(fn).key : undefined;
|
|
32
33
|
|
|
33
34
|
useAsyncEffect(async () => {
|
|
34
35
|
if (!existingBlueprint) {
|
|
@@ -52,21 +53,21 @@ export const BlueprintEditor = ({ object }: BlueprintEditorProps) => {
|
|
|
52
53
|
text.content = instructions;
|
|
53
54
|
});
|
|
54
55
|
|
|
55
|
-
if (
|
|
56
|
-
const toolId = ToolId.make(
|
|
56
|
+
if (fnKey) {
|
|
57
|
+
const toolId = ToolId.make(fnKey);
|
|
57
58
|
if (!existingBlueprint.tools?.includes(toolId)) {
|
|
58
59
|
Obj.update(existingBlueprint, (existingBlueprint) => {
|
|
59
60
|
existingBlueprint.tools = [...(existingBlueprint.tools ?? []), toolId];
|
|
60
61
|
});
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
|
-
} else if (
|
|
64
|
+
} else if (fnKey) {
|
|
64
65
|
db.add(
|
|
65
66
|
Blueprint.make({
|
|
66
67
|
key: blueprintKey,
|
|
67
68
|
name: object.name ?? 'Script',
|
|
68
69
|
instructions: Template.make({ source: instructions }),
|
|
69
|
-
tools: [ToolId.make(
|
|
70
|
+
tools: [ToolId.make(fnKey)],
|
|
70
71
|
}),
|
|
71
72
|
);
|
|
72
73
|
}
|
|
@@ -74,7 +75,7 @@ export const BlueprintEditor = ({ object }: BlueprintEditorProps) => {
|
|
|
74
75
|
} finally {
|
|
75
76
|
setCreating(false);
|
|
76
77
|
}
|
|
77
|
-
}, [db, existingBlueprint,
|
|
78
|
+
}, [db, existingBlueprint, fnKey, blueprintKey, object.name, instructions]);
|
|
78
79
|
|
|
79
80
|
return (
|
|
80
81
|
<div className='flex flex-col'>
|
|
@@ -92,7 +93,7 @@ export const BlueprintEditor = ({ object }: BlueprintEditorProps) => {
|
|
|
92
93
|
</Input.Root>
|
|
93
94
|
|
|
94
95
|
<div className='pt-2'>
|
|
95
|
-
<Button disabled={(!existingBlueprint && !
|
|
96
|
+
<Button disabled={(!existingBlueprint && !fnKey) || creating} onClick={handleSave}>
|
|
96
97
|
{t(existingBlueprint ? 'update-blueprint.label' : 'create-blueprint.label')}
|
|
97
98
|
</Button>
|
|
98
99
|
</div>
|
|
@@ -10,10 +10,11 @@ import { withPluginManager } from '@dxos/app-framework/testing';
|
|
|
10
10
|
import { Blueprint } from '@dxos/compute';
|
|
11
11
|
import { Script } from '@dxos/compute';
|
|
12
12
|
import { Operation } from '@dxos/compute';
|
|
13
|
-
import {
|
|
13
|
+
import { Filter } from '@dxos/echo';
|
|
14
|
+
import { ClientPlugin } from '@dxos/plugin-client/testing';
|
|
14
15
|
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
15
16
|
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
16
|
-
import {
|
|
17
|
+
import { useQuery, useSpaces } from '@dxos/react-client/echo';
|
|
17
18
|
import { ObjectProperties } from '@dxos/react-ui-form';
|
|
18
19
|
import { Loading, withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
19
20
|
import { Text } from '@dxos/schema';
|
|
@@ -6,8 +6,8 @@ import React, { useCallback, useMemo } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { type Script } from '@dxos/compute';
|
|
8
8
|
import { Context } from '@dxos/context';
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
9
10
|
import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
|
|
10
|
-
import { getSpace } from '@dxos/react-client/echo';
|
|
11
11
|
import { Panel } from '@dxos/react-ui';
|
|
12
12
|
|
|
13
13
|
import { TestPanel } from '#components';
|
|
@@ -20,7 +20,7 @@ export type TestContainerProps = {
|
|
|
20
20
|
|
|
21
21
|
export const TestContainer = ({ role, script }: TestContainerProps) => {
|
|
22
22
|
const { client, fn, existingFunctionId } = useDeployDeps({ script });
|
|
23
|
-
const
|
|
23
|
+
const spaceId = Obj.getDatabase(script)?.spaceId;
|
|
24
24
|
|
|
25
25
|
const functionsClient = useMemo(() => FunctionsServiceClient.fromClient(client), [client]);
|
|
26
26
|
|
|
@@ -29,9 +29,9 @@ export const TestContainer = ({ role, script }: TestContainerProps) => {
|
|
|
29
29
|
if (!fn) {
|
|
30
30
|
throw new Error('Function not deployed');
|
|
31
31
|
}
|
|
32
|
-
return functionsClient.invoke(Context.default(), fn, input, { spaceId
|
|
32
|
+
return functionsClient.invoke(Context.default(), fn, input, { spaceId });
|
|
33
33
|
},
|
|
34
|
-
[fn, functionsClient,
|
|
34
|
+
[fn, functionsClient, spaceId],
|
|
35
35
|
);
|
|
36
36
|
|
|
37
37
|
return (
|
package/src/containers/index.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { type ComponentType, lazy } from 'react';
|
|
6
6
|
|
|
7
7
|
export const DeploymentDialog: ComponentType<any> = lazy(() => import('./DeploymentDialog'));
|
|
8
|
-
export const
|
|
9
|
-
export const
|
|
8
|
+
export const NotebookArticle: ComponentType<any> = lazy(() => import('./NotebookArticle'));
|
|
9
|
+
export const ScriptArticle: ComponentType<any> = lazy(() => import('./ScriptArticle'));
|
|
10
10
|
export const ScriptProperties: ComponentType<any> = lazy(() => import('./ScriptProperties'));
|
|
11
11
|
export const TestContainer: ComponentType<any> = lazy(() => import('./TestContainer'));
|
package/src/meta.ts
CHANGED
|
@@ -2,25 +2,31 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { DXN } from '@dxos/keys';
|
|
6
7
|
import { trim } from '@dxos/util';
|
|
7
8
|
|
|
8
|
-
export const meta
|
|
9
|
-
|
|
9
|
+
export const meta = Plugin.makeMeta({
|
|
10
|
+
key: DXN.make('org.dxos.plugin.script'),
|
|
10
11
|
name: 'Scripts',
|
|
12
|
+
author: 'DXOS',
|
|
13
|
+
spec: 'PLUGIN.mdl',
|
|
11
14
|
description: trim`
|
|
12
|
-
Write and
|
|
13
|
-
|
|
15
|
+
Write, deploy, and run custom TypeScript functions as ECHO objects directly inside your Composer spaces.
|
|
16
|
+
Scripts execute on the Cloudflare Workers-based EDGE runtime and have access to the full DXOS SDK,
|
|
17
|
+
Effect-TS, and a curated set of third-party libraries including HTTP, JSON, CSV, and date utilities.
|
|
18
|
+
An AI Script assistant wires CRUD, deploy, invoke, and invocation-inspection operations as tools
|
|
19
|
+
so an agent can scaffold, iterate, and test functions entirely within a chat session.
|
|
14
20
|
`,
|
|
15
21
|
icon: 'ph--code--regular',
|
|
16
22
|
iconHue: 'sky',
|
|
17
23
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-explorer',
|
|
18
24
|
tags: ['labs'],
|
|
19
25
|
screenshots: ['https://dxos.network/plugin-details-scripts-dark.png'],
|
|
20
|
-
};
|
|
26
|
+
});
|
|
21
27
|
|
|
22
28
|
// TODO(ZaymonFC): Configure by scopes?
|
|
23
29
|
export const defaultScriptsForIntegration: Record<string, string[]> = {
|
|
24
30
|
// TODO(wittjosiah): Also include content extraction scripts in the default set.
|
|
25
|
-
'gmail.com': ['org.dxos.script.gmail'],
|
|
31
|
+
'gmail.com': [DXN.make('org.dxos.script.gmail')],
|
|
26
32
|
};
|
package/src/operations/index.ts
CHANGED
|
@@ -4,7 +4,4 @@
|
|
|
4
4
|
|
|
5
5
|
import { OperationHandlerSet } from '@dxos/compute';
|
|
6
6
|
|
|
7
|
-
export const ScriptOperationHandlerSet = OperationHandlerSet.lazy(
|
|
8
|
-
() => import('./access-token-created'),
|
|
9
|
-
() => import('./create-script'),
|
|
10
|
-
);
|
|
7
|
+
export const ScriptOperationHandlerSet = OperationHandlerSet.lazy(() => import('./create-script'));
|
|
@@ -10,10 +10,11 @@ import * as Stream from 'effect/Stream';
|
|
|
10
10
|
|
|
11
11
|
import { AiService } from '@dxos/ai';
|
|
12
12
|
import { Operation } from '@dxos/compute';
|
|
13
|
+
import { DXN } from '@dxos/keys';
|
|
13
14
|
|
|
14
15
|
const Anthropic = Operation.make({
|
|
15
16
|
meta: {
|
|
16
|
-
key: 'org.dxos.script.anthropic',
|
|
17
|
+
key: DXN.make('org.dxos.script.anthropic'),
|
|
17
18
|
name: 'Anthropic Chat',
|
|
18
19
|
description: 'Chat with Anthropic',
|
|
19
20
|
},
|
|
@@ -7,13 +7,13 @@ import * as Effect from 'effect/Effect';
|
|
|
7
7
|
import * as Schema from 'effect/Schema';
|
|
8
8
|
|
|
9
9
|
import { Operation } from '@dxos/compute';
|
|
10
|
-
import { Database, Obj } from '@dxos/echo';
|
|
10
|
+
import { Database, Obj, DXN } from '@dxos/echo';
|
|
11
11
|
import { Chess } from '@dxos/plugin-chess';
|
|
12
12
|
import { GameRef, Game, loadGame } from '@dxos/plugin-game';
|
|
13
13
|
|
|
14
14
|
const ChessBot = Operation.make({
|
|
15
15
|
meta: {
|
|
16
|
-
key: 'org.dxos.script.
|
|
16
|
+
key: DXN.make('org.dxos.script.chessBot'),
|
|
17
17
|
name: 'Chess Bot',
|
|
18
18
|
description: 'Plays a random move in a chess game.',
|
|
19
19
|
},
|