@dxos/plugin-conductor 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 (76) hide show
  1. package/LICENSE +102 -5
  2. package/PLUGIN.mdl +461 -0
  3. package/dist/lib/neutral/CanvasArticle-KEPXL3ZT.mjs +98 -0
  4. package/dist/lib/neutral/CanvasArticle-KEPXL3ZT.mjs.map +7 -0
  5. package/dist/lib/neutral/ConductorPlugin.mjs +38 -0
  6. package/dist/lib/neutral/ConductorPlugin.mjs.map +7 -0
  7. package/dist/lib/neutral/capabilities/index.mjs +9 -0
  8. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  9. package/dist/lib/neutral/chunk-WDHL35VB.mjs +39 -0
  10. package/dist/lib/neutral/chunk-WDHL35VB.mjs.map +7 -0
  11. package/dist/lib/neutral/components/index.mjs +1 -0
  12. package/dist/lib/neutral/components/index.mjs.map +7 -0
  13. package/dist/lib/neutral/containers/index.mjs +7 -0
  14. package/dist/lib/neutral/containers/index.mjs.map +7 -0
  15. package/dist/lib/neutral/create-object-PTHDJAGI.mjs +26 -0
  16. package/dist/lib/neutral/create-object-PTHDJAGI.mjs.map +7 -0
  17. package/dist/lib/neutral/index.mjs +7 -0
  18. package/dist/lib/neutral/index.mjs.map +7 -0
  19. package/dist/lib/neutral/meta.json +1 -0
  20. package/dist/lib/neutral/meta.mjs +7 -0
  21. package/dist/lib/neutral/meta.mjs.map +7 -0
  22. package/dist/lib/neutral/plugin.mjs +11 -0
  23. package/dist/lib/neutral/plugin.mjs.map +7 -0
  24. package/dist/lib/neutral/react-surface-JCMKXAUY.mjs +22 -0
  25. package/dist/lib/neutral/react-surface-JCMKXAUY.mjs.map +7 -0
  26. package/dist/lib/neutral/translations.mjs +29 -0
  27. package/dist/lib/neutral/translations.mjs.map +7 -0
  28. package/dist/types/src/ConductorPlugin.d.ts +1 -0
  29. package/dist/types/src/ConductorPlugin.d.ts.map +1 -1
  30. package/dist/types/src/ConductorPlugin.test.d.ts +2 -0
  31. package/dist/types/src/ConductorPlugin.test.d.ts.map +1 -0
  32. package/dist/types/src/capabilities/create-object.d.ts +11 -0
  33. package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
  34. package/dist/types/src/capabilities/index.d.ts +6 -0
  35. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  36. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  37. package/dist/types/src/containers/CanvasArticle/CanvasArticle.d.ts +6 -0
  38. package/dist/types/src/containers/CanvasArticle/CanvasArticle.d.ts.map +1 -0
  39. package/dist/types/src/containers/CanvasArticle/index.d.ts +2 -0
  40. package/dist/types/src/containers/CanvasArticle/index.d.ts.map +1 -0
  41. package/dist/types/src/containers/index.d.ts +1 -1
  42. package/dist/types/src/containers/index.d.ts.map +1 -1
  43. package/dist/types/src/index.d.ts +0 -1
  44. package/dist/types/src/index.d.ts.map +1 -1
  45. package/dist/types/src/meta.d.ts +1 -1
  46. package/dist/types/src/meta.d.ts.map +1 -1
  47. package/dist/types/src/plugin.d.ts +3 -0
  48. package/dist/types/src/plugin.d.ts.map +1 -0
  49. package/dist/types/src/translations.d.ts +24 -16
  50. package/dist/types/src/translations.d.ts.map +1 -1
  51. package/dist/types/tsconfig.tsbuildinfo +1 -1
  52. package/package.json +71 -38
  53. package/src/ConductorPlugin.test.ts +27 -0
  54. package/src/ConductorPlugin.tsx +10 -28
  55. package/src/capabilities/create-object.ts +30 -0
  56. package/src/capabilities/index.ts +1 -0
  57. package/src/capabilities/react-surface.tsx +2 -2
  58. package/src/containers/{CanvasContainer/CanvasContainer.tsx → CanvasArticle/CanvasArticle.tsx} +32 -12
  59. package/src/containers/CanvasArticle/index.ts +5 -0
  60. package/src/containers/index.ts +1 -1
  61. package/src/index.ts +0 -1
  62. package/src/meta.ts +20 -6
  63. package/src/plugin.ts +9 -0
  64. package/src/translations.ts +2 -1
  65. package/src/vite-env.d.ts +10 -0
  66. package/dist/lib/browser/index.mjs +0 -91
  67. package/dist/lib/browser/index.mjs.map +0 -7
  68. package/dist/lib/browser/meta.json +0 -1
  69. package/dist/lib/node-esm/index.mjs +0 -93
  70. package/dist/lib/node-esm/index.mjs.map +0 -7
  71. package/dist/lib/node-esm/meta.json +0 -1
  72. package/dist/types/src/containers/CanvasContainer/CanvasContainer.d.ts +0 -6
  73. package/dist/types/src/containers/CanvasContainer/CanvasContainer.d.ts.map +0 -1
  74. package/dist/types/src/containers/CanvasContainer/index.d.ts +0 -2
  75. package/dist/types/src/containers/CanvasContainer/index.d.ts.map +0 -1
  76. package/src/containers/CanvasContainer/index.ts +0 -5
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.
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
+ ```
@@ -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
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/containers/CanvasArticle/CanvasArticle.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport type * as Exit from 'effect/Exit';\nimport React, { Fragment, useEffect, useMemo, useRef } from 'react';\n\nimport { AiService } from '@dxos/ai';\nimport { Capabilities } from '@dxos/app-framework';\nimport { useCapability } from '@dxos/app-framework/ui';\nimport { type AppSurface } from '@dxos/app-toolkit/ui';\nimport { Credential, Operation, OperationRegistry, ServiceResolver } from '@dxos/compute';\nimport { ComputeGraphModel } from '@dxos/conductor';\nimport { Database, Feed, Obj } from '@dxos/echo';\nimport { useObject } from '@dxos/react-client/echo';\nimport { Flex, type FlexProps } from '@dxos/react-ui';\nimport {\n ComputeContext,\n ComputeGraphController,\n type ComputeShape,\n ComputeShapeLayout,\n computeShapes,\n useComputeGraphController,\n useGraphMonitor,\n} from '@dxos/react-ui-canvas-compute';\nimport {\n type CanvasBoard,\n CanvasGraphModel,\n Editor,\n type EditorController,\n KeyboardContainer,\n ShapeRegistry,\n} from '@dxos/react-ui-canvas-editor';\n\nexport type CanvasArticleProps = AppSurface.ObjectArticleProps<CanvasBoard.CanvasBoard>;\n\nexport const CanvasArticle = ({ role, subject, attendableId: _attendableId }: CanvasArticleProps) => {\n const [canvas] = useObject(subject);\n const id = Obj.getURI(canvas);\n const graph = useMemo(\n () => CanvasGraphModel.create<ComputeShape>(canvas.layout, (fn) => Obj.update(subject, fn)),\n [subject, canvas.layout],\n );\n const controller = useGraphController(subject);\n const graphMonitor = useGraphMonitor(controller?.graph);\n const registry = useMemo(() => new ShapeRegistry(computeShapes), []);\n const editorRef = useRef<EditorController>(null);\n useComputeGraphController({ controller, graph, editorRef });\n\n // Layout.\n const layout = useMemo(\n () => (controller && registry ? new ComputeShapeLayout(controller, registry) : undefined),\n [controller, registry],\n );\n\n if (!controller) {\n return;\n }\n\n const Root = role === 'section' ? Container : Fragment;\n\n return (\n <ComputeContext.Provider value={{ controller }}>\n <Root>\n <KeyboardContainer id={id}>\n <Editor.Root\n id={id}\n ref={editorRef}\n graph={graph}\n graphMonitor={graphMonitor as any}\n registry={registry}\n layout={layout}\n >\n <Editor.Canvas />\n <Editor.UI showTools />\n </Editor.Root>\n </KeyboardContainer>\n </Root>\n </ComputeContext.Provider>\n );\n};\n\nconst Container = (props: FlexProps) => <Flex {...props} classNames='aspect-square' />;\n\nconst useGraphController = (canvas: CanvasBoard.CanvasBoard) => {\n const db = Obj.getDatabase(canvas);\n const processManagerRuntime = useCapability(Capabilities.ProcessManagerRuntime);\n const [computeGraph] = useObject(canvas.computeGraph);\n const controller = useMemo(() => {\n if (!canvas.computeGraph?.target || !db) {\n return null;\n }\n const spaceId = db.spaceId;\n const model = new ComputeGraphModel(canvas.computeGraph?.target);\n const spaceLayer = ServiceResolver.provide(\n { space: spaceId },\n AiService.AiService,\n Database.Service,\n Feed.FeedService,\n Credential.CredentialsService,\n Operation.Service,\n OperationRegistry.Service,\n );\n const computeGraphRuntime = {\n runPromiseExit: <A, E>(effect: Effect.Effect<A, E, any>): Promise<Exit.Exit<A, E>> =>\n processManagerRuntime.runPromiseExit(effect.pipe(Effect.provide(spaceLayer)) as any) as Promise<\n Exit.Exit<A, E>\n >,\n };\n const controller = new ComputeGraphController(computeGraphRuntime, model);\n return controller;\n }, [computeGraph, db, processManagerRuntime]);\n\n useEffect(() => {\n if (!controller) {\n return;\n }\n\n void controller.open();\n return () => {\n void controller.close();\n };\n }, [controller]);\n\n return controller;\n};\n"],
5
+ "mappings": "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",
6
+ "names": ["Effect", "React", "Fragment", "useEffect", "useMemo", "useRef", "AiService", "Capabilities", "useCapability", "Credential", "Operation", "OperationRegistry", "ServiceResolver", "ComputeGraphModel", "Database", "Feed", "Obj", "useObject", "Flex", "ComputeContext", "ComputeGraphController", "ComputeShapeLayout", "computeShapes", "useComputeGraphController", "useGraphMonitor", "CanvasGraphModel", "Editor", "KeyboardContainer", "ShapeRegistry", "CanvasArticle", "role", "subject", "attendableId", "_attendableId", "canvas", "id", "getURI", "graph", "create", "layout", "fn", "update", "controller", "useGraphController", "graphMonitor", "registry", "editorRef", "undefined", "Root", "Container", "Provider", "value", "ref", "Canvas", "UI", "showTools", "props", "classNames", "db", "getDatabase", "processManagerRuntime", "ProcessManagerRuntime", "computeGraph", "target", "spaceId", "model", "spaceLayer", "provide", "space", "Service", "FeedService", "CredentialsService", "computeGraphRuntime", "runPromiseExit", "effect", "pipe", "open", "close"]
7
+ }