@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
|
@@ -4,22 +4,24 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { type ChangeEvent, useCallback } from 'react';
|
|
6
6
|
|
|
7
|
-
import { getUserFunctionIdInMetadata } from '@dxos/compute-runtime';
|
|
8
|
-
import { getInvocationUrl } from '@dxos/compute-runtime';
|
|
7
|
+
import { getInvocationUrl, getUserFunctionIdInMetadata } from '@dxos/compute-runtime';
|
|
9
8
|
import * as Operation from '@dxos/compute/Operation';
|
|
10
9
|
import type * as Script from '@dxos/compute/Script';
|
|
11
10
|
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
12
11
|
import { useQuery } from '@dxos/echo-react';
|
|
13
12
|
import { useClient } from '@dxos/react-client';
|
|
14
|
-
import { Clipboard, Flex, Input, useControlledState, useTranslation } from '@dxos/react-ui';
|
|
15
13
|
import { Form } from '@dxos/react-ui-form';
|
|
14
|
+
import * as Field from '@dxos/react-ui/Field';
|
|
15
|
+
import * as Hooks from '@dxos/react-ui/Hooks';
|
|
16
|
+
import * as Input from '@dxos/react-ui/Input';
|
|
17
|
+
import * as SystemButton from '@dxos/react-ui/SystemButton';
|
|
16
18
|
|
|
17
19
|
import { meta } from '#meta';
|
|
18
20
|
|
|
19
21
|
export type FunctionBindingProps = { object: Script.Script };
|
|
20
22
|
|
|
21
23
|
export const FunctionBinding = ({ object }: FunctionBindingProps) => {
|
|
22
|
-
const { t } = useTranslation(meta.profile.key);
|
|
24
|
+
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
23
25
|
const client = useClient();
|
|
24
26
|
const db = Obj.getDatabase(object);
|
|
25
27
|
|
|
@@ -31,7 +33,7 @@ export const FunctionBinding = ({ object }: FunctionBindingProps) => {
|
|
|
31
33
|
spaceId: db?.spaceId,
|
|
32
34
|
});
|
|
33
35
|
|
|
34
|
-
const [binding, setBinding] = useControlledState(fn?.binding ?? '');
|
|
36
|
+
const [binding, setBinding] = Hooks.useControlledState(fn?.binding ?? '');
|
|
35
37
|
const handleBindingChange = useCallback(
|
|
36
38
|
(event: ChangeEvent<HTMLInputElement>) => setBinding(event.target.value),
|
|
37
39
|
[setBinding],
|
|
@@ -50,13 +52,11 @@ export const FunctionBinding = ({ object }: FunctionBindingProps) => {
|
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
return (
|
|
53
|
-
<
|
|
54
|
-
<Form.Section title={t('remote-function-settings.heading')} />
|
|
55
|
-
|
|
55
|
+
<Form.FieldSet label={t('remote-function-settings.heading')}>
|
|
56
56
|
{functionUrl && (
|
|
57
|
-
<
|
|
58
|
-
<
|
|
59
|
-
<Input.
|
|
57
|
+
<Field.Root>
|
|
58
|
+
<Field.Label>{t('function-url.label')}</Field.Label>
|
|
59
|
+
<Input.Root
|
|
60
60
|
disabled
|
|
61
61
|
value={functionUrl}
|
|
62
62
|
onChange={(event) => {
|
|
@@ -65,20 +65,20 @@ export const FunctionBinding = ({ object }: FunctionBindingProps) => {
|
|
|
65
65
|
});
|
|
66
66
|
}}
|
|
67
67
|
/>
|
|
68
|
-
<Clipboard
|
|
69
|
-
</
|
|
68
|
+
<SystemButton.Clipboard iconOnly value={functionUrl} />
|
|
69
|
+
</Field.Root>
|
|
70
70
|
)}
|
|
71
71
|
|
|
72
|
-
<
|
|
73
|
-
<
|
|
74
|
-
<Input.
|
|
72
|
+
<Field.Root>
|
|
73
|
+
<Field.Label>{t('function-binding.label')}</Field.Label>
|
|
74
|
+
<Input.Root
|
|
75
75
|
placeholder={t('function-binding.placeholder')}
|
|
76
76
|
value={binding}
|
|
77
77
|
onChange={handleBindingChange}
|
|
78
78
|
onBlur={handleBindingBlur}
|
|
79
79
|
/>
|
|
80
|
-
</
|
|
81
|
-
</
|
|
80
|
+
</Field.Root>
|
|
81
|
+
</Form.FieldSet>
|
|
82
82
|
);
|
|
83
83
|
};
|
|
84
84
|
|
|
@@ -5,15 +5,19 @@
|
|
|
5
5
|
import { Octokit } from '@octokit/core';
|
|
6
6
|
import React, { useCallback, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import * as Hooks from '@dxos/app-framework/Hooks';
|
|
9
9
|
import * as SettingsOperation from '@dxos/app-toolkit/SettingsOperation';
|
|
10
10
|
import type * as Script from '@dxos/compute/Script';
|
|
11
11
|
import { Filter, Obj } from '@dxos/echo';
|
|
12
12
|
import { useQuery } from '@dxos/echo-react';
|
|
13
13
|
import { AccessToken } from '@dxos/link';
|
|
14
14
|
import { log } from '@dxos/log';
|
|
15
|
-
import { Banner, Button, Clipboard, Flex, useAsyncEffect, useTranslation } from '@dxos/react-ui';
|
|
16
15
|
import { Form } from '@dxos/react-ui-form';
|
|
16
|
+
import * as Banner from '@dxos/react-ui/Banner';
|
|
17
|
+
import * as Button from '@dxos/react-ui/Button';
|
|
18
|
+
import * as UiHooks from '@dxos/react-ui/Hooks';
|
|
19
|
+
import * as Layout from '@dxos/react-ui/Layout';
|
|
20
|
+
import * as SystemButton from '@dxos/react-ui/SystemButton';
|
|
17
21
|
import { kebabize } from '@dxos/util';
|
|
18
22
|
|
|
19
23
|
import { meta } from '#meta';
|
|
@@ -22,15 +26,15 @@ export type FunctionPublishingProps = { object: Script.Script };
|
|
|
22
26
|
|
|
23
27
|
// TODO(burdon): Move to separate tab?
|
|
24
28
|
export const FunctionPublishing = ({ object }: FunctionPublishingProps) => {
|
|
25
|
-
const { t } = useTranslation(meta.profile.key);
|
|
26
|
-
const { invokePromise } = useOperationInvoker();
|
|
29
|
+
const { t } = UiHooks.useTranslation(meta.profile.key);
|
|
30
|
+
const { invokePromise } = Hooks.useOperationInvoker();
|
|
27
31
|
const db = Obj.getDatabase(object);
|
|
28
32
|
|
|
29
33
|
const [githubToken] = useQuery(db, Filter.type(AccessToken.AccessToken, { source: 'github.com' }));
|
|
30
34
|
const gistKey = Obj.getMeta(object).keys.find(({ source }) => source === 'github.com');
|
|
31
35
|
const [gistUrl, setGistUrl] = useState<string | undefined>();
|
|
32
36
|
|
|
33
|
-
useAsyncEffect(async () => {
|
|
37
|
+
UiHooks.useAsyncEffect(async () => {
|
|
34
38
|
const token = githubToken?.token;
|
|
35
39
|
const gistId = gistKey?.id;
|
|
36
40
|
if (!token || !gistId) {
|
|
@@ -94,31 +98,27 @@ export const FunctionPublishing = ({ object }: FunctionPublishingProps) => {
|
|
|
94
98
|
}, [object, githubToken]);
|
|
95
99
|
|
|
96
100
|
return (
|
|
97
|
-
<
|
|
98
|
-
<Form.Section title={t('script-publish-settings.label')} description={t('script-publish-settings.description')} />
|
|
99
|
-
|
|
101
|
+
<Form.FieldSet label={t('script-publish-settings.label')} description={t('script-publish-settings.description')}>
|
|
100
102
|
{!githubToken && (
|
|
101
|
-
<Flex column classNames='py-form-gap'>
|
|
103
|
+
<Layout.Flex column classNames='py-form-gap'>
|
|
102
104
|
<Banner.Root valence='info'>
|
|
103
|
-
<Banner.
|
|
104
|
-
<Banner.Title>{t('no-github-token.label')}</Banner.Title>
|
|
105
|
-
</Banner.Content>
|
|
105
|
+
<Banner.Title>{t('no-github-token.label')}</Banner.Title>
|
|
106
106
|
</Banner.Root>
|
|
107
|
-
<Flex classNames='pt-form-gap'>
|
|
108
|
-
<Button onClick={handleOpenTokenManager}>{t('open-token-manager.label')}</Button>
|
|
109
|
-
</Flex>
|
|
110
|
-
</Flex>
|
|
107
|
+
<Layout.Flex classNames='pt-form-gap'>
|
|
108
|
+
<Button.Root onClick={handleOpenTokenManager}>{t('open-token-manager.label')}</Button.Root>
|
|
109
|
+
</Layout.Flex>
|
|
110
|
+
</Layout.Flex>
|
|
111
111
|
)}
|
|
112
112
|
|
|
113
113
|
{githubToken && (
|
|
114
|
-
<Flex gap='sm' justify='end'>
|
|
115
|
-
{gistUrl && <Clipboard
|
|
116
|
-
<Button disabled={publishing} onClick={handlePublish}>
|
|
114
|
+
<Layout.Flex gap='sm' justify='end'>
|
|
115
|
+
{gistUrl && <SystemButton.Clipboard iconOnly value={gistUrl} />}
|
|
116
|
+
<Button.Root disabled={publishing} onClick={handlePublish}>
|
|
117
117
|
{t('publish.label')}
|
|
118
|
-
</Button>
|
|
119
|
-
</Flex>
|
|
118
|
+
</Button.Root>
|
|
119
|
+
</Layout.Flex>
|
|
120
120
|
)}
|
|
121
|
-
</
|
|
121
|
+
</Form.FieldSet>
|
|
122
122
|
);
|
|
123
123
|
};
|
|
124
124
|
|
|
@@ -14,7 +14,7 @@ import { Filter } from '@dxos/echo';
|
|
|
14
14
|
import { useQuery } from '@dxos/echo-react';
|
|
15
15
|
import { ClientPlugin } from '@dxos/plugin-client/testing';
|
|
16
16
|
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
17
|
-
import
|
|
17
|
+
import * as CorePlugins from '@dxos/plugin-testing/CorePlugins';
|
|
18
18
|
import * as StorybookPlugin from '@dxos/plugin-testing/StorybookPlugin';
|
|
19
19
|
import { useSpaces } from '@dxos/react-client/echo';
|
|
20
20
|
import { ObjectProperties } from '@dxos/react-ui-form';
|
|
@@ -24,7 +24,7 @@ import { Text } from '@dxos/schema';
|
|
|
24
24
|
import { createScript } from '#testing';
|
|
25
25
|
import { translations } from '#translations';
|
|
26
26
|
|
|
27
|
-
import { ScriptProperties } from './ScriptProperties';
|
|
27
|
+
import { ScriptProperties } from './ScriptProperties.tsx';
|
|
28
28
|
|
|
29
29
|
type StoryArgs = {};
|
|
30
30
|
|
|
@@ -50,7 +50,7 @@ const meta = {
|
|
|
50
50
|
withLayout({ layout: 'column' }),
|
|
51
51
|
withPluginManager({
|
|
52
52
|
plugins: [
|
|
53
|
-
...
|
|
53
|
+
...CorePlugins.make(),
|
|
54
54
|
ClientPlugin.make({
|
|
55
55
|
types: [Script.Script, Operation.PersistentOperation, Skill.Skill, Text.Text],
|
|
56
56
|
onClientInitialized: ({ client }) =>
|
|
@@ -4,28 +4,28 @@
|
|
|
4
4
|
|
|
5
5
|
import React 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 { Form } from '@dxos/react-ui-form';
|
|
10
10
|
|
|
11
|
-
import { FunctionBinding } from './FunctionBinding';
|
|
12
|
-
import { FunctionPublishing } from './FunctionPublishing';
|
|
13
|
-
import { SkillEditor } from './SkillEditor';
|
|
11
|
+
import { FunctionBinding } from './FunctionBinding.tsx';
|
|
12
|
+
import { FunctionPublishing } from './FunctionPublishing.tsx';
|
|
13
|
+
import { SkillEditor } from './SkillEditor.tsx';
|
|
14
14
|
|
|
15
15
|
export type ScriptPropertiesProps = AppSurface.ObjectPropertiesProps<Script.Script>;
|
|
16
16
|
|
|
17
17
|
export const ScriptProperties = ({ subject: object }: ScriptPropertiesProps) => {
|
|
18
18
|
return (
|
|
19
19
|
<>
|
|
20
|
-
<Form.
|
|
20
|
+
<Form.FieldSet>
|
|
21
21
|
<FunctionBinding object={object} />
|
|
22
|
-
</Form.
|
|
23
|
-
<Form.
|
|
22
|
+
</Form.FieldSet>
|
|
23
|
+
<Form.FieldSet>
|
|
24
24
|
<SkillEditor object={object} />
|
|
25
|
-
</Form.
|
|
26
|
-
<Form.
|
|
25
|
+
</Form.FieldSet>
|
|
26
|
+
<Form.FieldSet>
|
|
27
27
|
<FunctionPublishing object={object} />
|
|
28
|
-
</Form.
|
|
28
|
+
</Form.FieldSet>
|
|
29
29
|
</>
|
|
30
30
|
);
|
|
31
31
|
};
|
|
@@ -11,8 +11,11 @@ import * as Skill from '@dxos/compute/Skill';
|
|
|
11
11
|
import * as Template from '@dxos/compute/Template';
|
|
12
12
|
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
13
13
|
import { useQuery } from '@dxos/echo-react';
|
|
14
|
-
import { Button, Flex, Input, useAsyncEffect, useTranslation } from '@dxos/react-ui';
|
|
15
14
|
import { Form } from '@dxos/react-ui-form';
|
|
15
|
+
import * as Button from '@dxos/react-ui/Button';
|
|
16
|
+
import * as Field from '@dxos/react-ui/Field';
|
|
17
|
+
import * as Hooks from '@dxos/react-ui/Hooks';
|
|
18
|
+
import * as Input from '@dxos/react-ui/Input';
|
|
16
19
|
import { kebabize } from '@dxos/util';
|
|
17
20
|
|
|
18
21
|
import { meta } from '#meta';
|
|
@@ -20,7 +23,7 @@ import { meta } from '#meta';
|
|
|
20
23
|
export type SkillEditorProps = { object: Script.Script };
|
|
21
24
|
|
|
22
25
|
export const SkillEditor = ({ object }: SkillEditorProps) => {
|
|
23
|
-
const { t } = useTranslation(meta.profile.key);
|
|
26
|
+
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
24
27
|
const db = Obj.getDatabase(object);
|
|
25
28
|
const [fn] = useQuery(db, Filter.type(Operation.PersistentOperation, { source: Ref.make(object) }));
|
|
26
29
|
const skills = useQuery(db, Filter.type(Skill.Skill));
|
|
@@ -32,7 +35,7 @@ export const SkillEditor = ({ object }: SkillEditorProps) => {
|
|
|
32
35
|
const existingSkill = skills.find((bp) => Obj.getMeta(bp).key === skillKey);
|
|
33
36
|
const fnKey = fn ? Obj.getMeta(fn).key : undefined;
|
|
34
37
|
|
|
35
|
-
useAsyncEffect(async () => {
|
|
38
|
+
Hooks.useAsyncEffect(async () => {
|
|
36
39
|
if (!existingSkill) {
|
|
37
40
|
return;
|
|
38
41
|
}
|
|
@@ -58,7 +61,8 @@ export const SkillEditor = ({ object }: SkillEditorProps) => {
|
|
|
58
61
|
const toolId = ToolId.make(fnKey);
|
|
59
62
|
if (!existingSkill.tools?.includes(toolId)) {
|
|
60
63
|
Obj.update(existingSkill, (existingSkill) => {
|
|
61
|
-
existingSkill.tools
|
|
64
|
+
existingSkill.tools ??= [];
|
|
65
|
+
existingSkill.tools.push(toolId);
|
|
62
66
|
});
|
|
63
67
|
}
|
|
64
68
|
}
|
|
@@ -79,26 +83,24 @@ export const SkillEditor = ({ object }: SkillEditorProps) => {
|
|
|
79
83
|
}, [db, existingSkill, fnKey, skillKey, object.name, instructions]);
|
|
80
84
|
|
|
81
85
|
return (
|
|
82
|
-
<
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
<Input.Label>{t('skill-instructions.label')}</Input.Label>
|
|
87
|
-
<Input.TextArea
|
|
86
|
+
<Form.FieldSet label={t('skill-editor.label')} description={t('skill-editor.description')}>
|
|
87
|
+
<Field.Root>
|
|
88
|
+
<Field.Label>{t('skill-instructions.label')}</Field.Label>
|
|
89
|
+
<Input.Textarea
|
|
88
90
|
placeholder={t('skill-instructions.placeholder')}
|
|
89
91
|
rows={6}
|
|
90
92
|
value={instructions}
|
|
91
93
|
onChange={(event) => setInstructions(event.target.value)}
|
|
92
94
|
classNames='resize-y'
|
|
93
95
|
/>
|
|
94
|
-
</
|
|
96
|
+
</Field.Root>
|
|
95
97
|
|
|
96
98
|
<div className='pt-2'>
|
|
97
|
-
<Button disabled={(!existingSkill && !fnKey) || creating} onClick={handleSave}>
|
|
99
|
+
<Button.Root disabled={(!existingSkill && !fnKey) || creating} onClick={handleSave}>
|
|
98
100
|
{t(existingSkill ? 'update-skill.label' : 'create-skill.label')}
|
|
99
|
-
</Button>
|
|
101
|
+
</Button.Root>
|
|
100
102
|
</div>
|
|
101
|
-
</
|
|
103
|
+
</Form.FieldSet>
|
|
102
104
|
);
|
|
103
105
|
};
|
|
104
106
|
|
|
@@ -8,7 +8,7 @@ import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
|
8
8
|
|
|
9
9
|
import { translations } from '#translations';
|
|
10
10
|
|
|
11
|
-
import { ScriptSettings } from './ScriptSettings';
|
|
11
|
+
import { ScriptSettings } from './ScriptSettings.tsx';
|
|
12
12
|
|
|
13
13
|
const meta = {
|
|
14
14
|
title: 'plugins/plugin-script/containers/ScriptSettings',
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
import { Button, useTranslation } from '@dxos/react-ui';
|
|
7
|
+
import type * as AppSurface from '@dxos/app-toolkit/AppSurface';
|
|
9
8
|
import { Form } from '@dxos/react-ui-form';
|
|
9
|
+
import * as Button from '@dxos/react-ui/Button';
|
|
10
|
+
import * as Hooks from '@dxos/react-ui/Hooks';
|
|
10
11
|
|
|
11
12
|
import { meta } from '#meta';
|
|
12
13
|
import { Settings } from '#types';
|
|
@@ -18,8 +19,8 @@ export type ScriptSettingsProps = AppSurface.SettingsProps<
|
|
|
18
19
|
}
|
|
19
20
|
>;
|
|
20
21
|
|
|
21
|
-
export const ScriptSettings = ({ settings, onSettingsChange, onAuthenticate }: ScriptSettingsProps) => {
|
|
22
|
-
const { t } = useTranslation(meta.profile.key);
|
|
22
|
+
export const ScriptSettings = ({ settings, onSettingsChange, scope, onAuthenticate }: ScriptSettingsProps) => {
|
|
23
|
+
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
23
24
|
|
|
24
25
|
return (
|
|
25
26
|
<Form.Root
|
|
@@ -31,15 +32,19 @@ export const ScriptSettings = ({ settings, onSettingsChange, onAuthenticate }: S
|
|
|
31
32
|
>
|
|
32
33
|
<Form.Viewport scroll>
|
|
33
34
|
<Form.Content>
|
|
34
|
-
<Form.
|
|
35
|
+
<Form.FieldSet label={meta.profile.name ?? meta.profile.key} actions={scope}>
|
|
35
36
|
{/* TODO(wittjosiah): Hide outside of dev environments. */}
|
|
36
|
-
<Form.
|
|
37
|
-
|
|
37
|
+
<Form.Field
|
|
38
|
+
standalone
|
|
39
|
+
label={t('authenticate-action.label')}
|
|
40
|
+
description={t('authenticate-action.description')}
|
|
41
|
+
>
|
|
42
|
+
<Button.Root disabled={!onSettingsChange} onClick={onAuthenticate}>
|
|
38
43
|
{t('authenticate-button.label')}
|
|
39
|
-
</Button>
|
|
40
|
-
</Form.
|
|
41
|
-
<Form.
|
|
42
|
-
</Form.
|
|
44
|
+
</Button.Root>
|
|
45
|
+
</Form.Field>
|
|
46
|
+
<Form.Fields />
|
|
47
|
+
</Form.FieldSet>
|
|
43
48
|
</Form.Content>
|
|
44
49
|
</Form.Viewport>
|
|
45
50
|
</Form.Root>
|
|
@@ -8,7 +8,7 @@ import type * as Script from '@dxos/compute/Script';
|
|
|
8
8
|
import { Context } from '@dxos/context';
|
|
9
9
|
import { Obj } from '@dxos/echo';
|
|
10
10
|
import { FunctionsServiceClient } from '@dxos/edge-compute';
|
|
11
|
-
import
|
|
11
|
+
import * as Panel from '@dxos/react-ui/Panel';
|
|
12
12
|
|
|
13
13
|
import { TestPanel } from '#components';
|
|
14
14
|
import { useDeployDeps } from '#hooks';
|
|
@@ -35,10 +35,10 @@ export const TestContainer = ({ role, script }: TestContainerProps) => {
|
|
|
35
35
|
);
|
|
36
36
|
|
|
37
37
|
return (
|
|
38
|
-
<Panel.Root role={role}
|
|
39
|
-
<Panel.
|
|
38
|
+
<Panel.Root role={role} width='document'>
|
|
39
|
+
<Panel.Body asChild>
|
|
40
40
|
<TestPanel onInvoke={existingFunctionId ? handleInvoke : undefined} />
|
|
41
|
-
</Panel.
|
|
41
|
+
</Panel.Body>
|
|
42
42
|
</Panel.Root>
|
|
43
43
|
);
|
|
44
44
|
};
|
package/src/containers/index.ts
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import { type ComponentType, lazy } from 'react';
|
|
6
6
|
|
|
7
|
-
export const DeploymentDialog: ComponentType<any> = lazy(() => import('./DeploymentDialog'));
|
|
8
|
-
export const NotebookArticle: ComponentType<any> = lazy(() => import('./NotebookArticle'));
|
|
9
|
-
export const ScriptArticle: ComponentType<any> = lazy(() => import('./ScriptArticle'));
|
|
10
|
-
export const ScriptProperties: ComponentType<any> = lazy(() => import('./ScriptProperties'));
|
|
11
|
-
export const ScriptSettings: ComponentType<any> = lazy(() => import('./ScriptSettings'));
|
|
12
|
-
export const TestContainer: ComponentType<any> = lazy(() => import('./TestContainer'));
|
|
7
|
+
export const DeploymentDialog: ComponentType<any> = lazy(() => import('./DeploymentDialog/index.ts'));
|
|
8
|
+
export const NotebookArticle: ComponentType<any> = lazy(() => import('./NotebookArticle/index.ts'));
|
|
9
|
+
export const ScriptArticle: ComponentType<any> = lazy(() => import('./ScriptArticle/index.ts'));
|
|
10
|
+
export const ScriptProperties: ComponentType<any> = lazy(() => import('./ScriptProperties/index.ts'));
|
|
11
|
+
export const ScriptSettings: ComponentType<any> = lazy(() => import('./ScriptSettings/index.ts'));
|
|
12
|
+
export const TestContainer: ComponentType<any> = lazy(() => import('./TestContainer/index.ts'));
|
package/src/e2e/ai.test.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { FunctionsServiceClient } from '@dxos/edge-compute';
|
|
|
14
14
|
import { bundleFunction } from '@dxos/edge-compute/native';
|
|
15
15
|
import { failedInvariant } from '@dxos/invariant';
|
|
16
16
|
import { FunctionRuntimeKind } from '@dxos/protocols';
|
|
17
|
-
import { EdgeReplicationSetting } from '@dxos/protocols/
|
|
17
|
+
import { EdgeReplicationSetting } from '@dxos/protocols/buf/dxos/echo/metadata_pb';
|
|
18
18
|
|
|
19
19
|
// To heavy to run in CI.
|
|
20
20
|
describe.skip('Function', { tags: ['functions-e2e'] }, () => {
|
package/src/hooks/deploy.ts
CHANGED
|
@@ -11,13 +11,13 @@ import { type Database, Obj, Query, Ref } from '@dxos/echo';
|
|
|
11
11
|
import { useQuery } from '@dxos/echo-react';
|
|
12
12
|
import { log } from '@dxos/log';
|
|
13
13
|
import { type Client, useClient } from '@dxos/react-client';
|
|
14
|
-
import { type TFunction } from '@dxos/react-ui';
|
|
15
14
|
import { type ActionGraphProps, createMenuAction } from '@dxos/react-ui-menu';
|
|
15
|
+
import type * as Theme from '@dxos/react-ui/Theme';
|
|
16
16
|
import { messageValence } from '@dxos/ui-theme';
|
|
17
17
|
|
|
18
18
|
import { meta } from '#meta';
|
|
19
19
|
|
|
20
|
-
import { deployScript, getFunctionUrl, isScriptDeployed } from '../util';
|
|
20
|
+
import { deployScript, getFunctionUrl, isScriptDeployed } from '../util/index.ts';
|
|
21
21
|
|
|
22
22
|
export type DeployActionProperties = { type: 'deploy' } | { type: 'copy' };
|
|
23
23
|
|
|
@@ -28,7 +28,7 @@ export type DeployState = {
|
|
|
28
28
|
error: string;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
import { type ScriptToolbarStateStore } from './useToolbarState';
|
|
31
|
+
import { type ScriptToolbarStateStore } from './useToolbarState.ts';
|
|
32
32
|
|
|
33
33
|
export type CreateDeployOptions = {
|
|
34
34
|
state: ScriptToolbarStateStore;
|
|
@@ -37,7 +37,7 @@ export type CreateDeployOptions = {
|
|
|
37
37
|
db?: Database.Database;
|
|
38
38
|
existingFunctionId?: string;
|
|
39
39
|
client: Client;
|
|
40
|
-
t: TFunction;
|
|
40
|
+
t: Theme.TFunction;
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
export const createDeploy = ({
|
|
@@ -69,7 +69,14 @@ export const createDeploy = ({
|
|
|
69
69
|
state.set('error', undefined);
|
|
70
70
|
state.set('deploying', true);
|
|
71
71
|
|
|
72
|
-
const result = await deployScript({
|
|
72
|
+
const result = await deployScript({
|
|
73
|
+
script,
|
|
74
|
+
getEdgeHttpClient: () => client.edge.http,
|
|
75
|
+
ownerDid: client.halo.identity.get()?.did,
|
|
76
|
+
db,
|
|
77
|
+
fn,
|
|
78
|
+
existingFunctionId,
|
|
79
|
+
});
|
|
73
80
|
|
|
74
81
|
if (!result.success) {
|
|
75
82
|
log.catch(result.error);
|
package/src/hooks/index.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export * from './deploy';
|
|
6
|
-
export * from './format';
|
|
7
|
-
export * from './template';
|
|
5
|
+
export * from './deploy.ts';
|
|
6
|
+
export * from './format.ts';
|
|
7
|
+
export * from './template.ts';
|
|
8
8
|
|
|
9
|
-
export * from './useCreateAndDeployScriptTemplates';
|
|
10
|
-
export * from './useToolbarState';
|
|
11
|
-
export * from './useCompiler';
|
|
9
|
+
export * from './useCreateAndDeployScriptTemplates.ts';
|
|
10
|
+
export * from './useToolbarState.ts';
|
|
11
|
+
export * from './useCompiler.ts';
|
package/src/hooks/template.ts
CHANGED
|
@@ -7,7 +7,7 @@ import * as Script from '@dxos/compute/Script';
|
|
|
7
7
|
import { Obj } from '@dxos/echo';
|
|
8
8
|
import { type ActionGraphProps, createMenuAction } from '@dxos/react-ui-menu';
|
|
9
9
|
|
|
10
|
-
import { templates } from '../templates';
|
|
10
|
+
import { templates } from '../templates/index.ts';
|
|
11
11
|
|
|
12
12
|
export type TemplateActionProperties = { type: 'template'; value: string };
|
|
13
13
|
|
package/src/hooks/useCompiler.ts
CHANGED
|
@@ -2,23 +2,24 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
5
|
+
import * as Hooks from '@dxos/app-framework/Hooks';
|
|
6
|
+
import * as PluginManagerProvider from '@dxos/app-framework/PluginManagerProvider';
|
|
7
|
+
import * as EffectEx from '@dxos/effect/EffectEx';
|
|
8
|
+
import * as UiHooks from '@dxos/react-ui/Hooks';
|
|
8
9
|
|
|
9
10
|
import { ScriptCapabilities, ScriptEvents } from '#types';
|
|
10
11
|
|
|
11
|
-
import type { Compiler } from '../compiler';
|
|
12
|
+
import type { Compiler } from '../compiler/index.ts';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Asynchronously sets up the compiler and returns it.
|
|
15
16
|
* @returns The compiler instance or undefined if it is not ready.
|
|
16
17
|
*/
|
|
17
18
|
export const useCompiler = (): Compiler | undefined => {
|
|
18
|
-
const manager = usePluginManager();
|
|
19
|
-
useAsyncEffect(async () => {
|
|
19
|
+
const manager = PluginManagerProvider.usePluginManager();
|
|
20
|
+
UiHooks.useAsyncEffect(async () => {
|
|
20
21
|
await manager.activate(ScriptEvents.SetupCompiler).pipe(EffectEx.runAndForwardErrors);
|
|
21
22
|
}, [manager]);
|
|
22
|
-
const [compiler] = useCapabilities(ScriptCapabilities.Compiler);
|
|
23
|
+
const [compiler] = Hooks.useCapabilities(ScriptCapabilities.Compiler);
|
|
23
24
|
return compiler;
|
|
24
25
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { useCallback, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import * as Hooks from '@dxos/app-framework/Hooks';
|
|
8
8
|
import * as Script from '@dxos/compute/Script';
|
|
9
9
|
import { type Database, Obj } from '@dxos/echo';
|
|
10
10
|
import { invariant } from '@dxos/invariant';
|
|
@@ -13,8 +13,8 @@ import { useClient } from '@dxos/react-client';
|
|
|
13
13
|
|
|
14
14
|
import { ScriptOperation } from '#types';
|
|
15
15
|
|
|
16
|
-
import { type Template } from '../templates';
|
|
17
|
-
import { deployScript } from '../util';
|
|
16
|
+
import { type Template } from '../templates/index.ts';
|
|
17
|
+
import { deployScript } from '../util/index.ts';
|
|
18
18
|
|
|
19
19
|
type DeploymentStatus = 'idle' | 'pending' | 'success' | 'error';
|
|
20
20
|
|
|
@@ -26,7 +26,7 @@ type DeploymentStatus = 'idle' | 'pending' | 'success' | 'error';
|
|
|
26
26
|
* All creation / deployment operations run concurrently for improved performance.
|
|
27
27
|
*/
|
|
28
28
|
export const useCreateAndDeployScriptTemplates = (db: Database.Database | undefined, scriptTemplates: Template[]) => {
|
|
29
|
-
const { invokePromise } = useOperationInvoker();
|
|
29
|
+
const { invokePromise } = Hooks.useOperationInvoker();
|
|
30
30
|
const client = useClient();
|
|
31
31
|
const [status, setStatus] = useState<DeploymentStatus>('idle');
|
|
32
32
|
const [error, setError] = useState<Error | undefined>(undefined);
|
|
@@ -45,7 +45,12 @@ export const useCreateAndDeployScriptTemplates = (db: Database.Database | undefi
|
|
|
45
45
|
invariant(Obj.instanceOf(Script.Script, createResult.data?.object));
|
|
46
46
|
await invokePromise(SpaceOperation.AddObject, { object: createResult.data.object }, { spaceId: db.spaceId });
|
|
47
47
|
|
|
48
|
-
return deployScript({
|
|
48
|
+
return deployScript({
|
|
49
|
+
db,
|
|
50
|
+
getEdgeHttpClient: () => client.edge.http,
|
|
51
|
+
ownerDid: client.halo.identity.get()?.did,
|
|
52
|
+
script: createResult.data.object,
|
|
53
|
+
});
|
|
49
54
|
}),
|
|
50
55
|
);
|
|
51
56
|
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as Atom from 'effect/
|
|
5
|
+
import * as Atom from 'effect/reactivity/Atom';
|
|
6
6
|
import { useMemo } from 'react';
|
|
7
7
|
|
|
8
8
|
import * as Capabilities from '@dxos/app-framework/Capabilities';
|
|
9
|
-
import
|
|
9
|
+
import * as Hooks from '@dxos/app-framework/Hooks';
|
|
10
10
|
|
|
11
|
-
import { type DeployState } from './deploy';
|
|
11
|
+
import { type DeployState } from './deploy.ts';
|
|
12
12
|
|
|
13
13
|
export type ScriptToolbarState = Partial<DeployState>;
|
|
14
14
|
|
|
@@ -20,7 +20,7 @@ export type ScriptToolbarStateStore = {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
export const useToolbarState = (initialState: ScriptToolbarState = {}): ScriptToolbarStateStore => {
|
|
23
|
-
const registry = useCapability(Capabilities.AtomRegistry);
|
|
23
|
+
const registry = Hooks.useCapability(Capabilities.AtomRegistry);
|
|
24
24
|
const atom = useMemo(() => Atom.make<ScriptToolbarState>(initialState), []);
|
|
25
25
|
|
|
26
26
|
return useMemo(
|
package/src/index.ts
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export * as ScriptPlugin from './ScriptPlugin';
|
|
6
|
-
export * from '#meta';
|
|
5
|
+
export * as ScriptPlugin from './ScriptPlugin.ts';
|
|
7
6
|
export * from '#types';
|
|
8
|
-
export * from './
|
|
7
|
+
export * as ScriptFunction from './ScriptFunction.ts';
|
|
8
|
+
export * as Templates from './Templates.ts';
|
|
9
|
+
export * from '#operations';
|
|
10
|
+
export * from '#skills';
|