@dxos/react-ui-canvas-compute 0.7.5-labs.5f04cf6

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 (149) hide show
  1. package/LICENSE +8 -0
  2. package/README.md +1 -0
  3. package/dist/lib/browser/index.mjs +2499 -0
  4. package/dist/lib/browser/index.mjs.map +7 -0
  5. package/dist/lib/browser/meta.json +1 -0
  6. package/dist/lib/node/index.cjs +2591 -0
  7. package/dist/lib/node/index.cjs.map +7 -0
  8. package/dist/lib/node/meta.json +1 -0
  9. package/dist/lib/node-esm/index.mjs +2499 -0
  10. package/dist/lib/node-esm/index.mjs.map +7 -0
  11. package/dist/lib/node-esm/meta.json +1 -0
  12. package/dist/types/src/compute-layout.d.ts +9 -0
  13. package/dist/types/src/compute-layout.d.ts.map +1 -0
  14. package/dist/types/src/compute.stories.d.ts +28 -0
  15. package/dist/types/src/compute.stories.d.ts.map +1 -0
  16. package/dist/types/src/graph/controller.d.ts +139 -0
  17. package/dist/types/src/graph/controller.d.ts.map +1 -0
  18. package/dist/types/src/graph/index.d.ts +3 -0
  19. package/dist/types/src/graph/index.d.ts.map +1 -0
  20. package/dist/types/src/graph/node-defs.d.ts +6 -0
  21. package/dist/types/src/graph/node-defs.d.ts.map +1 -0
  22. package/dist/types/src/hooks/compute-context.d.ts +7 -0
  23. package/dist/types/src/hooks/compute-context.d.ts.map +1 -0
  24. package/dist/types/src/hooks/index.d.ts +4 -0
  25. package/dist/types/src/hooks/index.d.ts.map +1 -0
  26. package/dist/types/src/hooks/useComputeNodeState.d.ts +19 -0
  27. package/dist/types/src/hooks/useComputeNodeState.d.ts.map +1 -0
  28. package/dist/types/src/hooks/useGraphMonitor.d.ts +14 -0
  29. package/dist/types/src/hooks/useGraphMonitor.d.ts.map +1 -0
  30. package/dist/types/src/index.d.ts +6 -0
  31. package/dist/types/src/index.d.ts.map +1 -0
  32. package/dist/types/src/json.test.d.ts +21 -0
  33. package/dist/types/src/json.test.d.ts.map +1 -0
  34. package/dist/types/src/registry.d.ts +9 -0
  35. package/dist/types/src/registry.d.ts.map +1 -0
  36. package/dist/types/src/schema.test.d.ts +2 -0
  37. package/dist/types/src/schema.test.d.ts.map +1 -0
  38. package/dist/types/src/shapes/Append.d.ts +54 -0
  39. package/dist/types/src/shapes/Append.d.ts.map +1 -0
  40. package/dist/types/src/shapes/Array.d.ts +38 -0
  41. package/dist/types/src/shapes/Array.d.ts.map +1 -0
  42. package/dist/types/src/shapes/Audio.d.ts +54 -0
  43. package/dist/types/src/shapes/Audio.d.ts.map +1 -0
  44. package/dist/types/src/shapes/Beacon.d.ts +54 -0
  45. package/dist/types/src/shapes/Beacon.d.ts.map +1 -0
  46. package/dist/types/src/shapes/Boolean.d.ts +233 -0
  47. package/dist/types/src/shapes/Boolean.d.ts.map +1 -0
  48. package/dist/types/src/shapes/Chat.d.ts +57 -0
  49. package/dist/types/src/shapes/Chat.d.ts.map +1 -0
  50. package/dist/types/src/shapes/Constant.d.ts +60 -0
  51. package/dist/types/src/shapes/Constant.d.ts.map +1 -0
  52. package/dist/types/src/shapes/Database.d.ts +54 -0
  53. package/dist/types/src/shapes/Database.d.ts.map +1 -0
  54. package/dist/types/src/shapes/Function.d.ts +54 -0
  55. package/dist/types/src/shapes/Function.d.ts.map +1 -0
  56. package/dist/types/src/shapes/Gpt.d.ts +54 -0
  57. package/dist/types/src/shapes/Gpt.d.ts.map +1 -0
  58. package/dist/types/src/shapes/GptRealtime.d.ts +54 -0
  59. package/dist/types/src/shapes/GptRealtime.d.ts.map +1 -0
  60. package/dist/types/src/shapes/Json.d.ts +107 -0
  61. package/dist/types/src/shapes/Json.d.ts.map +1 -0
  62. package/dist/types/src/shapes/Logic.d.ts +109 -0
  63. package/dist/types/src/shapes/Logic.d.ts.map +1 -0
  64. package/dist/types/src/shapes/Queue.d.ts +58 -0
  65. package/dist/types/src/shapes/Queue.d.ts.map +1 -0
  66. package/dist/types/src/shapes/RNG.d.ts +58 -0
  67. package/dist/types/src/shapes/RNG.d.ts.map +1 -0
  68. package/dist/types/src/shapes/Scope.d.ts +54 -0
  69. package/dist/types/src/shapes/Scope.d.ts.map +1 -0
  70. package/dist/types/src/shapes/Surface.d.ts +54 -0
  71. package/dist/types/src/shapes/Surface.d.ts.map +1 -0
  72. package/dist/types/src/shapes/Switch.d.ts +54 -0
  73. package/dist/types/src/shapes/Switch.d.ts.map +1 -0
  74. package/dist/types/src/shapes/Table.d.ts +54 -0
  75. package/dist/types/src/shapes/Table.d.ts.map +1 -0
  76. package/dist/types/src/shapes/Template.d.ts +56 -0
  77. package/dist/types/src/shapes/Template.d.ts.map +1 -0
  78. package/dist/types/src/shapes/Text.d.ts +54 -0
  79. package/dist/types/src/shapes/Text.d.ts.map +1 -0
  80. package/dist/types/src/shapes/TextToImage.d.ts +54 -0
  81. package/dist/types/src/shapes/TextToImage.d.ts.map +1 -0
  82. package/dist/types/src/shapes/Thread.d.ts +58 -0
  83. package/dist/types/src/shapes/Thread.d.ts.map +1 -0
  84. package/dist/types/src/shapes/Trigger.d.ts +64 -0
  85. package/dist/types/src/shapes/Trigger.d.ts.map +1 -0
  86. package/dist/types/src/shapes/common/Box.d.ts +25 -0
  87. package/dist/types/src/shapes/common/Box.d.ts.map +1 -0
  88. package/dist/types/src/shapes/common/FunctionBody.d.ts +15 -0
  89. package/dist/types/src/shapes/common/FunctionBody.d.ts.map +1 -0
  90. package/dist/types/src/shapes/common/TypeSelect.d.ts +4 -0
  91. package/dist/types/src/shapes/common/TypeSelect.d.ts.map +1 -0
  92. package/dist/types/src/shapes/common/index.d.ts +4 -0
  93. package/dist/types/src/shapes/common/index.d.ts.map +1 -0
  94. package/dist/types/src/shapes/defs.d.ts +39 -0
  95. package/dist/types/src/shapes/defs.d.ts.map +1 -0
  96. package/dist/types/src/shapes/index.d.ts +27 -0
  97. package/dist/types/src/shapes/index.d.ts.map +1 -0
  98. package/dist/types/src/testing/circuits.d.ts +193 -0
  99. package/dist/types/src/testing/circuits.d.ts.map +1 -0
  100. package/dist/types/src/testing/index.d.ts +2 -0
  101. package/dist/types/src/testing/index.d.ts.map +1 -0
  102. package/dist/types/tsconfig.tsbuildinfo +1 -0
  103. package/package.json +85 -0
  104. package/src/README.md +47 -0
  105. package/src/compute-layout.ts +37 -0
  106. package/src/compute.stories.tsx +362 -0
  107. package/src/graph/controller.ts +405 -0
  108. package/src/graph/index.ts +6 -0
  109. package/src/graph/node-defs.ts +82 -0
  110. package/src/hooks/compute-context.ts +19 -0
  111. package/src/hooks/index.ts +7 -0
  112. package/src/hooks/useComputeNodeState.ts +83 -0
  113. package/src/hooks/useGraphMonitor.ts +133 -0
  114. package/src/index.ts +9 -0
  115. package/src/json.test.ts +35 -0
  116. package/src/registry.ts +100 -0
  117. package/src/schema.test.ts +62 -0
  118. package/src/shapes/Append.tsx +43 -0
  119. package/src/shapes/Array.tsx +61 -0
  120. package/src/shapes/Audio.tsx +55 -0
  121. package/src/shapes/Beacon.tsx +56 -0
  122. package/src/shapes/Boolean.tsx +215 -0
  123. package/src/shapes/Chat.tsx +77 -0
  124. package/src/shapes/Constant.tsx +125 -0
  125. package/src/shapes/Database.tsx +39 -0
  126. package/src/shapes/Function.tsx +40 -0
  127. package/src/shapes/Gpt.tsx +91 -0
  128. package/src/shapes/GptRealtime.tsx +168 -0
  129. package/src/shapes/Json.tsx +103 -0
  130. package/src/shapes/Logic.tsx +82 -0
  131. package/src/shapes/Queue.tsx +78 -0
  132. package/src/shapes/RNG.tsx +84 -0
  133. package/src/shapes/Scope.tsx +54 -0
  134. package/src/shapes/Surface.tsx +57 -0
  135. package/src/shapes/Switch.tsx +53 -0
  136. package/src/shapes/Table.tsx +45 -0
  137. package/src/shapes/Template.tsx +98 -0
  138. package/src/shapes/Text.tsx +56 -0
  139. package/src/shapes/TextToImage.tsx +39 -0
  140. package/src/shapes/Thread.tsx +87 -0
  141. package/src/shapes/Trigger.tsx +152 -0
  142. package/src/shapes/common/Box.tsx +74 -0
  143. package/src/shapes/common/FunctionBody.tsx +122 -0
  144. package/src/shapes/common/TypeSelect.tsx +27 -0
  145. package/src/shapes/common/index.ts +7 -0
  146. package/src/shapes/defs.ts +50 -0
  147. package/src/shapes/index.ts +31 -0
  148. package/src/testing/circuits.ts +320 -0
  149. package/src/testing/index.ts +5 -0
@@ -0,0 +1,2591 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var node_exports = {};
30
+ __export(node_exports, {
31
+ AndShape: () => AndShape,
32
+ AppendComponent: () => AppendComponent,
33
+ AppendShape: () => AppendShape,
34
+ AudioComponent: () => AudioComponent,
35
+ AudioShape: () => AudioShape,
36
+ BeaconComponent: () => BeaconComponent,
37
+ BeaconShape: () => BeaconShape,
38
+ Box: () => Box,
39
+ ChatShape: () => ChatShape,
40
+ ComputeContext: () => ComputeContext,
41
+ ComputeGraphController: () => ComputeGraphController,
42
+ ComputeShape: () => ComputeShape,
43
+ ComputeShapeLayout: () => ComputeShapeLayout,
44
+ ConstantComponent: () => ConstantComponent,
45
+ ConstantShape: () => ConstantShape,
46
+ DatabaseComponent: () => DatabaseComponent,
47
+ DatabaseShape: () => DatabaseShape,
48
+ FunctionBody: () => FunctionBody,
49
+ FunctionComponent: () => FunctionComponent,
50
+ FunctionShape: () => FunctionShape,
51
+ GptComponent: () => GptComponent,
52
+ GptRealtimeComponent: () => GptRealtimeComponent,
53
+ GptRealtimeShape: () => GptRealtimeShape,
54
+ GptShape: () => GptShape,
55
+ IfComponent: () => IfComponent,
56
+ IfElseComponent: () => IfElseComponent,
57
+ IfElseShape: () => IfElseShape,
58
+ IfShape: () => IfShape,
59
+ InvalidStateError: () => InvalidStateError,
60
+ JsonComponent: () => JsonComponent,
61
+ JsonShape: () => JsonShape,
62
+ JsonTransformComponent: () => JsonTransformComponent,
63
+ JsonTransformShape: () => JsonTransformShape,
64
+ NotShape: () => NotShape,
65
+ OrShape: () => OrShape,
66
+ QueueComponent: () => QueueComponent,
67
+ QueueItem: () => QueueItem,
68
+ QueueShape: () => QueueShape,
69
+ RandomComponent: () => RandomComponent,
70
+ RandomShape: () => RandomShape,
71
+ ReducerComponent: () => ReducerComponent,
72
+ ReducerShape: () => ReducerShape,
73
+ ScopeComponent: () => ScopeComponent,
74
+ ScopeShape: () => ScopeShape,
75
+ SurfaceComponent: () => SurfaceComponent,
76
+ SurfaceShape: () => SurfaceShape,
77
+ SwitchComponent: () => SwitchComponent,
78
+ SwitchShape: () => SwitchShape,
79
+ TableComponent: () => TableComponent,
80
+ TableShape: () => TableShape,
81
+ TemplateShape: () => TemplateShape,
82
+ TextComponent: () => TextComponent,
83
+ TextInputComponent: () => TextInputComponent,
84
+ TextShape: () => TextShape,
85
+ TextToImageComponent: () => TextToImageComponent,
86
+ TextToImageShape: () => TextToImageShape,
87
+ ThreadComponent: () => ThreadComponent,
88
+ ThreadItem: () => ThreadItem,
89
+ ThreadShape: () => ThreadShape,
90
+ TriggerComponent: () => TriggerComponent,
91
+ TriggerShape: () => TriggerShape,
92
+ TypeSelect: () => TypeSelect,
93
+ andShape: () => andShape,
94
+ appendShape: () => appendShape,
95
+ audioShape: () => audioShape,
96
+ beaconShape: () => beaconShape,
97
+ chatShape: () => chatShape,
98
+ computeShapes: () => computeShapes,
99
+ constantShape: () => constantShape,
100
+ createAnchorId: () => createAnchorId,
101
+ createAnd: () => createAnd,
102
+ createAppend: () => createAppend,
103
+ createAudio: () => createAudio,
104
+ createBeacon: () => createBeacon,
105
+ createChat: () => createChat,
106
+ createComputeGraph: () => createComputeGraph,
107
+ createComputeGraphController: () => createComputeGraphController,
108
+ createComputeNode: () => createComputeNode,
109
+ createConstant: () => createConstant,
110
+ createDatabase: () => createDatabase,
111
+ createFunction: () => createFunction,
112
+ createFunctionAnchors: () => createFunctionAnchors,
113
+ createGpt: () => createGpt,
114
+ createGptRealtime: () => createGptRealtime,
115
+ createIf: () => createIf,
116
+ createIfElse: () => createIfElse,
117
+ createJson: () => createJson,
118
+ createJsonTransform: () => createJsonTransform,
119
+ createNot: () => createNot,
120
+ createOr: () => createOr,
121
+ createQueue: () => createQueue,
122
+ createRandom: () => createRandom,
123
+ createReducer: () => createReducer,
124
+ createScope: () => createScope,
125
+ createShape: () => createShape,
126
+ createSurface: () => createSurface,
127
+ createSwitch: () => createSwitch,
128
+ createTable: () => createTable,
129
+ createTemplate: () => createTemplate,
130
+ createText: () => createText,
131
+ createTextToImage: () => createTextToImage,
132
+ createThread: () => createThread,
133
+ createTrigger: () => createTrigger,
134
+ databaseShape: () => databaseShape,
135
+ footerHeight: () => footerHeight,
136
+ functionShape: () => functionShape,
137
+ getHeight: () => getHeight,
138
+ getProperties: () => getProperties,
139
+ gptRealtimeShape: () => gptRealtimeShape,
140
+ gptShape: () => gptShape,
141
+ headerHeight: () => headerHeight,
142
+ ifElseShape: () => ifElseShape,
143
+ ifShape: () => ifShape,
144
+ isValidComputeNode: () => isValidComputeNode,
145
+ jsonShape: () => jsonShape,
146
+ jsonTransformShape: () => jsonTransformShape,
147
+ mapEdge: () => mapEdge,
148
+ notShape: () => notShape,
149
+ orShape: () => orShape,
150
+ parseAnchorId: () => parseAnchorId,
151
+ queueShape: () => queueShape,
152
+ randomShape: () => randomShape,
153
+ reducerShape: () => reducerShape,
154
+ resolveComputeNode: () => resolveComputeNode,
155
+ scopeShape: () => scopeShape,
156
+ surfaceShape: () => surfaceShape,
157
+ switchShape: () => switchShape,
158
+ tableShape: () => tableShape,
159
+ templateShape: () => templateShape,
160
+ textShape: () => textShape,
161
+ textToImageShape: () => textToImageShape,
162
+ threadShape: () => threadShape,
163
+ triggerShape: () => triggerShape,
164
+ useComputeContext: () => useComputeContext,
165
+ useComputeNodeState: () => useComputeNodeState,
166
+ useGraphMonitor: () => useGraphMonitor
167
+ });
168
+ module.exports = __toCommonJS(node_exports);
169
+ var import_effect = require("effect");
170
+ var import_async = require("@dxos/async");
171
+ var import_conductor = require("@dxos/conductor");
172
+ var import_context = require("@dxos/context");
173
+ var import_log = require("@dxos/log");
174
+ var import_conductor2 = require("@dxos/conductor");
175
+ var import_debug = require("@dxos/debug");
176
+ var import_echo_schema = require("@dxos/echo-schema");
177
+ var import_invariant = require("@dxos/invariant");
178
+ var import_react = require("react");
179
+ var import_debug2 = require("@dxos/debug");
180
+ var import_react2 = require("react");
181
+ var import_echo_schema2 = require("@dxos/echo-schema");
182
+ var import_invariant2 = require("@dxos/invariant");
183
+ var import_react3 = require("react");
184
+ var import_conductor3 = require("@dxos/conductor");
185
+ var import_echo_schema3 = require("@dxos/echo-schema");
186
+ var import_invariant3 = require("@dxos/invariant");
187
+ var import_keys = require("@dxos/keys");
188
+ var import_echo = require("@dxos/react-client/echo");
189
+ var import_util = require("@dxos/util");
190
+ var import_react_ui_canvas_editor = require("@dxos/react-ui-canvas-editor");
191
+ var import_react4 = __toESM(require("react"));
192
+ var import_invariant4 = require("@dxos/invariant");
193
+ var import_react_ui = require("@dxos/react-ui");
194
+ var import_react_ui_canvas_editor2 = require("@dxos/react-ui-canvas-editor");
195
+ var import_react_ui_theme = require("@dxos/react-ui-theme");
196
+ var import_react5 = __toESM(require("react"));
197
+ var import_conductor4 = require("@dxos/conductor");
198
+ var import_echo_schema4 = require("@dxos/echo-schema");
199
+ var import_react_ui_canvas = require("@dxos/react-ui-canvas");
200
+ var import_react_ui_canvas_editor3 = require("@dxos/react-ui-canvas-editor");
201
+ var import_schema = require("@effect/schema");
202
+ var import_conductor5 = require("@dxos/conductor");
203
+ var import_echo_schema5 = require("@dxos/echo-schema");
204
+ var import_react_ui_canvas_editor4 = require("@dxos/react-ui-canvas-editor");
205
+ var import_react6 = __toESM(require("react"));
206
+ var import_react_ui2 = require("@dxos/react-ui");
207
+ var import_conductor6 = require("@dxos/conductor");
208
+ var import_react7 = __toESM(require("react"));
209
+ var import_conductor7 = require("@dxos/conductor");
210
+ var import_echo_schema6 = require("@dxos/echo-schema");
211
+ var import_react8 = __toESM(require("react"));
212
+ var import_conductor8 = require("@dxos/conductor");
213
+ var import_echo_schema7 = require("@dxos/echo-schema");
214
+ var import_react9 = __toESM(require("react"));
215
+ var import_echo_schema8 = require("@dxos/echo-schema");
216
+ var import_react_ui3 = require("@dxos/react-ui");
217
+ var import_react_ui_canvas_editor5 = require("@dxos/react-ui-canvas-editor");
218
+ var import_react10 = __toESM(require("react"));
219
+ var import_conductor9 = require("@dxos/conductor");
220
+ var import_echo_schema9 = require("@dxos/echo-schema");
221
+ var import_react_ui4 = require("@dxos/react-ui");
222
+ var import_react_ui_canvas_editor6 = require("@dxos/react-ui-canvas-editor");
223
+ var import_react_ui_theme2 = require("@dxos/react-ui-theme");
224
+ var import_react11 = __toESM(require("react"));
225
+ var import_echo_schema10 = require("@dxos/echo-schema");
226
+ var import_react_ui_canvas_editor7 = require("@dxos/react-ui-canvas-editor");
227
+ var import_react12 = __toESM(require("react"));
228
+ var import_conductor10 = require("@dxos/conductor");
229
+ var import_echo_schema11 = require("@dxos/echo-schema");
230
+ var import_react_ui_canvas_editor8 = require("@dxos/react-ui-canvas-editor");
231
+ var import_react_ui_canvas_editor9 = require("@dxos/react-ui-canvas-editor");
232
+ var import_react13 = __toESM(require("react"));
233
+ var import_conductor11 = require("@dxos/conductor");
234
+ var import_echo_schema12 = require("@dxos/echo-schema");
235
+ var import_react_ui5 = require("@dxos/react-ui");
236
+ var import_react_ui_canvas_editor10 = require("@dxos/react-ui-canvas-editor");
237
+ var import_react_ui_canvas_editor11 = require("@dxos/react-ui-canvas-editor");
238
+ var import_util2 = require("@dxos/util");
239
+ var import_react14 = __toESM(require("react"));
240
+ var import_echo_schema13 = require("@dxos/echo-schema");
241
+ var import_react_ui_canvas_editor12 = require("@dxos/react-ui-canvas-editor");
242
+ var import_react15 = __toESM(require("react"));
243
+ var import_conductor12 = require("@dxos/conductor");
244
+ var import_echo_schema14 = require("@dxos/echo-schema");
245
+ var import_react16 = __toESM(require("react"));
246
+ var import_conductor13 = require("@dxos/conductor");
247
+ var import_echo_schema15 = require("@dxos/echo-schema");
248
+ var import_react17 = __toESM(require("react"));
249
+ var import_conductor14 = require("@dxos/conductor");
250
+ var import_echo_schema16 = require("@dxos/echo-schema");
251
+ var import_react_ui_canvas_editor13 = require("@dxos/react-ui-canvas-editor");
252
+ var import_react_ui_syntax_highlighter = require("@dxos/react-ui-syntax-highlighter");
253
+ var import_react18 = __toESM(require("react"));
254
+ var import_conductor15 = require("@dxos/conductor");
255
+ var import_echo_schema17 = require("@dxos/echo-schema");
256
+ var import_react19 = __toESM(require("react"));
257
+ var import_conductor16 = require("@dxos/conductor");
258
+ var import_echo_schema18 = require("@dxos/echo-schema");
259
+ var import_react_ui_theme3 = require("@dxos/react-ui-theme");
260
+ var import_react20 = __toESM(require("react"));
261
+ var import_conductor17 = require("@dxos/conductor");
262
+ var import_echo_schema19 = require("@dxos/echo-schema");
263
+ var import_react_ui6 = require("@dxos/react-ui");
264
+ var import_react_ui_canvas_editor14 = require("@dxos/react-ui-canvas-editor");
265
+ var import_react_ui_theme4 = require("@dxos/react-ui-theme");
266
+ var import_react21 = __toESM(require("react"));
267
+ var import_conductor18 = require("@dxos/conductor");
268
+ var import_echo_schema20 = require("@dxos/echo-schema");
269
+ var import_react_ui_canvas_editor15 = require("@dxos/react-ui-canvas-editor");
270
+ var import_react_ui_sfx = require("@dxos/react-ui-sfx");
271
+ var import_react22 = __toESM(require("react"));
272
+ var import_app_framework = require("@dxos/app-framework");
273
+ var import_conductor19 = require("@dxos/conductor");
274
+ var import_echo_schema21 = require("@dxos/echo-schema");
275
+ var import_react_ui_canvas_editor16 = require("@dxos/react-ui-canvas-editor");
276
+ var import_react23 = __toESM(require("react"));
277
+ var import_conductor20 = require("@dxos/conductor");
278
+ var import_echo_schema22 = require("@dxos/echo-schema");
279
+ var import_react_ui7 = require("@dxos/react-ui");
280
+ var import_react_ui_canvas_editor17 = require("@dxos/react-ui-canvas-editor");
281
+ var import_react24 = __toESM(require("react"));
282
+ var import_conductor21 = require("@dxos/conductor");
283
+ var import_echo_schema23 = require("@dxos/echo-schema");
284
+ var import_react25 = __toESM(require("react"));
285
+ var import_conductor22 = require("@dxos/conductor");
286
+ var import_echo_schema24 = require("@dxos/echo-schema");
287
+ var import_invariant5 = require("@dxos/invariant");
288
+ var import_react_ui_canvas_editor18 = require("@dxos/react-ui-canvas-editor");
289
+ var import_react26 = __toESM(require("react"));
290
+ var import_conductor23 = require("@dxos/conductor");
291
+ var import_echo_schema25 = require("@dxos/echo-schema");
292
+ var import_react_ui_canvas_editor19 = require("@dxos/react-ui-canvas-editor");
293
+ var import_react_ui_canvas_editor20 = require("@dxos/react-ui-canvas-editor");
294
+ var import_react27 = __toESM(require("react"));
295
+ var import_conductor24 = require("@dxos/conductor");
296
+ var import_echo_schema26 = require("@dxos/echo-schema");
297
+ var import_react_ui_theme5 = require("@dxos/react-ui-theme");
298
+ var import_react28 = __toESM(require("react"));
299
+ var import_echo_schema27 = require("@dxos/echo-schema");
300
+ var import_react_ui_canvas_editor21 = require("@dxos/react-ui-canvas-editor");
301
+ var import_react29 = __toESM(require("react"));
302
+ var import_conductor25 = require("@dxos/conductor");
303
+ var import_echo_schema28 = require("@dxos/echo-schema");
304
+ var import_functions = require("@dxos/functions");
305
+ var import_echo2 = require("@dxos/react-client/echo");
306
+ var import_react_ui8 = require("@dxos/react-ui");
307
+ var import_react30 = __toESM(require("react"));
308
+ var import_echo_schema29 = require("@dxos/echo-schema");
309
+ var import_react_ui9 = require("@dxos/react-ui");
310
+ var import_conductor26 = require("@dxos/conductor");
311
+ var import_echo_schema30 = require("@dxos/echo-schema");
312
+ var import_react_ui_canvas_editor22 = require("@dxos/react-ui-canvas-editor");
313
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/ui/react-ui-canvas-compute/src/graph/node-defs.ts";
314
+ var resolveComputeNode = async (node) => {
315
+ const impl = import_conductor2.registry[node.type];
316
+ (0, import_invariant.invariant)(impl, `Unknown node type: ${node.type}`, {
317
+ F: __dxlog_file,
318
+ L: 22,
319
+ S: void 0,
320
+ A: [
321
+ "impl",
322
+ "`Unknown node type: ${node.type}`"
323
+ ]
324
+ });
325
+ return impl;
326
+ };
327
+ var isValidComputeNode = (type) => {
328
+ return nodeFactory[type] !== void 0;
329
+ };
330
+ var createComputeNode = (shape) => {
331
+ const type = shape.type ?? (0, import_debug.raise)(new Error("Type not specified"));
332
+ const factory = nodeFactory[type] ?? (0, import_debug.raise)(new Error(`Unknown shape type: ${type}`));
333
+ return factory(shape);
334
+ };
335
+ var nodeFactory = {
336
+ // System.
337
+ [import_conductor2.NODE_INPUT]: () => createNode(import_conductor2.NODE_INPUT),
338
+ [import_conductor2.NODE_OUTPUT]: () => createNode(import_conductor2.NODE_OUTPUT),
339
+ // Extensions.
340
+ ["text-to-image"]: () => createNode("text-to-image"),
341
+ ["and"]: () => createNode("and"),
342
+ ["append"]: () => createNode("append"),
343
+ ["audio"]: () => createNode("audio"),
344
+ ["beacon"]: () => createNode("beacon"),
345
+ ["chat"]: () => createNode("chat"),
346
+ ["constant"]: (shape) => createNode("constant", {
347
+ value: shape.value
348
+ }),
349
+ ["database"]: () => createNode("database"),
350
+ ["gpt"]: () => createNode("gpt"),
351
+ ["gpt-realtime"]: () => createNode("gpt-realtime"),
352
+ ["if"]: () => createNode("if"),
353
+ ["if-else"]: () => createNode("if-else"),
354
+ ["function"]: () => createNode("function"),
355
+ ["json"]: () => createNode("json"),
356
+ ["json-transform"]: () => createNode("json-transform"),
357
+ ["not"]: () => createNode("not"),
358
+ ["or"]: () => createNode("or"),
359
+ ["queue"]: () => createNode("queue"),
360
+ ["rng"]: () => createNode("rng"),
361
+ ["reducer"]: () => createNode("reducer"),
362
+ ["scope"]: () => createNode("scope"),
363
+ ["surface"]: () => createNode("surface"),
364
+ ["switch"]: () => createNode("switch"),
365
+ ["template"]: (shape) => {
366
+ const node = createNode("template", {
367
+ valueType: shape.valueType,
368
+ value: shape.text
369
+ });
370
+ node.inputSchema = (0, import_echo_schema.toJsonSchema)((0, import_conductor2.getTemplateInputSchema)(node));
371
+ return node;
372
+ },
373
+ ["text"]: () => createNode("text"),
374
+ ["thread"]: () => createNode("thread"),
375
+ ["trigger"]: () => createNode(import_conductor2.NODE_INPUT)
376
+ };
377
+ var createNode = (type, props) => ({
378
+ id: import_echo_schema.ObjectId.random(),
379
+ type,
380
+ ...props
381
+ });
382
+ var ComputeContext = (0, import_react.createContext)(null);
383
+ var useComputeContext = () => {
384
+ return (0, import_react.useContext)(ComputeContext) ?? (0, import_debug2.raise)(new Error("Missing ComputeContext"));
385
+ };
386
+ var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-canvas-compute/src/hooks/useComputeNodeState.ts";
387
+ var useComputeNodeState = (shape) => {
388
+ const { controller } = useComputeContext();
389
+ (0, import_invariant2.invariant)(controller, void 0, {
390
+ F: __dxlog_file2,
391
+ L: 32,
392
+ S: void 0,
393
+ A: [
394
+ "controller",
395
+ ""
396
+ ]
397
+ });
398
+ const [meta, setMeta] = (0, import_react2.useState)();
399
+ (0, import_react2.useEffect)(() => {
400
+ let disposed = false;
401
+ queueMicrotask(async () => {
402
+ (0, import_invariant2.invariant)(shape.node, "Node not specified", {
403
+ F: __dxlog_file2,
404
+ L: 38,
405
+ S: void 0,
406
+ A: [
407
+ "shape.node",
408
+ "'Node not specified'"
409
+ ]
410
+ });
411
+ const node = controller.getComputeNode(shape.node);
412
+ const meta2 = await controller.getMeta(node);
413
+ if (disposed) {
414
+ return;
415
+ }
416
+ setMeta(meta2);
417
+ });
418
+ return () => {
419
+ disposed = true;
420
+ };
421
+ }, [
422
+ shape.node
423
+ ]);
424
+ const evalNode = (0, import_react2.useCallback)(() => {
425
+ return controller.evalNode(shape.node);
426
+ }, [
427
+ shape.node
428
+ ]);
429
+ const subscribeToEventLog = (0, import_react2.useCallback)((cb) => {
430
+ return controller.events.on((ev) => {
431
+ if (ev.nodeId === shape.node) {
432
+ cb(ev);
433
+ }
434
+ });
435
+ }, [
436
+ shape.node
437
+ ]);
438
+ return {
439
+ node: controller.getComputeNode(shape.node),
440
+ meta: meta ?? {
441
+ input: import_echo_schema2.S.Struct({}),
442
+ output: import_echo_schema2.S.Struct({})
443
+ },
444
+ runtime: {
445
+ inputs: controller.getInputs(shape.node),
446
+ outputs: controller.getOutputs(shape.node),
447
+ setOutput: (property, value) => {
448
+ controller.setOutput(shape.node, property, value);
449
+ },
450
+ evalNode,
451
+ subscribeToEventLog
452
+ }
453
+ };
454
+ };
455
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-canvas-compute/src/hooks/useGraphMonitor.ts";
456
+ var mapEdge = (graph, { source, target, output = import_conductor3.DEFAULT_OUTPUT, input = import_conductor3.DEFAULT_INPUT }) => {
457
+ const sourceNode = graph.findNode(source);
458
+ const targetNode = graph.findNode(target);
459
+ (0, import_invariant3.invariant)(sourceNode?.node, void 0, {
460
+ F: __dxlog_file3,
461
+ L: 27,
462
+ S: void 0,
463
+ A: [
464
+ "sourceNode?.node",
465
+ ""
466
+ ]
467
+ });
468
+ (0, import_invariant3.invariant)(targetNode?.node, void 0, {
469
+ F: __dxlog_file3,
470
+ L: 28,
471
+ S: void 0,
472
+ A: [
473
+ "targetNode?.node",
474
+ ""
475
+ ]
476
+ });
477
+ return {
478
+ id: import_echo_schema3.ObjectId.random(),
479
+ source: sourceNode.node,
480
+ target: targetNode.node,
481
+ output,
482
+ input
483
+ };
484
+ };
485
+ var useGraphMonitor = (model) => {
486
+ return (0, import_react3.useMemo)(() => {
487
+ return {
488
+ onCreate: ({ node }) => {
489
+ if (!model) {
490
+ return;
491
+ }
492
+ (0, import_invariant3.invariant)(node.type, void 0, {
493
+ F: __dxlog_file3,
494
+ L: 53,
495
+ S: void 0,
496
+ A: [
497
+ "node.type",
498
+ ""
499
+ ]
500
+ });
501
+ if (!isValidComputeNode(node.type)) {
502
+ return;
503
+ }
504
+ const computeNode = createComputeNode(node);
505
+ if (node.type === "trigger") {
506
+ linkTriggerToCompute(model, computeNode, node);
507
+ }
508
+ model.addNode(computeNode);
509
+ node.node = computeNode.id;
510
+ },
511
+ onLink: ({ graph, edge }) => {
512
+ if (model) {
513
+ model.addEdge(mapEdge(graph, edge));
514
+ }
515
+ },
516
+ onDelete: ({ subgraph }) => {
517
+ if (model) {
518
+ const nodeIds = subgraph.nodes.map((shape) => shape.node);
519
+ const edgeIds = subgraph.edges.map(({ source, target, output = import_conductor3.DEFAULT_OUTPUT, input = import_conductor3.DEFAULT_INPUT }) => {
520
+ return model.edges.find((computeEdge) => computeEdge.input === input && computeEdge.output === output)?.id;
521
+ }).filter(import_util.nonNullable);
522
+ model.removeNodes(nodeIds);
523
+ model.removeEdges(edgeIds);
524
+ deleteTriggerObjects(model, subgraph);
525
+ }
526
+ }
527
+ };
528
+ }, [
529
+ model
530
+ ]);
531
+ };
532
+ var createComputeGraph = (graph) => {
533
+ const computeGraph = import_conductor3.ComputeGraphModel.create();
534
+ if (graph) {
535
+ for (const shape of graph.nodes) {
536
+ if (isValidComputeNode(shape.type)) {
537
+ const node = createComputeNode(shape);
538
+ computeGraph.addNode(node);
539
+ shape.node = node.id;
540
+ }
541
+ }
542
+ for (const edge of graph.edges) {
543
+ computeGraph.addEdge(mapEdge(graph, edge));
544
+ }
545
+ }
546
+ return computeGraph;
547
+ };
548
+ var linkTriggerToCompute = (graph, computeNode, triggerData) => {
549
+ const functionTrigger = triggerData.functionTrigger?.target;
550
+ (0, import_invariant3.invariant)(functionTrigger, void 0, {
551
+ F: __dxlog_file3,
552
+ L: 116,
553
+ S: void 0,
554
+ A: [
555
+ "functionTrigger",
556
+ ""
557
+ ]
558
+ });
559
+ functionTrigger.function = import_keys.DXN.fromLocalObjectId(graph.root.id).toString();
560
+ functionTrigger.meta ??= {};
561
+ functionTrigger.meta.computeNodeId = computeNode.id;
562
+ };
563
+ var deleteTriggerObjects = (computeGraph, deleted) => {
564
+ const space = (0, import_echo.getSpace)(computeGraph.root);
565
+ if (!space) {
566
+ return;
567
+ }
568
+ for (const node of deleted.nodes) {
569
+ if (node.type === "trigger") {
570
+ const trigger = node;
571
+ space.db.remove(trigger.functionTrigger.target);
572
+ }
573
+ }
574
+ };
575
+ function _ts_decorate(decorators, target, key, desc) {
576
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
577
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
578
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
579
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
580
+ }
581
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-canvas-compute/src/graph/controller.ts";
582
+ var InvalidStateError = Error;
583
+ var AUTO_TRIGGER_NODES = [
584
+ "chat",
585
+ "switch",
586
+ "constant"
587
+ ];
588
+ var createComputeGraphController = (graph, services) => {
589
+ const computeGraph = createComputeGraph(graph);
590
+ const controller = new ComputeGraphController(computeGraph);
591
+ controller.setServices(services ?? {});
592
+ return {
593
+ controller,
594
+ graph
595
+ };
596
+ };
597
+ var ComputeGraphController = class extends import_context.Resource {
598
+ constructor(_graph) {
599
+ super();
600
+ this._graph = _graph;
601
+ this._executor = new import_conductor.GraphExecutor({
602
+ computeNodeResolver: (node) => resolveComputeNode(node)
603
+ });
604
+ this._services = {};
605
+ this._forcedOutputs = {};
606
+ this._runtimeStateInputs = {};
607
+ this._runtimeStateOutputs = {};
608
+ this.update = new import_async.Event();
609
+ this.output = new import_async.Event();
610
+ this.events = new import_async.Event();
611
+ }
612
+ toJSON() {
613
+ return {
614
+ graph: this._graph,
615
+ state: {
616
+ inputs: this._runtimeStateInputs,
617
+ outputs: this._runtimeStateOutputs
618
+ },
619
+ forcedOutputs: this._forcedOutputs
620
+ };
621
+ }
622
+ setServices(services) {
623
+ Object.assign(this._services, services);
624
+ }
625
+ get graph() {
626
+ return this._graph;
627
+ }
628
+ get userState() {
629
+ return this._forcedOutputs;
630
+ }
631
+ get inputStates() {
632
+ return this._runtimeStateInputs;
633
+ }
634
+ get outputStates() {
635
+ return this._runtimeStateOutputs;
636
+ }
637
+ /**
638
+ * Inputs and outputs for all nodes.
639
+ */
640
+ get state() {
641
+ const ids = [
642
+ .../* @__PURE__ */ new Set([
643
+ ...Object.keys(this._runtimeStateInputs),
644
+ ...Object.keys(this._runtimeStateOutputs)
645
+ ])
646
+ ];
647
+ return Object.fromEntries(ids.map((id) => [
648
+ id,
649
+ {
650
+ node: this._graph.getNode(id),
651
+ input: this._runtimeStateInputs[id],
652
+ output: this._runtimeStateOutputs[id]
653
+ }
654
+ ]));
655
+ }
656
+ addNode(node) {
657
+ this._graph.addNode(node);
658
+ }
659
+ addEdge(edge) {
660
+ this._graph.addEdge(edge);
661
+ }
662
+ getComputeNode(nodeId) {
663
+ return this._graph.getNode(nodeId);
664
+ }
665
+ getInputs(nodeId) {
666
+ return this._runtimeStateInputs[nodeId] ?? {};
667
+ }
668
+ getOutputs(nodeId) {
669
+ return this._runtimeStateOutputs[nodeId] ?? {};
670
+ }
671
+ setOutput(nodeId, property, value) {
672
+ this._forcedOutputs[nodeId] ??= {};
673
+ this._forcedOutputs[nodeId][property] = value;
674
+ queueMicrotask(async () => {
675
+ try {
676
+ await this.exec(nodeId);
677
+ } catch (err) {
678
+ import_log.log.catch(err, void 0, {
679
+ F: __dxlog_file4,
680
+ L: 208,
681
+ S: this,
682
+ C: (f, a) => f(...a)
683
+ });
684
+ }
685
+ });
686
+ }
687
+ async getMeta(node) {
688
+ const { meta } = await resolveComputeNode(node);
689
+ return meta;
690
+ }
691
+ async evalNode(nodeId) {
692
+ const executor = this._executor.clone();
693
+ await executor.load(this._graph);
694
+ for (const [nodeId2, outputs] of Object.entries(this._forcedOutputs)) {
695
+ executor.setOutputs(nodeId2, import_effect.Effect.succeed((0, import_conductor.makeValueBag)(outputs)));
696
+ }
697
+ const services = this._createServiceLayer();
698
+ await import_effect.Effect.runPromise(import_effect.Effect.gen(this, function* () {
699
+ const scope = yield* import_effect.Scope.make();
700
+ const executable = yield* import_effect.Effect.promise(() => resolveComputeNode(this._graph.getNode(nodeId)));
701
+ const computingOutputs = executable.exec != null;
702
+ const effect = (computingOutputs ? executor.computeOutputs(nodeId) : executor.computeInputs(nodeId)).pipe(import_effect.Effect.withSpan("runGraph"), import_effect.Effect.provide(services), import_effect.Scope.extend(scope), import_effect.Effect.flatMap(computeValueBag), import_effect.Effect.withSpan("test"), import_effect.Effect.tap((values) => {
703
+ for (const [key, value] of Object.entries(values)) {
704
+ if (computingOutputs) {
705
+ this._onOutputComputed(nodeId, key, value);
706
+ } else {
707
+ this._onInputComputed(nodeId, key, value);
708
+ }
709
+ }
710
+ }));
711
+ yield* effect;
712
+ yield* import_effect.Scope.close(scope, import_effect.Exit.void);
713
+ }));
714
+ this.update.emit();
715
+ }
716
+ /**
717
+ * Executes the graph.
718
+ * @param startFromNode - Node to start from, otherwise all {@link AUTO_TRIGGER_NODES} are executed.
719
+ */
720
+ async exec(startFromNode) {
721
+ this._runtimeStateInputs = {};
722
+ this._runtimeStateOutputs = {};
723
+ const executor = this._executor.clone();
724
+ await executor.load(this._graph);
725
+ for (const [nodeId, outputs] of Object.entries(this._forcedOutputs)) {
726
+ executor.setOutputs(nodeId, import_effect.Effect.succeed((0, import_conductor.makeValueBag)(outputs)));
727
+ }
728
+ const triggerNodes = startFromNode != null ? [
729
+ this._graph.getNode(startFromNode)
730
+ ] : this._graph.nodes.filter((node) => node.type != null && AUTO_TRIGGER_NODES.includes(node.type));
731
+ const allAffectedNodes = [
732
+ ...new Set(triggerNodes.flatMap((node) => executor.getAllDependantNodes(node.id)))
733
+ ];
734
+ const services = this._createServiceLayer();
735
+ await import_effect.Effect.runPromise(import_effect.Effect.gen(this, function* () {
736
+ const scope = yield* import_effect.Scope.make();
737
+ const tasks = [];
738
+ for (const node of allAffectedNodes) {
739
+ const executable = yield* import_effect.Effect.promise(() => resolveComputeNode(this._graph.getNode(node)));
740
+ const computingOutputs = executable.exec != null;
741
+ const effect = (computingOutputs ? executor.computeOutputs(node) : executor.computeInputs(node)).pipe(import_effect.Effect.withSpan("runGraph"), import_effect.Effect.provide(services), import_effect.Scope.extend(scope), import_effect.Effect.flatMap(computeValueBag), import_effect.Effect.withSpan("test"), import_effect.Effect.tap((values) => {
742
+ for (const [key, value] of Object.entries(values)) {
743
+ if (computingOutputs) {
744
+ this._onOutputComputed(node, key, value);
745
+ } else {
746
+ this._onInputComputed(node, key, value);
747
+ }
748
+ }
749
+ }));
750
+ tasks.push(effect);
751
+ }
752
+ yield* import_effect.Effect.all(tasks);
753
+ yield* import_effect.Scope.close(scope, import_effect.Exit.void);
754
+ }));
755
+ this.update.emit();
756
+ }
757
+ _createServiceLayer() {
758
+ const services = {
759
+ ...DEFAULT_SERVICES,
760
+ ...this._services
761
+ };
762
+ const logLayer = import_effect.Layer.succeed(import_conductor.EventLogger, this._createLogger());
763
+ const gptLayer = import_effect.Layer.succeed(import_conductor.GptService, services.gpt);
764
+ const queueLayer = services.edgeHttpClient != null ? import_conductor.QueueService.fromClient(services.edgeHttpClient) : import_conductor.QueueService.notAvailable;
765
+ const spaceLayer = services.spaceService != null ? import_effect.Layer.succeed(import_conductor.SpaceService, services.spaceService) : import_conductor.SpaceService.empty;
766
+ return import_effect.Layer.mergeAll(logLayer, gptLayer, queueLayer, spaceLayer);
767
+ }
768
+ _createLogger() {
769
+ return {
770
+ log: (event) => {
771
+ this._handleEvent(event);
772
+ },
773
+ nodeId: void 0
774
+ };
775
+ }
776
+ _handleEvent(event) {
777
+ (0, import_log.log)("handleEvent", {
778
+ event
779
+ }, {
780
+ F: __dxlog_file4,
781
+ L: 351,
782
+ S: this,
783
+ C: (f, a) => f(...a)
784
+ });
785
+ switch (event.type) {
786
+ case "compute-input": {
787
+ this._onInputComputed(event.nodeId, event.property, {
788
+ type: "executed",
789
+ value: event.value
790
+ });
791
+ break;
792
+ }
793
+ case "compute-output": {
794
+ this._onOutputComputed(event.nodeId, event.property, {
795
+ type: "executed",
796
+ value: event.value
797
+ });
798
+ break;
799
+ }
800
+ }
801
+ this.events.emit(event);
802
+ }
803
+ _onInputComputed(nodeId, property, value) {
804
+ this._runtimeStateInputs[nodeId] ??= {};
805
+ this._runtimeStateInputs[nodeId][property] = value;
806
+ }
807
+ _onOutputComputed(nodeId, property, value) {
808
+ this._runtimeStateOutputs[nodeId] ??= {};
809
+ this._runtimeStateOutputs[nodeId][property] = value;
810
+ this.output.emit({
811
+ nodeId,
812
+ property,
813
+ value
814
+ });
815
+ }
816
+ };
817
+ _ts_decorate([
818
+ import_async.synchronized
819
+ ], ComputeGraphController.prototype, "exec", null);
820
+ var DEFAULT_SERVICES = {
821
+ gpt: new import_conductor.MockGpt()
822
+ };
823
+ var computeValueBag = (bag) => {
824
+ return import_effect.Effect.all(Object.entries(bag.values).map(([key, eff]) => import_effect.Effect.either(eff).pipe(import_effect.Effect.map((value) => {
825
+ if (import_effect.Either.isLeft(value)) {
826
+ if ((0, import_conductor.isNotExecuted)(value.left)) {
827
+ return [
828
+ key,
829
+ {
830
+ type: "not-executed"
831
+ }
832
+ ];
833
+ } else {
834
+ return [
835
+ key,
836
+ {
837
+ type: "error",
838
+ error: value.left
839
+ }
840
+ ];
841
+ }
842
+ } else {
843
+ return [
844
+ key,
845
+ {
846
+ type: "executed",
847
+ value: value.right
848
+ }
849
+ ];
850
+ }
851
+ })))).pipe(import_effect.Effect.map((entries) => Object.fromEntries(entries)));
852
+ };
853
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-canvas-compute/src/shapes/common/Box.tsx";
854
+ var headerHeight = 32;
855
+ var footerHeight = 32;
856
+ var Box = /* @__PURE__ */ (0, import_react4.forwardRef)(({ children, classNames, shape, title, status, open, onAction }, forwardedRef) => {
857
+ (0, import_invariant4.invariant)(shape.type, void 0, {
858
+ F: __dxlog_file5,
859
+ L: 30,
860
+ S: void 0,
861
+ A: [
862
+ "shape.type",
863
+ ""
864
+ ]
865
+ });
866
+ const { icon, name, openable } = (0, import_react_ui_canvas_editor2.useShapeDef)(shape.type) ?? {
867
+ icon: "ph--placeholder--regular"
868
+ };
869
+ const { debug } = (0, import_react_ui_canvas_editor2.useEditorContext)();
870
+ return /* @__PURE__ */ import_react4.default.createElement("div", {
871
+ ref: forwardedRef,
872
+ className: "flex flex-col h-full w-full justify-between"
873
+ }, /* @__PURE__ */ import_react4.default.createElement("div", {
874
+ className: "flex shrink-0 w-full justify-between items-center h-[32px] bg-hoverSurface"
875
+ }, /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Icon, {
876
+ icon,
877
+ classNames: "mx-2"
878
+ }), /* @__PURE__ */ import_react4.default.createElement("div", {
879
+ className: "grow text-sm truncate"
880
+ }, debug ? shape.type : name ?? shape.text ?? title), /* @__PURE__ */ import_react4.default.createElement(import_react_ui.IconButton, {
881
+ classNames: "p-1 text-green-500",
882
+ variant: "ghost",
883
+ icon: "ph--play--regular",
884
+ size: 4,
885
+ label: "run",
886
+ iconOnly: true,
887
+ onDoubleClick: (ev) => ev.stopPropagation(),
888
+ onClick: (ev) => {
889
+ ev.stopPropagation();
890
+ onAction?.("run");
891
+ }
892
+ })), /* @__PURE__ */ import_react4.default.createElement("div", {
893
+ className: (0, import_react_ui_theme.mx)("flex flex-col h-full grow overflow-hidden", classNames)
894
+ }, children), /* @__PURE__ */ import_react4.default.createElement("div", {
895
+ className: "flex shrink-0 w-full justify-between items-center h-[32px] bg-hoverSurface"
896
+ }, /* @__PURE__ */ import_react4.default.createElement("div", {
897
+ className: "grow px-2 text-sm truncate"
898
+ }, debug ? shape.id : status), openable && /* @__PURE__ */ import_react4.default.createElement(import_react_ui.IconButton, {
899
+ classNames: "p-1",
900
+ variant: "ghost",
901
+ icon: open ? "ph--caret-up--regular" : "ph--caret-down--regular",
902
+ size: 4,
903
+ label: open ? "close" : "open",
904
+ iconOnly: true,
905
+ onClick: (ev) => {
906
+ ev.stopPropagation();
907
+ onAction?.(open ? "close" : "open");
908
+ }
909
+ })));
910
+ });
911
+ var getProperties = (ast) => import_schema.AST.getPropertySignatures(ast).map(({ name }) => ({
912
+ name: name.toString()
913
+ }));
914
+ var createAnchorId = (kind, property = kind === "input" ? import_conductor5.DEFAULT_INPUT : import_conductor5.DEFAULT_OUTPUT) => [
915
+ kind,
916
+ property
917
+ ].join(".");
918
+ var parseAnchorId = (id) => {
919
+ const parts = id.match(/(input|output)\.(.+)/);
920
+ return parts ? parts.slice(1) : [
921
+ void 0,
922
+ id
923
+ ];
924
+ };
925
+ var ComputeShape = import_echo_schema5.S.extend(import_react_ui_canvas_editor4.Polygon, import_echo_schema5.S.Struct({
926
+ // TODO(burdon): Rename computeNode?
927
+ node: import_echo_schema5.S.optional(import_echo_schema5.ObjectId.annotations({
928
+ [import_schema.AST.DescriptionAnnotationId]: "Compute node id"
929
+ }))
930
+ }).pipe(import_echo_schema5.S.mutable));
931
+ var createShape = ({ id, ...rest }) => {
932
+ return {
933
+ id: id ?? import_echo_schema5.ObjectId.random(),
934
+ ...rest
935
+ };
936
+ };
937
+ var bodyPadding = 8;
938
+ var expandedHeight = 200;
939
+ var FunctionBody = ({ shape, name, content, inputSchema = import_conductor4.VoidInput, outputSchema = import_conductor4.VoidOutput, ...props }) => {
940
+ const { scale } = (0, import_react_ui_canvas.useCanvasContext)();
941
+ const rootRef = (0, import_react5.useRef)(null);
942
+ const [open, setOpen] = (0, import_react5.useState)(false);
943
+ const handleAction = (action) => {
944
+ if (!rootRef.current) {
945
+ return;
946
+ }
947
+ switch (action) {
948
+ case "open": {
949
+ const el = (0, import_react_ui_canvas_editor3.getParentShapeElement)(rootRef.current, shape.id);
950
+ const { height } = el.getBoundingClientRect();
951
+ el.style.height = `${height / scale + expandedHeight}px`;
952
+ setOpen(true);
953
+ break;
954
+ }
955
+ case "close": {
956
+ const el = (0, import_react_ui_canvas_editor3.getParentShapeElement)(rootRef.current, shape.id);
957
+ el.style.height = "";
958
+ setOpen(false);
959
+ break;
960
+ }
961
+ }
962
+ };
963
+ const inputs = getProperties(inputSchema.ast);
964
+ const outputs = getProperties(outputSchema.ast);
965
+ const columnCount = inputs.length && outputs.length ? 2 : 1;
966
+ return /* @__PURE__ */ import_react5.default.createElement(Box, {
967
+ ref: rootRef,
968
+ shape,
969
+ title: name,
970
+ classNames: "divide-y divide-separator",
971
+ open,
972
+ onAction: handleAction,
973
+ ...props
974
+ }, /* @__PURE__ */ import_react5.default.createElement("div", {
975
+ className: `grid grid-cols-${columnCount} items-center`,
976
+ style: {
977
+ paddingTop: bodyPadding,
978
+ paddingBottom: bodyPadding
979
+ }
980
+ }, (inputs?.length ?? 0) > 0 && /* @__PURE__ */ import_react5.default.createElement("div", {
981
+ className: "flex flex-col"
982
+ }, inputs?.map(({ name: name2 }) => /* @__PURE__ */ import_react5.default.createElement("div", {
983
+ key: name2,
984
+ className: "px-2 truncate text-sm font-mono items-center",
985
+ style: {
986
+ height: import_react_ui_canvas_editor3.rowHeight
987
+ }
988
+ }, name2))), (outputs?.length ?? 0) > 0 && /* @__PURE__ */ import_react5.default.createElement("div", {
989
+ className: "flex flex-col"
990
+ }, outputs?.map(({ name: name2 }) => /* @__PURE__ */ import_react5.default.createElement("div", {
991
+ key: name2,
992
+ className: "px-2 truncate text-sm font-mono items-center text-right",
993
+ style: {
994
+ height: import_react_ui_canvas_editor3.rowHeight
995
+ }
996
+ }, name2)))), open && /* @__PURE__ */ import_react5.default.createElement("div", {
997
+ className: "flex flex-col grow overflow-hidden"
998
+ }, content));
999
+ };
1000
+ var getHeight = (input) => {
1001
+ const properties = import_echo_schema4.AST.getPropertySignatures(input.ast);
1002
+ return headerHeight + footerHeight + bodyPadding * 2 + properties.length * import_react_ui_canvas_editor3.rowHeight + 2;
1003
+ };
1004
+ var createFunctionAnchors = (shape, input = import_conductor4.VoidInput, output = import_conductor4.VoidOutput) => {
1005
+ const inputs = import_echo_schema4.AST.getPropertySignatures(input.ast).map(({ name }) => createAnchorId("input", name.toString()));
1006
+ const outputs = import_echo_schema4.AST.getPropertySignatures(output.ast).map(({ name }) => createAnchorId("output", name.toString()));
1007
+ return (0, import_react_ui_canvas_editor3.createAnchors)({
1008
+ shape,
1009
+ inputs,
1010
+ outputs,
1011
+ center: {
1012
+ x: 0,
1013
+ y: (headerHeight - footerHeight) / 2 + 1
1014
+ }
1015
+ });
1016
+ };
1017
+ var TypeSelect = ({ value, onValueChange }) => {
1018
+ return /* @__PURE__ */ import_react6.default.createElement(import_react_ui2.Select.Root, {
1019
+ value,
1020
+ onValueChange
1021
+ }, /* @__PURE__ */ import_react6.default.createElement(import_react_ui2.Select.TriggerButton, {
1022
+ variant: "ghost",
1023
+ classNames: "w-full !px-0"
1024
+ }), /* @__PURE__ */ import_react6.default.createElement(import_react_ui2.Select.Portal, null, /* @__PURE__ */ import_react6.default.createElement(import_react_ui2.Select.Content, null, /* @__PURE__ */ import_react6.default.createElement(import_react_ui2.Select.ScrollUpButton, null), /* @__PURE__ */ import_react6.default.createElement(import_react_ui2.Select.Viewport, null, import_conductor6.ComputeValueType.literals.map((type) => /* @__PURE__ */ import_react6.default.createElement(import_react_ui2.Select.Option, {
1025
+ key: type,
1026
+ value: type
1027
+ }, type))), /* @__PURE__ */ import_react6.default.createElement(import_react_ui2.Select.ScrollDownButton, null), /* @__PURE__ */ import_react6.default.createElement(import_react_ui2.Select.Arrow, null))));
1028
+ };
1029
+ var ReducerShape = import_echo_schema6.S.extend(ComputeShape, import_echo_schema6.S.Struct({
1030
+ type: import_echo_schema6.S.Literal("reducer")
1031
+ }));
1032
+ var ReducerComponent = ({ shape }) => {
1033
+ return /* @__PURE__ */ import_react7.default.createElement(FunctionBody, {
1034
+ shape,
1035
+ inputSchema: import_conductor7.ReducerInput,
1036
+ outputSchema: import_conductor7.ReducerOutput
1037
+ });
1038
+ };
1039
+ var createReducer = ({ id, size = {
1040
+ width: 192,
1041
+ height: getHeight(import_conductor7.ReducerInput)
1042
+ }, ...rest }) => createShape({
1043
+ type: "reducer",
1044
+ size,
1045
+ ...rest
1046
+ });
1047
+ var reducerShape = {
1048
+ type: "reducer",
1049
+ name: "Reducer",
1050
+ icon: "ph--repeat--regular",
1051
+ component: (props) => /* @__PURE__ */ import_react7.default.createElement(ReducerComponent, props),
1052
+ createShape: createReducer,
1053
+ getAnchors: (shape) => createFunctionAnchors(shape, import_conductor7.ReducerInput, import_conductor7.ReducerOutput)
1054
+ };
1055
+ var AppendShape = import_echo_schema7.S.extend(ComputeShape, import_echo_schema7.S.Struct({
1056
+ type: import_echo_schema7.S.Literal("append")
1057
+ }));
1058
+ var createAppend = (props) => createShape({
1059
+ type: "append",
1060
+ size: {
1061
+ width: 128,
1062
+ height: getHeight(import_conductor8.AppendInput)
1063
+ },
1064
+ ...props
1065
+ });
1066
+ var AppendComponent = ({ shape }) => {
1067
+ return /* @__PURE__ */ import_react8.default.createElement(FunctionBody, {
1068
+ shape,
1069
+ inputSchema: import_conductor8.AppendInput
1070
+ });
1071
+ };
1072
+ var appendShape = {
1073
+ type: "append",
1074
+ name: "Append",
1075
+ icon: "ph--list-plus--regular",
1076
+ component: AppendComponent,
1077
+ createShape: createAppend,
1078
+ getAnchors: (shape) => createFunctionAnchors(shape, import_conductor8.AppendInput)
1079
+ };
1080
+ var AudioShape = import_echo_schema8.S.extend(ComputeShape, import_echo_schema8.S.Struct({
1081
+ type: import_echo_schema8.S.Literal("audio")
1082
+ }));
1083
+ var createAudio = (props) => createShape({
1084
+ type: "audio",
1085
+ size: {
1086
+ width: 64,
1087
+ height: 64
1088
+ },
1089
+ ...props
1090
+ });
1091
+ var AudioComponent = ({ shape }) => {
1092
+ const { node } = useComputeNodeState(shape);
1093
+ const [active, setActive] = (0, import_react9.useState)(false);
1094
+ (0, import_react9.useEffect)(() => {
1095
+ node.value = active;
1096
+ }, [
1097
+ active
1098
+ ]);
1099
+ return /* @__PURE__ */ import_react9.default.createElement("div", {
1100
+ className: "flex w-full justify-center items-center"
1101
+ }, /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.Icon, {
1102
+ icon: active ? "ph--microphone--regular" : "ph--microphone-slash--regular",
1103
+ classNames: [
1104
+ "transition opacity-20 duration-1000",
1105
+ active && "opacity-100 text-red-500"
1106
+ ],
1107
+ size: 8,
1108
+ onClick: () => setActive(!active)
1109
+ }));
1110
+ };
1111
+ var audioShape = {
1112
+ type: "audio",
1113
+ name: "Audio",
1114
+ icon: "ph--microphone--regular",
1115
+ component: AudioComponent,
1116
+ createShape: createAudio,
1117
+ getAnchors: (shape) => (0, import_react_ui_canvas_editor5.createAnchorMap)(shape, {
1118
+ [createAnchorId("output")]: {
1119
+ x: 1,
1120
+ y: 0
1121
+ }
1122
+ })
1123
+ };
1124
+ var BeaconShape = import_echo_schema9.S.extend(ComputeShape, import_echo_schema9.S.Struct({
1125
+ type: import_echo_schema9.S.Literal("beacon")
1126
+ }));
1127
+ var createBeacon = (props) => createShape({
1128
+ type: "beacon",
1129
+ size: {
1130
+ width: 64,
1131
+ height: 64
1132
+ },
1133
+ ...props
1134
+ });
1135
+ var BeaconComponent = ({ shape }) => {
1136
+ const { runtime } = useComputeNodeState(shape);
1137
+ const input = runtime.inputs[import_conductor9.DEFAULT_INPUT];
1138
+ const value = input?.type === "executed" ? input.value : false;
1139
+ return /* @__PURE__ */ import_react10.default.createElement("div", {
1140
+ className: "flex w-full justify-center items-center"
1141
+ }, /* @__PURE__ */ import_react10.default.createElement(import_react_ui4.Icon, {
1142
+ icon: "ph--sun--regular",
1143
+ classNames: (0, import_react_ui_theme2.mx)("transition opacity-20 duration-1000", (0, import_conductor9.isTruthy)(value) && "opacity-100 text-yellow-500"),
1144
+ size: 8
1145
+ }));
1146
+ };
1147
+ var beaconShape = {
1148
+ type: "beacon",
1149
+ name: "Beacon",
1150
+ icon: "ph--sun--regular",
1151
+ component: BeaconComponent,
1152
+ createShape: createBeacon,
1153
+ getAnchors: (shape) => (0, import_react_ui_canvas_editor6.createAnchorMap)(shape, {
1154
+ [createAnchorId("input")]: {
1155
+ x: -1,
1156
+ y: 0
1157
+ }
1158
+ })
1159
+ };
1160
+ var GateShape = import_echo_schema10.S.extend(ComputeShape, import_echo_schema10.S.Struct({
1161
+ type: import_echo_schema10.S.String
1162
+ }));
1163
+ var createGate = (props) => createShape({
1164
+ size: {
1165
+ width: 64,
1166
+ height: 64
1167
+ },
1168
+ ...props
1169
+ });
1170
+ var GateComponent = (Symbol22) => () => {
1171
+ return /* @__PURE__ */ import_react11.default.createElement("div", {
1172
+ className: "flex w-full justify-center items-center"
1173
+ }, /* @__PURE__ */ import_react11.default.createElement(Symbol22, null));
1174
+ };
1175
+ var defineShape = ({ type, name, icon, Symbol: Symbol22, createShape: createShape2, inputs, outputs = [
1176
+ createAnchorId("output")
1177
+ ] }) => ({
1178
+ type,
1179
+ name,
1180
+ icon,
1181
+ component: GateComponent(Symbol22),
1182
+ createShape: createShape2,
1183
+ getAnchors: (shape) => (0, import_react_ui_canvas_editor7.createAnchors)({
1184
+ shape,
1185
+ inputs,
1186
+ outputs
1187
+ })
1188
+ });
1189
+ var Symbol2 = (pathConstructor, inputs) => ({
1190
+ width = 64,
1191
+ height = 32,
1192
+ // TODO(burdon): Same as line color.
1193
+ className = "fill-neutral-200 dark:fill-neutral-800 stroke-neutral-500",
1194
+ strokeWidth = 1
1195
+ }) => {
1196
+ const startX = width * 0.25;
1197
+ const endX = width * 0.75;
1198
+ const centerY = height / 2;
1199
+ const paths = pathConstructor({
1200
+ startX,
1201
+ endX,
1202
+ height
1203
+ });
1204
+ return /* @__PURE__ */ import_react11.default.createElement("svg", {
1205
+ viewBox: `0 0 ${width} ${height}`,
1206
+ className: "w-full h-full"
1207
+ }, (0, import_react_ui_canvas_editor7.getAnchorPoints)({
1208
+ x: 0,
1209
+ y: centerY
1210
+ }, inputs).map(({ x, y }, i) => /* @__PURE__ */ import_react11.default.createElement("line", {
1211
+ key: i,
1212
+ x1: x,
1213
+ y1: y,
1214
+ x2: startX * 1.3,
1215
+ y2: y,
1216
+ strokeWidth,
1217
+ className
1218
+ })), /* @__PURE__ */ import_react11.default.createElement("line", {
1219
+ x1: endX,
1220
+ y1: centerY,
1221
+ x2: width,
1222
+ y2: centerY,
1223
+ strokeWidth,
1224
+ className
1225
+ }), paths.map((path, i) => /* @__PURE__ */ import_react11.default.createElement("path", {
1226
+ key: i,
1227
+ d: path,
1228
+ strokeWidth,
1229
+ className
1230
+ })));
1231
+ };
1232
+ var AndSymbol = Symbol2(({ startX, endX, height }) => {
1233
+ const arcRadius = (endX - startX) / 2;
1234
+ return [
1235
+ `
1236
+ M ${startX},${height * 0.1}
1237
+ L ${endX - arcRadius},${height * 0.1}
1238
+ A ${arcRadius},${height * 0.4} 0 0 1 ${endX - arcRadius},${height * 0.9}
1239
+ L ${startX},${height * 0.9}
1240
+ Z
1241
+ `
1242
+ ];
1243
+ }, 2);
1244
+ var AndShape = GateShape;
1245
+ var createAnd = (props) => {
1246
+ return createGate({
1247
+ ...props,
1248
+ type: "and"
1249
+ });
1250
+ };
1251
+ var andShape = defineShape({
1252
+ type: "and",
1253
+ name: "AND",
1254
+ icon: "ph--intersection--regular",
1255
+ Symbol: AndSymbol,
1256
+ createShape: createAnd,
1257
+ inputs: [
1258
+ "input.a",
1259
+ "input.b"
1260
+ ]
1261
+ });
1262
+ var OrSymbol = Symbol2(({ startX, endX, height }) => {
1263
+ const arcRadius = (endX - startX) / 2;
1264
+ return [
1265
+ `
1266
+ M ${startX},${height * 0.1}
1267
+ L ${endX - arcRadius},${height * 0.1}
1268
+ A ${arcRadius},${height * 0.4} 0 0 1 ${endX - arcRadius},${height * 0.9}
1269
+ L ${startX},${height * 0.9}
1270
+ C ${startX * 1.4},${height * 0.5} ${startX * 1.4},${height * 0.5} ${startX},${height * 0.1}
1271
+ Z
1272
+ `
1273
+ ];
1274
+ }, 2);
1275
+ var OrShape = GateShape;
1276
+ var createOr = (props) => {
1277
+ return createGate({
1278
+ ...props,
1279
+ type: "or"
1280
+ });
1281
+ };
1282
+ var orShape = defineShape({
1283
+ type: "or",
1284
+ name: "OR",
1285
+ icon: "ph--union--regular",
1286
+ Symbol: OrSymbol,
1287
+ createShape: createOr,
1288
+ inputs: [
1289
+ "input.a",
1290
+ "input.b"
1291
+ ]
1292
+ });
1293
+ var NotSymbol = Symbol2(({ startX, endX, height }) => {
1294
+ return [
1295
+ `
1296
+ M ${startX},${height * 0.1}
1297
+ L ${endX * 0.9},${height * 0.5}
1298
+ L ${startX},${height * 0.9}
1299
+ Z
1300
+ `,
1301
+ `
1302
+ M ${endX - height * 0.2},${height * 0.5}
1303
+ A ${height * 0.1} ${height * 0.1} 0 0 1 ${endX},${height * 0.5}
1304
+ A ${height * 0.1} ${height * 0.1} 0 0 1 ${endX - height * 0.2},${height * 0.5}
1305
+ Z
1306
+ `
1307
+ ];
1308
+ }, 1);
1309
+ var NotShape = GateShape;
1310
+ var createNot = (props) => {
1311
+ return createGate({
1312
+ ...props,
1313
+ type: "not"
1314
+ });
1315
+ };
1316
+ var notShape = defineShape({
1317
+ type: "not",
1318
+ name: "NOT",
1319
+ icon: "ph--x--regular",
1320
+ Symbol: NotSymbol,
1321
+ createShape: createNot,
1322
+ inputs: [
1323
+ createAnchorId("input")
1324
+ ]
1325
+ });
1326
+ var ChatShape = import_echo_schema11.S.extend(ComputeShape, import_echo_schema11.S.Struct({
1327
+ type: import_echo_schema11.S.Literal("chat")
1328
+ }));
1329
+ var TextInputComponent = ({ shape, title, ...props }) => {
1330
+ const { runtime } = useComputeNodeState(shape);
1331
+ const inputRef = (0, import_react12.useRef)(null);
1332
+ const handleEnter = (text) => {
1333
+ const value = text.trim();
1334
+ if (value.length) {
1335
+ runtime.setOutput(import_conductor10.DEFAULT_OUTPUT, value);
1336
+ inputRef.current?.setText("");
1337
+ }
1338
+ };
1339
+ return /* @__PURE__ */ import_react12.default.createElement(Box, {
1340
+ shape,
1341
+ title
1342
+ }, /* @__PURE__ */ import_react12.default.createElement(import_react_ui_canvas_editor8.TextBox, {
1343
+ ref: inputRef,
1344
+ onEnter: handleEnter,
1345
+ ...props
1346
+ }));
1347
+ };
1348
+ var createChat = (props) => createShape({
1349
+ type: "chat",
1350
+ size: {
1351
+ width: 256,
1352
+ height: 128
1353
+ },
1354
+ ...props
1355
+ });
1356
+ var chatShape = {
1357
+ type: "chat",
1358
+ name: "Chat",
1359
+ icon: "ph--textbox--regular",
1360
+ component: (props) => /* @__PURE__ */ import_react12.default.createElement(TextInputComponent, {
1361
+ ...props,
1362
+ title: "Prompt",
1363
+ placeholder: "Message"
1364
+ }),
1365
+ createShape: createChat,
1366
+ getAnchors: (shape) => (0, import_react_ui_canvas_editor9.createAnchorMap)(shape, {
1367
+ [createAnchorId("output")]: {
1368
+ x: 1,
1369
+ y: 0
1370
+ }
1371
+ }),
1372
+ resizable: true
1373
+ };
1374
+ var ConstantShape = import_echo_schema12.S.extend(ComputeShape, import_echo_schema12.S.Struct({
1375
+ type: import_echo_schema12.S.Literal("constant"),
1376
+ value: import_echo_schema12.S.optional(import_echo_schema12.S.Any)
1377
+ }));
1378
+ var inferType = (value) => {
1379
+ if (typeof value === "string") {
1380
+ return "string";
1381
+ } else if (typeof value === "number") {
1382
+ return "number";
1383
+ } else if (typeof value === "boolean") {
1384
+ return "boolean";
1385
+ } else if (typeof value === "object") {
1386
+ return "object";
1387
+ }
1388
+ };
1389
+ var ConstantComponent = ({ shape, title, chat, ...props }) => {
1390
+ const { node } = useComputeNodeState(shape);
1391
+ const [type, setType] = (0, import_react13.useState)(inferType(node.value) ?? import_conductor11.ComputeValueType.literals[0]);
1392
+ const inputRef = (0, import_react13.useRef)(null);
1393
+ const handleEnter = (0, import_react13.useCallback)((text) => {
1394
+ const value = text.trim();
1395
+ if (value.length) {
1396
+ if (type === "number") {
1397
+ const floatValue = parseFloat(value);
1398
+ if (!isNaN(floatValue)) {
1399
+ node.value = floatValue;
1400
+ }
1401
+ } else if (type === "object") {
1402
+ node.value = (0, import_util2.safeParseJson)(value, {});
1403
+ } else {
1404
+ node.value = value;
1405
+ }
1406
+ inputRef.current?.focus();
1407
+ }
1408
+ }, [
1409
+ type
1410
+ ]);
1411
+ return /* @__PURE__ */ import_react13.default.createElement(Box, {
1412
+ shape,
1413
+ title,
1414
+ status: /* @__PURE__ */ import_react13.default.createElement(TypeSelect, {
1415
+ value: type,
1416
+ onValueChange: setType
1417
+ })
1418
+ }, (type === "string" || type === "number") && /* @__PURE__ */ import_react13.default.createElement(import_react_ui_canvas_editor10.TextBox, {
1419
+ ...props,
1420
+ ref: inputRef,
1421
+ value: node.value,
1422
+ onEnter: handleEnter
1423
+ }), type === "object" && /* @__PURE__ */ import_react13.default.createElement(import_react_ui_canvas_editor10.TextBox, {
1424
+ ...props,
1425
+ ref: inputRef,
1426
+ value: JSON.stringify(node.value, null, 2),
1427
+ language: "json"
1428
+ }), type === "boolean" && /* @__PURE__ */ import_react13.default.createElement("div", {
1429
+ className: "flex grow justify-center items-center"
1430
+ }, /* @__PURE__ */ import_react13.default.createElement(import_react_ui5.Input.Root, null, /* @__PURE__ */ import_react13.default.createElement(import_react_ui5.Input.Switch, {
1431
+ checked: node.value,
1432
+ onCheckedChange: (value) => {
1433
+ node.value = value;
1434
+ }
1435
+ }))));
1436
+ };
1437
+ var createConstant = (props) => createShape({
1438
+ type: "constant",
1439
+ size: {
1440
+ width: 192,
1441
+ height: 128
1442
+ },
1443
+ ...props
1444
+ });
1445
+ var constantShape = {
1446
+ type: "constant",
1447
+ name: "Value",
1448
+ icon: "ph--dots-three-circle--regular",
1449
+ component: (props) => /* @__PURE__ */ import_react13.default.createElement(ConstantComponent, {
1450
+ ...props,
1451
+ placeholder: "Constant"
1452
+ }),
1453
+ createShape: createConstant,
1454
+ getAnchors: (shape) => (0, import_react_ui_canvas_editor11.createAnchorMap)(shape, {
1455
+ [createAnchorId("output")]: {
1456
+ x: 1,
1457
+ y: 0
1458
+ }
1459
+ }),
1460
+ resizable: true
1461
+ };
1462
+ var DatabaseShape = import_echo_schema13.S.extend(ComputeShape, import_echo_schema13.S.Struct({
1463
+ type: import_echo_schema13.S.Literal("database")
1464
+ }));
1465
+ var createDatabase = (props) => createShape({
1466
+ type: "database",
1467
+ size: {
1468
+ width: 128,
1469
+ height: 64
1470
+ },
1471
+ ...props
1472
+ });
1473
+ var DatabaseComponent = ({ shape }) => {
1474
+ return /* @__PURE__ */ import_react14.default.createElement(Box, {
1475
+ shape
1476
+ });
1477
+ };
1478
+ var databaseShape = {
1479
+ type: "database",
1480
+ name: "ECHO",
1481
+ icon: "ph--database--regular",
1482
+ component: DatabaseComponent,
1483
+ createShape: createDatabase,
1484
+ getAnchors: (shape) => (0, import_react_ui_canvas_editor12.createAnchorMap)(shape, {
1485
+ [createAnchorId("output")]: {
1486
+ x: 1,
1487
+ y: 0
1488
+ }
1489
+ })
1490
+ };
1491
+ var FunctionShape = import_echo_schema14.S.extend(ComputeShape, import_echo_schema14.S.Struct({
1492
+ type: import_echo_schema14.S.Literal("function")
1493
+ }));
1494
+ var createFunction = (props) => createShape({
1495
+ type: "function",
1496
+ size: {
1497
+ width: 192,
1498
+ height: getHeight(import_conductor12.FunctionInput)
1499
+ },
1500
+ ...props
1501
+ });
1502
+ var FunctionComponent = ({ shape }) => {
1503
+ return /* @__PURE__ */ import_react15.default.createElement(FunctionBody, {
1504
+ shape,
1505
+ inputSchema: import_conductor12.FunctionInput,
1506
+ outputSchema: import_conductor12.AnyOutput
1507
+ });
1508
+ };
1509
+ var functionShape = {
1510
+ type: "function",
1511
+ name: "Function",
1512
+ icon: "ph--function--regular",
1513
+ component: FunctionComponent,
1514
+ createShape: createFunction,
1515
+ // TODO(burdon): Get dynamic schema.
1516
+ getAnchors: (shape) => createFunctionAnchors(shape, import_conductor12.FunctionInput, import_conductor12.AnyOutput)
1517
+ };
1518
+ var GptShape = import_echo_schema15.S.extend(ComputeShape, import_echo_schema15.S.Struct({
1519
+ type: import_echo_schema15.S.Literal("gpt")
1520
+ }));
1521
+ var createGpt = (props) => createShape({
1522
+ type: "gpt",
1523
+ size: {
1524
+ width: 256,
1525
+ height: Math.max(getHeight(import_conductor13.GptInput), getHeight(import_conductor13.GptOutput))
1526
+ },
1527
+ ...props
1528
+ });
1529
+ var GptComponent = ({ shape }) => {
1530
+ const { meta, runtime } = useComputeNodeState(shape);
1531
+ const [text, setText] = (0, import_react16.useState)("");
1532
+ const [tokens, setTokens] = (0, import_react16.useState)(0);
1533
+ (0, import_react16.useEffect)(() => {
1534
+ return runtime.subscribeToEventLog((ev) => {
1535
+ switch (ev.type) {
1536
+ case "begin-compute": {
1537
+ setText("");
1538
+ break;
1539
+ }
1540
+ case "custom": {
1541
+ const token = ev.event;
1542
+ switch (token.type) {
1543
+ case "content_block_delta":
1544
+ switch (token.delta.type) {
1545
+ case "text_delta": {
1546
+ const delta = token.delta.text;
1547
+ setText((prev) => {
1548
+ const text2 = prev + delta;
1549
+ setTokens(text2.split(" ").length);
1550
+ return text2;
1551
+ });
1552
+ break;
1553
+ }
1554
+ }
1555
+ break;
1556
+ }
1557
+ break;
1558
+ }
1559
+ }
1560
+ });
1561
+ }, [
1562
+ runtime?.subscribeToEventLog
1563
+ ]);
1564
+ return /* @__PURE__ */ import_react16.default.createElement(FunctionBody, {
1565
+ shape,
1566
+ content: /* @__PURE__ */ import_react16.default.createElement("div", {
1567
+ className: "px-2 py-1 overflow-y-scroll"
1568
+ }, text),
1569
+ status: `${tokens} tokens`,
1570
+ inputSchema: meta.input,
1571
+ outputSchema: meta.output
1572
+ });
1573
+ };
1574
+ var gptShape = {
1575
+ type: "gpt",
1576
+ name: "GPT",
1577
+ icon: "ph--brain--regular",
1578
+ component: GptComponent,
1579
+ createShape: createGpt,
1580
+ getAnchors: (shape) => createFunctionAnchors(shape, import_conductor13.GptInput, import_conductor13.GptOutput),
1581
+ openable: true
1582
+ };
1583
+ var JsonShape = import_echo_schema16.S.extend(ComputeShape, import_echo_schema16.S.Struct({
1584
+ type: import_echo_schema16.S.Literal("json")
1585
+ }));
1586
+ var JsonTransformShape = import_echo_schema16.S.extend(ComputeShape, import_echo_schema16.S.Struct({
1587
+ type: import_echo_schema16.S.Literal("json-transform")
1588
+ }));
1589
+ var JsonComponent = ({ shape, ...props }) => {
1590
+ const { runtime } = useComputeNodeState(shape);
1591
+ const input = runtime.inputs[import_conductor14.DEFAULT_INPUT];
1592
+ const value = input?.type === "executed" ? input.value : void 0;
1593
+ return /* @__PURE__ */ import_react17.default.createElement(Box, {
1594
+ shape
1595
+ }, /* @__PURE__ */ import_react17.default.createElement(import_react_ui_syntax_highlighter.JsonFilter, {
1596
+ data: value,
1597
+ classNames: "text-xs"
1598
+ }));
1599
+ };
1600
+ var JsonTransformComponent = ({ shape, ...props }) => {
1601
+ return /* @__PURE__ */ import_react17.default.createElement(Box, {
1602
+ shape
1603
+ });
1604
+ };
1605
+ var createJson = (props) => createShape({
1606
+ type: "json",
1607
+ size: {
1608
+ width: 256,
1609
+ height: 256
1610
+ },
1611
+ ...props
1612
+ });
1613
+ var jsonShape = {
1614
+ type: "json",
1615
+ name: "JSON",
1616
+ icon: "ph--code--regular",
1617
+ component: (props) => /* @__PURE__ */ import_react17.default.createElement(JsonComponent, props),
1618
+ createShape: createJson,
1619
+ getAnchors: (shape) => (0, import_react_ui_canvas_editor13.createAnchorMap)(shape, {
1620
+ [createAnchorId("input")]: {
1621
+ x: -1,
1622
+ y: 0
1623
+ },
1624
+ [createAnchorId("output")]: {
1625
+ x: 1,
1626
+ y: 0
1627
+ }
1628
+ }),
1629
+ resizable: true
1630
+ };
1631
+ var createJsonTransform = (props) => createShape({
1632
+ type: "json-transform",
1633
+ size: {
1634
+ width: 128,
1635
+ height: getHeight(import_conductor14.JsonTransformInput)
1636
+ },
1637
+ ...props
1638
+ });
1639
+ var jsonTransformShape = {
1640
+ type: "json-transform",
1641
+ name: "Transform",
1642
+ icon: "ph--shuffle-simple--regular",
1643
+ component: (props) => /* @__PURE__ */ import_react17.default.createElement(JsonTransformComponent, props),
1644
+ createShape: createJsonTransform,
1645
+ getAnchors: (shape) => createFunctionAnchors(shape, import_conductor14.JsonTransformInput, import_conductor14.DefaultOutput),
1646
+ resizable: true
1647
+ };
1648
+ var IfShape = import_echo_schema17.S.extend(ComputeShape, import_echo_schema17.S.Struct({
1649
+ type: import_echo_schema17.S.Literal("if")
1650
+ }));
1651
+ var IfElseShape = import_echo_schema17.S.extend(ComputeShape, import_echo_schema17.S.Struct({
1652
+ type: import_echo_schema17.S.Literal("if-else")
1653
+ }));
1654
+ var IfComponent = ({ shape, ...props }) => {
1655
+ return /* @__PURE__ */ import_react18.default.createElement(FunctionBody, {
1656
+ shape,
1657
+ inputSchema: import_conductor15.IfInput,
1658
+ outputSchema: import_conductor15.IfOutput
1659
+ });
1660
+ };
1661
+ var IfElseComponent = ({ shape, ...props }) => {
1662
+ return /* @__PURE__ */ import_react18.default.createElement(FunctionBody, {
1663
+ shape,
1664
+ inputSchema: import_conductor15.IfElseInput,
1665
+ outputSchema: import_conductor15.IfElseOutput
1666
+ });
1667
+ };
1668
+ var createIf = (props) => createShape({
1669
+ type: "if",
1670
+ size: {
1671
+ width: 192,
1672
+ height: getHeight(import_conductor15.IfInput)
1673
+ },
1674
+ ...props
1675
+ });
1676
+ var ifShape = {
1677
+ type: "if",
1678
+ name: "IF",
1679
+ icon: "ph--arrows-split--regular",
1680
+ component: (props) => /* @__PURE__ */ import_react18.default.createElement(IfComponent, props),
1681
+ createShape: createIf,
1682
+ getAnchors: (shape) => createFunctionAnchors(shape, import_conductor15.IfInput, import_conductor15.IfOutput)
1683
+ };
1684
+ var createIfElse = (props) => createShape({
1685
+ type: "if-else",
1686
+ size: {
1687
+ width: 192,
1688
+ height: getHeight(import_conductor15.IfElseInput)
1689
+ },
1690
+ ...props
1691
+ });
1692
+ var ifElseShape = {
1693
+ type: "if-else",
1694
+ name: "IF/ELSE",
1695
+ icon: "ph--arrows-merge--regular",
1696
+ component: (props) => /* @__PURE__ */ import_react18.default.createElement(IfElseComponent, props),
1697
+ createShape: createIfElse,
1698
+ getAnchors: (shape) => createFunctionAnchors(shape, import_conductor15.IfElseInput, import_conductor15.IfElseOutput)
1699
+ };
1700
+ var QueueShape = import_echo_schema18.S.extend(ComputeShape, import_echo_schema18.S.Struct({
1701
+ type: import_echo_schema18.S.Literal("queue")
1702
+ }));
1703
+ var createQueue = (props) => createShape({
1704
+ type: "queue",
1705
+ size: {
1706
+ width: 256,
1707
+ height: 512
1708
+ },
1709
+ ...props
1710
+ });
1711
+ var QueueComponent = ({ shape }) => {
1712
+ const { runtime } = useComputeNodeState(shape);
1713
+ const items = runtime.outputs[import_conductor16.DEFAULT_OUTPUT]?.type === "executed" ? runtime.outputs[import_conductor16.DEFAULT_OUTPUT].value : [];
1714
+ const handleAction = (action) => {
1715
+ if (action === "run") {
1716
+ runtime.evalNode();
1717
+ }
1718
+ };
1719
+ return /* @__PURE__ */ import_react19.default.createElement(Box, {
1720
+ shape,
1721
+ status: `${items.length} items`,
1722
+ onAction: handleAction
1723
+ }, /* @__PURE__ */ import_react19.default.createElement("div", {
1724
+ className: "flex flex-col w-full overflow-y-scroll divide-y divide-separator"
1725
+ }, [
1726
+ ...items
1727
+ ].map((item, i) => /* @__PURE__ */ import_react19.default.createElement(QueueItem, {
1728
+ key: i,
1729
+ classNames: "p-1 px-2",
1730
+ item
1731
+ }))));
1732
+ };
1733
+ var QueueItem = ({ classNames, item }) => {
1734
+ if (typeof item !== "object") {
1735
+ return /* @__PURE__ */ import_react19.default.createElement("div", {
1736
+ className: (0, import_react_ui_theme3.mx)(classNames, "whitespace-pre-wrap")
1737
+ }, item);
1738
+ }
1739
+ return /* @__PURE__ */ import_react19.default.createElement("div", {
1740
+ className: (0, import_react_ui_theme3.mx)("grid grid-cols-[80px,1fr]", classNames)
1741
+ }, Object.entries(item).map(([key, value]) => /* @__PURE__ */ import_react19.default.createElement(import_react19.Fragment, {
1742
+ key
1743
+ }, /* @__PURE__ */ import_react19.default.createElement("div", {
1744
+ className: "p-1 text-xs text-subdued"
1745
+ }, key), /* @__PURE__ */ import_react19.default.createElement("div", null, typeof value === "string" ? value : JSON.stringify(value)))));
1746
+ };
1747
+ var queueShape = {
1748
+ type: "queue",
1749
+ name: "Queue",
1750
+ icon: "ph--queue--regular",
1751
+ component: QueueComponent,
1752
+ createShape: createQueue,
1753
+ getAnchors: (shape) => createFunctionAnchors(shape, import_conductor16.QueueInput, import_conductor16.QueueOutput),
1754
+ resizable: true
1755
+ };
1756
+ var RandomShape = import_echo_schema19.S.extend(ComputeShape, import_echo_schema19.S.Struct({
1757
+ type: import_echo_schema19.S.Literal("rng"),
1758
+ min: import_echo_schema19.S.optional(import_echo_schema19.S.Number),
1759
+ max: import_echo_schema19.S.optional(import_echo_schema19.S.Number)
1760
+ }));
1761
+ var createRandom = (props) => createShape({
1762
+ type: "rng",
1763
+ size: {
1764
+ width: 64,
1765
+ height: 64
1766
+ },
1767
+ ...props
1768
+ });
1769
+ var icons = [
1770
+ "ph--dice-one--regular",
1771
+ "ph--dice-two--regular",
1772
+ "ph--dice-three--regular",
1773
+ "ph--dice-four--regular",
1774
+ "ph--dice-five--regular",
1775
+ "ph--dice-six--regular"
1776
+ ];
1777
+ var pickIcon = () => icons[Math.floor(Math.random() * icons.length)];
1778
+ var RandomComponent = ({ shape }) => {
1779
+ const { runtime } = useComputeNodeState(shape);
1780
+ const [spin, setSpin] = (0, import_react20.useState)(false);
1781
+ const [icon, setIcon] = (0, import_react20.useState)(pickIcon());
1782
+ (0, import_react20.useEffect)(() => {
1783
+ if (!spin) {
1784
+ return;
1785
+ }
1786
+ const i = setInterval(() => setIcon(pickIcon()), 250);
1787
+ const t1 = setTimeout(() => clearInterval(i), 900);
1788
+ const t2 = setTimeout(() => setSpin(false), 1100);
1789
+ return () => {
1790
+ clearInterval(i);
1791
+ clearTimeout(t1);
1792
+ clearTimeout(t2);
1793
+ };
1794
+ }, [
1795
+ spin
1796
+ ]);
1797
+ const handleClick = (ev) => {
1798
+ ev.stopPropagation();
1799
+ runtime.setOutput(import_conductor17.DEFAULT_OUTPUT, Math.random());
1800
+ setSpin(true);
1801
+ };
1802
+ return /* @__PURE__ */ import_react20.default.createElement("div", {
1803
+ className: "flex grow items-center justify-center"
1804
+ }, /* @__PURE__ */ import_react20.default.createElement(import_react_ui6.Icon, {
1805
+ icon,
1806
+ classNames: (0, import_react_ui_theme4.mx)(spin && "animate-[spin_1s]"),
1807
+ size: 10,
1808
+ onClick: handleClick
1809
+ }));
1810
+ };
1811
+ var randomShape = {
1812
+ type: "rng",
1813
+ name: "Random",
1814
+ icon: "ph--dice-six--regular",
1815
+ component: RandomComponent,
1816
+ createShape: createRandom,
1817
+ getAnchors: (shape) => (0, import_react_ui_canvas_editor14.createAnchorMap)(shape, {
1818
+ [createAnchorId("output")]: {
1819
+ x: 1,
1820
+ y: 0
1821
+ }
1822
+ })
1823
+ };
1824
+ var ScopeShape = import_echo_schema20.S.extend(ComputeShape, import_echo_schema20.S.Struct({
1825
+ type: import_echo_schema20.S.Literal("scope")
1826
+ }));
1827
+ var createScope = (props) => createShape({
1828
+ type: "scope",
1829
+ size: {
1830
+ width: 128,
1831
+ height: 128
1832
+ },
1833
+ classNames: "rounded-full border-primary-800",
1834
+ ...props
1835
+ });
1836
+ var ScopeComponent = ({ shape }) => {
1837
+ const { runtime } = useComputeNodeState(shape);
1838
+ const input = runtime.inputs[import_conductor18.DEFAULT_INPUT];
1839
+ const active = input?.type === "executed" ? input.value : false;
1840
+ const { getAverage } = (0, import_react_ui_sfx.useAudioStream)(active);
1841
+ return /* @__PURE__ */ import_react21.default.createElement("div", {
1842
+ className: "flex w-full justify-center items-center bg-black"
1843
+ }, /* @__PURE__ */ import_react21.default.createElement(import_react_ui_sfx.Chaos, {
1844
+ active,
1845
+ getValue: getAverage,
1846
+ options: {
1847
+ ...import_react_ui_sfx.shaderPresets.heptapod,
1848
+ zoom: 1.2
1849
+ }
1850
+ }));
1851
+ };
1852
+ var scopeShape = {
1853
+ type: "scope",
1854
+ name: "Scope",
1855
+ icon: "ph--waveform--regular",
1856
+ component: ScopeComponent,
1857
+ createShape: createScope,
1858
+ getAnchors: (shape) => (0, import_react_ui_canvas_editor15.createAnchorMap)(shape, {
1859
+ [createAnchorId("input")]: {
1860
+ x: -1,
1861
+ y: 0
1862
+ }
1863
+ })
1864
+ };
1865
+ var SurfaceShape = import_echo_schema21.S.extend(ComputeShape, import_echo_schema21.S.Struct({
1866
+ type: import_echo_schema21.S.Literal("surface")
1867
+ }));
1868
+ var createSurface = (props) => createShape({
1869
+ type: "surface",
1870
+ size: {
1871
+ width: 384,
1872
+ height: 384
1873
+ },
1874
+ ...props
1875
+ });
1876
+ var SurfaceComponent = ({ shape }) => {
1877
+ const { runtime } = useComputeNodeState(shape);
1878
+ const input = runtime.inputs[import_conductor19.DEFAULT_INPUT];
1879
+ const value = input?.type === "executed" ? input.value : null;
1880
+ const handleAction = (action) => {
1881
+ if (action === "run") {
1882
+ runtime.evalNode();
1883
+ }
1884
+ };
1885
+ return /* @__PURE__ */ import_react22.default.createElement(Box, {
1886
+ shape,
1887
+ onAction: handleAction
1888
+ }, value !== null && /* @__PURE__ */ import_react22.default.createElement(import_app_framework.Surface, {
1889
+ role: "canvas-node",
1890
+ data: {
1891
+ value
1892
+ },
1893
+ limit: 1
1894
+ }));
1895
+ };
1896
+ var surfaceShape = {
1897
+ type: "surface",
1898
+ name: "Surface",
1899
+ icon: "ph--frame-corners--regular",
1900
+ component: SurfaceComponent,
1901
+ createShape: createSurface,
1902
+ getAnchors: (shape) => (0, import_react_ui_canvas_editor16.createAnchorMap)(shape, {
1903
+ [createAnchorId("input")]: {
1904
+ x: -1,
1905
+ y: 0
1906
+ }
1907
+ }),
1908
+ resizable: true
1909
+ };
1910
+ var SwitchShape = import_echo_schema22.S.extend(ComputeShape, import_echo_schema22.S.Struct({
1911
+ type: import_echo_schema22.S.Literal("switch")
1912
+ }));
1913
+ var createSwitch = (props) => createShape({
1914
+ type: "switch",
1915
+ size: {
1916
+ width: 64,
1917
+ height: 64
1918
+ },
1919
+ ...props
1920
+ });
1921
+ var SwitchComponent = ({ shape }) => {
1922
+ const { runtime } = useComputeNodeState(shape);
1923
+ const [value, setValue] = (0, import_react23.useState)(false);
1924
+ (0, import_react23.useEffect)(() => {
1925
+ runtime.setOutput(import_conductor20.DEFAULT_OUTPUT, value);
1926
+ }, [
1927
+ value
1928
+ ]);
1929
+ return /* @__PURE__ */ import_react23.default.createElement("div", {
1930
+ className: "flex w-full justify-center items-center",
1931
+ onClick: (ev) => ev.stopPropagation()
1932
+ }, /* @__PURE__ */ import_react23.default.createElement(import_react_ui7.Input.Root, null, /* @__PURE__ */ import_react23.default.createElement(import_react_ui7.Input.Switch, {
1933
+ checked: value,
1934
+ onCheckedChange: (value2) => setValue(value2)
1935
+ })));
1936
+ };
1937
+ var switchShape = {
1938
+ type: "switch",
1939
+ name: "Switch",
1940
+ icon: "ph--toggle-left--regular",
1941
+ component: SwitchComponent,
1942
+ createShape: createSwitch,
1943
+ getAnchors: (shape) => (0, import_react_ui_canvas_editor17.createAnchorMap)(shape, {
1944
+ [createAnchorId("output")]: {
1945
+ x: 1,
1946
+ y: 0
1947
+ }
1948
+ })
1949
+ };
1950
+ var InputSchema = (0, import_conductor21.createInputSchema)(import_conductor21.GptMessage);
1951
+ var OutputSchema = (0, import_conductor21.createOutputSchema)(import_echo_schema23.S.mutable(import_echo_schema23.S.Array(import_conductor21.GptMessage)));
1952
+ var TableShape = import_echo_schema23.S.extend(ComputeShape, import_echo_schema23.S.Struct({
1953
+ type: import_echo_schema23.S.Literal("table")
1954
+ }));
1955
+ var createTable = (props) => createShape({
1956
+ type: "table",
1957
+ size: {
1958
+ width: 320,
1959
+ height: 512
1960
+ },
1961
+ ...props
1962
+ });
1963
+ var TableComponent = ({ shape }) => {
1964
+ return /* @__PURE__ */ import_react24.default.createElement(Box, {
1965
+ shape
1966
+ });
1967
+ };
1968
+ var tableShape = {
1969
+ type: "table",
1970
+ name: "Table",
1971
+ icon: "ph--table--regular",
1972
+ component: TableComponent,
1973
+ createShape: createTable,
1974
+ getAnchors: (shape) => createFunctionAnchors(shape, InputSchema, OutputSchema),
1975
+ resizable: true
1976
+ };
1977
+ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-canvas-compute/src/shapes/Template.tsx";
1978
+ var TemplateShape = import_echo_schema24.S.extend(ComputeShape, import_echo_schema24.S.Struct({
1979
+ type: import_echo_schema24.S.Literal("template"),
1980
+ valueType: import_echo_schema24.S.optional(import_conductor22.ComputeValueType)
1981
+ }));
1982
+ var TextInputComponent2 = ({ shape, title, ...props }) => {
1983
+ const { node } = useComputeNodeState(shape);
1984
+ const inputRef = (0, import_react25.useRef)(null);
1985
+ const handleEnter = (text) => {
1986
+ const value = text.trim();
1987
+ if (value.length) {
1988
+ const schema = (0, import_conductor22.getTemplateInputSchema)(node);
1989
+ node.value = value;
1990
+ node.inputSchema = (0, import_echo_schema24.toJsonSchema)(schema);
1991
+ }
1992
+ };
1993
+ const handleTypeChange = (newType) => {
1994
+ (0, import_invariant5.invariant)(import_echo_schema24.S.is(import_conductor22.ComputeValueType)(newType), "Invalid type", {
1995
+ F: __dxlog_file6,
1996
+ L: 57,
1997
+ S: void 0,
1998
+ A: [
1999
+ "S.is(ComputeValueType)(newType)",
2000
+ "'Invalid type'"
2001
+ ]
2002
+ });
2003
+ node.valueType = newType;
2004
+ node.inputSchema = (0, import_echo_schema24.toJsonSchema)((0, import_conductor22.getTemplateInputSchema)(node));
2005
+ };
2006
+ return /* @__PURE__ */ import_react25.default.createElement(Box, {
2007
+ shape,
2008
+ title: "Template",
2009
+ status: /* @__PURE__ */ import_react25.default.createElement(TypeSelect, {
2010
+ value: node.valueType ?? "string",
2011
+ onValueChange: handleTypeChange
2012
+ })
2013
+ }, /* @__PURE__ */ import_react25.default.createElement(import_react_ui_canvas_editor18.TextBox, {
2014
+ ...props,
2015
+ ref: inputRef,
2016
+ value: node.value,
2017
+ language: node.valueType === "object" ? "json" : void 0,
2018
+ onBlur: handleEnter,
2019
+ onEnter: handleEnter
2020
+ }));
2021
+ };
2022
+ var createTemplate = (props) => createShape({
2023
+ type: "template",
2024
+ size: {
2025
+ width: 256,
2026
+ height: 384
2027
+ },
2028
+ ...props
2029
+ });
2030
+ var templateShape = {
2031
+ type: "template",
2032
+ name: "Template",
2033
+ icon: "ph--article--regular",
2034
+ component: (props) => /* @__PURE__ */ import_react25.default.createElement(TextInputComponent2, {
2035
+ ...props,
2036
+ placeholder: "Prompt"
2037
+ }),
2038
+ createShape: createTemplate,
2039
+ getAnchors: (shape) => createFunctionAnchors(shape, import_conductor22.VoidInput, import_conductor22.TemplateOutput),
2040
+ resizable: true
2041
+ };
2042
+ var TextShape = import_echo_schema25.S.extend(ComputeShape, import_echo_schema25.S.Struct({
2043
+ type: import_echo_schema25.S.Literal("text")
2044
+ }));
2045
+ var createText = (props) => createShape({
2046
+ type: "text",
2047
+ size: {
2048
+ width: 384,
2049
+ height: 384
2050
+ },
2051
+ ...props
2052
+ });
2053
+ var TextComponent = ({ shape }) => {
2054
+ const { runtime } = useComputeNodeState(shape);
2055
+ const input = runtime.inputs[import_conductor23.DEFAULT_INPUT];
2056
+ const value = input?.type === "executed" ? input.value : 0;
2057
+ const handleAction = (action) => {
2058
+ if (action === "run") {
2059
+ runtime.evalNode();
2060
+ }
2061
+ };
2062
+ return /* @__PURE__ */ import_react26.default.createElement(Box, {
2063
+ shape,
2064
+ onAction: handleAction
2065
+ }, /* @__PURE__ */ import_react26.default.createElement(import_react_ui_canvas_editor19.TextBox, {
2066
+ value
2067
+ }));
2068
+ };
2069
+ var textShape = {
2070
+ type: "text",
2071
+ name: "Text",
2072
+ icon: "ph--article--regular",
2073
+ component: TextComponent,
2074
+ createShape: createText,
2075
+ getAnchors: (shape) => (0, import_react_ui_canvas_editor20.createAnchorMap)(shape, {
2076
+ [createAnchorId("input")]: {
2077
+ x: -1,
2078
+ y: 0
2079
+ }
2080
+ }),
2081
+ resizable: true
2082
+ };
2083
+ var InputSchema2 = (0, import_conductor24.createInputSchema)(import_conductor24.GptMessage);
2084
+ var OutputSchema2 = (0, import_conductor24.createOutputSchema)(import_echo_schema26.S.mutable(import_echo_schema26.S.Array(import_conductor24.GptMessage)));
2085
+ var ThreadShape = import_echo_schema26.S.extend(ComputeShape, import_echo_schema26.S.Struct({
2086
+ type: import_echo_schema26.S.Literal("thread")
2087
+ }));
2088
+ var createThread = (props) => createShape({
2089
+ type: "thread",
2090
+ size: {
2091
+ width: 384,
2092
+ height: 384
2093
+ },
2094
+ ...props
2095
+ });
2096
+ var ThreadComponent = ({ shape }) => {
2097
+ const items = [];
2098
+ const scrollRef = (0, import_react27.useRef)(null);
2099
+ (0, import_react27.useEffect)(() => {
2100
+ if (scrollRef.current) {
2101
+ scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
2102
+ }
2103
+ }, [
2104
+ items
2105
+ ]);
2106
+ return /* @__PURE__ */ import_react27.default.createElement(Box, {
2107
+ shape
2108
+ }, /* @__PURE__ */ import_react27.default.createElement("div", {
2109
+ ref: scrollRef,
2110
+ className: "flex flex-col w-full overflow-y-scroll gap-2 p-2"
2111
+ }, [
2112
+ ...items
2113
+ ].map((item, i) => /* @__PURE__ */ import_react27.default.createElement(ThreadItem, {
2114
+ key: i,
2115
+ item
2116
+ }))));
2117
+ };
2118
+ var ThreadItem = ({ classNames, item }) => {
2119
+ if (typeof item !== "object") {
2120
+ return /* @__PURE__ */ import_react27.default.createElement("div", {
2121
+ className: (0, import_react_ui_theme5.mx)(classNames)
2122
+ }, item);
2123
+ }
2124
+ const { role, message } = item;
2125
+ return /* @__PURE__ */ import_react27.default.createElement("div", {
2126
+ className: (0, import_react_ui_theme5.mx)("flex", classNames, role === "user" && "justify-end")
2127
+ }, /* @__PURE__ */ import_react27.default.createElement("div", {
2128
+ className: (0, import_react_ui_theme5.mx)("block rounded-md p-1 px-2 text-sm", role === "user" ? "bg-blue-100 dark:bg-blue-800" : role === "system" ? "bg-red-100, dark:bg-red-800" : "whitespace-pre-wrap bg-neutral-50 dark:bg-neutral-800")
2129
+ }, message));
2130
+ };
2131
+ var threadShape = {
2132
+ type: "thread",
2133
+ name: "Thread",
2134
+ icon: "ph--chats-circle--regular",
2135
+ component: ThreadComponent,
2136
+ createShape: createThread,
2137
+ getAnchors: (shape) => createFunctionAnchors(shape, InputSchema2, OutputSchema2),
2138
+ resizable: true
2139
+ };
2140
+ var TextToImageShape = import_echo_schema27.S.extend(ComputeShape, import_echo_schema27.S.Struct({
2141
+ type: import_echo_schema27.S.Literal("text-to-image")
2142
+ }));
2143
+ var createTextToImage = (props) => createShape({
2144
+ type: "text-to-image",
2145
+ size: {
2146
+ width: 128,
2147
+ height: 64
2148
+ },
2149
+ ...props
2150
+ });
2151
+ var TextToImageComponent = ({ shape }) => {
2152
+ return /* @__PURE__ */ import_react28.default.createElement(Box, {
2153
+ shape
2154
+ });
2155
+ };
2156
+ var textToImageShape = {
2157
+ type: "text-to-image",
2158
+ name: "Image",
2159
+ icon: "ph--image--regular",
2160
+ component: TextToImageComponent,
2161
+ createShape: createTextToImage,
2162
+ getAnchors: (shape) => (0, import_react_ui_canvas_editor21.createAnchorMap)(shape, {
2163
+ [createAnchorId("output")]: {
2164
+ x: 1,
2165
+ y: 0
2166
+ }
2167
+ })
2168
+ };
2169
+ var TriggerShape = import_echo_schema28.S.extend(ComputeShape, import_echo_schema28.S.Struct({
2170
+ type: import_echo_schema28.S.Literal("trigger"),
2171
+ functionTrigger: import_echo_schema28.S.optional((0, import_echo_schema28.Ref)(import_functions.FunctionTrigger))
2172
+ }));
2173
+ var createTrigger = (props) => {
2174
+ const functionTrigger = (0, import_echo2.create)(import_functions.FunctionTrigger, {
2175
+ enabled: true,
2176
+ spec: createTriggerSpec(props.triggerKind ?? import_functions.TriggerKind.Email)
2177
+ });
2178
+ return createShape({
2179
+ type: "trigger",
2180
+ functionTrigger: (0, import_echo2.makeRef)(functionTrigger),
2181
+ size: {
2182
+ width: 192,
2183
+ height: getHeight(import_conductor25.EmailTriggerOutput)
2184
+ },
2185
+ ...props
2186
+ });
2187
+ };
2188
+ var TriggerComponent = ({ shape }) => {
2189
+ const functionTrigger = shape.functionTrigger?.target;
2190
+ (0, import_react29.useEffect)(() => {
2191
+ if (functionTrigger && !functionTrigger.spec) {
2192
+ functionTrigger.spec = createTriggerSpec(import_functions.TriggerKind.Email);
2193
+ }
2194
+ }, [
2195
+ functionTrigger,
2196
+ functionTrigger?.spec
2197
+ ]);
2198
+ (0, import_react29.useEffect)(() => {
2199
+ shape.size.height = getHeight(getOutputSchema(functionTrigger?.spec?.type ?? import_functions.TriggerKind.Email));
2200
+ }, [
2201
+ functionTrigger?.spec?.type
2202
+ ]);
2203
+ const setKind = (kind) => {
2204
+ if (functionTrigger?.spec?.type !== kind) {
2205
+ functionTrigger.spec = createTriggerSpec(kind);
2206
+ }
2207
+ };
2208
+ if (!functionTrigger?.spec) {
2209
+ return;
2210
+ }
2211
+ return /* @__PURE__ */ import_react29.default.createElement(FunctionBody, {
2212
+ shape,
2213
+ status: /* @__PURE__ */ import_react29.default.createElement(TriggerKindSelect, {
2214
+ value: functionTrigger.spec?.type,
2215
+ onValueChange: (kind) => setKind(kind)
2216
+ }),
2217
+ inputSchema: import_conductor25.VoidInput,
2218
+ outputSchema: getOutputSchema(functionTrigger.spec.type)
2219
+ });
2220
+ };
2221
+ var TriggerKindSelect = ({ value, onValueChange }) => {
2222
+ return /* @__PURE__ */ import_react29.default.createElement(import_react_ui8.Select.Root, {
2223
+ value,
2224
+ onValueChange
2225
+ }, /* @__PURE__ */ import_react29.default.createElement(import_react_ui8.Select.TriggerButton, {
2226
+ variant: "ghost",
2227
+ classNames: "w-full !px-0"
2228
+ }), /* @__PURE__ */ import_react29.default.createElement(import_react_ui8.Select.Portal, null, /* @__PURE__ */ import_react29.default.createElement(import_react_ui8.Select.Content, null, /* @__PURE__ */ import_react29.default.createElement(import_react_ui8.Select.ScrollUpButton, null), /* @__PURE__ */ import_react29.default.createElement(import_react_ui8.Select.Viewport, null, Object.values(import_functions.TriggerKind).map((type) => /* @__PURE__ */ import_react29.default.createElement(import_react_ui8.Select.Option, {
2229
+ key: type,
2230
+ value: type
2231
+ }, type))), /* @__PURE__ */ import_react29.default.createElement(import_react_ui8.Select.ScrollDownButton, null), /* @__PURE__ */ import_react29.default.createElement(import_react_ui8.Select.Arrow, null))));
2232
+ };
2233
+ var createTriggerSpec = (kind) => {
2234
+ switch (kind) {
2235
+ case import_functions.TriggerKind.Timer:
2236
+ return {
2237
+ type: import_functions.TriggerKind.Timer,
2238
+ cron: "0 0 * * *"
2239
+ };
2240
+ case import_functions.TriggerKind.Webhook:
2241
+ return {
2242
+ type: import_functions.TriggerKind.Webhook,
2243
+ method: "POST"
2244
+ };
2245
+ case import_functions.TriggerKind.Subscription:
2246
+ return {
2247
+ type: import_functions.TriggerKind.Subscription,
2248
+ filter: {}
2249
+ };
2250
+ case import_functions.TriggerKind.Email:
2251
+ return {
2252
+ type: import_functions.TriggerKind.Email
2253
+ };
2254
+ }
2255
+ };
2256
+ var getOutputSchema = (kind) => {
2257
+ const kindToSchema = {
2258
+ [import_functions.TriggerKind.Email]: import_conductor25.EmailTriggerOutput,
2259
+ [import_functions.TriggerKind.Subscription]: import_conductor25.SubscriptionTriggerOutput,
2260
+ [import_functions.TriggerKind.Timer]: import_conductor25.TimerTriggerOutput,
2261
+ [import_functions.TriggerKind.Webhook]: import_conductor25.WebhookTriggerOutput
2262
+ };
2263
+ return kindToSchema[kind];
2264
+ };
2265
+ var triggerShape = {
2266
+ type: "trigger",
2267
+ name: "Trigger",
2268
+ icon: "ph--lightning--regular",
2269
+ component: TriggerComponent,
2270
+ createShape: createTrigger,
2271
+ getAnchors: (shape) => createFunctionAnchors(shape, import_conductor25.VoidInput, getOutputSchema(shape.functionTrigger?.target?.spec?.type ?? import_functions.TriggerKind.Email))
2272
+ };
2273
+ var GptRealtimeShape = import_echo_schema29.S.extend(ComputeShape, import_echo_schema29.S.Struct({
2274
+ type: import_echo_schema29.S.Literal("gpt-realtime")
2275
+ }));
2276
+ var createGptRealtime = (props) => createShape({
2277
+ type: "gpt-realtime",
2278
+ size: {
2279
+ width: 256,
2280
+ height: 256
2281
+ },
2282
+ ...props
2283
+ });
2284
+ var GptRealtimeComponent = ({ shape }) => {
2285
+ const [isLive, setIsLive] = (0, import_react30.useState)(false);
2286
+ const [isReady, setIsReady] = (0, import_react30.useState)(false);
2287
+ const start = async () => {
2288
+ setIsLive(true);
2289
+ try {
2290
+ const peerConnection = new RTCPeerConnection();
2291
+ peerConnection.ontrack = (event) => {
2292
+ const audioElement = document.createElement("audio");
2293
+ audioElement.srcObject = event.streams[0];
2294
+ audioElement.autoplay = true;
2295
+ audioElement.controls = false;
2296
+ audioElement.style.display = "none";
2297
+ document.body.appendChild(audioElement);
2298
+ setIsReady(true);
2299
+ };
2300
+ const stream = await navigator.mediaDevices.getUserMedia({
2301
+ audio: true
2302
+ });
2303
+ stream.getTracks().forEach((track) => peerConnection.addTransceiver(track, {
2304
+ direction: "sendrecv"
2305
+ }));
2306
+ const offer = await peerConnection.createOffer();
2307
+ await peerConnection.setLocalDescription(offer);
2308
+ const response = await fetch(`${AI_SERVICE_URL}/rtc-connect`, {
2309
+ method: "POST",
2310
+ body: offer.sdp,
2311
+ headers: {
2312
+ "Content-Type": "application/sdp"
2313
+ }
2314
+ });
2315
+ const answer = await response.text();
2316
+ await peerConnection.setRemoteDescription({
2317
+ sdp: answer,
2318
+ type: "answer"
2319
+ });
2320
+ const dataChannel = peerConnection.createDataChannel("response");
2321
+ const configureData = () => {
2322
+ console.log("Configuring data channel");
2323
+ const event = {
2324
+ type: "session.update",
2325
+ session: {
2326
+ modalities: [
2327
+ "text",
2328
+ "audio"
2329
+ ],
2330
+ // Provide the tools. Note they match the keys in the `fns` object above
2331
+ tools: []
2332
+ }
2333
+ };
2334
+ dataChannel.send(JSON.stringify(event));
2335
+ };
2336
+ dataChannel.addEventListener("open", (ev) => {
2337
+ console.log("Opening data channel", ev);
2338
+ configureData();
2339
+ });
2340
+ dataChannel.addEventListener("message", async (ev) => {
2341
+ const msg = JSON.parse(ev.data);
2342
+ if (msg.type === "response.function_call_arguments.done") {
2343
+ }
2344
+ });
2345
+ } catch (error) {
2346
+ console.error("Error in realtime session:", error);
2347
+ throw error;
2348
+ }
2349
+ };
2350
+ return /* @__PURE__ */ import_react30.default.createElement("div", {
2351
+ className: "flex w-full justify-center items-center"
2352
+ }, /* @__PURE__ */ import_react30.default.createElement(import_react_ui9.Icon, {
2353
+ icon: isReady ? "ph--waveform--regular" : isLive ? "ph--pulse--regular" : "ph--play--regular",
2354
+ size: 16,
2355
+ classNames: !isLive && "cursor-pointer",
2356
+ onClick: start
2357
+ }));
2358
+ };
2359
+ var gptRealtimeShape = {
2360
+ type: "gpt-realtime",
2361
+ name: "GPT Realtime",
2362
+ icon: "ph--pulse--regular",
2363
+ component: GptRealtimeComponent,
2364
+ createShape: createGptRealtime,
2365
+ // TODO(dmaretskyi): Can we fetch the schema dynamically?
2366
+ getAnchors: (shape) => createFunctionAnchors(shape, import_echo_schema29.S.Struct({
2367
+ audio: import_echo_schema29.S.Any
2368
+ }), import_echo_schema29.S.Struct({})),
2369
+ resizable: true
2370
+ };
2371
+ var AI_SERVICE_URL = "http://localhost:8788";
2372
+ var computeShapes = [
2373
+ {
2374
+ title: "Inputs",
2375
+ shapes: [
2376
+ //
2377
+ constantShape,
2378
+ templateShape,
2379
+ chatShape,
2380
+ switchShape,
2381
+ audioShape,
2382
+ triggerShape,
2383
+ randomShape
2384
+ ]
2385
+ },
2386
+ {
2387
+ title: "Transform",
2388
+ shapes: [
2389
+ //
2390
+ gptShape,
2391
+ gptRealtimeShape,
2392
+ functionShape,
2393
+ databaseShape,
2394
+ textToImageShape,
2395
+ appendShape
2396
+ ]
2397
+ },
2398
+ {
2399
+ title: "Operations",
2400
+ shapes: [
2401
+ //
2402
+ ifShape,
2403
+ ifElseShape,
2404
+ andShape,
2405
+ orShape,
2406
+ notShape,
2407
+ reducerShape,
2408
+ jsonTransformShape
2409
+ ]
2410
+ },
2411
+ {
2412
+ title: "Outputs",
2413
+ shapes: [
2414
+ //
2415
+ jsonShape,
2416
+ queueShape,
2417
+ threadShape,
2418
+ textShape,
2419
+ surfaceShape,
2420
+ beaconShape,
2421
+ scopeShape
2422
+ ]
2423
+ },
2424
+ {
2425
+ title: "Misc",
2426
+ shapes: [
2427
+ //
2428
+ import_react_ui_canvas_editor.noteShape
2429
+ ]
2430
+ }
2431
+ ];
2432
+ var ComputeShapeLayout = class extends import_react_ui_canvas_editor22.ShapeLayout {
2433
+ constructor(_controller, registry2) {
2434
+ super(registry2);
2435
+ this._controller = _controller;
2436
+ }
2437
+ // TODO(burdon): Doesn't update.
2438
+ getAnchors(shape) {
2439
+ const shapeDef = this._registry.getShapeDef(shape.type);
2440
+ let anchors = shapeDef?.getAnchors?.(shape) ?? {};
2441
+ if (shape.node) {
2442
+ const node = this._controller.graph.getNode(shape.node);
2443
+ if (node.inputSchema || node.outputSchema) {
2444
+ const inputSchema = node.inputSchema ? (0, import_echo_schema30.toEffectSchema)(node.inputSchema) : import_conductor26.DefaultInput;
2445
+ const outputSchema = node.outputSchema ? (0, import_echo_schema30.toEffectSchema)(node.outputSchema) : import_conductor26.DefaultOutput;
2446
+ anchors = createFunctionAnchors(shape, inputSchema, outputSchema);
2447
+ }
2448
+ }
2449
+ return anchors;
2450
+ }
2451
+ };
2452
+ // Annotate the CommonJS export names for ESM import in node:
2453
+ 0 && (module.exports = {
2454
+ AndShape,
2455
+ AppendComponent,
2456
+ AppendShape,
2457
+ AudioComponent,
2458
+ AudioShape,
2459
+ BeaconComponent,
2460
+ BeaconShape,
2461
+ Box,
2462
+ ChatShape,
2463
+ ComputeContext,
2464
+ ComputeGraphController,
2465
+ ComputeShape,
2466
+ ComputeShapeLayout,
2467
+ ConstantComponent,
2468
+ ConstantShape,
2469
+ DatabaseComponent,
2470
+ DatabaseShape,
2471
+ FunctionBody,
2472
+ FunctionComponent,
2473
+ FunctionShape,
2474
+ GptComponent,
2475
+ GptRealtimeComponent,
2476
+ GptRealtimeShape,
2477
+ GptShape,
2478
+ IfComponent,
2479
+ IfElseComponent,
2480
+ IfElseShape,
2481
+ IfShape,
2482
+ InvalidStateError,
2483
+ JsonComponent,
2484
+ JsonShape,
2485
+ JsonTransformComponent,
2486
+ JsonTransformShape,
2487
+ NotShape,
2488
+ OrShape,
2489
+ QueueComponent,
2490
+ QueueItem,
2491
+ QueueShape,
2492
+ RandomComponent,
2493
+ RandomShape,
2494
+ ReducerComponent,
2495
+ ReducerShape,
2496
+ ScopeComponent,
2497
+ ScopeShape,
2498
+ SurfaceComponent,
2499
+ SurfaceShape,
2500
+ SwitchComponent,
2501
+ SwitchShape,
2502
+ TableComponent,
2503
+ TableShape,
2504
+ TemplateShape,
2505
+ TextComponent,
2506
+ TextInputComponent,
2507
+ TextShape,
2508
+ TextToImageComponent,
2509
+ TextToImageShape,
2510
+ ThreadComponent,
2511
+ ThreadItem,
2512
+ ThreadShape,
2513
+ TriggerComponent,
2514
+ TriggerShape,
2515
+ TypeSelect,
2516
+ andShape,
2517
+ appendShape,
2518
+ audioShape,
2519
+ beaconShape,
2520
+ chatShape,
2521
+ computeShapes,
2522
+ constantShape,
2523
+ createAnchorId,
2524
+ createAnd,
2525
+ createAppend,
2526
+ createAudio,
2527
+ createBeacon,
2528
+ createChat,
2529
+ createComputeGraph,
2530
+ createComputeGraphController,
2531
+ createComputeNode,
2532
+ createConstant,
2533
+ createDatabase,
2534
+ createFunction,
2535
+ createFunctionAnchors,
2536
+ createGpt,
2537
+ createGptRealtime,
2538
+ createIf,
2539
+ createIfElse,
2540
+ createJson,
2541
+ createJsonTransform,
2542
+ createNot,
2543
+ createOr,
2544
+ createQueue,
2545
+ createRandom,
2546
+ createReducer,
2547
+ createScope,
2548
+ createShape,
2549
+ createSurface,
2550
+ createSwitch,
2551
+ createTable,
2552
+ createTemplate,
2553
+ createText,
2554
+ createTextToImage,
2555
+ createThread,
2556
+ createTrigger,
2557
+ databaseShape,
2558
+ footerHeight,
2559
+ functionShape,
2560
+ getHeight,
2561
+ getProperties,
2562
+ gptRealtimeShape,
2563
+ gptShape,
2564
+ headerHeight,
2565
+ ifElseShape,
2566
+ ifShape,
2567
+ isValidComputeNode,
2568
+ jsonShape,
2569
+ jsonTransformShape,
2570
+ mapEdge,
2571
+ notShape,
2572
+ orShape,
2573
+ parseAnchorId,
2574
+ queueShape,
2575
+ randomShape,
2576
+ reducerShape,
2577
+ resolveComputeNode,
2578
+ scopeShape,
2579
+ surfaceShape,
2580
+ switchShape,
2581
+ tableShape,
2582
+ templateShape,
2583
+ textShape,
2584
+ textToImageShape,
2585
+ threadShape,
2586
+ triggerShape,
2587
+ useComputeContext,
2588
+ useComputeNodeState,
2589
+ useGraphMonitor
2590
+ });
2591
+ //# sourceMappingURL=index.cjs.map