@dxos/react-ui-canvas-compute 0.8.4-main.406dc2a → 0.8.4-main.548089c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/index.mjs +74 -92
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +74 -92
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/graph/controller.d.ts +11 -28
- package/dist/types/src/graph/controller.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeNodeState.d.ts +2 -2
- package/dist/types/src/hooks/useComputeNodeState.d.ts.map +1 -1
- package/dist/types/src/shapes/RNG.d.ts.map +1 -1
- package/dist/types/src/shapes/Surface.d.ts.map +1 -1
- package/dist/types/src/shapes/Trigger.d.ts +3 -3
- package/dist/types/src/shapes/Trigger.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 +42 -40
- package/src/compute.stories.tsx +6 -6
- package/src/graph/controller.ts +12 -5
- package/src/hooks/useComputeNodeState.ts +4 -3
- package/src/shapes/Audio.tsx +1 -1
- package/src/shapes/Beacon.tsx +1 -1
- package/src/shapes/Boolean.tsx +2 -2
- package/src/shapes/Function.tsx +3 -3
- package/src/shapes/Gpt.tsx +1 -1
- package/src/shapes/GptRealtime.tsx +1 -1
- package/src/shapes/Queue.tsx +2 -2
- package/src/shapes/RNG.tsx +5 -1
- package/src/shapes/Scope.tsx +1 -1
- package/src/shapes/Surface.tsx +6 -2
- package/src/shapes/Switch.tsx +1 -1
- package/src/shapes/Table.tsx +3 -3
- package/src/shapes/Thread.tsx +5 -5
- package/src/shapes/Trigger.tsx +23 -38
- package/src/shapes/common/Box.tsx +5 -5
- package/src/shapes/common/FunctionBody.tsx +2 -2
- package/src/shapes/common/TypeSelect.tsx +1 -1
- package/src/testing/circuits.ts +1 -1
|
@@ -346,19 +346,6 @@ var createNode = (type, props) => ({
|
|
|
346
346
|
});
|
|
347
347
|
|
|
348
348
|
// src/graph/controller.ts
|
|
349
|
-
function _define_property(obj, key, value) {
|
|
350
|
-
if (key in obj) {
|
|
351
|
-
Object.defineProperty(obj, key, {
|
|
352
|
-
value,
|
|
353
|
-
enumerable: true,
|
|
354
|
-
configurable: true,
|
|
355
|
-
writable: true
|
|
356
|
-
});
|
|
357
|
-
} else {
|
|
358
|
-
obj[key] = value;
|
|
359
|
-
}
|
|
360
|
-
return obj;
|
|
361
|
-
}
|
|
362
349
|
function _ts_decorate(decorators, target, key, desc) {
|
|
363
350
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
364
351
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -381,6 +368,29 @@ var createComputeGraphController = (graph, serviceContainer) => {
|
|
|
381
368
|
};
|
|
382
369
|
};
|
|
383
370
|
var ComputeGraphController = class extends Resource {
|
|
371
|
+
_serviceContainer;
|
|
372
|
+
_graph;
|
|
373
|
+
_executor = new GraphExecutor({
|
|
374
|
+
computeNodeResolver: (node) => resolveComputeNode(node)
|
|
375
|
+
});
|
|
376
|
+
_diagnostics = [];
|
|
377
|
+
/**
|
|
378
|
+
* Canvas force-sets outputs of those nodes.
|
|
379
|
+
*/
|
|
380
|
+
_forcedOutputs = {};
|
|
381
|
+
/**
|
|
382
|
+
* Runtime state of the execution graph.
|
|
383
|
+
*/
|
|
384
|
+
_runtimeStateInputs = {};
|
|
385
|
+
_runtimeStateOutputs = {};
|
|
386
|
+
// TODO(burdon): Remove? Make state reactive?
|
|
387
|
+
update = new Event();
|
|
388
|
+
/** Computed result. */
|
|
389
|
+
output = new Event();
|
|
390
|
+
events = new Event();
|
|
391
|
+
constructor(_serviceContainer, _graph) {
|
|
392
|
+
super(), this._serviceContainer = _serviceContainer, this._graph = _graph;
|
|
393
|
+
}
|
|
384
394
|
toJSON() {
|
|
385
395
|
return {
|
|
386
396
|
graph: this._graph,
|
|
@@ -441,8 +451,7 @@ var ComputeGraphController = class extends Resource {
|
|
|
441
451
|
return this._runtimeStateOutputs[nodeId] ?? {};
|
|
442
452
|
}
|
|
443
453
|
setOutput(nodeId, property, value) {
|
|
444
|
-
|
|
445
|
-
(_this__forcedOutputs = this._forcedOutputs)[_nodeId = nodeId] ?? (_this__forcedOutputs[_nodeId] = {});
|
|
454
|
+
this._forcedOutputs[nodeId] ??= {};
|
|
446
455
|
this._forcedOutputs[nodeId][property] = value;
|
|
447
456
|
queueMicrotask(async () => {
|
|
448
457
|
try {
|
|
@@ -450,7 +459,7 @@ var ComputeGraphController = class extends Resource {
|
|
|
450
459
|
} catch (err) {
|
|
451
460
|
log.catch(err, void 0, {
|
|
452
461
|
F: __dxlog_file4,
|
|
453
|
-
L:
|
|
462
|
+
L: 210,
|
|
454
463
|
S: this,
|
|
455
464
|
C: (f, a) => f(...a)
|
|
456
465
|
});
|
|
@@ -544,7 +553,7 @@ var ComputeGraphController = class extends Resource {
|
|
|
544
553
|
event
|
|
545
554
|
}, {
|
|
546
555
|
F: __dxlog_file4,
|
|
547
|
-
L:
|
|
556
|
+
L: 346,
|
|
548
557
|
S: this,
|
|
549
558
|
C: (f, a) => f(...a)
|
|
550
559
|
});
|
|
@@ -567,13 +576,11 @@ var ComputeGraphController = class extends Resource {
|
|
|
567
576
|
this.events.emit(event);
|
|
568
577
|
}
|
|
569
578
|
_onInputComputed(nodeId, property, value) {
|
|
570
|
-
|
|
571
|
-
(_this__runtimeStateInputs = this._runtimeStateInputs)[_nodeId = nodeId] ?? (_this__runtimeStateInputs[_nodeId] = {});
|
|
579
|
+
this._runtimeStateInputs[nodeId] ??= {};
|
|
572
580
|
this._runtimeStateInputs[nodeId][property] = value;
|
|
573
581
|
}
|
|
574
582
|
_onOutputComputed(nodeId, property, value) {
|
|
575
|
-
|
|
576
|
-
(_this__runtimeStateOutputs = this._runtimeStateOutputs)[_nodeId = nodeId] ?? (_this__runtimeStateOutputs[_nodeId] = {});
|
|
583
|
+
this._runtimeStateOutputs[nodeId] ??= {};
|
|
577
584
|
this._runtimeStateOutputs[nodeId][property] = value;
|
|
578
585
|
this.output.emit({
|
|
579
586
|
nodeId,
|
|
@@ -581,19 +588,6 @@ var ComputeGraphController = class extends Resource {
|
|
|
581
588
|
value
|
|
582
589
|
});
|
|
583
590
|
}
|
|
584
|
-
constructor(_serviceContainer, _graph) {
|
|
585
|
-
super(), _define_property(this, "_serviceContainer", void 0), _define_property(this, "_graph", void 0), _define_property(this, "_executor", void 0), _define_property(this, "_diagnostics", void 0), /**
|
|
586
|
-
* Canvas force-sets outputs of those nodes.
|
|
587
|
-
*/
|
|
588
|
-
_define_property(this, "_forcedOutputs", void 0), /**
|
|
589
|
-
* Runtime state of the execution graph.
|
|
590
|
-
*/
|
|
591
|
-
_define_property(this, "_runtimeStateInputs", void 0), _define_property(this, "_runtimeStateOutputs", void 0), // TODO(burdon): Remove? Make state reactive?
|
|
592
|
-
_define_property(this, "update", void 0), /** Computed result. */
|
|
593
|
-
_define_property(this, "output", void 0), _define_property(this, "events", void 0), this._serviceContainer = _serviceContainer, this._graph = _graph, this._executor = new GraphExecutor({
|
|
594
|
-
computeNodeResolver: (node) => resolveComputeNode(node)
|
|
595
|
-
}), this._diagnostics = [], this._forcedOutputs = {}, this._runtimeStateInputs = {}, this._runtimeStateOutputs = {}, this.update = new Event(), this.output = new Event(), this.events = new Event();
|
|
596
|
-
}
|
|
597
591
|
};
|
|
598
592
|
_ts_decorate([
|
|
599
593
|
synchronized
|
|
@@ -663,9 +657,9 @@ var Box = /* @__PURE__ */ forwardRef(({ children, classNames, shape, title, stat
|
|
|
663
657
|
const { debug } = useEditorContext();
|
|
664
658
|
return /* @__PURE__ */ React.createElement("div", {
|
|
665
659
|
ref: forwardedRef,
|
|
666
|
-
className: "flex flex-col
|
|
660
|
+
className: "flex flex-col bs-full is-full justify-between"
|
|
667
661
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
668
|
-
className: "flex shrink-0
|
|
662
|
+
className: "flex shrink-0 is-full justify-between items-center h-[32px] bg-hoverSurface"
|
|
669
663
|
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
670
664
|
icon,
|
|
671
665
|
classNames: "mx-2"
|
|
@@ -684,11 +678,11 @@ var Box = /* @__PURE__ */ forwardRef(({ children, classNames, shape, title, stat
|
|
|
684
678
|
onAction?.("run");
|
|
685
679
|
}
|
|
686
680
|
})), /* @__PURE__ */ React.createElement("div", {
|
|
687
|
-
className: mx("flex flex-col
|
|
681
|
+
className: mx("flex flex-col bs-full grow overflow-hidden", classNames)
|
|
688
682
|
}, children), /* @__PURE__ */ React.createElement("div", {
|
|
689
|
-
className: "flex shrink-0
|
|
683
|
+
className: "flex shrink-0 is-full justify-between items-center h-[32px] bg-hoverSurface"
|
|
690
684
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
691
|
-
className: "grow
|
|
685
|
+
className: "grow pli-2 text-sm truncate"
|
|
692
686
|
}, debug ? shape.id : status), openable && /* @__PURE__ */ React.createElement(IconButton, {
|
|
693
687
|
classNames: "p-1",
|
|
694
688
|
variant: "ghost",
|
|
@@ -797,7 +791,7 @@ var FunctionBody = ({ shape, name, content, inputSchema = VoidInput, outputSchem
|
|
|
797
791
|
className: "flex flex-col"
|
|
798
792
|
}, inputs?.map(({ name: name2 }) => /* @__PURE__ */ React2.createElement("div", {
|
|
799
793
|
key: name2,
|
|
800
|
-
className: "
|
|
794
|
+
className: "pli-2 truncate text-sm font-mono items-center",
|
|
801
795
|
style: {
|
|
802
796
|
height: rowHeight
|
|
803
797
|
}
|
|
@@ -805,7 +799,7 @@ var FunctionBody = ({ shape, name, content, inputSchema = VoidInput, outputSchem
|
|
|
805
799
|
className: "flex flex-col"
|
|
806
800
|
}, outputs?.map(({ name: name2 }) => /* @__PURE__ */ React2.createElement("div", {
|
|
807
801
|
key: name2,
|
|
808
|
-
className: "
|
|
802
|
+
className: "pli-2 truncate text-sm font-mono items-center text-right",
|
|
809
803
|
style: {
|
|
810
804
|
height: rowHeight
|
|
811
805
|
}
|
|
@@ -847,7 +841,7 @@ var TypeSelect = ({ value, onValueChange }) => {
|
|
|
847
841
|
onValueChange
|
|
848
842
|
}, /* @__PURE__ */ React3.createElement(Select.TriggerButton, {
|
|
849
843
|
variant: "ghost",
|
|
850
|
-
classNames: "
|
|
844
|
+
classNames: "is-full !pli-0"
|
|
851
845
|
}), /* @__PURE__ */ React3.createElement(Select.Portal, null, /* @__PURE__ */ React3.createElement(Select.Content, null, /* @__PURE__ */ React3.createElement(Select.ScrollUpButton, null), /* @__PURE__ */ React3.createElement(Select.Viewport, null, ComputeValueType.literals.map((type) => /* @__PURE__ */ React3.createElement(Select.Option, {
|
|
852
846
|
key: type,
|
|
853
847
|
value: type
|
|
@@ -958,7 +952,7 @@ var AudioComponent = ({ shape }) => {
|
|
|
958
952
|
active
|
|
959
953
|
]);
|
|
960
954
|
return /* @__PURE__ */ React6.createElement("div", {
|
|
961
|
-
className: "flex
|
|
955
|
+
className: "flex is-full justify-center items-center"
|
|
962
956
|
}, /* @__PURE__ */ React6.createElement(Icon2, {
|
|
963
957
|
icon: active ? "ph--microphone--regular" : "ph--microphone-slash--regular",
|
|
964
958
|
classNames: [
|
|
@@ -1011,7 +1005,7 @@ var BeaconComponent = ({ shape }) => {
|
|
|
1011
1005
|
const input = runtime.inputs[DEFAULT_INPUT3];
|
|
1012
1006
|
const value = input?.type === "executed" ? input.value : false;
|
|
1013
1007
|
return /* @__PURE__ */ React7.createElement("div", {
|
|
1014
|
-
className: "flex
|
|
1008
|
+
className: "flex is-full justify-center items-center"
|
|
1015
1009
|
}, /* @__PURE__ */ React7.createElement(Icon3, {
|
|
1016
1010
|
icon: "ph--sun--regular",
|
|
1017
1011
|
classNames: [
|
|
@@ -1063,7 +1057,7 @@ var defineShape = ({ type, name, icon, symbol: Symbol, createShape: createShape2
|
|
|
1063
1057
|
// Be careful not to name component factories with a capital letter.
|
|
1064
1058
|
component: () => {
|
|
1065
1059
|
return /* @__PURE__ */ React8.createElement("div", {
|
|
1066
|
-
className: "flex
|
|
1060
|
+
className: "flex is-full justify-center items-center"
|
|
1067
1061
|
}, /* @__PURE__ */ React8.createElement(Symbol, null));
|
|
1068
1062
|
},
|
|
1069
1063
|
createShape: createShape2,
|
|
@@ -1090,7 +1084,7 @@ var createSymbol = (pathConstructor, inputs) => ({
|
|
|
1090
1084
|
});
|
|
1091
1085
|
return /* @__PURE__ */ React8.createElement("svg", {
|
|
1092
1086
|
viewBox: `0 0 ${width} ${height}`,
|
|
1093
|
-
className: "
|
|
1087
|
+
className: "is-full bs-full"
|
|
1094
1088
|
}, getAnchorPoints({
|
|
1095
1089
|
x: 0,
|
|
1096
1090
|
y: centerY
|
|
@@ -1421,7 +1415,7 @@ import * as Schema11 from "effect/Schema";
|
|
|
1421
1415
|
import React12, { useCallback as useCallback3, useRef as useRef4 } from "react";
|
|
1422
1416
|
import { AnyOutput, FunctionInput } from "@dxos/conductor";
|
|
1423
1417
|
import { Ref as Ref2, getSnapshot, isInstanceOf } from "@dxos/echo/internal";
|
|
1424
|
-
import {
|
|
1418
|
+
import { Function, Script } from "@dxos/functions";
|
|
1425
1419
|
import { useClient } from "@dxos/react-client";
|
|
1426
1420
|
import { Filter, parseId } from "@dxos/react-client/echo";
|
|
1427
1421
|
import { TextBox as TextBox3 } from "@dxos/react-ui-canvas-editor";
|
|
@@ -1450,10 +1444,10 @@ var TextInputComponent2 = ({ shape, title, ...props }) => {
|
|
|
1450
1444
|
}
|
|
1451
1445
|
const space = client.spaces.get(spaceId);
|
|
1452
1446
|
const object = space?.db.getObjectById(objectId);
|
|
1453
|
-
if (!space || !isInstanceOf(
|
|
1447
|
+
if (!space || !isInstanceOf(Script.Script, object)) {
|
|
1454
1448
|
return;
|
|
1455
1449
|
}
|
|
1456
|
-
const { objects: [fn] } = await space.db.query(Filter.type(
|
|
1450
|
+
const { objects: [fn] } = await space.db.query(Filter.type(Function.Function, {
|
|
1457
1451
|
source: Ref2.make(object)
|
|
1458
1452
|
})).run();
|
|
1459
1453
|
if (!fn) {
|
|
@@ -1556,7 +1550,7 @@ var GptComponent = ({ shape }) => {
|
|
|
1556
1550
|
return /* @__PURE__ */ React13.createElement(FunctionBody, {
|
|
1557
1551
|
shape,
|
|
1558
1552
|
content: /* @__PURE__ */ React13.createElement("div", {
|
|
1559
|
-
className: "
|
|
1553
|
+
className: "pli-2 plb-1 overflow-y-scroll"
|
|
1560
1554
|
}, text),
|
|
1561
1555
|
status: `${tokens} tokens`,
|
|
1562
1556
|
inputSchema: meta.input,
|
|
@@ -1759,12 +1753,12 @@ var QueueComponent = ({ shape }) => {
|
|
|
1759
1753
|
status: `${items.length} items`,
|
|
1760
1754
|
onAction: handleAction
|
|
1761
1755
|
}, /* @__PURE__ */ React16.createElement("div", {
|
|
1762
|
-
className: "flex flex-col
|
|
1756
|
+
className: "flex flex-col is-full overflow-y-scroll divide-y divide-separator"
|
|
1763
1757
|
}, [
|
|
1764
1758
|
...items
|
|
1765
1759
|
].map((item, i) => /* @__PURE__ */ React16.createElement(QueueItem, {
|
|
1766
1760
|
key: i,
|
|
1767
|
-
classNames: "p-1
|
|
1761
|
+
classNames: "p-1 pli-2",
|
|
1768
1762
|
item
|
|
1769
1763
|
}))));
|
|
1770
1764
|
} finally {
|
|
@@ -1908,7 +1902,7 @@ var ScopeComponent = ({ shape }) => {
|
|
|
1908
1902
|
const active = input?.type === "executed" ? input.value : false;
|
|
1909
1903
|
const { getAverage } = useAudioStream(active);
|
|
1910
1904
|
return /* @__PURE__ */ React18.createElement("div", {
|
|
1911
|
-
className: "flex
|
|
1905
|
+
className: "flex is-full justify-center items-center bg-black"
|
|
1912
1906
|
}, /* @__PURE__ */ React18.createElement(Chaos, {
|
|
1913
1907
|
active,
|
|
1914
1908
|
getValue: getAverage,
|
|
@@ -1939,7 +1933,7 @@ var scopeShape = {
|
|
|
1939
1933
|
import { useSignals as _useSignals18 } from "@preact-signals/safe-react/tracking";
|
|
1940
1934
|
import * as Schema18 from "effect/Schema";
|
|
1941
1935
|
import React19 from "react";
|
|
1942
|
-
import { Surface } from "@dxos/app-framework";
|
|
1936
|
+
import { Surface } from "@dxos/app-framework/react";
|
|
1943
1937
|
import { DEFAULT_INPUT as DEFAULT_INPUT6 } from "@dxos/conductor";
|
|
1944
1938
|
import { createAnchorMap as createAnchorMap9 } from "@dxos/react-ui-canvas-editor";
|
|
1945
1939
|
var SurfaceShape = Schema18.extend(ComputeShape, Schema18.Struct({
|
|
@@ -2022,7 +2016,7 @@ var SwitchComponent = ({ shape }) => {
|
|
|
2022
2016
|
value
|
|
2023
2017
|
]);
|
|
2024
2018
|
return /* @__PURE__ */ React20.createElement("div", {
|
|
2025
|
-
className: "flex
|
|
2019
|
+
className: "flex is-full justify-center items-center",
|
|
2026
2020
|
onClick: (ev) => ev.stopPropagation()
|
|
2027
2021
|
}, /* @__PURE__ */ React20.createElement(Input2.Root, null, /* @__PURE__ */ React20.createElement(Input2.Switch, {
|
|
2028
2022
|
checked: value,
|
|
@@ -2051,9 +2045,9 @@ import { useSignals as _useSignals20 } from "@preact-signals/safe-react/tracking
|
|
|
2051
2045
|
import * as Schema20 from "effect/Schema";
|
|
2052
2046
|
import React21 from "react";
|
|
2053
2047
|
import { createInputSchema, createOutputSchema } from "@dxos/conductor";
|
|
2054
|
-
import {
|
|
2055
|
-
var InputSchema = createInputSchema(
|
|
2056
|
-
var OutputSchema = createOutputSchema(Schema20.mutable(Schema20.Array(
|
|
2048
|
+
import { Message } from "@dxos/types";
|
|
2049
|
+
var InputSchema = createInputSchema(Message.Message);
|
|
2050
|
+
var OutputSchema = createOutputSchema(Schema20.mutable(Schema20.Array(Message.Message)));
|
|
2057
2051
|
var TableShape = Schema20.extend(ComputeShape, Schema20.Struct({
|
|
2058
2052
|
type: Schema20.Literal("table")
|
|
2059
2053
|
}));
|
|
@@ -2224,9 +2218,9 @@ import * as Schema23 from "effect/Schema";
|
|
|
2224
2218
|
import React24, { useEffect as useEffect7, useRef as useRef6 } from "react";
|
|
2225
2219
|
import { createInputSchema as createInputSchema2, createOutputSchema as createOutputSchema2 } from "@dxos/conductor";
|
|
2226
2220
|
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
2227
|
-
import {
|
|
2228
|
-
var InputSchema2 = createInputSchema2(
|
|
2229
|
-
var OutputSchema2 = createOutputSchema2(Schema23.mutable(Schema23.Array(
|
|
2221
|
+
import { Message as Message2 } from "@dxos/types";
|
|
2222
|
+
var InputSchema2 = createInputSchema2(Message2.Message);
|
|
2223
|
+
var OutputSchema2 = createOutputSchema2(Schema23.mutable(Schema23.Array(Message2.Message)));
|
|
2230
2224
|
var ThreadShape = Schema23.extend(ComputeShape, Schema23.Struct({
|
|
2231
2225
|
type: Schema23.Literal("thread")
|
|
2232
2226
|
}));
|
|
@@ -2254,7 +2248,7 @@ var ThreadComponent = ({ shape }) => {
|
|
|
2254
2248
|
shape
|
|
2255
2249
|
}, /* @__PURE__ */ React24.createElement("div", {
|
|
2256
2250
|
ref: scrollRef,
|
|
2257
|
-
className: "flex flex-col
|
|
2251
|
+
className: "flex flex-col is-full overflow-y-scroll gap-2 p-2"
|
|
2258
2252
|
}, [
|
|
2259
2253
|
...items
|
|
2260
2254
|
].map((item, i) => /* @__PURE__ */ React24.createElement(ThreadItem, {
|
|
@@ -2277,7 +2271,7 @@ var ThreadItem = ({ classNames, item }) => {
|
|
|
2277
2271
|
return /* @__PURE__ */ React24.createElement("div", {
|
|
2278
2272
|
className: mx3("flex", classNames, role === "user" && "justify-end")
|
|
2279
2273
|
}, /* @__PURE__ */ React24.createElement("div", {
|
|
2280
|
-
className: mx3("block rounded-md p-1
|
|
2274
|
+
className: mx3("block rounded-md p-1 pli-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")
|
|
2281
2275
|
}, message));
|
|
2282
2276
|
} finally {
|
|
2283
2277
|
_effect.f();
|
|
@@ -2338,18 +2332,18 @@ import { useSignals as _useSignals25 } from "@preact-signals/safe-react/tracking
|
|
|
2338
2332
|
import * as Schema25 from "effect/Schema";
|
|
2339
2333
|
import React26, { useEffect as useEffect8 } from "react";
|
|
2340
2334
|
import { VoidInput as VoidInput3 } from "@dxos/conductor";
|
|
2341
|
-
import { Filter as Filter2,
|
|
2335
|
+
import { Filter as Filter2, Query } from "@dxos/echo";
|
|
2342
2336
|
import { ObjectId as ObjectId4, Ref as Ref3 } from "@dxos/echo/internal";
|
|
2343
|
-
import {
|
|
2337
|
+
import { Trigger, TriggerEvent } from "@dxos/functions";
|
|
2344
2338
|
import { DXN, SpaceId } from "@dxos/keys";
|
|
2345
2339
|
import { useSpace } from "@dxos/react-client/echo";
|
|
2346
2340
|
import { Select as Select2 } from "@dxos/react-ui";
|
|
2347
2341
|
var TriggerShape = Schema25.extend(ComputeShape, Schema25.Struct({
|
|
2348
2342
|
type: Schema25.Literal("trigger"),
|
|
2349
|
-
functionTrigger: Schema25.optional(Ref3(
|
|
2343
|
+
functionTrigger: Schema25.optional(Ref3(Trigger.Trigger))
|
|
2350
2344
|
}));
|
|
2351
2345
|
var createTrigger = (props) => {
|
|
2352
|
-
const functionTrigger =
|
|
2346
|
+
const functionTrigger = Trigger.make({
|
|
2353
2347
|
enabled: true,
|
|
2354
2348
|
spec: createTriggerSpec(props)
|
|
2355
2349
|
});
|
|
@@ -2358,7 +2352,7 @@ var createTrigger = (props) => {
|
|
|
2358
2352
|
functionTrigger: Ref3.make(functionTrigger),
|
|
2359
2353
|
size: {
|
|
2360
2354
|
width: 192,
|
|
2361
|
-
height: getHeight(
|
|
2355
|
+
height: getHeight(TriggerEvent.EmailEvent)
|
|
2362
2356
|
},
|
|
2363
2357
|
...props
|
|
2364
2358
|
});
|
|
@@ -2416,8 +2410,8 @@ var TriggerKindSelect = ({ value, onValueChange }) => {
|
|
|
2416
2410
|
onValueChange
|
|
2417
2411
|
}, /* @__PURE__ */ React26.createElement(Select2.TriggerButton, {
|
|
2418
2412
|
variant: "ghost",
|
|
2419
|
-
classNames: "
|
|
2420
|
-
}), /* @__PURE__ */ React26.createElement(Select2.Portal, null, /* @__PURE__ */ React26.createElement(Select2.Content, null, /* @__PURE__ */ React26.createElement(Select2.ScrollUpButton, null), /* @__PURE__ */ React26.createElement(Select2.Viewport, null,
|
|
2413
|
+
classNames: "is-full !pli-0"
|
|
2414
|
+
}), /* @__PURE__ */ React26.createElement(Select2.Portal, null, /* @__PURE__ */ React26.createElement(Select2.Content, null, /* @__PURE__ */ React26.createElement(Select2.ScrollUpButton, null), /* @__PURE__ */ React26.createElement(Select2.Viewport, null, Trigger.Kinds.map((kind) => /* @__PURE__ */ React26.createElement(Select2.Option, {
|
|
2421
2415
|
key: kind,
|
|
2422
2416
|
value: kind
|
|
2423
2417
|
}, kind))), /* @__PURE__ */ React26.createElement(Select2.ScrollDownButton, null), /* @__PURE__ */ React26.createElement(Select2.Arrow, null))));
|
|
@@ -2464,11 +2458,11 @@ var createTriggerSpec = (props) => {
|
|
|
2464
2458
|
};
|
|
2465
2459
|
var getOutputSchema = (kind) => {
|
|
2466
2460
|
const kindToSchema = {
|
|
2467
|
-
["email"]:
|
|
2468
|
-
["subscription"]:
|
|
2469
|
-
["timer"]:
|
|
2470
|
-
["webhook"]:
|
|
2471
|
-
["queue"]:
|
|
2461
|
+
["email"]: TriggerEvent.EmailEvent,
|
|
2462
|
+
["subscription"]: TriggerEvent.SubscriptionEvent,
|
|
2463
|
+
["timer"]: TriggerEvent.TimerEvent,
|
|
2464
|
+
["webhook"]: TriggerEvent.WebhookEvent,
|
|
2465
|
+
["queue"]: TriggerEvent.QueueEvent
|
|
2472
2466
|
};
|
|
2473
2467
|
return kindToSchema[kind];
|
|
2474
2468
|
};
|
|
@@ -2590,7 +2584,7 @@ var GptRealtimeComponent = ({ shape }) => {
|
|
|
2590
2584
|
}
|
|
2591
2585
|
};
|
|
2592
2586
|
return /* @__PURE__ */ React27.createElement("div", {
|
|
2593
|
-
className: "flex
|
|
2587
|
+
className: "flex is-full justify-center items-center"
|
|
2594
2588
|
}, /* @__PURE__ */ React27.createElement(Icon5, {
|
|
2595
2589
|
icon: isReady ? "ph--waveform--regular" : isLive ? "ph--pulse--regular" : "ph--play--regular",
|
|
2596
2590
|
size: 16,
|
|
@@ -2681,20 +2675,11 @@ var computeShapes = [
|
|
|
2681
2675
|
import { DefaultInput, DefaultOutput as DefaultOutput2 } from "@dxos/conductor";
|
|
2682
2676
|
import { toEffectSchema } from "@dxos/echo/internal";
|
|
2683
2677
|
import { ShapeLayout } from "@dxos/react-ui-canvas-editor";
|
|
2684
|
-
function _define_property2(obj, key, value) {
|
|
2685
|
-
if (key in obj) {
|
|
2686
|
-
Object.defineProperty(obj, key, {
|
|
2687
|
-
value,
|
|
2688
|
-
enumerable: true,
|
|
2689
|
-
configurable: true,
|
|
2690
|
-
writable: true
|
|
2691
|
-
});
|
|
2692
|
-
} else {
|
|
2693
|
-
obj[key] = value;
|
|
2694
|
-
}
|
|
2695
|
-
return obj;
|
|
2696
|
-
}
|
|
2697
2678
|
var ComputeShapeLayout = class extends ShapeLayout {
|
|
2679
|
+
_controller;
|
|
2680
|
+
constructor(_controller, registry2) {
|
|
2681
|
+
super(registry2), this._controller = _controller;
|
|
2682
|
+
}
|
|
2698
2683
|
// TODO(burdon): Doesn't update.
|
|
2699
2684
|
getAnchors(shape) {
|
|
2700
2685
|
const shapeDef = this._registry.getShapeDef(shape.type);
|
|
@@ -2709,9 +2694,6 @@ var ComputeShapeLayout = class extends ShapeLayout {
|
|
|
2709
2694
|
}
|
|
2710
2695
|
return anchors;
|
|
2711
2696
|
}
|
|
2712
|
-
constructor(_controller, registry2) {
|
|
2713
|
-
super(registry2), _define_property2(this, "_controller", void 0), this._controller = _controller;
|
|
2714
|
-
}
|
|
2715
2697
|
};
|
|
2716
2698
|
export {
|
|
2717
2699
|
AndShape,
|