@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
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Obj } from '@dxos/echo';
|
|
8
|
+
import { DropdownMenu, IconButton, ScrollArea, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
8
9
|
import { composable, composableProps } from '@dxos/react-ui';
|
|
9
|
-
import {
|
|
10
|
+
import { Mosaic, type MosaicEventHandler, type MosaicTileProps } from '@dxos/react-ui-mosaic';
|
|
11
|
+
import { mx } from '@dxos/ui-theme';
|
|
12
|
+
import { arrayMove } from '@dxos/util';
|
|
10
13
|
|
|
11
14
|
import { meta } from '#meta';
|
|
12
15
|
import { type Notebook } from '#types';
|
|
@@ -17,55 +20,122 @@ import { NotebookMenu } from './NotebookMenu';
|
|
|
17
20
|
|
|
18
21
|
const minSectionHeight = 'min-h-[16rem]';
|
|
19
22
|
|
|
23
|
+
const getCellId = (cell: Notebook.Cell) => cell.id;
|
|
24
|
+
|
|
20
25
|
export type NotebookStackProps = ThemedClassName<
|
|
21
26
|
{
|
|
22
27
|
notebook?: Notebook.Notebook;
|
|
23
|
-
onRearrange?: StackProps['onRearrange'];
|
|
24
28
|
} & (Pick<NotebookSectionProps, 'db' | 'graph' | 'promptResults' | 'onCellInsert' | 'onCellDelete'> &
|
|
25
29
|
Pick<TypescriptEditorProps, 'env'>)
|
|
26
30
|
>;
|
|
27
31
|
|
|
28
|
-
// TODO(burdon): Option for narrow rail (with compact buttons that align with first button in toolbar).
|
|
29
32
|
export const NotebookStack = composable<HTMLDivElement, NotebookStackProps>(
|
|
30
|
-
({ notebook,
|
|
31
|
-
const
|
|
33
|
+
({ notebook, db, graph, promptResults, onCellInsert, onCellDelete, env, ...props }, forwardedRef) => {
|
|
34
|
+
const [viewport, setViewport] = useState<HTMLElement | null>(null);
|
|
35
|
+
|
|
36
|
+
// Stable Tile identity: an inline component is a new type each render, so Mosaic would unmount and
|
|
37
|
+
// remount every cell (losing editor state) whenever this component re-renders.
|
|
38
|
+
const Tile = useCallback(
|
|
39
|
+
(tileProps: MosaicTileProps<Notebook.Cell>) => (
|
|
40
|
+
<NotebookSection
|
|
41
|
+
{...tileProps}
|
|
42
|
+
db={db}
|
|
43
|
+
graph={graph}
|
|
44
|
+
promptResults={promptResults}
|
|
45
|
+
onCellInsert={onCellInsert}
|
|
46
|
+
onCellDelete={onCellDelete}
|
|
47
|
+
env={env}
|
|
48
|
+
/>
|
|
49
|
+
),
|
|
50
|
+
[db, graph, promptResults, onCellInsert, onCellDelete, env],
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
// Reorder cells in place; placeholder/tile locations are 1-based with half-step placeholders between
|
|
54
|
+
// tiles, so the floor of the drop location is the destination array index (see Mosaic.Stack).
|
|
55
|
+
const eventHandler = useMemo<MosaicEventHandler<Notebook.Cell>>(
|
|
56
|
+
() => ({
|
|
57
|
+
id: notebook?.id ?? 'notebook',
|
|
58
|
+
// Only the notebook's own cells are droppable; onDrop only reorders within this notebook.
|
|
59
|
+
canDrop: ({ source }) => !!notebook && notebook.cells.some((cell) => cell.id === source.id),
|
|
60
|
+
onDrop: ({ source, target }) => {
|
|
61
|
+
if (!notebook || !target) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const to =
|
|
66
|
+
target.type === 'tile' || target.type === 'placeholder'
|
|
67
|
+
? target.location
|
|
68
|
+
: target.type === 'container'
|
|
69
|
+
? notebook.cells.length
|
|
70
|
+
: -1;
|
|
71
|
+
const insertIndex = typeof to === 'number' && to >= 0 ? Math.floor(to) : -1;
|
|
72
|
+
if (insertIndex < 0) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
Obj.update(notebook, (notebook) => {
|
|
77
|
+
const from = notebook.cells.findIndex((cell) => cell.id === source.id);
|
|
78
|
+
if (from !== -1) {
|
|
79
|
+
arrayMove(notebook.cells, from, insertIndex);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
}),
|
|
84
|
+
[notebook],
|
|
85
|
+
);
|
|
86
|
+
|
|
32
87
|
return (
|
|
33
|
-
<
|
|
34
|
-
{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
<NotebookSection key={i} cell={cell} {...sectionProps} />
|
|
43
|
-
))}
|
|
44
|
-
</Stack>
|
|
88
|
+
<Mosaic.Root ref={forwardedRef}>
|
|
89
|
+
<Mosaic.Container asChild orientation='vertical' autoScroll={viewport} eventHandler={eventHandler}>
|
|
90
|
+
<ScrollArea.Root orientation='vertical' padding {...composableProps(props)}>
|
|
91
|
+
<ScrollArea.Viewport ref={setViewport}>
|
|
92
|
+
<Mosaic.Stack orientation='vertical' items={notebook?.cells ?? []} getId={getCellId} Tile={Tile} />
|
|
93
|
+
</ScrollArea.Viewport>
|
|
94
|
+
</ScrollArea.Root>
|
|
95
|
+
</Mosaic.Container>
|
|
96
|
+
</Mosaic.Root>
|
|
45
97
|
);
|
|
46
98
|
},
|
|
47
99
|
);
|
|
48
100
|
|
|
49
|
-
type NotebookSectionProps =
|
|
101
|
+
type NotebookSectionProps = MosaicTileProps<Notebook.Cell> &
|
|
102
|
+
Pick<NotebookCellProps, 'db' | 'graph' | 'promptResults' | 'onCellInsert' | 'onCellDelete' | 'env'>;
|
|
50
103
|
|
|
104
|
+
// TODO(burdon): Option for narrow rail (with compact buttons that align with first button in toolbar).
|
|
105
|
+
// TODO(burdon): Reinstate a Mosaic-native resize affordance for query cells (currently a fixed min-height).
|
|
51
106
|
const NotebookSection = ({
|
|
52
|
-
cell,
|
|
107
|
+
data: cell,
|
|
53
108
|
db,
|
|
54
109
|
env,
|
|
110
|
+
graph,
|
|
55
111
|
promptResults,
|
|
56
112
|
onCellInsert,
|
|
57
113
|
onCellDelete,
|
|
58
|
-
...
|
|
114
|
+
...tileProps
|
|
59
115
|
}: NotebookSectionProps) => {
|
|
60
116
|
const { t } = useTranslation(meta.profile.key);
|
|
61
117
|
const resizable = cell.type === 'query';
|
|
118
|
+
const [dragHandle, setDragHandle] = useState<HTMLButtonElement | null>(null);
|
|
62
119
|
|
|
63
120
|
return (
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
121
|
+
<Mosaic.Tile
|
|
122
|
+
{...tileProps}
|
|
123
|
+
data={cell}
|
|
124
|
+
dragHandle={dragHandle}
|
|
125
|
+
classNames={mx(
|
|
126
|
+
'grid grid-cols-[min-content_1fr] overflow-visible border border-subdued-separator',
|
|
127
|
+
resizable && minSectionHeight,
|
|
128
|
+
)}
|
|
129
|
+
>
|
|
130
|
+
{/* Side rail */}
|
|
131
|
+
<div className='flex flex-col p-1 border-e border-subdued-separator dx-attention-surface'>
|
|
132
|
+
<IconButton
|
|
133
|
+
ref={setDragHandle}
|
|
134
|
+
variant='ghost'
|
|
135
|
+
icon='ph--dots-six-vertical--regular'
|
|
136
|
+
iconOnly
|
|
137
|
+
label='Drag handle'
|
|
138
|
+
/>
|
|
69
139
|
<DropdownMenu.Root>
|
|
70
140
|
<DropdownMenu.Trigger asChild>
|
|
71
141
|
<IconButton
|
|
@@ -77,21 +147,9 @@ const NotebookSection = ({
|
|
|
77
147
|
</DropdownMenu.Trigger>
|
|
78
148
|
<NotebookMenu cell={cell} onCellInsert={onCellInsert} onCellDelete={onCellDelete} />
|
|
79
149
|
</DropdownMenu.Root>
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
<StackItem.DragPreview>
|
|
85
|
-
{({ item: cell }) => (
|
|
86
|
-
<StackItem.Content classNames='overflow-visible bg-group-surface border border-subdued-separator'>
|
|
87
|
-
<NotebookCell db={db} cell={cell} env={env} dragging />
|
|
88
|
-
</StackItem.Content>
|
|
89
|
-
)}
|
|
90
|
-
</StackItem.DragPreview>
|
|
91
|
-
|
|
92
|
-
<StackItem.Content classNames='overflow-visible'>
|
|
93
|
-
<NotebookCell db={db} cell={cell} env={env} promptResults={promptResults} {...props} />
|
|
94
|
-
</StackItem.Content>
|
|
95
|
-
</StackItem.Root>
|
|
150
|
+
</div>
|
|
151
|
+
|
|
152
|
+
<NotebookCell db={db} cell={cell} env={env} graph={graph} promptResults={promptResults} />
|
|
153
|
+
</Mosaic.Tile>
|
|
96
154
|
);
|
|
97
155
|
};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { Doc } from '@dxos/echo-doc';
|
|
9
9
|
import { QuerySandbox } from '@dxos/echo-query';
|
|
10
10
|
import { createObject } from '@dxos/react-client/echo';
|
|
11
11
|
import { Panel, Toolbar, useAsyncEffect } from '@dxos/react-ui';
|
|
@@ -36,12 +36,7 @@ const DefaultStory = (props: QueryEditorProps) => {
|
|
|
36
36
|
}, []);
|
|
37
37
|
|
|
38
38
|
const extensions = useMemo(
|
|
39
|
-
() => [
|
|
40
|
-
createDataExtensions({
|
|
41
|
-
id: object.id,
|
|
42
|
-
text: createDocAccessor(object, ['content']),
|
|
43
|
-
}),
|
|
44
|
-
],
|
|
39
|
+
() => [createDataExtensions({ id: object.id, text: Doc.createAccessor(object, ['content']) })],
|
|
45
40
|
[],
|
|
46
41
|
);
|
|
47
42
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { Doc } from '@dxos/echo-doc';
|
|
9
9
|
import { createObject } from '@dxos/react-client/echo';
|
|
10
10
|
import { Panel, Toolbar } from '@dxos/react-ui';
|
|
11
11
|
import { JsonHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
@@ -37,7 +37,7 @@ const DefaultStory = (props: TypescriptEditorProps) => {
|
|
|
37
37
|
() => [
|
|
38
38
|
createDataExtensions({
|
|
39
39
|
id: object.id,
|
|
40
|
-
text:
|
|
40
|
+
text: Doc.createAccessor(object, ['content']),
|
|
41
41
|
}),
|
|
42
42
|
],
|
|
43
43
|
[],
|
|
@@ -15,8 +15,7 @@ import { continueKeymap } from '@valtown/codemirror-continue';
|
|
|
15
15
|
import { type HoverInfo, tsAutocomplete, tsFacet, tsHover, tsLinter, tsSync } from '@valtown/codemirror-ts';
|
|
16
16
|
import React from 'react';
|
|
17
17
|
|
|
18
|
-
import {
|
|
19
|
-
import { type ThemeMode, type ThemedClassName, useThemeContext } from '@dxos/react-ui';
|
|
18
|
+
import { type ThemedClassName, type ThemeMode, useThemeContext } from '@dxos/react-ui';
|
|
20
19
|
import { composable, composableProps } from '@dxos/react-ui';
|
|
21
20
|
import { type UseTextEditorProps, useTextEditor } from '@dxos/react-ui-editor';
|
|
22
21
|
import { Domino } from '@dxos/ui';
|
|
@@ -67,20 +66,20 @@ export const TypescriptEditor = composable<HTMLDivElement, TypescriptEditorProps
|
|
|
67
66
|
scrollTo,
|
|
68
67
|
extensions: [
|
|
69
68
|
extensions,
|
|
69
|
+
createThemeExtensions({
|
|
70
|
+
monospace: true,
|
|
71
|
+
themeMode,
|
|
72
|
+
syntaxHighlighting: true,
|
|
73
|
+
}),
|
|
70
74
|
createBasicExtensions({
|
|
71
75
|
highlightActiveLine: true,
|
|
72
76
|
indentWithTab: true,
|
|
73
77
|
lineNumbers: true,
|
|
74
78
|
lineWrapping: false,
|
|
75
|
-
scrollPastEnd: role
|
|
79
|
+
scrollPastEnd: role === 'article',
|
|
76
80
|
search: true,
|
|
77
81
|
...options,
|
|
78
82
|
}),
|
|
79
|
-
createThemeExtensions({
|
|
80
|
-
monospace: true,
|
|
81
|
-
themeMode,
|
|
82
|
-
syntaxHighlighting: true,
|
|
83
|
-
}),
|
|
84
83
|
|
|
85
84
|
InputModeExtensions[inputMode],
|
|
86
85
|
javascript({ typescript: true }),
|
package/src/components/index.ts
CHANGED
|
@@ -2,12 +2,8 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type ComponentType, lazy } from 'react';
|
|
6
|
-
|
|
7
5
|
export * from './NotebookStack';
|
|
8
6
|
export * from './QueryEditor';
|
|
9
7
|
export * from './ScriptToolbar';
|
|
10
8
|
export * from './TestPanel';
|
|
11
9
|
export * from './TypescriptEditor';
|
|
12
|
-
|
|
13
|
-
export const ScriptPluginSettings: ComponentType<any> = lazy(() => import('./ScriptPluginSettings'));
|
|
@@ -9,16 +9,16 @@ import React from 'react';
|
|
|
9
9
|
import { SERVICES_CONFIG } from '@dxos/ai/testing';
|
|
10
10
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
11
11
|
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
12
|
-
import {
|
|
12
|
+
import { RunInstructions } from '@dxos/assistant-toolkit';
|
|
13
13
|
import { Operation } from '@dxos/compute';
|
|
14
14
|
import { Filter } from '@dxos/echo';
|
|
15
15
|
import { AssistantPlugin } from '@dxos/plugin-assistant/testing';
|
|
16
|
-
import { AutomationPlugin } from '@dxos/plugin-automation/testing';
|
|
17
16
|
import { ClientPlugin } from '@dxos/plugin-client/testing';
|
|
18
17
|
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
19
18
|
import { ExplorerPlugin } from '@dxos/plugin-explorer/testing';
|
|
20
19
|
import { Markdown } from '@dxos/plugin-markdown';
|
|
21
20
|
import { MarkdownPlugin } from '@dxos/plugin-markdown/testing';
|
|
21
|
+
import { RoutinePlugin } from '@dxos/plugin-routine/testing';
|
|
22
22
|
import { corePlugins } from '@dxos/plugin-testing';
|
|
23
23
|
import { Config, useClient } from '@dxos/react-client';
|
|
24
24
|
import { useQuery } from '@dxos/react-client/echo';
|
|
@@ -59,11 +59,11 @@ const meta: Meta<typeof NotebookArticle> = {
|
|
|
59
59
|
|
|
60
60
|
personalSpace.db.add(createNotebook());
|
|
61
61
|
personalSpace.db.add(Markdown.make({ content: '# Hello World' }));
|
|
62
|
-
personalSpace.db.add(Operation.serialize(
|
|
62
|
+
personalSpace.db.add(Operation.serialize(RunInstructions));
|
|
63
63
|
}),
|
|
64
64
|
}),
|
|
65
65
|
AssistantPlugin(),
|
|
66
|
-
|
|
66
|
+
RoutinePlugin(),
|
|
67
67
|
ExplorerPlugin(),
|
|
68
68
|
MarkdownPlugin(),
|
|
69
69
|
],
|
|
@@ -11,8 +11,8 @@ import React, { useCallback, useContext, useMemo, useState } from 'react';
|
|
|
11
11
|
|
|
12
12
|
import { useSpaceCallback } from '@dxos/app-framework/ui';
|
|
13
13
|
import { type AppSurface } from '@dxos/app-toolkit/ui';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
14
|
+
import { RunInstructions } from '@dxos/assistant-toolkit';
|
|
15
|
+
import { Instructions, Skill } from '@dxos/compute';
|
|
16
16
|
import { Operation } from '@dxos/compute';
|
|
17
17
|
import { Filter, Obj, Query, Ref } from '@dxos/echo';
|
|
18
18
|
import { QueryBuilder } from '@dxos/echo-query';
|
|
@@ -30,11 +30,7 @@ import { type Notebook } from '#types';
|
|
|
30
30
|
|
|
31
31
|
import { ComputeGraph } from '../../notebook';
|
|
32
32
|
|
|
33
|
-
const
|
|
34
|
-
'org.dxos.blueprint.assistant',
|
|
35
|
-
'org.dxos.blueprint.database',
|
|
36
|
-
'org.dxos.blueprint.markdown',
|
|
37
|
-
];
|
|
33
|
+
const INCLUDE_SKILLS = ['org.dxos.skill.assistant', 'org.dxos.skill.database', 'org.dxos.skill.markdown'];
|
|
38
34
|
|
|
39
35
|
// TODO(burdon): Support calling named deployed functions (as with sheet).
|
|
40
36
|
|
|
@@ -43,7 +39,7 @@ export type NotebookArticleProps = AppSurface.ObjectArticleProps<Notebook.Notebo
|
|
|
43
39
|
export const NotebookArticle = ({ role, subject: notebook, attendableId, env }: NotebookArticleProps) => {
|
|
44
40
|
const { t } = useTranslation(meta.profile.key);
|
|
45
41
|
const registry = useContext(RegistryContext);
|
|
46
|
-
const db = Obj.getDatabase(notebook);
|
|
42
|
+
const db = notebook ? Obj.getDatabase(notebook) : undefined;
|
|
47
43
|
const { hasAttention } = useAttention(attendableId);
|
|
48
44
|
|
|
49
45
|
// TODO(burdon): Consolidate execution and state (with graph).
|
|
@@ -99,20 +95,20 @@ export const NotebookArticle = ({ role, subject: notebook, attendableId, env }:
|
|
|
99
95
|
Effect.fnUntraced(function* () {
|
|
100
96
|
invariant(graph);
|
|
101
97
|
|
|
102
|
-
const
|
|
98
|
+
const allInstructions =
|
|
103
99
|
notebook?.cells
|
|
104
100
|
.filter((cell) => cell.type === 'prompt')
|
|
105
101
|
.map((cell) => cell.prompt)
|
|
106
102
|
.filter(isNonNullable) ?? [];
|
|
107
103
|
|
|
108
|
-
for (const
|
|
104
|
+
for (const instructions of allInstructions) {
|
|
109
105
|
yield* runPrompt({
|
|
110
|
-
|
|
106
|
+
instructions,
|
|
111
107
|
input: { ...queryValues, ...graph.getValuesByName() },
|
|
112
108
|
onResult: (result) =>
|
|
113
109
|
setPromptResults((prev) => ({
|
|
114
110
|
...prev,
|
|
115
|
-
[
|
|
111
|
+
[instructions.uri]: result,
|
|
116
112
|
})),
|
|
117
113
|
});
|
|
118
114
|
}
|
|
@@ -128,23 +124,6 @@ export const NotebookArticle = ({ role, subject: notebook, attendableId, env }:
|
|
|
128
124
|
await handleExecPrompts();
|
|
129
125
|
}, [graph, handleExecQueries, handleExecPrompts]);
|
|
130
126
|
|
|
131
|
-
const handleRearrange = useCallback<NonNullable<NotebookStackProps['onRearrange']>>(
|
|
132
|
-
(source, target) => {
|
|
133
|
-
invariant(notebook);
|
|
134
|
-
const from = notebook.cells.findIndex((cell) => cell.id === source.id);
|
|
135
|
-
const to = notebook.cells.findIndex((cell) => cell.id === target.id);
|
|
136
|
-
if (from != null && to != null) {
|
|
137
|
-
Obj.update(notebook, (notebook) => {
|
|
138
|
-
const cell = notebook.cells.splice(from, 1)[0];
|
|
139
|
-
if (cell) {
|
|
140
|
-
notebook.cells.splice(to, 0, cell);
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
[notebook],
|
|
146
|
-
);
|
|
147
|
-
|
|
148
127
|
const handleCellInsert = useCallback<NonNullable<NotebookStackProps['onCellInsert']>>(
|
|
149
128
|
async (type, after) => {
|
|
150
129
|
invariant(notebook);
|
|
@@ -159,14 +138,14 @@ export const NotebookArticle = ({ role, subject: notebook, attendableId, env }:
|
|
|
159
138
|
|
|
160
139
|
case 'prompt': {
|
|
161
140
|
if (db) {
|
|
162
|
-
const objects = await db.query(Query.select(Filter.type(
|
|
163
|
-
const
|
|
164
|
-
.filter((
|
|
165
|
-
const key = Obj.getMeta(
|
|
166
|
-
return key !== undefined &&
|
|
141
|
+
const objects = await db.query(Query.select(Filter.type(Skill.Skill))).run();
|
|
142
|
+
const skills = objects
|
|
143
|
+
.filter((skill) => {
|
|
144
|
+
const key = Obj.getMeta(skill).key;
|
|
145
|
+
return key !== undefined && INCLUDE_SKILLS.includes(key);
|
|
167
146
|
})
|
|
168
|
-
.map((
|
|
169
|
-
cell.prompt = Ref.make(
|
|
147
|
+
.map((skill) => Ref.make(skill));
|
|
148
|
+
cell.prompt = Ref.make(Instructions.make({ text: '', skills }));
|
|
170
149
|
}
|
|
171
150
|
break;
|
|
172
151
|
}
|
|
@@ -212,14 +191,13 @@ export const NotebookArticle = ({ role, subject: notebook, attendableId, env }:
|
|
|
212
191
|
/>
|
|
213
192
|
</Toolbar.Root>
|
|
214
193
|
</Panel.Toolbar>
|
|
215
|
-
<Panel.Content
|
|
194
|
+
<Panel.Content>
|
|
216
195
|
<NotebookStack
|
|
217
196
|
db={db}
|
|
218
197
|
notebook={notebook}
|
|
219
198
|
graph={graph}
|
|
220
199
|
env={env}
|
|
221
200
|
promptResults={promptResults}
|
|
222
|
-
onRearrange={handleRearrange}
|
|
223
201
|
onCellInsert={handleCellInsert}
|
|
224
202
|
onCellDelete={handleCellDelete}
|
|
225
203
|
/>
|
|
@@ -230,17 +208,17 @@ export const NotebookArticle = ({ role, subject: notebook, attendableId, env }:
|
|
|
230
208
|
|
|
231
209
|
// TODO(wittjosiah): Factor out. Copied from PromptArticle in plugin-assistant.
|
|
232
210
|
const runPrompt = Effect.fn(function* ({
|
|
233
|
-
|
|
211
|
+
instructions,
|
|
234
212
|
input,
|
|
235
213
|
onResult,
|
|
236
214
|
}: {
|
|
237
|
-
|
|
215
|
+
instructions: Ref.Ref<Instructions.Instructions>;
|
|
238
216
|
input: Record<string, any>;
|
|
239
217
|
onResult: (result: string) => void;
|
|
240
218
|
}) {
|
|
241
|
-
const inputData: Operation.Definition.Input<typeof
|
|
219
|
+
const inputData: Operation.Definition.Input<typeof RunInstructions> = { instructions, input };
|
|
242
220
|
// Invoke the function.
|
|
243
|
-
const result = yield* Operation.invoke(
|
|
221
|
+
const result = yield* Operation.invoke(RunInstructions, inputData).pipe(Effect.orDie, Effect.exit);
|
|
244
222
|
|
|
245
223
|
Exit.match(result, {
|
|
246
224
|
onFailure: (cause) => {
|
|
@@ -8,7 +8,7 @@ import React, { useEffect, useState } from 'react';
|
|
|
8
8
|
|
|
9
9
|
import { SERVICES_CONFIG } from '@dxos/ai/testing';
|
|
10
10
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
11
|
-
import {
|
|
11
|
+
import { Skill } from '@dxos/compute';
|
|
12
12
|
import { Script } from '@dxos/compute';
|
|
13
13
|
import { Operation } from '@dxos/compute';
|
|
14
14
|
import { Filter } from '@dxos/echo';
|
|
@@ -25,12 +25,12 @@ import { translations } from '#translations';
|
|
|
25
25
|
|
|
26
26
|
import { ScriptArticle } from './ScriptArticle';
|
|
27
27
|
|
|
28
|
-
type
|
|
28
|
+
type StoryArgs = {};
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* Loads the script source ref so `script.source.target` is available for the editor.
|
|
32
32
|
*/
|
|
33
|
-
const DefaultStory = (_:
|
|
33
|
+
const DefaultStory = (_: StoryArgs) => {
|
|
34
34
|
const [space] = useSpaces();
|
|
35
35
|
const [script] = useQuery(space?.db, Filter.type(Script.Script));
|
|
36
36
|
const [sourceReady, setSourceReady] = useState(false);
|
|
@@ -80,7 +80,7 @@ const meta = {
|
|
|
80
80
|
services: SERVICES_CONFIG.REMOTE,
|
|
81
81
|
},
|
|
82
82
|
}),
|
|
83
|
-
types: [Script.Script, Operation.PersistentOperation,
|
|
83
|
+
types: [Script.Script, Operation.PersistentOperation, Skill.Skill, Text.Text],
|
|
84
84
|
onClientInitialized: ({ client }) =>
|
|
85
85
|
Effect.gen(function* () {
|
|
86
86
|
yield* initializeIdentity(client);
|
|
@@ -98,7 +98,7 @@ const meta = {
|
|
|
98
98
|
layout: 'fullscreen',
|
|
99
99
|
translations,
|
|
100
100
|
},
|
|
101
|
-
} satisfies Meta<
|
|
101
|
+
} satisfies Meta<StoryArgs>;
|
|
102
102
|
|
|
103
103
|
export default meta;
|
|
104
104
|
|
|
@@ -7,11 +7,11 @@ import React, { useMemo } from 'react';
|
|
|
7
7
|
import { type AppSurface } from '@dxos/app-toolkit/ui';
|
|
8
8
|
import { type Script } from '@dxos/compute';
|
|
9
9
|
import { Obj } from '@dxos/echo';
|
|
10
|
-
import {
|
|
10
|
+
import { Doc } from '@dxos/echo-doc';
|
|
11
11
|
import { getSpace } from '@dxos/react-client/echo';
|
|
12
12
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
13
13
|
import { Panel } from '@dxos/react-ui';
|
|
14
|
-
import { createDataExtensions,
|
|
14
|
+
import { createDataExtensions, editorClassNames, listener } from '@dxos/ui-editor';
|
|
15
15
|
|
|
16
16
|
import { ScriptToolbar, TypescriptEditor, type TypescriptEditorProps } from '#components';
|
|
17
17
|
import { useDeployState, useToolbarState } from '#hooks';
|
|
@@ -44,7 +44,7 @@ export const ScriptArticle = ({
|
|
|
44
44
|
return [
|
|
45
45
|
createDataExtensions({
|
|
46
46
|
id: script.id,
|
|
47
|
-
text:
|
|
47
|
+
text: Doc.createAccessor(script.source.target, ['content']),
|
|
48
48
|
messenger: space,
|
|
49
49
|
identity,
|
|
50
50
|
}),
|
|
@@ -51,7 +51,7 @@ export const FunctionBinding = ({ object }: FunctionBindingProps) => {
|
|
|
51
51
|
|
|
52
52
|
return (
|
|
53
53
|
<div className='flex flex-col'>
|
|
54
|
-
<Form.Section
|
|
54
|
+
<Form.Section title={t('remote-function-settings.heading')} />
|
|
55
55
|
|
|
56
56
|
{functionUrl && (
|
|
57
57
|
<Input.Root>
|
|
@@ -95,7 +95,7 @@ export const FunctionPublishing = ({ object }: FunctionPublishingProps) => {
|
|
|
95
95
|
|
|
96
96
|
return (
|
|
97
97
|
<div className='flex flex-col'>
|
|
98
|
-
<Form.Section
|
|
98
|
+
<Form.Section title={t('script-publish-settings.label')} description={t('script-publish-settings.description')} />
|
|
99
99
|
|
|
100
100
|
{!githubToken && (
|
|
101
101
|
<div className='flex flex-col py-form-gap'>
|
|
@@ -7,7 +7,7 @@ import * as Effect from 'effect/Effect';
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
-
import {
|
|
10
|
+
import { Skill } from '@dxos/compute';
|
|
11
11
|
import { Script } from '@dxos/compute';
|
|
12
12
|
import { Operation } from '@dxos/compute';
|
|
13
13
|
import { Filter } from '@dxos/echo';
|
|
@@ -24,9 +24,9 @@ import { translations } from '#translations';
|
|
|
24
24
|
|
|
25
25
|
import { ScriptProperties } from './ScriptProperties';
|
|
26
26
|
|
|
27
|
-
type
|
|
27
|
+
type StoryArgs = {};
|
|
28
28
|
|
|
29
|
-
const DefaultStory = (_:
|
|
29
|
+
const DefaultStory = (_: StoryArgs) => {
|
|
30
30
|
const [space] = useSpaces();
|
|
31
31
|
const [script] = useQuery(space?.db, Filter.type(Script.Script));
|
|
32
32
|
if (!script) {
|
|
@@ -50,7 +50,7 @@ const meta = {
|
|
|
50
50
|
plugins: [
|
|
51
51
|
...corePlugins(),
|
|
52
52
|
ClientPlugin({
|
|
53
|
-
types: [Script.Script, Operation.PersistentOperation,
|
|
53
|
+
types: [Script.Script, Operation.PersistentOperation, Skill.Skill, Text.Text],
|
|
54
54
|
onClientInitialized: ({ client }) =>
|
|
55
55
|
Effect.gen(function* () {
|
|
56
56
|
yield* initializeIdentity(client);
|
|
@@ -67,7 +67,7 @@ const meta = {
|
|
|
67
67
|
layout: 'fullscreen',
|
|
68
68
|
translations,
|
|
69
69
|
},
|
|
70
|
-
} satisfies Meta<
|
|
70
|
+
} satisfies Meta<StoryArgs>;
|
|
71
71
|
|
|
72
72
|
export default meta;
|
|
73
73
|
|
|
@@ -8,9 +8,9 @@ import { type AppSurface } from '@dxos/app-toolkit/ui';
|
|
|
8
8
|
import { type Script } from '@dxos/compute';
|
|
9
9
|
import { Form } from '@dxos/react-ui-form';
|
|
10
10
|
|
|
11
|
-
import { BlueprintEditor } from './BlueprintEditor';
|
|
12
11
|
import { FunctionBinding } from './FunctionBinding';
|
|
13
12
|
import { FunctionPublishing } from './FunctionPublishing';
|
|
13
|
+
import { SkillEditor } from './SkillEditor';
|
|
14
14
|
|
|
15
15
|
export type ScriptPropertiesProps = AppSurface.ObjectPropertiesProps<Script.Script>;
|
|
16
16
|
|
|
@@ -21,7 +21,7 @@ export const ScriptProperties = ({ subject: object }: ScriptPropertiesProps) =>
|
|
|
21
21
|
<FunctionBinding object={object} />
|
|
22
22
|
</Form.Section>
|
|
23
23
|
<Form.Section>
|
|
24
|
-
<
|
|
24
|
+
<SkillEditor object={object} />
|
|
25
25
|
</Form.Section>
|
|
26
26
|
<Form.Section>
|
|
27
27
|
<FunctionPublishing object={object} />
|