@dxos/react-ui-canvas-compute 0.8.4-main.a4bbb77 → 0.8.4-main.ae835ea

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 (99) hide show
  1. package/dist/lib/browser/index.mjs +88 -100
  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 +88 -100
  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 +5 -18
  8. package/dist/types/src/graph/controller.d.ts.map +1 -1
  9. package/dist/types/src/json.test.d.ts +1 -1
  10. package/dist/types/src/json.test.d.ts.map +1 -1
  11. package/dist/types/src/shapes/Append.d.ts +1 -1
  12. package/dist/types/src/shapes/Append.d.ts.map +1 -1
  13. package/dist/types/src/shapes/Array.d.ts +1 -1
  14. package/dist/types/src/shapes/Array.d.ts.map +1 -1
  15. package/dist/types/src/shapes/Audio.d.ts +1 -1
  16. package/dist/types/src/shapes/Audio.d.ts.map +1 -1
  17. package/dist/types/src/shapes/Beacon.d.ts +1 -1
  18. package/dist/types/src/shapes/Beacon.d.ts.map +1 -1
  19. package/dist/types/src/shapes/Boolean.d.ts +1 -1
  20. package/dist/types/src/shapes/Boolean.d.ts.map +1 -1
  21. package/dist/types/src/shapes/Chat.d.ts +1 -1
  22. package/dist/types/src/shapes/Chat.d.ts.map +1 -1
  23. package/dist/types/src/shapes/Constant.d.ts +1 -1
  24. package/dist/types/src/shapes/Constant.d.ts.map +1 -1
  25. package/dist/types/src/shapes/Database.d.ts +1 -1
  26. package/dist/types/src/shapes/Database.d.ts.map +1 -1
  27. package/dist/types/src/shapes/Function.d.ts +1 -1
  28. package/dist/types/src/shapes/Function.d.ts.map +1 -1
  29. package/dist/types/src/shapes/Gpt.d.ts +1 -1
  30. package/dist/types/src/shapes/Gpt.d.ts.map +1 -1
  31. package/dist/types/src/shapes/GptRealtime.d.ts +1 -1
  32. package/dist/types/src/shapes/GptRealtime.d.ts.map +1 -1
  33. package/dist/types/src/shapes/Json.d.ts +1 -1
  34. package/dist/types/src/shapes/Json.d.ts.map +1 -1
  35. package/dist/types/src/shapes/Logic.d.ts +1 -1
  36. package/dist/types/src/shapes/Logic.d.ts.map +1 -1
  37. package/dist/types/src/shapes/Queue.d.ts +1 -1
  38. package/dist/types/src/shapes/Queue.d.ts.map +1 -1
  39. package/dist/types/src/shapes/RNG.d.ts +1 -1
  40. package/dist/types/src/shapes/RNG.d.ts.map +1 -1
  41. package/dist/types/src/shapes/Scope.d.ts +1 -1
  42. package/dist/types/src/shapes/Scope.d.ts.map +1 -1
  43. package/dist/types/src/shapes/Surface.d.ts +1 -1
  44. package/dist/types/src/shapes/Surface.d.ts.map +1 -1
  45. package/dist/types/src/shapes/Switch.d.ts +1 -1
  46. package/dist/types/src/shapes/Switch.d.ts.map +1 -1
  47. package/dist/types/src/shapes/Table.d.ts +1 -1
  48. package/dist/types/src/shapes/Table.d.ts.map +1 -1
  49. package/dist/types/src/shapes/Template.d.ts +1 -1
  50. package/dist/types/src/shapes/Template.d.ts.map +1 -1
  51. package/dist/types/src/shapes/Text.d.ts +1 -1
  52. package/dist/types/src/shapes/Text.d.ts.map +1 -1
  53. package/dist/types/src/shapes/TextToImage.d.ts +1 -1
  54. package/dist/types/src/shapes/TextToImage.d.ts.map +1 -1
  55. package/dist/types/src/shapes/Thread.d.ts +1 -1
  56. package/dist/types/src/shapes/Thread.d.ts.map +1 -1
  57. package/dist/types/src/shapes/Trigger.d.ts +4 -4
  58. package/dist/types/src/shapes/Trigger.d.ts.map +1 -1
  59. package/dist/types/src/shapes/common/FunctionBody.d.ts +1 -1
  60. package/dist/types/src/shapes/common/FunctionBody.d.ts.map +1 -1
  61. package/dist/types/src/shapes/defs.d.ts +2 -1
  62. package/dist/types/src/shapes/defs.d.ts.map +1 -1
  63. package/dist/types/tsconfig.tsbuildinfo +1 -1
  64. package/package.json +41 -42
  65. package/src/compute-layout.ts +1 -1
  66. package/src/compute.stories.tsx +2 -2
  67. package/src/graph/controller.ts +13 -2
  68. package/src/graph/node-defs.ts +1 -1
  69. package/src/hooks/useComputeNodeState.ts +1 -1
  70. package/src/hooks/useGraphMonitor.ts +1 -1
  71. package/src/json.test.ts +1 -1
  72. package/src/schema.test.ts +2 -2
  73. package/src/shapes/Append.tsx +1 -1
  74. package/src/shapes/Array.tsx +1 -1
  75. package/src/shapes/Audio.tsx +1 -1
  76. package/src/shapes/Beacon.tsx +1 -1
  77. package/src/shapes/Boolean.tsx +1 -1
  78. package/src/shapes/Chat.tsx +1 -1
  79. package/src/shapes/Constant.tsx +1 -1
  80. package/src/shapes/Database.tsx +1 -1
  81. package/src/shapes/Function.tsx +5 -5
  82. package/src/shapes/Gpt.tsx +1 -1
  83. package/src/shapes/GptRealtime.tsx +1 -1
  84. package/src/shapes/Json.tsx +1 -1
  85. package/src/shapes/Logic.tsx +1 -1
  86. package/src/shapes/Queue.tsx +1 -1
  87. package/src/shapes/RNG.tsx +1 -1
  88. package/src/shapes/Scope.tsx +1 -1
  89. package/src/shapes/Surface.tsx +1 -1
  90. package/src/shapes/Switch.tsx +1 -1
  91. package/src/shapes/Table.tsx +1 -1
  92. package/src/shapes/Template.tsx +2 -2
  93. package/src/shapes/Text.tsx +1 -1
  94. package/src/shapes/TextToImage.tsx +1 -1
  95. package/src/shapes/Thread.tsx +1 -1
  96. package/src/shapes/Trigger.tsx +29 -39
  97. package/src/shapes/common/FunctionBody.tsx +2 -1
  98. package/src/shapes/defs.ts +3 -2
  99. 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.a4bbb77",
3
+ "version": "0.8.4-main.ae835ea",
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,62 +29,61 @@
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.a4bbb77",
33
- "@dxos/app-framework": "0.8.4-main.a4bbb77",
34
- "@dxos/assistant": "0.8.4-main.a4bbb77",
35
- "@dxos/async": "0.8.4-main.a4bbb77",
36
- "@dxos/blueprints": "0.8.4-main.a4bbb77",
37
- "@dxos/conductor": "0.8.4-main.a4bbb77",
38
- "@dxos/context": "0.8.4-main.a4bbb77",
39
- "@dxos/echo": "0.8.4-main.a4bbb77",
40
- "@dxos/echo-schema": "0.8.4-main.a4bbb77",
41
- "@dxos/edge-client": "0.8.4-main.a4bbb77",
42
- "@dxos/functions": "0.8.4-main.a4bbb77",
43
- "@dxos/graph": "0.8.4-main.a4bbb77",
44
- "@dxos/debug": "0.8.4-main.a4bbb77",
45
- "@dxos/invariant": "0.8.4-main.a4bbb77",
46
- "@dxos/keys": "0.8.4-main.a4bbb77",
47
- "@dxos/react-edge-client": "0.8.4-main.a4bbb77",
48
- "@dxos/log": "0.8.4-main.a4bbb77",
49
- "@dxos/react-client": "0.8.4-main.a4bbb77",
50
- "@dxos/react-ui-attention": "0.8.4-main.a4bbb77",
51
- "@dxos/react-ui-canvas-editor": "0.8.4-main.a4bbb77",
52
- "@dxos/react-ui-canvas": "0.8.4-main.a4bbb77",
53
- "@dxos/react-ui-editor": "0.8.4-main.a4bbb77",
54
- "@dxos/react-ui-form": "0.8.4-main.a4bbb77",
55
- "@dxos/react-ui-sfx": "0.8.4-main.a4bbb77",
56
- "@dxos/react-ui-stack": "0.8.4-main.a4bbb77",
57
- "@dxos/react-ui-syntax-highlighter": "0.8.4-main.a4bbb77",
58
- "@dxos/schema": "0.8.4-main.a4bbb77",
59
- "@dxos/util": "0.8.4-main.a4bbb77",
60
- "@dxos/live-object": "0.8.4-main.a4bbb77"
32
+ "@dxos/ai": "0.8.4-main.ae835ea",
33
+ "@dxos/app-framework": "0.8.4-main.ae835ea",
34
+ "@dxos/async": "0.8.4-main.ae835ea",
35
+ "@dxos/assistant": "0.8.4-main.ae835ea",
36
+ "@dxos/conductor": "0.8.4-main.ae835ea",
37
+ "@dxos/debug": "0.8.4-main.ae835ea",
38
+ "@dxos/context": "0.8.4-main.ae835ea",
39
+ "@dxos/echo": "0.8.4-main.ae835ea",
40
+ "@dxos/edge-client": "0.8.4-main.ae835ea",
41
+ "@dxos/functions": "0.8.4-main.ae835ea",
42
+ "@dxos/invariant": "0.8.4-main.ae835ea",
43
+ "@dxos/graph": "0.8.4-main.ae835ea",
44
+ "@dxos/keys": "0.8.4-main.ae835ea",
45
+ "@dxos/live-object": "0.8.4-main.ae835ea",
46
+ "@dxos/log": "0.8.4-main.ae835ea",
47
+ "@dxos/blueprints": "0.8.4-main.ae835ea",
48
+ "@dxos/react-client": "0.8.4-main.ae835ea",
49
+ "@dxos/react-edge-client": "0.8.4-main.ae835ea",
50
+ "@dxos/react-ui-attention": "0.8.4-main.ae835ea",
51
+ "@dxos/react-ui-canvas": "0.8.4-main.ae835ea",
52
+ "@dxos/react-ui-editor": "0.8.4-main.ae835ea",
53
+ "@dxos/react-ui-form": "0.8.4-main.ae835ea",
54
+ "@dxos/react-ui-sfx": "0.8.4-main.ae835ea",
55
+ "@dxos/react-ui-syntax-highlighter": "0.8.4-main.ae835ea",
56
+ "@dxos/schema": "0.8.4-main.ae835ea",
57
+ "@dxos/react-ui-stack": "0.8.4-main.ae835ea",
58
+ "@dxos/util": "0.8.4-main.ae835ea",
59
+ "@dxos/react-ui-canvas-editor": "0.8.4-main.ae835ea"
61
60
  },
62
61
  "devDependencies": {
63
62
  "@effect/ai": "0.29.1",
64
63
  "@effect/experimental": "0.56.0",
65
64
  "@types/lodash.defaultsdeep": "^4.6.6",
66
- "@types/react": "~19.2.0",
67
- "@types/react-dom": "~19.2.0",
65
+ "@types/react": "~19.2.2",
66
+ "@types/react-dom": "~19.2.2",
68
67
  "effect": "3.18.3",
69
68
  "lodash.defaultsdeep": "^4.6.1",
70
69
  "react": "~19.2.0",
71
70
  "react-dom": "~19.2.0",
72
71
  "vite": "7.1.9",
73
- "@dxos/app-framework": "0.8.4-main.a4bbb77",
74
- "@dxos/assistant-testing": "0.8.4-main.a4bbb77",
75
- "@dxos/compute": "0.8.4-main.a4bbb77",
76
- "@dxos/random": "0.8.4-main.a4bbb77",
77
- "@dxos/react-ui": "0.8.4-main.a4bbb77",
78
- "@dxos/echo-signals": "0.8.4-main.a4bbb77",
79
- "@dxos/react-ui-theme": "0.8.4-main.a4bbb77",
80
- "@dxos/storybook-utils": "0.8.4-main.a4bbb77"
72
+ "@dxos/app-framework": "0.8.4-main.ae835ea",
73
+ "@dxos/assistant-toolkit": "0.8.4-main.ae835ea",
74
+ "@dxos/random": "0.8.4-main.ae835ea",
75
+ "@dxos/react-ui": "0.8.4-main.ae835ea",
76
+ "@dxos/compute": "0.8.4-main.ae835ea",
77
+ "@dxos/storybook-utils": "0.8.4-main.ae835ea",
78
+ "@dxos/echo-signals": "0.8.4-main.ae835ea",
79
+ "@dxos/react-ui-theme": "0.8.4-main.ae835ea"
81
80
  },
82
81
  "peerDependencies": {
83
82
  "effect": "^3.13.3",
84
83
  "react": "^19.0.0",
85
84
  "react-dom": "^19.0.0",
86
- "@dxos/react-ui": "0.8.4-main.a4bbb77",
87
- "@dxos/react-ui-theme": "0.8.4-main.a4bbb77"
85
+ "@dxos/react-ui-theme": "0.8.4-main.ae835ea",
86
+ "@dxos/react-ui": "0.8.4-main.ae835ea"
88
87
  },
89
88
  "publishConfig": {
90
89
  "access": "public"
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import { DefaultInput, DefaultOutput } from '@dxos/conductor';
6
- import { toEffectSchema } from '@dxos/echo-schema';
6
+ import { toEffectSchema } from '@dxos/echo/internal';
7
7
  import { type Anchor, ShapeLayout, type ShapeRegistry } from '@dxos/react-ui-canvas-editor';
8
8
 
9
9
  import { type ComputeGraphController } from './graph';
@@ -6,7 +6,7 @@ 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
11
  import { ServiceContainer } from '@dxos/functions';
12
12
  import { withClientProvider } from '@dxos/react-client/testing';
@@ -142,7 +142,7 @@ const DefaultStory = ({
142
142
 
143
143
  {sidebar && (
144
144
  <Container id='sidebar' classNames='flex flex-col h-full overflow-hidden'>
145
- <Toolbar.Root classNames='p-1'>
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>
@@ -2,7 +2,11 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { type Context, Effect, Either, Exit, Scope } from 'effect';
5
+ import type * as Context from 'effect/Context';
6
+ import * as Effect from 'effect/Effect';
7
+ import * as Either from 'effect/Either';
8
+ import * as Exit from 'effect/Exit';
9
+ import * as Scope from 'effect/Scope';
6
10
 
7
11
  import { Event, synchronized } from '@dxos/async';
8
12
  import {
@@ -154,7 +158,14 @@ export class ComputeGraphController extends Resource {
154
158
  /**
155
159
  * Inputs and outputs for all nodes.
156
160
  */
157
- get state() {
161
+ get state(): Record<
162
+ string,
163
+ {
164
+ node: ComputeNode;
165
+ input: Record<string, RuntimeValue>;
166
+ output: Record<string, RuntimeValue>;
167
+ }
168
+ > {
158
169
  const ids = [...new Set([...Object.keys(this._runtimeStateInputs), ...Object.keys(this._runtimeStateOutputs)])];
159
170
  return Object.fromEntries(
160
171
  ids.map((id) => [
@@ -12,7 +12,7 @@ import {
12
12
  registry,
13
13
  } from '@dxos/conductor';
14
14
  import { raise } from '@dxos/debug';
15
- import { ObjectId, toJsonSchema } from '@dxos/echo-schema';
15
+ import { ObjectId, toJsonSchema } from '@dxos/echo/internal';
16
16
  import { invariant } from '@dxos/invariant';
17
17
 
18
18
  import { type ComputeShape, type ConstantShape, type TemplateShape } from '../shapes';
@@ -2,7 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import { useCallback, useEffect, useState } from 'react';
7
7
 
8
8
  import type { ComputeMeta, ComputeNode } from '@dxos/conductor';
@@ -5,7 +5,7 @@
5
5
  import { useMemo } from 'react';
6
6
 
7
7
  import { type ComputeEdge, ComputeGraphModel, type ComputeNode, DEFAULT_INPUT, DEFAULT_OUTPUT } from '@dxos/conductor';
8
- import { ObjectId, Ref } from '@dxos/echo-schema';
8
+ import { ObjectId, Ref } from '@dxos/echo/internal';
9
9
  import { invariant } from '@dxos/invariant';
10
10
  import { getSpace } from '@dxos/react-client/echo';
11
11
  import { type CanvasGraphModel, type Connection, type GraphMonitor } from '@dxos/react-ui-canvas-editor';
package/src/json.test.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import { describe, test } from 'vitest';
7
7
 
8
8
  import { BaseGraphEdge, BaseGraphNode } from '@dxos/graph';
@@ -2,10 +2,10 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import { describe, test } from 'vitest';
7
7
 
8
- import { live } from '@dxos/client/echo';
8
+ import { live } from '@dxos/echo/internal';
9
9
  import { BaseGraphNode, Graph } from '@dxos/graph';
10
10
  import {
11
11
  Polygon,
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React from 'react';
7
7
 
8
8
  import { AppendInput } from '@dxos/conductor';
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React from 'react';
7
7
 
8
8
  import { ReducerInput, ReducerOutput } from '@dxos/conductor';
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React, { useEffect, useState } from 'react';
7
7
 
8
8
  import { Icon } from '@dxos/react-ui';
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React from 'react';
7
7
 
8
8
  import { DEFAULT_INPUT, isTruthy } from '@dxos/conductor';
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React, { type FC } from 'react';
7
7
 
8
8
  import { type ShapeDef, getAnchorPoints } from '@dxos/react-ui-canvas-editor';
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React, { useRef } from 'react';
7
7
 
8
8
  import { DEFAULT_OUTPUT } from '@dxos/conductor';
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React, { useCallback, useRef, useState } from 'react';
7
7
 
8
8
  import { ComputeValueType } from '@dxos/conductor';
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React from 'react';
7
7
 
8
8
  import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
@@ -2,12 +2,12 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React, { useCallback, useRef } from 'react';
7
7
 
8
8
  import { AnyOutput, FunctionInput } from '@dxos/conductor';
9
- import { Ref, getSnapshot, isInstanceOf } from '@dxos/echo-schema';
10
- import { FunctionType, ScriptType } from '@dxos/functions';
9
+ import { Ref, getSnapshot, isInstanceOf } from '@dxos/echo/internal';
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
  }
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React, { useEffect, useState } from 'react';
7
7
 
8
8
  import { GptInput, GptOutput } from '@dxos/conductor';
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React, { useState } from 'react';
7
7
 
8
8
  import { log } from '@dxos/log';
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React from 'react';
7
7
 
8
8
  import { DEFAULT_INPUT, DefaultOutput, JsonTransformInput } from '@dxos/conductor';
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React from 'react';
7
7
 
8
8
  import { IfElseInput, IfElseOutput, IfInput, IfOutput } from '@dxos/conductor';
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
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';
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
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';
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React from 'react';
7
7
 
8
8
  import { DEFAULT_INPUT } from '@dxos/conductor';
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React from 'react';
7
7
 
8
8
  import { Surface } from '@dxos/app-framework';
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
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';
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React from 'react';
7
7
 
8
8
  import { createInputSchema, createOutputSchema } from '@dxos/conductor';
@@ -2,11 +2,11 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
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-schema';
9
+ import { toJsonSchema } from '@dxos/echo/internal';
10
10
  import { invariant } from '@dxos/invariant';
11
11
  import {
12
12
  type ShapeComponentProps,
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React from 'react';
7
7
 
8
8
  import { DEFAULT_INPUT } from '@dxos/conductor';
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React from 'react';
7
7
 
8
8
  import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
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';
@@ -2,28 +2,13 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
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 { Filter, Obj, Query } from '@dxos/echo';
10
- import { ObjectId, Ref } from '@dxos/echo-schema';
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, Query } from '@dxos/echo';
10
+ import { ObjectId, Ref } from '@dxos/echo/internal';
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!)}
@@ -106,7 +91,7 @@ const TriggerKindSelect = ({ value, onValueChange }: Pick<SelectRootProps, 'valu
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,31 +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
- return { kind: 'subscription', query: Query.select(Filter.nothing()).ast } satisfies SubscriptionTrigger;
116
+ return {
117
+ kind: 'subscription',
118
+ query: {
119
+ ast: Query.select(Filter.nothing()).ast,
120
+ },
121
+ } satisfies Trigger.SubscriptionSpec;
132
122
  case 'email':
133
- return { kind: 'email' } satisfies EmailTrigger;
123
+ return { kind: 'email' } satisfies Trigger.EmailSpec;
134
124
  case 'queue': {
135
125
  const dxn = new DXN(DXN.kind.QUEUE, ['data', props.spaceId ?? SpaceId.random(), ObjectId.random()]).toString();
136
- return { kind: 'queue', queue: dxn } satisfies QueueTrigger;
126
+ return { kind: 'queue', queue: dxn } satisfies Trigger.QueueSpec;
137
127
  }
138
128
  }
139
129
  };
140
130
 
141
- const getOutputSchema = (kind: TriggerKind) => {
142
- const kindToSchema: Record<TriggerKind, Schema.Schema<any>> = {
143
- ['email']: EmailTriggerOutput,
144
- ['subscription']: SubscriptionTriggerOutput,
145
- ['timer']: TimerTriggerOutput,
146
- ['webhook']: WebhookTriggerOutput,
147
- ['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,
148
138
  };
149
139
  return kindToSchema[kind];
150
140
  };
@@ -2,7 +2,8 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { type Schema, SchemaAST } from 'effect';
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';