@dxos/react-ui-canvas-compute 0.8.2-staging.7ac8446 → 0.8.2
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 +1022 -836
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +1040 -854
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +1022 -836
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/DiagnosticOverlay.d.ts.map +1 -1
- package/dist/types/src/graph/controller.d.ts +2 -18
- package/dist/types/src/graph/controller.d.ts.map +1 -1
- package/dist/types/src/graph/node-defs.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeGraphController.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeNodeState.d.ts.map +1 -1
- package/dist/types/src/hooks/useGraphMonitor.d.ts.map +1 -1
- package/dist/types/src/json.test.d.ts +18 -18
- package/dist/types/src/json.test.d.ts.map +1 -1
- package/dist/types/src/shapes/Append.d.ts +19 -19
- package/dist/types/src/shapes/Append.d.ts.map +1 -1
- package/dist/types/src/shapes/Array.d.ts +19 -19
- package/dist/types/src/shapes/Array.d.ts.map +1 -1
- package/dist/types/src/shapes/Audio.d.ts +19 -19
- package/dist/types/src/shapes/Audio.d.ts.map +1 -1
- package/dist/types/src/shapes/Beacon.d.ts +19 -19
- package/dist/types/src/shapes/Beacon.d.ts.map +1 -1
- package/dist/types/src/shapes/Boolean.d.ts +70 -70
- package/dist/types/src/shapes/Boolean.d.ts.map +1 -1
- package/dist/types/src/shapes/Chat.d.ts +19 -19
- package/dist/types/src/shapes/Chat.d.ts.map +1 -1
- package/dist/types/src/shapes/Constant.d.ts +20 -20
- package/dist/types/src/shapes/Constant.d.ts.map +1 -1
- package/dist/types/src/shapes/Database.d.ts +19 -19
- package/dist/types/src/shapes/Database.d.ts.map +1 -1
- package/dist/types/src/shapes/Function.d.ts +19 -19
- package/dist/types/src/shapes/Function.d.ts.map +1 -1
- package/dist/types/src/shapes/Gpt.d.ts +19 -19
- package/dist/types/src/shapes/Gpt.d.ts.map +1 -1
- package/dist/types/src/shapes/GptRealtime.d.ts +19 -19
- package/dist/types/src/shapes/GptRealtime.d.ts.map +1 -1
- package/dist/types/src/shapes/Json.d.ts +37 -37
- package/dist/types/src/shapes/Json.d.ts.map +1 -1
- package/dist/types/src/shapes/Logic.d.ts +37 -37
- package/dist/types/src/shapes/Logic.d.ts.map +1 -1
- package/dist/types/src/shapes/Queue.d.ts +19 -19
- package/dist/types/src/shapes/Queue.d.ts.map +1 -1
- package/dist/types/src/shapes/RNG.d.ts +21 -21
- package/dist/types/src/shapes/RNG.d.ts.map +1 -1
- package/dist/types/src/shapes/Scope.d.ts +19 -19
- package/dist/types/src/shapes/Scope.d.ts.map +1 -1
- package/dist/types/src/shapes/Surface.d.ts +19 -19
- package/dist/types/src/shapes/Surface.d.ts.map +1 -1
- package/dist/types/src/shapes/Switch.d.ts +19 -19
- package/dist/types/src/shapes/Switch.d.ts.map +1 -1
- package/dist/types/src/shapes/Table.d.ts +19 -19
- package/dist/types/src/shapes/Table.d.ts.map +1 -1
- package/dist/types/src/shapes/Template.d.ts +20 -20
- package/dist/types/src/shapes/Template.d.ts.map +1 -1
- package/dist/types/src/shapes/Text.d.ts +19 -19
- package/dist/types/src/shapes/Text.d.ts.map +1 -1
- package/dist/types/src/shapes/TextToImage.d.ts +19 -19
- package/dist/types/src/shapes/TextToImage.d.ts.map +1 -1
- package/dist/types/src/shapes/Thread.d.ts +19 -19
- package/dist/types/src/shapes/Thread.d.ts.map +1 -1
- package/dist/types/src/shapes/Trigger.d.ts +47 -45
- package/dist/types/src/shapes/Trigger.d.ts.map +1 -1
- package/dist/types/src/shapes/common/FunctionBody.d.ts +5 -5
- package/dist/types/src/shapes/common/FunctionBody.d.ts.map +1 -1
- package/dist/types/src/shapes/common/TypeSelect.d.ts.map +1 -1
- package/dist/types/src/shapes/defs.d.ts +18 -19
- package/dist/types/src/shapes/defs.d.ts.map +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 +3 -3
- package/src/graph/controller.ts +12 -12
- package/src/hooks/useComputeNodeState.ts +3 -3
- package/src/hooks/useGraphMonitor.ts +3 -5
- package/src/json.test.ts +10 -10
- package/src/schema.test.ts +7 -7
- package/src/shapes/Append.tsx +5 -5
- package/src/shapes/Array.tsx +5 -5
- package/src/shapes/Audio.tsx +5 -5
- package/src/shapes/Beacon.tsx +5 -5
- package/src/shapes/Boolean.tsx +5 -5
- package/src/shapes/Chat.tsx +5 -5
- package/src/shapes/Constant.tsx +6 -6
- package/src/shapes/Database.tsx +5 -5
- package/src/shapes/Function.tsx +8 -7
- package/src/shapes/Gpt.tsx +6 -6
- package/src/shapes/GptRealtime.tsx +8 -8
- package/src/shapes/Json.tsx +9 -9
- package/src/shapes/Logic.tsx +9 -9
- package/src/shapes/Queue.tsx +5 -5
- package/src/shapes/RNG.tsx +7 -7
- package/src/shapes/Scope.tsx +5 -5
- package/src/shapes/Surface.tsx +5 -5
- package/src/shapes/Switch.tsx +5 -5
- package/src/shapes/Table.tsx +6 -6
- package/src/shapes/Template.tsx +8 -7
- package/src/shapes/Text.tsx +5 -5
- package/src/shapes/TextToImage.tsx +5 -5
- package/src/shapes/Thread.tsx +6 -6
- package/src/shapes/Trigger.tsx +32 -33
- package/src/shapes/common/FunctionBody.tsx +11 -9
- package/src/shapes/defs.ts +9 -9
package/src/shapes/Database.tsx
CHANGED
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
|
|
7
|
-
import { S } from '@dxos/echo-schema';
|
|
8
8
|
import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
9
9
|
import { createAnchorMap } from '@dxos/react-ui-canvas-editor';
|
|
10
10
|
|
|
11
11
|
import { Box } from './common';
|
|
12
12
|
import { ComputeShape, createAnchorId, createShape, type CreateShapeProps } from './defs';
|
|
13
13
|
|
|
14
|
-
export const DatabaseShape =
|
|
14
|
+
export const DatabaseShape = Schema.extend(
|
|
15
15
|
ComputeShape,
|
|
16
|
-
|
|
17
|
-
type:
|
|
16
|
+
Schema.Struct({
|
|
17
|
+
type: Schema.Literal('database'),
|
|
18
18
|
}),
|
|
19
19
|
);
|
|
20
20
|
|
|
21
|
-
export type DatabaseShape =
|
|
21
|
+
export type DatabaseShape = Schema.Schema.Type<typeof DatabaseShape>;
|
|
22
22
|
|
|
23
23
|
export type CreateDatabaseProps = CreateShapeProps<DatabaseShape>;
|
|
24
24
|
|
package/src/shapes/Function.tsx
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import React, { useCallback, useRef } from 'react';
|
|
6
7
|
|
|
7
8
|
import { AnyOutput, FunctionInput } from '@dxos/conductor';
|
|
8
|
-
import { getSnapshot, isInstanceOf,
|
|
9
|
-
import { FunctionType, ScriptType } from '@dxos/functions
|
|
9
|
+
import { getSnapshot, isInstanceOf, Ref } from '@dxos/echo-schema';
|
|
10
|
+
import { FunctionType, ScriptType } from '@dxos/functions';
|
|
10
11
|
import { useClient } from '@dxos/react-client';
|
|
11
12
|
import { Filter, makeRef, parseId } from '@dxos/react-client/echo';
|
|
12
13
|
import {
|
|
@@ -21,14 +22,14 @@ import { Box, createFunctionAnchors } from './common';
|
|
|
21
22
|
import { ComputeShape, createShape, type CreateShapeProps } from './defs';
|
|
22
23
|
import { useComputeNodeState } from '../hooks';
|
|
23
24
|
|
|
24
|
-
export const FunctionShape =
|
|
25
|
+
export const FunctionShape = Schema.extend(
|
|
25
26
|
ComputeShape,
|
|
26
|
-
|
|
27
|
-
type:
|
|
27
|
+
Schema.Struct({
|
|
28
|
+
type: Schema.Literal('function'),
|
|
28
29
|
}),
|
|
29
30
|
);
|
|
30
31
|
|
|
31
|
-
export type FunctionShape =
|
|
32
|
+
export type FunctionShape = Schema.Schema.Type<typeof FunctionShape>;
|
|
32
33
|
|
|
33
34
|
export type CreateFunctionProps = CreateShapeProps<FunctionShape>;
|
|
34
35
|
|
|
@@ -62,7 +63,7 @@ const TextInputComponent = ({ shape, title, ...props }: TextInputComponentProps)
|
|
|
62
63
|
|
|
63
64
|
const {
|
|
64
65
|
objects: [fn],
|
|
65
|
-
} = await space.db.query(Filter.
|
|
66
|
+
} = await space.db.query(Filter.type(FunctionType, { source: Ref.make(object) })).run();
|
|
66
67
|
if (!fn) {
|
|
67
68
|
return;
|
|
68
69
|
}
|
package/src/shapes/Gpt.tsx
CHANGED
|
@@ -2,25 +2,25 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import React, { useEffect, useState } from 'react';
|
|
6
7
|
|
|
7
|
-
import type
|
|
8
|
+
import { type GenerationStreamEvent } from '@dxos/ai';
|
|
8
9
|
import { GptInput, GptOutput } from '@dxos/conductor';
|
|
9
|
-
import { S } from '@dxos/echo-schema';
|
|
10
10
|
import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
11
11
|
|
|
12
12
|
import { createFunctionAnchors, FunctionBody, getHeight } from './common';
|
|
13
13
|
import { ComputeShape, createShape, type CreateShapeProps } from './defs';
|
|
14
14
|
import { useComputeNodeState } from '../hooks';
|
|
15
15
|
|
|
16
|
-
export const GptShape =
|
|
16
|
+
export const GptShape = Schema.extend(
|
|
17
17
|
ComputeShape,
|
|
18
|
-
|
|
19
|
-
type:
|
|
18
|
+
Schema.Struct({
|
|
19
|
+
type: Schema.Literal('gpt'),
|
|
20
20
|
}),
|
|
21
21
|
);
|
|
22
22
|
|
|
23
|
-
export type GptShape =
|
|
23
|
+
export type GptShape = Schema.Schema.Type<typeof GptShape>;
|
|
24
24
|
|
|
25
25
|
export type CreateGptProps = CreateShapeProps<GptShape>;
|
|
26
26
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import React, { useState } from 'react';
|
|
6
7
|
|
|
7
|
-
import { S } from '@dxos/echo-schema';
|
|
8
8
|
import { log } from '@dxos/log';
|
|
9
9
|
import { useConfig } from '@dxos/react-client';
|
|
10
10
|
import { Icon } from '@dxos/react-ui';
|
|
@@ -13,14 +13,14 @@ import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-e
|
|
|
13
13
|
import { createFunctionAnchors } from './common';
|
|
14
14
|
import { ComputeShape, createShape, type CreateShapeProps } from './defs';
|
|
15
15
|
|
|
16
|
-
export const GptRealtimeShape =
|
|
16
|
+
export const GptRealtimeShape = Schema.extend(
|
|
17
17
|
ComputeShape,
|
|
18
|
-
|
|
19
|
-
type:
|
|
18
|
+
Schema.Struct({
|
|
19
|
+
type: Schema.Literal('gpt-realtime'),
|
|
20
20
|
}),
|
|
21
21
|
);
|
|
22
22
|
|
|
23
|
-
export type GptRealtimeShape =
|
|
23
|
+
export type GptRealtimeShape = Schema.Schema.Type<typeof GptRealtimeShape>;
|
|
24
24
|
|
|
25
25
|
export type CreateGptRealtimeProps = CreateShapeProps<GptRealtimeShape>;
|
|
26
26
|
|
|
@@ -164,10 +164,10 @@ export const gptRealtimeShape: ShapeDef<GptRealtimeShape> = {
|
|
|
164
164
|
getAnchors: (shape) =>
|
|
165
165
|
createFunctionAnchors(
|
|
166
166
|
shape,
|
|
167
|
-
|
|
168
|
-
audio:
|
|
167
|
+
Schema.Struct({
|
|
168
|
+
audio: Schema.Any,
|
|
169
169
|
}),
|
|
170
|
-
|
|
170
|
+
Schema.Struct({}),
|
|
171
171
|
),
|
|
172
172
|
resizable: true,
|
|
173
173
|
};
|
package/src/shapes/Json.tsx
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
|
|
7
8
|
import { DEFAULT_INPUT, DefaultOutput, JsonTransformInput } from '@dxos/conductor';
|
|
8
|
-
import { S } from '@dxos/echo-schema';
|
|
9
9
|
import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
10
10
|
import { createAnchorMap } from '@dxos/react-ui-canvas-editor';
|
|
11
11
|
import { JsonFilter } from '@dxos/react-ui-syntax-highlighter';
|
|
@@ -18,23 +18,23 @@ import { useComputeNodeState } from '../hooks';
|
|
|
18
18
|
// Data
|
|
19
19
|
//
|
|
20
20
|
|
|
21
|
-
export const JsonShape =
|
|
21
|
+
export const JsonShape = Schema.extend(
|
|
22
22
|
ComputeShape,
|
|
23
|
-
|
|
24
|
-
type:
|
|
23
|
+
Schema.Struct({
|
|
24
|
+
type: Schema.Literal('json'),
|
|
25
25
|
}),
|
|
26
26
|
);
|
|
27
27
|
|
|
28
|
-
export type JsonShape =
|
|
28
|
+
export type JsonShape = Schema.Schema.Type<typeof JsonShape>;
|
|
29
29
|
|
|
30
|
-
export const JsonTransformShape =
|
|
30
|
+
export const JsonTransformShape = Schema.extend(
|
|
31
31
|
ComputeShape,
|
|
32
|
-
|
|
33
|
-
type:
|
|
32
|
+
Schema.Struct({
|
|
33
|
+
type: Schema.Literal('json-transform'),
|
|
34
34
|
}),
|
|
35
35
|
);
|
|
36
36
|
|
|
37
|
-
export type JsonTransformShape =
|
|
37
|
+
export type JsonTransformShape = Schema.Schema.Type<typeof JsonTransformShape>;
|
|
38
38
|
|
|
39
39
|
//
|
|
40
40
|
// Component
|
package/src/shapes/Logic.tsx
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
|
|
7
8
|
import { IfElseInput, IfElseOutput, IfInput, IfOutput } from '@dxos/conductor';
|
|
8
|
-
import { S } from '@dxos/echo-schema';
|
|
9
9
|
import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
10
10
|
|
|
11
11
|
import { createFunctionAnchors, FunctionBody, getHeight } from './common';
|
|
@@ -15,23 +15,23 @@ import { ComputeShape, createShape, type CreateShapeProps } from './defs';
|
|
|
15
15
|
// Data
|
|
16
16
|
//
|
|
17
17
|
|
|
18
|
-
export const IfShape =
|
|
18
|
+
export const IfShape = Schema.extend(
|
|
19
19
|
ComputeShape,
|
|
20
|
-
|
|
21
|
-
type:
|
|
20
|
+
Schema.Struct({
|
|
21
|
+
type: Schema.Literal('if'),
|
|
22
22
|
}),
|
|
23
23
|
);
|
|
24
24
|
|
|
25
|
-
export type IfShape =
|
|
25
|
+
export type IfShape = Schema.Schema.Type<typeof IfShape>;
|
|
26
26
|
|
|
27
|
-
export const IfElseShape =
|
|
27
|
+
export const IfElseShape = Schema.extend(
|
|
28
28
|
ComputeShape,
|
|
29
|
-
|
|
30
|
-
type:
|
|
29
|
+
Schema.Struct({
|
|
30
|
+
type: Schema.Literal('if-else'),
|
|
31
31
|
}),
|
|
32
32
|
);
|
|
33
33
|
|
|
34
|
-
export type IfElseShape =
|
|
34
|
+
export type IfElseShape = Schema.Schema.Type<typeof IfElseShape>;
|
|
35
35
|
|
|
36
36
|
//
|
|
37
37
|
// Components
|
package/src/shapes/Queue.tsx
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import React, { Fragment } from 'react';
|
|
6
7
|
|
|
7
8
|
import { DEFAULT_OUTPUT, QueueInput, QueueOutput } from '@dxos/conductor';
|
|
8
|
-
import { S } from '@dxos/echo-schema';
|
|
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';
|
|
@@ -15,14 +15,14 @@ import { Box, type BoxActionHandler } from './common';
|
|
|
15
15
|
import { ComputeShape, createShape, type CreateShapeProps } from './defs';
|
|
16
16
|
import { useComputeNodeState } from '../hooks';
|
|
17
17
|
|
|
18
|
-
export const QueueShape =
|
|
18
|
+
export const QueueShape = Schema.extend(
|
|
19
19
|
ComputeShape,
|
|
20
|
-
|
|
21
|
-
type:
|
|
20
|
+
Schema.Struct({
|
|
21
|
+
type: Schema.Literal('queue'),
|
|
22
22
|
}),
|
|
23
23
|
);
|
|
24
24
|
|
|
25
|
-
export type QueueShape =
|
|
25
|
+
export type QueueShape = Schema.Schema.Type<typeof QueueShape>;
|
|
26
26
|
|
|
27
27
|
export type CreateQueueProps = CreateShapeProps<QueueShape>;
|
|
28
28
|
|
package/src/shapes/RNG.tsx
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import React, { useEffect, useState } from 'react';
|
|
6
7
|
|
|
7
8
|
import { DEFAULT_OUTPUT } from '@dxos/conductor';
|
|
8
|
-
import { S } from '@dxos/echo-schema';
|
|
9
9
|
import { Icon, type IconProps } from '@dxos/react-ui';
|
|
10
10
|
import { createAnchorMap, type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
11
11
|
import { mx } from '@dxos/react-ui-theme';
|
|
@@ -13,16 +13,16 @@ import { mx } from '@dxos/react-ui-theme';
|
|
|
13
13
|
import { ComputeShape, createAnchorId, createShape, type CreateShapeProps } from './defs';
|
|
14
14
|
import { useComputeNodeState } from '../hooks';
|
|
15
15
|
|
|
16
|
-
export const RandomShape =
|
|
16
|
+
export const RandomShape = Schema.extend(
|
|
17
17
|
ComputeShape,
|
|
18
|
-
|
|
19
|
-
type:
|
|
20
|
-
min:
|
|
21
|
-
max:
|
|
18
|
+
Schema.Struct({
|
|
19
|
+
type: Schema.Literal('rng'),
|
|
20
|
+
min: Schema.optional(Schema.Number),
|
|
21
|
+
max: Schema.optional(Schema.Number),
|
|
22
22
|
}),
|
|
23
23
|
);
|
|
24
24
|
|
|
25
|
-
export type RandomShape =
|
|
25
|
+
export type RandomShape = Schema.Schema.Type<typeof RandomShape>;
|
|
26
26
|
|
|
27
27
|
export type CreateRandomProps = CreateShapeProps<RandomShape>;
|
|
28
28
|
|
package/src/shapes/Scope.tsx
CHANGED
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
|
|
7
8
|
import { DEFAULT_INPUT } from '@dxos/conductor';
|
|
8
|
-
import { S } from '@dxos/echo-schema';
|
|
9
9
|
import { createAnchorMap, type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
10
10
|
import { useAudioStream, Chaos, shaderPresets } from '@dxos/react-ui-sfx';
|
|
11
11
|
|
|
12
12
|
import { ComputeShape, createAnchorId, createShape, type CreateShapeProps } from './defs';
|
|
13
13
|
import { useComputeNodeState } from '../hooks';
|
|
14
14
|
|
|
15
|
-
export const ScopeShape =
|
|
15
|
+
export const ScopeShape = Schema.extend(
|
|
16
16
|
ComputeShape,
|
|
17
|
-
|
|
18
|
-
type:
|
|
17
|
+
Schema.Struct({
|
|
18
|
+
type: Schema.Literal('scope'),
|
|
19
19
|
}),
|
|
20
20
|
);
|
|
21
21
|
|
|
22
|
-
export type ScopeShape =
|
|
22
|
+
export type ScopeShape = Schema.Schema.Type<typeof ScopeShape>;
|
|
23
23
|
|
|
24
24
|
export type CreateScopeProps = CreateShapeProps<ScopeShape>;
|
|
25
25
|
|
package/src/shapes/Surface.tsx
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
|
|
7
8
|
import { Surface } from '@dxos/app-framework';
|
|
8
9
|
import { DEFAULT_INPUT } from '@dxos/conductor';
|
|
9
|
-
import { S } from '@dxos/echo-schema';
|
|
10
10
|
import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
11
11
|
import { createAnchorMap } from '@dxos/react-ui-canvas-editor';
|
|
12
12
|
|
|
@@ -14,14 +14,14 @@ import { Box, type BoxActionHandler } from './common';
|
|
|
14
14
|
import { ComputeShape, createAnchorId, createShape, type CreateShapeProps } from './defs';
|
|
15
15
|
import { useComputeNodeState } from '../hooks';
|
|
16
16
|
|
|
17
|
-
export const SurfaceShape =
|
|
17
|
+
export const SurfaceShape = Schema.extend(
|
|
18
18
|
ComputeShape,
|
|
19
|
-
|
|
20
|
-
type:
|
|
19
|
+
Schema.Struct({
|
|
20
|
+
type: Schema.Literal('surface'),
|
|
21
21
|
}),
|
|
22
22
|
);
|
|
23
23
|
|
|
24
|
-
export type SurfaceShape =
|
|
24
|
+
export type SurfaceShape = Schema.Schema.Type<typeof SurfaceShape>;
|
|
25
25
|
|
|
26
26
|
export type CreateSurfaceProps = CreateShapeProps<SurfaceShape>;
|
|
27
27
|
|
package/src/shapes/Switch.tsx
CHANGED
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import React, { useEffect, useState } from 'react';
|
|
6
7
|
|
|
7
8
|
import { DEFAULT_OUTPUT } from '@dxos/conductor';
|
|
8
|
-
import { S } from '@dxos/echo-schema';
|
|
9
9
|
import { Input } from '@dxos/react-ui';
|
|
10
10
|
import { createAnchorMap, type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
11
11
|
|
|
12
12
|
import { ComputeShape, createAnchorId, createShape, type CreateShapeProps } from './defs';
|
|
13
13
|
import { useComputeNodeState } from '../hooks';
|
|
14
14
|
|
|
15
|
-
export const SwitchShape =
|
|
15
|
+
export const SwitchShape = Schema.extend(
|
|
16
16
|
ComputeShape,
|
|
17
|
-
|
|
18
|
-
type:
|
|
17
|
+
Schema.Struct({
|
|
18
|
+
type: Schema.Literal('switch'),
|
|
19
19
|
}),
|
|
20
20
|
);
|
|
21
21
|
|
|
22
|
-
export type SwitchShape =
|
|
22
|
+
export type SwitchShape = Schema.Schema.Type<typeof SwitchShape>;
|
|
23
23
|
|
|
24
24
|
export type CreateSwitchProps = CreateShapeProps<SwitchShape>;
|
|
25
25
|
|
package/src/shapes/Table.tsx
CHANGED
|
@@ -2,26 +2,26 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
|
|
7
8
|
import { createInputSchema, createOutputSchema, GptMessage } from '@dxos/conductor';
|
|
8
|
-
import { S } from '@dxos/echo-schema';
|
|
9
9
|
import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
10
10
|
|
|
11
11
|
import { createFunctionAnchors, Box } from './common';
|
|
12
12
|
import { ComputeShape, createShape, type CreateShapeProps } from './defs';
|
|
13
13
|
|
|
14
14
|
const InputSchema = createInputSchema(GptMessage);
|
|
15
|
-
const OutputSchema = createOutputSchema(
|
|
15
|
+
const OutputSchema = createOutputSchema(Schema.mutable(Schema.Array(GptMessage)));
|
|
16
16
|
|
|
17
|
-
export const TableShape =
|
|
17
|
+
export const TableShape = Schema.extend(
|
|
18
18
|
ComputeShape,
|
|
19
|
-
|
|
20
|
-
type:
|
|
19
|
+
Schema.Struct({
|
|
20
|
+
type: Schema.Literal('table'),
|
|
21
21
|
}),
|
|
22
22
|
);
|
|
23
23
|
|
|
24
|
-
export type TableShape =
|
|
24
|
+
export type TableShape = Schema.Schema.Type<typeof TableShape>;
|
|
25
25
|
|
|
26
26
|
export type CreateTableProps = CreateShapeProps<TableShape>;
|
|
27
27
|
|
package/src/shapes/Template.tsx
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import React, { useRef } from 'react';
|
|
6
7
|
|
|
7
8
|
import { ComputeValueType, getTemplateInputSchema, TemplateOutput, VoidInput } from '@dxos/conductor';
|
|
8
|
-
import {
|
|
9
|
+
import { toJsonSchema } from '@dxos/echo-schema';
|
|
9
10
|
import { invariant } from '@dxos/invariant';
|
|
10
11
|
import {
|
|
11
12
|
type ShapeComponentProps,
|
|
@@ -23,15 +24,15 @@ import { useComputeNodeState } from '../hooks';
|
|
|
23
24
|
// Data
|
|
24
25
|
//
|
|
25
26
|
|
|
26
|
-
export const TemplateShape =
|
|
27
|
+
export const TemplateShape = Schema.extend(
|
|
27
28
|
ComputeShape,
|
|
28
|
-
|
|
29
|
-
type:
|
|
30
|
-
valueType:
|
|
29
|
+
Schema.Struct({
|
|
30
|
+
type: Schema.Literal('template'),
|
|
31
|
+
valueType: Schema.optional(ComputeValueType),
|
|
31
32
|
}),
|
|
32
33
|
);
|
|
33
34
|
|
|
34
|
-
export type TemplateShape =
|
|
35
|
+
export type TemplateShape = Schema.Schema.Type<typeof TemplateShape>;
|
|
35
36
|
|
|
36
37
|
//
|
|
37
38
|
// Component
|
|
@@ -54,7 +55,7 @@ const TextInputComponent = ({ shape, title, ...props }: TextInputComponentProps)
|
|
|
54
55
|
};
|
|
55
56
|
|
|
56
57
|
const handleTypeChange = (newType: string) => {
|
|
57
|
-
invariant(
|
|
58
|
+
invariant(Schema.is(ComputeValueType)(newType), 'Invalid type');
|
|
58
59
|
|
|
59
60
|
node.valueType = newType;
|
|
60
61
|
node.inputSchema = toJsonSchema(getTemplateInputSchema(node));
|
package/src/shapes/Text.tsx
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
|
|
7
8
|
import { DEFAULT_INPUT } from '@dxos/conductor';
|
|
8
|
-
import { S } from '@dxos/echo-schema';
|
|
9
9
|
import { TextBox, type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
10
10
|
import { createAnchorMap } from '@dxos/react-ui-canvas-editor';
|
|
11
11
|
|
|
@@ -13,14 +13,14 @@ import { Box, type BoxActionHandler } from './common';
|
|
|
13
13
|
import { ComputeShape, createAnchorId, createShape, type CreateShapeProps } from './defs';
|
|
14
14
|
import { useComputeNodeState } from '../hooks';
|
|
15
15
|
|
|
16
|
-
export const TextShape =
|
|
16
|
+
export const TextShape = Schema.extend(
|
|
17
17
|
ComputeShape,
|
|
18
|
-
|
|
19
|
-
type:
|
|
18
|
+
Schema.Struct({
|
|
19
|
+
type: Schema.Literal('text'),
|
|
20
20
|
}),
|
|
21
21
|
);
|
|
22
22
|
|
|
23
|
-
export type TextShape =
|
|
23
|
+
export type TextShape = Schema.Schema.Type<typeof TextShape>;
|
|
24
24
|
|
|
25
25
|
export type CreateTextProps = CreateShapeProps<TextShape>;
|
|
26
26
|
|
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
|
|
7
|
-
import { S } from '@dxos/echo-schema';
|
|
8
8
|
import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
9
9
|
import { createAnchorMap } from '@dxos/react-ui-canvas-editor';
|
|
10
10
|
|
|
11
11
|
import { Box } from './common';
|
|
12
12
|
import { ComputeShape, createAnchorId, createShape, type CreateShapeProps } from './defs';
|
|
13
13
|
|
|
14
|
-
export const TextToImageShape =
|
|
14
|
+
export const TextToImageShape = Schema.extend(
|
|
15
15
|
ComputeShape,
|
|
16
|
-
|
|
17
|
-
type:
|
|
16
|
+
Schema.Struct({
|
|
17
|
+
type: Schema.Literal('text-to-image'),
|
|
18
18
|
}),
|
|
19
19
|
);
|
|
20
20
|
|
|
21
|
-
export type TextToImageShape =
|
|
21
|
+
export type TextToImageShape = Schema.Schema.Type<typeof TextToImageShape>;
|
|
22
22
|
|
|
23
23
|
export type CreateTextToImageProps = CreateShapeProps<TextToImageShape>;
|
|
24
24
|
|
package/src/shapes/Thread.tsx
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import React, { useEffect, useRef } from 'react';
|
|
6
7
|
|
|
7
8
|
import { createInputSchema, createOutputSchema, GptMessage } from '@dxos/conductor';
|
|
8
|
-
import { S } from '@dxos/echo-schema';
|
|
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';
|
|
@@ -14,16 +14,16 @@ import { createFunctionAnchors, Box } from './common';
|
|
|
14
14
|
import { ComputeShape, createShape, type CreateShapeProps } from './defs';
|
|
15
15
|
|
|
16
16
|
const InputSchema = createInputSchema(GptMessage);
|
|
17
|
-
const OutputSchema = createOutputSchema(
|
|
17
|
+
const OutputSchema = createOutputSchema(Schema.mutable(Schema.Array(GptMessage)));
|
|
18
18
|
|
|
19
|
-
export const ThreadShape =
|
|
19
|
+
export const ThreadShape = Schema.extend(
|
|
20
20
|
ComputeShape,
|
|
21
|
-
|
|
22
|
-
type:
|
|
21
|
+
Schema.Struct({
|
|
22
|
+
type: Schema.Literal('thread'),
|
|
23
23
|
}),
|
|
24
24
|
);
|
|
25
25
|
|
|
26
|
-
export type ThreadShape =
|
|
26
|
+
export type ThreadShape = Schema.Schema.Type<typeof ThreadShape>;
|
|
27
27
|
|
|
28
28
|
export type CreateThreadProps = CreateShapeProps<ThreadShape>;
|
|
29
29
|
|