@dxos/react-ui-canvas-compute 0.8.3 → 0.8.4-main.28f8d3d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/index.mjs +191 -168
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +191 -168
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/compute.stories.d.ts +1 -1
- package/dist/types/src/compute.stories.d.ts.map +1 -1
- package/dist/types/src/graph/controller.d.ts +31 -5
- package/dist/types/src/graph/controller.d.ts.map +1 -1
- package/dist/types/src/graph/node-defs.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeGraphController.d.ts +1 -1
- package/dist/types/src/hooks/useComputeGraphController.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeNodeState.d.ts +3 -2
- package/dist/types/src/hooks/useComputeNodeState.d.ts.map +1 -1
- package/dist/types/src/hooks/useGraphMonitor.d.ts +1 -1
- package/dist/types/src/hooks/useGraphMonitor.d.ts.map +1 -1
- package/dist/types/src/shapes/Append.d.ts.map +1 -1
- package/dist/types/src/shapes/Array.d.ts.map +1 -1
- package/dist/types/src/shapes/Audio.d.ts.map +1 -1
- package/dist/types/src/shapes/Beacon.d.ts.map +1 -1
- package/dist/types/src/shapes/Boolean.d.ts.map +1 -1
- package/dist/types/src/shapes/Chat.d.ts.map +1 -1
- package/dist/types/src/shapes/Constant.d.ts +1 -1
- package/dist/types/src/shapes/Constant.d.ts.map +1 -1
- package/dist/types/src/shapes/Database.d.ts.map +1 -1
- package/dist/types/src/shapes/Function.d.ts.map +1 -1
- package/dist/types/src/shapes/Gpt.d.ts.map +1 -1
- package/dist/types/src/shapes/GptRealtime.d.ts.map +1 -1
- package/dist/types/src/shapes/Json.d.ts.map +1 -1
- package/dist/types/src/shapes/Logic.d.ts.map +1 -1
- package/dist/types/src/shapes/Queue.d.ts.map +1 -1
- package/dist/types/src/shapes/RNG.d.ts.map +1 -1
- package/dist/types/src/shapes/Scope.d.ts.map +1 -1
- package/dist/types/src/shapes/Surface.d.ts.map +1 -1
- package/dist/types/src/shapes/Switch.d.ts.map +1 -1
- package/dist/types/src/shapes/Table.d.ts.map +1 -1
- package/dist/types/src/shapes/Template.d.ts.map +1 -1
- package/dist/types/src/shapes/Text.d.ts.map +1 -1
- package/dist/types/src/shapes/TextToImage.d.ts.map +1 -1
- package/dist/types/src/shapes/Thread.d.ts.map +1 -1
- package/dist/types/src/shapes/Trigger.d.ts.map +1 -1
- package/dist/types/src/shapes/common/Box.d.ts.map +1 -1
- package/dist/types/src/testing/circuits.d.ts +1 -1
- package/dist/types/src/testing/circuits.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +47 -44
- package/src/compute.stories.tsx +17 -29
- package/src/graph/controller.ts +10 -10
- package/src/graph/node-defs.ts +4 -3
- package/src/hooks/useComputeGraphController.ts +1 -1
- package/src/hooks/useComputeNodeState.ts +6 -4
- package/src/hooks/useGraphMonitor.ts +1 -1
- package/src/registry.ts +2 -2
- package/src/schema.test.ts +2 -2
- package/src/shapes/Append.tsx +2 -2
- package/src/shapes/Array.tsx +2 -2
- package/src/shapes/Audio.tsx +3 -2
- package/src/shapes/Beacon.tsx +4 -4
- package/src/shapes/Boolean.tsx +2 -2
- package/src/shapes/Chat.tsx +3 -2
- package/src/shapes/Constant.tsx +3 -2
- package/src/shapes/Database.tsx +1 -1
- package/src/shapes/Function.tsx +8 -7
- package/src/shapes/Gpt.tsx +6 -4
- package/src/shapes/GptRealtime.tsx +1 -1
- package/src/shapes/Json.tsx +3 -2
- package/src/shapes/Logic.tsx +2 -2
- package/src/shapes/Queue.tsx +3 -2
- package/src/shapes/RNG.tsx +4 -4
- package/src/shapes/Scope.tsx +4 -3
- package/src/shapes/Surface.tsx +4 -3
- package/src/shapes/Switch.tsx +3 -2
- package/src/shapes/Table.tsx +6 -5
- package/src/shapes/Template.tsx +4 -3
- package/src/shapes/Text.tsx +4 -3
- package/src/shapes/TextToImage.tsx +1 -1
- package/src/shapes/Thread.tsx +6 -5
- package/src/shapes/Trigger.tsx +8 -8
- package/src/shapes/common/Box.tsx +2 -2
- package/src/shapes/common/FunctionBody.tsx +1 -1
- package/src/testing/circuits.ts +4 -4
- package/dist/lib/node/index.cjs +0 -2896
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
|
@@ -1,96 +1,21 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
|
|
3
|
-
//
|
|
3
|
+
// src/graph/controller.ts
|
|
4
4
|
import { Effect, Either, Exit, Scope } from "effect";
|
|
5
5
|
import { Event, synchronized } from "@dxos/async";
|
|
6
|
-
import { GraphExecutor,
|
|
6
|
+
import { GraphExecutor, ValueBag, isNotExecuted } from "@dxos/conductor";
|
|
7
7
|
import { Resource } from "@dxos/context";
|
|
8
8
|
import { log } from "@dxos/log";
|
|
9
9
|
|
|
10
|
-
//
|
|
11
|
-
import { NODE_INPUT, NODE_OUTPUT, registry, getTemplateInputSchema } from "@dxos/conductor";
|
|
12
|
-
import { raise } from "@dxos/debug";
|
|
13
|
-
import { ObjectId, toJsonSchema } from "@dxos/echo-schema";
|
|
14
|
-
import { invariant } from "@dxos/invariant";
|
|
15
|
-
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/ui/react-ui-canvas-compute/src/graph/node-defs.ts";
|
|
16
|
-
var resolveComputeNode = async (node) => {
|
|
17
|
-
const impl = registry[node.type];
|
|
18
|
-
invariant(impl, `Unknown node type: ${node.type}`, {
|
|
19
|
-
F: __dxlog_file,
|
|
20
|
-
L: 22,
|
|
21
|
-
S: void 0,
|
|
22
|
-
A: [
|
|
23
|
-
"impl",
|
|
24
|
-
"`Unknown node type: ${node.type}`"
|
|
25
|
-
]
|
|
26
|
-
});
|
|
27
|
-
return impl;
|
|
28
|
-
};
|
|
29
|
-
var isValidComputeNode = (type) => {
|
|
30
|
-
return nodeFactory[type] !== void 0;
|
|
31
|
-
};
|
|
32
|
-
var createComputeNode = (shape) => {
|
|
33
|
-
const type = shape.type ?? raise(new Error("Type not specified"));
|
|
34
|
-
const factory = nodeFactory[type] ?? raise(new Error(`Unknown shape type: ${type}`));
|
|
35
|
-
return factory(shape);
|
|
36
|
-
};
|
|
37
|
-
var nodeFactory = {
|
|
38
|
-
// System.
|
|
39
|
-
[NODE_INPUT]: () => createNode(NODE_INPUT),
|
|
40
|
-
[NODE_OUTPUT]: () => createNode(NODE_OUTPUT),
|
|
41
|
-
// Extensions.
|
|
42
|
-
["text-to-image"]: () => createNode("text-to-image"),
|
|
43
|
-
["and"]: () => createNode("and"),
|
|
44
|
-
["append"]: () => createNode("append"),
|
|
45
|
-
["audio"]: () => createNode("audio"),
|
|
46
|
-
["beacon"]: () => createNode("beacon"),
|
|
47
|
-
["chat"]: () => createNode("chat"),
|
|
48
|
-
["constant"]: (shape) => createNode("constant", {
|
|
49
|
-
value: shape.value
|
|
50
|
-
}),
|
|
51
|
-
["database"]: () => createNode("database"),
|
|
52
|
-
["gpt"]: () => createNode("gpt"),
|
|
53
|
-
["gpt-realtime"]: () => createNode("gpt-realtime"),
|
|
54
|
-
["if"]: () => createNode("if"),
|
|
55
|
-
["if-else"]: () => createNode("if-else"),
|
|
56
|
-
["function"]: () => createNode("function"),
|
|
57
|
-
["json"]: () => createNode("json"),
|
|
58
|
-
["json-transform"]: () => createNode("json-transform"),
|
|
59
|
-
["not"]: () => createNode("not"),
|
|
60
|
-
["or"]: () => createNode("or"),
|
|
61
|
-
["queue"]: () => createNode("queue"),
|
|
62
|
-
["rng"]: () => createNode("rng"),
|
|
63
|
-
["reducer"]: () => createNode("reducer"),
|
|
64
|
-
["scope"]: () => createNode("scope"),
|
|
65
|
-
["surface"]: () => createNode("surface"),
|
|
66
|
-
["switch"]: () => createNode("switch"),
|
|
67
|
-
["template"]: (shape) => {
|
|
68
|
-
const node = createNode("template", {
|
|
69
|
-
valueType: shape.valueType,
|
|
70
|
-
value: shape.text
|
|
71
|
-
});
|
|
72
|
-
node.inputSchema = toJsonSchema(getTemplateInputSchema(node));
|
|
73
|
-
return node;
|
|
74
|
-
},
|
|
75
|
-
["text"]: () => createNode("text"),
|
|
76
|
-
["thread"]: () => createNode("thread"),
|
|
77
|
-
["trigger"]: () => createNode(NODE_INPUT)
|
|
78
|
-
};
|
|
79
|
-
var createNode = (type, props) => ({
|
|
80
|
-
id: ObjectId.random(),
|
|
81
|
-
type,
|
|
82
|
-
...props
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
// packages/ui/react-ui-canvas-compute/src/hooks/compute-context.ts
|
|
10
|
+
// src/hooks/compute-context.ts
|
|
86
11
|
import { createContext, useContext } from "react";
|
|
87
|
-
import { raise
|
|
12
|
+
import { raise } from "@dxos/debug";
|
|
88
13
|
var ComputeContext = createContext(null);
|
|
89
14
|
var useComputeContext = () => {
|
|
90
|
-
return useContext(ComputeContext) ??
|
|
15
|
+
return useContext(ComputeContext) ?? raise(new Error("Missing ComputeContext"));
|
|
91
16
|
};
|
|
92
17
|
|
|
93
|
-
//
|
|
18
|
+
// src/hooks/useComputeGraphController.ts
|
|
94
19
|
import { useEffect, useState } from "react";
|
|
95
20
|
var combine = (...cbs) => {
|
|
96
21
|
return () => {
|
|
@@ -140,16 +65,16 @@ var useComputeGraphController = ({ controller, graph, editorRef }) => {
|
|
|
140
65
|
]);
|
|
141
66
|
};
|
|
142
67
|
|
|
143
|
-
//
|
|
68
|
+
// src/hooks/useComputeNodeState.ts
|
|
144
69
|
import { Schema } from "effect";
|
|
145
70
|
import { useCallback, useEffect as useEffect2, useState as useState2 } from "react";
|
|
146
|
-
import { invariant
|
|
147
|
-
var
|
|
71
|
+
import { invariant } from "@dxos/invariant";
|
|
72
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/hooks/useComputeNodeState.ts";
|
|
148
73
|
var useComputeNodeState = (shape) => {
|
|
149
74
|
const { controller } = useComputeContext();
|
|
150
|
-
|
|
151
|
-
F:
|
|
152
|
-
L:
|
|
75
|
+
invariant(controller, void 0, {
|
|
76
|
+
F: __dxlog_file,
|
|
77
|
+
L: 34,
|
|
153
78
|
S: void 0,
|
|
154
79
|
A: [
|
|
155
80
|
"controller",
|
|
@@ -160,9 +85,9 @@ var useComputeNodeState = (shape) => {
|
|
|
160
85
|
useEffect2(() => {
|
|
161
86
|
let disposed = false;
|
|
162
87
|
queueMicrotask(async () => {
|
|
163
|
-
|
|
164
|
-
F:
|
|
165
|
-
L:
|
|
88
|
+
invariant(shape.node, "Node not specified", {
|
|
89
|
+
F: __dxlog_file,
|
|
90
|
+
L: 40,
|
|
166
91
|
S: void 0,
|
|
167
92
|
A: [
|
|
168
93
|
"shape.node",
|
|
@@ -214,19 +139,19 @@ var useComputeNodeState = (shape) => {
|
|
|
214
139
|
};
|
|
215
140
|
};
|
|
216
141
|
|
|
217
|
-
//
|
|
142
|
+
// src/hooks/useGraphMonitor.ts
|
|
218
143
|
import { useMemo } from "react";
|
|
219
144
|
import { ComputeGraphModel, DEFAULT_INPUT, DEFAULT_OUTPUT } from "@dxos/conductor";
|
|
220
|
-
import { ObjectId
|
|
221
|
-
import { invariant as
|
|
145
|
+
import { ObjectId, Ref } from "@dxos/echo-schema";
|
|
146
|
+
import { invariant as invariant2 } from "@dxos/invariant";
|
|
222
147
|
import { getSpace } from "@dxos/react-client/echo";
|
|
223
148
|
import { isNonNullable } from "@dxos/util";
|
|
224
|
-
var
|
|
149
|
+
var __dxlog_file2 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/hooks/useGraphMonitor.ts";
|
|
225
150
|
var mapEdge = (graph, { source, target, output = DEFAULT_OUTPUT, input = DEFAULT_INPUT }) => {
|
|
226
151
|
const sourceNode = graph.findNode(source);
|
|
227
152
|
const targetNode = graph.findNode(target);
|
|
228
|
-
|
|
229
|
-
F:
|
|
153
|
+
invariant2(sourceNode?.node, void 0, {
|
|
154
|
+
F: __dxlog_file2,
|
|
230
155
|
L: 26,
|
|
231
156
|
S: void 0,
|
|
232
157
|
A: [
|
|
@@ -234,8 +159,8 @@ var mapEdge = (graph, { source, target, output = DEFAULT_OUTPUT, input = DEFAULT
|
|
|
234
159
|
""
|
|
235
160
|
]
|
|
236
161
|
});
|
|
237
|
-
|
|
238
|
-
F:
|
|
162
|
+
invariant2(targetNode?.node, void 0, {
|
|
163
|
+
F: __dxlog_file2,
|
|
239
164
|
L: 27,
|
|
240
165
|
S: void 0,
|
|
241
166
|
A: [
|
|
@@ -244,7 +169,7 @@ var mapEdge = (graph, { source, target, output = DEFAULT_OUTPUT, input = DEFAULT
|
|
|
244
169
|
]
|
|
245
170
|
});
|
|
246
171
|
return {
|
|
247
|
-
id:
|
|
172
|
+
id: ObjectId.random(),
|
|
248
173
|
source: sourceNode.node,
|
|
249
174
|
target: targetNode.node,
|
|
250
175
|
output,
|
|
@@ -258,8 +183,8 @@ var useGraphMonitor = (model) => {
|
|
|
258
183
|
if (!model) {
|
|
259
184
|
return;
|
|
260
185
|
}
|
|
261
|
-
|
|
262
|
-
F:
|
|
186
|
+
invariant2(node.type, void 0, {
|
|
187
|
+
F: __dxlog_file2,
|
|
263
188
|
L: 52,
|
|
264
189
|
S: void 0,
|
|
265
190
|
A: [
|
|
@@ -316,8 +241,8 @@ var createComputeGraph = (graph) => {
|
|
|
316
241
|
};
|
|
317
242
|
var linkTriggerToCompute = (graph, computeNode, triggerData) => {
|
|
318
243
|
const functionTrigger = triggerData.functionTrigger?.target;
|
|
319
|
-
|
|
320
|
-
F:
|
|
244
|
+
invariant2(functionTrigger, void 0, {
|
|
245
|
+
F: __dxlog_file2,
|
|
321
246
|
L: 115,
|
|
322
247
|
S: void 0,
|
|
323
248
|
A: [
|
|
@@ -341,14 +266,90 @@ var deleteTriggerObjects = (computeGraph, deleted) => {
|
|
|
341
266
|
}
|
|
342
267
|
};
|
|
343
268
|
|
|
344
|
-
//
|
|
269
|
+
// src/graph/node-defs.ts
|
|
270
|
+
import { NODE_INPUT, NODE_OUTPUT, getTemplateInputSchema, registry } from "@dxos/conductor";
|
|
271
|
+
import { raise as raise2 } from "@dxos/debug";
|
|
272
|
+
import { ObjectId as ObjectId2, toJsonSchema } from "@dxos/echo-schema";
|
|
273
|
+
import { invariant as invariant3 } from "@dxos/invariant";
|
|
274
|
+
var __dxlog_file3 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/graph/node-defs.ts";
|
|
275
|
+
var resolveComputeNode = async (node) => {
|
|
276
|
+
const impl = registry[node.type];
|
|
277
|
+
invariant3(impl, `Unknown node type: ${node.type}`, {
|
|
278
|
+
F: __dxlog_file3,
|
|
279
|
+
L: 22,
|
|
280
|
+
S: void 0,
|
|
281
|
+
A: [
|
|
282
|
+
"impl",
|
|
283
|
+
"`Unknown node type: ${node.type}`"
|
|
284
|
+
]
|
|
285
|
+
});
|
|
286
|
+
return impl;
|
|
287
|
+
};
|
|
288
|
+
var isValidComputeNode = (type) => {
|
|
289
|
+
return nodeFactory[type] !== void 0;
|
|
290
|
+
};
|
|
291
|
+
var createComputeNode = (shape) => {
|
|
292
|
+
const type = shape.type ?? raise2(new Error("Type not specified"));
|
|
293
|
+
const factory = nodeFactory[type] ?? raise2(new Error(`Unknown shape type: ${type}`));
|
|
294
|
+
return factory(shape);
|
|
295
|
+
};
|
|
296
|
+
var nodeFactory = {
|
|
297
|
+
// System.
|
|
298
|
+
[NODE_INPUT]: () => createNode(NODE_INPUT),
|
|
299
|
+
[NODE_OUTPUT]: () => createNode(NODE_OUTPUT),
|
|
300
|
+
// Extensions.
|
|
301
|
+
["text-to-image"]: () => createNode("text-to-image"),
|
|
302
|
+
["and"]: () => createNode("and"),
|
|
303
|
+
["append"]: () => createNode("append"),
|
|
304
|
+
["audio"]: () => createNode("audio"),
|
|
305
|
+
["beacon"]: () => createNode("beacon"),
|
|
306
|
+
["chat"]: () => createNode("chat"),
|
|
307
|
+
["constant"]: (shape) => createNode("constant", {
|
|
308
|
+
value: shape.value
|
|
309
|
+
}),
|
|
310
|
+
["make-queue"]: () => createNode("make-queue"),
|
|
311
|
+
["database"]: () => createNode("database"),
|
|
312
|
+
["gpt"]: () => createNode("gpt"),
|
|
313
|
+
["gpt-realtime"]: () => createNode("gpt-realtime"),
|
|
314
|
+
["if"]: () => createNode("if"),
|
|
315
|
+
["if-else"]: () => createNode("if-else"),
|
|
316
|
+
["function"]: () => createNode("function"),
|
|
317
|
+
["json"]: () => createNode("json"),
|
|
318
|
+
["json-transform"]: () => createNode("json-transform"),
|
|
319
|
+
["not"]: () => createNode("not"),
|
|
320
|
+
["or"]: () => createNode("or"),
|
|
321
|
+
["queue"]: () => createNode("queue"),
|
|
322
|
+
["rng"]: () => createNode("rng"),
|
|
323
|
+
["reducer"]: () => createNode("reducer"),
|
|
324
|
+
["scope"]: () => createNode("scope"),
|
|
325
|
+
["surface"]: () => createNode("surface"),
|
|
326
|
+
["switch"]: () => createNode("switch"),
|
|
327
|
+
["template"]: (shape) => {
|
|
328
|
+
const node = createNode("template", {
|
|
329
|
+
valueType: shape.valueType,
|
|
330
|
+
value: shape.text
|
|
331
|
+
});
|
|
332
|
+
node.inputSchema = toJsonSchema(getTemplateInputSchema(node));
|
|
333
|
+
return node;
|
|
334
|
+
},
|
|
335
|
+
["text"]: () => createNode("text"),
|
|
336
|
+
["thread"]: () => createNode("thread"),
|
|
337
|
+
["trigger"]: () => createNode(NODE_INPUT)
|
|
338
|
+
};
|
|
339
|
+
var createNode = (type, props) => ({
|
|
340
|
+
id: ObjectId2.random(),
|
|
341
|
+
type,
|
|
342
|
+
...props
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
// src/graph/controller.ts
|
|
345
346
|
function _ts_decorate(decorators, target, key, desc) {
|
|
346
347
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
347
348
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
348
349
|
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;
|
|
349
350
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
350
351
|
}
|
|
351
|
-
var __dxlog_file4 = "/
|
|
352
|
+
var __dxlog_file4 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/graph/controller.ts";
|
|
352
353
|
var InvalidStateError = Error;
|
|
353
354
|
var AUTO_TRIGGER_NODES = [
|
|
354
355
|
"chat",
|
|
@@ -364,6 +365,24 @@ var createComputeGraphController = (graph, serviceContainer) => {
|
|
|
364
365
|
};
|
|
365
366
|
};
|
|
366
367
|
var ComputeGraphController = class extends Resource {
|
|
368
|
+
_serviceContainer;
|
|
369
|
+
_graph;
|
|
370
|
+
_executor;
|
|
371
|
+
_diagnostics;
|
|
372
|
+
/**
|
|
373
|
+
* Canvas force-sets outputs of those nodes.
|
|
374
|
+
*/
|
|
375
|
+
_forcedOutputs;
|
|
376
|
+
/**
|
|
377
|
+
* Runtime state of the execution graph.
|
|
378
|
+
*/
|
|
379
|
+
_runtimeStateInputs;
|
|
380
|
+
_runtimeStateOutputs;
|
|
381
|
+
// TODO(burdon): Remove? Make state reactive?
|
|
382
|
+
update;
|
|
383
|
+
/** Computed result. */
|
|
384
|
+
output;
|
|
385
|
+
events;
|
|
367
386
|
constructor(_serviceContainer, _graph) {
|
|
368
387
|
super(), this._serviceContainer = _serviceContainer, this._graph = _graph, this._executor = new GraphExecutor({
|
|
369
388
|
computeNodeResolver: (node) => resolveComputeNode(node)
|
|
@@ -604,17 +623,17 @@ var computeValueBag = (bag) => {
|
|
|
604
623
|
})))).pipe(Effect.map((entries) => Object.fromEntries(entries)));
|
|
605
624
|
};
|
|
606
625
|
|
|
607
|
-
//
|
|
626
|
+
// src/registry.ts
|
|
608
627
|
import { noteShape } from "@dxos/react-ui-canvas-editor";
|
|
609
628
|
|
|
610
|
-
//
|
|
629
|
+
// src/shapes/common/Box.tsx
|
|
611
630
|
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
612
631
|
import React, { forwardRef } from "react";
|
|
613
632
|
import { invariant as invariant4 } from "@dxos/invariant";
|
|
614
633
|
import { Icon, IconButton } from "@dxos/react-ui";
|
|
615
634
|
import { useEditorContext, useShapeDef } from "@dxos/react-ui-canvas-editor";
|
|
616
635
|
import { mx } from "@dxos/react-ui-theme";
|
|
617
|
-
var __dxlog_file5 = "/
|
|
636
|
+
var __dxlog_file5 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/shapes/common/Box.tsx";
|
|
618
637
|
var headerHeight = 32;
|
|
619
638
|
var footerHeight = 32;
|
|
620
639
|
var Box = /* @__PURE__ */ forwardRef(({ children, classNames, shape, title, status, open, onAction }, forwardedRef) => {
|
|
@@ -678,15 +697,15 @@ var Box = /* @__PURE__ */ forwardRef(({ children, classNames, shape, title, stat
|
|
|
678
697
|
}
|
|
679
698
|
});
|
|
680
699
|
|
|
681
|
-
//
|
|
700
|
+
// src/shapes/common/FunctionBody.tsx
|
|
682
701
|
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
683
702
|
import { SchemaAST as SchemaAST2 } from "effect";
|
|
684
703
|
import React2, { useRef, useState as useState3 } from "react";
|
|
685
704
|
import { VoidInput, VoidOutput } from "@dxos/conductor";
|
|
686
705
|
import { useCanvasContext } from "@dxos/react-ui-canvas";
|
|
687
|
-
import {
|
|
706
|
+
import { createAnchors, getParentShapeElement, rowHeight } from "@dxos/react-ui-canvas-editor";
|
|
688
707
|
|
|
689
|
-
//
|
|
708
|
+
// src/shapes/defs.ts
|
|
690
709
|
import { Schema as Schema2, SchemaAST } from "effect";
|
|
691
710
|
import { DEFAULT_INPUT as DEFAULT_INPUT2, DEFAULT_OUTPUT as DEFAULT_OUTPUT2 } from "@dxos/conductor";
|
|
692
711
|
import { ObjectId as ObjectId3 } from "@dxos/echo-schema";
|
|
@@ -718,7 +737,7 @@ var createShape = ({ id, ...rest }) => {
|
|
|
718
737
|
};
|
|
719
738
|
};
|
|
720
739
|
|
|
721
|
-
//
|
|
740
|
+
// src/shapes/common/FunctionBody.tsx
|
|
722
741
|
var bodyPadding = 8;
|
|
723
742
|
var expandedHeight = 200;
|
|
724
743
|
var FunctionBody = ({ shape, name, content, inputSchema = VoidInput, outputSchema = VoidOutput, ...props }) => {
|
|
@@ -805,7 +824,7 @@ var createFunctionAnchors = (shape, input = VoidInput, output = VoidOutput) => {
|
|
|
805
824
|
});
|
|
806
825
|
};
|
|
807
826
|
|
|
808
|
-
//
|
|
827
|
+
// src/shapes/common/TypeSelect.tsx
|
|
809
828
|
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
810
829
|
import React3 from "react";
|
|
811
830
|
import { ComputeValueType } from "@dxos/conductor";
|
|
@@ -828,7 +847,7 @@ var TypeSelect = ({ value, onValueChange }) => {
|
|
|
828
847
|
}
|
|
829
848
|
};
|
|
830
849
|
|
|
831
|
-
//
|
|
850
|
+
// src/shapes/Array.tsx
|
|
832
851
|
import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
|
|
833
852
|
import { Schema as Schema3 } from "effect";
|
|
834
853
|
import React4 from "react";
|
|
@@ -865,7 +884,7 @@ var reducerShape = {
|
|
|
865
884
|
getAnchors: (shape) => createFunctionAnchors(shape, ReducerInput, ReducerOutput)
|
|
866
885
|
};
|
|
867
886
|
|
|
868
|
-
//
|
|
887
|
+
// src/shapes/Append.tsx
|
|
869
888
|
import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
|
|
870
889
|
import { Schema as Schema4 } from "effect";
|
|
871
890
|
import React5 from "react";
|
|
@@ -901,7 +920,7 @@ var appendShape = {
|
|
|
901
920
|
getAnchors: (shape) => createFunctionAnchors(shape, AppendInput)
|
|
902
921
|
};
|
|
903
922
|
|
|
904
|
-
//
|
|
923
|
+
// src/shapes/Audio.tsx
|
|
905
924
|
import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
|
|
906
925
|
import { Schema as Schema5 } from "effect";
|
|
907
926
|
import React6, { useEffect as useEffect3, useState as useState4 } from "react";
|
|
@@ -957,14 +976,13 @@ var audioShape = {
|
|
|
957
976
|
})
|
|
958
977
|
};
|
|
959
978
|
|
|
960
|
-
//
|
|
979
|
+
// src/shapes/Beacon.tsx
|
|
961
980
|
import { useSignals as _useSignals7 } from "@preact-signals/safe-react/tracking";
|
|
962
981
|
import { Schema as Schema6 } from "effect";
|
|
963
982
|
import React7 from "react";
|
|
964
983
|
import { DEFAULT_INPUT as DEFAULT_INPUT3, isTruthy } from "@dxos/conductor";
|
|
965
984
|
import { Icon as Icon3 } from "@dxos/react-ui";
|
|
966
985
|
import { createAnchorMap as createAnchorMap2 } from "@dxos/react-ui-canvas-editor";
|
|
967
|
-
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
968
986
|
var BeaconShape = Schema6.extend(ComputeShape, Schema6.Struct({
|
|
969
987
|
type: Schema6.Literal("beacon")
|
|
970
988
|
}));
|
|
@@ -986,7 +1004,10 @@ var BeaconComponent = ({ shape }) => {
|
|
|
986
1004
|
className: "flex w-full justify-center items-center"
|
|
987
1005
|
}, /* @__PURE__ */ React7.createElement(Icon3, {
|
|
988
1006
|
icon: "ph--sun--regular",
|
|
989
|
-
classNames:
|
|
1007
|
+
classNames: [
|
|
1008
|
+
"transition opacity-20 duration-1000",
|
|
1009
|
+
isTruthy(value) && "opacity-100 text-yellow-500"
|
|
1010
|
+
],
|
|
990
1011
|
size: 8
|
|
991
1012
|
}));
|
|
992
1013
|
} finally {
|
|
@@ -1007,7 +1028,7 @@ var beaconShape = {
|
|
|
1007
1028
|
})
|
|
1008
1029
|
};
|
|
1009
1030
|
|
|
1010
|
-
//
|
|
1031
|
+
// src/shapes/Boolean.tsx
|
|
1011
1032
|
import { Schema as Schema7 } from "effect";
|
|
1012
1033
|
import React8 from "react";
|
|
1013
1034
|
import { getAnchorPoints } from "@dxos/react-ui-canvas-editor";
|
|
@@ -1180,7 +1201,7 @@ var notShape = defineShape({
|
|
|
1180
1201
|
]
|
|
1181
1202
|
});
|
|
1182
1203
|
|
|
1183
|
-
//
|
|
1204
|
+
// src/shapes/Chat.tsx
|
|
1184
1205
|
import { useSignals as _useSignals8 } from "@preact-signals/safe-react/tracking";
|
|
1185
1206
|
import { Schema as Schema8 } from "effect";
|
|
1186
1207
|
import React9, { useRef as useRef2 } from "react";
|
|
@@ -1241,7 +1262,7 @@ var chatShape = {
|
|
|
1241
1262
|
resizable: true
|
|
1242
1263
|
};
|
|
1243
1264
|
|
|
1244
|
-
//
|
|
1265
|
+
// src/shapes/Constant.tsx
|
|
1245
1266
|
import { useSignals as _useSignals9 } from "@preact-signals/safe-react/tracking";
|
|
1246
1267
|
import { Schema as Schema9 } from "effect";
|
|
1247
1268
|
import React10, { useCallback as useCallback2, useRef as useRef3, useState as useState5 } from "react";
|
|
@@ -1344,7 +1365,7 @@ var constantShape = {
|
|
|
1344
1365
|
resizable: true
|
|
1345
1366
|
};
|
|
1346
1367
|
|
|
1347
|
-
//
|
|
1368
|
+
// src/shapes/Database.tsx
|
|
1348
1369
|
import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
|
|
1349
1370
|
import { Schema as Schema10 } from "effect";
|
|
1350
1371
|
import React11 from "react";
|
|
@@ -1384,15 +1405,15 @@ var databaseShape = {
|
|
|
1384
1405
|
})
|
|
1385
1406
|
};
|
|
1386
1407
|
|
|
1387
|
-
//
|
|
1408
|
+
// src/shapes/Function.tsx
|
|
1388
1409
|
import { useSignals as _useSignals11 } from "@preact-signals/safe-react/tracking";
|
|
1389
1410
|
import { Schema as Schema11 } from "effect";
|
|
1390
1411
|
import React12, { useCallback as useCallback3, useRef as useRef4 } from "react";
|
|
1391
1412
|
import { AnyOutput, FunctionInput } from "@dxos/conductor";
|
|
1392
|
-
import {
|
|
1413
|
+
import { Ref as Ref2, getSnapshot, isInstanceOf } from "@dxos/echo-schema";
|
|
1393
1414
|
import { FunctionType, ScriptType } from "@dxos/functions";
|
|
1394
1415
|
import { useClient } from "@dxos/react-client";
|
|
1395
|
-
import { Filter,
|
|
1416
|
+
import { Filter, parseId } from "@dxos/react-client/echo";
|
|
1396
1417
|
import { TextBox as TextBox3 } from "@dxos/react-ui-canvas-editor";
|
|
1397
1418
|
var FunctionShape = Schema11.extend(ComputeShape, Schema11.Struct({
|
|
1398
1419
|
type: Schema11.Literal("function")
|
|
@@ -1429,7 +1450,7 @@ var TextInputComponent2 = ({ shape, title, ...props }) => {
|
|
|
1429
1450
|
return;
|
|
1430
1451
|
}
|
|
1431
1452
|
node.value = value;
|
|
1432
|
-
node.function =
|
|
1453
|
+
node.function = Ref2.make(fn);
|
|
1433
1454
|
node.inputSchema = getSnapshot(fn.inputSchema);
|
|
1434
1455
|
node.outputSchema = getSnapshot(fn.outputSchema);
|
|
1435
1456
|
}, [
|
|
@@ -1469,7 +1490,7 @@ var functionShape = {
|
|
|
1469
1490
|
getAnchors: (shape) => createFunctionAnchors(shape, FunctionInput, AnyOutput)
|
|
1470
1491
|
};
|
|
1471
1492
|
|
|
1472
|
-
//
|
|
1493
|
+
// src/shapes/Gpt.tsx
|
|
1473
1494
|
import { useSignals as _useSignals12 } from "@preact-signals/safe-react/tracking";
|
|
1474
1495
|
import { Schema as Schema12 } from "effect";
|
|
1475
1496
|
import React13, { useEffect as useEffect4, useState as useState6 } from "react";
|
|
@@ -1545,7 +1566,7 @@ var gptShape = {
|
|
|
1545
1566
|
openable: true
|
|
1546
1567
|
};
|
|
1547
1568
|
|
|
1548
|
-
//
|
|
1569
|
+
// src/shapes/Json.tsx
|
|
1549
1570
|
import { useSignals as _useSignals13 } from "@preact-signals/safe-react/tracking";
|
|
1550
1571
|
import { Schema as Schema13 } from "effect";
|
|
1551
1572
|
import React14 from "react";
|
|
@@ -1628,7 +1649,7 @@ var jsonTransformShape = {
|
|
|
1628
1649
|
resizable: true
|
|
1629
1650
|
};
|
|
1630
1651
|
|
|
1631
|
-
//
|
|
1652
|
+
// src/shapes/Logic.tsx
|
|
1632
1653
|
import { useSignals as _useSignals14 } from "@preact-signals/safe-react/tracking";
|
|
1633
1654
|
import { Schema as Schema14 } from "effect";
|
|
1634
1655
|
import React15 from "react";
|
|
@@ -1696,12 +1717,12 @@ var ifElseShape = {
|
|
|
1696
1717
|
getAnchors: (shape) => createFunctionAnchors(shape, IfElseInput, IfElseOutput)
|
|
1697
1718
|
};
|
|
1698
1719
|
|
|
1699
|
-
//
|
|
1720
|
+
// src/shapes/Queue.tsx
|
|
1700
1721
|
import { useSignals as _useSignals15 } from "@preact-signals/safe-react/tracking";
|
|
1701
1722
|
import { Schema as Schema15 } from "effect";
|
|
1702
1723
|
import React16, { Fragment } from "react";
|
|
1703
1724
|
import { DEFAULT_OUTPUT as DEFAULT_OUTPUT4, QueueInput, QueueOutput } from "@dxos/conductor";
|
|
1704
|
-
import { mx as
|
|
1725
|
+
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
1705
1726
|
var QueueShape = Schema15.extend(ComputeShape, Schema15.Struct({
|
|
1706
1727
|
type: Schema15.Literal("queue")
|
|
1707
1728
|
}));
|
|
@@ -1745,11 +1766,11 @@ var QueueItem = ({ classNames, item }) => {
|
|
|
1745
1766
|
try {
|
|
1746
1767
|
if (typeof item !== "object") {
|
|
1747
1768
|
return /* @__PURE__ */ React16.createElement("div", {
|
|
1748
|
-
className:
|
|
1769
|
+
className: mx2(classNames, "whitespace-pre-wrap")
|
|
1749
1770
|
}, item);
|
|
1750
1771
|
}
|
|
1751
1772
|
return /* @__PURE__ */ React16.createElement("div", {
|
|
1752
|
-
className:
|
|
1773
|
+
className: mx2("grid grid-cols-[80px,1fr]", classNames)
|
|
1753
1774
|
}, Object.entries(item).map(([key, value]) => /* @__PURE__ */ React16.createElement(Fragment, {
|
|
1754
1775
|
key
|
|
1755
1776
|
}, /* @__PURE__ */ React16.createElement("div", {
|
|
@@ -1769,14 +1790,13 @@ var queueShape = {
|
|
|
1769
1790
|
resizable: true
|
|
1770
1791
|
};
|
|
1771
1792
|
|
|
1772
|
-
//
|
|
1793
|
+
// src/shapes/RNG.tsx
|
|
1773
1794
|
import { useSignals as _useSignals16 } from "@preact-signals/safe-react/tracking";
|
|
1774
1795
|
import { Schema as Schema16 } from "effect";
|
|
1775
1796
|
import React17, { useEffect as useEffect5, useState as useState7 } from "react";
|
|
1776
1797
|
import { DEFAULT_OUTPUT as DEFAULT_OUTPUT5 } from "@dxos/conductor";
|
|
1777
1798
|
import { Icon as Icon4 } from "@dxos/react-ui";
|
|
1778
1799
|
import { createAnchorMap as createAnchorMap7 } from "@dxos/react-ui-canvas-editor";
|
|
1779
|
-
import { mx as mx4 } from "@dxos/react-ui-theme";
|
|
1780
1800
|
var RandomShape = Schema16.extend(ComputeShape, Schema16.Struct({
|
|
1781
1801
|
type: Schema16.Literal("rng"),
|
|
1782
1802
|
min: Schema16.optional(Schema16.Number),
|
|
@@ -1829,7 +1849,7 @@ var RandomComponent = ({ shape }) => {
|
|
|
1829
1849
|
className: "flex grow items-center justify-center"
|
|
1830
1850
|
}, /* @__PURE__ */ React17.createElement(Icon4, {
|
|
1831
1851
|
icon,
|
|
1832
|
-
classNames:
|
|
1852
|
+
classNames: spin && "animate-[spin_1s]",
|
|
1833
1853
|
size: 10,
|
|
1834
1854
|
onClick: handleClick
|
|
1835
1855
|
}));
|
|
@@ -1851,13 +1871,13 @@ var randomShape = {
|
|
|
1851
1871
|
})
|
|
1852
1872
|
};
|
|
1853
1873
|
|
|
1854
|
-
//
|
|
1874
|
+
// src/shapes/Scope.tsx
|
|
1855
1875
|
import { useSignals as _useSignals17 } from "@preact-signals/safe-react/tracking";
|
|
1856
1876
|
import { Schema as Schema17 } from "effect";
|
|
1857
1877
|
import React18 from "react";
|
|
1858
1878
|
import { DEFAULT_INPUT as DEFAULT_INPUT5 } from "@dxos/conductor";
|
|
1859
1879
|
import { createAnchorMap as createAnchorMap8 } from "@dxos/react-ui-canvas-editor";
|
|
1860
|
-
import {
|
|
1880
|
+
import { Chaos, shaderPresets, useAudioStream } from "@dxos/react-ui-sfx";
|
|
1861
1881
|
var ScopeShape = Schema17.extend(ComputeShape, Schema17.Struct({
|
|
1862
1882
|
type: Schema17.Literal("scope")
|
|
1863
1883
|
}));
|
|
@@ -1905,7 +1925,7 @@ var scopeShape = {
|
|
|
1905
1925
|
})
|
|
1906
1926
|
};
|
|
1907
1927
|
|
|
1908
|
-
//
|
|
1928
|
+
// src/shapes/Surface.tsx
|
|
1909
1929
|
import { useSignals as _useSignals18 } from "@preact-signals/safe-react/tracking";
|
|
1910
1930
|
import { Schema as Schema18 } from "effect";
|
|
1911
1931
|
import React19 from "react";
|
|
@@ -1938,7 +1958,7 @@ var SurfaceComponent = ({ shape }) => {
|
|
|
1938
1958
|
shape,
|
|
1939
1959
|
onAction: handleAction
|
|
1940
1960
|
}, value !== null && /* @__PURE__ */ React19.createElement(Surface, {
|
|
1941
|
-
role: "
|
|
1961
|
+
role: "card--extrinsic",
|
|
1942
1962
|
data: {
|
|
1943
1963
|
value
|
|
1944
1964
|
},
|
|
@@ -1963,7 +1983,7 @@ var surfaceShape = {
|
|
|
1963
1983
|
resizable: true
|
|
1964
1984
|
};
|
|
1965
1985
|
|
|
1966
|
-
//
|
|
1986
|
+
// src/shapes/Switch.tsx
|
|
1967
1987
|
import { useSignals as _useSignals19 } from "@preact-signals/safe-react/tracking";
|
|
1968
1988
|
import { Schema as Schema19 } from "effect";
|
|
1969
1989
|
import React20, { useEffect as useEffect6, useState as useState8 } from "react";
|
|
@@ -2016,13 +2036,14 @@ var switchShape = {
|
|
|
2016
2036
|
})
|
|
2017
2037
|
};
|
|
2018
2038
|
|
|
2019
|
-
//
|
|
2039
|
+
// src/shapes/Table.tsx
|
|
2020
2040
|
import { useSignals as _useSignals20 } from "@preact-signals/safe-react/tracking";
|
|
2021
2041
|
import { Schema as Schema20 } from "effect";
|
|
2022
2042
|
import React21 from "react";
|
|
2023
|
-
import { createInputSchema, createOutputSchema
|
|
2024
|
-
|
|
2025
|
-
var
|
|
2043
|
+
import { createInputSchema, createOutputSchema } from "@dxos/conductor";
|
|
2044
|
+
import { DataType } from "@dxos/schema";
|
|
2045
|
+
var InputSchema = createInputSchema(DataType.Message);
|
|
2046
|
+
var OutputSchema = createOutputSchema(Schema20.mutable(Schema20.Array(DataType.Message)));
|
|
2026
2047
|
var TableShape = Schema20.extend(ComputeShape, Schema20.Struct({
|
|
2027
2048
|
type: Schema20.Literal("table")
|
|
2028
2049
|
}));
|
|
@@ -2054,15 +2075,15 @@ var tableShape = {
|
|
|
2054
2075
|
resizable: true
|
|
2055
2076
|
};
|
|
2056
2077
|
|
|
2057
|
-
//
|
|
2078
|
+
// src/shapes/Template.tsx
|
|
2058
2079
|
import { useSignals as _useSignals21 } from "@preact-signals/safe-react/tracking";
|
|
2059
2080
|
import { Schema as Schema21 } from "effect";
|
|
2060
2081
|
import React22, { useRef as useRef5 } from "react";
|
|
2061
|
-
import { ComputeValueType as ComputeValueType3,
|
|
2082
|
+
import { ComputeValueType as ComputeValueType3, TemplateOutput, VoidInput as VoidInput2, getTemplateInputSchema as getTemplateInputSchema2 } from "@dxos/conductor";
|
|
2062
2083
|
import { toJsonSchema as toJsonSchema2 } from "@dxos/echo-schema";
|
|
2063
2084
|
import { invariant as invariant5 } from "@dxos/invariant";
|
|
2064
2085
|
import { TextBox as TextBox4 } from "@dxos/react-ui-canvas-editor";
|
|
2065
|
-
var __dxlog_file6 = "/
|
|
2086
|
+
var __dxlog_file6 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/shapes/Template.tsx";
|
|
2066
2087
|
var TemplateShape = Schema21.extend(ComputeShape, Schema21.Struct({
|
|
2067
2088
|
type: Schema21.Literal("template"),
|
|
2068
2089
|
valueType: Schema21.optional(ComputeValueType3)
|
|
@@ -2083,7 +2104,7 @@ var TextInputComponent3 = ({ shape, title, ...props }) => {
|
|
|
2083
2104
|
const handleTypeChange = (newType) => {
|
|
2084
2105
|
invariant5(Schema21.is(ComputeValueType3)(newType), "Invalid type", {
|
|
2085
2106
|
F: __dxlog_file6,
|
|
2086
|
-
L:
|
|
2107
|
+
L: 59,
|
|
2087
2108
|
S: void 0,
|
|
2088
2109
|
A: [
|
|
2089
2110
|
"Schema.is(ComputeValueType)(newType)",
|
|
@@ -2133,7 +2154,7 @@ var templateShape = {
|
|
|
2133
2154
|
resizable: true
|
|
2134
2155
|
};
|
|
2135
2156
|
|
|
2136
|
-
//
|
|
2157
|
+
// src/shapes/Text.tsx
|
|
2137
2158
|
import { useSignals as _useSignals22 } from "@preact-signals/safe-react/tracking";
|
|
2138
2159
|
import { Schema as Schema22 } from "effect";
|
|
2139
2160
|
import React23 from "react";
|
|
@@ -2187,14 +2208,15 @@ var textShape = {
|
|
|
2187
2208
|
resizable: true
|
|
2188
2209
|
};
|
|
2189
2210
|
|
|
2190
|
-
//
|
|
2211
|
+
// src/shapes/Thread.tsx
|
|
2191
2212
|
import { useSignals as _useSignals23 } from "@preact-signals/safe-react/tracking";
|
|
2192
2213
|
import { Schema as Schema23 } from "effect";
|
|
2193
2214
|
import React24, { useEffect as useEffect7, useRef as useRef6 } from "react";
|
|
2194
|
-
import { createInputSchema as createInputSchema2, createOutputSchema as createOutputSchema2
|
|
2195
|
-
import { mx as
|
|
2196
|
-
|
|
2197
|
-
var
|
|
2215
|
+
import { createInputSchema as createInputSchema2, createOutputSchema as createOutputSchema2 } from "@dxos/conductor";
|
|
2216
|
+
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
2217
|
+
import { DataType as DataType2 } from "@dxos/schema";
|
|
2218
|
+
var InputSchema2 = createInputSchema2(DataType2.Message);
|
|
2219
|
+
var OutputSchema2 = createOutputSchema2(Schema23.mutable(Schema23.Array(DataType2.Message)));
|
|
2198
2220
|
var ThreadShape = Schema23.extend(ComputeShape, Schema23.Struct({
|
|
2199
2221
|
type: Schema23.Literal("thread")
|
|
2200
2222
|
}));
|
|
@@ -2238,14 +2260,14 @@ var ThreadItem = ({ classNames, item }) => {
|
|
|
2238
2260
|
try {
|
|
2239
2261
|
if (typeof item !== "object") {
|
|
2240
2262
|
return /* @__PURE__ */ React24.createElement("div", {
|
|
2241
|
-
className:
|
|
2263
|
+
className: mx3(classNames)
|
|
2242
2264
|
}, item);
|
|
2243
2265
|
}
|
|
2244
2266
|
const { role, message } = item;
|
|
2245
2267
|
return /* @__PURE__ */ React24.createElement("div", {
|
|
2246
|
-
className:
|
|
2268
|
+
className: mx3("flex", classNames, role === "user" && "justify-end")
|
|
2247
2269
|
}, /* @__PURE__ */ React24.createElement("div", {
|
|
2248
|
-
className:
|
|
2270
|
+
className: mx3("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")
|
|
2249
2271
|
}, message));
|
|
2250
2272
|
} finally {
|
|
2251
2273
|
_effect.f();
|
|
@@ -2261,7 +2283,7 @@ var threadShape = {
|
|
|
2261
2283
|
resizable: true
|
|
2262
2284
|
};
|
|
2263
2285
|
|
|
2264
|
-
//
|
|
2286
|
+
// src/shapes/TextToImage.tsx
|
|
2265
2287
|
import { useSignals as _useSignals24 } from "@preact-signals/safe-react/tracking";
|
|
2266
2288
|
import { Schema as Schema24 } from "effect";
|
|
2267
2289
|
import React25 from "react";
|
|
@@ -2301,15 +2323,15 @@ var textToImageShape = {
|
|
|
2301
2323
|
})
|
|
2302
2324
|
};
|
|
2303
2325
|
|
|
2304
|
-
//
|
|
2326
|
+
// src/shapes/Trigger.tsx
|
|
2305
2327
|
import { useSignals as _useSignals25 } from "@preact-signals/safe-react/tracking";
|
|
2306
2328
|
import { Schema as Schema25 } from "effect";
|
|
2307
2329
|
import React26, { useEffect as useEffect8 } from "react";
|
|
2308
2330
|
import { VoidInput as VoidInput3 } from "@dxos/conductor";
|
|
2309
2331
|
import { ObjectId as ObjectId4, Ref as Ref3 } from "@dxos/echo-schema";
|
|
2310
|
-
import {
|
|
2332
|
+
import { EmailTriggerOutput, FunctionTrigger, QueueTriggerOutput, SubscriptionTriggerOutput, TimerTriggerOutput, TriggerKind, WebhookTriggerOutput } from "@dxos/functions";
|
|
2311
2333
|
import { DXN, SpaceId } from "@dxos/keys";
|
|
2312
|
-
import { live,
|
|
2334
|
+
import { live, useSpace } from "@dxos/react-client/echo";
|
|
2313
2335
|
import { Select as Select2 } from "@dxos/react-ui";
|
|
2314
2336
|
var TriggerShape = Schema25.extend(ComputeShape, Schema25.Struct({
|
|
2315
2337
|
type: Schema25.Literal("trigger"),
|
|
@@ -2322,7 +2344,7 @@ var createTrigger = (props) => {
|
|
|
2322
2344
|
});
|
|
2323
2345
|
return createShape({
|
|
2324
2346
|
type: "trigger",
|
|
2325
|
-
functionTrigger:
|
|
2347
|
+
functionTrigger: Ref3.make(functionTrigger),
|
|
2326
2348
|
size: {
|
|
2327
2349
|
width: 192,
|
|
2328
2350
|
height: getHeight(EmailTriggerOutput)
|
|
@@ -2446,14 +2468,14 @@ var triggerShape = {
|
|
|
2446
2468
|
getAnchors: (shape) => createFunctionAnchors(shape, VoidInput3, getOutputSchema(shape.functionTrigger?.target?.spec?.kind ?? TriggerKind.Email))
|
|
2447
2469
|
};
|
|
2448
2470
|
|
|
2449
|
-
//
|
|
2471
|
+
// src/shapes/GptRealtime.tsx
|
|
2450
2472
|
import { useSignals as _useSignals26 } from "@preact-signals/safe-react/tracking";
|
|
2451
2473
|
import { Schema as Schema26 } from "effect";
|
|
2452
2474
|
import React27, { useState as useState9 } from "react";
|
|
2453
2475
|
import { log as log2 } from "@dxos/log";
|
|
2454
2476
|
import { useConfig } from "@dxos/react-client";
|
|
2455
2477
|
import { Icon as Icon5 } from "@dxos/react-ui";
|
|
2456
|
-
var __dxlog_file7 = "/
|
|
2478
|
+
var __dxlog_file7 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/shapes/GptRealtime.tsx";
|
|
2457
2479
|
var GptRealtimeShape = Schema26.extend(ComputeShape, Schema26.Struct({
|
|
2458
2480
|
type: Schema26.Literal("gpt-realtime")
|
|
2459
2481
|
}));
|
|
@@ -2580,7 +2602,7 @@ var gptRealtimeShape = {
|
|
|
2580
2602
|
};
|
|
2581
2603
|
var DEFAULT_AI_SERVICE_URL = "http://localhost:8788";
|
|
2582
2604
|
|
|
2583
|
-
//
|
|
2605
|
+
// src/registry.ts
|
|
2584
2606
|
var computeShapes = [
|
|
2585
2607
|
{
|
|
2586
2608
|
title: "Inputs",
|
|
@@ -2642,11 +2664,12 @@ var computeShapes = [
|
|
|
2642
2664
|
}
|
|
2643
2665
|
];
|
|
2644
2666
|
|
|
2645
|
-
//
|
|
2667
|
+
// src/compute-layout.ts
|
|
2646
2668
|
import { DefaultInput, DefaultOutput as DefaultOutput2 } from "@dxos/conductor";
|
|
2647
2669
|
import { toEffectSchema } from "@dxos/echo-schema";
|
|
2648
2670
|
import { ShapeLayout } from "@dxos/react-ui-canvas-editor";
|
|
2649
2671
|
var ComputeShapeLayout = class extends ShapeLayout {
|
|
2672
|
+
_controller;
|
|
2650
2673
|
constructor(_controller, registry2) {
|
|
2651
2674
|
super(registry2), this._controller = _controller;
|
|
2652
2675
|
}
|