@dxos/react-ui-canvas-compute 0.8.4-main.422d1c7879 → 0.8.4-main.4668b7de9b

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 (84) hide show
  1. package/LICENSE +102 -5
  2. package/dist/lib/browser/index.mjs +79 -144
  3. package/dist/lib/browser/index.mjs.map +3 -3
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/node-esm/index.mjs +79 -144
  6. package/dist/lib/node-esm/index.mjs.map +3 -3
  7. package/dist/lib/node-esm/meta.json +1 -1
  8. package/dist/types/src/components/DiagnosticOverlay.d.ts.map +1 -1
  9. package/dist/types/src/compute-layout.d.ts.map +1 -1
  10. package/dist/types/src/compute.stories.d.ts +1 -1
  11. package/dist/types/src/compute.stories.d.ts.map +1 -1
  12. package/dist/types/src/graph/controller.d.ts +44 -31
  13. package/dist/types/src/graph/controller.d.ts.map +1 -1
  14. package/dist/types/src/graph/node-defs.d.ts.map +1 -1
  15. package/dist/types/src/hooks/useComputeGraphController.d.ts.map +1 -1
  16. package/dist/types/src/hooks/useComputeNodeState.d.ts +2 -3
  17. package/dist/types/src/hooks/useComputeNodeState.d.ts.map +1 -1
  18. package/dist/types/src/hooks/useGraphMonitor.d.ts.map +1 -1
  19. package/dist/types/src/shapes/Append.d.ts +1 -1
  20. package/dist/types/src/shapes/Append.d.ts.map +1 -1
  21. package/dist/types/src/shapes/Array.d.ts +1 -1
  22. package/dist/types/src/shapes/Array.d.ts.map +1 -1
  23. package/dist/types/src/shapes/Audio.d.ts +1 -1
  24. package/dist/types/src/shapes/Audio.d.ts.map +1 -1
  25. package/dist/types/src/shapes/Beacon.d.ts +1 -1
  26. package/dist/types/src/shapes/Beacon.d.ts.map +1 -1
  27. package/dist/types/src/shapes/Boolean.d.ts +7 -7
  28. package/dist/types/src/shapes/Boolean.d.ts.map +1 -1
  29. package/dist/types/src/shapes/Chat.d.ts +1 -1
  30. package/dist/types/src/shapes/Chat.d.ts.map +1 -1
  31. package/dist/types/src/shapes/Constant.d.ts +1 -1
  32. package/dist/types/src/shapes/Constant.d.ts.map +1 -1
  33. package/dist/types/src/shapes/Database.d.ts +1 -1
  34. package/dist/types/src/shapes/Database.d.ts.map +1 -1
  35. package/dist/types/src/shapes/Feed.d.ts +1 -1
  36. package/dist/types/src/shapes/Feed.d.ts.map +1 -1
  37. package/dist/types/src/shapes/Function.d.ts +1 -1
  38. package/dist/types/src/shapes/Function.d.ts.map +1 -1
  39. package/dist/types/src/shapes/Gpt.d.ts +1 -1
  40. package/dist/types/src/shapes/Gpt.d.ts.map +1 -1
  41. package/dist/types/src/shapes/GptRealtime.d.ts +1 -1
  42. package/dist/types/src/shapes/GptRealtime.d.ts.map +1 -1
  43. package/dist/types/src/shapes/Json.d.ts +2 -2
  44. package/dist/types/src/shapes/Json.d.ts.map +1 -1
  45. package/dist/types/src/shapes/Logic.d.ts +2 -2
  46. package/dist/types/src/shapes/Logic.d.ts.map +1 -1
  47. package/dist/types/src/shapes/RNG.d.ts +2 -2
  48. package/dist/types/src/shapes/RNG.d.ts.map +1 -1
  49. package/dist/types/src/shapes/Scope.d.ts +1 -1
  50. package/dist/types/src/shapes/Scope.d.ts.map +1 -1
  51. package/dist/types/src/shapes/Surface.d.ts +1 -1
  52. package/dist/types/src/shapes/Surface.d.ts.map +1 -1
  53. package/dist/types/src/shapes/Switch.d.ts +1 -1
  54. package/dist/types/src/shapes/Switch.d.ts.map +1 -1
  55. package/dist/types/src/shapes/Table.d.ts +1 -1
  56. package/dist/types/src/shapes/Table.d.ts.map +1 -1
  57. package/dist/types/src/shapes/Template.d.ts +2 -2
  58. package/dist/types/src/shapes/Template.d.ts.map +1 -1
  59. package/dist/types/src/shapes/Text.d.ts +1 -1
  60. package/dist/types/src/shapes/Text.d.ts.map +1 -1
  61. package/dist/types/src/shapes/TextToImage.d.ts +1 -1
  62. package/dist/types/src/shapes/TextToImage.d.ts.map +1 -1
  63. package/dist/types/src/shapes/Thread.d.ts +1 -1
  64. package/dist/types/src/shapes/Thread.d.ts.map +1 -1
  65. package/dist/types/src/shapes/Trigger.d.ts +7 -30
  66. package/dist/types/src/shapes/Trigger.d.ts.map +1 -1
  67. package/dist/types/src/shapes/common/FunctionBody.d.ts.map +1 -1
  68. package/dist/types/src/shapes/common/TypeSelect.d.ts +1 -1
  69. package/dist/types/src/shapes/common/TypeSelect.d.ts.map +1 -1
  70. package/dist/types/src/shapes/defs.d.ts +1 -1
  71. package/dist/types/src/shapes/defs.d.ts.map +1 -1
  72. package/dist/types/src/testing/circuits.d.ts.map +1 -1
  73. package/dist/types/tsconfig.tsbuildinfo +1 -1
  74. package/package.json +45 -45
  75. package/src/compute.stories.tsx +4 -4
  76. package/src/graph/controller.ts +67 -22
  77. package/src/hooks/useComputeNodeState.ts +3 -4
  78. package/src/hooks/useGraphMonitor.ts +1 -1
  79. package/src/shapes/Function.tsx +4 -3
  80. package/src/shapes/Table.tsx +3 -2
  81. package/src/shapes/Thread.tsx +4 -7
  82. package/src/shapes/Trigger.tsx +15 -10
  83. package/src/shapes/common/Box.tsx +1 -1
  84. package/src/testing/circuits.ts +3 -3
package/LICENSE CHANGED
@@ -1,8 +1,105 @@
1
- MIT License
2
- Copyright (c) 2022 DXOS
1
+ # Functional Source License, Version 1.1, ALv2 Future License
3
2
 
4
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3
+ ## Abbreviation
5
4
 
6
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5
+ FSL-1.1-Apache-2.0
7
6
 
8
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7
+ ## Notice
8
+
9
+ Copyright 2026 DXOS
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Patents,
26
+ Redistribution and Trademark clauses below, we hereby grant you the right to
27
+ use, copy, modify, create derivative works, publicly perform, publicly display
28
+ and redistribute the Software for any Permitted Purpose identified below.
29
+
30
+ ### Permitted Purpose
31
+
32
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
33
+ means making the Software available to others in a commercial product or
34
+ service that:
35
+
36
+ 1. substitutes for the Software;
37
+
38
+ 2. substitutes for any other product or service we offer using the Software
39
+ that exists as of the date we make the Software available; or
40
+
41
+ 3. offers the same or substantially similar functionality as the Software.
42
+
43
+ Permitted Purposes specifically include using the Software:
44
+
45
+ 1. for your internal use and access;
46
+
47
+ 2. for non-commercial education;
48
+
49
+ 3. for non-commercial research; and
50
+
51
+ 4. in connection with professional services that you provide to a licensee
52
+ using the Software in accordance with these Terms and Conditions.
53
+
54
+ ### Patents
55
+
56
+ To the extent your use for a Permitted Purpose would necessarily infringe our
57
+ patents, the license grant above includes a license under our patents. If you
58
+ make a claim against any party that the Software infringes or contributes to
59
+ the infringement of any patent, then your patent license to the Software ends
60
+ immediately.
61
+
62
+ ### Redistribution
63
+
64
+ The Terms and Conditions apply to all copies, modifications and derivatives of
65
+ the Software.
66
+
67
+ If you redistribute any copies, modifications or derivatives of the Software,
68
+ you must include a copy of or a link to these Terms and Conditions and not
69
+ remove any copyright notices provided in or with the Software.
70
+
71
+ ### Disclaimer
72
+
73
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
74
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
75
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
+
77
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
78
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
79
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
+
81
+ ### Trademarks
82
+
83
+ Except for displaying the License Details and identifying us as the origin of
84
+ the Software, you have no right under these Terms and Conditions to use our
85
+ trademarks, trade names, service marks or product names.
86
+
87
+ ## Grant of Future License
88
+
89
+ We hereby irrevocably grant you an additional license to use the Software under
90
+ the Apache License, Version 2.0 that is effective on the second anniversary of
91
+ the date we make the Software available. On or after that date, you may use the
92
+ Software under the Apache License, Version 2.0, in which case the following
93
+ will apply:
94
+
95
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
96
+ this file except in compliance with the License.
97
+
98
+ You may obtain a copy of the License at
99
+
100
+ http://www.apache.org/licenses/LICENSE-2.0
101
+
102
+ Unless required by applicable law or agreed to in writing, software distributed
103
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
104
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
105
+ specific language governing permissions and limitations under the License.
@@ -7,10 +7,10 @@ import * as Exit from "effect/Exit";
7
7
  import * as Layer from "effect/Layer";
8
8
  import * as Scope from "effect/Scope";
9
9
  import { Event, synchronized } from "@dxos/async";
10
- import { GraphExecutor, ValueBag, isNotExecuted } from "@dxos/conductor";
10
+ import { Trace } from "@dxos/compute";
11
+ import { ComputeBeginEvent, ComputeCustomEvent, ComputeEndEvent, ComputeInputEvent, ComputeNodeContext, ComputeOutputEvent, GraphExecutor, ValueBag, isNotExecuted } from "@dxos/conductor";
11
12
  import { Resource } from "@dxos/context";
12
13
  import { unwrapExit } from "@dxos/effect";
13
- import { ComputeEventLogger, Trace } from "@dxos/functions";
14
14
  import { log } from "@dxos/log";
15
15
 
16
16
  // src/hooks/compute-context.ts
@@ -78,28 +78,12 @@ import { invariant } from "@dxos/invariant";
78
78
  var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/hooks/useComputeNodeState.ts";
79
79
  var useComputeNodeState = (shape) => {
80
80
  const { controller } = useComputeContext();
81
- invariant(controller, void 0, {
82
- F: __dxlog_file,
83
- L: 33,
84
- S: void 0,
85
- A: [
86
- "controller",
87
- ""
88
- ]
89
- });
81
+ invariant(controller, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 12, S: void 0, A: ["controller", ""] });
90
82
  const [meta, setMeta] = useState2();
91
83
  useEffect2(() => {
92
84
  let disposed = false;
93
85
  queueMicrotask(async () => {
94
- invariant(shape.node, "Node not specified", {
95
- F: __dxlog_file,
96
- L: 39,
97
- S: void 0,
98
- A: [
99
- "shape.node",
100
- "'Node not specified'"
101
- ]
102
- });
86
+ invariant(shape.node, "Node not specified", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 17, S: void 0, A: ["shape.node", "'Node not specified'"] });
103
87
  const node = controller.getComputeNode(shape.node);
104
88
  const meta2 = await controller.getMeta(node);
105
89
  if (disposed) {
@@ -155,24 +139,8 @@ var __dxlog_file2 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/hook
155
139
  var mapEdge = (graph, { source, target, output = DEFAULT_OUTPUT, input = DEFAULT_INPUT }) => {
156
140
  const sourceNode = graph.findNode(source);
157
141
  const targetNode = graph.findNode(target);
158
- invariant2(sourceNode?.node, void 0, {
159
- F: __dxlog_file2,
160
- L: 25,
161
- S: void 0,
162
- A: [
163
- "sourceNode?.node",
164
- ""
165
- ]
166
- });
167
- invariant2(targetNode?.node, void 0, {
168
- F: __dxlog_file2,
169
- L: 26,
170
- S: void 0,
171
- A: [
172
- "targetNode?.node",
173
- ""
174
- ]
175
- });
142
+ invariant2(sourceNode?.node, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 15, S: void 0, A: ["sourceNode?.node", ""] });
143
+ invariant2(targetNode?.node, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 16, S: void 0, A: ["targetNode?.node", ""] });
176
144
  return {
177
145
  id: Obj.ID.random(),
178
146
  source: sourceNode.node,
@@ -188,15 +156,7 @@ var useGraphMonitor = (model) => {
188
156
  if (!model) {
189
157
  return;
190
158
  }
191
- invariant2(node.type, void 0, {
192
- F: __dxlog_file2,
193
- L: 51,
194
- S: void 0,
195
- A: [
196
- "node.type",
197
- ""
198
- ]
199
- });
159
+ invariant2(node.type, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 37, S: void 0, A: ["node.type", ""] });
200
160
  if (!isValidComputeNode(node.type)) {
201
161
  return;
202
162
  }
@@ -246,16 +206,8 @@ var createComputeGraph = (graph) => {
246
206
  };
247
207
  var linkTriggerToCompute = (graph, computeNode, triggerData) => {
248
208
  const functionTrigger = triggerData.functionTrigger?.target;
249
- invariant2(functionTrigger, void 0, {
250
- F: __dxlog_file2,
251
- L: 114,
252
- S: void 0,
253
- A: [
254
- "functionTrigger",
255
- ""
256
- ]
257
- });
258
- Obj.change(functionTrigger, (functionTrigger2) => {
209
+ invariant2(functionTrigger, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 88, S: void 0, A: ["functionTrigger", ""] });
210
+ Obj.update(functionTrigger, (functionTrigger2) => {
259
211
  functionTrigger2.function = Ref.make(graph.root);
260
212
  functionTrigger2.inputNodeId = computeNode.id;
261
213
  });
@@ -281,15 +233,7 @@ import { invariant as invariant3 } from "@dxos/invariant";
281
233
  var __dxlog_file3 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/graph/node-defs.ts";
282
234
  var resolveComputeNode = async (node) => {
283
235
  const impl = registry[node.type];
284
- invariant3(impl, `Unknown node type: ${node.type}`, {
285
- F: __dxlog_file3,
286
- L: 22,
287
- S: void 0,
288
- A: [
289
- "impl",
290
- "`Unknown node type: ${node.type}`"
291
- ]
292
- });
236
+ invariant3(impl, `Unknown node type: ${node.type}`, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 10, S: void 0, A: ["impl", "`Unknown node type: ${node.type}`"] });
293
237
  return impl;
294
238
  };
295
239
  var isValidComputeNode = (type) => {
@@ -350,13 +294,13 @@ var createNode = (type, props) => ({
350
294
  });
351
295
 
352
296
  // src/graph/controller.ts
297
+ var __dxlog_file4 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/graph/controller.ts";
353
298
  function _ts_decorate(decorators, target, key, desc) {
354
299
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
355
300
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
356
301
  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;
357
302
  return c > 3 && r && Object.defineProperty(target, key, r), r;
358
303
  }
359
- var __dxlog_file4 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/graph/controller.ts";
360
304
  var InvalidStateError = Error;
361
305
  var AUTO_TRIGGER_NODES = [
362
306
  "chat",
@@ -461,12 +405,7 @@ var ComputeGraphController = class extends Resource {
461
405
  try {
462
406
  await this.exec(nodeId);
463
407
  } catch (err) {
464
- log.catch(err, void 0, {
465
- F: __dxlog_file4,
466
- L: 230,
467
- S: this,
468
- C: (f, a) => f(...a)
469
- });
408
+ log.catch(err, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file4, L: 128, S: this });
470
409
  }
471
410
  });
472
411
  }
@@ -489,7 +428,7 @@ var ComputeGraphController = class extends Resource {
489
428
  const scope = yield* Scope.make();
490
429
  const executable = yield* Effect.promise(() => resolveComputeNode(this._graph.getNode(nodeId)));
491
430
  const computingOutputs = executable.exec != null;
492
- const effect = (computingOutputs ? executor.computeOutputs(nodeId) : executor.computeInputs(nodeId)).pipe(Effect.withSpan("runGraph"), Scope.extend(scope), Effect.provide(Layer.mergeAll(ComputeEventLogger.layerNoop, Trace.writerLayerNoop)), Effect.flatMap(computeValueBag), Effect.withSpan("test"), Effect.tap((values) => {
431
+ const effect = (computingOutputs ? executor.computeOutputs(nodeId) : executor.computeInputs(nodeId)).pipe(Effect.withSpan("runGraph"), Scope.extend(scope), Effect.provide(Layer.mergeAll(Layer.succeed(Trace.TraceService, this._createTraceWriter()), ComputeNodeContext.layerNoop)), Effect.flatMap(computeValueBag), Effect.withSpan("test"), Effect.tap((values) => {
493
432
  for (const [key, value] of Object.entries(values)) {
494
433
  if (computingOutputs) {
495
434
  this._onOutputComputed(nodeId, key, value);
@@ -527,7 +466,7 @@ var ComputeGraphController = class extends Resource {
527
466
  for (const node of allAffectedNodes) {
528
467
  const executable = yield* Effect.promise(() => resolveComputeNode(this._graph.getNode(node)));
529
468
  const computingOutputs = executable.exec != null;
530
- const effect = (computingOutputs ? executor.computeOutputs(node) : executor.computeInputs(node)).pipe(Effect.withSpan("runGraph"), Scope.extend(scope), Effect.flatMap(computeValueBag), Effect.provide(Layer.mergeAll(ComputeEventLogger.layerNoop, Trace.writerLayerNoop)), Effect.withSpan("test"), Effect.tap((values) => {
469
+ const effect = (computingOutputs ? executor.computeOutputs(node) : executor.computeInputs(node)).pipe(Effect.withSpan("runGraph"), Scope.extend(scope), Effect.flatMap(computeValueBag), Effect.provide(Layer.mergeAll(Layer.succeed(Trace.TraceService, this._createTraceWriter()), ComputeNodeContext.layerNoop)), Effect.withSpan("test"), Effect.tap((values) => {
531
470
  for (const [key, value] of Object.entries(values)) {
532
471
  if (computingOutputs) {
533
472
  this._onOutputComputed(node, key, value);
@@ -543,23 +482,20 @@ var ComputeGraphController = class extends Resource {
543
482
  })));
544
483
  this.update.emit();
545
484
  }
546
- _createLogger() {
485
+ _createTraceWriter() {
547
486
  return {
548
- log: (event) => {
549
- this._handleEvent(event);
550
- },
551
- nodeId: void 0
487
+ write: (eventType, payload) => {
488
+ const event = traceEventToComputeEvent(eventType.key, payload);
489
+ if (event) {
490
+ this._handleEvent(event);
491
+ }
492
+ }
552
493
  };
553
494
  }
554
495
  _handleEvent(event) {
555
496
  log("handleEvent", {
556
497
  event
557
- }, {
558
- F: __dxlog_file4,
559
- L: 369,
560
- S: this,
561
- C: (f, a) => f(...a)
562
- });
498
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file4, L: 223, S: this });
563
499
  switch (event.type) {
564
500
  case "compute-input": {
565
501
  this._onInputComputed(event.nodeId, event.property, {
@@ -598,6 +534,37 @@ _ts_decorate([
598
534
  _ts_decorate([
599
535
  synchronized
600
536
  ], ComputeGraphController.prototype, "exec", null);
537
+ var traceEventToComputeEvent = (key, payload) => {
538
+ switch (key) {
539
+ case ComputeBeginEvent.key:
540
+ return {
541
+ type: "begin-compute",
542
+ ...payload
543
+ };
544
+ case ComputeEndEvent.key:
545
+ return {
546
+ type: "end-compute",
547
+ ...payload
548
+ };
549
+ case ComputeInputEvent.key:
550
+ return {
551
+ type: "compute-input",
552
+ ...payload
553
+ };
554
+ case ComputeOutputEvent.key:
555
+ return {
556
+ type: "compute-output",
557
+ ...payload
558
+ };
559
+ case ComputeCustomEvent.key:
560
+ return {
561
+ type: "custom",
562
+ ...payload
563
+ };
564
+ default:
565
+ return void 0;
566
+ }
567
+ };
601
568
  var computeValueBag = (bag) => {
602
569
  return Effect.all(Object.entries(bag.values).map(([key, eff]) => Effect.either(eff).pipe(Effect.map((value) => {
603
570
  if (Either.isLeft(value)) {
@@ -642,17 +609,9 @@ var __dxlog_file5 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/shap
642
609
  var headerHeight = 32;
643
610
  var footerHeight = 32;
644
611
  var Box = /* @__PURE__ */ forwardRef(({ children, classNames, shape, title, status, open, onAction }, forwardedRef) => {
645
- invariant4(shape.type, void 0, {
646
- F: __dxlog_file5,
647
- L: 29,
648
- S: void 0,
649
- A: [
650
- "shape.type",
651
- ""
652
- ]
653
- });
612
+ invariant4(shape.type, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 12, S: void 0, A: ["shape.type", ""] });
654
613
  const { icon, name, openable } = useShapeDef(shape.type) ?? {
655
- icon: "ph--placeholder--regular"
614
+ icon: "ph--circle-dashed--regular"
656
615
  };
657
616
  const { debug } = useEditorContext();
658
617
  return /* @__PURE__ */ React.createElement("div", {
@@ -1418,12 +1377,13 @@ var feedShape = {
1418
1377
  // src/shapes/Function.tsx
1419
1378
  import * as Schema12 from "effect/Schema";
1420
1379
  import React13, { useCallback as useCallback3, useRef as useRef4 } from "react";
1380
+ import { Script } from "@dxos/compute";
1381
+ import { Operation } from "@dxos/compute";
1421
1382
  import { AnyOutput, FunctionInput } from "@dxos/conductor";
1383
+ import { Filter } from "@dxos/echo";
1422
1384
  import { Ref as Ref2, getSnapshot, isInstanceOf } from "@dxos/echo/internal";
1423
- import { Script } from "@dxos/functions";
1424
- import { Operation } from "@dxos/operation";
1385
+ import { parseId } from "@dxos/keys";
1425
1386
  import { useClient } from "@dxos/react-client";
1426
- import { Filter, parseId } from "@dxos/react-client/echo";
1427
1387
  import { TextBox as TextBox3 } from "@dxos/react-ui-canvas-editor";
1428
1388
  var FunctionShape = Schema12.extend(ComputeShape, Schema12.Struct({
1429
1389
  type: Schema12.Literal("function")
@@ -1625,12 +1585,7 @@ var GptRealtimeComponent = ({ shape }) => {
1625
1585
  });
1626
1586
  const dataChannel = peerConnection.createDataChannel("response");
1627
1587
  const configureData = () => {
1628
- log2.info("Configuring data channel", void 0, {
1629
- F: __dxlog_file6,
1630
- L: 87,
1631
- S: void 0,
1632
- C: (f, a) => f(...a)
1633
- });
1588
+ log2.info("Configuring data channel", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file6, L: 69, S: void 0 });
1634
1589
  const event = {
1635
1590
  type: "session.update",
1636
1591
  session: {
@@ -1647,12 +1602,7 @@ var GptRealtimeComponent = ({ shape }) => {
1647
1602
  dataChannel.addEventListener("open", (ev) => {
1648
1603
  log2.info("Opening data channel", {
1649
1604
  ev
1650
- }, {
1651
- F: __dxlog_file6,
1652
- L: 100,
1653
- S: void 0,
1654
- C: (f, a) => f(...a)
1655
- });
1605
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file6, L: 84, S: void 0 });
1656
1606
  configureData();
1657
1607
  });
1658
1608
  dataChannel.addEventListener("message", async (ev) => {
@@ -1663,12 +1613,7 @@ var GptRealtimeComponent = ({ shape }) => {
1663
1613
  } catch (error) {
1664
1614
  log2.error("Error in realtime session:", {
1665
1615
  error
1666
- }, {
1667
- F: __dxlog_file6,
1668
- L: 140,
1669
- S: void 0,
1670
- C: (f, a) => f(...a)
1671
- });
1616
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file6, L: 124, S: void 0 });
1672
1617
  throw error;
1673
1618
  }
1674
1619
  };
@@ -2053,9 +1998,10 @@ var switchShape = {
2053
1998
  import * as Schema21 from "effect/Schema";
2054
1999
  import React22 from "react";
2055
2000
  import { createInputSchema, createOutputSchema } from "@dxos/conductor";
2001
+ import { Type } from "@dxos/echo";
2056
2002
  import { Message } from "@dxos/types";
2057
- var InputSchema = createInputSchema(Message.Message);
2058
- var OutputSchema = createOutputSchema(Schema21.mutable(Schema21.Array(Message.Message)));
2003
+ var InputSchema = createInputSchema(Type.getSchema(Message.Message));
2004
+ var OutputSchema = createOutputSchema(Schema21.mutable(Schema21.Array(Type.getSchema(Message.Message))));
2059
2005
  var TableShape = Schema21.extend(ComputeShape, Schema21.Struct({
2060
2006
  type: Schema21.Literal("table")
2061
2007
  }));
@@ -2106,15 +2052,7 @@ var TextInputComponent3 = ({ shape, title, ...props }) => {
2106
2052
  }
2107
2053
  };
2108
2054
  const handleTypeChange = (newType) => {
2109
- invariant5(Schema22.is(ComputeValueType3)(newType), "Invalid type", {
2110
- F: __dxlog_file7,
2111
- L: 58,
2112
- S: void 0,
2113
- A: [
2114
- "Schema.is(ComputeValueType)(newType)",
2115
- "'Invalid type'"
2116
- ]
2117
- });
2055
+ invariant5(Schema22.is(ComputeValueType3)(newType), "Invalid type", { "~LogMeta": "~LogMeta", F: __dxlog_file7, L: 32, S: void 0, A: ["Schema.is(ComputeValueType)(newType)", "'Invalid type'"] });
2118
2056
  node.valueType = newType;
2119
2057
  node.inputSchema = toJsonSchema(getTemplateInputSchema2(node));
2120
2058
  };
@@ -2207,11 +2145,12 @@ var textShape = {
2207
2145
  import * as Schema24 from "effect/Schema";
2208
2146
  import React25, { useEffect as useEffect7, useRef as useRef6 } from "react";
2209
2147
  import { createInputSchema as createInputSchema2, createOutputSchema as createOutputSchema2 } from "@dxos/conductor";
2148
+ import { Type as Type2 } from "@dxos/echo";
2210
2149
  import { ScrollArea as ScrollArea3 } from "@dxos/react-ui";
2211
2150
  import { Message as Message2 } from "@dxos/types";
2212
2151
  import { mx as mx3 } from "@dxos/ui-theme";
2213
- var InputSchema2 = createInputSchema2(Message2.Message);
2214
- var OutputSchema2 = createOutputSchema2(Schema24.mutable(Schema24.Array(Message2.Message)));
2152
+ var InputSchema2 = createInputSchema2(Type2.getSchema(Message2.Message));
2153
+ var OutputSchema2 = createOutputSchema2(Schema24.mutable(Schema24.Array(Type2.getSchema(Message2.Message))));
2215
2154
  var ThreadShape = Schema24.extend(ComputeShape, Schema24.Struct({
2216
2155
  type: Schema24.Literal("thread")
2217
2156
  }));
@@ -2250,7 +2189,6 @@ var ThreadComponent = ({ shape }) => {
2250
2189
  var ThreadItem = ({ classNames, item }) => {
2251
2190
  if (typeof item !== "object") {
2252
2191
  return /* @__PURE__ */ React25.createElement("div", {
2253
- role: "none",
2254
2192
  className: mx3(classNames)
2255
2193
  }, item);
2256
2194
  }
@@ -2308,16 +2246,16 @@ var textToImageShape = {
2308
2246
  // src/shapes/Trigger.tsx
2309
2247
  import * as Schema26 from "effect/Schema";
2310
2248
  import React27, { useEffect as useEffect8 } from "react";
2249
+ import { Trigger, TriggerEvent } from "@dxos/compute";
2311
2250
  import { VoidInput as VoidInput3 } from "@dxos/conductor";
2312
2251
  import { Filter as Filter2, Obj as Obj4, Query, Ref as Ref3 } from "@dxos/echo";
2313
- import { Trigger, TriggerEvent } from "@dxos/functions";
2314
- import { DXN, SpaceId } from "@dxos/keys";
2315
2252
  import { useSpaces } from "@dxos/react-client/echo";
2316
2253
  import { Select as Select2 } from "@dxos/react-ui";
2317
- var TriggerShape = Schema26.extend(ComputeShape, Schema26.Struct({
2254
+ var TriggerShapeSchema = Schema26.extend(ComputeShape, Schema26.Struct({
2318
2255
  type: Schema26.Literal("trigger"),
2319
2256
  functionTrigger: Schema26.optional(Ref3.Ref(Trigger.Trigger))
2320
2257
  }));
2258
+ var TriggerShape = TriggerShapeSchema;
2321
2259
  var createTrigger = (props) => {
2322
2260
  const functionTrigger = Trigger.make({
2323
2261
  enabled: true,
@@ -2338,7 +2276,7 @@ var TriggerComponent = ({ shape }) => {
2338
2276
  const functionTrigger = shape.functionTrigger?.target;
2339
2277
  useEffect8(() => {
2340
2278
  if (functionTrigger && !functionTrigger.spec) {
2341
- Obj4.change(functionTrigger, (functionTrigger2) => {
2279
+ Obj4.update(functionTrigger, (functionTrigger2) => {
2342
2280
  functionTrigger2.spec = createTriggerSpec({
2343
2281
  triggerKind: "email",
2344
2282
  spaceId: space?.id
@@ -2356,7 +2294,7 @@ var TriggerComponent = ({ shape }) => {
2356
2294
  ]);
2357
2295
  const setKind = (kind) => {
2358
2296
  if (functionTrigger?.spec?.kind !== kind) {
2359
- Obj4.change(functionTrigger, (obj) => {
2297
+ Obj4.update(functionTrigger, (obj) => {
2360
2298
  obj.spec = createTriggerSpec({
2361
2299
  triggerKind: kind,
2362
2300
  spaceId: space?.id
@@ -2402,13 +2340,10 @@ var createTriggerSpec = (props) => {
2402
2340
  return Trigger.specSubscription(Query.select(Filter2.nothing()));
2403
2341
  case "email":
2404
2342
  return Trigger.specEmail();
2405
- case "queue": {
2406
- const dxn = new DXN(DXN.kind.QUEUE, [
2407
- "data",
2408
- props.spaceId ?? SpaceId.random(),
2409
- Obj4.ID.random()
2410
- ]).toString();
2411
- return Trigger.specQueue(dxn);
2343
+ case "feed": {
2344
+ return {
2345
+ kind: "feed"
2346
+ };
2412
2347
  }
2413
2348
  }
2414
2349
  };
@@ -2418,7 +2353,7 @@ var getOutputSchema = (kind) => {
2418
2353
  ["subscription"]: TriggerEvent.SubscriptionEvent,
2419
2354
  ["timer"]: TriggerEvent.TimerEvent,
2420
2355
  ["webhook"]: TriggerEvent.WebhookEvent,
2421
- ["queue"]: TriggerEvent.QueueEvent
2356
+ ["feed"]: TriggerEvent.FeedEvent
2422
2357
  };
2423
2358
  return kindToSchema[kind];
2424
2359
  };