@dxos/react-ui-canvas-compute 0.8.4-main.69d29f4 → 0.8.4-main.6fa680abb7
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 +77 -67
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +77 -67
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/compute.stories.d.ts.map +1 -1
- package/dist/types/src/graph/controller.d.ts +2 -2
- package/dist/types/src/graph/controller.d.ts.map +1 -1
- package/dist/types/src/hooks/useGraphMonitor.d.ts +2 -2
- package/dist/types/src/hooks/useGraphMonitor.d.ts.map +1 -1
- package/dist/types/src/shapes/Gpt.d.ts.map +1 -1
- package/dist/types/src/shapes/Queue.d.ts.map +1 -1
- package/dist/types/src/shapes/Surface.d.ts.map +1 -1
- package/dist/types/src/shapes/Thread.d.ts.map +1 -1
- package/dist/types/src/shapes/Trigger.d.ts +2 -1
- package/dist/types/src/shapes/Trigger.d.ts.map +1 -1
- package/dist/types/src/shapes/common/Box.d.ts +3 -3
- package/dist/types/src/shapes/common/Box.d.ts.map +1 -1
- package/dist/types/src/shapes/common/FunctionBody.d.ts +2 -2
- package/dist/types/src/shapes/common/FunctionBody.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +49 -48
- package/src/README.md +0 -3
- package/src/compute.stories.tsx +10 -7
- package/src/graph/controller.ts +2 -1
- package/src/graph/node-defs.ts +28 -28
- package/src/hooks/useGraphMonitor.ts +2 -2
- package/src/schema.test.ts +3 -3
- package/src/shapes/Audio.tsx +2 -2
- package/src/shapes/Beacon.tsx +1 -1
- package/src/shapes/Boolean.tsx +2 -2
- package/src/shapes/Gpt.tsx +6 -1
- package/src/shapes/GptRealtime.tsx +1 -1
- package/src/shapes/Queue.tsx +9 -7
- package/src/shapes/Scope.tsx +1 -1
- package/src/shapes/Surface.tsx +4 -2
- package/src/shapes/Switch.tsx +1 -1
- package/src/shapes/Thread.tsx +14 -8
- package/src/shapes/Trigger.tsx +3 -3
- package/src/shapes/common/Box.tsx +7 -8
- package/src/shapes/common/FunctionBody.tsx +4 -4
- package/src/shapes/common/TypeSelect.tsx +1 -1
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.6fa680abb7",
|
|
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,9 @@
|
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
16
16
|
"source": "./src/index.ts",
|
|
17
|
-
"types": "./dist/types/src/index.d.ts",
|
|
18
17
|
"browser": "./dist/lib/browser/index.mjs",
|
|
19
|
-
"node": "./dist/lib/node-esm/index.mjs"
|
|
18
|
+
"node": "./dist/lib/node-esm/index.mjs",
|
|
19
|
+
"types": "./dist/types/src/index.d.ts"
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"types": "dist/types/src/index.d.ts",
|
|
@@ -30,64 +30,65 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@antv/graphlib": "^2.0.4",
|
|
32
32
|
"@antv/layout": "^1.2.13",
|
|
33
|
-
"@effect/platform": "0.
|
|
33
|
+
"@effect/platform": "0.94.4",
|
|
34
34
|
"chess.js": "^1.0.0",
|
|
35
|
-
"@dxos/ai": "0.8.4-main.
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/debug": "0.8.4-main.
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/functions": "0.8.4-main.
|
|
48
|
-
"@dxos/graph": "0.8.4-main.
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/react-
|
|
53
|
-
"@dxos/react-
|
|
54
|
-
"@dxos/react-ui-canvas": "0.8.4-main.
|
|
55
|
-
"@dxos/react-ui-canvas-editor": "0.8.4-main.
|
|
56
|
-
"@dxos/react-
|
|
57
|
-
"@dxos/react-ui-editor": "0.8.4-main.
|
|
58
|
-
"@dxos/react-ui-form": "0.8.4-main.
|
|
59
|
-
"@dxos/react-ui-
|
|
60
|
-
"@dxos/react-ui-
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/
|
|
35
|
+
"@dxos/ai": "0.8.4-main.6fa680abb7",
|
|
36
|
+
"@dxos/assistant": "0.8.4-main.6fa680abb7",
|
|
37
|
+
"@dxos/async": "0.8.4-main.6fa680abb7",
|
|
38
|
+
"@dxos/app-framework": "0.8.4-main.6fa680abb7",
|
|
39
|
+
"@dxos/conductor": "0.8.4-main.6fa680abb7",
|
|
40
|
+
"@dxos/context": "0.8.4-main.6fa680abb7",
|
|
41
|
+
"@dxos/blueprints": "0.8.4-main.6fa680abb7",
|
|
42
|
+
"@dxos/debug": "0.8.4-main.6fa680abb7",
|
|
43
|
+
"@dxos/edge-client": "0.8.4-main.6fa680abb7",
|
|
44
|
+
"@dxos/effect": "0.8.4-main.6fa680abb7",
|
|
45
|
+
"@dxos/functions": "0.8.4-main.6fa680abb7",
|
|
46
|
+
"@dxos/echo": "0.8.4-main.6fa680abb7",
|
|
47
|
+
"@dxos/functions-runtime": "0.8.4-main.6fa680abb7",
|
|
48
|
+
"@dxos/graph": "0.8.4-main.6fa680abb7",
|
|
49
|
+
"@dxos/invariant": "0.8.4-main.6fa680abb7",
|
|
50
|
+
"@dxos/log": "0.8.4-main.6fa680abb7",
|
|
51
|
+
"@dxos/keys": "0.8.4-main.6fa680abb7",
|
|
52
|
+
"@dxos/react-ui-attention": "0.8.4-main.6fa680abb7",
|
|
53
|
+
"@dxos/react-edge-client": "0.8.4-main.6fa680abb7",
|
|
54
|
+
"@dxos/react-ui-canvas": "0.8.4-main.6fa680abb7",
|
|
55
|
+
"@dxos/react-ui-canvas-editor": "0.8.4-main.6fa680abb7",
|
|
56
|
+
"@dxos/react-client": "0.8.4-main.6fa680abb7",
|
|
57
|
+
"@dxos/react-ui-editor": "0.8.4-main.6fa680abb7",
|
|
58
|
+
"@dxos/react-ui-form": "0.8.4-main.6fa680abb7",
|
|
59
|
+
"@dxos/react-ui-stack": "0.8.4-main.6fa680abb7",
|
|
60
|
+
"@dxos/react-ui-sfx": "0.8.4-main.6fa680abb7",
|
|
61
|
+
"@dxos/schema": "0.8.4-main.6fa680abb7",
|
|
62
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.6fa680abb7",
|
|
63
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.4-main.6fa680abb7",
|
|
64
|
+
"@dxos/types": "0.8.4-main.6fa680abb7",
|
|
65
|
+
"@dxos/util": "0.8.4-main.6fa680abb7"
|
|
65
66
|
},
|
|
66
67
|
"devDependencies": {
|
|
67
|
-
"@effect/ai": "0.
|
|
68
|
-
"@effect/experimental": "0.
|
|
68
|
+
"@effect/ai": "0.33.2",
|
|
69
|
+
"@effect/experimental": "0.58.0",
|
|
69
70
|
"@types/lodash.defaultsdeep": "^4.6.6",
|
|
70
71
|
"@types/react": "~19.2.7",
|
|
71
72
|
"@types/react-dom": "~19.2.3",
|
|
72
|
-
"effect": "3.19.
|
|
73
|
+
"effect": "3.19.16",
|
|
73
74
|
"lodash.defaultsdeep": "^4.6.1",
|
|
74
75
|
"react": "~19.2.3",
|
|
75
76
|
"react-dom": "~19.2.3",
|
|
76
|
-
"vite": "7.1.
|
|
77
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
78
|
-
"@dxos/assistant-toolkit": "0.8.4-main.
|
|
79
|
-
"@dxos/
|
|
80
|
-
"@dxos/
|
|
81
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
82
|
-
"@dxos/
|
|
83
|
-
"@dxos/
|
|
77
|
+
"vite": "^7.1.11",
|
|
78
|
+
"@dxos/app-framework": "0.8.4-main.6fa680abb7",
|
|
79
|
+
"@dxos/assistant-toolkit": "0.8.4-main.6fa680abb7",
|
|
80
|
+
"@dxos/react-ui": "0.8.4-main.6fa680abb7",
|
|
81
|
+
"@dxos/compute": "0.8.4-main.6fa680abb7",
|
|
82
|
+
"@dxos/ui-theme": "0.8.4-main.6fa680abb7",
|
|
83
|
+
"@dxos/storybook-utils": "0.8.4-main.6fa680abb7",
|
|
84
|
+
"@dxos/random": "0.8.4-main.6fa680abb7"
|
|
84
85
|
},
|
|
85
86
|
"peerDependencies": {
|
|
86
|
-
"effect": "3.19.
|
|
87
|
+
"effect": "3.19.16",
|
|
87
88
|
"react": "~19.2.3",
|
|
88
89
|
"react-dom": "~19.2.3",
|
|
89
|
-
"@dxos/ui
|
|
90
|
-
"@dxos/
|
|
90
|
+
"@dxos/react-ui": "0.8.4-main.6fa680abb7",
|
|
91
|
+
"@dxos/ui-theme": "0.8.4-main.6fa680abb7"
|
|
91
92
|
},
|
|
92
93
|
"publishConfig": {
|
|
93
94
|
"access": "public"
|
package/src/README.md
CHANGED
package/src/compute.stories.tsx
CHANGED
|
@@ -11,12 +11,13 @@ import { AiServiceTestingPreset } from '@dxos/ai/testing';
|
|
|
11
11
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
12
|
import { capabilities } from '@dxos/assistant-toolkit/testing';
|
|
13
13
|
import { type ComputeGraphModel, type ComputeNode, type GraphDiagnostic } from '@dxos/conductor';
|
|
14
|
+
import { Feed } from '@dxos/echo';
|
|
14
15
|
import { CredentialsService, TracingService } from '@dxos/functions';
|
|
15
16
|
import { FunctionInvocationServiceLayerTest } from '@dxos/functions-runtime';
|
|
16
17
|
import { TestDatabaseLayer } from '@dxos/functions-runtime/testing';
|
|
17
18
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
18
19
|
import { Select, Toolbar } from '@dxos/react-ui';
|
|
19
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
20
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
20
21
|
import { withAttention } from '@dxos/react-ui-attention/testing';
|
|
21
22
|
import { Editor, type EditorController, type EditorRootProps, ShapeRegistry } from '@dxos/react-ui-canvas-editor';
|
|
22
23
|
import { Container, useSelection } from '@dxos/react-ui-canvas-editor/testing';
|
|
@@ -122,7 +123,7 @@ const DefaultStory = ({
|
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
return (
|
|
125
|
-
<div className='grid grid-cols-[
|
|
126
|
+
<div className='grid grid-cols-[1fr_360px] w-full h-full'>
|
|
126
127
|
<ComputeContext.Provider value={{ controller }}>
|
|
127
128
|
<Container id={id} classNames={['flex grow overflow-hidden', !sidebar && 'col-span-2']}>
|
|
128
129
|
<Editor.Root<ComputeShape>
|
|
@@ -146,10 +147,10 @@ const DefaultStory = ({
|
|
|
146
147
|
</ComputeContext.Provider>
|
|
147
148
|
|
|
148
149
|
{sidebar && (
|
|
149
|
-
<Container id='sidebar' classNames='flex flex-col
|
|
150
|
+
<Container id='sidebar' classNames='flex flex-col h-full overflow-hidden'>
|
|
150
151
|
<Toolbar.Root>
|
|
151
152
|
<Select.Root value={sidebar} onValueChange={(value) => setSidebar(value as RenderProps['sidebar'])}>
|
|
152
|
-
<Select.TriggerButton classNames='
|
|
153
|
+
<Select.TriggerButton classNames='w-full'>{sidebar}</Select.TriggerButton>
|
|
153
154
|
<Select.Portal>
|
|
154
155
|
<Select.Content>
|
|
155
156
|
<Select.Viewport>
|
|
@@ -165,7 +166,7 @@ const DefaultStory = ({
|
|
|
165
166
|
</Select.Root>
|
|
166
167
|
</Toolbar.Root>
|
|
167
168
|
|
|
168
|
-
<div className='flex flex-col
|
|
169
|
+
<div className='flex flex-col h-full overflow-hidden divide-y divider-separator'>
|
|
169
170
|
{/* TODO(burdon): Provide schema. */}
|
|
170
171
|
{sidebar === 'selected' && selected && (
|
|
171
172
|
<Form.Root<ComputeNode> values={getComputeNode(selected.id) ?? {}}>
|
|
@@ -190,8 +191,9 @@ const meta = {
|
|
|
190
191
|
component: Editor.Root as any,
|
|
191
192
|
render: DefaultStory,
|
|
192
193
|
decorators: [
|
|
193
|
-
withTheme,
|
|
194
|
-
|
|
194
|
+
withTheme(),
|
|
195
|
+
withLayout({ layout: 'fullscreen' }),
|
|
196
|
+
withAttention(),
|
|
195
197
|
withClientProvider({ createIdentity: true, createSpace: true }),
|
|
196
198
|
withPluginManager({ capabilities }),
|
|
197
199
|
],
|
|
@@ -221,6 +223,7 @@ const ServiceLayer = Layer.empty.pipe(
|
|
|
221
223
|
TestDatabaseLayer(),
|
|
222
224
|
CredentialsService.configuredLayer([]),
|
|
223
225
|
TracingService.layerNoop,
|
|
226
|
+
Feed.notAvailable,
|
|
224
227
|
),
|
|
225
228
|
),
|
|
226
229
|
Layer.orDie,
|
package/src/graph/controller.ts
CHANGED
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
isNotExecuted,
|
|
26
26
|
} from '@dxos/conductor';
|
|
27
27
|
import { Resource } from '@dxos/context';
|
|
28
|
-
import type { Database } from '@dxos/echo';
|
|
28
|
+
import type { Database, Feed } from '@dxos/echo';
|
|
29
29
|
import { unwrapExit } from '@dxos/effect';
|
|
30
30
|
import {
|
|
31
31
|
ComputeEventLogger,
|
|
@@ -87,6 +87,7 @@ type ComputeOutputEvent = {
|
|
|
87
87
|
export type ComputeServices =
|
|
88
88
|
| AiService.AiService
|
|
89
89
|
| Database.Service
|
|
90
|
+
| Feed.Service
|
|
90
91
|
| QueueService
|
|
91
92
|
| CredentialsService
|
|
92
93
|
| FunctionInvocationService;
|
package/src/graph/node-defs.ts
CHANGED
|
@@ -39,41 +39,41 @@ const nodeFactory: Record<NodeType | 'trigger', (shape: ComputeShape) => Compute
|
|
|
39
39
|
[NODE_OUTPUT]: () => createNode(NODE_OUTPUT),
|
|
40
40
|
|
|
41
41
|
// Extensions.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
'text-to-image': () => createNode('text-to-image'), // TODO(burdon): Rename ai-impage-tool
|
|
43
|
+
and: () => createNode('and'),
|
|
44
|
+
append: () => createNode('append'),
|
|
45
|
+
audio: () => createNode('audio'),
|
|
46
|
+
beacon: () => createNode('beacon'),
|
|
47
|
+
chat: () => createNode('chat'),
|
|
48
|
+
constant: (shape) =>
|
|
49
49
|
createNode('constant', {
|
|
50
50
|
value: (shape as ConstantShape).value,
|
|
51
51
|
}),
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
52
|
+
'make-queue': () => createNode('make-queue'),
|
|
53
|
+
database: () => createNode('database'),
|
|
54
|
+
gpt: () => createNode('gpt'),
|
|
55
|
+
'gpt-realtime': () => createNode('gpt-realtime'),
|
|
56
|
+
if: () => createNode('if'),
|
|
57
|
+
'if-else': () => createNode('if-else'),
|
|
58
|
+
function: () => createNode('function'),
|
|
59
|
+
json: () => createNode('json'),
|
|
60
|
+
'json-transform': () => createNode('json-transform'),
|
|
61
|
+
not: () => createNode('not'),
|
|
62
|
+
or: () => createNode('or'),
|
|
63
|
+
queue: () => createNode('queue'),
|
|
64
|
+
rng: () => createNode('rng'),
|
|
65
|
+
reducer: () => createNode('reducer'),
|
|
66
|
+
scope: () => createNode('scope'),
|
|
67
|
+
surface: () => createNode('surface'),
|
|
68
|
+
switch: () => createNode('switch'),
|
|
69
|
+
template: (shape) => {
|
|
70
70
|
const node = createNode('template', { valueType: (shape as TemplateShape).valueType, value: shape.text });
|
|
71
71
|
node.inputSchema = JsonSchema.toJsonSchema(getTemplateInputSchema(node));
|
|
72
72
|
return node;
|
|
73
73
|
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
text: () => createNode('text'),
|
|
75
|
+
thread: () => createNode('thread'),
|
|
76
|
+
trigger: () => createNode(NODE_INPUT),
|
|
77
77
|
};
|
|
78
78
|
|
|
79
79
|
const createNode = (type: string, props?: Partial<ComputeNode>): ComputeNode => ({
|
|
@@ -7,7 +7,7 @@ import { useMemo } from 'react';
|
|
|
7
7
|
import { type ComputeEdge, ComputeGraphModel, type ComputeNode, DEFAULT_INPUT, DEFAULT_OUTPUT } from '@dxos/conductor';
|
|
8
8
|
import { Obj, Ref } from '@dxos/echo';
|
|
9
9
|
import { invariant } from '@dxos/invariant';
|
|
10
|
-
import { type
|
|
10
|
+
import { type CanvasBoard, type CanvasGraphModel, type GraphMonitor } from '@dxos/react-ui-canvas-editor';
|
|
11
11
|
import { isNonNullable } from '@dxos/util';
|
|
12
12
|
|
|
13
13
|
import { createComputeNode, isValidComputeNode } from '../graph';
|
|
@@ -18,7 +18,7 @@ import { type ComputeShape, type TriggerShape } from '../shapes';
|
|
|
18
18
|
*/
|
|
19
19
|
export const mapEdge = (
|
|
20
20
|
graph: CanvasGraphModel,
|
|
21
|
-
{ source, target, output = DEFAULT_OUTPUT, input = DEFAULT_INPUT }: Connection,
|
|
21
|
+
{ source, target, output = DEFAULT_OUTPUT, input = DEFAULT_INPUT }: CanvasBoard.Connection,
|
|
22
22
|
): ComputeEdge => {
|
|
23
23
|
const sourceNode = graph.findNode(source) as ComputeShape;
|
|
24
24
|
const targetNode = graph.findNode(target) as ComputeShape;
|
package/src/schema.test.ts
CHANGED
|
@@ -7,9 +7,9 @@ import { describe, test } from 'vitest';
|
|
|
7
7
|
|
|
8
8
|
import { Graph } from '@dxos/graph';
|
|
9
9
|
import {
|
|
10
|
+
CanvasBoard,
|
|
10
11
|
CanvasGraphModel,
|
|
11
12
|
Polygon,
|
|
12
|
-
Shape,
|
|
13
13
|
createEllipse,
|
|
14
14
|
createPath,
|
|
15
15
|
createRectangle,
|
|
@@ -26,7 +26,7 @@ describe('compute', () => {
|
|
|
26
26
|
console.log(JSON.stringify(node, null, 2));
|
|
27
27
|
expect(Schema.is(ComputeShape)(node)).toBe(true);
|
|
28
28
|
expect(Schema.is(Polygon)(node)).toBe(true);
|
|
29
|
-
expect(Schema.is(Shape)(node)).toBe(true);
|
|
29
|
+
expect(Schema.is(CanvasBoard.Shape)(node)).toBe(true);
|
|
30
30
|
expect(Schema.is(Graph.Node)(node)).toBe(true);
|
|
31
31
|
|
|
32
32
|
const graph: Graph.Any = { nodes: [], edges: [] };
|
|
@@ -39,7 +39,7 @@ describe('compute', () => {
|
|
|
39
39
|
|
|
40
40
|
describe('schema', () => {
|
|
41
41
|
test('basic types', ({ expect }) => {
|
|
42
|
-
const shapes: Shape[] = [];
|
|
42
|
+
const shapes: CanvasBoard.Shape[] = [];
|
|
43
43
|
shapes.push(createRectangle({ id: 'shape-1', center: { x: 0, y: 0 }, size: { width: 80, height: 80 } }));
|
|
44
44
|
shapes.push(createEllipse({ id: 'shape-2', center: { x: 0, y: 0 }, size: { width: 80, height: 80 } }));
|
|
45
45
|
shapes.push(createFunction({ id: 'shape-3', center: { x: 0, y: 0 } }));
|
package/src/shapes/Audio.tsx
CHANGED
|
@@ -35,10 +35,10 @@ 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 w-full justify-center items-center'>
|
|
39
39
|
<Icon
|
|
40
40
|
icon={active ? 'ph--microphone--regular' : 'ph--microphone-slash--regular'}
|
|
41
|
-
classNames={['transition opacity-20 duration-1000', active && 'opacity-100 text-
|
|
41
|
+
classNames={['transition opacity-20 duration-1000', active && 'opacity-100 text-error-text']}
|
|
42
42
|
size={8}
|
|
43
43
|
onClick={() => setActive(!active)}
|
|
44
44
|
/>
|
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 w-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 w-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='w-full h-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/Gpt.tsx
CHANGED
|
@@ -6,6 +6,7 @@ import * as Schema from 'effect/Schema';
|
|
|
6
6
|
import React, { useEffect, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { GptInput, GptOutput } from '@dxos/conductor';
|
|
9
|
+
import { ScrollArea } from '@dxos/react-ui';
|
|
9
10
|
import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
10
11
|
|
|
11
12
|
import { useComputeNodeState } from '../hooks';
|
|
@@ -74,7 +75,11 @@ export const GptComponent = ({ shape }: ShapeComponentProps<GptShape>) => {
|
|
|
74
75
|
return (
|
|
75
76
|
<FunctionBody
|
|
76
77
|
shape={shape}
|
|
77
|
-
content={
|
|
78
|
+
content={
|
|
79
|
+
<ScrollArea.Root orientation='vertical' thin>
|
|
80
|
+
<ScrollArea.Viewport>{text}</ScrollArea.Viewport>
|
|
81
|
+
</ScrollArea.Root>
|
|
82
|
+
}
|
|
78
83
|
status={`${tokens} tokens`}
|
|
79
84
|
inputSchema={meta.input}
|
|
80
85
|
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 w-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
|
@@ -6,7 +6,7 @@ import * as Schema from 'effect/Schema';
|
|
|
6
6
|
import React, { Fragment } from 'react';
|
|
7
7
|
|
|
8
8
|
import { DEFAULT_OUTPUT, QueueInput, QueueOutput } from '@dxos/conductor';
|
|
9
|
-
import { type ThemedClassName } from '@dxos/react-ui';
|
|
9
|
+
import { ScrollArea, 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/ui-theme';
|
|
12
12
|
|
|
@@ -46,11 +46,13 @@ export const QueueComponent = ({ shape }: ShapeComponentProps<QueueShape>) => {
|
|
|
46
46
|
|
|
47
47
|
return (
|
|
48
48
|
<Box shape={shape} status={`${items.length} items`} onAction={handleAction}>
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
<ScrollArea.Root orientation='vertical'>
|
|
50
|
+
<ScrollArea.Viewport classNames='divide-y divide-separator'>
|
|
51
|
+
{[...items].map((item, i) => (
|
|
52
|
+
<QueueItem key={i} classNames='p-1 px-2' item={item} />
|
|
53
|
+
))}
|
|
54
|
+
</ScrollArea.Viewport>
|
|
55
|
+
</ScrollArea.Root>
|
|
54
56
|
</Box>
|
|
55
57
|
);
|
|
56
58
|
};
|
|
@@ -61,7 +63,7 @@ export const QueueItem = ({ classNames, item }: ThemedClassName<{ item: any }>)
|
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
return (
|
|
64
|
-
<div className={mx('grid grid-cols-[
|
|
66
|
+
<div className={mx('grid grid-cols-[80px_1fr]', classNames)}>
|
|
65
67
|
{Object.entries(item).map(([key, value]) => (
|
|
66
68
|
<Fragment key={key}>
|
|
67
69
|
<div className='p-1 text-xs text-subdued'>{key}</div>
|
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 w-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,8 +5,9 @@
|
|
|
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/ui';
|
|
9
9
|
import { DEFAULT_INPUT } from '@dxos/conductor';
|
|
10
|
+
import { Card } from '@dxos/react-ui';
|
|
10
11
|
import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
11
12
|
import { createAnchorMap } from '@dxos/react-ui-canvas-editor';
|
|
12
13
|
|
|
@@ -44,9 +45,10 @@ export const SurfaceComponent = ({ shape }: ShapeComponentProps<SurfaceShape>) =
|
|
|
44
45
|
}
|
|
45
46
|
};
|
|
46
47
|
|
|
48
|
+
// TODO(burdon): Subject property?
|
|
47
49
|
return (
|
|
48
50
|
<Box shape={shape} onAction={handleAction}>
|
|
49
|
-
{value !== null && <Surface role='card--
|
|
51
|
+
<Card.Root>{value !== null && <Surface.Surface role='card--content' data={{ value }} limit={1} />}</Card.Root>
|
|
50
52
|
</Box>
|
|
51
53
|
);
|
|
52
54
|
};
|
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 w-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/Thread.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import * as Schema from 'effect/Schema';
|
|
|
6
6
|
import React, { useEffect, useRef } from 'react';
|
|
7
7
|
|
|
8
8
|
import { createInputSchema, createOutputSchema } from '@dxos/conductor';
|
|
9
|
-
import { type ThemedClassName } from '@dxos/react-ui';
|
|
9
|
+
import { ScrollArea, type ThemedClassName } from '@dxos/react-ui';
|
|
10
10
|
import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
11
11
|
import { Message } from '@dxos/types';
|
|
12
12
|
import { mx } from '@dxos/ui-theme';
|
|
@@ -42,18 +42,24 @@ export const ThreadComponent = ({ shape }: ShapeComponentProps<ThreadShape>) =>
|
|
|
42
42
|
|
|
43
43
|
return (
|
|
44
44
|
<Box shape={shape}>
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
<ScrollArea.Root orientation='vertical'>
|
|
46
|
+
<ScrollArea.Viewport classNames='gap-2 p-2' ref={scrollRef}>
|
|
47
|
+
{[...items].map((item, i) => (
|
|
48
|
+
<ThreadItem key={i} item={item} />
|
|
49
|
+
))}
|
|
50
|
+
</ScrollArea.Viewport>
|
|
51
|
+
</ScrollArea.Root>
|
|
50
52
|
</Box>
|
|
51
53
|
);
|
|
52
54
|
};
|
|
53
55
|
|
|
54
56
|
export const ThreadItem = ({ classNames, item }: ThemedClassName<{ item: any }>) => {
|
|
55
57
|
if (typeof item !== 'object') {
|
|
56
|
-
return
|
|
58
|
+
return (
|
|
59
|
+
<div role='none' className={mx(classNames)}>
|
|
60
|
+
{item}
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
57
63
|
}
|
|
58
64
|
|
|
59
65
|
// TODO(burdon): Hack; introspect type.
|
|
@@ -63,7 +69,7 @@ export const ThreadItem = ({ classNames, item }: ThemedClassName<{ item: any }>)
|
|
|
63
69
|
<div className={mx('flex', classNames, role === 'user' && 'justify-end')}>
|
|
64
70
|
<div
|
|
65
71
|
className={mx(
|
|
66
|
-
'block rounded-md p-1
|
|
72
|
+
'block rounded-md p-1 px-2 text-sm',
|
|
67
73
|
role === 'user'
|
|
68
74
|
? 'bg-blue-100 dark:bg-blue-800'
|
|
69
75
|
: role === 'system'
|
package/src/shapes/Trigger.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import * as Schema from 'effect/Schema';
|
|
|
6
6
|
import React, { useEffect } from 'react';
|
|
7
7
|
|
|
8
8
|
import { VoidInput } from '@dxos/conductor';
|
|
9
|
-
import { Filter, Obj, Query, Ref
|
|
9
|
+
import { Filter, Obj, Query, Ref } from '@dxos/echo';
|
|
10
10
|
import { type Mutable } from '@dxos/echo/internal';
|
|
11
11
|
import { Trigger, TriggerEvent } from '@dxos/functions';
|
|
12
12
|
import { DXN, SpaceId } from '@dxos/keys';
|
|
@@ -21,7 +21,7 @@ export const TriggerShape = Schema.extend(
|
|
|
21
21
|
ComputeShape,
|
|
22
22
|
Schema.Struct({
|
|
23
23
|
type: Schema.Literal('trigger'),
|
|
24
|
-
functionTrigger: Schema.optional(
|
|
24
|
+
functionTrigger: Schema.optional(Ref.Ref(Trigger.Trigger)),
|
|
25
25
|
}),
|
|
26
26
|
);
|
|
27
27
|
|
|
@@ -91,7 +91,7 @@ export const TriggerComponent = ({ shape }: TriggerComponentProps) => {
|
|
|
91
91
|
const TriggerKindSelect = ({ value, onValueChange }: Pick<SelectRootProps, 'value' | 'onValueChange'>) => {
|
|
92
92
|
return (
|
|
93
93
|
<Select.Root value={value} onValueChange={onValueChange}>
|
|
94
|
-
<Select.TriggerButton variant='ghost' classNames='
|
|
94
|
+
<Select.TriggerButton variant='ghost' classNames='w-full px-0!' />
|
|
95
95
|
<Select.Portal>
|
|
96
96
|
<Select.Content>
|
|
97
97
|
<Select.ScrollUpButton />
|
|
@@ -6,8 +6,7 @@ import React, { type PropsWithChildren, type ReactNode, forwardRef } from 'react
|
|
|
6
6
|
|
|
7
7
|
import { invariant } from '@dxos/invariant';
|
|
8
8
|
import { Icon, IconButton, type ThemedClassName } from '@dxos/react-ui';
|
|
9
|
-
import { useEditorContext, useShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
10
|
-
import { type Shape } from '@dxos/react-ui-canvas-editor';
|
|
9
|
+
import { type CanvasBoard, useEditorContext, useShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
11
10
|
import { mx } from '@dxos/ui-theme';
|
|
12
11
|
|
|
13
12
|
export const headerHeight = 32;
|
|
@@ -17,7 +16,7 @@ export type BoxActionHandler = (action: 'run' | 'open' | 'close') => void;
|
|
|
17
16
|
|
|
18
17
|
export type BoxProps = PropsWithChildren<
|
|
19
18
|
ThemedClassName<{
|
|
20
|
-
shape: Shape;
|
|
19
|
+
shape: CanvasBoard.Shape;
|
|
21
20
|
title?: string;
|
|
22
21
|
status?: string | ReactNode;
|
|
23
22
|
open?: boolean;
|
|
@@ -32,8 +31,8 @@ export const Box = forwardRef<HTMLDivElement, BoxProps>(
|
|
|
32
31
|
const { debug } = useEditorContext();
|
|
33
32
|
|
|
34
33
|
return (
|
|
35
|
-
<div ref={forwardedRef} className='flex flex-col
|
|
36
|
-
<div className='flex shrink-0
|
|
34
|
+
<div ref={forwardedRef} className='flex flex-col h-full w-full justify-between'>
|
|
35
|
+
<div className='flex shrink-0 w-full justify-between items-center h-[32px] bg-input-surface'>
|
|
37
36
|
<Icon icon={icon} classNames='mx-2' />
|
|
38
37
|
<div className='grow text-sm truncate'>{debug ? shape.type : (name ?? shape.text ?? title)}</div>
|
|
39
38
|
<IconButton
|
|
@@ -50,9 +49,9 @@ export const Box = forwardRef<HTMLDivElement, BoxProps>(
|
|
|
50
49
|
}}
|
|
51
50
|
/>
|
|
52
51
|
</div>
|
|
53
|
-
<div className={mx('flex flex-col
|
|
54
|
-
<div className='flex shrink-0
|
|
55
|
-
<div className='grow
|
|
52
|
+
<div className={mx('flex flex-col h-full grow overflow-hidden', classNames)}>{children}</div>
|
|
53
|
+
<div className='flex shrink-0 w-full justify-between items-center h-[32px] bg-input-surface'>
|
|
54
|
+
<div className='grow px-2 text-sm truncate'>{debug ? shape.id : status}</div>
|
|
56
55
|
{openable && (
|
|
57
56
|
<IconButton
|
|
58
57
|
classNames='p-1'
|