@dxos/plugin-conductor 0.8.4-main.406dc2a → 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.
- package/LICENSE +102 -5
- package/PLUGIN.mdl +461 -0
- package/README.md +7 -3
- package/dist/lib/neutral/CanvasArticle-KEPXL3ZT.mjs +98 -0
- package/dist/lib/neutral/CanvasArticle-KEPXL3ZT.mjs.map +7 -0
- package/dist/lib/neutral/ConductorPlugin.mjs +38 -0
- package/dist/lib/neutral/ConductorPlugin.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +9 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-WDHL35VB.mjs +39 -0
- package/dist/lib/neutral/chunk-WDHL35VB.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +1 -0
- package/dist/lib/neutral/containers/index.mjs +7 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-object-PTHDJAGI.mjs +26 -0
- package/dist/lib/neutral/create-object-PTHDJAGI.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +7 -0
- package/dist/lib/neutral/meta.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +11 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-JCMKXAUY.mjs +22 -0
- package/dist/lib/neutral/react-surface-JCMKXAUY.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +29 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/types/src/ConductorPlugin.d.ts +3 -1
- package/dist/types/src/ConductorPlugin.d.ts.map +1 -1
- package/dist/types/src/ConductorPlugin.test.d.ts +2 -0
- package/dist/types/src/ConductorPlugin.test.d.ts.map +1 -0
- package/dist/types/src/capabilities/create-object.d.ts +11 -0
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +8 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/CanvasArticle/CanvasArticle.d.ts +6 -0
- package/dist/types/src/containers/CanvasArticle/CanvasArticle.d.ts.map +1 -0
- package/dist/types/src/containers/CanvasArticle/index.d.ts +2 -0
- package/dist/types/src/containers/CanvasArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +3 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +0 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/plugin.d.ts +3 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +24 -14
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +0 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +83 -48
- package/src/ConductorPlugin.test.ts +27 -0
- package/src/ConductorPlugin.tsx +20 -54
- package/src/capabilities/create-object.ts +30 -0
- package/src/capabilities/index.ts +3 -3
- package/src/capabilities/react-surface.tsx +24 -15
- package/src/components/index.ts +1 -5
- package/src/containers/CanvasArticle/CanvasArticle.tsx +127 -0
- package/src/containers/CanvasArticle/index.ts +5 -0
- package/src/containers/index.ts +7 -0
- package/src/index.ts +0 -1
- package/src/meta.ts +24 -6
- package/src/plugin.ts +9 -0
- package/src/translations.ts +15 -12
- package/src/types/index.ts +0 -2
- package/src/vite-env.d.ts +10 -0
- package/dist/lib/browser/CanvasContainer-5TA2MZRA.mjs +0 -94
- package/dist/lib/browser/CanvasContainer-5TA2MZRA.mjs.map +0 -7
- package/dist/lib/browser/chunk-4QBTY4AV.mjs +0 -25
- package/dist/lib/browser/chunk-4QBTY4AV.mjs.map +0 -7
- package/dist/lib/browser/chunk-AETQP5S5.mjs +0 -19
- package/dist/lib/browser/chunk-AETQP5S5.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -92
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-DAIOSE5F.mjs +0 -34
- package/dist/lib/browser/intent-resolver-DAIOSE5F.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-QZQ43BFX.mjs +0 -31
- package/dist/lib/browser/react-surface-QZQ43BFX.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -8
- package/dist/lib/node-esm/CanvasContainer-I35ILMX5.mjs +0 -96
- package/dist/lib/node-esm/CanvasContainer-I35ILMX5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ESN57RYB.mjs +0 -26
- package/dist/lib/node-esm/chunk-ESN57RYB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SSXOBTGB.mjs +0 -21
- package/dist/lib/node-esm/chunk-SSXOBTGB.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -93
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-B45X4BRQ.mjs +0 -35
- package/dist/lib/node-esm/intent-resolver-B45X4BRQ.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/react-surface-ZPRFSLDI.mjs +0 -32
- package/dist/lib/node-esm/react-surface-ZPRFSLDI.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -9
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/components/CanvasContainer.d.ts +0 -8
- package/dist/types/src/components/CanvasContainer.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -18
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/capabilities/intent-resolver.ts +0 -27
- package/src/components/CanvasContainer.tsx +0 -104
- package/src/types/schema.ts +0 -20
- /package/dist/lib/{browser/types → neutral/components}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/types → neutral}/index.mjs.map +0 -0
package/LICENSE
CHANGED
|
@@ -1,8 +1,105 @@
|
|
|
1
|
-
|
|
2
|
-
Copyright (c) 2022 DXOS
|
|
1
|
+
# Functional Source License, Version 1.1, ALv2 Future License
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
## Abbreviation
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
FSL-1.1-Apache-2.0
|
|
7
6
|
|
|
8
|
-
|
|
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.
|
package/PLUGIN.mdl
ADDED
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: org.dxos.plugin.conductor
|
|
3
|
+
name: ConductorPlugin
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Visual node-based compute graph plugin for `DXOS` Composer — wire data sources, AI models, logic, and transformations into reactive pipelines that execute in the local-first runtime.
|
|
8
|
+
|
|
9
|
+
## Extensions
|
|
10
|
+
|
|
11
|
+
The following extension dialects are used in this document.
|
|
12
|
+
Each extension is defined in the Appendix or resolved via its URI.
|
|
13
|
+
|
|
14
|
+
| Term | URI |
|
|
15
|
+
|-------------|--------------------------------|
|
|
16
|
+
| `type` | `org.dxos.mdl.type@1.0` |
|
|
17
|
+
| `feat` | `org.dxos.mdl.feat@1.0` |
|
|
18
|
+
| `test` | `org.dxos.mdl.test@1.0` |
|
|
19
|
+
| `component` | `org.dxos.mdl.component@1.0` |
|
|
20
|
+
| `op` | `org.dxos.mdl.op@1.0` |
|
|
21
|
+
|
|
22
|
+
## Types
|
|
23
|
+
|
|
24
|
+
```mdl
|
|
25
|
+
type ComputeValueType
|
|
26
|
+
literals: string | number | boolean | object
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```mdl
|
|
30
|
+
type NodeType
|
|
31
|
+
literals:
|
|
32
|
+
input | output | constant | template | switch | rng |
|
|
33
|
+
audio | chat | text | json | json-transform | surface |
|
|
34
|
+
beacon | scope | reducer | thread | queue | make-queue | append |
|
|
35
|
+
and | or | not | if | if-else |
|
|
36
|
+
function | gpt | gpt-realtime |
|
|
37
|
+
database | text-to-image
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```mdl
|
|
41
|
+
type ComputeNode
|
|
42
|
+
desc: A node in the compute graph persisted via ECHO.
|
|
43
|
+
extends: [Graph.Node]
|
|
44
|
+
fields:
|
|
45
|
+
inputSchema?: JsonSchema
|
|
46
|
+
outputSchema?: JsonSchema
|
|
47
|
+
subgraph?: Ref<ComputeGraph> # composition: nested graph
|
|
48
|
+
function?: Ref<PersistentOperation> # composition: reusable function node
|
|
49
|
+
valueType?: ComputeValueType # for constant/template nodes
|
|
50
|
+
value?: any # for constant and template nodes
|
|
51
|
+
enabled?: boolean # for switch nodes
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```mdl
|
|
55
|
+
type ComputeEdge
|
|
56
|
+
desc: A directed edge connecting an output port on one node to an input port on another.
|
|
57
|
+
extends: [Graph.Edge]
|
|
58
|
+
fields:
|
|
59
|
+
input: string # target node input property name
|
|
60
|
+
output: string # source node output property name
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```mdl
|
|
64
|
+
type ComputeGraph
|
|
65
|
+
desc: Persistent ECHO object holding the full node-edge graph plus special I/O reference nodes.
|
|
66
|
+
fields:
|
|
67
|
+
graph: Graph.Graph
|
|
68
|
+
input?: ComputeNode
|
|
69
|
+
output?: ComputeNode
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```mdl
|
|
73
|
+
type ValueBag
|
|
74
|
+
desc: A set of named asynchronous value effects passed between nodes.
|
|
75
|
+
fields:
|
|
76
|
+
_tag: "ValueBag"
|
|
77
|
+
values: Record<string, ValueEffect<any>>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Components
|
|
81
|
+
|
|
82
|
+
```mdl
|
|
83
|
+
component CanvasArticle
|
|
84
|
+
desc: Full-screen canvas editor for a ComputeGraph; renders as an article or a section embed.
|
|
85
|
+
props:
|
|
86
|
+
role: "article" | "section"
|
|
87
|
+
subject: CanvasBoard
|
|
88
|
+
attendableId?: string
|
|
89
|
+
state:
|
|
90
|
+
graph: CanvasGraphModel<ComputeShape>
|
|
91
|
+
controller?: ComputeGraphController
|
|
92
|
+
registry: ShapeRegistry
|
|
93
|
+
layout?: ComputeShapeLayout
|
|
94
|
+
slots:
|
|
95
|
+
toolbar?: ReactNode # injected by AppSurface frame
|
|
96
|
+
layout: |
|
|
97
|
+
┌──────────────────────────────────────────────┐
|
|
98
|
+
│ [toolbar — zoom, tools, minimap] │
|
|
99
|
+
├──────────────────────────────────────────────┤
|
|
100
|
+
│ │
|
|
101
|
+
│ ┌──────┐ ┌──────┐ ┌──────┐ │
|
|
102
|
+
│ │ node │───▶│ node │───▶│ node │ │
|
|
103
|
+
│ └──────┘ └──────┘ └──────┘ │
|
|
104
|
+
│ │
|
|
105
|
+
│ canvas — pan / zoom / connect nodes │
|
|
106
|
+
└──────────────────────────────────────────────┘
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Operations
|
|
110
|
+
|
|
111
|
+
Pure operations — no effects, no service dependencies.
|
|
112
|
+
|
|
113
|
+
```mdl
|
|
114
|
+
op evalConstant
|
|
115
|
+
desc: Returns the scalar value stored on a constant node.
|
|
116
|
+
input:
|
|
117
|
+
node: ComputeNode
|
|
118
|
+
output: Scalar
|
|
119
|
+
errors:
|
|
120
|
+
MissingValue: node has no value set
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
```mdl
|
|
124
|
+
op jsonTransform
|
|
125
|
+
desc: Evaluates a JSONPath expression over an input value.
|
|
126
|
+
input:
|
|
127
|
+
input: any
|
|
128
|
+
expression: string
|
|
129
|
+
output: any
|
|
130
|
+
errors:
|
|
131
|
+
InvalidExpression: JSONPath expression could not be parsed
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
```mdl
|
|
135
|
+
op boolAnd
|
|
136
|
+
desc: Logical AND of two boolean inputs.
|
|
137
|
+
input:
|
|
138
|
+
a: boolean
|
|
139
|
+
b: boolean
|
|
140
|
+
output: boolean
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
```mdl
|
|
144
|
+
op boolOr
|
|
145
|
+
desc: Logical OR of two boolean inputs.
|
|
146
|
+
input:
|
|
147
|
+
a: boolean
|
|
148
|
+
b: boolean
|
|
149
|
+
output: boolean
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
```mdl
|
|
153
|
+
op boolNot
|
|
154
|
+
desc: Logical NOT of a boolean input.
|
|
155
|
+
input:
|
|
156
|
+
input: boolean
|
|
157
|
+
output: boolean
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
```mdl
|
|
161
|
+
op ifRoute
|
|
162
|
+
desc: Routes a value to the true or false output port based on a condition.
|
|
163
|
+
input:
|
|
164
|
+
condition: boolean
|
|
165
|
+
value: any
|
|
166
|
+
output: IfOutput # { true?: any; false?: any }
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
```mdl
|
|
170
|
+
op ifElseSelect
|
|
171
|
+
desc: Ternary — returns trueValue or falseValue depending on condition.
|
|
172
|
+
input:
|
|
173
|
+
condition: boolean
|
|
174
|
+
true: any
|
|
175
|
+
false: any
|
|
176
|
+
output: any
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Effectful operations — mutate persistent state or call external services.
|
|
180
|
+
|
|
181
|
+
```mdl
|
|
182
|
+
op createComputeGraph
|
|
183
|
+
desc: Creates a new CanvasBoard with an empty ComputeGraph and adds it to the target space.
|
|
184
|
+
input:
|
|
185
|
+
target?: Space | Collection
|
|
186
|
+
output: string # DXN of created CanvasBoard
|
|
187
|
+
effects: [echo:write]
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
```mdl
|
|
191
|
+
op appendToQueue
|
|
192
|
+
desc: Appends items to an ECHO queue or collection identified by DXN.
|
|
193
|
+
input:
|
|
194
|
+
id: string # DXN — dxn:queue or dxn:echo
|
|
195
|
+
items: any[]
|
|
196
|
+
output: void
|
|
197
|
+
effects: [echo:write, feed:write]
|
|
198
|
+
errors:
|
|
199
|
+
UnsupportedDXN: DXN kind not supported
|
|
200
|
+
SpaceMismatch: ECHO DXN belongs to a different space
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
```mdl
|
|
204
|
+
op createQueue
|
|
205
|
+
desc: Allocates a new append-only Feed and returns a Ref to it.
|
|
206
|
+
input:
|
|
207
|
+
output: Ref<Feed>
|
|
208
|
+
effects: [feed:write]
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
```mdl
|
|
212
|
+
op invokeGpt
|
|
213
|
+
desc: Sends the current conversation thread to the configured AI model and streams the reply.
|
|
214
|
+
input:
|
|
215
|
+
thread: Ref<Thread>
|
|
216
|
+
tools?: Tool[]
|
|
217
|
+
systemPrompt?: string
|
|
218
|
+
output: Message
|
|
219
|
+
effects: [http]
|
|
220
|
+
requires: [AiService]
|
|
221
|
+
errors:
|
|
222
|
+
ModelUnavailable: AI service could not be reached
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
```mdl
|
|
226
|
+
op invokeFunction
|
|
227
|
+
desc: Deserialises a PersistentOperation from ECHO and invokes it with the provided input bag.
|
|
228
|
+
input:
|
|
229
|
+
function: Ref<PersistentOperation>
|
|
230
|
+
input: any
|
|
231
|
+
output: any
|
|
232
|
+
effects: [echo:read]
|
|
233
|
+
requires: [Database.Service, OperationRegistry.Service]
|
|
234
|
+
errors:
|
|
235
|
+
FunctionNotFound: referenced operation does not exist
|
|
236
|
+
InvocationFailed: operation returned an error
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Features
|
|
240
|
+
|
|
241
|
+
```mdl
|
|
242
|
+
feat F-1: Canvas Editor
|
|
243
|
+
|
|
244
|
+
req F-1.1: User can create a new compute graph via the "Create object" entry.
|
|
245
|
+
req F-1.2: Canvas renders nodes as draggable, resizable shapes on an infinite panning surface.
|
|
246
|
+
req F-1.3:
|
|
247
|
+
when: user drags from an output port to an input port
|
|
248
|
+
then: a ComputeEdge is created connecting the two ports
|
|
249
|
+
req F-1.4:
|
|
250
|
+
when: a ComputeEdge is deleted
|
|
251
|
+
then: downstream nodes stop receiving values from the disconnected output
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
```mdl
|
|
255
|
+
feat F-2: Node Palette
|
|
256
|
+
|
|
257
|
+
req F-2.1: Toolbar exposes all built-in NodeTypes; user can drag them onto the canvas.
|
|
258
|
+
req F-2.2: Constant nodes display an inline editor for their scalar value and valueType.
|
|
259
|
+
req F-2.3: Template nodes render a text input with {{variable}} interpolation.
|
|
260
|
+
req F-2.4: Function nodes allow selecting a PersistentOperation from the space.
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
```mdl
|
|
264
|
+
feat F-3: Reactive Execution
|
|
265
|
+
|
|
266
|
+
req F-3.1:
|
|
267
|
+
when: any upstream node value changes
|
|
268
|
+
then: ComputeGraphController re-evaluates dependent nodes in topological order
|
|
269
|
+
|
|
270
|
+
req F-3.2: Node execution is lazy; nodes only run when their outputs are consumed.
|
|
271
|
+
|
|
272
|
+
req F-3.3:
|
|
273
|
+
when: a node fails with ConductorError
|
|
274
|
+
then: downstream nodes receive a NotExecuted marker and do not throw
|
|
275
|
+
|
|
276
|
+
req F-3.4:
|
|
277
|
+
when: a node emits a ValueBag
|
|
278
|
+
then: individual output ports can resolve at different times (async bag semantics)
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
```mdl
|
|
282
|
+
feat F-4: AI Integration
|
|
283
|
+
|
|
284
|
+
req F-4.1: GPT node connects to AiService; configuration includes model, system prompt, and tools.
|
|
285
|
+
req F-4.2:
|
|
286
|
+
when: GPT node executes
|
|
287
|
+
then: op:invokeGpt streams the model response back to the output port
|
|
288
|
+
|
|
289
|
+
req F-4.3: Function node can reference any PersistentOperation registered in the space.
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
```mdl
|
|
293
|
+
feat F-5: Data Sources and Sinks
|
|
294
|
+
|
|
295
|
+
req F-5.1: Queue node reads messages from a Feed referenced by DXN.
|
|
296
|
+
req F-5.2: Append node writes items to a Feed or ECHO collection referenced by DXN.
|
|
297
|
+
req F-5.3: Database node exposes ECHO space contents as a query tool for AI nodes.
|
|
298
|
+
req F-5.4: Thread node surfaces a conversation thread with its message history.
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
```mdl
|
|
302
|
+
feat F-6: Logic and Control Flow
|
|
303
|
+
|
|
304
|
+
req F-6.1: If node routes a value to true or false output port based on a boolean condition.
|
|
305
|
+
req F-6.2: IfElse node selects one of two values using a ternary condition.
|
|
306
|
+
req F-6.3: Reducer node collects an array of values from multiple upstream ports.
|
|
307
|
+
req F-6.4: And / Or / Not nodes implement standard boolean combinators.
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
```mdl
|
|
311
|
+
feat F-7: Persistence and Collaboration
|
|
312
|
+
|
|
313
|
+
req F-7.1: ComputeGraph is stored as an ECHO object; graph topology is replicated to peers.
|
|
314
|
+
req F-7.2:
|
|
315
|
+
when: a peer modifies a node value or edge
|
|
316
|
+
then: all collaborators see the change reflected on the canvas in real time
|
|
317
|
+
|
|
318
|
+
req F-7.3:
|
|
319
|
+
when: a CanvasBoard is embedded as a section in another document
|
|
320
|
+
then: the graph renders in the section aspect-square container and remains interactive
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
## Acceptance
|
|
324
|
+
|
|
325
|
+
```mdl
|
|
326
|
+
test T-1: Create empty graph
|
|
327
|
+
given: user opens the Create Object menu
|
|
328
|
+
when: user selects "Compute Graph"
|
|
329
|
+
then:
|
|
330
|
+
- a new CanvasBoard with an empty ComputeGraph is created in the space
|
|
331
|
+
- the canvas opens with no nodes
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
```mdl
|
|
335
|
+
test T-2: Add constant node and read value
|
|
336
|
+
given: an empty canvas
|
|
337
|
+
when: user adds a constant node, sets value "hello", connects it to a text node
|
|
338
|
+
then:
|
|
339
|
+
- text node receives "hello" on its input port
|
|
340
|
+
- text node renders "hello"
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
```mdl
|
|
344
|
+
test T-3: Boolean AND gate
|
|
345
|
+
given: two switch nodes with values true and false connected to an AND node
|
|
346
|
+
when: graph executes
|
|
347
|
+
then:
|
|
348
|
+
- AND node output is false
|
|
349
|
+
- switching both inputs to true produces output true
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
```mdl
|
|
353
|
+
test T-4: JSONPath transform
|
|
354
|
+
given: a constant node with value { "a": { "b": 42 } } connected to a json-transform node
|
|
355
|
+
when: expression "$.a.b" is set on the transform node
|
|
356
|
+
then:
|
|
357
|
+
- output port value is [42]
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
```mdl
|
|
361
|
+
test T-5: GPT node invocation
|
|
362
|
+
given: a thread node connected to a GPT node with a system prompt
|
|
363
|
+
when: graph executes with AiService available
|
|
364
|
+
then:
|
|
365
|
+
- GPT node output port receives a Message
|
|
366
|
+
- Message content is non-empty
|
|
367
|
+
errors: [ModelUnavailable]
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
```mdl
|
|
371
|
+
test T-6: Append to queue
|
|
372
|
+
given: a make-queue node connected to an append node; constant node provides input items
|
|
373
|
+
when: graph executes
|
|
374
|
+
then:
|
|
375
|
+
- queue contains the appended items
|
|
376
|
+
- downstream queue node reads them back
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
```mdl
|
|
380
|
+
test T-7: Collaborative edit
|
|
381
|
+
given: two peers have the same CanvasBoard open
|
|
382
|
+
when: peer A moves a node on the canvas
|
|
383
|
+
then:
|
|
384
|
+
- peer B sees the node in the new position within one replication round-trip
|
|
385
|
+
tags: [collaborative]
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
```mdl
|
|
389
|
+
test T-8: NotExecuted propagation
|
|
390
|
+
given: an if node whose condition is false, connected to a text node on the true port
|
|
391
|
+
when: graph executes
|
|
392
|
+
then:
|
|
393
|
+
- text node receives a NotExecuted marker
|
|
394
|
+
- text node renders nothing (no error thrown)
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
## Appendix: Extension Definitions
|
|
400
|
+
|
|
401
|
+
```mdl
|
|
402
|
+
ext type
|
|
403
|
+
uri: org.dxos.mdl.type@1.0
|
|
404
|
+
desc: A named data structure with typed fields and optional literals.
|
|
405
|
+
fields:
|
|
406
|
+
desc?: Prose
|
|
407
|
+
fields?: FieldMap
|
|
408
|
+
literals?: UnionList
|
|
409
|
+
extends?: TypeRef[]
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
```mdl
|
|
413
|
+
ext feat
|
|
414
|
+
uri: org.dxos.mdl.feat@1.0
|
|
415
|
+
desc: A named feature grouping one or more requirements.
|
|
416
|
+
fields:
|
|
417
|
+
desc?: Prose
|
|
418
|
+
req: RequirementList
|
|
419
|
+
nesting: self
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
```mdl
|
|
423
|
+
ext test
|
|
424
|
+
uri: org.dxos.mdl.test@1.0
|
|
425
|
+
desc: An acceptance scenario expressed as given / when / then steps.
|
|
426
|
+
fields:
|
|
427
|
+
given?: Step | Step[]
|
|
428
|
+
when?: Step | Step[]
|
|
429
|
+
then: Step | Step[]
|
|
430
|
+
tags?: TagList
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
```mdl
|
|
434
|
+
ext component
|
|
435
|
+
uri: org.dxos.mdl.component@1.0
|
|
436
|
+
desc: A UI component with props, internal state, slots, actions, and events.
|
|
437
|
+
fields:
|
|
438
|
+
desc?: Prose
|
|
439
|
+
props?: FieldMap
|
|
440
|
+
state?: FieldMap
|
|
441
|
+
slots?: FieldMap
|
|
442
|
+
actions?: ActionMap
|
|
443
|
+
emits?: EventMap
|
|
444
|
+
layout?: CodeBlock
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
```mdl
|
|
448
|
+
ext op
|
|
449
|
+
uri: org.dxos.mdl.op@1.0
|
|
450
|
+
desc: |
|
|
451
|
+
A named operation with typed inputs, outputs, and declared errors.
|
|
452
|
+
Pure ops have no effects or requires. Effectful ops declare both.
|
|
453
|
+
fields:
|
|
454
|
+
desc?: Prose
|
|
455
|
+
input?: FieldMap
|
|
456
|
+
output?: TypeExpr
|
|
457
|
+
errors?: ErrorMap
|
|
458
|
+
effects?: EffectList
|
|
459
|
+
requires?: ServiceList
|
|
460
|
+
note?: Prose
|
|
461
|
+
```
|
package/README.md
CHANGED
|
@@ -28,10 +28,10 @@ The system is built on `@dxos/graph` as the core abstraction layer Canvas visual
|
|
|
28
28
|
- ComputeNode state changes are Effect signals
|
|
29
29
|
- Canvas React components automatically update based on these signals
|
|
30
30
|
|
|
31
|
-
|
|
32
31
|
## Development
|
|
33
32
|
|
|
34
33
|
### Phase 1: Basic editor
|
|
34
|
+
|
|
35
35
|
- [x] Canvas with pan and zoom (`@dxos/react-canvaas`).
|
|
36
36
|
- [x] General graph data structure (`@dxos/graph`).
|
|
37
37
|
- [x] Radix-style Editor component, with Canvas, Grid and Toolbar.
|
|
@@ -47,7 +47,8 @@ The system is built on `@dxos/graph` as the core abstraction layer Canvas visual
|
|
|
47
47
|
- [ ] Undo/redo (history).
|
|
48
48
|
- [ ] Snap to edges or center? (currently center).
|
|
49
49
|
|
|
50
|
-
### Phase 2:
|
|
50
|
+
### Phase 2:
|
|
51
|
+
|
|
51
52
|
- [x] FunctionShape components with properties and anchor points. Add/delete and Play buttons.
|
|
52
53
|
- [x] Shape registry.
|
|
53
54
|
- [x] Custom frames.
|
|
@@ -77,9 +78,11 @@ The system is built on `@dxos/graph` as the core abstraction layer Canvas visual
|
|
|
77
78
|
- [x] GPT (with prompt and base prompt inputs).
|
|
78
79
|
|
|
79
80
|
### Phase 4:
|
|
80
|
-
|
|
81
|
+
|
|
82
|
+
- [ ] Group/collapse nodes; hierarchical graph editor.
|
|
81
83
|
|
|
82
84
|
### Technical Debt
|
|
85
|
+
|
|
83
86
|
- [x] `AttentionContainer` (and key management).
|
|
84
87
|
- [ ] Factor out common Toolbar pattern (with state observers).
|
|
85
88
|
- [ ] Reconcile Graph with framework (ECHO, app-graph, etc.)
|
|
@@ -87,4 +90,5 @@ The system is built on `@dxos/graph` as the core abstraction layer Canvas visual
|
|
|
87
90
|
- [ ] TypedObject and schema id property.
|
|
88
91
|
|
|
89
92
|
### Design Issues
|
|
93
|
+
|
|
90
94
|
- [ ] Represent all compute node properties as inputs? (e.g., trigger).
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// src/containers/CanvasArticle/CanvasArticle.tsx
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import React, { Fragment, useEffect, useMemo, useRef } from "react";
|
|
4
|
+
import { AiService } from "@dxos/ai";
|
|
5
|
+
import { Capabilities } from "@dxos/app-framework";
|
|
6
|
+
import { useCapability } from "@dxos/app-framework/ui";
|
|
7
|
+
import { Credential, Operation, OperationRegistry, ServiceResolver } from "@dxos/compute";
|
|
8
|
+
import { ComputeGraphModel } from "@dxos/conductor";
|
|
9
|
+
import { Database, Feed, Obj } from "@dxos/echo";
|
|
10
|
+
import { useObject } from "@dxos/react-client/echo";
|
|
11
|
+
import { Flex } from "@dxos/react-ui";
|
|
12
|
+
import { ComputeContext, ComputeGraphController, ComputeShapeLayout, computeShapes, useComputeGraphController, useGraphMonitor } from "@dxos/react-ui-canvas-compute";
|
|
13
|
+
import { CanvasGraphModel, Editor, KeyboardContainer, ShapeRegistry } from "@dxos/react-ui-canvas-editor";
|
|
14
|
+
var CanvasArticle = ({ role, subject, attendableId: _attendableId }) => {
|
|
15
|
+
const [canvas] = useObject(subject);
|
|
16
|
+
const id = Obj.getURI(canvas);
|
|
17
|
+
const graph = useMemo(() => CanvasGraphModel.create(canvas.layout, (fn) => Obj.update(subject, fn)), [
|
|
18
|
+
subject,
|
|
19
|
+
canvas.layout
|
|
20
|
+
]);
|
|
21
|
+
const controller = useGraphController(subject);
|
|
22
|
+
const graphMonitor = useGraphMonitor(controller?.graph);
|
|
23
|
+
const registry = useMemo(() => new ShapeRegistry(computeShapes), []);
|
|
24
|
+
const editorRef = useRef(null);
|
|
25
|
+
useComputeGraphController({
|
|
26
|
+
controller,
|
|
27
|
+
graph,
|
|
28
|
+
editorRef
|
|
29
|
+
});
|
|
30
|
+
const layout = useMemo(() => controller && registry ? new ComputeShapeLayout(controller, registry) : void 0, [
|
|
31
|
+
controller,
|
|
32
|
+
registry
|
|
33
|
+
]);
|
|
34
|
+
if (!controller) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const Root = role === "section" ? Container : Fragment;
|
|
38
|
+
return /* @__PURE__ */ React.createElement(ComputeContext.Provider, {
|
|
39
|
+
value: {
|
|
40
|
+
controller
|
|
41
|
+
}
|
|
42
|
+
}, /* @__PURE__ */ React.createElement(Root, null, /* @__PURE__ */ React.createElement(KeyboardContainer, {
|
|
43
|
+
id
|
|
44
|
+
}, /* @__PURE__ */ React.createElement(Editor.Root, {
|
|
45
|
+
id,
|
|
46
|
+
ref: editorRef,
|
|
47
|
+
graph,
|
|
48
|
+
graphMonitor,
|
|
49
|
+
registry,
|
|
50
|
+
layout
|
|
51
|
+
}, /* @__PURE__ */ React.createElement(Editor.Canvas, null), /* @__PURE__ */ React.createElement(Editor.UI, {
|
|
52
|
+
showTools: true
|
|
53
|
+
})))));
|
|
54
|
+
};
|
|
55
|
+
var Container = (props) => /* @__PURE__ */ React.createElement(Flex, {
|
|
56
|
+
...props,
|
|
57
|
+
classNames: "aspect-square"
|
|
58
|
+
});
|
|
59
|
+
var useGraphController = (canvas) => {
|
|
60
|
+
const db = Obj.getDatabase(canvas);
|
|
61
|
+
const processManagerRuntime = useCapability(Capabilities.ProcessManagerRuntime);
|
|
62
|
+
const [computeGraph] = useObject(canvas.computeGraph);
|
|
63
|
+
const controller = useMemo(() => {
|
|
64
|
+
if (!canvas.computeGraph?.target || !db) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
const spaceId = db.spaceId;
|
|
68
|
+
const model = new ComputeGraphModel(canvas.computeGraph?.target);
|
|
69
|
+
const spaceLayer = ServiceResolver.provide({
|
|
70
|
+
space: spaceId
|
|
71
|
+
}, AiService.AiService, Database.Service, Feed.FeedService, Credential.CredentialsService, Operation.Service, OperationRegistry.Service);
|
|
72
|
+
const computeGraphRuntime = {
|
|
73
|
+
runPromiseExit: (effect) => processManagerRuntime.runPromiseExit(effect.pipe(Effect.provide(spaceLayer)))
|
|
74
|
+
};
|
|
75
|
+
const controller2 = new ComputeGraphController(computeGraphRuntime, model);
|
|
76
|
+
return controller2;
|
|
77
|
+
}, [
|
|
78
|
+
computeGraph,
|
|
79
|
+
db,
|
|
80
|
+
processManagerRuntime
|
|
81
|
+
]);
|
|
82
|
+
useEffect(() => {
|
|
83
|
+
if (!controller) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
void controller.open();
|
|
87
|
+
return () => {
|
|
88
|
+
void controller.close();
|
|
89
|
+
};
|
|
90
|
+
}, [
|
|
91
|
+
controller
|
|
92
|
+
]);
|
|
93
|
+
return controller;
|
|
94
|
+
};
|
|
95
|
+
export {
|
|
96
|
+
CanvasArticle as default
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=CanvasArticle-KEPXL3ZT.mjs.map
|