@dxos/react-ui-canvas-compute 0.8.4-main.406dc2a → 0.8.4-main.548089c

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.
Files changed (39) hide show
  1. package/dist/lib/browser/index.mjs +74 -92
  2. package/dist/lib/browser/index.mjs.map +3 -3
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node-esm/index.mjs +74 -92
  5. package/dist/lib/node-esm/index.mjs.map +3 -3
  6. package/dist/lib/node-esm/meta.json +1 -1
  7. package/dist/types/src/graph/controller.d.ts +11 -28
  8. package/dist/types/src/graph/controller.d.ts.map +1 -1
  9. package/dist/types/src/hooks/useComputeNodeState.d.ts +2 -2
  10. package/dist/types/src/hooks/useComputeNodeState.d.ts.map +1 -1
  11. package/dist/types/src/shapes/RNG.d.ts.map +1 -1
  12. package/dist/types/src/shapes/Surface.d.ts.map +1 -1
  13. package/dist/types/src/shapes/Trigger.d.ts +3 -3
  14. package/dist/types/src/shapes/Trigger.d.ts.map +1 -1
  15. package/dist/types/src/testing/circuits.d.ts +1 -1
  16. package/dist/types/src/testing/circuits.d.ts.map +1 -1
  17. package/dist/types/tsconfig.tsbuildinfo +1 -1
  18. package/package.json +42 -40
  19. package/src/compute.stories.tsx +6 -6
  20. package/src/graph/controller.ts +12 -5
  21. package/src/hooks/useComputeNodeState.ts +4 -3
  22. package/src/shapes/Audio.tsx +1 -1
  23. package/src/shapes/Beacon.tsx +1 -1
  24. package/src/shapes/Boolean.tsx +2 -2
  25. package/src/shapes/Function.tsx +3 -3
  26. package/src/shapes/Gpt.tsx +1 -1
  27. package/src/shapes/GptRealtime.tsx +1 -1
  28. package/src/shapes/Queue.tsx +2 -2
  29. package/src/shapes/RNG.tsx +5 -1
  30. package/src/shapes/Scope.tsx +1 -1
  31. package/src/shapes/Surface.tsx +6 -2
  32. package/src/shapes/Switch.tsx +1 -1
  33. package/src/shapes/Table.tsx +3 -3
  34. package/src/shapes/Thread.tsx +5 -5
  35. package/src/shapes/Trigger.tsx +23 -38
  36. package/src/shapes/common/Box.tsx +5 -5
  37. package/src/shapes/common/FunctionBody.tsx +2 -2
  38. package/src/shapes/common/TypeSelect.tsx +1 -1
  39. package/src/testing/circuits.ts +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.406dc2a",
3
+ "version": "0.8.4-main.548089c",
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.406dc2a",
33
- "@dxos/app-framework": "0.8.4-main.406dc2a",
34
- "@dxos/assistant": "0.8.4-main.406dc2a",
35
- "@dxos/async": "0.8.4-main.406dc2a",
36
- "@dxos/blueprints": "0.8.4-main.406dc2a",
37
- "@dxos/debug": "0.8.4-main.406dc2a",
38
- "@dxos/context": "0.8.4-main.406dc2a",
39
- "@dxos/conductor": "0.8.4-main.406dc2a",
40
- "@dxos/echo": "0.8.4-main.406dc2a",
41
- "@dxos/edge-client": "0.8.4-main.406dc2a",
42
- "@dxos/functions": "0.8.4-main.406dc2a",
43
- "@dxos/invariant": "0.8.4-main.406dc2a",
44
- "@dxos/keys": "0.8.4-main.406dc2a",
45
- "@dxos/log": "0.8.4-main.406dc2a",
46
- "@dxos/graph": "0.8.4-main.406dc2a",
47
- "@dxos/live-object": "0.8.4-main.406dc2a",
48
- "@dxos/react-client": "0.8.4-main.406dc2a",
49
- "@dxos/react-edge-client": "0.8.4-main.406dc2a",
50
- "@dxos/react-ui-canvas": "0.8.4-main.406dc2a",
51
- "@dxos/react-ui-canvas-editor": "0.8.4-main.406dc2a",
52
- "@dxos/react-ui-editor": "0.8.4-main.406dc2a",
53
- "@dxos/react-ui-form": "0.8.4-main.406dc2a",
54
- "@dxos/react-ui-attention": "0.8.4-main.406dc2a",
55
- "@dxos/react-ui-sfx": "0.8.4-main.406dc2a",
56
- "@dxos/react-ui-stack": "0.8.4-main.406dc2a",
57
- "@dxos/react-ui-syntax-highlighter": "0.8.4-main.406dc2a",
58
- "@dxos/schema": "0.8.4-main.406dc2a",
59
- "@dxos/util": "0.8.4-main.406dc2a"
32
+ "@dxos/ai": "0.8.4-main.548089c",
33
+ "@dxos/app-framework": "0.8.4-main.548089c",
34
+ "@dxos/async": "0.8.4-main.548089c",
35
+ "@dxos/assistant": "0.8.4-main.548089c",
36
+ "@dxos/blueprints": "0.8.4-main.548089c",
37
+ "@dxos/debug": "0.8.4-main.548089c",
38
+ "@dxos/conductor": "0.8.4-main.548089c",
39
+ "@dxos/context": "0.8.4-main.548089c",
40
+ "@dxos/echo": "0.8.4-main.548089c",
41
+ "@dxos/functions": "0.8.4-main.548089c",
42
+ "@dxos/edge-client": "0.8.4-main.548089c",
43
+ "@dxos/functions-runtime": "0.8.4-main.548089c",
44
+ "@dxos/graph": "0.8.4-main.548089c",
45
+ "@dxos/keys": "0.8.4-main.548089c",
46
+ "@dxos/invariant": "0.8.4-main.548089c",
47
+ "@dxos/live-object": "0.8.4-main.548089c",
48
+ "@dxos/log": "0.8.4-main.548089c",
49
+ "@dxos/react-client": "0.8.4-main.548089c",
50
+ "@dxos/react-ui-attention": "0.8.4-main.548089c",
51
+ "@dxos/react-edge-client": "0.8.4-main.548089c",
52
+ "@dxos/react-ui-canvas": "0.8.4-main.548089c",
53
+ "@dxos/react-ui-canvas-editor": "0.8.4-main.548089c",
54
+ "@dxos/react-ui-editor": "0.8.4-main.548089c",
55
+ "@dxos/react-ui-form": "0.8.4-main.548089c",
56
+ "@dxos/react-ui-sfx": "0.8.4-main.548089c",
57
+ "@dxos/react-ui-syntax-highlighter": "0.8.4-main.548089c",
58
+ "@dxos/react-ui-stack": "0.8.4-main.548089c",
59
+ "@dxos/schema": "0.8.4-main.548089c",
60
+ "@dxos/types": "0.8.4-main.548089c",
61
+ "@dxos/util": "0.8.4-main.548089c"
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.1",
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.406dc2a",
73
- "@dxos/assistant-testing": "0.8.4-main.406dc2a",
74
- "@dxos/echo-signals": "0.8.4-main.406dc2a",
75
- "@dxos/compute": "0.8.4-main.406dc2a",
76
- "@dxos/random": "0.8.4-main.406dc2a",
77
- "@dxos/react-ui": "0.8.4-main.406dc2a",
78
- "@dxos/react-ui-theme": "0.8.4-main.406dc2a",
79
- "@dxos/storybook-utils": "0.8.4-main.406dc2a"
74
+ "@dxos/app-framework": "0.8.4-main.548089c",
75
+ "@dxos/assistant-toolkit": "0.8.4-main.548089c",
76
+ "@dxos/compute": "0.8.4-main.548089c",
77
+ "@dxos/random": "0.8.4-main.548089c",
78
+ "@dxos/react-ui": "0.8.4-main.548089c",
79
+ "@dxos/echo-signals": "0.8.4-main.548089c",
80
+ "@dxos/react-ui-theme": "0.8.4-main.548089c",
81
+ "@dxos/storybook-utils": "0.8.4-main.548089c"
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.406dc2a",
86
- "@dxos/react-ui-theme": "0.8.4-main.406dc2a"
87
+ "@dxos/react-ui": "0.8.4-main.548089c",
88
+ "@dxos/react-ui-theme": "0.8.4-main.548089c"
87
89
  },
88
90
  "publishConfig": {
89
91
  "access": "public"
@@ -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-testing';
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] w-full h-full'>
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 h-full overflow-hidden'>
145
- <Toolbar.Root classNames='p-1'>
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 h-full overflow-hidden divide-y divider-separator'>
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={{}} />
@@ -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/schema';
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<ComputeMeta> {
215
+ async getMeta(node: ComputeNode): Promise<ComputeNodeMeta> {
209
216
  const { meta } = await resolveComputeNode(node);
210
217
  return meta;
211
218
  }
@@ -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 { ComputeMeta, ComputeNode } from '@dxos/conductor';
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: ComputeMeta;
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<ComputeMeta>();
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
 
@@ -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 w-full justify-center items-center'>
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']}
@@ -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 w-full justify-center items-center'>
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']}
@@ -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 w-full justify-center items-center'>
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='w-full h-full'>
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} />
@@ -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 { FunctionType, ScriptType } from '@dxos/functions';
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(ScriptType, object)) {
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(FunctionType, { source: Ref.make(object) })).run();
67
+ } = await space.db.query(Filter.type(Function.Function, { source: Ref.make(object) })).run();
68
68
  if (!fn) {
69
69
  return;
70
70
  }
@@ -74,7 +74,7 @@ export const GptComponent = ({ shape }: ShapeComponentProps<GptShape>) => {
74
74
  return (
75
75
  <FunctionBody
76
76
  shape={shape}
77
- content={<div className='px-2 py-1 overflow-y-scroll'>{text}</div>}
77
+ content={<div className='pli-2 plb-1 overflow-y-scroll'>{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 w-full justify-center items-center'>
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}
@@ -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 w-full overflow-y-scroll divide-y divide-separator'>
45
+ <div className='flex flex-col is-full overflow-y-scroll divide-y divide-separator'>
46
46
  {[...items].map((item, i) => (
47
- <QueueItem key={i} classNames='p-1 px-2' item={item} />
47
+ <QueueItem key={i} classNames='p-1 pli-2' item={item} />
48
48
  ))}
49
49
  </div>
50
50
  </Box>
@@ -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>({ type: 'rng', size: { width: 64, height: 64 }, ...props });
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',
@@ -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 w-full justify-center items-center bg-black'>
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
  );
@@ -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>({ type: 'surface', size: { width: 384, height: 384 }, ...props });
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);
@@ -36,7 +36,7 @@ export const SwitchComponent = ({ shape }: ShapeComponentProps<SwitchShape>) =>
36
36
  }, [value]);
37
37
 
38
38
  return (
39
- <div className='flex w-full justify-center items-center' onClick={(ev) => ev.stopPropagation()}>
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>
@@ -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 { DataType } from '@dxos/schema';
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(DataType.Message);
16
- const OutputSchema = createOutputSchema(Schema.mutable(Schema.Array(DataType.Message)));
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,
@@ -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 { DataType } from '@dxos/schema';
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(DataType.Message);
18
- const OutputSchema = createOutputSchema(Schema.mutable(Schema.Array(DataType.Message)));
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 w-full overflow-y-scroll gap-2 p-2'>
45
+ <div ref={scrollRef} className='flex flex-col is-full overflow-y-scroll 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 px-2 text-sm',
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'
@@ -6,24 +6,9 @@ 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 } from '@dxos/echo';
9
+ import { Filter, Query } from '@dxos/echo';
10
10
  import { ObjectId, Ref } from '@dxos/echo/internal';
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';
11
+ import { Trigger, TriggerEvent } from '@dxos/functions';
27
12
  import { DXN, SpaceId } from '@dxos/keys';
28
13
  import { useSpace } from '@dxos/react-client/echo';
29
14
  import { Select, type SelectRootProps } from '@dxos/react-ui';
@@ -36,25 +21,25 @@ export const TriggerShape = Schema.extend(
36
21
  ComputeShape,
37
22
  Schema.Struct({
38
23
  type: Schema.Literal('trigger'),
39
- functionTrigger: Schema.optional(Ref(FunctionTrigger)),
24
+ functionTrigger: Schema.optional(Ref(Trigger.Trigger)),
40
25
  }),
41
26
  );
42
27
  export type TriggerShape = Schema.Schema.Type<typeof TriggerShape>;
43
28
 
44
29
  export type CreateTriggerProps = CreateShapeProps<Omit<TriggerShape, 'functionTrigger'>> & {
45
30
  spaceId?: SpaceId;
46
- triggerKind?: TriggerKind;
31
+ triggerKind?: Trigger.Kind;
47
32
  };
48
33
 
49
34
  export const createTrigger = (props: CreateTriggerProps): TriggerShape => {
50
- const functionTrigger = Obj.make(FunctionTrigger, {
35
+ const functionTrigger = Trigger.make({
51
36
  enabled: true,
52
37
  spec: createTriggerSpec(props),
53
38
  });
54
39
  return createShape<TriggerShape>({
55
40
  type: 'trigger',
56
41
  functionTrigger: Ref.make(functionTrigger),
57
- size: { width: 192, height: getHeight(EmailTriggerOutput) },
42
+ size: { width: 192, height: getHeight(TriggerEvent.EmailEvent) },
58
43
  ...props,
59
44
  });
60
45
  };
@@ -75,7 +60,7 @@ export const TriggerComponent = ({ shape }: TriggerComponentProps) => {
75
60
  shape.size.height = getHeight(getOutputSchema(functionTrigger?.spec?.kind ?? 'email'));
76
61
  }, [functionTrigger?.spec?.kind]);
77
62
 
78
- const setKind = (kind: TriggerKind) => {
63
+ const setKind = (kind: Trigger.Kind) => {
79
64
  if (functionTrigger?.spec?.kind !== kind) {
80
65
  functionTrigger!.spec = createTriggerSpec({ triggerKind: kind, spaceId: space?.id });
81
66
  }
@@ -89,7 +74,7 @@ export const TriggerComponent = ({ shape }: TriggerComponentProps) => {
89
74
  <FunctionBody
90
75
  shape={shape}
91
76
  status={
92
- <TriggerKindSelect value={functionTrigger.spec?.kind} onValueChange={(kind) => setKind(kind as TriggerKind)} />
77
+ <TriggerKindSelect value={functionTrigger.spec?.kind} onValueChange={(kind) => setKind(kind as Trigger.Kind)} />
93
78
  }
94
79
  inputSchema={VoidInput}
95
80
  outputSchema={getOutputSchema(functionTrigger.spec!.kind!)}
@@ -101,12 +86,12 @@ export const TriggerComponent = ({ shape }: TriggerComponentProps) => {
101
86
  const TriggerKindSelect = ({ value, onValueChange }: Pick<SelectRootProps, 'value' | 'onValueChange'>) => {
102
87
  return (
103
88
  <Select.Root value={value} onValueChange={onValueChange}>
104
- <Select.TriggerButton variant='ghost' classNames='w-full !px-0' />
89
+ <Select.TriggerButton variant='ghost' classNames='is-full !pli-0' />
105
90
  <Select.Portal>
106
91
  <Select.Content>
107
92
  <Select.ScrollUpButton />
108
93
  <Select.Viewport>
109
- {TriggerKinds.map((kind) => (
94
+ {Trigger.Kinds.map((kind) => (
110
95
  <Select.Option key={kind} value={kind}>
111
96
  {kind}
112
97
  </Select.Option>
@@ -120,36 +105,36 @@ const TriggerKindSelect = ({ value, onValueChange }: Pick<SelectRootProps, 'valu
120
105
  );
121
106
  };
122
107
 
123
- const createTriggerSpec = (props: { triggerKind?: TriggerKind; spaceId?: SpaceId }): TriggerType => {
108
+ const createTriggerSpec = (props: { triggerKind?: Trigger.Kind; spaceId?: SpaceId }): Trigger.Spec => {
124
109
  const kind = props.triggerKind ?? 'email';
125
110
  switch (kind) {
126
111
  case 'timer':
127
- return { kind: 'timer', cron: '*/10 * * * * *' } satisfies TimerTrigger;
112
+ return { kind: 'timer', cron: '*/10 * * * * *' } satisfies Trigger.TimerSpec;
128
113
  case 'webhook':
129
- return { kind: 'webhook', method: 'POST' } satisfies WebhookTrigger;
114
+ return { kind: 'webhook', method: 'POST' } satisfies Trigger.WebhookSpec;
130
115
  case 'subscription':
131
116
  return {
132
117
  kind: 'subscription',
133
118
  query: {
134
119
  ast: Query.select(Filter.nothing()).ast,
135
120
  },
136
- } satisfies SubscriptionTrigger;
121
+ } satisfies Trigger.SubscriptionSpec;
137
122
  case 'email':
138
- return { kind: 'email' } satisfies EmailTrigger;
123
+ return { kind: 'email' } satisfies Trigger.EmailSpec;
139
124
  case 'queue': {
140
125
  const dxn = new DXN(DXN.kind.QUEUE, ['data', props.spaceId ?? SpaceId.random(), ObjectId.random()]).toString();
141
- return { kind: 'queue', queue: dxn } satisfies QueueTrigger;
126
+ return { kind: 'queue', queue: dxn } satisfies Trigger.QueueSpec;
142
127
  }
143
128
  }
144
129
  };
145
130
 
146
- const getOutputSchema = (kind: TriggerKind) => {
147
- const kindToSchema: Record<TriggerKind, Schema.Schema<any>> = {
148
- ['email']: EmailTriggerOutput,
149
- ['subscription']: SubscriptionTriggerOutput,
150
- ['timer']: TimerTriggerOutput,
151
- ['webhook']: WebhookTriggerOutput,
152
- ['queue']: QueueTriggerOutput,
131
+ const getOutputSchema = (kind: Trigger.Kind) => {
132
+ const kindToSchema: Record<Trigger.Kind, Schema.Schema<any>> = {
133
+ ['email']: TriggerEvent.EmailEvent,
134
+ ['subscription']: TriggerEvent.SubscriptionEvent,
135
+ ['timer']: TriggerEvent.TimerEvent,
136
+ ['webhook']: TriggerEvent.WebhookEvent,
137
+ ['queue']: TriggerEvent.QueueEvent,
153
138
  };
154
139
  return kindToSchema[kind];
155
140
  };
@@ -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 h-full w-full justify-between'>
36
- <div className='flex shrink-0 w-full justify-between items-center h-[32px] bg-hoverSurface'>
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 h-[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 h-full grow overflow-hidden', classNames)}>{children}</div>
54
- <div className='flex shrink-0 w-full justify-between items-center h-[32px] bg-hoverSurface'>
55
- <div className='grow px-2 text-sm truncate'>{debug ? shape.id : status}</div>
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 h-[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'
@@ -82,7 +82,7 @@ export const FunctionBody = ({
82
82
  {(inputs?.length ?? 0) > 0 && (
83
83
  <div className='flex flex-col'>
84
84
  {inputs?.map(({ name }) => (
85
- <div key={name} className='px-2 truncate text-sm font-mono items-center' style={{ height: rowHeight }}>
85
+ <div key={name} className='pli-2 truncate text-sm font-mono items-center' style={{ height: rowHeight }}>
86
86
  {name}
87
87
  </div>
88
88
  ))}
@@ -93,7 +93,7 @@ export const FunctionBody = ({
93
93
  {outputs?.map(({ name }) => (
94
94
  <div
95
95
  key={name}
96
- className='px-2 truncate text-sm font-mono items-center text-right'
96
+ className='pli-2 truncate text-sm font-mono items-center text-right'
97
97
  style={{ height: rowHeight }}
98
98
  >
99
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='w-full !px-0' />
14
+ <Select.TriggerButton variant='ghost' classNames='is-full !pli-0' />
15
15
  <Select.Portal>
16
16
  <Select.Content>
17
17
  <Select.ScrollUpButton />