@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
package/src/meta.ts
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as Registry from 'effect/
|
|
5
|
+
import * as Registry from 'effect/reactivity/AtomRegistry';
|
|
6
6
|
import { describe, expect, test } from 'vitest';
|
|
7
7
|
|
|
8
8
|
import { Obj } from '@dxos/echo';
|
|
9
9
|
|
|
10
10
|
import { createNotebook } from '#testing';
|
|
11
11
|
|
|
12
|
-
import { ComputeGraph } from './compute-graph';
|
|
12
|
+
import { ComputeGraph } from './compute-graph.ts';
|
|
13
13
|
|
|
14
14
|
describe('notebook', () => {
|
|
15
15
|
test('parse dependency graph', async () => {
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as Atom from 'effect/
|
|
6
|
-
import type * as Registry from 'effect/
|
|
5
|
+
import * as Atom from 'effect/reactivity/Atom';
|
|
6
|
+
import type * as Registry from 'effect/reactivity/AtomRegistry';
|
|
7
7
|
|
|
8
8
|
import { log } from '@dxos/log';
|
|
9
9
|
|
|
10
10
|
import { Notebook } from '#types';
|
|
11
11
|
|
|
12
|
-
import { evalScript } from './eval';
|
|
13
|
-
import { type ParsedExpression, VirtualTypeScriptParser } from './vfs-parser';
|
|
12
|
+
import { evalScript } from './eval.ts';
|
|
13
|
+
import { type ParsedExpression, VirtualTypeScriptParser } from './vfs-parser.ts';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Compute graph that evaluates the notebook cells.
|
package/src/notebook/index.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { describe, expect, test } from 'vitest';
|
|
6
6
|
|
|
7
|
-
import { NotebookVirtualParser, VirtualTypeScriptParser } from './vfs-parser';
|
|
7
|
+
import { NotebookVirtualParser, VirtualTypeScriptParser } from './vfs-parser.ts';
|
|
8
8
|
|
|
9
9
|
describe('vfs-parser', () => {
|
|
10
10
|
test('parse simple assignments', () => {
|
|
@@ -7,7 +7,7 @@ import { createSystem, createVirtualTypeScriptEnvironment } from '@typescript/vf
|
|
|
7
7
|
|
|
8
8
|
import { invariant } from '@dxos/invariant';
|
|
9
9
|
|
|
10
|
-
import { builtIns, systemDefinitions } from './eval';
|
|
10
|
+
import { builtIns, systemDefinitions } from './eval.ts';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Default system definitions.
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
5
7
|
import * as Operation from '@dxos/compute/Operation';
|
|
6
8
|
import * as OperationHandlerSet from '@dxos/compute/OperationHandlerSet';
|
|
7
9
|
|
|
8
10
|
import { ScriptOperation } from '#types';
|
|
9
11
|
|
|
10
12
|
export const handlers = OperationHandlerSet.lazy([
|
|
11
|
-
ScriptOperation.CreateScript.pipe(Operation.lazyHandler(() => import('./create-script'))),
|
|
13
|
+
ScriptOperation.CreateScript.pipe(Operation.lazyHandler(() => import('./create-script.ts'))),
|
|
12
14
|
]);
|
|
@@ -10,7 +10,7 @@ import * as Script from '@dxos/compute/Script';
|
|
|
10
10
|
|
|
11
11
|
import { ScriptOperation } from '#types';
|
|
12
12
|
|
|
13
|
-
import { templates } from '../templates';
|
|
13
|
+
import { templates } from '../templates/index.ts';
|
|
14
14
|
|
|
15
15
|
const handler: Operation.WithHandler<typeof ScriptOperation.CreateScript> = ScriptOperation.CreateScript.pipe(
|
|
16
16
|
Operation.withHandler(
|
package/src/operations/index.ts
CHANGED
package/src/plugin.test.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { describe, test } from 'vitest';
|
|
6
6
|
|
|
7
7
|
import * as ClientPlugin from '@dxos/plugin-client/ClientPlugin';
|
|
8
|
-
import
|
|
8
|
+
import * as Harness from '@dxos/plugin-testing/Harness';
|
|
9
9
|
|
|
10
10
|
import { meta } from '#meta';
|
|
11
11
|
import { ScriptPlugin } from '#plugin';
|
|
@@ -14,7 +14,7 @@ const moduleId = (name: string) => `${meta.profile.key}.module.${name}`;
|
|
|
14
14
|
|
|
15
15
|
describe('ScriptPlugin', () => {
|
|
16
16
|
test('modules activate on the expected events', async ({ expect }) => {
|
|
17
|
-
await using harness = await createComposerTestApp({
|
|
17
|
+
await using harness = await Harness.createComposerTestApp({
|
|
18
18
|
plugins: [ClientPlugin.make({}), ScriptPlugin()],
|
|
19
19
|
});
|
|
20
20
|
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
5
7
|
import * as Skill from '@dxos/compute/Skill';
|
|
6
8
|
import * as Template from '@dxos/compute/Template';
|
|
7
9
|
import { trim } from '@dxos/util';
|
|
@@ -16,7 +18,7 @@ import {
|
|
|
16
18
|
QueryDeployedFunctions,
|
|
17
19
|
Read,
|
|
18
20
|
Update,
|
|
19
|
-
} from './functions';
|
|
21
|
+
} from './functions/index.ts';
|
|
20
22
|
|
|
21
23
|
const SKILL_KEY = 'org.dxos.skill.script';
|
|
22
24
|
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
|
-
import * as
|
|
7
|
+
import * as DefaultParent from '@dxos/app-toolkit/DefaultParent';
|
|
8
8
|
import * as Operation from '@dxos/compute/Operation';
|
|
9
9
|
import * as Script from '@dxos/compute/Script';
|
|
10
10
|
import { Database, Obj, Ref } from '@dxos/echo';
|
|
11
11
|
|
|
12
|
-
import { Create } from './definitions';
|
|
12
|
+
import { Create } from './definitions.ts';
|
|
13
13
|
|
|
14
14
|
export default Create.pipe(
|
|
15
15
|
Operation.withHandler(
|
|
@@ -32,7 +32,7 @@ export default Create.pipe(
|
|
|
32
32
|
name,
|
|
33
33
|
source: Ref.make(script),
|
|
34
34
|
});
|
|
35
|
-
yield*
|
|
35
|
+
yield* DefaultParent.add({ object: fn });
|
|
36
36
|
|
|
37
37
|
return {
|
|
38
38
|
function: Obj.getURI(fn),
|
|
@@ -43,6 +43,6 @@ export default Create.pipe(
|
|
|
43
43
|
|
|
44
44
|
const findTemplate = (templateId: string) =>
|
|
45
45
|
Effect.promise(async () => {
|
|
46
|
-
const { templates } = await import('../../templates');
|
|
46
|
+
const { templates } = await import('../../templates/index.ts');
|
|
47
47
|
return templates.find((template) => template.id === templateId);
|
|
48
48
|
});
|
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import { ClientService } from '@dxos/client';
|
|
8
7
|
import * as Operation from '@dxos/compute/Operation';
|
|
9
|
-
import {
|
|
8
|
+
import { ConfigService } from '@dxos/config';
|
|
9
|
+
import { Database, DXN, Hypergraph, Ref } from '@dxos/echo';
|
|
10
|
+
import { EdgeHttpClientService } from '@dxos/edge-client';
|
|
11
|
+
import { Identity } from '@dxos/halo';
|
|
10
12
|
import { trim } from '@dxos/util';
|
|
11
13
|
|
|
12
14
|
const FunctionRef = Ref.Ref(Operation.PersistentOperation).annotate({
|
|
@@ -205,7 +207,7 @@ export const Deploy = Operation.make({
|
|
|
205
207
|
description: 'The URL of the deployed function.',
|
|
206
208
|
}),
|
|
207
209
|
}),
|
|
208
|
-
services: [Database.Service,
|
|
210
|
+
services: [Database.Service, EdgeHttpClientService, Identity.Service, ConfigService],
|
|
209
211
|
});
|
|
210
212
|
|
|
211
213
|
export const Invoke = Operation.make({
|
|
@@ -226,7 +228,7 @@ export const Invoke = Operation.make({
|
|
|
226
228
|
description: 'The response from the function.',
|
|
227
229
|
}),
|
|
228
230
|
}),
|
|
229
|
-
services: [Database.Service,
|
|
231
|
+
services: [Database.Service, EdgeHttpClientService],
|
|
230
232
|
});
|
|
231
233
|
|
|
232
234
|
const InvocationSpanSchema = Schema.Struct({
|
|
@@ -305,7 +307,7 @@ export const QueryDeployedFunctions = Operation.make({
|
|
|
305
307
|
description: 'List of deployed functions.',
|
|
306
308
|
}),
|
|
307
309
|
}),
|
|
308
|
-
services: [
|
|
310
|
+
services: [EdgeHttpClientService],
|
|
309
311
|
});
|
|
310
312
|
|
|
311
313
|
export const InstallFunction = Operation.make({
|
|
@@ -330,5 +332,5 @@ export const InstallFunction = Operation.make({
|
|
|
330
332
|
description: 'Version of the installed function.',
|
|
331
333
|
}),
|
|
332
334
|
}),
|
|
333
|
-
services: [
|
|
335
|
+
services: [Database.Service, Hypergraph.Service, EdgeHttpClientService],
|
|
334
336
|
});
|
|
@@ -7,7 +7,7 @@ import * as Effect from 'effect/Effect';
|
|
|
7
7
|
import * as Operation from '@dxos/compute/Operation';
|
|
8
8
|
import { Database } from '@dxos/echo';
|
|
9
9
|
|
|
10
|
-
import { Delete } from './definitions';
|
|
10
|
+
import { Delete } from './definitions.ts';
|
|
11
11
|
|
|
12
12
|
export default Delete.pipe(
|
|
13
13
|
Operation.withHandler(
|
|
@@ -3,33 +3,36 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Option from 'effect/Option';
|
|
6
7
|
import wasmUrl from 'esbuild-wasm/esbuild.wasm?url';
|
|
7
8
|
|
|
8
|
-
import { ClientService } from '@dxos/client';
|
|
9
9
|
import { getUserFunctionIdInMetadata } from '@dxos/compute-runtime';
|
|
10
10
|
import * as Operation from '@dxos/compute/Operation';
|
|
11
11
|
import * as Script from '@dxos/compute/Script';
|
|
12
|
+
import { ConfigService } from '@dxos/config';
|
|
12
13
|
import { Context } from '@dxos/context';
|
|
13
14
|
import { Database, Obj } from '@dxos/echo';
|
|
15
|
+
import { EdgeHttpClientService } from '@dxos/edge-client';
|
|
14
16
|
import { FunctionsServiceClient, incrementSemverPatch } from '@dxos/edge-compute';
|
|
15
17
|
import { bundleFunction, initializeBundler } from '@dxos/edge-compute/bundler';
|
|
18
|
+
import { Identity } from '@dxos/halo';
|
|
16
19
|
import { FunctionRuntimeKind } from '@dxos/protocols';
|
|
17
20
|
|
|
18
|
-
import { Deploy } from './definitions';
|
|
21
|
+
import { Deploy } from './definitions.ts';
|
|
22
|
+
import { FunctionError } from './errors.ts';
|
|
19
23
|
|
|
20
24
|
export default Deploy.pipe(
|
|
21
25
|
Operation.withHandler(
|
|
22
26
|
Effect.fn(function* ({ function: fn }) {
|
|
23
27
|
const loaded = yield* Database.load(fn);
|
|
24
|
-
const client = yield* ClientService;
|
|
25
28
|
if (!loaded.source) {
|
|
26
|
-
return yield* Effect.fail(new
|
|
29
|
+
return yield* Effect.fail(new FunctionError({ message: 'Function has no source script.' }));
|
|
27
30
|
}
|
|
28
31
|
const script = (yield* Database.load(loaded.source)) as Script.Script;
|
|
29
32
|
|
|
30
33
|
const db = Obj.getDatabase(loaded);
|
|
31
34
|
if (!db || !script.source?.target?.content) {
|
|
32
|
-
return yield* Effect.fail(new
|
|
35
|
+
return yield* Effect.fail(new FunctionError({ message: 'Script source or space not available' }));
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
yield* Effect.promise(() => initializeBundler({ wasmUrl }));
|
|
@@ -41,12 +44,12 @@ export default Deploy.pipe(
|
|
|
41
44
|
const existingFunctionId = getUserFunctionIdInMetadata(Obj.getMeta(loaded));
|
|
42
45
|
const currentVersion = Obj.getMeta(loaded).version;
|
|
43
46
|
|
|
44
|
-
const identity =
|
|
47
|
+
const identity = Option.getOrUndefined(yield* Identity.getSnapshot);
|
|
45
48
|
if (!identity) {
|
|
46
|
-
return yield* Effect.fail(new
|
|
49
|
+
return yield* Effect.fail(new FunctionError({ message: 'Identity not available.' }));
|
|
47
50
|
}
|
|
48
51
|
|
|
49
|
-
const functionsService = FunctionsServiceClient
|
|
52
|
+
const functionsService = new FunctionsServiceClient(yield* EdgeHttpClientService);
|
|
50
53
|
const newFunction = yield* Effect.promise(() =>
|
|
51
54
|
functionsService.deploy(Context.default(), {
|
|
52
55
|
ownerUri: identity.did,
|
|
@@ -65,10 +68,11 @@ export default Deploy.pipe(
|
|
|
65
68
|
});
|
|
66
69
|
|
|
67
70
|
const edgeFunctionId = getUserFunctionIdInMetadata(Obj.getMeta(loaded));
|
|
71
|
+
const config = yield* ConfigService;
|
|
68
72
|
return {
|
|
69
73
|
function: Obj.getURI(loaded),
|
|
70
74
|
functionUrl: edgeFunctionId
|
|
71
|
-
? `${
|
|
75
|
+
? `${config.values.runtime?.services?.edge?.url ?? ''}/functions/${edgeFunctionId}`
|
|
72
76
|
: undefined,
|
|
73
77
|
};
|
|
74
78
|
}),
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { BaseError } from '@dxos/errors';
|
|
6
|
+
|
|
7
|
+
/** Function operation failed. The underlying failure, where there is one, is the `cause`. */
|
|
8
|
+
export class FunctionError extends BaseError.extend('FunctionError', 'Function operation failed.') {}
|
|
@@ -15,18 +15,18 @@ import {
|
|
|
15
15
|
QueryDeployedFunctions,
|
|
16
16
|
Read,
|
|
17
17
|
Update,
|
|
18
|
-
} from './definitions';
|
|
18
|
+
} from './definitions.ts';
|
|
19
19
|
|
|
20
|
-
export * from './definitions';
|
|
20
|
+
export * from './definitions.ts';
|
|
21
21
|
|
|
22
22
|
export const ScriptHandlers = OperationHandlerSet.lazy([
|
|
23
|
-
Create.pipe(Operation.lazyHandler(() => import('./create'))),
|
|
24
|
-
Read.pipe(Operation.lazyHandler(() => import('./read'))),
|
|
25
|
-
Update.pipe(Operation.lazyHandler(() => import('./update'))),
|
|
26
|
-
Delete.pipe(Operation.lazyHandler(() => import('./delete'))),
|
|
27
|
-
Deploy.pipe(Operation.lazyHandler(() => import('./deploy'))),
|
|
28
|
-
Invoke.pipe(Operation.lazyHandler(() => import('./invoke'))),
|
|
29
|
-
InspectInvocations.pipe(Operation.lazyHandler(() => import('./inspect-invocations'))),
|
|
30
|
-
QueryDeployedFunctions.pipe(Operation.lazyHandler(() => import('./query-deployed-functions'))),
|
|
31
|
-
InstallFunction.pipe(Operation.lazyHandler(() => import('./install-function'))),
|
|
23
|
+
Create.pipe(Operation.lazyHandler(() => import('./create.ts'))),
|
|
24
|
+
Read.pipe(Operation.lazyHandler(() => import('./read.ts'))),
|
|
25
|
+
Update.pipe(Operation.lazyHandler(() => import('./update.ts'))),
|
|
26
|
+
Delete.pipe(Operation.lazyHandler(() => import('./delete.ts'))),
|
|
27
|
+
Deploy.pipe(Operation.lazyHandler(() => import('./deploy.ts'))),
|
|
28
|
+
Invoke.pipe(Operation.lazyHandler(() => import('./invoke.ts'))),
|
|
29
|
+
InspectInvocations.pipe(Operation.lazyHandler(() => import('./inspect-invocations.ts'))),
|
|
30
|
+
QueryDeployedFunctions.pipe(Operation.lazyHandler(() => import('./query-deployed-functions.ts'))),
|
|
31
|
+
InstallFunction.pipe(Operation.lazyHandler(() => import('./install-function.ts'))),
|
|
32
32
|
]);
|
|
@@ -10,7 +10,7 @@ import { InvocationTraceEndEvent, InvocationTraceStartEvent, createInvocationSpa
|
|
|
10
10
|
import * as Operation from '@dxos/compute/Operation';
|
|
11
11
|
import { Database, Feed, Filter, Obj, Query } from '@dxos/echo';
|
|
12
12
|
|
|
13
|
-
import { InspectInvocations } from './definitions';
|
|
13
|
+
import { InspectInvocations } from './definitions.ts';
|
|
14
14
|
|
|
15
15
|
export default InspectInvocations.pipe(
|
|
16
16
|
Operation.withHandler(
|
|
@@ -4,35 +4,32 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
|
-
import { ClientService } from '@dxos/client';
|
|
8
7
|
import * as Operation from '@dxos/compute/Operation';
|
|
9
8
|
import { Context } from '@dxos/context';
|
|
10
|
-
import { Filter, Obj } from '@dxos/echo';
|
|
9
|
+
import { Database, Filter, Hypergraph, Obj } from '@dxos/echo';
|
|
10
|
+
import { EdgeHttpClientService } from '@dxos/edge-client';
|
|
11
11
|
import { FunctionsServiceClient } from '@dxos/edge-compute';
|
|
12
12
|
|
|
13
|
-
import { InstallFunction } from './definitions';
|
|
13
|
+
import { InstallFunction } from './definitions.ts';
|
|
14
|
+
import { FunctionError } from './errors.ts';
|
|
14
15
|
|
|
15
16
|
export default InstallFunction.pipe(
|
|
16
17
|
Operation.withHandler(
|
|
17
18
|
Effect.fn(function* ({ key }) {
|
|
18
|
-
const
|
|
19
|
-
const functionsService = FunctionsServiceClient.fromClient(client);
|
|
19
|
+
const functionsService = new FunctionsServiceClient(yield* EdgeHttpClientService);
|
|
20
20
|
const deployed = yield* Effect.promise(() => functionsService.query(Context.default()));
|
|
21
21
|
|
|
22
22
|
const fn = deployed.findLast((entry) => Obj.getMeta(entry).key === key);
|
|
23
23
|
if (!fn) {
|
|
24
|
-
return yield* Effect.fail(new
|
|
24
|
+
return yield* Effect.fail(new FunctionError({ message: `No deployed function found with key: ${key}` }));
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
yield* Effect.promise(() => client.addTypes([Operation.PersistentOperation]));
|
|
27
|
+
const { db } = yield* Database.Service;
|
|
28
|
+
const { graph } = yield* Hypergraph.Service;
|
|
29
|
+
graph.registry.add([Operation.PersistentOperation]);
|
|
33
30
|
|
|
34
31
|
const existingFunctions = yield* Effect.promise(() =>
|
|
35
|
-
|
|
32
|
+
db.query(Filter.and(Filter.type(Operation.PersistentOperation), Filter.key(key))).run(),
|
|
36
33
|
);
|
|
37
34
|
|
|
38
35
|
let installed: Operation.PersistentOperation;
|
|
@@ -43,7 +40,7 @@ export default InstallFunction.pipe(
|
|
|
43
40
|
}
|
|
44
41
|
} else {
|
|
45
42
|
installed = Obj.clone(fn);
|
|
46
|
-
|
|
43
|
+
db.add(installed);
|
|
47
44
|
}
|
|
48
45
|
|
|
49
46
|
return {
|
|
@@ -4,26 +4,26 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
|
-
import { ClientService } from '@dxos/client';
|
|
8
7
|
import * as Operation from '@dxos/compute/Operation';
|
|
9
8
|
import { Context } from '@dxos/context';
|
|
10
9
|
import { Database, Obj } from '@dxos/echo';
|
|
10
|
+
import { EdgeHttpClientService } from '@dxos/edge-client';
|
|
11
11
|
import { FunctionsServiceClient } from '@dxos/edge-compute';
|
|
12
12
|
|
|
13
|
-
import { Invoke } from './definitions';
|
|
13
|
+
import { Invoke } from './definitions.ts';
|
|
14
|
+
import { FunctionError } from './errors.ts';
|
|
14
15
|
|
|
15
16
|
export default Invoke.pipe(
|
|
16
17
|
Operation.withHandler(
|
|
17
18
|
Effect.fn(function* ({ function: fn, payload }) {
|
|
18
19
|
const loaded = yield* Database.load(fn);
|
|
19
|
-
const client = yield* ClientService;
|
|
20
20
|
|
|
21
21
|
const spaceId = Obj.getDatabase(loaded)?.spaceId;
|
|
22
22
|
if (!spaceId) {
|
|
23
|
-
return yield* Effect.fail(new
|
|
23
|
+
return yield* Effect.fail(new FunctionError({ message: 'Function is not in a space.' }));
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
const functionsService = FunctionsServiceClient
|
|
26
|
+
const functionsService = new FunctionsServiceClient(yield* EdgeHttpClientService);
|
|
27
27
|
const result = yield* Effect.promise(() =>
|
|
28
28
|
functionsService.invoke(Context.default(), loaded, payload ?? {}, { spaceId }),
|
|
29
29
|
);
|
|
@@ -4,19 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
|
-
import { ClientService } from '@dxos/client';
|
|
8
7
|
import * as Operation from '@dxos/compute/Operation';
|
|
9
8
|
import { Context } from '@dxos/context';
|
|
10
9
|
import { Obj } from '@dxos/echo';
|
|
10
|
+
import { EdgeHttpClientService } from '@dxos/edge-client';
|
|
11
11
|
import { FunctionsServiceClient } from '@dxos/edge-compute';
|
|
12
12
|
|
|
13
|
-
import { QueryDeployedFunctions } from './definitions';
|
|
13
|
+
import { QueryDeployedFunctions } from './definitions.ts';
|
|
14
14
|
|
|
15
15
|
export default QueryDeployedFunctions.pipe(
|
|
16
16
|
Operation.withHandler(
|
|
17
17
|
Effect.fn(function* () {
|
|
18
|
-
const
|
|
19
|
-
const functionsService = FunctionsServiceClient.fromClient(client);
|
|
18
|
+
const functionsService = new FunctionsServiceClient(yield* EdgeHttpClientService);
|
|
20
19
|
const deployed = yield* Effect.promise(() => functionsService.query(Context.default()));
|
|
21
20
|
return {
|
|
22
21
|
functions: deployed.map((fn) => {
|
|
@@ -8,14 +8,15 @@ import * as Operation from '@dxos/compute/Operation';
|
|
|
8
8
|
import type * as Script from '@dxos/compute/Script';
|
|
9
9
|
import { Database } from '@dxos/echo';
|
|
10
10
|
|
|
11
|
-
import { Read } from './definitions';
|
|
11
|
+
import { Read } from './definitions.ts';
|
|
12
|
+
import { FunctionError } from './errors.ts';
|
|
12
13
|
|
|
13
14
|
export default Read.pipe(
|
|
14
15
|
Operation.withHandler(
|
|
15
16
|
Effect.fn(function* ({ function: fn }) {
|
|
16
17
|
const loaded = yield* Database.load(fn);
|
|
17
18
|
if (!loaded.source) {
|
|
18
|
-
return yield* Effect.fail(new
|
|
19
|
+
return yield* Effect.fail(new FunctionError({ message: 'Function has no source script.' }));
|
|
19
20
|
}
|
|
20
21
|
const script = (yield* Database.load(loaded.source)) as Script.Script;
|
|
21
22
|
const text = yield* Database.load(script.source);
|
|
@@ -9,14 +9,15 @@ import type * as Script from '@dxos/compute/Script';
|
|
|
9
9
|
import { Database, Obj } from '@dxos/echo';
|
|
10
10
|
import { Doc, applyEdits } from '@dxos/echo-doc';
|
|
11
11
|
|
|
12
|
-
import { Update } from './definitions';
|
|
12
|
+
import { Update } from './definitions.ts';
|
|
13
|
+
import { FunctionError } from './errors.ts';
|
|
13
14
|
|
|
14
15
|
export default Update.pipe(
|
|
15
16
|
Operation.withHandler(
|
|
16
17
|
Effect.fn(function* ({ function: fn, name, description, edits }) {
|
|
17
18
|
const loaded = yield* Database.load(fn);
|
|
18
19
|
if (!loaded.source) {
|
|
19
|
-
return yield* Effect.fail(new
|
|
20
|
+
return yield* Effect.fail(new FunctionError({ message: 'Function has no source script.' }));
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
const script = (yield* Database.load(loaded.source)) as Script.Script;
|
package/src/skills/index.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import * as LanguageModel from 'effect/ai/LanguageModel';
|
|
5
6
|
import * as Effect from 'effect/Effect';
|
|
6
7
|
import * as Schema from 'effect/Schema';
|
|
7
8
|
import * as Stream from 'effect/Stream';
|
|
8
|
-
import * as LanguageModel from 'effect/unstable/ai/LanguageModel';
|
|
9
9
|
|
|
10
10
|
import { AiService } from '@dxos/ai';
|
|
11
11
|
import * as Operation from '@dxos/compute/Operation';
|
|
@@ -27,7 +27,7 @@ const Anthropic = Operation.make({
|
|
|
27
27
|
export default Anthropic.pipe(
|
|
28
28
|
Operation.withHandler(
|
|
29
29
|
Effect.fn(function* ({ message }) {
|
|
30
|
-
const model = AiService.
|
|
30
|
+
const model = AiService.languageModel('com.anthropic.model.claude-sonnet-5.default');
|
|
31
31
|
|
|
32
32
|
//
|
|
33
33
|
// Basic example.
|
|
@@ -215,7 +215,7 @@ export default Commentary.pipe(
|
|
|
215
215
|
},
|
|
216
216
|
Effect.provide(
|
|
217
217
|
Layer.mergeAll(
|
|
218
|
-
AiService.
|
|
218
|
+
AiService.languageModel('com.anthropic.model.claude-haiku-4-5.default'),
|
|
219
219
|
ToolResolverService.layerEmpty,
|
|
220
220
|
ToolExecutionService.layerEmpty,
|
|
221
221
|
Trace.writerLayerNoop,
|
|
@@ -2,16 +2,19 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import * as Data from 'effect/Data';
|
|
5
6
|
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as FetchHttpClient from 'effect/http/FetchHttpClient';
|
|
8
|
+
import * as HttpClient from 'effect/http/HttpClient';
|
|
9
|
+
import * as HttpClientRequest from 'effect/http/HttpClientRequest';
|
|
6
10
|
import * as Schedule from 'effect/Schedule';
|
|
7
11
|
import * as Schema from 'effect/Schema';
|
|
8
|
-
import * as FetchHttpClient from 'effect/unstable/http/FetchHttpClient';
|
|
9
|
-
import * as HttpClient from 'effect/unstable/http/HttpClient';
|
|
10
|
-
import * as HttpClientRequest from 'effect/unstable/http/HttpClientRequest';
|
|
11
12
|
|
|
12
13
|
import * as Operation from '@dxos/compute/Operation';
|
|
13
14
|
import { DXN } from '@dxos/keys';
|
|
14
15
|
|
|
16
|
+
class NoRateError extends Data.TaggedError('NoRateError')<{ from: string; to: string }> {}
|
|
17
|
+
|
|
15
18
|
const ForexEffect = Operation.make({
|
|
16
19
|
meta: {
|
|
17
20
|
key: DXN.make('com.example.operation.script.forexEffect'),
|
|
@@ -40,7 +43,7 @@ export default ForexEffect.pipe(
|
|
|
40
43
|
|
|
41
44
|
const rate = json?.data?.rates?.[to];
|
|
42
45
|
if (rate == null) {
|
|
43
|
-
return yield* Effect.fail(new
|
|
46
|
+
return yield* Effect.fail(new NoRateError({ from, to }));
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
return rate.toString();
|
package/src/testing/index.ts
CHANGED
package/src/translations.ts
CHANGED
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Script from '@dxos/compute/Script';
|
|
6
6
|
import { Type } from '@dxos/echo';
|
|
7
|
-
import {
|
|
7
|
+
import { translations as queryTranslations } from '@dxos/react-ui-query/translations';
|
|
8
|
+
import type * as Theme from '@dxos/react-ui/Theme';
|
|
8
9
|
|
|
9
10
|
import { meta } from '#meta';
|
|
10
11
|
import { Notebook } from '#types';
|
|
11
12
|
|
|
12
13
|
export const translations = [
|
|
14
|
+
...queryTranslations,
|
|
13
15
|
{
|
|
14
16
|
'en-US': {
|
|
15
17
|
[Type.getTypename(Script.Script)]: {
|
|
@@ -105,4 +107,4 @@ export const translations = [
|
|
|
105
107
|
},
|
|
106
108
|
},
|
|
107
109
|
},
|
|
108
|
-
] as const satisfies Resource[];
|
|
110
|
+
] as const satisfies Theme.Resource[];
|
package/src/types/Notebook.ts
CHANGED
|
@@ -6,8 +6,6 @@ import * as Schema from 'effect/Schema';
|
|
|
6
6
|
|
|
7
7
|
import * as Instructions from '@dxos/compute/Instructions';
|
|
8
8
|
import { Annotation, DXN, Obj, Ref, Type } from '@dxos/echo';
|
|
9
|
-
import { FormInputAnnotation } from '@dxos/echo/Annotation';
|
|
10
|
-
import { LabelAnnotation } from '@dxos/echo/Annotation';
|
|
11
9
|
import * as Graph from '@dxos/plugin-explorer/Graph';
|
|
12
10
|
import { Text } from '@dxos/schema';
|
|
13
11
|
|
|
@@ -28,8 +26,12 @@ export type Cell = Schema.Schema.Type<typeof Cell>;
|
|
|
28
26
|
export class Notebook extends Type.makeObject<Notebook>(DXN.make('org.dxos.type.notebook', '0.1.0'))(
|
|
29
27
|
Schema.Struct({
|
|
30
28
|
name: Schema.String.pipe(Schema.optional),
|
|
31
|
-
cells: Cell.pipe(Schema.Array, FormInputAnnotation.set(false)),
|
|
32
|
-
}).pipe(
|
|
29
|
+
cells: Cell.pipe(Schema.Array, Annotation.FormInputAnnotation.set(false)),
|
|
30
|
+
}).pipe(
|
|
31
|
+
Annotation.LabelAnnotation.set(['name']),
|
|
32
|
+
Annotation.IconAnnotation.set({ icon: 'ph--notebook--regular', hue: 'sky' }),
|
|
33
|
+
Annotation.UserType.set(),
|
|
34
|
+
),
|
|
33
35
|
) {}
|
|
34
36
|
|
|
35
37
|
export const make = (props: Obj.MakeProps<typeof Notebook> = { cells: [] }): Notebook => Obj.make(Notebook, props);
|