@dxos/react-ui-canvas-compute 0.8.4-main.5ea62a8 → 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 +123 -136
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +123 -136
- 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 +3 -1
- package/dist/types/src/compute.stories.d.ts.map +1 -1
- package/dist/types/src/graph/controller.d.ts +13 -30
- package/dist/types/src/graph/controller.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeGraphController.d.ts +1 -1
- package/dist/types/src/hooks/useComputeGraphController.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/json.test.d.ts +1 -1
- package/dist/types/src/json.test.d.ts.map +1 -1
- package/dist/types/src/shapes/Append.d.ts +1 -1
- package/dist/types/src/shapes/Append.d.ts.map +1 -1
- package/dist/types/src/shapes/Array.d.ts +1 -1
- package/dist/types/src/shapes/Array.d.ts.map +1 -1
- package/dist/types/src/shapes/Audio.d.ts +1 -1
- package/dist/types/src/shapes/Audio.d.ts.map +1 -1
- package/dist/types/src/shapes/Beacon.d.ts +1 -1
- package/dist/types/src/shapes/Beacon.d.ts.map +1 -1
- package/dist/types/src/shapes/Boolean.d.ts +1 -1
- package/dist/types/src/shapes/Boolean.d.ts.map +1 -1
- package/dist/types/src/shapes/Chat.d.ts +1 -1
- package/dist/types/src/shapes/Chat.d.ts.map +1 -1
- package/dist/types/src/shapes/Constant.d.ts +2 -2
- package/dist/types/src/shapes/Constant.d.ts.map +1 -1
- package/dist/types/src/shapes/Database.d.ts +1 -1
- package/dist/types/src/shapes/Database.d.ts.map +1 -1
- package/dist/types/src/shapes/Function.d.ts +1 -1
- package/dist/types/src/shapes/Function.d.ts.map +1 -1
- package/dist/types/src/shapes/Gpt.d.ts +1 -1
- package/dist/types/src/shapes/Gpt.d.ts.map +1 -1
- package/dist/types/src/shapes/GptRealtime.d.ts +1 -1
- package/dist/types/src/shapes/GptRealtime.d.ts.map +1 -1
- package/dist/types/src/shapes/Json.d.ts +1 -1
- package/dist/types/src/shapes/Json.d.ts.map +1 -1
- package/dist/types/src/shapes/Logic.d.ts +1 -1
- package/dist/types/src/shapes/Logic.d.ts.map +1 -1
- package/dist/types/src/shapes/Queue.d.ts +1 -1
- package/dist/types/src/shapes/Queue.d.ts.map +1 -1
- package/dist/types/src/shapes/RNG.d.ts +1 -1
- package/dist/types/src/shapes/RNG.d.ts.map +1 -1
- package/dist/types/src/shapes/Scope.d.ts +1 -1
- package/dist/types/src/shapes/Scope.d.ts.map +1 -1
- package/dist/types/src/shapes/Surface.d.ts +1 -1
- package/dist/types/src/shapes/Surface.d.ts.map +1 -1
- package/dist/types/src/shapes/Switch.d.ts +1 -1
- package/dist/types/src/shapes/Switch.d.ts.map +1 -1
- package/dist/types/src/shapes/Table.d.ts +1 -1
- package/dist/types/src/shapes/Table.d.ts.map +1 -1
- package/dist/types/src/shapes/Template.d.ts +1 -1
- package/dist/types/src/shapes/Template.d.ts.map +1 -1
- package/dist/types/src/shapes/Text.d.ts +1 -1
- package/dist/types/src/shapes/Text.d.ts.map +1 -1
- package/dist/types/src/shapes/TextToImage.d.ts +1 -1
- package/dist/types/src/shapes/TextToImage.d.ts.map +1 -1
- package/dist/types/src/shapes/Thread.d.ts +1 -1
- package/dist/types/src/shapes/Thread.d.ts.map +1 -1
- package/dist/types/src/shapes/Trigger.d.ts +4 -37
- package/dist/types/src/shapes/Trigger.d.ts.map +1 -1
- package/dist/types/src/shapes/common/FunctionBody.d.ts +1 -1
- package/dist/types/src/shapes/common/FunctionBody.d.ts.map +1 -1
- package/dist/types/src/shapes/defs.d.ts +2 -1
- package/dist/types/src/shapes/defs.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 +52 -50
- package/src/compute-layout.ts +1 -1
- package/src/compute.stories.tsx +12 -12
- package/src/graph/controller.ts +17 -6
- package/src/graph/node-defs.ts +3 -3
- package/src/hooks/useComputeGraphController.ts +1 -1
- package/src/hooks/useComputeNodeState.ts +5 -4
- package/src/hooks/useGraphMonitor.ts +2 -2
- package/src/json.test.ts +1 -1
- package/src/schema.test.ts +8 -8
- package/src/shapes/Append.tsx +1 -1
- package/src/shapes/Array.tsx +1 -1
- package/src/shapes/Audio.tsx +2 -2
- package/src/shapes/Beacon.tsx +2 -2
- package/src/shapes/Boolean.tsx +3 -3
- package/src/shapes/Chat.tsx +1 -1
- package/src/shapes/Constant.tsx +1 -1
- package/src/shapes/Database.tsx +1 -1
- package/src/shapes/Function.tsx +5 -5
- package/src/shapes/Gpt.tsx +2 -2
- package/src/shapes/GptRealtime.tsx +2 -2
- package/src/shapes/Json.tsx +1 -1
- package/src/shapes/Logic.tsx +1 -1
- package/src/shapes/Queue.tsx +3 -3
- package/src/shapes/RNG.tsx +6 -2
- package/src/shapes/Scope.tsx +2 -2
- package/src/shapes/Surface.tsx +7 -3
- package/src/shapes/Switch.tsx +2 -2
- package/src/shapes/Table.tsx +4 -4
- package/src/shapes/Template.tsx +2 -2
- package/src/shapes/Text.tsx +1 -1
- package/src/shapes/TextToImage.tsx +1 -1
- package/src/shapes/Thread.tsx +6 -6
- package/src/shapes/Trigger.tsx +30 -41
- package/src/shapes/common/Box.tsx +5 -5
- package/src/shapes/common/FunctionBody.tsx +4 -3
- package/src/shapes/common/TypeSelect.tsx +1 -1
- package/src/shapes/defs.ts +5 -4
- package/src/testing/circuits.ts +2 -3
package/src/shapes/Queue.tsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
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';
|
|
@@ -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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
import React, { useEffect, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { DEFAULT_OUTPUT } from '@dxos/conductor';
|
|
@@ -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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
8
|
import { DEFAULT_INPUT } from '@dxos/conductor';
|
|
@@ -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
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
import React, { useEffect, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { DEFAULT_OUTPUT } from '@dxos/conductor';
|
|
@@ -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
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
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/Template.tsx
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
import React, { useRef } from 'react';
|
|
7
7
|
|
|
8
8
|
import { ComputeValueType, TemplateOutput, VoidInput, getTemplateInputSchema } from '@dxos/conductor';
|
|
9
|
-
import { toJsonSchema } from '@dxos/echo
|
|
9
|
+
import { toJsonSchema } from '@dxos/echo/internal';
|
|
10
10
|
import { invariant } from '@dxos/invariant';
|
|
11
11
|
import {
|
|
12
12
|
type ShapeComponentProps,
|
package/src/shapes/Text.tsx
CHANGED
package/src/shapes/Thread.tsx
CHANGED
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
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
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'
|
package/src/shapes/Trigger.tsx
CHANGED
|
@@ -2,28 +2,12 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
import React, { useEffect } from 'react';
|
|
7
7
|
|
|
8
8
|
import { VoidInput } from '@dxos/conductor';
|
|
9
|
-
import { Obj } from '@dxos/echo';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
type EmailTrigger,
|
|
13
|
-
EmailTriggerOutput,
|
|
14
|
-
FunctionTrigger,
|
|
15
|
-
type QueueTrigger,
|
|
16
|
-
QueueTriggerOutput,
|
|
17
|
-
type SubscriptionTrigger,
|
|
18
|
-
SubscriptionTriggerOutput,
|
|
19
|
-
type TimerTrigger,
|
|
20
|
-
TimerTriggerOutput,
|
|
21
|
-
type TriggerKind,
|
|
22
|
-
TriggerKinds,
|
|
23
|
-
type TriggerType,
|
|
24
|
-
type WebhookTrigger,
|
|
25
|
-
WebhookTriggerOutput,
|
|
26
|
-
} from '@dxos/functions';
|
|
9
|
+
import { Filter, Obj, Query, Ref, Type } from '@dxos/echo';
|
|
10
|
+
import { Trigger, TriggerEvent } from '@dxos/functions';
|
|
27
11
|
import { DXN, SpaceId } from '@dxos/keys';
|
|
28
12
|
import { useSpace } from '@dxos/react-client/echo';
|
|
29
13
|
import { Select, type SelectRootProps } from '@dxos/react-ui';
|
|
@@ -36,25 +20,25 @@ export const TriggerShape = Schema.extend(
|
|
|
36
20
|
ComputeShape,
|
|
37
21
|
Schema.Struct({
|
|
38
22
|
type: Schema.Literal('trigger'),
|
|
39
|
-
functionTrigger: Schema.optional(Ref(
|
|
23
|
+
functionTrigger: Schema.optional(Type.Ref(Trigger.Trigger)),
|
|
40
24
|
}),
|
|
41
25
|
);
|
|
42
26
|
export type TriggerShape = Schema.Schema.Type<typeof TriggerShape>;
|
|
43
27
|
|
|
44
28
|
export type CreateTriggerProps = CreateShapeProps<Omit<TriggerShape, 'functionTrigger'>> & {
|
|
45
29
|
spaceId?: SpaceId;
|
|
46
|
-
triggerKind?:
|
|
30
|
+
triggerKind?: Trigger.Kind;
|
|
47
31
|
};
|
|
48
32
|
|
|
49
33
|
export const createTrigger = (props: CreateTriggerProps): TriggerShape => {
|
|
50
|
-
const functionTrigger =
|
|
34
|
+
const functionTrigger = Trigger.make({
|
|
51
35
|
enabled: true,
|
|
52
36
|
spec: createTriggerSpec(props),
|
|
53
37
|
});
|
|
54
38
|
return createShape<TriggerShape>({
|
|
55
39
|
type: 'trigger',
|
|
56
40
|
functionTrigger: Ref.make(functionTrigger),
|
|
57
|
-
size: { width: 192, height: getHeight(
|
|
41
|
+
size: { width: 192, height: getHeight(TriggerEvent.EmailEvent) },
|
|
58
42
|
...props,
|
|
59
43
|
});
|
|
60
44
|
};
|
|
@@ -75,7 +59,7 @@ export const TriggerComponent = ({ shape }: TriggerComponentProps) => {
|
|
|
75
59
|
shape.size.height = getHeight(getOutputSchema(functionTrigger?.spec?.kind ?? 'email'));
|
|
76
60
|
}, [functionTrigger?.spec?.kind]);
|
|
77
61
|
|
|
78
|
-
const setKind = (kind:
|
|
62
|
+
const setKind = (kind: Trigger.Kind) => {
|
|
79
63
|
if (functionTrigger?.spec?.kind !== kind) {
|
|
80
64
|
functionTrigger!.spec = createTriggerSpec({ triggerKind: kind, spaceId: space?.id });
|
|
81
65
|
}
|
|
@@ -89,7 +73,7 @@ export const TriggerComponent = ({ shape }: TriggerComponentProps) => {
|
|
|
89
73
|
<FunctionBody
|
|
90
74
|
shape={shape}
|
|
91
75
|
status={
|
|
92
|
-
<TriggerKindSelect value={functionTrigger.spec?.kind} onValueChange={(kind) => setKind(kind as
|
|
76
|
+
<TriggerKindSelect value={functionTrigger.spec?.kind} onValueChange={(kind) => setKind(kind as Trigger.Kind)} />
|
|
93
77
|
}
|
|
94
78
|
inputSchema={VoidInput}
|
|
95
79
|
outputSchema={getOutputSchema(functionTrigger.spec!.kind!)}
|
|
@@ -101,12 +85,12 @@ export const TriggerComponent = ({ shape }: TriggerComponentProps) => {
|
|
|
101
85
|
const TriggerKindSelect = ({ value, onValueChange }: Pick<SelectRootProps, 'value' | 'onValueChange'>) => {
|
|
102
86
|
return (
|
|
103
87
|
<Select.Root value={value} onValueChange={onValueChange}>
|
|
104
|
-
<Select.TriggerButton variant='ghost' classNames='
|
|
88
|
+
<Select.TriggerButton variant='ghost' classNames='is-full !pli-0' />
|
|
105
89
|
<Select.Portal>
|
|
106
90
|
<Select.Content>
|
|
107
91
|
<Select.ScrollUpButton />
|
|
108
92
|
<Select.Viewport>
|
|
109
|
-
{
|
|
93
|
+
{Trigger.Kinds.map((kind) => (
|
|
110
94
|
<Select.Option key={kind} value={kind}>
|
|
111
95
|
{kind}
|
|
112
96
|
</Select.Option>
|
|
@@ -120,31 +104,36 @@ const TriggerKindSelect = ({ value, onValueChange }: Pick<SelectRootProps, 'valu
|
|
|
120
104
|
);
|
|
121
105
|
};
|
|
122
106
|
|
|
123
|
-
const createTriggerSpec = (props: { triggerKind?:
|
|
107
|
+
const createTriggerSpec = (props: { triggerKind?: Trigger.Kind; spaceId?: SpaceId }): Trigger.Spec => {
|
|
124
108
|
const kind = props.triggerKind ?? 'email';
|
|
125
109
|
switch (kind) {
|
|
126
110
|
case 'timer':
|
|
127
|
-
return { kind: 'timer', cron: '*/10 * * * * *' } satisfies
|
|
111
|
+
return { kind: 'timer', cron: '*/10 * * * * *' } satisfies Trigger.TimerSpec;
|
|
128
112
|
case 'webhook':
|
|
129
|
-
return { kind: 'webhook', method: 'POST' } satisfies
|
|
113
|
+
return { kind: 'webhook', method: 'POST' } satisfies Trigger.WebhookSpec;
|
|
130
114
|
case 'subscription':
|
|
131
|
-
return {
|
|
115
|
+
return {
|
|
116
|
+
kind: 'subscription',
|
|
117
|
+
query: {
|
|
118
|
+
ast: Query.select(Filter.nothing()).ast,
|
|
119
|
+
},
|
|
120
|
+
} satisfies Trigger.SubscriptionSpec;
|
|
132
121
|
case 'email':
|
|
133
|
-
return { kind: 'email' } satisfies
|
|
122
|
+
return { kind: 'email' } satisfies Trigger.EmailSpec;
|
|
134
123
|
case 'queue': {
|
|
135
|
-
const dxn = new DXN(DXN.kind.QUEUE, ['data', props.spaceId ?? SpaceId.random(),
|
|
136
|
-
return { kind: 'queue', queue: dxn } satisfies
|
|
124
|
+
const dxn = new DXN(DXN.kind.QUEUE, ['data', props.spaceId ?? SpaceId.random(), Obj.ID.random()]).toString();
|
|
125
|
+
return { kind: 'queue', queue: dxn } satisfies Trigger.QueueSpec;
|
|
137
126
|
}
|
|
138
127
|
}
|
|
139
128
|
};
|
|
140
129
|
|
|
141
|
-
const getOutputSchema = (kind:
|
|
142
|
-
const kindToSchema: Record<
|
|
143
|
-
['email']:
|
|
144
|
-
['subscription']:
|
|
145
|
-
['timer']:
|
|
146
|
-
['webhook']:
|
|
147
|
-
['queue']:
|
|
130
|
+
const getOutputSchema = (kind: Trigger.Kind) => {
|
|
131
|
+
const kindToSchema: Record<Trigger.Kind, Schema.Schema<any>> = {
|
|
132
|
+
['email']: TriggerEvent.EmailEvent,
|
|
133
|
+
['subscription']: TriggerEvent.SubscriptionEvent,
|
|
134
|
+
['timer']: TriggerEvent.TimerEvent,
|
|
135
|
+
['webhook']: TriggerEvent.WebhookEvent,
|
|
136
|
+
['queue']: TriggerEvent.QueueEvent,
|
|
148
137
|
};
|
|
149
138
|
return kindToSchema[kind];
|
|
150
139
|
};
|
|
@@ -32,8 +32,8 @@ export const Box = forwardRef<HTMLDivElement, BoxProps>(
|
|
|
32
32
|
const { debug } = useEditorContext();
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
|
-
<div ref={forwardedRef} className='flex flex-col
|
|
36
|
-
<div className='flex shrink-0
|
|
35
|
+
<div ref={forwardedRef} className='flex flex-col bs-full is-full justify-between'>
|
|
36
|
+
<div className='flex shrink-0 is-full justify-between items-center bs-[32px] bg-hoverSurface'>
|
|
37
37
|
<Icon icon={icon} classNames='mx-2' />
|
|
38
38
|
<div className='grow text-sm truncate'>{debug ? shape.type : (name ?? shape.text ?? title)}</div>
|
|
39
39
|
<IconButton
|
|
@@ -50,9 +50,9 @@ export const Box = forwardRef<HTMLDivElement, BoxProps>(
|
|
|
50
50
|
}}
|
|
51
51
|
/>
|
|
52
52
|
</div>
|
|
53
|
-
<div className={mx('flex flex-col
|
|
54
|
-
<div className='flex shrink-0
|
|
55
|
-
<div className='grow
|
|
53
|
+
<div className={mx('flex flex-col bs-full grow overflow-hidden', classNames)}>{children}</div>
|
|
54
|
+
<div className='flex shrink-0 is-full justify-between items-center bs-[32px] bg-hoverSurface'>
|
|
55
|
+
<div className='grow pli-2 text-sm truncate'>{debug ? shape.id : status}</div>
|
|
56
56
|
{openable && (
|
|
57
57
|
<IconButton
|
|
58
58
|
classNames='p-1'
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import type * as Schema from 'effect/Schema';
|
|
6
|
+
import * as SchemaAST from 'effect/SchemaAST';
|
|
6
7
|
import React, { type JSX, useRef, useState } from 'react';
|
|
7
8
|
|
|
8
9
|
import { VoidInput, VoidOutput } from '@dxos/conductor';
|
|
@@ -81,7 +82,7 @@ export const FunctionBody = ({
|
|
|
81
82
|
{(inputs?.length ?? 0) > 0 && (
|
|
82
83
|
<div className='flex flex-col'>
|
|
83
84
|
{inputs?.map(({ name }) => (
|
|
84
|
-
<div key={name} className='
|
|
85
|
+
<div key={name} className='pli-2 truncate text-sm font-mono items-center' style={{ height: rowHeight }}>
|
|
85
86
|
{name}
|
|
86
87
|
</div>
|
|
87
88
|
))}
|
|
@@ -92,7 +93,7 @@ export const FunctionBody = ({
|
|
|
92
93
|
{outputs?.map(({ name }) => (
|
|
93
94
|
<div
|
|
94
95
|
key={name}
|
|
95
|
-
className='
|
|
96
|
+
className='pli-2 truncate text-sm font-mono items-center text-right'
|
|
96
97
|
style={{ height: rowHeight }}
|
|
97
98
|
>
|
|
98
99
|
{name}
|
|
@@ -11,7 +11,7 @@ import { Select, type SelectRootProps } from '@dxos/react-ui';
|
|
|
11
11
|
export const TypeSelect = ({ value, onValueChange }: Pick<SelectRootProps, 'value' | 'onValueChange'>) => {
|
|
12
12
|
return (
|
|
13
13
|
<Select.Root value={value} onValueChange={onValueChange}>
|
|
14
|
-
<Select.TriggerButton variant='ghost' classNames='
|
|
14
|
+
<Select.TriggerButton variant='ghost' classNames='is-full !pli-0' />
|
|
15
15
|
<Select.Portal>
|
|
16
16
|
<Select.Content>
|
|
17
17
|
<Select.ScrollUpButton />
|
package/src/shapes/defs.ts
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
import * as SchemaAST from 'effect/SchemaAST';
|
|
6
7
|
|
|
7
8
|
import { DEFAULT_INPUT, DEFAULT_OUTPUT } from '@dxos/conductor';
|
|
8
|
-
import {
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
9
10
|
import { Polygon } from '@dxos/react-ui-canvas-editor';
|
|
10
11
|
import { type MakeOptional } from '@dxos/util';
|
|
11
12
|
|
|
@@ -36,7 +37,7 @@ export const ComputeShape = Schema.extend(
|
|
|
36
37
|
Polygon,
|
|
37
38
|
Schema.Struct({
|
|
38
39
|
// TODO(burdon): Rename computeNode?
|
|
39
|
-
node: Schema.optional(
|
|
40
|
+
node: Schema.optional(Obj.ID.annotations({ description: 'Compute node id' })),
|
|
40
41
|
}).pipe(Schema.mutable),
|
|
41
42
|
);
|
|
42
43
|
|
|
@@ -44,7 +45,7 @@ export type ComputeShape = Schema.Schema.Type<typeof ComputeShape>;
|
|
|
44
45
|
|
|
45
46
|
export const createShape = <S extends ComputeShape>({ id, ...rest }: CreateShapeProps<S> & { type: string }): S => {
|
|
46
47
|
return {
|
|
47
|
-
id: id ??
|
|
48
|
+
id: id ?? Obj.ID.random(),
|
|
48
49
|
...rest,
|
|
49
50
|
} as S;
|
|
50
51
|
};
|
package/src/testing/circuits.ts
CHANGED
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { createSystemPrompt } from '@dxos/assistant';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { DXN, SpaceId } from '@dxos/keys';
|
|
6
|
+
import { type ServiceContainer } from '@dxos/functions-runtime';
|
|
7
|
+
import { DXN, ObjectId, SpaceId } from '@dxos/keys';
|
|
9
8
|
import { type Dimension, type Point } from '@dxos/react-ui-canvas';
|
|
10
9
|
import { CanvasGraphModel, createNote, pointMultiply, pointsToRect, rectToPoints } from '@dxos/react-ui-canvas-editor';
|
|
11
10
|
|