@dxos/plugin-script 0.12.0-next-73daef452f1464b62efdbca75fb0067c1066f264 → 0.13.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 +93 -17
- package/README.md +1 -1
- package/dist/lib/Notebook.mjs +4 -5
- package/dist/lib/Notebook.mjs.map +1 -1
- package/dist/lib/ScriptCapabilities.mjs.map +1 -1
- package/dist/lib/ScriptOperation.mjs +1 -1
- package/dist/lib/ScriptOperation.mjs.map +1 -1
- package/dist/lib/ScriptOperationHandlerSet.mjs.map +1 -1
- package/dist/lib/ScriptSkill.mjs +1 -1
- package/dist/lib/ScriptSkill.mjs.map +1 -1
- package/dist/lib/capabilities.browser.mjs +51 -0
- package/dist/lib/capabilities.browser.mjs.map +1 -0
- package/dist/lib/capabilities.mjs +17 -7
- package/dist/lib/capabilities.mjs.map +1 -1
- package/dist/lib/capabilities.node.mjs +16 -4
- package/dist/lib/capabilities.node.mjs.map +1 -1
- package/dist/lib/capabilities.tauri.mjs +51 -0
- package/dist/lib/capabilities.tauri.mjs.map +1 -0
- package/dist/lib/capabilities.workerd.mjs +1 -1
- package/dist/lib/capabilities.workerd.mjs.map +1 -1
- package/dist/lib/chunk-DeploymentDialog.mjs +12 -9
- package/dist/lib/chunk-DeploymentDialog.mjs.map +1 -1
- package/dist/lib/chunk-NotebookArticle.mjs +37 -36
- package/dist/lib/chunk-NotebookArticle.mjs.map +1 -1
- package/dist/lib/chunk-PLUGIN.mjs +6 -0
- package/dist/lib/chunk-PLUGIN.mjs.map +1 -0
- package/dist/lib/chunk-ScriptArticle.mjs +14 -15
- package/dist/lib/chunk-ScriptArticle.mjs.map +1 -1
- package/dist/lib/chunk-ScriptProperties.mjs +91 -94
- package/dist/lib/chunk-ScriptProperties.mjs.map +1 -1
- package/dist/lib/chunk-ScriptSettings.mjs +11 -8
- package/dist/lib/chunk-ScriptSettings.mjs.map +1 -1
- package/dist/lib/chunk-TestContainer.mjs +5 -5
- package/dist/lib/chunk-TestContainer.mjs.map +1 -1
- package/dist/lib/chunk-app-graph-builder.mjs +2 -0
- package/dist/lib/chunk-app-graph-builder.mjs.map +1 -1
- package/dist/lib/chunk-compiler.mjs +87 -4
- package/dist/lib/chunk-compiler.mjs.map +1 -1
- package/dist/lib/chunk-create-object.mjs +1 -1
- package/dist/lib/chunk-create-script.mjs.map +1 -1
- package/dist/lib/chunk-create.mjs +4 -4
- package/dist/lib/chunk-create.mjs.map +1 -1
- package/dist/lib/chunk-definitions.mjs +246 -0
- package/dist/lib/chunk-definitions.mjs.map +1 -0
- package/dist/lib/chunk-delete.mjs +2 -2
- package/dist/lib/chunk-delete.mjs.map +1 -1
- package/dist/lib/chunk-deploy.mjs +16 -12
- package/dist/lib/chunk-deploy.mjs.map +1 -1
- package/dist/lib/chunk-errors.mjs +8 -0
- package/dist/lib/chunk-errors.mjs.map +1 -0
- package/dist/lib/chunk-functions.mjs +66 -246
- package/dist/lib/chunk-functions.mjs.map +1 -1
- package/dist/lib/chunk-inspect-invocations.mjs +3 -3
- package/dist/lib/chunk-inspect-invocations.mjs.map +1 -1
- package/dist/lib/chunk-install-function.mjs +11 -11
- package/dist/lib/chunk-install-function.mjs.map +1 -1
- package/dist/lib/chunk-invoke.mjs +6 -6
- package/dist/lib/chunk-invoke.mjs.map +1 -1
- package/dist/lib/chunk-operation-handler.mjs +16 -2
- package/dist/lib/chunk-operation-handler.mjs.map +1 -1
- package/dist/lib/chunk-query-deployed-functions.mjs +5 -6
- package/dist/lib/chunk-query-deployed-functions.mjs.map +1 -1
- package/dist/lib/chunk-react-surface.mjs +14 -10
- package/dist/lib/chunk-react-surface.mjs.map +1 -1
- package/dist/lib/chunk-read.mjs +4 -3
- package/dist/lib/chunk-read.mjs.map +1 -1
- package/dist/lib/chunk-settings.mjs +2 -2
- package/dist/lib/chunk-settings.mjs.map +1 -1
- package/dist/lib/chunk-skill-definition.mjs +1 -1
- package/dist/lib/chunk-templates.mjs +3 -3
- package/dist/lib/chunk-update.mjs +4 -3
- package/dist/lib/chunk-update.mjs.map +1 -1
- package/dist/lib/components.mjs +114 -123
- package/dist/lib/components.mjs.map +1 -1
- package/dist/lib/containers.mjs.map +1 -1
- package/dist/lib/hooks.mjs +96 -16
- package/dist/lib/hooks.mjs.map +1 -1
- package/dist/lib/index.mjs +5 -3
- package/dist/lib/meta.mjs.map +1 -1
- package/dist/lib/ns/ScriptFunction.mjs +12 -0
- package/dist/lib/ns/ScriptFunction.mjs.map +1 -0
- package/dist/lib/ns/Templates.mjs +11 -0
- package/dist/lib/ns/Templates.mjs.map +1 -0
- package/dist/lib/testing.mjs +1 -1
- package/dist/lib/translations.mjs +2 -1
- package/dist/lib/translations.mjs.map +1 -1
- package/dist/types/src/ScriptFunction.d.ts +2 -0
- package/dist/types/src/ScriptFunction.d.ts.map +1 -0
- package/dist/types/src/Templates.d.ts +2 -0
- package/dist/types/src/Templates.d.ts.map +1 -0
- package/dist/types/src/capabilities/ScriptSurfaces.d.ts.map +1 -1
- package/dist/types/src/capabilities/compiler.d.ts +2 -1
- package/dist/types/src/capabilities/compiler.d.ts.map +1 -1
- package/dist/types/src/capabilities/errors.d.ts +33 -0
- package/dist/types/src/capabilities/errors.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/browser.d.ts +12 -0
- package/dist/types/src/capabilities/gen/browser.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/node.d.ts.map +1 -1
- package/dist/types/src/capabilities/gen/tauri.d.ts +12 -0
- package/dist/types/src/capabilities/gen/tauri.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/workerd.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/compiler/index.d.ts +1 -1
- package/dist/types/src/compiler/index.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts +3 -3
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookMenu.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts +4 -4
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts +10 -0
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/index.d.ts +2 -2
- package/dist/types/src/components/NotebookStack/index.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts +2 -2
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +10 -0
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/index.d.ts +1 -1
- package/dist/types/src/components/ScriptToolbar/index.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/TestPanel.d.ts +2 -2
- package/dist/types/src/components/TestPanel/TestPanel.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/index.d.ts +1 -1
- package/dist/types/src/components/TestPanel/index.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts +2 -2
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/index.d.ts +1 -1
- package/dist/types/src/components/TypescriptEditor/index.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -5
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.d.ts +1 -1
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.d.ts.map +1 -1
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts +10 -0
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts.map +1 -1
- package/dist/types/src/containers/DeploymentDialog/index.d.ts +1 -1
- package/dist/types/src/containers/DeploymentDialog/index.d.ts.map +1 -1
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.d.ts +1 -1
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.d.ts.map +1 -1
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.stories.d.ts +1 -1
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.stories.d.ts.map +1 -1
- package/dist/types/src/containers/NotebookArticle/index.d.ts +1 -1
- package/dist/types/src/containers/NotebookArticle/index.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.d.ts +1 -1
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.stories.d.ts +10 -0
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.stories.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptArticle/index.d.ts +1 -1
- package/dist/types/src/containers/ScriptArticle/index.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptProperties/FunctionBinding.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptProperties/FunctionPublishing.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts +1 -1
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.stories.d.ts +10 -0
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.stories.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptProperties/SkillEditor.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptProperties/index.d.ts +1 -1
- package/dist/types/src/containers/ScriptProperties/index.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptSettings/ScriptSettings.d.ts +2 -2
- package/dist/types/src/containers/ScriptSettings/ScriptSettings.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptSettings/ScriptSettings.stories.d.ts +11 -1
- package/dist/types/src/containers/ScriptSettings/ScriptSettings.stories.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptSettings/index.d.ts +1 -1
- package/dist/types/src/containers/ScriptSettings/index.d.ts.map +1 -1
- package/dist/types/src/containers/TestContainer/index.d.ts +1 -1
- package/dist/types/src/containers/TestContainer/index.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/hooks/deploy.d.ts +3 -3
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +6 -6
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useCompiler.d.ts +1 -1
- package/dist/types/src/hooks/useCompiler.d.ts.map +1 -1
- package/dist/types/src/hooks/useCreateAndDeployScriptTemplates.d.ts +1 -1
- package/dist/types/src/hooks/useCreateAndDeployScriptTemplates.d.ts.map +1 -1
- package/dist/types/src/hooks/useToolbarState.d.ts +2 -2
- package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +5 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/notebook/compute-graph.d.ts +3 -3
- package/dist/types/src/notebook/compute-graph.d.ts.map +1 -1
- package/dist/types/src/notebook/index.d.ts +1 -1
- package/dist/types/src/notebook/index.d.ts.map +1 -1
- package/dist/types/src/operations/ScriptOperationHandlerSet.d.ts.map +1 -1
- package/dist/types/src/operations/index.d.ts +1 -1
- package/dist/types/src/operations/index.d.ts.map +1 -1
- package/dist/types/src/skills/ScriptSkill.d.ts.map +1 -1
- package/dist/types/src/skills/functions/definitions.d.ts +8 -6
- package/dist/types/src/skills/functions/definitions.d.ts.map +1 -1
- package/dist/types/src/skills/functions/deploy.d.ts +4 -2
- package/dist/types/src/skills/functions/deploy.d.ts.map +1 -1
- package/dist/types/src/skills/functions/errors.d.ts +33 -0
- package/dist/types/src/skills/functions/errors.d.ts.map +1 -0
- package/dist/types/src/skills/functions/index.d.ts +1 -1
- package/dist/types/src/skills/functions/index.d.ts.map +1 -1
- package/dist/types/src/skills/functions/install-function.d.ts +3 -2
- package/dist/types/src/skills/functions/install-function.d.ts.map +1 -1
- package/dist/types/src/skills/functions/invoke.d.ts +2 -2
- package/dist/types/src/skills/functions/invoke.d.ts.map +1 -1
- package/dist/types/src/skills/functions/query-deployed-functions.d.ts +2 -2
- package/dist/types/src/skills/functions/query-deployed-functions.d.ts.map +1 -1
- package/dist/types/src/skills/index.d.ts +1 -1
- package/dist/types/src/skills/index.d.ts.map +1 -1
- package/dist/types/src/templates/forex-effect.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +2 -2
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +10 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Notebook.d.ts.map +1 -1
- package/dist/types/src/types/ScriptCapabilities.d.ts +3 -3
- package/dist/types/src/types/ScriptCapabilities.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +5 -5
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/util/deploy.d.ts +6 -3
- package/dist/types/src/util/deploy.d.ts.map +1 -1
- package/dist/types/src/util/functions.d.ts +1 -1
- package/dist/types/src/util/functions.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +2 -2
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +106 -96
- package/src/ScriptFunction.ts +7 -0
- package/src/Templates.ts +7 -0
- package/src/capabilities/ScriptSurfaces.tsx +19 -10
- package/src/capabilities/app-graph-builder.ts +2 -0
- package/src/capabilities/compiler.ts +6 -5
- package/src/capabilities/errors.ts +8 -0
- package/src/capabilities/gen/browser.ts +62 -0
- package/src/capabilities/gen/node.ts +10 -10
- package/src/capabilities/gen/tauri.ts +62 -0
- package/src/capabilities/gen/workerd.ts +4 -4
- package/src/capabilities/index.ts +11 -11
- package/src/capabilities/operation-handler.ts +1 -1
- package/src/capabilities/react-surface.ts +4 -4
- package/src/capabilities/settings.ts +2 -2
- package/src/compiler/compiler.browser.test.ts +1 -1
- package/src/compiler/index.ts +1 -1
- package/src/components/NotebookStack/NotebookCell.tsx +35 -29
- package/src/components/NotebookStack/NotebookMenu.tsx +27 -26
- package/src/components/NotebookStack/NotebookStack.stories.tsx +3 -3
- package/src/components/NotebookStack/NotebookStack.tsx +20 -17
- package/src/components/NotebookStack/index.ts +2 -2
- package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +5 -5
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +14 -15
- package/src/components/ScriptToolbar/index.ts +1 -1
- package/src/components/TestPanel/TestPanel.tsx +29 -23
- package/src/components/TestPanel/index.ts +1 -1
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +10 -8
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +11 -7
- package/src/components/TypescriptEditor/index.ts +1 -1
- package/src/components/index.ts +4 -5
- package/src/containers/DeploymentDialog/DeploymentDialog.stories.tsx +5 -7
- package/src/containers/DeploymentDialog/DeploymentDialog.tsx +18 -15
- package/src/containers/DeploymentDialog/index.ts +1 -1
- package/src/containers/NotebookArticle/NotebookArticle.stories.tsx +6 -6
- package/src/containers/NotebookArticle/NotebookArticle.tsx +25 -21
- package/src/containers/NotebookArticle/index.ts +1 -1
- package/src/containers/ScriptArticle/ScriptArticle.stories.tsx +3 -3
- package/src/containers/ScriptArticle/ScriptArticle.tsx +13 -11
- package/src/containers/ScriptArticle/index.ts +1 -1
- package/src/containers/ScriptProperties/FunctionBinding.tsx +18 -18
- package/src/containers/ScriptProperties/FunctionPublishing.tsx +22 -22
- package/src/containers/ScriptProperties/ScriptProperties.stories.tsx +3 -3
- package/src/containers/ScriptProperties/ScriptProperties.tsx +10 -10
- package/src/containers/ScriptProperties/SkillEditor.tsx +16 -14
- package/src/containers/ScriptProperties/index.ts +1 -1
- package/src/containers/ScriptSettings/ScriptSettings.stories.tsx +1 -1
- package/src/containers/ScriptSettings/ScriptSettings.tsx +16 -11
- package/src/containers/ScriptSettings/index.ts +1 -1
- package/src/containers/TestContainer/TestContainer.tsx +4 -4
- package/src/containers/TestContainer/index.ts +1 -1
- package/src/containers/index.ts +6 -6
- package/src/e2e/ai.test.ts +1 -1
- package/src/hooks/deploy.ts +12 -5
- package/src/hooks/index.ts +6 -6
- package/src/hooks/template.ts +1 -1
- package/src/hooks/useCompiler.ts +8 -7
- package/src/hooks/useCreateAndDeployScriptTemplates.ts +10 -5
- package/src/hooks/useToolbarState.ts +4 -4
- package/src/index.ts +5 -3
- package/src/meta.ts +1 -1
- package/src/notebook/compute-graph.test.ts +2 -2
- package/src/notebook/compute-graph.ts +4 -4
- package/src/notebook/index.ts +1 -1
- package/src/notebook/vfs-parser.test.ts +1 -1
- package/src/notebook/vfs-parser.ts +1 -1
- package/src/operations/ScriptOperationHandlerSet.ts +3 -1
- package/src/operations/create-script.ts +1 -1
- package/src/operations/index.ts +1 -1
- package/src/plugin.test.ts +2 -2
- package/src/skills/ScriptSkill.ts +3 -1
- package/src/skills/functions/create.ts +4 -4
- package/src/skills/functions/definitions.ts +8 -6
- package/src/skills/functions/delete.ts +1 -1
- package/src/skills/functions/deploy.ts +13 -9
- package/src/skills/functions/errors.ts +8 -0
- package/src/skills/functions/index.ts +11 -11
- package/src/skills/functions/inspect-invocations.ts +1 -1
- package/src/skills/functions/install-function.ts +11 -14
- package/src/skills/functions/invoke.ts +5 -5
- package/src/skills/functions/query-deployed-functions.ts +3 -4
- package/src/skills/functions/read.ts +3 -2
- package/src/skills/functions/update.ts +3 -2
- package/src/skills/index.ts +1 -1
- package/src/templates/anthropic.ts +2 -2
- package/src/templates/commentary.ts +1 -1
- package/src/templates/forex-effect.ts +7 -4
- package/src/testing/index.ts +2 -2
- package/src/translations.ts +4 -2
- package/src/types/Notebook.ts +6 -4
- package/src/types/ScriptCapabilities.ts +3 -3
- package/src/types/ScriptOperation.ts +1 -1
- package/src/types/index.ts +5 -5
- package/src/util/deploy.ts +10 -7
- package/src/util/functions.ts +24 -15
- package/src/util/index.ts +2 -2
- package/dist/lib/chunk-compiler2.mjs +0 -76
- package/dist/lib/chunk-compiler2.mjs.map +0 -1
- package/dist/lib/chunk-util.mjs +0 -146
- package/dist/lib/chunk-util.mjs.map +0 -1
- package/dist/types/src/components/QueryEditor/QueryEditor.d.ts +0 -5
- package/dist/types/src/components/QueryEditor/QueryEditor.d.ts.map +0 -1
- package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts +0 -14
- package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/QueryEditor/index.d.ts +0 -2
- package/dist/types/src/components/QueryEditor/index.d.ts.map +0 -1
- package/src/components/QueryEditor/QueryEditor.stories.tsx +0 -91
- package/src/components/QueryEditor/QueryEditor.tsx +0 -50
- package/src/components/QueryEditor/index.ts +0 -5
|
@@ -5,9 +5,17 @@
|
|
|
5
5
|
import React, { forwardRef, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { log } from '@dxos/log';
|
|
8
|
-
import { Avatar, Icon, Input, ScrollArea, type ThemedClassName, Toolbar, useTranslation } from '@dxos/react-ui';
|
|
9
|
-
import { composable, composableProps } from '@dxos/react-ui';
|
|
10
8
|
import { JsonHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
9
|
+
import * as Avatar from '@dxos/react-ui/Avatar';
|
|
10
|
+
import * as Button from '@dxos/react-ui/Button';
|
|
11
|
+
import * as Field from '@dxos/react-ui/Field';
|
|
12
|
+
import * as Hooks from '@dxos/react-ui/Hooks';
|
|
13
|
+
import * as Icon from '@dxos/react-ui/Icon';
|
|
14
|
+
import * as Input from '@dxos/react-ui/Input';
|
|
15
|
+
import * as Layout from '@dxos/react-ui/Layout';
|
|
16
|
+
import * as ScrollArea from '@dxos/react-ui/ScrollArea';
|
|
17
|
+
import * as Toolbar from '@dxos/react-ui/Toolbar';
|
|
18
|
+
import * as Util from '@dxos/react-ui/Util';
|
|
11
19
|
import { mx } from '@dxos/ui-theme';
|
|
12
20
|
|
|
13
21
|
import { meta } from '#meta';
|
|
@@ -24,14 +32,14 @@ type Message = {
|
|
|
24
32
|
error?: Error;
|
|
25
33
|
};
|
|
26
34
|
|
|
27
|
-
export type TestPanelProps = ThemedClassName<{
|
|
35
|
+
export type TestPanelProps = Util.ThemedClassName<{
|
|
28
36
|
onInvoke?: (input: unknown) => Promise<unknown>;
|
|
29
37
|
}>;
|
|
30
38
|
|
|
31
39
|
// TODO(burdon): Need persistent history (currently lost when switching tabs).
|
|
32
|
-
export const TestPanel = composable<HTMLDivElement, TestPanelProps>(
|
|
40
|
+
export const TestPanel = Util.composable<HTMLDivElement, TestPanelProps>(
|
|
33
41
|
({ classNames, onInvoke, ...props }, forwardedRef) => {
|
|
34
|
-
const { t } = useTranslation(meta.profile.key);
|
|
42
|
+
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
35
43
|
|
|
36
44
|
const inputRef = useRef<HTMLInputElement>(null);
|
|
37
45
|
const [input, setInput] = useState('');
|
|
@@ -108,15 +116,15 @@ export const TestPanel = composable<HTMLDivElement, TestPanelProps>(
|
|
|
108
116
|
|
|
109
117
|
return (
|
|
110
118
|
<div
|
|
111
|
-
{...composableProps(props, { classNames: ['flex flex-col h-full overflow-hidden', classNames] })}
|
|
119
|
+
{...Util.composableProps(props, { classNames: ['flex flex-col h-full overflow-hidden', classNames] })}
|
|
112
120
|
ref={forwardedRef}
|
|
113
121
|
>
|
|
114
122
|
{/* TODO(burdon): Replace with Thread. */}
|
|
115
123
|
<MessageThread ref={scrollerRef} state={state} history={history} />
|
|
116
124
|
{/* TODO(burdon): Replace with Form based on the function's input schema. */}
|
|
117
125
|
<Toolbar.Root>
|
|
118
|
-
<
|
|
119
|
-
<Input.
|
|
126
|
+
<Field.Root>
|
|
127
|
+
<Input.Root
|
|
120
128
|
ref={inputRef}
|
|
121
129
|
autoFocus
|
|
122
130
|
placeholder={t('function-request.placeholder')}
|
|
@@ -124,9 +132,9 @@ export const TestPanel = composable<HTMLDivElement, TestPanelProps>(
|
|
|
124
132
|
onChange={(ev) => setInput(ev.target.value)}
|
|
125
133
|
onKeyDown={(ev) => ev.key === 'Enter' && handleRequest(input)}
|
|
126
134
|
/>
|
|
127
|
-
</
|
|
128
|
-
<
|
|
129
|
-
<
|
|
135
|
+
</Field.Root>
|
|
136
|
+
<Button.Root icon='ph--play--regular' label='Execute' iconOnly onClick={() => handleRequest(input)} />
|
|
137
|
+
<Button.Root icon='ph--trash--regular' label='Clear' iconOnly onClick={handleClear} />
|
|
130
138
|
</Toolbar.Root>
|
|
131
139
|
</div>
|
|
132
140
|
);
|
|
@@ -140,26 +148,28 @@ type MessageThreadProps = {
|
|
|
140
148
|
history: Message[];
|
|
141
149
|
};
|
|
142
150
|
|
|
151
|
+
const MESSAGE_COLS = ['var(--dx-rail-item)', 'fill', 'var(--dx-rail-item)'] as const;
|
|
152
|
+
|
|
143
153
|
const MessageThread = forwardRef<HTMLDivElement, MessageThreadProps>(
|
|
144
154
|
({ state, history }: MessageThreadProps, forwardedRef) => {
|
|
145
155
|
return (
|
|
146
156
|
<ScrollArea.Root orientation='vertical' classNames='h-full' ref={forwardedRef}>
|
|
147
157
|
<ScrollArea.Viewport classNames='gap-6 p-2'>
|
|
148
158
|
{history.map((message, i) => (
|
|
149
|
-
<
|
|
159
|
+
<Layout.Grid key={i} cols={MESSAGE_COLS}>
|
|
150
160
|
<div className='p-1'>{message.type === 'response' && <RobotAvatar />}</div>
|
|
151
161
|
<div className='overflow-auto'>
|
|
152
162
|
<MessageItem message={message} />
|
|
153
163
|
</div>
|
|
154
|
-
</
|
|
164
|
+
</Layout.Grid>
|
|
155
165
|
))}
|
|
156
166
|
|
|
157
167
|
{state === 'pending' && (
|
|
158
|
-
<
|
|
168
|
+
<Layout.Grid cols={MESSAGE_COLS}>
|
|
159
169
|
<div className='p-1'>
|
|
160
|
-
<Icon icon='ph--spinner--regular' size=
|
|
170
|
+
<Icon.Icon icon='ph--spinner--regular' size='xl' spin />
|
|
161
171
|
</div>
|
|
162
|
-
</
|
|
172
|
+
</Layout.Grid>
|
|
163
173
|
)}
|
|
164
174
|
</ScrollArea.Viewport>
|
|
165
175
|
</ScrollArea.Root>
|
|
@@ -167,9 +177,9 @@ const MessageThread = forwardRef<HTMLDivElement, MessageThreadProps>(
|
|
|
167
177
|
},
|
|
168
178
|
);
|
|
169
179
|
|
|
170
|
-
const MessageItem = ({ classNames, message }: ThemedClassName<{ message: Message }>) => {
|
|
180
|
+
const MessageItem = ({ classNames, message }: Util.ThemedClassName<{ message: Message }>) => {
|
|
171
181
|
const { type, text, data, error } = message;
|
|
172
|
-
const wrapper = 'p-1 px-2 rounded-md bg-hover-surface
|
|
182
|
+
const wrapper = 'p-1 px-2 rounded-md bg-hover-surface';
|
|
173
183
|
return (
|
|
174
184
|
<div className={mx('flex', type === 'request' ? 'ml-[1rem] justify-end' : 'mr-[1rem]', classNames)}>
|
|
175
185
|
{error && <div className={mx(wrapper, 'whitespace-pre text-error-text')}>{String(error)}</div>}
|
|
@@ -185,8 +195,4 @@ const MessageItem = ({ classNames, message }: ThemedClassName<{ message: Message
|
|
|
185
195
|
);
|
|
186
196
|
};
|
|
187
197
|
|
|
188
|
-
const RobotAvatar = () =>
|
|
189
|
-
<Avatar.Root>
|
|
190
|
-
<Avatar.Content size={6} variant='circle' icon='ph--drone--regular' />
|
|
191
|
-
</Avatar.Root>
|
|
192
|
-
);
|
|
198
|
+
const RobotAvatar = () => <Avatar.Root size='sm' variant='circle' icon='ph--drone--regular' />;
|
|
@@ -7,13 +7,15 @@ import React, { useCallback, useMemo, useState } from 'react';
|
|
|
7
7
|
|
|
8
8
|
import { Doc } from '@dxos/echo-doc';
|
|
9
9
|
import { createObject } from '@dxos/react-client/echo';
|
|
10
|
-
import { Panel, Toolbar } from '@dxos/react-ui';
|
|
11
10
|
import { JsonHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
11
|
+
import * as Button from '@dxos/react-ui/Button';
|
|
12
|
+
import * as Panel from '@dxos/react-ui/Panel';
|
|
12
13
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
14
|
+
import * as Toolbar from '@dxos/react-ui/Toolbar';
|
|
13
15
|
import { createDataExtensions } from '@dxos/ui-editor';
|
|
14
16
|
import { trim } from '@dxos/util';
|
|
15
17
|
|
|
16
|
-
import { TypescriptEditor, type TypescriptEditorProps } from './TypescriptEditor';
|
|
18
|
+
import { TypescriptEditor, type TypescriptEditorProps } from './TypescriptEditor.tsx';
|
|
17
19
|
|
|
18
20
|
const SCRIPT = trim`
|
|
19
21
|
x * 2
|
|
@@ -66,17 +68,17 @@ const DefaultStory = (props: TypescriptEditorProps) => {
|
|
|
66
68
|
|
|
67
69
|
return (
|
|
68
70
|
<Panel.Root>
|
|
69
|
-
<Panel.
|
|
71
|
+
<Panel.Header>
|
|
70
72
|
<Toolbar.Root>
|
|
71
|
-
<
|
|
73
|
+
<Button.Root onClick={handleRun}>Run</Button.Root>
|
|
72
74
|
</Toolbar.Root>
|
|
73
|
-
</Panel.
|
|
74
|
-
<Panel.
|
|
75
|
+
</Panel.Header>
|
|
76
|
+
<Panel.Body>
|
|
75
77
|
<div className='grid grid-rows-[1fr_min-content] h-full overflow-hidden text-sm'>
|
|
76
78
|
<TypescriptEditor {...props} initialValue={object.content} extensions={extensions} />
|
|
77
|
-
<JsonHighlighter data={result} classNames='shrink-0 p-2 border-y border-
|
|
79
|
+
<JsonHighlighter data={result} classNames='shrink-0 p-2 border-y border-separator-subtle' />
|
|
78
80
|
</div>
|
|
79
|
-
</Panel.
|
|
81
|
+
</Panel.Body>
|
|
80
82
|
</Panel.Root>
|
|
81
83
|
);
|
|
82
84
|
};
|
|
@@ -9,15 +9,15 @@ import { lintKeymap } from '@codemirror/lint';
|
|
|
9
9
|
import { Prec } from '@codemirror/state';
|
|
10
10
|
import { keymap } from '@codemirror/view';
|
|
11
11
|
import { tags } from '@lezer/highlight';
|
|
12
|
-
import { composeRefs } from '@radix-ui/react-compose-refs';
|
|
13
12
|
import { type VirtualTypeScriptEnvironment } from '@typescript/vfs';
|
|
14
13
|
import { continueKeymap } from '@valtown/codemirror-continue';
|
|
15
14
|
import { type HoverInfo, tsAutocomplete, tsFacet, tsHover, tsLinter, tsSync } from '@valtown/codemirror-ts';
|
|
16
15
|
import React from 'react';
|
|
17
16
|
|
|
18
|
-
import {
|
|
19
|
-
import { composable, composableProps } from '@dxos/react-ui';
|
|
17
|
+
import { composeRefs } from '@dxos/react-hooks';
|
|
20
18
|
import { type UseTextEditorProps, useTextEditor } from '@dxos/react-ui-editor';
|
|
19
|
+
import * as Hooks from '@dxos/react-ui/Hooks';
|
|
20
|
+
import * as Util from '@dxos/react-ui/Util';
|
|
21
21
|
import { Domino } from '@dxos/ui';
|
|
22
22
|
import {
|
|
23
23
|
type BasicExtensionsOptions,
|
|
@@ -27,9 +27,10 @@ import {
|
|
|
27
27
|
defaultStyles,
|
|
28
28
|
} from '@dxos/ui-editor';
|
|
29
29
|
import { type EditorInputMode } from '@dxos/ui-editor/types';
|
|
30
|
+
import { type ThemeMode } from '@dxos/ui-types';
|
|
30
31
|
import { isNonNullable } from '@dxos/util';
|
|
31
32
|
|
|
32
|
-
export type TypescriptEditorProps = ThemedClassName<
|
|
33
|
+
export type TypescriptEditorProps = Util.ThemedClassName<
|
|
33
34
|
{
|
|
34
35
|
id: string;
|
|
35
36
|
role?: string;
|
|
@@ -40,7 +41,7 @@ export type TypescriptEditorProps = ThemedClassName<
|
|
|
40
41
|
} & Pick<UseTextEditorProps, 'initialValue' | 'extensions' | 'scrollTo' | 'selection'>
|
|
41
42
|
>;
|
|
42
43
|
|
|
43
|
-
export const TypescriptEditor = composable<HTMLDivElement, TypescriptEditorProps>(
|
|
44
|
+
export const TypescriptEditor = Util.composable<HTMLDivElement, TypescriptEditorProps>(
|
|
44
45
|
(
|
|
45
46
|
{
|
|
46
47
|
classNames,
|
|
@@ -57,7 +58,7 @@ export const TypescriptEditor = composable<HTMLDivElement, TypescriptEditorProps
|
|
|
57
58
|
},
|
|
58
59
|
forwardedRef,
|
|
59
60
|
) => {
|
|
60
|
-
const
|
|
61
|
+
const themeMode = Hooks.useThemeMode();
|
|
61
62
|
const { parentRef, focusAttributes } = useTextEditor(
|
|
62
63
|
() => ({
|
|
63
64
|
id,
|
|
@@ -104,7 +105,10 @@ export const TypescriptEditor = composable<HTMLDivElement, TypescriptEditorProps
|
|
|
104
105
|
);
|
|
105
106
|
|
|
106
107
|
return (
|
|
107
|
-
<div
|
|
108
|
+
<div
|
|
109
|
+
{...Util.composableProps(props, { classNames, ...focusAttributes })}
|
|
110
|
+
ref={composeRefs(parentRef, forwardedRef)}
|
|
111
|
+
/>
|
|
108
112
|
);
|
|
109
113
|
},
|
|
110
114
|
);
|
package/src/components/index.ts
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export * from './NotebookStack';
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './TypescriptEditor';
|
|
5
|
+
export * from './NotebookStack/index.ts';
|
|
6
|
+
export * from './ScriptToolbar/index.ts';
|
|
7
|
+
export * from './TestPanel/index.ts';
|
|
8
|
+
export * from './TypescriptEditor/index.ts';
|
|
@@ -5,17 +5,17 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React, { useMemo } from 'react';
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import * as ProcessManagerPlugin from '@dxos/app-framework/ProcessManagerPlugin';
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
10
|
import { Obj } from '@dxos/echo';
|
|
11
11
|
import { AccessToken } from '@dxos/link';
|
|
12
12
|
import { ClientPlugin } from '@dxos/plugin-client/testing';
|
|
13
|
-
import
|
|
13
|
+
import * as Dialog from '@dxos/react-ui/Dialog';
|
|
14
14
|
import { withTheme } from '@dxos/react-ui/testing';
|
|
15
15
|
|
|
16
16
|
import { translations } from '#translations';
|
|
17
17
|
|
|
18
|
-
import { DeploymentDialog } from './DeploymentDialog';
|
|
18
|
+
import { DeploymentDialog } from './DeploymentDialog.tsx';
|
|
19
19
|
|
|
20
20
|
const DeploymentDialogStory = () => {
|
|
21
21
|
const accessToken = useMemo(
|
|
@@ -36,9 +36,7 @@ const DeploymentDialogStory = () => {
|
|
|
36
36
|
);
|
|
37
37
|
return (
|
|
38
38
|
<Dialog.Root defaultOpen={true}>
|
|
39
|
-
<
|
|
40
|
-
<DeploymentDialog accessToken={accessToken} scriptTemplates={scriptTemplates} />
|
|
41
|
-
</Dialog.Overlay>
|
|
39
|
+
<DeploymentDialog accessToken={accessToken} scriptTemplates={scriptTemplates} />
|
|
42
40
|
</Dialog.Root>
|
|
43
41
|
);
|
|
44
42
|
};
|
|
@@ -51,7 +49,7 @@ const meta = {
|
|
|
51
49
|
decorators: [
|
|
52
50
|
withTheme(),
|
|
53
51
|
withPluginManager({
|
|
54
|
-
plugins: [ProcessManagerPlugin(), ClientPlugin.make({})],
|
|
52
|
+
plugins: [ProcessManagerPlugin.make(), ClientPlugin.make({})],
|
|
55
53
|
}),
|
|
56
54
|
],
|
|
57
55
|
} satisfies Meta<typeof DeploymentDialogStory>;
|
|
@@ -4,16 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useEffect, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import * as Hooks from '@dxos/app-framework/Hooks';
|
|
8
8
|
import * as LayoutOperation from '@dxos/app-toolkit/LayoutOperation';
|
|
9
9
|
import { Obj } from '@dxos/echo';
|
|
10
10
|
import { type AccessToken } from '@dxos/link';
|
|
11
|
-
import
|
|
11
|
+
import * as Button from '@dxos/react-ui/Button';
|
|
12
|
+
import * as Dialog from '@dxos/react-ui/Dialog';
|
|
13
|
+
import * as UiHooks from '@dxos/react-ui/Hooks';
|
|
14
|
+
import * as SystemButton from '@dxos/react-ui/SystemButton';
|
|
12
15
|
|
|
13
16
|
import { useCreateAndDeployScriptTemplates } from '#hooks';
|
|
14
17
|
import { meta } from '#meta';
|
|
15
18
|
|
|
16
|
-
import { type Template } from '../../templates';
|
|
19
|
+
import { type Template } from '../../templates/index.ts';
|
|
17
20
|
|
|
18
21
|
// TODO(ZaymonFC):
|
|
19
22
|
// - Show activity and feedback to the user.
|
|
@@ -26,13 +29,13 @@ export type DeploymentDialogProps = {
|
|
|
26
29
|
};
|
|
27
30
|
|
|
28
31
|
export const DeploymentDialog = ({ accessToken, scriptTemplates }: DeploymentDialogProps) => {
|
|
29
|
-
const { t } = useTranslation(meta.profile.key);
|
|
32
|
+
const { t } = UiHooks.useTranslation(meta.profile.key);
|
|
30
33
|
const db = useMemo(() => Obj.getDatabase(accessToken), [accessToken]);
|
|
31
34
|
|
|
32
35
|
// TODO(ZaymonFC): Thinking further. All of this should get moved to intents to run async in the background.
|
|
33
36
|
// Deployment shouldn't be tied to the lifecycle of the dialogue component.
|
|
34
37
|
const { handleCreateAndDeployScripts, status } = useCreateAndDeployScriptTemplates(db, scriptTemplates);
|
|
35
|
-
const { invokePromise } = useOperationInvoker();
|
|
38
|
+
const { invokePromise } = Hooks.useOperationInvoker();
|
|
36
39
|
|
|
37
40
|
useEffect(() => {
|
|
38
41
|
if (status === 'success') {
|
|
@@ -70,9 +73,9 @@ export const DeploymentDialog = ({ accessToken, scriptTemplates }: DeploymentDia
|
|
|
70
73
|
<Dialog.Content>
|
|
71
74
|
<Dialog.Header>
|
|
72
75
|
<Dialog.Title>{t('deployment-dialog.title')}</Dialog.Title>
|
|
73
|
-
<Dialog.
|
|
74
|
-
<
|
|
75
|
-
</Dialog.
|
|
76
|
+
<Dialog.CloseTrigger asChild>
|
|
77
|
+
<SystemButton.Close />
|
|
78
|
+
</Dialog.CloseTrigger>
|
|
76
79
|
</Dialog.Header>
|
|
77
80
|
<Dialog.Body>
|
|
78
81
|
<p>
|
|
@@ -86,11 +89,11 @@ export const DeploymentDialog = ({ accessToken, scriptTemplates }: DeploymentDia
|
|
|
86
89
|
})}
|
|
87
90
|
</ul>
|
|
88
91
|
</Dialog.Body>
|
|
89
|
-
<Dialog.
|
|
90
|
-
<Dialog.
|
|
91
|
-
<Button disabled={status === 'pending'}>{t('deployment-dialog-skip-button.label')}</Button>
|
|
92
|
-
</Dialog.
|
|
93
|
-
<Button variant='primary' onClick={handleCreateAndDeployScripts} disabled={status === 'pending'}>
|
|
92
|
+
<Dialog.Footer>
|
|
93
|
+
<Dialog.CloseTrigger asChild>
|
|
94
|
+
<Button.Root disabled={status === 'pending'}>{t('deployment-dialog-skip-button.label')}</Button.Root>
|
|
95
|
+
</Dialog.CloseTrigger>
|
|
96
|
+
<Button.Root variant='primary' onClick={handleCreateAndDeployScripts} disabled={status === 'pending'}>
|
|
94
97
|
{status === 'pending'
|
|
95
98
|
? t('deployment-dialog-deploy-functions-pending-button.label', {
|
|
96
99
|
count: scriptTemplates.length,
|
|
@@ -98,8 +101,8 @@ export const DeploymentDialog = ({ accessToken, scriptTemplates }: DeploymentDia
|
|
|
98
101
|
: t('deployment-dialog-deploy-functions-button.label', {
|
|
99
102
|
count: scriptTemplates.length,
|
|
100
103
|
})}
|
|
101
|
-
</Button>
|
|
102
|
-
</Dialog.
|
|
104
|
+
</Button.Root>
|
|
105
|
+
</Dialog.Footer>
|
|
103
106
|
</Dialog.Content>
|
|
104
107
|
);
|
|
105
108
|
};
|
|
@@ -8,8 +8,8 @@ import React from 'react';
|
|
|
8
8
|
|
|
9
9
|
import { SERVICES_CONFIG } from '@dxos/ai/testing';
|
|
10
10
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
11
|
-
import
|
|
12
|
-
import
|
|
11
|
+
import * as AppSurface from '@dxos/app-toolkit/AppSurface';
|
|
12
|
+
import * as AgentOperation from '@dxos/assistant-toolkit/AgentOperation';
|
|
13
13
|
import * as Operation from '@dxos/compute/Operation';
|
|
14
14
|
import { Filter } from '@dxos/echo';
|
|
15
15
|
import { useQuery } from '@dxos/echo-react';
|
|
@@ -20,7 +20,7 @@ import { ExplorerPlugin } from '@dxos/plugin-explorer/testing';
|
|
|
20
20
|
import * as Markdown from '@dxos/plugin-markdown/Markdown';
|
|
21
21
|
import { MarkdownPlugin } from '@dxos/plugin-markdown/testing';
|
|
22
22
|
import { RoutinePlugin } from '@dxos/plugin-routine/testing';
|
|
23
|
-
import
|
|
23
|
+
import * as CorePlugins from '@dxos/plugin-testing/CorePlugins';
|
|
24
24
|
import { Config, useClient } from '@dxos/react-client';
|
|
25
25
|
import { withLayout } from '@dxos/react-ui/testing';
|
|
26
26
|
import { DataTypes } from '@dxos/schema';
|
|
@@ -29,7 +29,7 @@ import { createNotebook } from '#testing';
|
|
|
29
29
|
import { translations } from '#translations';
|
|
30
30
|
import { Notebook } from '#types';
|
|
31
31
|
|
|
32
|
-
import { NotebookArticle } from './NotebookArticle';
|
|
32
|
+
import { NotebookArticle } from './NotebookArticle.tsx';
|
|
33
33
|
|
|
34
34
|
const meta: Meta<typeof NotebookArticle> = {
|
|
35
35
|
title: 'plugins/plugin-script/containers/NotebookArticle',
|
|
@@ -44,7 +44,7 @@ const meta: Meta<typeof NotebookArticle> = {
|
|
|
44
44
|
withLayout({ layout: 'column', classNames: 'w-document-max-width' }),
|
|
45
45
|
withPluginManager({
|
|
46
46
|
plugins: [
|
|
47
|
-
...
|
|
47
|
+
...CorePlugins.make(),
|
|
48
48
|
ClientPlugin.make({
|
|
49
49
|
// TODO(wittjosiah): ComputeRuntime requires edge to be configured or it will throw.
|
|
50
50
|
config: new Config({
|
|
@@ -59,7 +59,7 @@ const meta: Meta<typeof NotebookArticle> = {
|
|
|
59
59
|
|
|
60
60
|
defaultSpace.db.add(createNotebook());
|
|
61
61
|
defaultSpace.db.add(Markdown.make({ content: '# Hello World' }));
|
|
62
|
-
defaultSpace.db.add(Operation.serialize(RunInstructions));
|
|
62
|
+
defaultSpace.db.add(Operation.serialize(AgentOperation.RunInstructions));
|
|
63
63
|
}),
|
|
64
64
|
}),
|
|
65
65
|
AssistantPlugin(),
|
|
@@ -9,9 +9,9 @@ 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
|
|
13
|
-
import
|
|
14
|
-
import
|
|
12
|
+
import * as Hooks from '@dxos/app-framework/Hooks';
|
|
13
|
+
import type * as AppSurface from '@dxos/app-toolkit/AppSurface';
|
|
14
|
+
import * as AgentOperation from '@dxos/assistant-toolkit/AgentOperation';
|
|
15
15
|
import * as Instructions from '@dxos/compute/Instructions';
|
|
16
16
|
import * as Operation from '@dxos/compute/Operation';
|
|
17
17
|
import * as Skill from '@dxos/compute/Skill';
|
|
@@ -20,8 +20,12 @@ import { QueryBuilder } from '@dxos/echo-query';
|
|
|
20
20
|
import { invariant } from '@dxos/invariant';
|
|
21
21
|
import { log } from '@dxos/log';
|
|
22
22
|
import * as Graph from '@dxos/plugin-explorer/Graph';
|
|
23
|
-
import { DropdownMenu, IconButton, Panel, Toolbar, useTranslation } from '@dxos/react-ui';
|
|
24
23
|
import { useAttention } from '@dxos/react-ui-attention';
|
|
24
|
+
import * as Button from '@dxos/react-ui/Button';
|
|
25
|
+
import * as UiHooks from '@dxos/react-ui/Hooks';
|
|
26
|
+
import * as Menu from '@dxos/react-ui/Menu';
|
|
27
|
+
import * as Panel from '@dxos/react-ui/Panel';
|
|
28
|
+
import * as Toolbar from '@dxos/react-ui/Toolbar';
|
|
25
29
|
import { Text, ViewModel } from '@dxos/schema';
|
|
26
30
|
import { isNonNullable } from '@dxos/util';
|
|
27
31
|
|
|
@@ -29,7 +33,7 @@ import { NotebookMenu, NotebookStack, type NotebookStackProps, type TypescriptEd
|
|
|
29
33
|
import { meta } from '#meta';
|
|
30
34
|
import { Notebook } from '#types';
|
|
31
35
|
|
|
32
|
-
import { ComputeGraph } from '../../notebook';
|
|
36
|
+
import { ComputeGraph } from '../../notebook/index.ts';
|
|
33
37
|
|
|
34
38
|
const INCLUDE_SKILLS = ['org.dxos.skill.assistant', 'org.dxos.skill.database', 'org.dxos.skill.markdown'];
|
|
35
39
|
|
|
@@ -38,7 +42,7 @@ const INCLUDE_SKILLS = ['org.dxos.skill.assistant', 'org.dxos.skill.database', '
|
|
|
38
42
|
export type NotebookArticleProps = AppSurface.ObjectArticleProps<Notebook.Notebook, Pick<TypescriptEditorProps, 'env'>>;
|
|
39
43
|
|
|
40
44
|
export const NotebookArticle = ({ role, subject: notebook, attendableId, env }: NotebookArticleProps) => {
|
|
41
|
-
const { t } = useTranslation(meta.profile.key);
|
|
45
|
+
const { t } = UiHooks.useTranslation(meta.profile.key);
|
|
42
46
|
const registry = useContext(RegistryContext);
|
|
43
47
|
const db = notebook ? Obj.getDatabase(notebook) : undefined;
|
|
44
48
|
const { hasAttention } = useAttention(attendableId);
|
|
@@ -90,7 +94,7 @@ export const NotebookArticle = ({ role, subject: notebook, attendableId, env }:
|
|
|
90
94
|
}, [db, notebook, graph]);
|
|
91
95
|
|
|
92
96
|
const [promptResults, setPromptResults] = useState<Record<string, string>>({});
|
|
93
|
-
const handleExecPrompts = useSpaceCallback(
|
|
97
|
+
const handleExecPrompts = Hooks.useSpaceCallback(
|
|
94
98
|
db?.spaceId,
|
|
95
99
|
[] as const,
|
|
96
100
|
Effect.fnUntraced(function* () {
|
|
@@ -174,16 +178,16 @@ export const NotebookArticle = ({ role, subject: notebook, attendableId, env }:
|
|
|
174
178
|
);
|
|
175
179
|
|
|
176
180
|
return (
|
|
177
|
-
<Panel.Root role={role}
|
|
178
|
-
<Panel.
|
|
179
|
-
<Toolbar.Root
|
|
180
|
-
<
|
|
181
|
-
<
|
|
182
|
-
<
|
|
183
|
-
</
|
|
181
|
+
<Panel.Root role={role} width='document'>
|
|
182
|
+
<Panel.Header>
|
|
183
|
+
<Toolbar.Root inactive={!hasAttention}>
|
|
184
|
+
<Menu.Root>
|
|
185
|
+
<Menu.Trigger asChild>
|
|
186
|
+
<Button.Root icon='ph--plus--regular' iconOnly label={t('notebook-cell-insert.label')} />
|
|
187
|
+
</Menu.Trigger>
|
|
184
188
|
<NotebookMenu onCellInsert={handleCellInsert} />
|
|
185
|
-
</
|
|
186
|
-
<
|
|
189
|
+
</Menu.Root>
|
|
190
|
+
<Button.Root
|
|
187
191
|
icon='ph--play--fill'
|
|
188
192
|
iconOnly
|
|
189
193
|
label={t('compute.label')}
|
|
@@ -191,8 +195,8 @@ export const NotebookArticle = ({ role, subject: notebook, attendableId, env }:
|
|
|
191
195
|
onClick={handleCompute}
|
|
192
196
|
/>
|
|
193
197
|
</Toolbar.Root>
|
|
194
|
-
</Panel.
|
|
195
|
-
<Panel.
|
|
198
|
+
</Panel.Header>
|
|
199
|
+
<Panel.Body asChild>
|
|
196
200
|
<NotebookStack
|
|
197
201
|
db={db}
|
|
198
202
|
notebook={notebook}
|
|
@@ -202,7 +206,7 @@ export const NotebookArticle = ({ role, subject: notebook, attendableId, env }:
|
|
|
202
206
|
onCellInsert={handleCellInsert}
|
|
203
207
|
onCellDelete={handleCellDelete}
|
|
204
208
|
/>
|
|
205
|
-
</Panel.
|
|
209
|
+
</Panel.Body>
|
|
206
210
|
</Panel.Root>
|
|
207
211
|
);
|
|
208
212
|
};
|
|
@@ -217,9 +221,9 @@ const runPrompt = Effect.fn(function* ({
|
|
|
217
221
|
input: Record<string, any>;
|
|
218
222
|
onResult: (result: string) => void;
|
|
219
223
|
}) {
|
|
220
|
-
const inputData: Operation.Definition.Input<typeof RunInstructions> = { instructions, input };
|
|
224
|
+
const inputData: Operation.Definition.Input<typeof AgentOperation.RunInstructions> = { instructions, input };
|
|
221
225
|
// Invoke the function.
|
|
222
|
-
const result = yield* Operation.invoke(RunInstructions, inputData).pipe(Effect.orDie, Effect.exit);
|
|
226
|
+
const result = yield* Operation.invoke(AgentOperation.RunInstructions, inputData).pipe(Effect.orDie, Effect.exit);
|
|
223
227
|
|
|
224
228
|
Exit.match(result, {
|
|
225
229
|
onFailure: (cause) => {
|
|
@@ -15,7 +15,7 @@ import { Filter } from '@dxos/echo';
|
|
|
15
15
|
import { useQuery } from '@dxos/echo-react';
|
|
16
16
|
import { ClientPlugin } from '@dxos/plugin-client/testing';
|
|
17
17
|
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
18
|
-
import
|
|
18
|
+
import * as CorePlugins from '@dxos/plugin-testing/CorePlugins';
|
|
19
19
|
import * as StorybookPlugin from '@dxos/plugin-testing/StorybookPlugin';
|
|
20
20
|
import { Config } from '@dxos/react-client';
|
|
21
21
|
import { useSpaces } from '@dxos/react-client/echo';
|
|
@@ -25,7 +25,7 @@ import { Text } from '@dxos/schema';
|
|
|
25
25
|
import { createScript } from '#testing';
|
|
26
26
|
import { translations } from '#translations';
|
|
27
27
|
|
|
28
|
-
import { ScriptArticle } from './ScriptArticle';
|
|
28
|
+
import { ScriptArticle } from './ScriptArticle.tsx';
|
|
29
29
|
|
|
30
30
|
type StoryArgs = {};
|
|
31
31
|
|
|
@@ -75,7 +75,7 @@ const meta = {
|
|
|
75
75
|
withLayout({ layout: 'column', classNames: 'w-document-max-width' }),
|
|
76
76
|
withPluginManager({
|
|
77
77
|
plugins: [
|
|
78
|
-
...
|
|
78
|
+
...CorePlugins.make(),
|
|
79
79
|
ClientPlugin.make({
|
|
80
80
|
config: new Config({
|
|
81
81
|
runtime: {
|
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import type * as AppSurface from '@dxos/app-toolkit/AppSurface';
|
|
8
8
|
import type * as Script from '@dxos/compute/Script';
|
|
9
9
|
import { Obj } from '@dxos/echo';
|
|
10
10
|
import { Doc } from '@dxos/echo-doc';
|
|
11
|
+
import { useResolveRef } from '@dxos/echo-react';
|
|
11
12
|
import { useIdentity } from '@dxos/halo-react';
|
|
12
13
|
import { getSpace } from '@dxos/react-client/echo';
|
|
13
|
-
import
|
|
14
|
+
import * as Panel from '@dxos/react-ui/Panel';
|
|
14
15
|
import { createDataExtensions, editorClassNames, listener } from '@dxos/ui-editor';
|
|
15
16
|
|
|
16
17
|
import { ScriptToolbar, TypescriptEditor, type TypescriptEditorProps } from '#components';
|
|
@@ -35,22 +36,23 @@ export const ScriptArticle = ({
|
|
|
35
36
|
const space = getSpace(script);
|
|
36
37
|
const state = useToolbarState();
|
|
37
38
|
useDeployState({ script, state });
|
|
39
|
+
const source = useResolveRef(script.source);
|
|
38
40
|
|
|
39
41
|
const extensions = useMemo(() => {
|
|
40
|
-
if (!
|
|
42
|
+
if (!source) {
|
|
41
43
|
return [];
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
return [
|
|
45
47
|
createDataExtensions({
|
|
46
48
|
id: script.id,
|
|
47
|
-
text: Doc.createAccessor(
|
|
49
|
+
text: Doc.createAccessor(source, ['content']),
|
|
48
50
|
messenger: space,
|
|
49
51
|
identity,
|
|
50
52
|
}),
|
|
51
53
|
listener({
|
|
52
54
|
onChange: ({ text }) => {
|
|
53
|
-
if (
|
|
55
|
+
if (source?.content !== text) {
|
|
54
56
|
Obj.update(script, (script) => {
|
|
55
57
|
script.changed = true;
|
|
56
58
|
});
|
|
@@ -58,7 +60,7 @@ export const ScriptArticle = ({
|
|
|
58
60
|
},
|
|
59
61
|
}),
|
|
60
62
|
];
|
|
61
|
-
}, [identity, space, script,
|
|
63
|
+
}, [identity, space, script, source]);
|
|
62
64
|
|
|
63
65
|
if (!extensions.length) {
|
|
64
66
|
return null;
|
|
@@ -66,20 +68,20 @@ export const ScriptArticle = ({
|
|
|
66
68
|
|
|
67
69
|
return (
|
|
68
70
|
<Panel.Root role={role}>
|
|
69
|
-
<Panel.
|
|
71
|
+
<Panel.Header>
|
|
70
72
|
<ScriptToolbar script={script} attendableId={attendableId} state={state} role={role} />
|
|
71
|
-
</Panel.
|
|
72
|
-
<Panel.
|
|
73
|
+
</Panel.Header>
|
|
74
|
+
<Panel.Body asChild>
|
|
73
75
|
<TypescriptEditor
|
|
74
76
|
classNames={editorClassNames(role)}
|
|
75
77
|
id={script.id}
|
|
76
78
|
env={env}
|
|
77
|
-
initialValue={
|
|
79
|
+
initialValue={source?.content}
|
|
78
80
|
extensions={extensions}
|
|
79
81
|
inputMode={settings.editorInputMode}
|
|
80
82
|
toolbar
|
|
81
83
|
/>
|
|
82
|
-
</Panel.
|
|
84
|
+
</Panel.Body>
|
|
83
85
|
</Panel.Root>
|
|
84
86
|
);
|
|
85
87
|
};
|