@dxos/react-ui-canvas-compute 0.9.1-staging.ee54ba693a → 0.11.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/dist/lib/index.mjs +2164 -0
- package/dist/lib/index.mjs.map +1 -0
- package/dist/types/src/compute.stories.d.ts.map +1 -1
- package/dist/types/src/shapes/Append.d.ts +2 -51
- package/dist/types/src/shapes/Append.d.ts.map +1 -1
- package/dist/types/src/shapes/Array.d.ts +2 -34
- package/dist/types/src/shapes/Array.d.ts.map +1 -1
- package/dist/types/src/shapes/Audio.d.ts +2 -51
- package/dist/types/src/shapes/Audio.d.ts.map +1 -1
- package/dist/types/src/shapes/Beacon.d.ts +2 -51
- package/dist/types/src/shapes/Beacon.d.ts.map +1 -1
- package/dist/types/src/shapes/Chat.d.ts +2 -51
- package/dist/types/src/shapes/Chat.d.ts.map +1 -1
- package/dist/types/src/shapes/Constant.d.ts +2 -53
- package/dist/types/src/shapes/Constant.d.ts.map +1 -1
- package/dist/types/src/shapes/Database.d.ts +2 -51
- package/dist/types/src/shapes/Database.d.ts.map +1 -1
- package/dist/types/src/shapes/Feed.d.ts +2 -51
- package/dist/types/src/shapes/Feed.d.ts.map +1 -1
- package/dist/types/src/shapes/Function.d.ts +7 -50
- package/dist/types/src/shapes/Function.d.ts.map +1 -1
- package/dist/types/src/shapes/Gpt.d.ts +2 -51
- package/dist/types/src/shapes/Gpt.d.ts.map +1 -1
- package/dist/types/src/shapes/GptRealtime.d.ts +2 -51
- package/dist/types/src/shapes/GptRealtime.d.ts.map +1 -1
- package/dist/types/src/shapes/Json.d.ts +2 -101
- package/dist/types/src/shapes/Json.d.ts.map +1 -1
- package/dist/types/src/shapes/Logic.d.ts +2 -103
- package/dist/types/src/shapes/Logic.d.ts.map +1 -1
- package/dist/types/src/shapes/RNG.d.ts +2 -55
- package/dist/types/src/shapes/RNG.d.ts.map +1 -1
- package/dist/types/src/shapes/Scope.d.ts +2 -51
- package/dist/types/src/shapes/Scope.d.ts.map +1 -1
- package/dist/types/src/shapes/Surface.d.ts +2 -51
- package/dist/types/src/shapes/Surface.d.ts.map +1 -1
- package/dist/types/src/shapes/Switch.d.ts +2 -51
- package/dist/types/src/shapes/Switch.d.ts.map +1 -1
- package/dist/types/src/shapes/Table.d.ts +2 -51
- package/dist/types/src/shapes/Table.d.ts.map +1 -1
- package/dist/types/src/shapes/Template.d.ts +4 -55
- package/dist/types/src/shapes/Template.d.ts.map +1 -1
- package/dist/types/src/shapes/Text.d.ts +2 -51
- package/dist/types/src/shapes/Text.d.ts.map +1 -1
- package/dist/types/src/shapes/TextToImage.d.ts +2 -51
- package/dist/types/src/shapes/TextToImage.d.ts.map +1 -1
- package/dist/types/src/shapes/Thread.d.ts +2 -51
- package/dist/types/src/shapes/Thread.d.ts.map +1 -1
- package/dist/types/src/shapes/Trigger.d.ts +2 -17
- package/dist/types/src/shapes/Trigger.d.ts.map +1 -1
- package/dist/types/src/shapes/append-def.d.ts +52 -0
- package/dist/types/src/shapes/append-def.d.ts.map +1 -0
- package/dist/types/src/shapes/array-def.d.ts +35 -0
- package/dist/types/src/shapes/array-def.d.ts.map +1 -0
- package/dist/types/src/shapes/audio-def.d.ts +52 -0
- package/dist/types/src/shapes/audio-def.d.ts.map +1 -0
- package/dist/types/src/shapes/beacon-def.d.ts +52 -0
- package/dist/types/src/shapes/beacon-def.d.ts.map +1 -0
- package/dist/types/src/shapes/chat-def.d.ts +52 -0
- package/dist/types/src/shapes/chat-def.d.ts.map +1 -0
- package/dist/types/src/shapes/common/Box.d.ts +0 -2
- package/dist/types/src/shapes/common/Box.d.ts.map +1 -1
- package/dist/types/src/shapes/common/FunctionBody.d.ts +1 -3
- package/dist/types/src/shapes/common/FunctionBody.d.ts.map +1 -1
- package/dist/types/src/shapes/common/box-defs.d.ts +3 -0
- package/dist/types/src/shapes/common/box-defs.d.ts.map +1 -0
- package/dist/types/src/shapes/common/function-anchors.d.ts +7 -0
- package/dist/types/src/shapes/common/function-anchors.d.ts.map +1 -0
- package/dist/types/src/shapes/common/index.d.ts +2 -0
- package/dist/types/src/shapes/common/index.d.ts.map +1 -1
- package/dist/types/src/shapes/constant-def.d.ts +54 -0
- package/dist/types/src/shapes/constant-def.d.ts.map +1 -0
- package/dist/types/src/shapes/database-def.d.ts +52 -0
- package/dist/types/src/shapes/database-def.d.ts.map +1 -0
- package/dist/types/src/shapes/feed-def.d.ts +52 -0
- package/dist/types/src/shapes/feed-def.d.ts.map +1 -0
- package/dist/types/src/shapes/function-def.d.ts +52 -0
- package/dist/types/src/shapes/function-def.d.ts.map +1 -0
- package/dist/types/src/shapes/gpt-def.d.ts +52 -0
- package/dist/types/src/shapes/gpt-def.d.ts.map +1 -0
- package/dist/types/src/shapes/gpt-realtime-def.d.ts +52 -0
- package/dist/types/src/shapes/gpt-realtime-def.d.ts.map +1 -0
- package/dist/types/src/shapes/index.d.ts +23 -0
- package/dist/types/src/shapes/index.d.ts.map +1 -1
- package/dist/types/src/shapes/json-def.d.ts +102 -0
- package/dist/types/src/shapes/json-def.d.ts.map +1 -0
- package/dist/types/src/shapes/logic-def.d.ts +104 -0
- package/dist/types/src/shapes/logic-def.d.ts.map +1 -0
- package/dist/types/src/shapes/rng-def.d.ts +56 -0
- package/dist/types/src/shapes/rng-def.d.ts.map +1 -0
- package/dist/types/src/shapes/scope-def.d.ts +52 -0
- package/dist/types/src/shapes/scope-def.d.ts.map +1 -0
- package/dist/types/src/shapes/surface-def.d.ts +52 -0
- package/dist/types/src/shapes/surface-def.d.ts.map +1 -0
- package/dist/types/src/shapes/switch-def.d.ts +52 -0
- package/dist/types/src/shapes/switch-def.d.ts.map +1 -0
- package/dist/types/src/shapes/table-def.d.ts +52 -0
- package/dist/types/src/shapes/table-def.d.ts.map +1 -0
- package/dist/types/src/shapes/template-def.d.ts +56 -0
- package/dist/types/src/shapes/template-def.d.ts.map +1 -0
- package/dist/types/src/shapes/text-def.d.ts +52 -0
- package/dist/types/src/shapes/text-def.d.ts.map +1 -0
- package/dist/types/src/shapes/text-to-image-def.d.ts +52 -0
- package/dist/types/src/shapes/text-to-image-def.d.ts.map +1 -0
- package/dist/types/src/shapes/thread-def.d.ts +52 -0
- package/dist/types/src/shapes/thread-def.d.ts.map +1 -0
- package/dist/types/src/shapes/trigger-def.d.ts +18 -0
- package/dist/types/src/shapes/trigger-def.d.ts.map +1 -0
- package/dist/types/src/shapes/trigger-spec.d.ts +9 -0
- package/dist/types/src/shapes/trigger-spec.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +43 -46
- package/src/compute.stories.tsx +1 -1
- package/src/shapes/Append.tsx +3 -31
- package/src/shapes/Array.tsx +3 -43
- package/src/shapes/Audio.tsx +2 -26
- package/src/shapes/Beacon.tsx +2 -29
- package/src/shapes/Chat.tsx +1 -36
- package/src/shapes/Constant.tsx +1 -37
- package/src/shapes/Database.tsx +2 -27
- package/src/shapes/Feed.tsx +4 -35
- package/src/shapes/Function.tsx +4 -38
- package/src/shapes/Gpt.tsx +3 -33
- package/src/shapes/GptRealtime.tsx +2 -36
- package/src/shapes/Json.tsx +4 -70
- package/src/shapes/Logic.tsx +3 -58
- package/src/shapes/RNG.tsx +2 -32
- package/src/shapes/Scope.tsx +2 -31
- package/src/shapes/Surface.tsx +2 -32
- package/src/shapes/Switch.tsx +2 -26
- package/src/shapes/Table.tsx +3 -34
- package/src/shapes/Template.tsx +6 -36
- package/src/shapes/Text.tsx +2 -28
- package/src/shapes/TextToImage.tsx +2 -27
- package/src/shapes/Thread.tsx +3 -34
- package/src/shapes/Trigger.tsx +6 -79
- package/src/shapes/append-def.ts +42 -0
- package/src/shapes/array-def.ts +54 -0
- package/src/shapes/audio-def.ts +36 -0
- package/src/shapes/beacon-def.ts +39 -0
- package/src/shapes/chat-def.tsx +47 -0
- package/src/shapes/common/Box.tsx +2 -5
- package/src/shapes/common/FunctionBody.tsx +6 -25
- package/src/shapes/common/box-defs.ts +10 -0
- package/src/shapes/common/function-anchors.ts +37 -0
- package/src/shapes/common/index.ts +3 -0
- package/src/shapes/constant-def.tsx +48 -0
- package/src/shapes/database-def.ts +37 -0
- package/src/shapes/feed-def.ts +44 -0
- package/src/shapes/function-def.ts +46 -0
- package/src/shapes/gpt-def.ts +43 -0
- package/src/shapes/gpt-realtime-def.ts +46 -0
- package/src/shapes/index.ts +25 -0
- package/src/shapes/json-def.ts +80 -0
- package/src/shapes/logic-def.ts +69 -0
- package/src/shapes/rng-def.ts +42 -0
- package/src/shapes/scope-def.ts +41 -0
- package/src/shapes/surface-def.ts +42 -0
- package/src/shapes/switch-def.ts +36 -0
- package/src/shapes/table-def.ts +45 -0
- package/src/shapes/template-def.ts +48 -0
- package/src/shapes/text-def.ts +38 -0
- package/src/shapes/text-to-image-def.ts +37 -0
- package/src/shapes/thread-def.ts +45 -0
- package/src/shapes/trigger-def.ts +63 -0
- package/src/shapes/trigger-spec.ts +44 -0
- package/dist/lib/browser/index.mjs +0 -2596
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/node-esm/index.mjs +0 -2596
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-canvas-compute",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "A compute graph extension for the canvas editor component.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -14,9 +14,8 @@
|
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
16
16
|
"source": "./src/index.ts",
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"types": "./dist/types/src/index.d.ts"
|
|
17
|
+
"types": "./dist/types/src/index.d.ts",
|
|
18
|
+
"import": "./dist/lib/index.mjs"
|
|
20
19
|
}
|
|
21
20
|
},
|
|
22
21
|
"types": "dist/types/src/index.d.ts",
|
|
@@ -30,39 +29,37 @@
|
|
|
30
29
|
"@effect/platform": "0.96.2",
|
|
31
30
|
"chess.js": "^1.0.0",
|
|
32
31
|
"workerize-loader": "^2.0.2",
|
|
33
|
-
"@dxos/ai": "0.
|
|
34
|
-
"@dxos/app-framework": "0.
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/compute-runtime": "0.
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/debug": "0.
|
|
43
|
-
"@dxos/echo": "0.
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/graph": "0.
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/react-
|
|
52
|
-
"@dxos/react-
|
|
53
|
-
"@dxos/react-
|
|
54
|
-
"@dxos/react-ui-
|
|
55
|
-
"@dxos/react-ui-canvas-editor": "0.
|
|
56
|
-
"@dxos/react-ui-
|
|
57
|
-
"@dxos/react-ui-editor": "0.
|
|
58
|
-
"@dxos/react-ui-
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/react-ui-syntax-highlighter": "0.
|
|
61
|
-
"@dxos/schema": "0.
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/types": "0.
|
|
64
|
-
"@dxos/util": "0.9.1-staging.ee54ba693a",
|
|
65
|
-
"@dxos/react-ui-form": "0.9.1-staging.ee54ba693a"
|
|
32
|
+
"@dxos/ai": "0.11.0",
|
|
33
|
+
"@dxos/app-framework": "0.11.0",
|
|
34
|
+
"@dxos/app-toolkit": "0.11.0",
|
|
35
|
+
"@dxos/async": "0.11.0",
|
|
36
|
+
"@dxos/assistant": "0.11.0",
|
|
37
|
+
"@dxos/compute": "0.11.0",
|
|
38
|
+
"@dxos/compute-runtime": "0.11.0",
|
|
39
|
+
"@dxos/conductor": "0.11.0",
|
|
40
|
+
"@dxos/context": "0.11.0",
|
|
41
|
+
"@dxos/debug": "0.11.0",
|
|
42
|
+
"@dxos/echo": "0.11.0",
|
|
43
|
+
"@dxos/edge-client": "0.11.0",
|
|
44
|
+
"@dxos/effect": "0.11.0",
|
|
45
|
+
"@dxos/graph": "0.11.0",
|
|
46
|
+
"@dxos/invariant": "0.11.0",
|
|
47
|
+
"@dxos/keys": "0.11.0",
|
|
48
|
+
"@dxos/log": "0.11.0",
|
|
49
|
+
"@dxos/react-client": "0.11.0",
|
|
50
|
+
"@dxos/react-edge-client": "0.11.0",
|
|
51
|
+
"@dxos/react-ui-attention": "0.11.0",
|
|
52
|
+
"@dxos/react-ui-audio": "0.11.0",
|
|
53
|
+
"@dxos/react-ui-canvas": "0.11.0",
|
|
54
|
+
"@dxos/react-ui-canvas-editor": "0.11.0",
|
|
55
|
+
"@dxos/react-ui-experimental": "0.11.0",
|
|
56
|
+
"@dxos/react-ui-editor": "0.11.0",
|
|
57
|
+
"@dxos/react-ui-form": "0.11.0",
|
|
58
|
+
"@dxos/react-ui-mosaic": "0.11.0",
|
|
59
|
+
"@dxos/react-ui-syntax-highlighter": "0.11.0",
|
|
60
|
+
"@dxos/schema": "0.11.0",
|
|
61
|
+
"@dxos/util": "0.11.0",
|
|
62
|
+
"@dxos/types": "0.11.0"
|
|
66
63
|
},
|
|
67
64
|
"devDependencies": {
|
|
68
65
|
"@effect/ai": "0.36.0",
|
|
@@ -74,20 +71,20 @@
|
|
|
74
71
|
"lodash.defaultsdeep": "^4.6.1",
|
|
75
72
|
"react": "~19.2.7",
|
|
76
73
|
"react-dom": "~19.2.7",
|
|
77
|
-
"vite": "^8.
|
|
78
|
-
"@dxos/
|
|
79
|
-
"@dxos/
|
|
80
|
-
"@dxos/
|
|
81
|
-
"@dxos/
|
|
82
|
-
"@dxos/
|
|
83
|
-
"@dxos/
|
|
74
|
+
"vite": "^8.1.4",
|
|
75
|
+
"@dxos/assistant-toolkit": "0.11.0",
|
|
76
|
+
"@dxos/random": "0.11.0",
|
|
77
|
+
"@dxos/react-ui": "0.11.0",
|
|
78
|
+
"@dxos/app-framework": "0.11.0",
|
|
79
|
+
"@dxos/storybook-utils": "0.11.0",
|
|
80
|
+
"@dxos/ui-theme": "0.11.0"
|
|
84
81
|
},
|
|
85
82
|
"peerDependencies": {
|
|
86
83
|
"effect": "3.21.4",
|
|
87
84
|
"react": "~19.2.7",
|
|
88
85
|
"react-dom": "~19.2.7",
|
|
89
|
-
"@dxos/react-ui": "0.
|
|
90
|
-
"@dxos/ui-theme": "0.
|
|
86
|
+
"@dxos/react-ui": "^0.11.0",
|
|
87
|
+
"@dxos/ui-theme": "^0.11.0"
|
|
91
88
|
},
|
|
92
89
|
"publishConfig": {
|
|
93
90
|
"access": "public"
|
package/src/compute.stories.tsx
CHANGED
|
@@ -12,10 +12,10 @@ import { AiServiceTestingPreset } from '@dxos/ai/testing';
|
|
|
12
12
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
13
13
|
import { capabilities } from '@dxos/assistant-toolkit/testing';
|
|
14
14
|
import { Operation } from '@dxos/compute';
|
|
15
|
+
import { configuredCredentialsLayer } from '@dxos/compute-runtime';
|
|
15
16
|
import { TestDatabaseLayer } from '@dxos/compute-runtime/testing';
|
|
16
17
|
import { type ComputeGraphModel, type ComputeNode, type GraphDiagnostic } from '@dxos/conductor';
|
|
17
18
|
import { registryLayerNoop } from '@dxos/echo/testing';
|
|
18
|
-
import { configuredCredentialsLayer } from '@dxos/functions';
|
|
19
19
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
20
20
|
import { Select, Toolbar } from '@dxos/react-ui';
|
|
21
21
|
import { withAttention } from '@dxos/react-ui-attention/testing';
|
package/src/shapes/Append.tsx
CHANGED
|
@@ -2,42 +2,14 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as Schema from 'effect/Schema';
|
|
6
5
|
import React from 'react';
|
|
7
6
|
|
|
8
7
|
import { AppendInput } from '@dxos/conductor';
|
|
9
|
-
import { type ShapeComponentProps
|
|
8
|
+
import { type ShapeComponentProps } from '@dxos/react-ui-canvas-editor';
|
|
10
9
|
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
export const AppendShape = Schema.extend(
|
|
15
|
-
ComputeShape,
|
|
16
|
-
Schema.Struct({
|
|
17
|
-
type: Schema.Literal('append'),
|
|
18
|
-
}),
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
export type AppendShape = Schema.Schema.Type<typeof AppendShape>;
|
|
22
|
-
|
|
23
|
-
export type CreateAppendProps = CreateShapeProps<AppendShape>;
|
|
24
|
-
|
|
25
|
-
export const createAppend = (props: CreateAppendProps) =>
|
|
26
|
-
createShape<AppendShape>({
|
|
27
|
-
type: 'append',
|
|
28
|
-
size: { width: 128, height: getHeight(AppendInput) },
|
|
29
|
-
...props,
|
|
30
|
-
});
|
|
10
|
+
import { type AppendShape } from './append-def';
|
|
11
|
+
import { FunctionBody } from './common';
|
|
31
12
|
|
|
32
13
|
export const AppendComponent = ({ shape }: ShapeComponentProps<AppendShape>) => {
|
|
33
14
|
return <FunctionBody shape={shape} inputSchema={AppendInput} />;
|
|
34
15
|
};
|
|
35
|
-
|
|
36
|
-
export const appendShape: ShapeDef<AppendShape> = {
|
|
37
|
-
type: 'append',
|
|
38
|
-
name: 'Append',
|
|
39
|
-
icon: 'ph--list-plus--regular',
|
|
40
|
-
component: AppendComponent,
|
|
41
|
-
createShape: createAppend,
|
|
42
|
-
getAnchors: (shape) => createFunctionAnchors(shape, AppendInput),
|
|
43
|
-
};
|
package/src/shapes/Array.tsx
CHANGED
|
@@ -2,27 +2,13 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as Schema from 'effect/Schema';
|
|
6
5
|
import React from 'react';
|
|
7
6
|
|
|
8
7
|
import { ReducerInput, ReducerOutput } from '@dxos/conductor';
|
|
9
|
-
import { type ShapeComponentProps
|
|
8
|
+
import { type ShapeComponentProps } from '@dxos/react-ui-canvas-editor';
|
|
10
9
|
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
//
|
|
15
|
-
// Data
|
|
16
|
-
//
|
|
17
|
-
|
|
18
|
-
export const ReducerShape = Schema.extend(
|
|
19
|
-
ComputeShape,
|
|
20
|
-
Schema.Struct({
|
|
21
|
-
type: Schema.Literal('reducer'),
|
|
22
|
-
}),
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
export type ReducerShape = Schema.Schema.Type<typeof ReducerShape>;
|
|
10
|
+
import { type ReducerShape } from './array-def';
|
|
11
|
+
import { FunctionBody } from './common';
|
|
26
12
|
|
|
27
13
|
//
|
|
28
14
|
// Components
|
|
@@ -33,29 +19,3 @@ export type ReducerComponentProps = ShapeComponentProps<ReducerShape>;
|
|
|
33
19
|
export const ReducerComponent = ({ shape }: ReducerComponentProps) => {
|
|
34
20
|
return <FunctionBody shape={shape} inputSchema={ReducerInput} outputSchema={ReducerOutput} />;
|
|
35
21
|
};
|
|
36
|
-
|
|
37
|
-
//
|
|
38
|
-
// Defs
|
|
39
|
-
//
|
|
40
|
-
|
|
41
|
-
export type CreateReduceProps = CreateShapeProps<ReducerShape> & { reduce?: string };
|
|
42
|
-
|
|
43
|
-
export const createReducer = ({
|
|
44
|
-
id,
|
|
45
|
-
size = { width: 192, height: getHeight(ReducerInput) },
|
|
46
|
-
...rest
|
|
47
|
-
}: CreateReduceProps): ReducerShape =>
|
|
48
|
-
createShape<ReducerShape>({
|
|
49
|
-
type: 'reducer',
|
|
50
|
-
size,
|
|
51
|
-
...rest,
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
export const reducerShape: ShapeDef<ReducerShape> = {
|
|
55
|
-
type: 'reducer',
|
|
56
|
-
name: 'Reducer',
|
|
57
|
-
icon: 'ph--repeat--regular',
|
|
58
|
-
component: (props) => <ReducerComponent {...props} />,
|
|
59
|
-
createShape: createReducer,
|
|
60
|
-
getAnchors: (shape) => createFunctionAnchors(shape, ReducerInput, ReducerOutput),
|
|
61
|
-
};
|
package/src/shapes/Audio.tsx
CHANGED
|
@@ -2,29 +2,14 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as Schema from 'effect/Schema';
|
|
6
5
|
import React, { useEffect, useState } from 'react';
|
|
7
6
|
|
|
8
7
|
import { DEFAULT_OUTPUT } from '@dxos/conductor';
|
|
9
8
|
import { Icon } from '@dxos/react-ui';
|
|
10
|
-
import { type ShapeComponentProps
|
|
9
|
+
import { type ShapeComponentProps } from '@dxos/react-ui-canvas-editor';
|
|
11
10
|
|
|
12
11
|
import { useComputeNodeState } from '../hooks';
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
export const AudioShape = Schema.extend(
|
|
16
|
-
ComputeShape,
|
|
17
|
-
Schema.Struct({
|
|
18
|
-
type: Schema.Literal('audio'),
|
|
19
|
-
}),
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
export type AudioShape = Schema.Schema.Type<typeof AudioShape>;
|
|
23
|
-
|
|
24
|
-
export type CreateAudioProps = CreateShapeProps<AudioShape>;
|
|
25
|
-
|
|
26
|
-
export const createAudio = (props: CreateAudioProps) =>
|
|
27
|
-
createShape<AudioShape>({ type: 'audio', size: { width: 64, height: 64 }, ...props });
|
|
12
|
+
import { type AudioShape } from './audio-def';
|
|
28
13
|
|
|
29
14
|
export const AudioComponent = ({ shape }: ShapeComponentProps<AudioShape>) => {
|
|
30
15
|
const { runtime } = useComputeNodeState(shape);
|
|
@@ -45,12 +30,3 @@ export const AudioComponent = ({ shape }: ShapeComponentProps<AudioShape>) => {
|
|
|
45
30
|
</div>
|
|
46
31
|
);
|
|
47
32
|
};
|
|
48
|
-
|
|
49
|
-
export const audioShape: ShapeDef<AudioShape> = {
|
|
50
|
-
type: 'audio',
|
|
51
|
-
name: 'Audio',
|
|
52
|
-
icon: 'ph--microphone--regular',
|
|
53
|
-
component: AudioComponent,
|
|
54
|
-
createShape: createAudio,
|
|
55
|
-
getAnchors: (shape) => createAnchorMap(shape, { [createAnchorId('output')]: { x: 1, y: 0 } }),
|
|
56
|
-
};
|
package/src/shapes/Beacon.tsx
CHANGED
|
@@ -2,29 +2,14 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as Schema from 'effect/Schema';
|
|
6
5
|
import React from 'react';
|
|
7
6
|
|
|
8
7
|
import { DEFAULT_INPUT, isTruthy } from '@dxos/conductor';
|
|
9
8
|
import { Icon } from '@dxos/react-ui';
|
|
10
|
-
import { type ShapeComponentProps
|
|
9
|
+
import { type ShapeComponentProps } from '@dxos/react-ui-canvas-editor';
|
|
11
10
|
|
|
12
11
|
import { useComputeNodeState } from '../hooks';
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
export const BeaconShape = Schema.extend(
|
|
16
|
-
ComputeShape,
|
|
17
|
-
Schema.Struct({
|
|
18
|
-
type: Schema.Literal('beacon'),
|
|
19
|
-
}),
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
export type BeaconShape = Schema.Schema.Type<typeof BeaconShape>;
|
|
23
|
-
|
|
24
|
-
export type CreateBeaconProps = CreateShapeProps<BeaconShape>;
|
|
25
|
-
|
|
26
|
-
export const createBeacon = (props: CreateBeaconProps) =>
|
|
27
|
-
createShape<BeaconShape>({ type: 'beacon', size: { width: 64, height: 64 }, ...props });
|
|
12
|
+
import { type BeaconShape } from './beacon-def';
|
|
28
13
|
|
|
29
14
|
export const BeaconComponent = ({ shape }: ShapeComponentProps<BeaconShape>) => {
|
|
30
15
|
const { runtime } = useComputeNodeState(shape);
|
|
@@ -41,15 +26,3 @@ export const BeaconComponent = ({ shape }: ShapeComponentProps<BeaconShape>) =>
|
|
|
41
26
|
</div>
|
|
42
27
|
);
|
|
43
28
|
};
|
|
44
|
-
|
|
45
|
-
export const beaconShape: ShapeDef<BeaconShape> = {
|
|
46
|
-
type: 'beacon',
|
|
47
|
-
name: 'Beacon',
|
|
48
|
-
icon: 'ph--sun--regular',
|
|
49
|
-
component: BeaconComponent,
|
|
50
|
-
createShape: createBeacon,
|
|
51
|
-
getAnchors: (shape) =>
|
|
52
|
-
createAnchorMap(shape, {
|
|
53
|
-
[createAnchorId('input')]: { x: -1, y: 0 },
|
|
54
|
-
}),
|
|
55
|
-
};
|
package/src/shapes/Chat.tsx
CHANGED
|
@@ -2,35 +2,19 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as Schema from 'effect/Schema';
|
|
6
5
|
import React, { useRef } from 'react';
|
|
7
6
|
|
|
8
7
|
import { DEFAULT_OUTPUT } from '@dxos/conductor';
|
|
9
8
|
import {
|
|
10
9
|
type ShapeComponentProps,
|
|
11
|
-
type ShapeDef,
|
|
12
10
|
TextBox,
|
|
13
11
|
type TextBoxControl,
|
|
14
12
|
type TextBoxProps,
|
|
15
13
|
} from '@dxos/react-ui-canvas-editor';
|
|
16
|
-
import { createAnchorMap } from '@dxos/react-ui-canvas-editor';
|
|
17
14
|
|
|
18
15
|
import { useComputeNodeState } from '../hooks';
|
|
16
|
+
import { type ChatShape } from './chat-def';
|
|
19
17
|
import { Box } from './common';
|
|
20
|
-
import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
|
|
21
|
-
|
|
22
|
-
//
|
|
23
|
-
// Data
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
export const ChatShape = Schema.extend(
|
|
27
|
-
ComputeShape,
|
|
28
|
-
Schema.Struct({
|
|
29
|
-
type: Schema.Literal('chat'),
|
|
30
|
-
}),
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
export type ChatShape = Schema.Schema.Type<typeof ChatShape>;
|
|
34
18
|
|
|
35
19
|
//
|
|
36
20
|
// Component
|
|
@@ -56,22 +40,3 @@ export const TextInputComponent = ({ shape, title, ...props }: TextInputComponen
|
|
|
56
40
|
</Box>
|
|
57
41
|
);
|
|
58
42
|
};
|
|
59
|
-
|
|
60
|
-
//
|
|
61
|
-
// Defs
|
|
62
|
-
//
|
|
63
|
-
|
|
64
|
-
export type CreateChatProps = CreateShapeProps<ChatShape>;
|
|
65
|
-
|
|
66
|
-
export const createChat = (props: CreateChatProps) =>
|
|
67
|
-
createShape<ChatShape>({ type: 'chat', size: { width: 256, height: 128 }, ...props });
|
|
68
|
-
|
|
69
|
-
export const chatShape: ShapeDef<ChatShape> = {
|
|
70
|
-
type: 'chat',
|
|
71
|
-
name: 'Chat',
|
|
72
|
-
icon: 'ph--textbox--regular',
|
|
73
|
-
component: (props) => <TextInputComponent {...props} title={'Prompt'} placeholder={'Message'} />,
|
|
74
|
-
createShape: createChat,
|
|
75
|
-
getAnchors: (shape) => createAnchorMap(shape, { [createAnchorId('output')]: { x: 1, y: 0 } }),
|
|
76
|
-
resizable: true,
|
|
77
|
-
};
|
package/src/shapes/Constant.tsx
CHANGED
|
@@ -2,38 +2,21 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as Schema from 'effect/Schema';
|
|
6
5
|
import React, { useCallback, useRef, useState } from 'react';
|
|
7
6
|
|
|
8
7
|
import { ComputeValueType } from '@dxos/conductor';
|
|
9
8
|
import { Input } from '@dxos/react-ui';
|
|
10
9
|
import {
|
|
11
10
|
type ShapeComponentProps,
|
|
12
|
-
type ShapeDef,
|
|
13
11
|
TextBox,
|
|
14
12
|
type TextBoxControl,
|
|
15
13
|
type TextBoxProps,
|
|
16
14
|
} from '@dxos/react-ui-canvas-editor';
|
|
17
|
-
import { createAnchorMap } from '@dxos/react-ui-canvas-editor';
|
|
18
15
|
import { safeParseJson } from '@dxos/util';
|
|
19
16
|
|
|
20
17
|
import { useComputeNodeState } from '../hooks';
|
|
21
18
|
import { Box, TypeSelect } from './common';
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
//
|
|
25
|
-
// Data
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
export const ConstantShape = Schema.extend(
|
|
29
|
-
ComputeShape,
|
|
30
|
-
Schema.Struct({
|
|
31
|
-
type: Schema.Literal('constant'),
|
|
32
|
-
value: Schema.optional(Schema.Any),
|
|
33
|
-
}),
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
export type ConstantShape = Schema.Schema.Type<typeof ConstantShape>;
|
|
19
|
+
import { type ConstantShape } from './constant-def';
|
|
37
20
|
|
|
38
21
|
//
|
|
39
22
|
// Component
|
|
@@ -104,22 +87,3 @@ export const ConstantComponent = ({ shape, title, chat, ...props }: ConstantComp
|
|
|
104
87
|
</Box>
|
|
105
88
|
);
|
|
106
89
|
};
|
|
107
|
-
|
|
108
|
-
//
|
|
109
|
-
// Defs
|
|
110
|
-
//
|
|
111
|
-
|
|
112
|
-
export type CreateConstantProps = CreateShapeProps<ConstantShape>;
|
|
113
|
-
|
|
114
|
-
export const createConstant = (props: CreateConstantProps) =>
|
|
115
|
-
createShape<ConstantShape>({ type: 'constant', size: { width: 192, height: 128 }, ...props });
|
|
116
|
-
|
|
117
|
-
export const constantShape: ShapeDef<ConstantShape> = {
|
|
118
|
-
type: 'constant',
|
|
119
|
-
name: 'Value',
|
|
120
|
-
icon: 'ph--dots-three-circle--regular',
|
|
121
|
-
component: (props) => <ConstantComponent {...props} placeholder={'Constant'} />,
|
|
122
|
-
createShape: createConstant,
|
|
123
|
-
getAnchors: (shape) => createAnchorMap(shape, { [createAnchorId('output')]: { x: 1, y: 0 } }),
|
|
124
|
-
resizable: true,
|
|
125
|
-
};
|
package/src/shapes/Database.tsx
CHANGED
|
@@ -2,38 +2,13 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as Schema from 'effect/Schema';
|
|
6
5
|
import React from 'react';
|
|
7
6
|
|
|
8
|
-
import { type ShapeComponentProps
|
|
9
|
-
import { createAnchorMap } from '@dxos/react-ui-canvas-editor';
|
|
7
|
+
import { type ShapeComponentProps } from '@dxos/react-ui-canvas-editor';
|
|
10
8
|
|
|
11
9
|
import { Box } from './common';
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
export const DatabaseShape = Schema.extend(
|
|
15
|
-
ComputeShape,
|
|
16
|
-
Schema.Struct({
|
|
17
|
-
type: Schema.Literal('database'),
|
|
18
|
-
}),
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
export type DatabaseShape = Schema.Schema.Type<typeof DatabaseShape>;
|
|
22
|
-
|
|
23
|
-
export type CreateDatabaseProps = CreateShapeProps<DatabaseShape>;
|
|
24
|
-
|
|
25
|
-
export const createDatabase = (props: CreateDatabaseProps) =>
|
|
26
|
-
createShape<DatabaseShape>({ type: 'database', size: { width: 128, height: 64 }, ...props });
|
|
10
|
+
import { type DatabaseShape } from './database-def';
|
|
27
11
|
|
|
28
12
|
export const DatabaseComponent = ({ shape }: ShapeComponentProps<DatabaseShape>) => {
|
|
29
13
|
return <Box shape={shape} />;
|
|
30
14
|
};
|
|
31
|
-
|
|
32
|
-
export const databaseShape: ShapeDef<DatabaseShape> = {
|
|
33
|
-
type: 'database',
|
|
34
|
-
name: 'ECHO',
|
|
35
|
-
icon: 'ph--database--regular',
|
|
36
|
-
component: DatabaseComponent,
|
|
37
|
-
createShape: createDatabase,
|
|
38
|
-
getAnchors: (shape) => createAnchorMap(shape, { [createAnchorId('output')]: { x: 1, y: 0 } }),
|
|
39
|
-
};
|
package/src/shapes/Feed.tsx
CHANGED
|
@@ -2,36 +2,16 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as Schema from 'effect/Schema';
|
|
6
5
|
import React, { Fragment } from 'react';
|
|
7
6
|
|
|
8
|
-
import { DEFAULT_OUTPUT
|
|
7
|
+
import { DEFAULT_OUTPUT } from '@dxos/conductor';
|
|
9
8
|
import { ScrollArea, type ThemedClassName } from '@dxos/react-ui';
|
|
10
|
-
import { type ShapeComponentProps
|
|
9
|
+
import { type ShapeComponentProps } from '@dxos/react-ui-canvas-editor';
|
|
11
10
|
import { mx } from '@dxos/ui-theme';
|
|
12
11
|
|
|
13
12
|
import { useComputeNodeState } from '../hooks';
|
|
14
|
-
import { createFunctionAnchors } from './common';
|
|
15
13
|
import { Box, type BoxActionHandler } from './common';
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
export const FeedShape = Schema.extend(
|
|
19
|
-
ComputeShape,
|
|
20
|
-
Schema.Struct({
|
|
21
|
-
type: Schema.Literal('queue'),
|
|
22
|
-
}),
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
export type FeedShape = Schema.Schema.Type<typeof FeedShape>;
|
|
26
|
-
|
|
27
|
-
export type CreateFeedProps = CreateShapeProps<FeedShape>;
|
|
28
|
-
|
|
29
|
-
export const createFeed = (props: CreateFeedProps) =>
|
|
30
|
-
createShape<FeedShape>({
|
|
31
|
-
type: 'queue',
|
|
32
|
-
size: { width: 256, height: 512 },
|
|
33
|
-
...props,
|
|
34
|
-
});
|
|
14
|
+
import { type FeedShape } from './feed-def';
|
|
35
15
|
|
|
36
16
|
export const FeedComponent = ({ shape }: ShapeComponentProps<FeedShape>) => {
|
|
37
17
|
const { runtime } = useComputeNodeState(shape);
|
|
@@ -46,7 +26,7 @@ export const FeedComponent = ({ shape }: ShapeComponentProps<FeedShape>) => {
|
|
|
46
26
|
return (
|
|
47
27
|
<Box shape={shape} status={`${items.length} items`} onAction={handleAction}>
|
|
48
28
|
<ScrollArea.Root orientation='vertical'>
|
|
49
|
-
<ScrollArea.Viewport classNames='divide-y divide-separator'>
|
|
29
|
+
<ScrollArea.Viewport classNames='divide-y divide-subdued-separator'>
|
|
50
30
|
{[...items].map((item, i) => (
|
|
51
31
|
<FeedItem key={i} classNames='p-1 px-2' item={item} />
|
|
52
32
|
))}
|
|
@@ -72,14 +52,3 @@ export const FeedItem = ({ classNames, item }: ThemedClassName<{ item: any }>) =
|
|
|
72
52
|
</div>
|
|
73
53
|
);
|
|
74
54
|
};
|
|
75
|
-
|
|
76
|
-
export const feedShape: ShapeDef<FeedShape> = {
|
|
77
|
-
// Must match the shape's `type` literal ('queue') so the registry resolves it; the registry is keyed by this.
|
|
78
|
-
type: 'queue',
|
|
79
|
-
name: 'Feed',
|
|
80
|
-
icon: 'ph--queue--regular',
|
|
81
|
-
component: FeedComponent,
|
|
82
|
-
createShape: createFeed,
|
|
83
|
-
getAnchors: (shape) => createFunctionAnchors(shape, QueueInput, QueueOutput),
|
|
84
|
-
resizable: true,
|
|
85
|
-
};
|
package/src/shapes/Function.tsx
CHANGED
|
@@ -2,53 +2,32 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as Schema from 'effect/Schema';
|
|
6
5
|
import React, { useCallback, useRef } from 'react';
|
|
7
6
|
|
|
8
7
|
import { Script } from '@dxos/compute';
|
|
9
8
|
import { Operation } from '@dxos/compute';
|
|
10
|
-
import { AnyOutput, FunctionInput } from '@dxos/conductor';
|
|
11
9
|
import { Filter, Ref } from '@dxos/echo';
|
|
12
10
|
import { instanceOf as isInstanceOf } from '@dxos/echo/Obj';
|
|
13
11
|
import { parseId } from '@dxos/keys';
|
|
14
12
|
import { useClient } from '@dxos/react-client';
|
|
15
13
|
import {
|
|
16
14
|
type ShapeComponentProps,
|
|
17
|
-
type ShapeDef,
|
|
18
15
|
TextBox,
|
|
19
16
|
type TextBoxControl,
|
|
20
17
|
type TextBoxProps,
|
|
21
18
|
} from '@dxos/react-ui-canvas-editor';
|
|
22
19
|
|
|
23
20
|
import { useComputeNodeState } from '../hooks';
|
|
24
|
-
import { Box
|
|
25
|
-
import {
|
|
26
|
-
|
|
27
|
-
export const FunctionShape = Schema.extend(
|
|
28
|
-
ComputeShape,
|
|
29
|
-
Schema.Struct({
|
|
30
|
-
type: Schema.Literal('function'),
|
|
31
|
-
}),
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
export type FunctionShape = Schema.Schema.Type<typeof FunctionShape>;
|
|
35
|
-
|
|
36
|
-
export type CreateFunctionProps = CreateShapeProps<FunctionShape>;
|
|
37
|
-
|
|
38
|
-
export const createFunction = (props: CreateFunctionProps) =>
|
|
39
|
-
createShape<FunctionShape>({
|
|
40
|
-
type: 'function',
|
|
41
|
-
size: { width: 256, height: 192 },
|
|
42
|
-
...props,
|
|
43
|
-
});
|
|
21
|
+
import { Box } from './common';
|
|
22
|
+
import { type FunctionShape } from './function-def';
|
|
44
23
|
|
|
45
24
|
//
|
|
46
25
|
// Component
|
|
47
26
|
//
|
|
48
27
|
|
|
49
|
-
type
|
|
28
|
+
type FunctionShapeComponentProps = ShapeComponentProps<FunctionShape> & TextBoxProps & { title?: string };
|
|
50
29
|
|
|
51
|
-
const
|
|
30
|
+
export const FunctionShapeComponent = ({ shape, title, ...props }: FunctionShapeComponentProps) => {
|
|
52
31
|
const client = useClient();
|
|
53
32
|
const { node, runtime } = useComputeNodeState(shape);
|
|
54
33
|
const inputRef = useRef<TextBoxControl>(null);
|
|
@@ -104,16 +83,3 @@ const TextInputComponent = ({ shape, title, ...props }: TextInputComponentProps)
|
|
|
104
83
|
</Box>
|
|
105
84
|
);
|
|
106
85
|
};
|
|
107
|
-
|
|
108
|
-
//
|
|
109
|
-
// Defs
|
|
110
|
-
//
|
|
111
|
-
|
|
112
|
-
export const functionShape: ShapeDef<FunctionShape> = {
|
|
113
|
-
type: 'function',
|
|
114
|
-
name: 'Function',
|
|
115
|
-
icon: 'ph--function--regular',
|
|
116
|
-
component: TextInputComponent,
|
|
117
|
-
createShape: createFunction,
|
|
118
|
-
getAnchors: (shape) => createFunctionAnchors(shape, FunctionInput, AnyOutput),
|
|
119
|
-
};
|