@dxos/react-ui-canvas-compute 0.8.4-main.5ad4a44 → 0.8.4-main.66e292d
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/browser/index.mjs +86 -106
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +86 -106
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/graph/controller.d.ts +11 -28
- package/dist/types/src/graph/controller.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeNodeState.d.ts +2 -2
- package/dist/types/src/hooks/useComputeNodeState.d.ts.map +1 -1
- package/dist/types/src/shapes/RNG.d.ts.map +1 -1
- package/dist/types/src/shapes/Surface.d.ts.map +1 -1
- package/dist/types/src/shapes/Trigger.d.ts +3 -3
- package/dist/types/src/shapes/Trigger.d.ts.map +1 -1
- package/dist/types/src/testing/circuits.d.ts +1 -1
- package/dist/types/src/testing/circuits.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +42 -40
- package/src/compute.stories.tsx +6 -6
- package/src/graph/controller.ts +12 -5
- package/src/graph/node-defs.ts +3 -3
- package/src/hooks/useComputeNodeState.ts +4 -3
- package/src/hooks/useGraphMonitor.ts +2 -2
- package/src/schema.test.ts +7 -7
- package/src/shapes/Audio.tsx +1 -1
- package/src/shapes/Beacon.tsx +1 -1
- package/src/shapes/Boolean.tsx +2 -2
- package/src/shapes/Function.tsx +3 -3
- package/src/shapes/Gpt.tsx +1 -1
- package/src/shapes/GptRealtime.tsx +1 -1
- package/src/shapes/Queue.tsx +2 -2
- package/src/shapes/RNG.tsx +5 -1
- package/src/shapes/Scope.tsx +1 -1
- package/src/shapes/Surface.tsx +6 -2
- package/src/shapes/Switch.tsx +1 -1
- package/src/shapes/Table.tsx +3 -3
- package/src/shapes/Thread.tsx +5 -5
- package/src/shapes/Trigger.tsx +24 -41
- package/src/shapes/common/Box.tsx +5 -5
- package/src/shapes/common/FunctionBody.tsx +2 -2
- package/src/shapes/common/TypeSelect.tsx +1 -1
- package/src/shapes/defs.ts +3 -3
- package/src/testing/circuits.ts +2 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-canvas-compute",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.66e292d",
|
|
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",
|
|
@@ -29,61 +29,63 @@
|
|
|
29
29
|
"@effect/platform": "0.92.1",
|
|
30
30
|
"@preact-signals/safe-react": "^0.9.0",
|
|
31
31
|
"chess.js": "^1.0.0",
|
|
32
|
-
"@dxos/ai": "0.8.4-main.
|
|
33
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
34
|
-
"@dxos/assistant": "0.8.4-main.
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/functions": "0.8.4-main.
|
|
43
|
-
"@dxos/graph": "0.8.4-main.
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/live-object": "0.8.4-main.
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/react-
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/react-ui-canvas": "0.8.4-main.
|
|
52
|
-
"@dxos/react-ui-
|
|
53
|
-
"@dxos/react-ui-
|
|
54
|
-
"@dxos/react-ui-form": "0.8.4-main.
|
|
55
|
-
"@dxos/react-ui-
|
|
56
|
-
"@dxos/react-ui-
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/
|
|
32
|
+
"@dxos/ai": "0.8.4-main.66e292d",
|
|
33
|
+
"@dxos/app-framework": "0.8.4-main.66e292d",
|
|
34
|
+
"@dxos/assistant": "0.8.4-main.66e292d",
|
|
35
|
+
"@dxos/context": "0.8.4-main.66e292d",
|
|
36
|
+
"@dxos/debug": "0.8.4-main.66e292d",
|
|
37
|
+
"@dxos/echo": "0.8.4-main.66e292d",
|
|
38
|
+
"@dxos/conductor": "0.8.4-main.66e292d",
|
|
39
|
+
"@dxos/blueprints": "0.8.4-main.66e292d",
|
|
40
|
+
"@dxos/async": "0.8.4-main.66e292d",
|
|
41
|
+
"@dxos/functions": "0.8.4-main.66e292d",
|
|
42
|
+
"@dxos/functions-runtime": "0.8.4-main.66e292d",
|
|
43
|
+
"@dxos/graph": "0.8.4-main.66e292d",
|
|
44
|
+
"@dxos/edge-client": "0.8.4-main.66e292d",
|
|
45
|
+
"@dxos/live-object": "0.8.4-main.66e292d",
|
|
46
|
+
"@dxos/keys": "0.8.4-main.66e292d",
|
|
47
|
+
"@dxos/log": "0.8.4-main.66e292d",
|
|
48
|
+
"@dxos/invariant": "0.8.4-main.66e292d",
|
|
49
|
+
"@dxos/react-edge-client": "0.8.4-main.66e292d",
|
|
50
|
+
"@dxos/react-ui-canvas-editor": "0.8.4-main.66e292d",
|
|
51
|
+
"@dxos/react-ui-canvas": "0.8.4-main.66e292d",
|
|
52
|
+
"@dxos/react-ui-editor": "0.8.4-main.66e292d",
|
|
53
|
+
"@dxos/react-ui-sfx": "0.8.4-main.66e292d",
|
|
54
|
+
"@dxos/react-ui-form": "0.8.4-main.66e292d",
|
|
55
|
+
"@dxos/react-ui-attention": "0.8.4-main.66e292d",
|
|
56
|
+
"@dxos/react-ui-stack": "0.8.4-main.66e292d",
|
|
57
|
+
"@dxos/react-client": "0.8.4-main.66e292d",
|
|
58
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.4-main.66e292d",
|
|
59
|
+
"@dxos/schema": "0.8.4-main.66e292d",
|
|
60
|
+
"@dxos/types": "0.8.4-main.66e292d",
|
|
61
|
+
"@dxos/util": "0.8.4-main.66e292d"
|
|
60
62
|
},
|
|
61
63
|
"devDependencies": {
|
|
62
64
|
"@effect/ai": "0.29.1",
|
|
63
65
|
"@effect/experimental": "0.56.0",
|
|
64
66
|
"@types/lodash.defaultsdeep": "^4.6.6",
|
|
65
67
|
"@types/react": "~19.2.2",
|
|
66
|
-
"@types/react-dom": "~19.2.
|
|
68
|
+
"@types/react-dom": "~19.2.2",
|
|
67
69
|
"effect": "3.18.3",
|
|
68
70
|
"lodash.defaultsdeep": "^4.6.1",
|
|
69
71
|
"react": "~19.2.0",
|
|
70
72
|
"react-dom": "~19.2.0",
|
|
71
73
|
"vite": "7.1.9",
|
|
72
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
73
|
-
"@dxos/
|
|
74
|
-
"@dxos/echo-signals": "0.8.4-main.
|
|
75
|
-
"@dxos/
|
|
76
|
-
"@dxos/random": "0.8.4-main.
|
|
77
|
-
"@dxos/
|
|
78
|
-
"@dxos/react-ui
|
|
79
|
-
"@dxos/
|
|
74
|
+
"@dxos/app-framework": "0.8.4-main.66e292d",
|
|
75
|
+
"@dxos/assistant-toolkit": "0.8.4-main.66e292d",
|
|
76
|
+
"@dxos/echo-signals": "0.8.4-main.66e292d",
|
|
77
|
+
"@dxos/compute": "0.8.4-main.66e292d",
|
|
78
|
+
"@dxos/random": "0.8.4-main.66e292d",
|
|
79
|
+
"@dxos/storybook-utils": "0.8.4-main.66e292d",
|
|
80
|
+
"@dxos/react-ui": "0.8.4-main.66e292d",
|
|
81
|
+
"@dxos/react-ui-theme": "0.8.4-main.66e292d"
|
|
80
82
|
},
|
|
81
83
|
"peerDependencies": {
|
|
82
84
|
"effect": "^3.13.3",
|
|
83
85
|
"react": "^19.0.0",
|
|
84
86
|
"react-dom": "^19.0.0",
|
|
85
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
86
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
87
|
+
"@dxos/react-ui": "0.8.4-main.66e292d",
|
|
88
|
+
"@dxos/react-ui-theme": "0.8.4-main.66e292d"
|
|
87
89
|
},
|
|
88
90
|
"publishConfig": {
|
|
89
91
|
"access": "public"
|
package/src/compute.stories.tsx
CHANGED
|
@@ -6,9 +6,9 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import React, { type PropsWithChildren, useEffect, useMemo, useRef, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
9
|
-
import { capabilities } from '@dxos/assistant-
|
|
9
|
+
import { capabilities } from '@dxos/assistant-toolkit';
|
|
10
10
|
import { type ComputeGraphModel, type ComputeNode, type GraphDiagnostic } from '@dxos/conductor';
|
|
11
|
-
import { ServiceContainer } from '@dxos/functions';
|
|
11
|
+
import { ServiceContainer } from '@dxos/functions-runtime';
|
|
12
12
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
13
13
|
import { Select, Toolbar } from '@dxos/react-ui';
|
|
14
14
|
import { withTheme } from '@dxos/react-ui/testing';
|
|
@@ -119,7 +119,7 @@ const DefaultStory = ({
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
return (
|
|
122
|
-
<div className='grid grid-cols-[1fr,360px]
|
|
122
|
+
<div className='grid grid-cols-[1fr,360px] is-full bs-full'>
|
|
123
123
|
<ComputeContext.Provider value={{ controller }}>
|
|
124
124
|
<Container id={id} classNames={['flex grow overflow-hidden', !sidebar && 'col-span-2']}>
|
|
125
125
|
<Editor.Root<ComputeShape>
|
|
@@ -141,8 +141,8 @@ const DefaultStory = ({
|
|
|
141
141
|
</ComputeContext.Provider>
|
|
142
142
|
|
|
143
143
|
{sidebar && (
|
|
144
|
-
<Container id='sidebar' classNames='flex flex-col
|
|
145
|
-
<Toolbar.Root
|
|
144
|
+
<Container id='sidebar' classNames='flex flex-col bs-full overflow-hidden'>
|
|
145
|
+
<Toolbar.Root>
|
|
146
146
|
<Select.Root value={sidebar} onValueChange={(value) => setSidebar(value as RenderProps['sidebar'])}>
|
|
147
147
|
<Select.TriggerButton classNames='is-full'>{sidebar}</Select.TriggerButton>
|
|
148
148
|
<Select.Portal>
|
|
@@ -160,7 +160,7 @@ const DefaultStory = ({
|
|
|
160
160
|
</Select.Root>
|
|
161
161
|
</Toolbar.Root>
|
|
162
162
|
|
|
163
|
-
<div className='flex flex-col
|
|
163
|
+
<div className='flex flex-col bs-full overflow-hidden divide-y divider-separator'>
|
|
164
164
|
{sidebar === 'selected' && selected && (
|
|
165
165
|
<div>Form</div>
|
|
166
166
|
// <Form<ComputeNode> schema={FormSchema} values={getComputeNode(selected.id) ?? {}} Custom={{}} />
|
package/src/graph/controller.ts
CHANGED
|
@@ -12,8 +12,8 @@ import { Event, synchronized } from '@dxos/async';
|
|
|
12
12
|
import {
|
|
13
13
|
type ComputeEdge,
|
|
14
14
|
type ComputeGraphModel,
|
|
15
|
-
type ComputeMeta,
|
|
16
15
|
type ComputeNode,
|
|
16
|
+
type ComputeNodeMeta,
|
|
17
17
|
type GptInput,
|
|
18
18
|
type GptOutput,
|
|
19
19
|
type GraphDiagnostic,
|
|
@@ -23,10 +23,10 @@ import {
|
|
|
23
23
|
} from '@dxos/conductor';
|
|
24
24
|
import { Resource } from '@dxos/context';
|
|
25
25
|
import { type ComputeEventLogger, type ComputeEventPayload } from '@dxos/functions';
|
|
26
|
-
import { type ServiceContainer } from '@dxos/functions';
|
|
26
|
+
import { type ServiceContainer } from '@dxos/functions-runtime';
|
|
27
27
|
import { log } from '@dxos/log';
|
|
28
28
|
import { type CanvasGraphModel } from '@dxos/react-ui-canvas-editor';
|
|
29
|
-
import { type ContentBlock } from '@dxos/
|
|
29
|
+
import { type ContentBlock } from '@dxos/types';
|
|
30
30
|
|
|
31
31
|
import { createComputeGraph } from '../hooks';
|
|
32
32
|
import { type ComputeShape } from '../shapes';
|
|
@@ -158,7 +158,14 @@ export class ComputeGraphController extends Resource {
|
|
|
158
158
|
/**
|
|
159
159
|
* Inputs and outputs for all nodes.
|
|
160
160
|
*/
|
|
161
|
-
get state()
|
|
161
|
+
get state(): Record<
|
|
162
|
+
string,
|
|
163
|
+
{
|
|
164
|
+
node: ComputeNode;
|
|
165
|
+
input: Record<string, RuntimeValue>;
|
|
166
|
+
output: Record<string, RuntimeValue>;
|
|
167
|
+
}
|
|
168
|
+
> {
|
|
162
169
|
const ids = [...new Set([...Object.keys(this._runtimeStateInputs), ...Object.keys(this._runtimeStateOutputs)])];
|
|
163
170
|
return Object.fromEntries(
|
|
164
171
|
ids.map((id) => [
|
|
@@ -205,7 +212,7 @@ export class ComputeGraphController extends Resource {
|
|
|
205
212
|
});
|
|
206
213
|
}
|
|
207
214
|
|
|
208
|
-
async getMeta(node: ComputeNode): Promise<
|
|
215
|
+
async getMeta(node: ComputeNode): Promise<ComputeNodeMeta> {
|
|
209
216
|
const { meta } = await resolveComputeNode(node);
|
|
210
217
|
return meta;
|
|
211
218
|
}
|
package/src/graph/node-defs.ts
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
registry,
|
|
13
13
|
} from '@dxos/conductor';
|
|
14
14
|
import { raise } from '@dxos/debug';
|
|
15
|
-
import {
|
|
15
|
+
import { JsonSchema, Obj } from '@dxos/echo';
|
|
16
16
|
import { invariant } from '@dxos/invariant';
|
|
17
17
|
|
|
18
18
|
import { type ComputeShape, type ConstantShape, type TemplateShape } from '../shapes';
|
|
@@ -68,7 +68,7 @@ const nodeFactory: Record<NodeType | 'trigger', (shape: ComputeShape) => Compute
|
|
|
68
68
|
['switch' as const]: () => createNode('switch'),
|
|
69
69
|
['template' as const]: (shape) => {
|
|
70
70
|
const node = createNode('template', { valueType: (shape as TemplateShape).valueType, value: shape.text });
|
|
71
|
-
node.inputSchema = toJsonSchema(getTemplateInputSchema(node));
|
|
71
|
+
node.inputSchema = JsonSchema.toJsonSchema(getTemplateInputSchema(node));
|
|
72
72
|
return node;
|
|
73
73
|
},
|
|
74
74
|
['text' as const]: () => createNode('text'),
|
|
@@ -77,7 +77,7 @@ const nodeFactory: Record<NodeType | 'trigger', (shape: ComputeShape) => Compute
|
|
|
77
77
|
};
|
|
78
78
|
|
|
79
79
|
const createNode = (type: string, props?: Partial<ComputeNode>): ComputeNode => ({
|
|
80
|
-
id:
|
|
80
|
+
id: Obj.ID.random(),
|
|
81
81
|
type,
|
|
82
82
|
...props,
|
|
83
83
|
});
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
import { useCallback, useEffect, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import type {
|
|
8
|
+
import type { ComputeNode, ComputeNodeMeta } from '@dxos/conductor';
|
|
9
9
|
import type { ComputeEventPayload } from '@dxos/functions';
|
|
10
10
|
import { invariant } from '@dxos/invariant';
|
|
11
11
|
|
|
@@ -16,7 +16,7 @@ import { useComputeContext } from './compute-context';
|
|
|
16
16
|
|
|
17
17
|
export type ComputeNodeState = {
|
|
18
18
|
node: ComputeNode;
|
|
19
|
-
meta:
|
|
19
|
+
meta: ComputeNodeMeta;
|
|
20
20
|
runtime: {
|
|
21
21
|
inputs: Record<string, RuntimeValue>;
|
|
22
22
|
outputs: Record<string, RuntimeValue>;
|
|
@@ -33,7 +33,7 @@ export const useComputeNodeState = (shape: ComputeShape): ComputeNodeState => {
|
|
|
33
33
|
const { controller } = useComputeContext();
|
|
34
34
|
invariant(controller);
|
|
35
35
|
|
|
36
|
-
const [meta, setMeta] = useState<
|
|
36
|
+
const [meta, setMeta] = useState<ComputeNodeMeta>();
|
|
37
37
|
useEffect(() => {
|
|
38
38
|
let disposed = false;
|
|
39
39
|
queueMicrotask(async () => {
|
|
@@ -43,6 +43,7 @@ export const useComputeNodeState = (shape: ComputeShape): ComputeNodeState => {
|
|
|
43
43
|
if (disposed) {
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
+
|
|
46
47
|
setMeta(meta);
|
|
47
48
|
});
|
|
48
49
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { useMemo } from 'react';
|
|
6
6
|
|
|
7
7
|
import { type ComputeEdge, ComputeGraphModel, type ComputeNode, DEFAULT_INPUT, DEFAULT_OUTPUT } from '@dxos/conductor';
|
|
8
|
-
import {
|
|
8
|
+
import { Obj, Ref } from '@dxos/echo';
|
|
9
9
|
import { invariant } from '@dxos/invariant';
|
|
10
10
|
import { getSpace } from '@dxos/react-client/echo';
|
|
11
11
|
import { type CanvasGraphModel, type Connection, type GraphMonitor } from '@dxos/react-ui-canvas-editor';
|
|
@@ -27,7 +27,7 @@ export const mapEdge = (
|
|
|
27
27
|
invariant(targetNode?.node);
|
|
28
28
|
|
|
29
29
|
return {
|
|
30
|
-
id:
|
|
30
|
+
id: Obj.ID.random(),
|
|
31
31
|
source: sourceNode.node,
|
|
32
32
|
target: targetNode.node,
|
|
33
33
|
output,
|
package/src/schema.test.ts
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
import { describe, test } from 'vitest';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import { BaseGraphNode, Graph } from '@dxos/graph';
|
|
8
|
+
import { BaseGraphNode, type Graph } from '@dxos/graph';
|
|
10
9
|
import {
|
|
10
|
+
CanvasGraphModel,
|
|
11
11
|
Polygon,
|
|
12
12
|
Shape,
|
|
13
13
|
createEllipse,
|
|
@@ -21,7 +21,7 @@ import { ComputeShape, createFunction, createSwitch } from './shapes';
|
|
|
21
21
|
|
|
22
22
|
describe('compute', () => {
|
|
23
23
|
test('model', ({ expect }) => {
|
|
24
|
-
|
|
24
|
+
const model = CanvasGraphModel.create<ComputeShape>();
|
|
25
25
|
const node = createSwitch({ id: 'x', center: { x: 0, y: 0 }, size: { width: 80, height: 80 } });
|
|
26
26
|
console.log(JSON.stringify(node, null, 2));
|
|
27
27
|
expect(Schema.is(ComputeShape)(node)).toBe(true);
|
|
@@ -29,11 +29,11 @@ describe('compute', () => {
|
|
|
29
29
|
expect(Schema.is(Shape)(node)).toBe(true);
|
|
30
30
|
expect(Schema.is(BaseGraphNode)(node)).toBe(true);
|
|
31
31
|
|
|
32
|
-
const graph =
|
|
33
|
-
graph.nodes.push(node);
|
|
32
|
+
const graph: Graph = { nodes: [], edges: [] };
|
|
33
|
+
graph.nodes.push(node);
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
model.createNode(node);
|
|
36
|
+
console.log(JSON.stringify(model, null, 2));
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
39
|
|
package/src/shapes/Audio.tsx
CHANGED
|
@@ -35,7 +35,7 @@ export const AudioComponent = ({ shape }: ShapeComponentProps<AudioShape>) => {
|
|
|
35
35
|
|
|
36
36
|
// https://docs.pmnd.rs/react-three-fiber/api/canvas#render-props
|
|
37
37
|
return (
|
|
38
|
-
<div className='flex
|
|
38
|
+
<div className='flex is-full justify-center items-center'>
|
|
39
39
|
<Icon
|
|
40
40
|
icon={active ? 'ph--microphone--regular' : 'ph--microphone-slash--regular'}
|
|
41
41
|
classNames={['transition opacity-20 duration-1000', active && 'opacity-100 text-red-500']}
|
package/src/shapes/Beacon.tsx
CHANGED
|
@@ -33,7 +33,7 @@ export const BeaconComponent = ({ shape }: ShapeComponentProps<BeaconShape>) =>
|
|
|
33
33
|
const value = input?.type === 'executed' ? input.value : false;
|
|
34
34
|
|
|
35
35
|
return (
|
|
36
|
-
<div className='flex
|
|
36
|
+
<div className='flex is-full justify-center items-center'>
|
|
37
37
|
<Icon
|
|
38
38
|
icon='ph--sun--regular'
|
|
39
39
|
classNames={['transition opacity-20 duration-1000', isTruthy(value) && 'opacity-100 text-yellow-500']}
|
package/src/shapes/Boolean.tsx
CHANGED
|
@@ -57,7 +57,7 @@ const defineShape = <S extends GateShape>({
|
|
|
57
57
|
// Be careful not to name component factories with a capital letter.
|
|
58
58
|
component: () => {
|
|
59
59
|
return (
|
|
60
|
-
<div className='flex
|
|
60
|
+
<div className='flex is-full justify-center items-center'>
|
|
61
61
|
<Symbol />
|
|
62
62
|
</div>
|
|
63
63
|
);
|
|
@@ -95,7 +95,7 @@ const createSymbol =
|
|
|
95
95
|
const paths = pathConstructor({ startX, endX, height });
|
|
96
96
|
|
|
97
97
|
return (
|
|
98
|
-
<svg viewBox={`0 0 ${width} ${height}`} className='
|
|
98
|
+
<svg viewBox={`0 0 ${width} ${height}`} className='is-full bs-full'>
|
|
99
99
|
{/* Input line. */}
|
|
100
100
|
{getAnchorPoints({ x: 0, y: centerY }, inputs).map(({ x, y }, i) => (
|
|
101
101
|
<line key={i} x1={x} y1={y} x2={startX * 1.3} y2={y} strokeWidth={strokeWidth} className={className} />
|
package/src/shapes/Function.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import React, { useCallback, useRef } from 'react';
|
|
|
7
7
|
|
|
8
8
|
import { AnyOutput, FunctionInput } from '@dxos/conductor';
|
|
9
9
|
import { Ref, getSnapshot, isInstanceOf } from '@dxos/echo/internal';
|
|
10
|
-
import {
|
|
10
|
+
import { Function, Script } from '@dxos/functions';
|
|
11
11
|
import { useClient } from '@dxos/react-client';
|
|
12
12
|
import { Filter, parseId } from '@dxos/react-client/echo';
|
|
13
13
|
import {
|
|
@@ -58,13 +58,13 @@ const TextInputComponent = ({ shape, title, ...props }: TextInputComponentProps)
|
|
|
58
58
|
|
|
59
59
|
const space = client.spaces.get(spaceId);
|
|
60
60
|
const object = space?.db.getObjectById(objectId);
|
|
61
|
-
if (!space || !isInstanceOf(
|
|
61
|
+
if (!space || !isInstanceOf(Script.Script, object)) {
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
const {
|
|
66
66
|
objects: [fn],
|
|
67
|
-
} = await space.db.query(Filter.type(
|
|
67
|
+
} = await space.db.query(Filter.type(Function.Function, { source: Ref.make(object) })).run();
|
|
68
68
|
if (!fn) {
|
|
69
69
|
return;
|
|
70
70
|
}
|
package/src/shapes/Gpt.tsx
CHANGED
|
@@ -74,7 +74,7 @@ export const GptComponent = ({ shape }: ShapeComponentProps<GptShape>) => {
|
|
|
74
74
|
return (
|
|
75
75
|
<FunctionBody
|
|
76
76
|
shape={shape}
|
|
77
|
-
content={<div className='
|
|
77
|
+
content={<div className='pli-2 plb-1 overflow-y-auto'>{text}</div>}
|
|
78
78
|
status={`${tokens} tokens`}
|
|
79
79
|
inputSchema={meta.input}
|
|
80
80
|
outputSchema={meta.output}
|
|
@@ -143,7 +143,7 @@ export const GptRealtimeComponent = ({ shape }: ShapeComponentProps<GptRealtimeS
|
|
|
143
143
|
};
|
|
144
144
|
|
|
145
145
|
return (
|
|
146
|
-
<div className='flex
|
|
146
|
+
<div className='flex is-full justify-center items-center'>
|
|
147
147
|
<Icon
|
|
148
148
|
icon={isReady ? 'ph--waveform--regular' : isLive ? 'ph--pulse--regular' : 'ph--play--regular'}
|
|
149
149
|
size={16}
|
package/src/shapes/Queue.tsx
CHANGED
|
@@ -42,9 +42,9 @@ export const QueueComponent = ({ shape }: ShapeComponentProps<QueueShape>) => {
|
|
|
42
42
|
|
|
43
43
|
return (
|
|
44
44
|
<Box shape={shape} status={`${items.length} items`} onAction={handleAction}>
|
|
45
|
-
<div className='flex flex-col
|
|
45
|
+
<div className='flex flex-col is-full overflow-y-auto divide-y divide-separator'>
|
|
46
46
|
{[...items].map((item, i) => (
|
|
47
|
-
<QueueItem key={i} classNames='p-1
|
|
47
|
+
<QueueItem key={i} classNames='p-1 pli-2' item={item} />
|
|
48
48
|
))}
|
|
49
49
|
</div>
|
|
50
50
|
</Box>
|
package/src/shapes/RNG.tsx
CHANGED
|
@@ -27,7 +27,11 @@ export type RandomShape = Schema.Schema.Type<typeof RandomShape>;
|
|
|
27
27
|
export type CreateRandomProps = CreateShapeProps<RandomShape>;
|
|
28
28
|
|
|
29
29
|
export const createRandom = (props: CreateRandomProps) =>
|
|
30
|
-
createShape<RandomShape>({
|
|
30
|
+
createShape<RandomShape>({
|
|
31
|
+
type: 'rng',
|
|
32
|
+
size: { width: 64, height: 64 },
|
|
33
|
+
...props,
|
|
34
|
+
});
|
|
31
35
|
|
|
32
36
|
const icons = [
|
|
33
37
|
'ph--dice-one--regular',
|
package/src/shapes/Scope.tsx
CHANGED
|
@@ -39,7 +39,7 @@ export const ScopeComponent = ({ shape }: ShapeComponentProps<ScopeShape>) => {
|
|
|
39
39
|
const { getAverage } = useAudioStream(active);
|
|
40
40
|
|
|
41
41
|
return (
|
|
42
|
-
<div className='flex
|
|
42
|
+
<div className='flex is-full justify-center items-center bg-black'>
|
|
43
43
|
<Chaos active={active} getValue={getAverage} options={{ ...shaderPresets.heptapod, zoom: 1.2 }} />
|
|
44
44
|
</div>
|
|
45
45
|
);
|
package/src/shapes/Surface.tsx
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import { Surface } from '@dxos/app-framework';
|
|
8
|
+
import { Surface } from '@dxos/app-framework/react';
|
|
9
9
|
import { DEFAULT_INPUT } from '@dxos/conductor';
|
|
10
10
|
import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
11
11
|
import { createAnchorMap } from '@dxos/react-ui-canvas-editor';
|
|
@@ -27,7 +27,11 @@ export type SurfaceShape = Schema.Schema.Type<typeof SurfaceShape>;
|
|
|
27
27
|
export type CreateSurfaceProps = CreateShapeProps<SurfaceShape>;
|
|
28
28
|
|
|
29
29
|
export const createSurface = (props: CreateSurfaceProps) =>
|
|
30
|
-
createShape<SurfaceShape>({
|
|
30
|
+
createShape<SurfaceShape>({
|
|
31
|
+
type: 'surface',
|
|
32
|
+
size: { width: 384, height: 384 },
|
|
33
|
+
...props,
|
|
34
|
+
});
|
|
31
35
|
|
|
32
36
|
export const SurfaceComponent = ({ shape }: ShapeComponentProps<SurfaceShape>) => {
|
|
33
37
|
const { runtime } = useComputeNodeState(shape);
|
package/src/shapes/Switch.tsx
CHANGED
|
@@ -36,7 +36,7 @@ export const SwitchComponent = ({ shape }: ShapeComponentProps<SwitchShape>) =>
|
|
|
36
36
|
}, [value]);
|
|
37
37
|
|
|
38
38
|
return (
|
|
39
|
-
<div className='flex
|
|
39
|
+
<div className='flex is-full justify-center items-center' onClick={(ev) => ev.stopPropagation()}>
|
|
40
40
|
<Input.Root>
|
|
41
41
|
<Input.Switch checked={value} onCheckedChange={(value) => setValue(value)} />
|
|
42
42
|
</Input.Root>
|
package/src/shapes/Table.tsx
CHANGED
|
@@ -7,13 +7,13 @@ import React from 'react';
|
|
|
7
7
|
|
|
8
8
|
import { createInputSchema, createOutputSchema } from '@dxos/conductor';
|
|
9
9
|
import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
10
|
-
import {
|
|
10
|
+
import { Message } from '@dxos/types';
|
|
11
11
|
|
|
12
12
|
import { Box, createFunctionAnchors } from './common';
|
|
13
13
|
import { ComputeShape, type CreateShapeProps, createShape } from './defs';
|
|
14
14
|
|
|
15
|
-
const InputSchema = createInputSchema(
|
|
16
|
-
const OutputSchema = createOutputSchema(Schema.mutable(Schema.Array(
|
|
15
|
+
const InputSchema = createInputSchema(Message.Message);
|
|
16
|
+
const OutputSchema = createOutputSchema(Schema.mutable(Schema.Array(Message.Message)));
|
|
17
17
|
|
|
18
18
|
export const TableShape = Schema.extend(
|
|
19
19
|
ComputeShape,
|
package/src/shapes/Thread.tsx
CHANGED
|
@@ -9,13 +9,13 @@ import { createInputSchema, createOutputSchema } from '@dxos/conductor';
|
|
|
9
9
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
10
10
|
import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
11
11
|
import { mx } from '@dxos/react-ui-theme';
|
|
12
|
-
import {
|
|
12
|
+
import { Message } from '@dxos/types';
|
|
13
13
|
|
|
14
14
|
import { Box, createFunctionAnchors } from './common';
|
|
15
15
|
import { ComputeShape, type CreateShapeProps, createShape } from './defs';
|
|
16
16
|
|
|
17
|
-
const InputSchema = createInputSchema(
|
|
18
|
-
const OutputSchema = createOutputSchema(Schema.mutable(Schema.Array(
|
|
17
|
+
const InputSchema = createInputSchema(Message.Message);
|
|
18
|
+
const OutputSchema = createOutputSchema(Schema.mutable(Schema.Array(Message.Message)));
|
|
19
19
|
|
|
20
20
|
export const ThreadShape = Schema.extend(
|
|
21
21
|
ComputeShape,
|
|
@@ -42,7 +42,7 @@ export const ThreadComponent = ({ shape }: ShapeComponentProps<ThreadShape>) =>
|
|
|
42
42
|
|
|
43
43
|
return (
|
|
44
44
|
<Box shape={shape}>
|
|
45
|
-
<div ref={scrollRef} className='flex flex-col
|
|
45
|
+
<div ref={scrollRef} className='flex flex-col is-full overflow-y-auto gap-2 p-2'>
|
|
46
46
|
{[...items].map((item, i) => (
|
|
47
47
|
<ThreadItem key={i} item={item} />
|
|
48
48
|
))}
|
|
@@ -63,7 +63,7 @@ export const ThreadItem = ({ classNames, item }: ThemedClassName<{ item: any }>)
|
|
|
63
63
|
<div className={mx('flex', classNames, role === 'user' && 'justify-end')}>
|
|
64
64
|
<div
|
|
65
65
|
className={mx(
|
|
66
|
-
'block rounded-md p-1
|
|
66
|
+
'block rounded-md p-1 pli-2 text-sm',
|
|
67
67
|
role === 'user'
|
|
68
68
|
? 'bg-blue-100 dark:bg-blue-800'
|
|
69
69
|
: role === 'system'
|