@dxos/react-ui-canvas-compute 0.10.0 → 0.11.1

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 (171) hide show
  1. package/dist/lib/index.mjs +2164 -0
  2. package/dist/lib/index.mjs.map +1 -0
  3. package/dist/types/src/compute.stories.d.ts.map +1 -1
  4. package/dist/types/src/shapes/Append.d.ts +2 -51
  5. package/dist/types/src/shapes/Append.d.ts.map +1 -1
  6. package/dist/types/src/shapes/Array.d.ts +2 -34
  7. package/dist/types/src/shapes/Array.d.ts.map +1 -1
  8. package/dist/types/src/shapes/Audio.d.ts +2 -51
  9. package/dist/types/src/shapes/Audio.d.ts.map +1 -1
  10. package/dist/types/src/shapes/Beacon.d.ts +2 -51
  11. package/dist/types/src/shapes/Beacon.d.ts.map +1 -1
  12. package/dist/types/src/shapes/Chat.d.ts +2 -51
  13. package/dist/types/src/shapes/Chat.d.ts.map +1 -1
  14. package/dist/types/src/shapes/Constant.d.ts +2 -53
  15. package/dist/types/src/shapes/Constant.d.ts.map +1 -1
  16. package/dist/types/src/shapes/Database.d.ts +2 -51
  17. package/dist/types/src/shapes/Database.d.ts.map +1 -1
  18. package/dist/types/src/shapes/Feed.d.ts +2 -51
  19. package/dist/types/src/shapes/Feed.d.ts.map +1 -1
  20. package/dist/types/src/shapes/Function.d.ts +7 -50
  21. package/dist/types/src/shapes/Function.d.ts.map +1 -1
  22. package/dist/types/src/shapes/Gpt.d.ts +2 -51
  23. package/dist/types/src/shapes/Gpt.d.ts.map +1 -1
  24. package/dist/types/src/shapes/GptRealtime.d.ts +2 -51
  25. package/dist/types/src/shapes/GptRealtime.d.ts.map +1 -1
  26. package/dist/types/src/shapes/Json.d.ts +2 -101
  27. package/dist/types/src/shapes/Json.d.ts.map +1 -1
  28. package/dist/types/src/shapes/Logic.d.ts +2 -103
  29. package/dist/types/src/shapes/Logic.d.ts.map +1 -1
  30. package/dist/types/src/shapes/RNG.d.ts +2 -55
  31. package/dist/types/src/shapes/RNG.d.ts.map +1 -1
  32. package/dist/types/src/shapes/Scope.d.ts +2 -51
  33. package/dist/types/src/shapes/Scope.d.ts.map +1 -1
  34. package/dist/types/src/shapes/Surface.d.ts +2 -51
  35. package/dist/types/src/shapes/Surface.d.ts.map +1 -1
  36. package/dist/types/src/shapes/Switch.d.ts +2 -51
  37. package/dist/types/src/shapes/Switch.d.ts.map +1 -1
  38. package/dist/types/src/shapes/Table.d.ts +2 -51
  39. package/dist/types/src/shapes/Table.d.ts.map +1 -1
  40. package/dist/types/src/shapes/Template.d.ts +4 -55
  41. package/dist/types/src/shapes/Template.d.ts.map +1 -1
  42. package/dist/types/src/shapes/Text.d.ts +2 -51
  43. package/dist/types/src/shapes/Text.d.ts.map +1 -1
  44. package/dist/types/src/shapes/TextToImage.d.ts +2 -51
  45. package/dist/types/src/shapes/TextToImage.d.ts.map +1 -1
  46. package/dist/types/src/shapes/Thread.d.ts +2 -51
  47. package/dist/types/src/shapes/Thread.d.ts.map +1 -1
  48. package/dist/types/src/shapes/Trigger.d.ts +2 -17
  49. package/dist/types/src/shapes/Trigger.d.ts.map +1 -1
  50. package/dist/types/src/shapes/append-def.d.ts +52 -0
  51. package/dist/types/src/shapes/append-def.d.ts.map +1 -0
  52. package/dist/types/src/shapes/array-def.d.ts +35 -0
  53. package/dist/types/src/shapes/array-def.d.ts.map +1 -0
  54. package/dist/types/src/shapes/audio-def.d.ts +52 -0
  55. package/dist/types/src/shapes/audio-def.d.ts.map +1 -0
  56. package/dist/types/src/shapes/beacon-def.d.ts +52 -0
  57. package/dist/types/src/shapes/beacon-def.d.ts.map +1 -0
  58. package/dist/types/src/shapes/chat-def.d.ts +52 -0
  59. package/dist/types/src/shapes/chat-def.d.ts.map +1 -0
  60. package/dist/types/src/shapes/common/Box.d.ts +0 -2
  61. package/dist/types/src/shapes/common/Box.d.ts.map +1 -1
  62. package/dist/types/src/shapes/common/FunctionBody.d.ts +1 -3
  63. package/dist/types/src/shapes/common/FunctionBody.d.ts.map +1 -1
  64. package/dist/types/src/shapes/common/box-defs.d.ts +3 -0
  65. package/dist/types/src/shapes/common/box-defs.d.ts.map +1 -0
  66. package/dist/types/src/shapes/common/function-anchors.d.ts +7 -0
  67. package/dist/types/src/shapes/common/function-anchors.d.ts.map +1 -0
  68. package/dist/types/src/shapes/common/index.d.ts +2 -0
  69. package/dist/types/src/shapes/common/index.d.ts.map +1 -1
  70. package/dist/types/src/shapes/constant-def.d.ts +54 -0
  71. package/dist/types/src/shapes/constant-def.d.ts.map +1 -0
  72. package/dist/types/src/shapes/database-def.d.ts +52 -0
  73. package/dist/types/src/shapes/database-def.d.ts.map +1 -0
  74. package/dist/types/src/shapes/feed-def.d.ts +52 -0
  75. package/dist/types/src/shapes/feed-def.d.ts.map +1 -0
  76. package/dist/types/src/shapes/function-def.d.ts +52 -0
  77. package/dist/types/src/shapes/function-def.d.ts.map +1 -0
  78. package/dist/types/src/shapes/gpt-def.d.ts +52 -0
  79. package/dist/types/src/shapes/gpt-def.d.ts.map +1 -0
  80. package/dist/types/src/shapes/gpt-realtime-def.d.ts +52 -0
  81. package/dist/types/src/shapes/gpt-realtime-def.d.ts.map +1 -0
  82. package/dist/types/src/shapes/index.d.ts +23 -0
  83. package/dist/types/src/shapes/index.d.ts.map +1 -1
  84. package/dist/types/src/shapes/json-def.d.ts +102 -0
  85. package/dist/types/src/shapes/json-def.d.ts.map +1 -0
  86. package/dist/types/src/shapes/logic-def.d.ts +104 -0
  87. package/dist/types/src/shapes/logic-def.d.ts.map +1 -0
  88. package/dist/types/src/shapes/rng-def.d.ts +56 -0
  89. package/dist/types/src/shapes/rng-def.d.ts.map +1 -0
  90. package/dist/types/src/shapes/scope-def.d.ts +52 -0
  91. package/dist/types/src/shapes/scope-def.d.ts.map +1 -0
  92. package/dist/types/src/shapes/surface-def.d.ts +52 -0
  93. package/dist/types/src/shapes/surface-def.d.ts.map +1 -0
  94. package/dist/types/src/shapes/switch-def.d.ts +52 -0
  95. package/dist/types/src/shapes/switch-def.d.ts.map +1 -0
  96. package/dist/types/src/shapes/table-def.d.ts +52 -0
  97. package/dist/types/src/shapes/table-def.d.ts.map +1 -0
  98. package/dist/types/src/shapes/template-def.d.ts +56 -0
  99. package/dist/types/src/shapes/template-def.d.ts.map +1 -0
  100. package/dist/types/src/shapes/text-def.d.ts +52 -0
  101. package/dist/types/src/shapes/text-def.d.ts.map +1 -0
  102. package/dist/types/src/shapes/text-to-image-def.d.ts +52 -0
  103. package/dist/types/src/shapes/text-to-image-def.d.ts.map +1 -0
  104. package/dist/types/src/shapes/thread-def.d.ts +52 -0
  105. package/dist/types/src/shapes/thread-def.d.ts.map +1 -0
  106. package/dist/types/src/shapes/trigger-def.d.ts +18 -0
  107. package/dist/types/src/shapes/trigger-def.d.ts.map +1 -0
  108. package/dist/types/src/shapes/trigger-spec.d.ts +9 -0
  109. package/dist/types/src/shapes/trigger-spec.d.ts.map +1 -0
  110. package/dist/types/tsconfig.tsbuildinfo +1 -1
  111. package/package.json +43 -46
  112. package/src/compute.stories.tsx +1 -1
  113. package/src/shapes/Append.tsx +3 -31
  114. package/src/shapes/Array.tsx +3 -43
  115. package/src/shapes/Audio.tsx +2 -26
  116. package/src/shapes/Beacon.tsx +2 -29
  117. package/src/shapes/Chat.tsx +1 -36
  118. package/src/shapes/Constant.tsx +1 -37
  119. package/src/shapes/Database.tsx +2 -27
  120. package/src/shapes/Feed.tsx +4 -35
  121. package/src/shapes/Function.tsx +4 -38
  122. package/src/shapes/Gpt.tsx +3 -33
  123. package/src/shapes/GptRealtime.tsx +2 -36
  124. package/src/shapes/Json.tsx +4 -70
  125. package/src/shapes/Logic.tsx +3 -58
  126. package/src/shapes/RNG.tsx +2 -32
  127. package/src/shapes/Scope.tsx +2 -31
  128. package/src/shapes/Surface.tsx +2 -32
  129. package/src/shapes/Switch.tsx +2 -26
  130. package/src/shapes/Table.tsx +3 -34
  131. package/src/shapes/Template.tsx +6 -36
  132. package/src/shapes/Text.tsx +2 -28
  133. package/src/shapes/TextToImage.tsx +2 -27
  134. package/src/shapes/Thread.tsx +3 -34
  135. package/src/shapes/Trigger.tsx +6 -79
  136. package/src/shapes/append-def.ts +42 -0
  137. package/src/shapes/array-def.ts +54 -0
  138. package/src/shapes/audio-def.ts +36 -0
  139. package/src/shapes/beacon-def.ts +39 -0
  140. package/src/shapes/chat-def.tsx +47 -0
  141. package/src/shapes/common/Box.tsx +2 -5
  142. package/src/shapes/common/FunctionBody.tsx +6 -25
  143. package/src/shapes/common/box-defs.ts +10 -0
  144. package/src/shapes/common/function-anchors.ts +37 -0
  145. package/src/shapes/common/index.ts +3 -0
  146. package/src/shapes/constant-def.tsx +48 -0
  147. package/src/shapes/database-def.ts +37 -0
  148. package/src/shapes/feed-def.ts +44 -0
  149. package/src/shapes/function-def.ts +46 -0
  150. package/src/shapes/gpt-def.ts +43 -0
  151. package/src/shapes/gpt-realtime-def.ts +46 -0
  152. package/src/shapes/index.ts +25 -0
  153. package/src/shapes/json-def.ts +80 -0
  154. package/src/shapes/logic-def.ts +69 -0
  155. package/src/shapes/rng-def.ts +42 -0
  156. package/src/shapes/scope-def.ts +41 -0
  157. package/src/shapes/surface-def.ts +42 -0
  158. package/src/shapes/switch-def.ts +36 -0
  159. package/src/shapes/table-def.ts +45 -0
  160. package/src/shapes/template-def.ts +48 -0
  161. package/src/shapes/text-def.ts +38 -0
  162. package/src/shapes/text-to-image-def.ts +37 -0
  163. package/src/shapes/thread-def.ts +45 -0
  164. package/src/shapes/trigger-def.ts +63 -0
  165. package/src/shapes/trigger-spec.ts +44 -0
  166. package/dist/lib/browser/index.mjs +0 -2596
  167. package/dist/lib/browser/index.mjs.map +0 -7
  168. package/dist/lib/browser/meta.json +0 -1
  169. package/dist/lib/node-esm/index.mjs +0 -2596
  170. package/dist/lib/node-esm/index.mjs.map +0 -7
  171. package/dist/lib/node-esm/meta.json +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/hooks/compute-context.ts","../../src/hooks/useComputeGraphController.ts","../../src/hooks/useComputeNodeState.ts","../../src/hooks/useGraphMonitor.ts","../../src/graph/node-defs.ts","../../src/graph/controller.ts","../../src/shapes/common/box-defs.ts","../../src/shapes/defs.ts","../../src/shapes/common/function-anchors.ts","../../src/shapes/common/Box.tsx","../../src/shapes/common/FunctionBody.tsx","../../src/shapes/common/TypeSelect.tsx","../../src/shapes/Append.tsx","../../src/shapes/append-def.ts","../../src/shapes/Array.tsx","../../src/shapes/array-def.ts","../../src/shapes/Audio.tsx","../../src/shapes/audio-def.ts","../../src/shapes/Beacon.tsx","../../src/shapes/beacon-def.ts","../../src/shapes/Chat.tsx","../../src/shapes/chat-def.tsx","../../src/shapes/Constant.tsx","../../src/shapes/constant-def.tsx","../../src/shapes/Database.tsx","../../src/shapes/database-def.ts","../../src/shapes/Feed.tsx","../../src/shapes/feed-def.ts","../../src/shapes/Function.tsx","../../src/shapes/function-def.ts","../../src/shapes/Gpt.tsx","../../src/shapes/gpt-def.ts","../../src/shapes/GptRealtime.tsx","../../src/shapes/gpt-realtime-def.ts","../../src/shapes/Json.tsx","../../src/shapes/json-def.ts","../../src/shapes/Logic.tsx","../../src/shapes/logic-def.ts","../../src/shapes/RNG.tsx","../../src/shapes/rng-def.ts","../../src/shapes/Scope.tsx","../../src/shapes/scope-def.ts","../../src/shapes/Surface.tsx","../../src/shapes/surface-def.ts","../../src/shapes/Switch.tsx","../../src/shapes/switch-def.ts","../../src/shapes/Table.tsx","../../src/shapes/table-def.ts","../../src/shapes/Template.tsx","../../src/shapes/template-def.ts","../../src/shapes/Text.tsx","../../src/shapes/text-def.ts","../../src/shapes/TextToImage.tsx","../../src/shapes/text-to-image-def.ts","../../src/shapes/Thread.tsx","../../src/shapes/thread-def.ts","../../src/shapes/trigger-spec.ts","../../src/shapes/Trigger.tsx","../../src/shapes/trigger-def.ts","../../src/shapes/Boolean.tsx","../../src/registry.ts","../../src/compute-layout.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport { createContext, useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport type { ComputeGraphController } from '../graph';\n\nexport type ComputeContextType = {\n controller: ComputeGraphController;\n};\n\nexport const ComputeContext = createContext<ComputeContextType | null>(null);\n\nexport const useComputeContext = () => {\n return useContext(ComputeContext) ?? raise(new Error('Missing ComputeContext'));\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport { type RefObject, useEffect, useState } from 'react';\n\nimport { type CleanupFn } from '@dxos/async';\nimport { type EditorController, type EditorRootProps } from '@dxos/react-ui-canvas-editor';\n\nimport { type ComputeGraphController } from '../graph';\nimport { type ComputeShape } from '../shapes';\n\n// TODO(burdon): Move to async/context?\nconst combine = (...cbs: CleanupFn[]) => {\n return () => {\n for (const cb of cbs) {\n cb();\n }\n };\n};\n\nexport type UseComputeGraphControllerOptions = Pick<EditorRootProps<ComputeShape>, 'graph'> & {\n controller: ComputeGraphController | null;\n editorRef: RefObject<EditorController | null>;\n};\n\nexport const useComputeGraphController = ({ controller, graph, editorRef }: UseComputeGraphControllerOptions) => {\n const [, forceUpdate] = useState({});\n\n useEffect(() => {\n if (!controller || !graph) {\n return;\n }\n\n void controller.open();\n const off = combine(\n controller.update.on(() => {\n void editorRef.current?.update();\n forceUpdate({});\n }),\n\n // TODO(burdon): Every node is called on every update.\n controller.output.on(({ nodeId, property, value }) => {\n if (value.type === 'not-executed') {\n // If the node didn't execute, don't trigger.\n return;\n }\n\n const edge = graph.edges.find((edge) => {\n const source = graph.getNode(edge.source);\n return (source as ComputeShape).node === nodeId && edge.output === property;\n });\n\n if (edge) {\n void editorRef.current?.action?.({ type: 'trigger', edges: [edge] });\n }\n }),\n );\n\n return () => {\n void controller.close();\n off();\n };\n }, [graph, controller]);\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\nimport { useCallback, useEffect, useState } from 'react';\n\nimport type { ComputeNode, ComputeNodeMeta } from '@dxos/conductor';\nimport { invariant } from '@dxos/invariant';\n\nimport { type ComputeEvent, type RuntimeValue } from '../graph';\nimport { type ComputeShape } from '../shapes';\nimport { useComputeContext } from './compute-context';\n\nexport type ComputeNodeState = {\n node: ComputeNode;\n meta: ComputeNodeMeta;\n runtime: {\n inputs: Record<string, RuntimeValue>;\n outputs: Record<string, RuntimeValue>;\n setOutput: (property: string, value: any) => void;\n evalNode: () => void;\n subscribeToEventLog: (cb: (event: ComputeEvent) => void) => () => void;\n };\n};\n\n/**\n * Runtime state of a compute node.\n */\nexport const useComputeNodeState = (shape: ComputeShape): ComputeNodeState => {\n const { controller } = useComputeContext();\n invariant(controller);\n\n const [meta, setMeta] = useState<ComputeNodeMeta>();\n useEffect(() => {\n let disposed = false;\n queueMicrotask(async () => {\n invariant(shape.node, 'Node not specified');\n const node = controller.getComputeNode(shape.node);\n const meta = await controller.getMeta(node);\n if (disposed) {\n return;\n }\n\n setMeta(meta);\n });\n\n return () => {\n disposed = true;\n };\n }, [shape.node]);\n\n const evalNode = useCallback(() => {\n return controller.evalNode(shape.node!);\n }, [shape.node]);\n\n const subscribeToEventLog = useCallback(\n (cb: (event: ComputeEvent) => void): (() => void) => {\n return controller.events.on((ev) => {\n if (ev.nodeId === shape.node) {\n cb(ev);\n }\n });\n },\n [shape.node],\n );\n\n return {\n node: controller.getComputeNode(shape.node!),\n meta: meta ?? {\n input: Schema.Struct({}),\n output: Schema.Struct({}),\n },\n runtime: {\n inputs: controller.getInputs(shape.node!),\n outputs: controller.getOutputs(shape.node!),\n setOutput: (property: string, value: any) => {\n controller.setOutput(shape.node!, property, value);\n },\n evalNode,\n subscribeToEventLog,\n },\n };\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport { useMemo } from 'react';\n\nimport { type ComputeEdge, ComputeGraphModel, type ComputeNode, DEFAULT_INPUT, DEFAULT_OUTPUT } from '@dxos/conductor';\nimport { Obj, Ref } from '@dxos/echo';\nimport { invariant } from '@dxos/invariant';\nimport { type CanvasBoard, type CanvasGraphModel, type GraphMonitor } from '@dxos/react-ui-canvas-editor';\nimport { isNonNullable } from '@dxos/util';\n\nimport { createComputeNode, isValidComputeNode } from '../graph';\nimport { type ComputeShape, type TriggerShape } from '../shapes';\n\n/**\n * Map canvas edge to compute edge.\n */\nexport const mapEdge = (\n graph: CanvasGraphModel,\n { source, target, output = DEFAULT_OUTPUT, input = DEFAULT_INPUT }: CanvasBoard.Connection,\n): ComputeEdge => {\n const sourceNode = graph.findNode(source) as ComputeShape;\n const targetNode = graph.findNode(target) as ComputeShape;\n invariant(sourceNode?.node);\n invariant(targetNode?.node);\n\n return {\n id: Obj.ID.random(),\n source: sourceNode.node,\n target: targetNode.node,\n output,\n input,\n };\n};\n\n/**\n * Listens for changes to the graph and updates the compute graph.\n * @param model Compute graph to update on change.\n */\n// TODO(burdon): Generalize into sync function.\nexport const useGraphMonitor = (model?: ComputeGraphModel): GraphMonitor<ComputeShape> => {\n return useMemo<GraphMonitor<ComputeShape>>(() => {\n return {\n onCreate: ({ node }) => {\n if (!model) {\n return;\n }\n\n // Ignore shapes that don't have a corresponding node factory.\n invariant(node.type);\n if (!isValidComputeNode(node.type)) {\n return;\n }\n\n const computeNode = createComputeNode(node);\n if (node.type === 'trigger') {\n linkTriggerToCompute(model, computeNode, node as TriggerShape);\n }\n model.addNode(computeNode);\n node.node = computeNode.id;\n },\n\n onLink: ({ graph, edge }) => {\n if (model) {\n model.addEdge(mapEdge(graph, edge));\n }\n },\n\n onDelete: ({ subgraph }) => {\n if (model) {\n const nodeIds = subgraph.nodes.map((shape) => (shape as ComputeShape).node) as string[];\n\n // NOTE(ZaymonFC): Based on the information we have, this is O(edges to remove * compute edges).\n const edgeIds = subgraph.edges\n .map(({ source, target, output = DEFAULT_OUTPUT, input = DEFAULT_INPUT }) => {\n return model.edges.find((computeEdge) => computeEdge.input === input && computeEdge.output === output)\n ?.id;\n })\n .filter(isNonNullable);\n\n model.removeNodes(nodeIds);\n model.removeEdges(edgeIds);\n\n deleteTriggerObjects(model, subgraph);\n }\n },\n };\n }, [model]);\n};\n\nexport const createComputeGraph = (graph?: CanvasGraphModel<ComputeShape>) => {\n const computeGraph = ComputeGraphModel.create();\n\n if (graph) {\n for (const shape of graph.nodes) {\n if (isValidComputeNode(shape.type)) {\n const node = createComputeNode(shape);\n computeGraph.addNode(node);\n shape.node = node.id;\n }\n }\n\n for (const edge of graph.edges) {\n computeGraph.addEdge(mapEdge(graph, edge));\n }\n }\n\n return computeGraph;\n};\n\nconst linkTriggerToCompute = (graph: ComputeGraphModel, computeNode: ComputeNode, triggerData: TriggerShape) => {\n const functionTrigger = triggerData.functionTrigger?.target;\n invariant(functionTrigger);\n Obj.update(functionTrigger, (functionTrigger) => {\n // TODO(wittjosiah): Widen Runnable union to include ComputeGraph and remove cast.\n functionTrigger.runnable = Ref.make(graph.root) as any;\n functionTrigger.inputNodeId = computeNode.id;\n });\n};\n\nconst deleteTriggerObjects = (computeGraph: ComputeGraphModel, deleted: CanvasGraphModel) => {\n const db = Obj.getDatabase(computeGraph.root);\n if (!db) {\n return;\n }\n for (const node of deleted.nodes) {\n if (node.type === 'trigger') {\n const trigger = node as TriggerShape;\n db.remove(trigger.functionTrigger!.target!);\n }\n }\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport {\n type ComputeNode,\n type Executable,\n NODE_INPUT,\n NODE_OUTPUT,\n type NodeType,\n getTemplateInputSchema,\n registry,\n} from '@dxos/conductor';\nimport { raise } from '@dxos/debug';\nimport { JsonSchema, Obj } from '@dxos/echo';\nimport { invariant } from '@dxos/invariant';\n\nimport { type ComputeShape, type ConstantShape, type TemplateShape } from '../shapes';\n\nexport const resolveComputeNode = async (node: ComputeNode): Promise<Executable> => {\n const impl = registry[node.type as NodeType];\n invariant(impl, `Unknown node type: ${node.type}`);\n return impl;\n};\n\nexport const isValidComputeNode = (type: string): boolean => {\n return nodeFactory[type as NodeType] !== undefined;\n};\n\nexport const createComputeNode = (shape: ComputeShape): ComputeNode => {\n const type = shape.type ?? raise(new Error('Type not specified'));\n const factory = nodeFactory[type as NodeType] ?? raise(new Error(`Unknown shape type: ${type}`));\n return factory(shape);\n};\n\nconst nodeFactory: Record<NodeType | 'trigger', (shape: ComputeShape) => ComputeNode> = {\n // System.\n [NODE_INPUT]: () => createNode(NODE_INPUT),\n [NODE_OUTPUT]: () => createNode(NODE_OUTPUT),\n\n // Extensions.\n 'text-to-image': () => createNode('text-to-image'), // TODO(burdon): Rename ai-impage-tool\n 'and': () => createNode('and'),\n 'append': () => createNode('append'),\n 'audio': () => createNode('audio'),\n 'beacon': () => createNode('beacon'),\n 'chat': () => createNode('chat'),\n 'constant': (shape) =>\n createNode('constant', {\n value: (shape as ConstantShape).value,\n }),\n 'make-queue': () => createNode('make-queue'),\n 'database': () => createNode('database'),\n 'gpt': () => createNode('gpt'),\n 'gpt-realtime': () => createNode('gpt-realtime'),\n 'if': () => createNode('if'),\n 'if-else': () => createNode('if-else'),\n 'function': () => createNode('function'),\n 'json': () => createNode('json'),\n 'json-transform': () => createNode('json-transform'),\n 'not': () => createNode('not'),\n 'or': () => createNode('or'),\n 'queue': () => createNode('queue'),\n 'rng': () => createNode('rng'),\n 'reducer': () => createNode('reducer'),\n 'scope': () => createNode('scope'),\n 'surface': () => createNode('surface'),\n 'switch': () => createNode('switch'),\n 'template': (shape) => {\n const node = createNode('template', { valueType: (shape as TemplateShape).valueType, value: shape.text });\n // `toJsonSchema` reuses cached fragments (e.g. the `Schema.Any` JSON form) across calls; deep-copy so each\n // ECHO node owns its own schema record rather than reassigning ownership of a shared one.\n node.inputSchema = structuredClone(JsonSchema.toJsonSchema(getTemplateInputSchema(node)));\n return node;\n },\n 'text': () => createNode('text'),\n 'thread': () => createNode('thread'),\n 'trigger': () => createNode(NODE_INPUT),\n};\n\nconst createNode = (type: string, props?: Partial<ComputeNode>): ComputeNode => ({\n id: Obj.ID.random(),\n type,\n ...props,\n});\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Either from 'effect/Either';\nimport * as Exit from 'effect/Exit';\nimport * as Layer from 'effect/Layer';\nimport * as Scope from 'effect/Scope';\n\nimport type { AiService } from '@dxos/ai';\nimport { Event, synchronized } from '@dxos/async';\nimport { type Credential, type Operation, Trace } from '@dxos/compute';\nimport {\n ComputeBeginEvent,\n ComputeCustomEvent,\n type ComputeEdge,\n ComputeEndEvent,\n type ComputeGraphModel,\n ComputeInputEvent,\n type ComputeNode,\n ComputeNodeContext,\n type ComputeNodeMeta,\n ComputeOutputEvent,\n type GptInput,\n type GptOutput,\n type GraphDiagnostic,\n GraphExecutor,\n ValueBag,\n isNotExecuted,\n} from '@dxos/conductor';\nimport { Resource } from '@dxos/context';\nimport type { Database, Registry } from '@dxos/echo';\nimport { EffectEx } from '@dxos/effect';\nimport { log } from '@dxos/log';\nimport { type CanvasGraphModel } from '@dxos/react-ui-canvas-editor';\nimport { type ContentBlock } from '@dxos/types';\n\nimport { createComputeGraph } from '../hooks';\nimport { type ComputeShape } from '../shapes';\nimport { resolveComputeNode } from './node-defs';\n\n// TODO(burdon): API package for conductor.\nexport const InvalidStateError = Error;\n\nexport type FunctionCallback<INPUT, OUTPUT> = (input: INPUT) => Promise<OUTPUT>;\n\n/**\n * Callback to notify the controller of a scheduled update.\n */\nexport type AsyncUpdate<T> = (value: T) => void;\n\nexport interface GptExecutor {\n invoke: FunctionCallback<GptInput, GptOutput>;\n\n // TODO(dmaretskyi): A hack to get image artifacts working. Rework into querying images from the ai-service store.\n imageCache: Map<string, ContentBlock.Image>;\n}\n\nexport type RuntimeValue =\n | {\n type: 'not-executed'; // TODO(burdon): Different from pending?\n }\n | {\n type: 'executed';\n value: any;\n }\n | {\n type: 'pending';\n }\n | {\n type: 'error';\n error: string;\n };\n\ntype ComputeOutputEvent = {\n nodeId: string;\n property: string;\n value: RuntimeValue;\n};\n\n/**\n * Event emitted by the compute graph during execution.\n */\nexport type ComputeEvent =\n | { type: 'begin-compute'; nodeId: string; inputs: ReadonlyArray<string> }\n | { type: 'end-compute'; nodeId: string; outputs: ReadonlyArray<string> }\n | { type: 'compute-input'; nodeId: string; property: string; value: any }\n | { type: 'compute-output'; nodeId: string; property: string; value: any }\n | { type: 'custom'; nodeId: string; event: any };\n\n// TODO(dmaretskyi): Re-use function servies definition.\nexport type ComputeServices =\n | AiService.AiService\n | Database.Service\n | Credential.CredentialsService\n | Operation.Service\n | Registry.Service;\n\n/**\n * Nodes that will automatically trigger the execution of the graph on startup.\n */\nconst AUTO_TRIGGER_NODES = ['chat', 'switch', 'constant'];\n\n/**\n * Minimal runtime interface required by the {@link ComputeGraphController}.\n *\n * Satisfied by both `effect/ManagedRuntime.ManagedRuntime` and ad-hoc adapters\n * built on top of the app-framework `ProcessManagerRuntime`.\n */\nexport interface ComputeGraphRuntime {\n runPromiseExit<A, E>(effect: Effect.Effect<A, E, ComputeServices>): Promise<Exit.Exit<A, E>>;\n}\n\nexport const createComputeGraphController = (\n graph: CanvasGraphModel<ComputeShape>,\n computeRuntime: ComputeGraphRuntime,\n) => {\n const computeGraph = createComputeGraph(graph);\n const controller = new ComputeGraphController(computeRuntime, computeGraph);\n return { controller, graph };\n};\n\n/**\n * Controller that manages compute graph state, execution, and service coordination.\n */\nexport class ComputeGraphController extends Resource {\n private readonly _executor = new GraphExecutor({\n computeNodeResolver: (node) => resolveComputeNode(node),\n });\n\n private _diagnostics: GraphDiagnostic[] = [];\n\n /**\n * Canvas force-sets outputs of those nodes.\n */\n private _forcedOutputs: Record<string, Record<string, unknown>> = {};\n\n /**\n * Runtime state of the execution graph.\n */\n private _runtimeStateInputs: Record<string, Record<string, RuntimeValue>> = {};\n\n private _runtimeStateOutputs: Record<string, Record<string, RuntimeValue>> = {};\n\n // TODO(burdon): Remove? Make state reactive?\n public readonly update = new Event();\n\n /** Computed result. */\n public readonly output = new Event<ComputeOutputEvent>();\n\n public readonly events = new Event<ComputeEvent>();\n\n constructor(\n private readonly _computeRuntime: ComputeGraphRuntime,\n /** Persistent compute graph. */\n private readonly _graph: ComputeGraphModel,\n ) {\n super();\n }\n\n toJSON() {\n return {\n graph: this._graph,\n state: {\n inputs: this._runtimeStateInputs,\n outputs: this._runtimeStateOutputs,\n },\n forcedOutputs: this._forcedOutputs,\n };\n }\n\n get graph() {\n return this._graph;\n }\n\n get diagnostics() {\n return this._diagnostics;\n }\n\n get userState() {\n return this._forcedOutputs;\n }\n\n get inputStates() {\n return this._runtimeStateInputs;\n }\n\n get outputStates() {\n return this._runtimeStateOutputs;\n }\n\n /**\n * Inputs and outputs for all nodes.\n */\n get state(): Record<\n string,\n {\n node: ComputeNode;\n input: Record<string, RuntimeValue>;\n output: Record<string, RuntimeValue>;\n }\n > {\n const ids = [...new Set([...Object.keys(this._runtimeStateInputs), ...Object.keys(this._runtimeStateOutputs)])];\n return Object.fromEntries(\n ids.map((id) => [\n id,\n {\n node: this._graph.getNode(id),\n input: this._runtimeStateInputs[id],\n output: this._runtimeStateOutputs[id],\n },\n ]),\n );\n }\n\n addNode(node: ComputeNode): void {\n this._graph.addNode(node);\n }\n\n addEdge(edge: ComputeEdge): void {\n this._graph.addEdge(edge);\n }\n\n getComputeNode(nodeId: string): ComputeNode {\n return this._graph.getNode(nodeId);\n }\n\n getInputs(nodeId: string): Record<string, RuntimeValue> {\n return this._runtimeStateInputs[nodeId] ?? {};\n }\n\n getOutputs(nodeId: string): Record<string, RuntimeValue> {\n return this._runtimeStateOutputs[nodeId] ?? {};\n }\n\n setOutput(nodeId: string, property: string, value: any): void {\n this._forcedOutputs[nodeId] ??= {};\n this._forcedOutputs[nodeId][property] = value;\n\n queueMicrotask(async () => {\n try {\n await this.exec(nodeId);\n } catch (err) {\n log.catch(err);\n }\n });\n }\n\n async getMeta(node: ComputeNode): Promise<ComputeNodeMeta> {\n const { meta } = await resolveComputeNode(node);\n return meta;\n }\n\n @synchronized\n async checkGraph(): Promise<void> {\n const executor = this._executor.clone();\n await executor.load(this._graph);\n this._diagnostics = executor.getDiagnostics();\n }\n\n async evalNode(nodeId: string): Promise<void> {\n const executor = this._executor.clone();\n await executor.load(this._graph);\n\n for (const [nodeId, outputs] of Object.entries(this._forcedOutputs)) {\n executor.setOutputs(nodeId, Effect.succeed(ValueBag.make(outputs)));\n }\n\n EffectEx.unwrapExit(\n await this._computeRuntime.runPromiseExit(\n Effect.gen(this, function* () {\n const scope = yield* Scope.make();\n\n // TODO(dmaretskyi): Code duplication.\n const executable = yield* Effect.promise(() => resolveComputeNode(this._graph.getNode(nodeId)));\n const computingOutputs = executable.exec != null;\n // TODO(dmaretskyi): Check if the node has a compute function and run computeOutputs if it does.\n const effect = (computingOutputs ? executor.computeOutputs(nodeId) : executor.computeInputs(nodeId)).pipe(\n Effect.withSpan('runGraph'),\n Scope.extend(scope),\n Effect.provide(\n Layer.mergeAll(\n Layer.succeed(Trace.TraceService, this._createTraceWriter()),\n ComputeNodeContext.layerNoop,\n ),\n ),\n Effect.flatMap(computeValueBag),\n Effect.withSpan('test'),\n Effect.tap((values) => {\n for (const [key, value] of Object.entries(values)) {\n if (computingOutputs) {\n this._onOutputComputed(nodeId, key, value);\n } else {\n this._onInputComputed(nodeId, key, value);\n }\n }\n }),\n );\n\n yield* effect;\n\n yield* Scope.close(scope, Exit.void);\n }),\n ),\n );\n\n this.update.emit();\n }\n\n /**\n * Executes the graph.\n * @param startFromNode - Node to start from, otherwise all {@link AUTO_TRIGGER_NODES} are executed.\n */\n @synchronized\n async exec(startFromNode?: string): Promise<void> {\n this._runtimeStateInputs = {};\n this._runtimeStateOutputs = {};\n const executor = this._executor.clone();\n await executor.load(this._graph);\n\n for (const [nodeId, outputs] of Object.entries(this._forcedOutputs)) {\n executor.setOutputs(nodeId, Effect.succeed(ValueBag.make(outputs)));\n }\n\n // TODO(dmaretskyi): Stop hardcoding.\n const triggerNodes =\n startFromNode != null\n ? [this._graph.getNode(startFromNode)]\n : this._graph.nodes.filter((node) => node.type != null && AUTO_TRIGGER_NODES.includes(node.type));\n const allAffectedNodes = [...new Set(triggerNodes.flatMap((node) => executor.getAllDependantNodes(node.id)))];\n\n EffectEx.unwrapExit(\n await this._computeRuntime.runPromiseExit(\n Effect.gen(this, function* () {\n const scope = yield* Scope.make();\n\n // TODO(burdon): Return map?\n const tasks: Effect.Effect<unknown, any, ComputeServices>[] = [];\n for (const node of allAffectedNodes) {\n // TODO(dmaretskyi): Code duplication.\n const executable = yield* Effect.promise(() => resolveComputeNode(this._graph.getNode(node)));\n const computingOutputs = executable.exec != null;\n\n // TODO(dmaretskyi): Check if the node has a compute function and run computeOutputs if it does.\n const effect = (computingOutputs ? executor.computeOutputs(node) : executor.computeInputs(node)).pipe(\n Effect.withSpan('runGraph'),\n Scope.extend(scope),\n Effect.flatMap(computeValueBag),\n Effect.provide(\n Layer.mergeAll(\n Layer.succeed(Trace.TraceService, this._createTraceWriter()),\n ComputeNodeContext.layerNoop,\n ),\n ),\n\n Effect.withSpan('test'),\n Effect.tap((values) => {\n for (const [key, value] of Object.entries(values)) {\n if (computingOutputs) {\n this._onOutputComputed(node, key, value);\n } else {\n this._onInputComputed(node, key, value);\n }\n }\n }),\n );\n\n tasks.push(effect);\n }\n\n //\n yield* Effect.all(tasks);\n\n //\n yield* Scope.close(scope, Exit.void);\n }),\n ),\n );\n\n this.update.emit();\n }\n\n private _createTraceWriter(): Trace.TraceWriter {\n return {\n write: (eventType, payload) => {\n const event = traceEventToComputeEvent(eventType.key, payload);\n if (event) {\n this._handleEvent(event);\n }\n },\n };\n }\n\n private _handleEvent(event: ComputeEvent): void {\n log('handleEvent', { event });\n switch (event.type) {\n case 'compute-input': {\n this._onInputComputed(event.nodeId, event.property, { type: 'executed', value: event.value });\n break;\n }\n\n case 'compute-output': {\n this._onOutputComputed(event.nodeId, event.property, { type: 'executed', value: event.value });\n break;\n }\n }\n this.events.emit(event);\n }\n\n private _onInputComputed(nodeId: string, property: string, value: RuntimeValue): void {\n this._runtimeStateInputs[nodeId] ??= {};\n this._runtimeStateInputs[nodeId][property] = value;\n }\n\n private _onOutputComputed(nodeId: string, property: string, value: RuntimeValue): void {\n this._runtimeStateOutputs[nodeId] ??= {};\n this._runtimeStateOutputs[nodeId][property] = value;\n\n // TODO(burdon): Only fire if changed?\n this.output.emit({ nodeId, property, value });\n }\n}\n\nconst traceEventToComputeEvent = (key: string, payload: unknown): ComputeEvent | undefined => {\n switch (key) {\n case ComputeBeginEvent.key:\n return { type: 'begin-compute', ...(payload as { nodeId: string; inputs: ReadonlyArray<string> }) };\n case ComputeEndEvent.key:\n return { type: 'end-compute', ...(payload as { nodeId: string; outputs: ReadonlyArray<string> }) };\n case ComputeInputEvent.key:\n return { type: 'compute-input', ...(payload as { nodeId: string; property: string; value: any }) };\n case ComputeOutputEvent.key:\n return { type: 'compute-output', ...(payload as { nodeId: string; property: string; value: any }) };\n case ComputeCustomEvent.key:\n return { type: 'custom', ...(payload as { nodeId: string; event: any }) };\n default:\n return undefined;\n }\n};\n\n/**\n * Waits for all effects in the bag to complete and returns the `RuntimeValue` for each property.\n */\nconst computeValueBag = (bag: ValueBag<any>): Effect.Effect<Record<string, RuntimeValue>, never, never> => {\n return Effect.all(\n Object.entries(bag.values).map(([key, eff]) =>\n Effect.either(eff).pipe(\n Effect.map((value) => {\n if (Either.isLeft(value)) {\n if (isNotExecuted(value.left)) {\n return [key, { type: 'not-executed' }] as const;\n } else {\n return [key, { type: 'error', error: value.left }] as const;\n }\n } else {\n return [key, { type: 'executed', value: value.right }] as const;\n }\n }),\n ),\n ),\n ).pipe(Effect.map((entries) => Object.fromEntries(entries) as Record<string, RuntimeValue>));\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\n// Kept out of `Box.tsx`: react-refresh only fast-refreshes a module whose\n// exports are all components, so values exported beside them force a full page reload on every edit.\n\nexport const headerHeight = 32;\n\nexport const footerHeight = 32;\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\nimport * as SchemaAST from 'effect/SchemaAST';\n\nimport { DEFAULT_INPUT, DEFAULT_OUTPUT } from '@dxos/conductor';\nimport { Obj } from '@dxos/echo';\nimport { Polygon } from '@dxos/react-ui-canvas-editor';\nimport { type MakeOptional } from '@dxos/util';\n\n//\n// Properties\n//\n\nexport type PropertyKind = 'input' | 'output';\n\nexport const getProperties = (ast: SchemaAST.AST) =>\n SchemaAST.getPropertySignatures(ast).map(({ name }) => ({ name: name.toString() }));\n\nexport const createAnchorId = (kind: PropertyKind, property = kind === 'input' ? DEFAULT_INPUT : DEFAULT_OUTPUT) =>\n [kind, property].join('.');\n\nexport const parseAnchorId = (id: string): [PropertyKind | undefined, string] => {\n const parts = id.match(/(input|output)\\.(.+)/);\n return parts ? (parts.slice(1) as any) : [undefined, id];\n};\n\n//\n// Shapes\n//\n\nexport type CreateShapeProps<S extends Polygon> = Omit<MakeOptional<S, 'id' | 'size'>, 'type' | 'node'>;\n\nexport const ComputeShape = Schema.extend(\n Polygon,\n Schema.Struct({\n // TODO(burdon): Rename computeNode?\n node: Schema.optional(Obj.ID.annotations({ description: 'Compute node id' })),\n }).pipe(Schema.mutable),\n);\n\nexport type ComputeShape = Schema.Schema.Type<typeof ComputeShape>;\n\nexport const createShape = <S extends ComputeShape>({ id, ...rest }: CreateShapeProps<S> & { type: string }): S => {\n return {\n id: id ?? Obj.ID.random(),\n ...rest,\n } as S;\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport type * as Schema from 'effect/Schema';\nimport * as SchemaAST from 'effect/SchemaAST';\n\nimport { VoidInput, VoidOutput } from '@dxos/conductor';\nimport { type Polygon } from '@dxos/react-ui-canvas-editor';\nimport { createAnchors, rowHeight } from '@dxos/react-ui-canvas-editor';\n\nimport { footerHeight, headerHeight } from '../common';\nimport { createAnchorId } from '../defs';\n\n// Kept out of `FunctionBody.tsx`: react-refresh only fast-refreshes a module whose\n// exports are all components, so values exported beside them force a full page reload on every edit.\n\n/** Vertical padding inside the function body; the height maths below depends on it. */\nexport const bodyPadding = 8;\n\nexport const getHeight = (input: Schema.Schema<any>) => {\n const properties = SchemaAST.getPropertySignatures(input.ast);\n return headerHeight + footerHeight + bodyPadding * 2 + properties.length * rowHeight + 2; // Incl. borders.\n};\n\nexport const createFunctionAnchors = (\n shape: Polygon,\n input: Schema.Schema<any> = VoidInput,\n output: Schema.Schema<any> = VoidOutput,\n) => {\n // TODO(burdon): Set type.\n const inputs = SchemaAST.getPropertySignatures(input.ast).map(({ name }) => createAnchorId('input', name.toString()));\n const outputs = SchemaAST.getPropertySignatures(output.ast).map(({ name }) =>\n createAnchorId('output', name.toString()),\n );\n return createAnchors({ shape, inputs, outputs, center: { x: 0, y: (headerHeight - footerHeight) / 2 + 1 } });\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { type PropsWithChildren, type ReactNode, forwardRef } from 'react';\n\nimport { invariant } from '@dxos/invariant';\nimport { Icon, IconButton, type ThemedClassName } from '@dxos/react-ui';\nimport { type CanvasBoard, useEditorContext, useShapeDef } from '@dxos/react-ui-canvas-editor';\nimport { mx } from '@dxos/ui-theme';\n\nexport type BoxActionHandler = (action: 'run' | 'open' | 'close') => void;\n\nexport type BoxProps = PropsWithChildren<\n ThemedClassName<{\n shape: CanvasBoard.Shape;\n title?: string;\n status?: string | ReactNode;\n open?: boolean;\n onAction?: BoxActionHandler;\n }>\n>;\n\nexport const Box = forwardRef<HTMLDivElement, BoxProps>(\n ({ children, classNames, shape, title, status, open, onAction }, forwardedRef) => {\n invariant(shape.type);\n const { icon, name, openable } = useShapeDef(shape.type) ?? { icon: 'ph--circle-dashed--regular' };\n const { debug } = useEditorContext();\n\n return (\n <div ref={forwardedRef} className='flex flex-col h-full w-full justify-between'>\n <div className='flex shrink-0 w-full justify-between items-center h-[32px] dx-input-surface'>\n <Icon icon={icon} classNames='mx-2' />\n <div className='grow text-sm truncate'>{debug ? shape.type : (name ?? shape.text ?? title)}</div>\n <IconButton\n classNames='p-1 text-green-500'\n variant='ghost'\n icon='ph--play--regular'\n label='run'\n iconOnly\n onDoubleClick={(ev) => ev.stopPropagation()}\n onClick={(ev) => {\n ev.stopPropagation();\n onAction?.('run');\n }}\n />\n </div>\n <div className={mx('flex flex-col h-full grow overflow-hidden', classNames)}>{children}</div>\n <div className='flex shrink-0 w-full justify-between items-center h-[32px] dx-input-surface'>\n <div className='grow px-2 text-sm truncate'>{debug ? shape.id : status}</div>\n {openable && (\n <IconButton\n classNames='p-1'\n variant='ghost'\n icon={open ? 'ph--caret-up--regular' : 'ph--caret-down--regular'}\n label={open ? 'close' : 'open'}\n iconOnly\n onClick={(ev) => {\n ev.stopPropagation();\n onAction?.(open ? 'close' : 'open');\n }}\n />\n )}\n </div>\n </div>\n );\n },\n);\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport type * as Schema from 'effect/Schema';\nimport React, { type JSX, useRef, useState } from 'react';\n\nimport { VoidInput, VoidOutput } from '@dxos/conductor';\nimport { useCanvasContext } from '@dxos/react-ui-canvas';\nimport { type CanvasBoard } from '@dxos/react-ui-canvas-editor';\nimport { getParentShapeElement, rowHeight } from '@dxos/react-ui-canvas-editor';\n\nimport { Box, type BoxProps } from '../common';\nimport { getProperties } from '../defs';\nimport { bodyPadding } from './function-anchors';\n\nconst expandedHeight = 200;\n\nexport type FunctionBodyProps = {\n shape: CanvasBoard.Shape;\n name?: string;\n content?: JSX.Element;\n inputSchema?: Schema.Schema.Any;\n outputSchema?: Schema.Schema.Any;\n} & Pick<BoxProps, 'status'>;\n\n// TODO(wittjosiah): Rename, not used for functions.\nexport const FunctionBody = ({\n shape,\n name,\n content,\n inputSchema = VoidInput,\n outputSchema = VoidOutput,\n ...props\n}: FunctionBodyProps) => {\n const { scale } = useCanvasContext();\n const rootRef = useRef<HTMLDivElement>(null);\n const [open, setOpen] = useState(false);\n\n const handleAction: BoxProps['onAction'] = (action) => {\n if (!rootRef.current) {\n return;\n }\n\n switch (action) {\n case 'open': {\n const el = getParentShapeElement(rootRef.current, shape.id)!;\n const { height } = el.getBoundingClientRect();\n el.style.height = `${height / scale + expandedHeight}px`;\n setOpen(true);\n break;\n }\n case 'close': {\n const el = getParentShapeElement(rootRef.current, shape.id)!;\n el.style.height = '';\n setOpen(false);\n break;\n }\n }\n };\n\n // TODO(burdon): Move labels to anchor?\n const inputs = getProperties(inputSchema.ast);\n const outputs = getProperties(outputSchema.ast);\n const columnCount = inputs.length && outputs.length ? 2 : 1;\n\n return (\n <Box\n ref={rootRef}\n shape={shape}\n title={name}\n classNames='divide-y divide-subdued-separator'\n open={open}\n onAction={handleAction}\n {...props}\n >\n <div\n className={`grid grid-cols-${columnCount} items-center`}\n style={{ paddingTop: bodyPadding, paddingBottom: bodyPadding }}\n >\n {(inputs?.length ?? 0) > 0 && (\n <div className='flex flex-col'>\n {inputs?.map(({ name }) => (\n <div key={name} className='px-2 truncate text-sm font-mono items-center' style={{ height: rowHeight }}>\n {name}\n </div>\n ))}\n </div>\n )}\n {(outputs?.length ?? 0) > 0 && (\n <div className='flex flex-col'>\n {outputs?.map(({ name }) => (\n <div\n key={name}\n className='px-2 truncate text-sm font-mono items-center text-right'\n style={{ height: rowHeight }}\n >\n {name}\n </div>\n ))}\n </div>\n )}\n </div>\n {open && <div className='flex flex-col grow overflow-hidden'>{content}</div>}\n </Box>\n );\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { ComputeValueType } from '@dxos/conductor';\nimport { Select, type SelectRootProps } from '@dxos/react-ui';\n\n// TODO(burdon): Factor out.\nexport const TypeSelect = ({ value, onValueChange }: Pick<SelectRootProps, 'value' | 'onValueChange'>) => {\n return (\n <Select.Root value={value} onValueChange={onValueChange}>\n <Select.TriggerButton variant='ghost' classNames='w-full px-0!' />\n <Select.Portal>\n <Select.Content>\n <Select.ScrollUpButton />\n <Select.Viewport>\n {ComputeValueType.literals.map((type) => (\n <Select.Option key={type} value={type}>\n {type}\n </Select.Option>\n ))}\n </Select.Viewport>\n <Select.ScrollDownButton />\n <Select.Arrow />\n </Select.Content>\n </Select.Portal>\n </Select.Root>\n );\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { AppendInput } from '@dxos/conductor';\nimport { type ShapeComponentProps } from '@dxos/react-ui-canvas-editor';\n\nimport { type AppendShape } from './append-def';\nimport { FunctionBody } from './common';\n\nexport const AppendComponent = ({ shape }: ShapeComponentProps<AppendShape>) => {\n return <FunctionBody shape={shape} inputSchema={AppendInput} />;\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { AppendInput } from '@dxos/conductor';\nimport { type ShapeDef } from '@dxos/react-ui-canvas-editor';\n\nimport { AppendComponent } from './Append';\nimport { createFunctionAnchors, getHeight } from './common';\nimport { ComputeShape, type CreateShapeProps, createShape } from './defs';\n\n// Kept out of `Append.tsx`: react-refresh only fast-refreshes a module whose\n// exports are all components, so values exported beside them force a full page reload on every edit.\n\nexport const AppendShape = Schema.extend(\n ComputeShape,\n Schema.Struct({\n type: Schema.Literal('append'),\n }),\n);\n\nexport type AppendShape = Schema.Schema.Type<typeof AppendShape>;\n\nexport type CreateAppendProps = CreateShapeProps<AppendShape>;\n\nexport const createAppend = (props: CreateAppendProps) =>\n createShape<AppendShape>({\n type: 'append',\n size: { width: 128, height: getHeight(AppendInput) },\n ...props,\n });\n\nexport const appendShape: ShapeDef<AppendShape> = {\n type: 'append',\n name: 'Append',\n icon: 'ph--list-plus--regular',\n component: AppendComponent,\n createShape: createAppend,\n getAnchors: (shape) => createFunctionAnchors(shape, AppendInput),\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { ReducerInput, ReducerOutput } from '@dxos/conductor';\nimport { type ShapeComponentProps } from '@dxos/react-ui-canvas-editor';\n\nimport { type ReducerShape } from './array-def';\nimport { FunctionBody } from './common';\n\n//\n// Components\n//\n\nexport type ReducerComponentProps = ShapeComponentProps<ReducerShape>;\n\nexport const ReducerComponent = ({ shape }: ReducerComponentProps) => {\n return <FunctionBody shape={shape} inputSchema={ReducerInput} outputSchema={ReducerOutput} />;\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { ReducerInput, ReducerOutput } from '@dxos/conductor';\nimport { type ShapeDef } from '@dxos/react-ui-canvas-editor';\n\nimport { ReducerComponent } from './Array';\nimport { createFunctionAnchors, getHeight } from './common';\nimport { ComputeShape, type CreateShapeProps, createShape } from './defs';\n\n// Kept out of `Array.tsx`: react-refresh only fast-refreshes a module whose\n// exports are all components, so values exported beside them force a full page reload on every edit.\n\n//\n// Data\n//\n\nexport const ReducerShape = Schema.extend(\n ComputeShape,\n Schema.Struct({\n type: Schema.Literal('reducer'),\n }),\n);\n\nexport type ReducerShape = Schema.Schema.Type<typeof ReducerShape>;\n\n//\n// Defs\n//\n\nexport type CreateReduceProps = CreateShapeProps<ReducerShape> & { reduce?: string };\n\nexport const createReducer = ({\n id,\n size = { width: 192, height: getHeight(ReducerInput) },\n ...rest\n}: CreateReduceProps): ReducerShape =>\n createShape<ReducerShape>({\n type: 'reducer',\n size,\n ...rest,\n });\n\nexport const reducerShape: ShapeDef<ReducerShape> = {\n type: 'reducer',\n name: 'Reducer',\n icon: 'ph--repeat--regular',\n component: ReducerComponent,\n createShape: createReducer,\n getAnchors: (shape) => createFunctionAnchors(shape, ReducerInput, ReducerOutput),\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useEffect, useState } from 'react';\n\nimport { DEFAULT_OUTPUT } from '@dxos/conductor';\nimport { Icon } from '@dxos/react-ui';\nimport { type ShapeComponentProps } from '@dxos/react-ui-canvas-editor';\n\nimport { useComputeNodeState } from '../hooks';\nimport { type AudioShape } from './audio-def';\n\nexport const AudioComponent = ({ shape }: ShapeComponentProps<AudioShape>) => {\n const { runtime } = useComputeNodeState(shape);\n const [active, setActive] = useState(false);\n useEffect(() => {\n runtime.setOutput(DEFAULT_OUTPUT, active);\n }, [active]);\n\n // https://docs.pmnd.rs/react-three-fiber/api/canvas#render-props\n return (\n <div className='flex w-full justify-center items-center'>\n <Icon\n icon={active ? 'ph--microphone--regular' : 'ph--microphone-slash--regular'}\n classNames={['transition opacity-20 duration-1000', active && 'opacity-100 text-error-text']}\n size={8}\n onClick={() => setActive(!active)}\n />\n </div>\n );\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { type ShapeDef, createAnchorMap } from '@dxos/react-ui-canvas-editor';\n\nimport { AudioComponent } from './Audio';\nimport { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';\n\n// Kept out of `Audio.tsx`: react-refresh only fast-refreshes a module whose\n// exports are all components, so values exported beside them force a full page reload on every edit.\n\nexport const AudioShape = Schema.extend(\n ComputeShape,\n Schema.Struct({\n type: Schema.Literal('audio'),\n }),\n);\n\nexport type AudioShape = Schema.Schema.Type<typeof AudioShape>;\n\nexport type CreateAudioProps = CreateShapeProps<AudioShape>;\n\nexport const createAudio = (props: CreateAudioProps) =>\n createShape<AudioShape>({ type: 'audio', size: { width: 64, height: 64 }, ...props });\n\nexport const audioShape: ShapeDef<AudioShape> = {\n type: 'audio',\n name: 'Audio',\n icon: 'ph--microphone--regular',\n component: AudioComponent,\n createShape: createAudio,\n getAnchors: (shape) => createAnchorMap(shape, { [createAnchorId('output')]: { x: 1, y: 0 } }),\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { DEFAULT_INPUT, isTruthy } from '@dxos/conductor';\nimport { Icon } from '@dxos/react-ui';\nimport { type ShapeComponentProps } from '@dxos/react-ui-canvas-editor';\n\nimport { useComputeNodeState } from '../hooks';\nimport { type BeaconShape } from './beacon-def';\n\nexport const BeaconComponent = ({ shape }: ShapeComponentProps<BeaconShape>) => {\n const { runtime } = useComputeNodeState(shape);\n const input = runtime.inputs[DEFAULT_INPUT];\n const value = input?.type === 'executed' ? input.value : false;\n\n return (\n <div className='flex w-full justify-center items-center'>\n <Icon\n icon='ph--sun--regular'\n classNames={['transition opacity-20 duration-1000', isTruthy(value) && 'opacity-100 text-yellow-500']}\n size={8}\n />\n </div>\n );\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { type ShapeDef, createAnchorMap } from '@dxos/react-ui-canvas-editor';\n\nimport { BeaconComponent } from './Beacon';\nimport { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';\n\n// Kept out of `Beacon.tsx`: react-refresh only fast-refreshes a module whose\n// exports are all components, so values exported beside them force a full page reload on every edit.\n\nexport const BeaconShape = Schema.extend(\n ComputeShape,\n Schema.Struct({\n type: Schema.Literal('beacon'),\n }),\n);\n\nexport type BeaconShape = Schema.Schema.Type<typeof BeaconShape>;\n\nexport type CreateBeaconProps = CreateShapeProps<BeaconShape>;\n\nexport const createBeacon = (props: CreateBeaconProps) =>\n createShape<BeaconShape>({ type: 'beacon', size: { width: 64, height: 64 }, ...props });\n\nexport const beaconShape: ShapeDef<BeaconShape> = {\n type: 'beacon',\n name: 'Beacon',\n icon: 'ph--sun--regular',\n component: BeaconComponent,\n createShape: createBeacon,\n getAnchors: (shape) =>\n createAnchorMap(shape, {\n [createAnchorId('input')]: { x: -1, y: 0 },\n }),\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useRef } from 'react';\n\nimport { DEFAULT_OUTPUT } from '@dxos/conductor';\nimport {\n type ShapeComponentProps,\n TextBox,\n type TextBoxControl,\n type TextBoxProps,\n} from '@dxos/react-ui-canvas-editor';\n\nimport { useComputeNodeState } from '../hooks';\nimport { type ChatShape } from './chat-def';\nimport { Box } from './common';\n\n//\n// Component\n//\n\nexport type TextInputComponentProps = ShapeComponentProps<ChatShape> & TextBoxProps & { title?: string };\n\nexport const TextInputComponent = ({ shape, title, ...props }: TextInputComponentProps) => {\n const { runtime } = useComputeNodeState(shape);\n const inputRef = useRef<TextBoxControl>(null);\n\n const handleEnter: TextBoxProps['onEnter'] = (text) => {\n const value = text.trim();\n if (value.length) {\n runtime.setOutput(DEFAULT_OUTPUT, value);\n inputRef.current?.setText('');\n }\n };\n\n return (\n <Box shape={shape} title={title}>\n <TextBox ref={inputRef} onEnter={handleEnter} {...props} />\n </Box>\n );\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\nimport React from 'react';\n\nimport { type ShapeDef } from '@dxos/react-ui-canvas-editor';\nimport { createAnchorMap } from '@dxos/react-ui-canvas-editor';\n\nimport { TextInputComponent } from './Chat';\nimport { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';\n\n// Kept out of `Chat.tsx`: react-refresh only fast-refreshes a module whose\n// exports are all components, so values exported beside them force a full page reload on every edit.\n\n//\n// Data\n//\n\nexport const ChatShape = Schema.extend(\n ComputeShape,\n Schema.Struct({\n type: Schema.Literal('chat'),\n }),\n);\n\nexport type ChatShape = Schema.Schema.Type<typeof ChatShape>;\n\n//\n// Defs\n//\n\nexport type CreateChatProps = CreateShapeProps<ChatShape>;\n\nexport const createChat = (props: CreateChatProps) =>\n createShape<ChatShape>({ type: 'chat', size: { width: 256, height: 128 }, ...props });\n\nexport const chatShape: ShapeDef<ChatShape> = {\n type: 'chat',\n name: 'Chat',\n icon: 'ph--textbox--regular',\n component: (props) => <TextInputComponent {...props} title={'Prompt'} placeholder={'Message'} />,\n createShape: createChat,\n getAnchors: (shape) => createAnchorMap(shape, { [createAnchorId('output')]: { x: 1, y: 0 } }),\n resizable: true,\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback, useRef, useState } from 'react';\n\nimport { ComputeValueType } from '@dxos/conductor';\nimport { Input } from '@dxos/react-ui';\nimport {\n type ShapeComponentProps,\n TextBox,\n type TextBoxControl,\n type TextBoxProps,\n} from '@dxos/react-ui-canvas-editor';\nimport { safeParseJson } from '@dxos/util';\n\nimport { useComputeNodeState } from '../hooks';\nimport { Box, TypeSelect } from './common';\nimport { type ConstantShape } from './constant-def';\n\n//\n// Component\n//\n\nexport type ConstantComponentProps = ShapeComponentProps<ConstantShape> &\n TextBoxProps & { title?: string; chat?: boolean };\n\nconst inferType = (value: any): string | undefined => {\n if (typeof value === 'string') {\n return 'string';\n } else if (typeof value === 'number') {\n return 'number';\n } else if (typeof value === 'boolean') {\n return 'boolean';\n } else if (typeof value === 'object') {\n return 'object';\n }\n};\n\nexport const ConstantComponent = ({ shape, title, chat, ...props }: ConstantComponentProps) => {\n const { node } = useComputeNodeState(shape);\n const [type, setType] = useState(inferType(node.value) ?? ComputeValueType.literals[0]);\n const inputRef = useRef<TextBoxControl>(null);\n\n const handleEnter = useCallback<NonNullable<TextBoxProps['onEnter']>>(\n (text) => {\n const value = text.trim();\n if (value.length) {\n // TODO(burdon): Set text filter.\n if (type === 'number') {\n const floatValue = parseFloat(value);\n if (!isNaN(floatValue)) {\n node.value = floatValue;\n }\n } else if (type === 'object') {\n node.value = safeParseJson(value, {});\n } else {\n node.value = value;\n }\n\n inputRef.current?.focus();\n }\n },\n [type],\n );\n\n return (\n <Box shape={shape} title={title} status={<TypeSelect value={type} onValueChange={setType} />}>\n {(type === 'string' || type === 'number') && (\n <TextBox {...props} ref={inputRef} value={node.value} onEnter={handleEnter} />\n )}\n {type === 'object' && (\n <TextBox {...props} ref={inputRef} value={JSON.stringify(node.value, null, 2)} language={'json'} />\n )}\n {type === 'boolean' && (\n <div className='flex grow justify-center items-center'>\n <Input.Root>\n <Input.Switch\n checked={node.value}\n onCheckedChange={(value) => {\n node.value = value;\n }}\n />\n </Input.Root>\n </div>\n )}\n </Box>\n );\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\nimport React from 'react';\n\nimport { type ShapeDef } from '@dxos/react-ui-canvas-editor';\nimport { createAnchorMap } from '@dxos/react-ui-canvas-editor';\n\nimport { ConstantComponent } from './Constant';\nimport { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';\n\n// Kept out of `Constant.tsx`: react-refresh only fast-refreshes a module whose\n// exports are all components, so values exported beside them force a full page reload on every edit.\n\n//\n// Data\n//\n\nexport const ConstantShape = Schema.extend(\n ComputeShape,\n Schema.Struct({\n type: Schema.Literal('constant'),\n value: Schema.optional(Schema.Any),\n }),\n);\n\nexport type ConstantShape = Schema.Schema.Type<typeof ConstantShape>;\n\n//\n// Defs\n//\n\nexport type CreateConstantProps = CreateShapeProps<ConstantShape>;\n\nexport const createConstant = (props: CreateConstantProps) =>\n createShape<ConstantShape>({ type: 'constant', size: { width: 192, height: 128 }, ...props });\n\nexport const constantShape: ShapeDef<ConstantShape> = {\n type: 'constant',\n name: 'Value',\n icon: 'ph--dots-three-circle--regular',\n component: (props) => <ConstantComponent {...props} placeholder={'Constant'} />,\n createShape: createConstant,\n getAnchors: (shape) => createAnchorMap(shape, { [createAnchorId('output')]: { x: 1, y: 0 } }),\n resizable: true,\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type ShapeComponentProps } from '@dxos/react-ui-canvas-editor';\n\nimport { Box } from './common';\nimport { type DatabaseShape } from './database-def';\n\nexport const DatabaseComponent = ({ shape }: ShapeComponentProps<DatabaseShape>) => {\n return <Box shape={shape} />;\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { type ShapeDef } from '@dxos/react-ui-canvas-editor';\nimport { createAnchorMap } from '@dxos/react-ui-canvas-editor';\n\nimport { DatabaseComponent } from './Database';\nimport { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';\n\n// Kept out of `Database.tsx`: react-refresh only fast-refreshes a module whose\n// exports are all components, so values exported beside them force a full page reload on every edit.\n\nexport const DatabaseShape = Schema.extend(\n ComputeShape,\n Schema.Struct({\n type: Schema.Literal('database'),\n }),\n);\n\nexport type DatabaseShape = Schema.Schema.Type<typeof DatabaseShape>;\n\nexport type CreateDatabaseProps = CreateShapeProps<DatabaseShape>;\n\nexport const createDatabase = (props: CreateDatabaseProps) =>\n createShape<DatabaseShape>({ type: 'database', size: { width: 128, height: 64 }, ...props });\n\nexport const databaseShape: ShapeDef<DatabaseShape> = {\n type: 'database',\n name: 'ECHO',\n icon: 'ph--database--regular',\n component: DatabaseComponent,\n createShape: createDatabase,\n getAnchors: (shape) => createAnchorMap(shape, { [createAnchorId('output')]: { x: 1, y: 0 } }),\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { Fragment } from 'react';\n\nimport { DEFAULT_OUTPUT } from '@dxos/conductor';\nimport { ScrollArea, type ThemedClassName } from '@dxos/react-ui';\nimport { type ShapeComponentProps } from '@dxos/react-ui-canvas-editor';\nimport { mx } from '@dxos/ui-theme';\n\nimport { useComputeNodeState } from '../hooks';\nimport { Box, type BoxActionHandler } from './common';\nimport { type FeedShape } from './feed-def';\n\nexport const FeedComponent = ({ shape }: ShapeComponentProps<FeedShape>) => {\n const { runtime } = useComputeNodeState(shape);\n const items = runtime.outputs[DEFAULT_OUTPUT]?.type === 'executed' ? runtime.outputs[DEFAULT_OUTPUT].value : [];\n\n const handleAction: BoxActionHandler = (action) => {\n if (action === 'run') {\n runtime.evalNode();\n }\n };\n\n return (\n <Box shape={shape} status={`${items.length} items`} onAction={handleAction}>\n <ScrollArea.Root orientation='vertical'>\n <ScrollArea.Viewport classNames='divide-y divide-subdued-separator'>\n {[...items].map((item, i) => (\n <FeedItem key={i} classNames='p-1 px-2' item={item} />\n ))}\n </ScrollArea.Viewport>\n </ScrollArea.Root>\n </Box>\n );\n};\n\nexport const FeedItem = ({ classNames, item }: ThemedClassName<{ item: any }>) => {\n if (typeof item !== 'object') {\n return <div className={mx(classNames, 'whitespace-pre-wrap')}>{item}</div>;\n }\n\n return (\n <div className={mx('grid grid-cols-[80px_1fr]', classNames)}>\n {Object.entries(item).map(([key, value]) => (\n <Fragment key={key}>\n <div className='p-1 text-xs text-subdued'>{key}</div>\n <div>{typeof value === 'string' ? value : JSON.stringify(value)}</div>\n </Fragment>\n ))}\n </div>\n );\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { QueueInput, QueueOutput } from '@dxos/conductor';\nimport { type ShapeDef } from '@dxos/react-ui-canvas-editor';\n\nimport { createFunctionAnchors } from './common';\nimport { ComputeShape, type CreateShapeProps, createShape } from './defs';\nimport { FeedComponent } from './Feed';\n\n// Kept out of `Feed.tsx`: react-refresh only fast-refreshes a module whose\n// exports are all components, so values exported beside them force a full page reload on every edit.\n\nexport const FeedShape = Schema.extend(\n ComputeShape,\n Schema.Struct({\n type: Schema.Literal('queue'),\n }),\n);\n\nexport type FeedShape = Schema.Schema.Type<typeof FeedShape>;\n\nexport type CreateFeedProps = CreateShapeProps<FeedShape>;\n\nexport const createFeed = (props: CreateFeedProps) =>\n createShape<FeedShape>({\n type: 'queue',\n size: { width: 256, height: 512 },\n ...props,\n });\n\nexport const feedShape: ShapeDef<FeedShape> = {\n // Must match the shape's `type` literal ('queue') so the registry resolves it; the registry is keyed by this.\n type: 'queue',\n name: 'Feed',\n icon: 'ph--queue--regular',\n component: FeedComponent,\n createShape: createFeed,\n getAnchors: (shape) => createFunctionAnchors(shape, QueueInput, QueueOutput),\n resizable: true,\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback, useRef } from 'react';\n\nimport { Script } from '@dxos/compute';\nimport { Operation } from '@dxos/compute';\nimport { Filter, Ref } from '@dxos/echo';\nimport { instanceOf as isInstanceOf } from '@dxos/echo/Obj';\nimport { parseId } from '@dxos/keys';\nimport { useClient } from '@dxos/react-client';\nimport {\n type ShapeComponentProps,\n TextBox,\n type TextBoxControl,\n type TextBoxProps,\n} from '@dxos/react-ui-canvas-editor';\n\nimport { useComputeNodeState } from '../hooks';\nimport { Box } from './common';\nimport { type FunctionShape } from './function-def';\n\n//\n// Component\n//\n\ntype FunctionShapeComponentProps = ShapeComponentProps<FunctionShape> & TextBoxProps & { title?: string };\n\nexport const FunctionShapeComponent = ({ shape, title, ...props }: FunctionShapeComponentProps) => {\n const client = useClient();\n const { node, runtime } = useComputeNodeState(shape);\n const inputRef = useRef<TextBoxControl>(null);\n\n const handleEnter = useCallback(\n async (text: string) => {\n const value = text.trim();\n const { spaceId, objectId } = parseId(value);\n if (!spaceId || !objectId) {\n return;\n }\n\n const space = client.spaces.get(spaceId);\n const object = space?.db.query(Filter.id(objectId)).runSync()[0];\n if (!space || !isInstanceOf(Script.Script, object)) {\n return;\n }\n\n const [fn] = await space.db.query(Filter.type(Operation.PersistentOperation, { source: Ref.make(object) })).run();\n if (!fn) {\n return;\n }\n\n node.value = value;\n node.function = Ref.make(fn);\n node.inputSchema = fn.inputSchema;\n node.outputSchema = fn.outputSchema;\n },\n [client, node],\n );\n\n const handleAction = useCallback(\n (action: 'run' | 'open' | 'close') => {\n if (action !== 'run') {\n return;\n }\n\n runtime.evalNode();\n },\n [runtime],\n );\n\n return (\n <Box shape={shape} title='Function' onAction={handleAction}>\n <TextBox\n {...props}\n ref={inputRef}\n value={node.value}\n language={node.valueType === 'object' ? 'json' : undefined}\n onBlur={handleEnter}\n onEnter={handleEnter}\n />\n </Box>\n );\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { AnyOutput, FunctionInput } from '@dxos/conductor';\nimport { type ShapeDef } from '@dxos/react-ui-canvas-editor';\n\nimport { createFunctionAnchors } from './common';\nimport { ComputeShape, type CreateShapeProps, createShape } from './defs';\nimport { FunctionShapeComponent } from './Function';\n\n// Kept out of `Function.tsx`: react-refresh only fast-refreshes a module whose\n// exports are all components, so values exported beside them force a full page reload on every edit.\n\nexport const FunctionShape = Schema.extend(\n ComputeShape,\n Schema.Struct({\n type: Schema.Literal('function'),\n }),\n);\n\nexport type FunctionShape = Schema.Schema.Type<typeof FunctionShape>;\n\nexport type CreateFunctionProps = CreateShapeProps<FunctionShape>;\n\nexport const createFunction = (props: CreateFunctionProps) =>\n createShape<FunctionShape>({\n type: 'function',\n size: { width: 256, height: 192 },\n ...props,\n });\n\n//\n// Defs\n//\n\nexport const functionShape: ShapeDef<FunctionShape> = {\n type: 'function',\n name: 'Function',\n icon: 'ph--function--regular',\n component: FunctionShapeComponent,\n createShape: createFunction,\n getAnchors: (shape) => createFunctionAnchors(shape, FunctionInput, AnyOutput),\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useEffect, useState } from 'react';\n\nimport { ScrollArea } from '@dxos/react-ui';\nimport { type ShapeComponentProps } from '@dxos/react-ui-canvas-editor';\n\nimport { useComputeNodeState } from '../hooks';\nimport { FunctionBody } from './common';\nimport { type GptShape } from './gpt-def';\n\nexport const GptComponent = ({ shape }: ShapeComponentProps<GptShape>) => {\n const { meta, runtime } = useComputeNodeState(shape);\n const [text, setText] = useState('');\n const [tokens, setTokens] = useState(0);\n\n useEffect(() => {\n return runtime.subscribeToEventLog((ev) => {\n switch (ev.type) {\n case 'begin-compute': {\n setText('');\n break;\n }\n\n case 'custom': {\n // TODO(burdon): Any?\n const token = ev.event;\n switch (token.type) {\n case 'content_block_delta':\n switch (token.delta.type) {\n case 'text_delta': {\n const delta = token.delta.text;\n setText((prev) => {\n const text = prev + delta;\n // TODO(burdon): Get token count.\n setTokens(text.split(' ').length);\n return text;\n });\n break;\n }\n }\n break;\n\n // TODO(dmaretskyi): Handle other types of events.\n }\n break;\n }\n }\n });\n }, [runtime?.subscribeToEventLog]);\n\n return (\n <FunctionBody\n shape={shape}\n content={\n <ScrollArea.Root orientation='vertical' thin>\n <ScrollArea.Viewport>{text}</ScrollArea.Viewport>\n </ScrollArea.Root>\n }\n status={`${tokens} tokens`}\n inputSchema={meta.input}\n outputSchema={meta.output}\n />\n );\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { GptInput, GptOutput } from '@dxos/conductor';\nimport { type ShapeDef } from '@dxos/react-ui-canvas-editor';\n\nimport { createFunctionAnchors, getHeight } from './common';\nimport { ComputeShape, type CreateShapeProps, createShape } from './defs';\nimport { GptComponent } from './Gpt';\n\n// Kept out of `Gpt.tsx`: react-refresh only fast-refreshes a module whose\n// exports are all components, so values exported beside them force a full page reload on every edit.\n\nexport const GptShape = Schema.extend(\n ComputeShape,\n Schema.Struct({\n type: Schema.Literal('gpt'),\n }),\n);\n\nexport type GptShape = Schema.Schema.Type<typeof GptShape>;\n\nexport type CreateGptProps = CreateShapeProps<GptShape>;\n\nexport const createGpt = (props: CreateGptProps) =>\n createShape<GptShape>({\n type: 'gpt',\n size: { width: 256, height: Math.max(getHeight(GptInput), getHeight(GptOutput)) },\n ...props,\n });\n\nexport const gptShape: ShapeDef<GptShape> = {\n type: 'gpt',\n name: 'GPT',\n icon: 'ph--brain--regular',\n component: GptComponent,\n createShape: createGpt,\n getAnchors: (shape) => createFunctionAnchors(shape, GptInput, GptOutput),\n openable: true,\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useState } from 'react';\n\nimport { log } from '@dxos/log';\nimport { useConfig } from '@dxos/react-client';\nimport { Icon } from '@dxos/react-ui';\nimport { type ShapeComponentProps } from '@dxos/react-ui-canvas-editor';\n\nimport { type GptRealtimeShape } from './gpt-realtime-def';\n\nexport const GptRealtimeComponent = ({ shape }: ShapeComponentProps<GptRealtimeShape>) => {\n const [isLive, setIsLive] = useState(false);\n const [isReady, setIsReady] = useState(false);\n const config = useConfig();\n\n const start = async () => {\n setIsLive(true);\n\n try {\n // Create WebRTC connection\n const peerConnection = new RTCPeerConnection();\n\n // Handle incoming audio\n peerConnection.ontrack = (event) => {\n const audioElement = document.createElement('audio');\n audioElement.srcObject = event.streams[0];\n audioElement.autoplay = true;\n audioElement.controls = false;\n audioElement.style.display = 'none';\n document.body.appendChild(audioElement);\n setIsReady(true);\n };\n\n // Get microphone stream\n const stream = await navigator.mediaDevices.getUserMedia({ audio: true });\n\n // Add microphone track to connection\n stream.getTracks().forEach((track) => peerConnection.addTransceiver(track, { direction: 'sendrecv' }));\n\n // Create offer\n const offer = await peerConnection.createOffer();\n await peerConnection.setLocalDescription(offer);\n\n // Send offer to backend and get answer\n const AiServiceUrl = new URL(\n '/rtc-connect',\n config.values.runtime?.services?.ai?.server ?? DEFAULT_AI_SERVICE_URL,\n );\n const response = await fetch(AiServiceUrl, {\n method: 'POST',\n body: offer.sdp,\n headers: {\n 'Content-Type': 'application/sdp',\n },\n });\n\n const answer = await response.text();\n\n // Set remote description with answer\n await peerConnection.setRemoteDescription({\n sdp: answer,\n type: 'answer',\n });\n\n const dataChannel = peerConnection.createDataChannel('response');\n\n const configureData = () => {\n log.info('Configuring data channel');\n const event = {\n type: 'session.update',\n session: {\n modalities: ['text', 'audio'],\n // Provide the tools. Note they match the keys in the `fns` object above\n tools: [],\n },\n };\n dataChannel.send(JSON.stringify(event));\n };\n\n dataChannel.addEventListener('open', (ev) => {\n log.info('Opening data channel', { ev });\n configureData();\n });\n\n // {\n // \"type\": \"response.function_call_arguments.done\",\n // \"event_id\": \"event_Ad2gt864G595umbCs2aF9\",\n // \"response_id\": \"resp_Ad2griUWUjsyeLyAVtTtt\",\n // \"item_id\": \"item_Ad2gsxA84w9GgEvFwW1Ex\",\n // \"output_index\": 1,\n // \"call_id\": \"call_PG12S5ER7l7HrvZz\",\n // \"name\": \"get_weather\",\n // \"arguments\": \"{\\\"location\\\":\\\"Portland, Oregon\\\"}\"\n // }\n\n dataChannel.addEventListener('message', async (ev) => {\n const msg = JSON.parse(ev.data);\n // console.log('realtime gpt event', msg);\n // Handle function calls\n if (msg.type === 'response.function_call_arguments.done') {\n // const fn = fns[msg.name];\n // if (fn !== undefined) {\n // console.log(`Calling local function ${msg.name} with ${msg.arguments}`);\n // const args = JSON.parse(msg.arguments);\n // const result = await fn(args);\n // console.log('result', result);\n // // Let OpenAI know that the function has been called and share it's output\n // const event = {\n // type: 'conversation.item.create',\n // item: {\n // type: 'function_call_output',\n // call_id: msg.call_id, // call_id from the function_call message\n // output: JSON.stringify(result), // result of the function\n // },\n // };\n // dataChannel.send(JSON.stringify(event));\n // }\n }\n });\n } catch (error) {\n log.error('Error in realtime session:', { error });\n throw error;\n }\n };\n\n return (\n <div className='flex w-full justify-center items-center'>\n <Icon\n icon={isReady ? 'ph--waveform--regular' : isLive ? 'ph--pulse--regular' : 'ph--play--regular'}\n size={16}\n classNames={!isLive && 'cursor-pointer'}\n onClick={start}\n />\n </div>\n );\n};\n\nconst DEFAULT_AI_SERVICE_URL = 'http://localhost:8788';\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { type ShapeDef } from '@dxos/react-ui-canvas-editor';\n\nimport { createFunctionAnchors } from './common';\nimport { ComputeShape, type CreateShapeProps, createShape } from './defs';\nimport { GptRealtimeComponent } from './GptRealtime';\n\n// Kept out of `GptRealtime.tsx`: react-refresh only fast-refreshes a module whose\n// exports are all components, so values exported beside them force a full page reload on every edit.\n\nexport const GptRealtimeShape = Schema.extend(\n ComputeShape,\n Schema.Struct({\n type: Schema.Literal('gpt-realtime'),\n }),\n);\n\nexport type GptRealtimeShape = Schema.Schema.Type<typeof GptRealtimeShape>;\n\nexport type CreateGptRealtimeProps = CreateShapeProps<GptRealtimeShape>;\n\nexport const createGptRealtime = (props: CreateGptRealtimeProps) =>\n createShape<GptRealtimeShape>({ type: 'gpt-realtime', size: { width: 256, height: 256 }, ...props });\n\nexport const gptRealtimeShape: ShapeDef<GptRealtimeShape> = {\n type: 'gpt-realtime',\n name: 'GPT Realtime',\n icon: 'ph--pulse--regular',\n component: GptRealtimeComponent,\n createShape: createGptRealtime,\n // TODO(dmaretskyi): Can we fetch the schema dynamically?\n getAnchors: (shape) =>\n createFunctionAnchors(\n shape,\n Schema.Struct({\n audio: Schema.Any,\n }),\n Schema.Struct({}),\n ),\n resizable: true,\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { DEFAULT_INPUT } from '@dxos/conductor';\nimport { type ShapeComponentProps } from '@dxos/react-ui-canvas-editor';\nimport { Syntax } from '@dxos/react-ui-syntax-highlighter';\n\nimport { useComputeNodeState } from '../hooks';\nimport { Box } from './common';\nimport { type JsonShape, type JsonTransformShape } from './json-def';\n\n//\n// Component\n//\n\nexport type JsonComponentProps = ShapeComponentProps<JsonShape>;\n\nexport const JsonComponent = ({ shape, ...props }: JsonComponentProps) => {\n const { runtime } = useComputeNodeState(shape);\n const input = runtime.inputs[DEFAULT_INPUT];\n const value = input?.type === 'executed' ? input.value : undefined;\n\n return (\n <Box shape={shape}>\n <Syntax.Root data={value}>\n <Syntax.Content>\n <Syntax.Filter />\n <Syntax.Viewport>\n <Syntax.Code classNames='text-xs' />\n </Syntax.Viewport>\n </Syntax.Content>\n </Syntax.Root>\n </Box>\n );\n};\n\nexport type JsonTransformComponentProps = ShapeComponentProps<JsonTransformShape>;\n\nexport const JsonTransformComponent = ({ shape, ...props }: JsonTransformComponentProps) => {\n return <Box shape={shape} />;\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { DefaultOutput, JsonTransformInput } from '@dxos/conductor';\nimport { type ShapeDef } from '@dxos/react-ui-canvas-editor';\nimport { createAnchorMap } from '@dxos/react-ui-canvas-editor';\n\nimport { createFunctionAnchors, getHeight } from './common';\nimport { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';\nimport { JsonComponent, JsonTransformComponent } from './Json';\n\n// Kept out of `Json.tsx`: react-refresh only fast-refreshes a module whose\n// exports are all components, so values exported beside them force a full page reload on every edit.\n\n//\n// Data\n//\n\nexport const JsonShape = Schema.extend(\n ComputeShape,\n Schema.Struct({\n type: Schema.Literal('json'),\n }),\n);\n\nexport type JsonShape = Schema.Schema.Type<typeof JsonShape>;\n\nexport const JsonTransformShape = Schema.extend(\n ComputeShape,\n Schema.Struct({\n type: Schema.Literal('json-transform'),\n }),\n);\n\nexport type JsonTransformShape = Schema.Schema.Type<typeof JsonTransformShape>;\n\n//\n// Defs\n//\n\nexport type CreateJsonProps = CreateShapeProps<JsonShape>;\n\nexport const createJson = (props: CreateJsonProps) =>\n createShape<JsonShape>({ type: 'json', size: { width: 256, height: 256 }, ...props });\n\nexport const jsonShape: ShapeDef<JsonShape> = {\n type: 'json',\n name: 'JSON',\n icon: 'ph--code--regular',\n component: JsonComponent,\n createShape: createJson,\n getAnchors: (shape) =>\n createAnchorMap(shape, {\n [createAnchorId('input')]: { x: -1, y: 0 },\n [createAnchorId('output')]: { x: 1, y: 0 },\n }),\n resizable: true,\n};\n\nexport type CreateJsonTransformProps = CreateShapeProps<JsonTransformShape> & { expression?: string };\n\nexport const createJsonTransform = (props: CreateJsonTransformProps) =>\n createShape<JsonTransformShape>({\n type: 'json-transform',\n size: { width: 128, height: getHeight(JsonTransformInput) },\n ...props,\n });\n\nexport const jsonTransformShape: ShapeDef<JsonTransformShape> = {\n type: 'json-transform',\n name: 'Transform',\n icon: 'ph--shuffle-simple--regular',\n component: JsonTransformComponent,\n createShape: createJsonTransform,\n getAnchors: (shape) => createFunctionAnchors(shape, JsonTransformInput, DefaultOutput),\n resizable: true,\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { IfElseInput, IfElseOutput, IfInput, IfOutput } from '@dxos/conductor';\nimport { type ShapeComponentProps } from '@dxos/react-ui-canvas-editor';\n\nimport { FunctionBody } from './common';\nimport { type IfElseShape, type IfShape } from './logic-def';\n\n//\n// Components\n//\n\nexport type IfComponentProps = ShapeComponentProps<IfShape>;\n\nexport const IfComponent = ({ shape, ...props }: IfComponentProps) => {\n return <FunctionBody shape={shape} inputSchema={IfInput} outputSchema={IfOutput} />;\n};\n\nexport type IfElseComponentProps = ShapeComponentProps<IfElseShape>;\n\nexport const IfElseComponent = ({ shape, ...props }: IfElseComponentProps) => {\n return <FunctionBody shape={shape} inputSchema={IfElseInput} outputSchema={IfElseOutput} />;\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { IfElseInput, IfElseOutput, IfInput, IfOutput } from '@dxos/conductor';\nimport { type ShapeDef } from '@dxos/react-ui-canvas-editor';\n\nimport { createFunctionAnchors, getHeight } from './common';\nimport { ComputeShape, type CreateShapeProps, createShape } from './defs';\nimport { IfComponent, IfElseComponent } from './Logic';\n\n// Kept out of `Logic.tsx`: react-refresh only fast-refreshes a module whose\n// exports are all components, so values exported beside them force a full page reload on every edit.\n\n//\n// Data\n//\n\nexport const IfShape = Schema.extend(\n ComputeShape,\n Schema.Struct({\n type: Schema.Literal('if'),\n }),\n);\n\nexport type IfShape = Schema.Schema.Type<typeof IfShape>;\n\nexport const IfElseShape = Schema.extend(\n ComputeShape,\n Schema.Struct({\n type: Schema.Literal('if-else'),\n }),\n);\n\nexport type IfElseShape = Schema.Schema.Type<typeof IfElseShape>;\n\n//\n// Defs\n//\n\nexport type CreateIfProps = CreateShapeProps<IfShape> & { if?: string };\n\nexport const createIf = (props: CreateIfProps) =>\n createShape<IfShape>({ type: 'if', size: { width: 192, height: getHeight(IfInput) }, ...props });\n\nexport const ifShape: ShapeDef<IfShape> = {\n type: 'if',\n name: 'IF',\n icon: 'ph--arrows-split--regular',\n component: IfComponent,\n createShape: createIf,\n getAnchors: (shape) => createFunctionAnchors(shape, IfInput, IfOutput),\n};\n\nexport type CreateIfElseProps = CreateShapeProps<IfShape> & { if?: string };\n\nexport const createIfElse = (props: CreateIfElseProps) =>\n createShape<IfElseShape>({ type: 'if-else', size: { width: 192, height: getHeight(IfElseInput) }, ...props });\n\nexport const ifElseShape: ShapeDef<IfElseShape> = {\n type: 'if-else',\n name: 'IF/ELSE',\n icon: 'ph--arrows-merge--regular',\n component: IfElseComponent,\n createShape: createIfElse,\n getAnchors: (shape) => createFunctionAnchors(shape, IfElseInput, IfElseOutput),\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useEffect, useState } from 'react';\n\nimport { DEFAULT_OUTPUT } from '@dxos/conductor';\nimport { Icon, type IconProps } from '@dxos/react-ui';\nimport { type ShapeComponentProps } from '@dxos/react-ui-canvas-editor';\n\nimport { useComputeNodeState } from '../hooks';\nimport { type RandomShape } from './rng-def';\n\nconst icons = [\n 'ph--dice-one--regular',\n 'ph--dice-two--regular',\n 'ph--dice-three--regular',\n 'ph--dice-four--regular',\n 'ph--dice-five--regular',\n 'ph--dice-six--regular',\n];\n\nconst pickIcon = () => icons[Math.floor(Math.random() * icons.length)];\n\n// TODO(burdon): Optional range.\nexport const RandomComponent = ({ shape }: ShapeComponentProps<RandomShape>) => {\n const { runtime } = useComputeNodeState(shape);\n\n const [spin, setSpin] = useState(false);\n const [icon, setIcon] = useState(pickIcon());\n useEffect(() => {\n if (!spin) {\n return;\n }\n\n const i = setInterval(() => setIcon(pickIcon()), 250);\n const t1 = setTimeout(() => clearInterval(i), 900);\n const t2 = setTimeout(() => setSpin(false), 1_100);\n return () => {\n clearInterval(i);\n clearTimeout(t1);\n clearTimeout(t2);\n };\n }, [spin]);\n\n const handleClick: IconProps['onClick'] = (ev) => {\n ev.stopPropagation();\n runtime.setOutput(DEFAULT_OUTPUT, Math.random());\n setSpin(true);\n };\n\n return (\n <div className='flex grow items-center justify-center'>\n <Icon icon={icon} classNames={spin && 'animate-[spin_1s]'} size={10} onClick={handleClick} />\n </div>\n );\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { type ShapeDef, createAnchorMap } from '@dxos/react-ui-canvas-editor';\n\nimport { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';\nimport { RandomComponent } from './RNG';\n\n// Kept out of `RNG.tsx`: react-refresh only fast-refreshes a module whose\n// exports are all components, so values exported beside them force a full page reload on every edit.\n\nexport const RandomShape = Schema.extend(\n ComputeShape,\n Schema.Struct({\n type: Schema.Literal('rng'),\n min: Schema.optional(Schema.Number),\n max: Schema.optional(Schema.Number),\n }),\n);\n\nexport type RandomShape = Schema.Schema.Type<typeof RandomShape>;\n\nexport type CreateRandomProps = CreateShapeProps<RandomShape>;\n\nexport const createRandom = (props: CreateRandomProps) =>\n createShape<RandomShape>({\n type: 'rng',\n size: { width: 64, height: 64 },\n ...props,\n });\n\nexport const randomShape: ShapeDef<RandomShape> = {\n type: 'rng',\n name: 'Random',\n icon: 'ph--dice-six--regular',\n component: RandomComponent,\n createShape: createRandom,\n getAnchors: (shape) => createAnchorMap(shape, { [createAnchorId('output')]: { x: 1, y: 0 } }),\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { DEFAULT_INPUT } from '@dxos/conductor';\nimport { useAudioStream } from '@dxos/react-ui-audio';\nimport { type ShapeComponentProps } from '@dxos/react-ui-canvas-editor';\nimport { Chaos, shaderPresets } from '@dxos/react-ui-experimental';\n\nimport { useComputeNodeState } from '../hooks';\nimport { type ScopeShape } from './scope-def';\n\nexport const ScopeComponent = ({ shape }: ShapeComponentProps<ScopeShape>) => {\n const { runtime } = useComputeNodeState(shape);\n const input = runtime.inputs[DEFAULT_INPUT];\n const active = input?.type === 'executed' ? input.value : false;\n const { getAverage } = useAudioStream(active);\n\n return (\n <div className='flex w-full justify-center items-center bg-black'>\n <Chaos active={active} getValue={getAverage} options={{ ...shaderPresets.heptapod, zoom: 1.2 }} />\n </div>\n );\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { type ShapeDef, createAnchorMap } from '@dxos/react-ui-canvas-editor';\n\nimport { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';\nimport { ScopeComponent } from './Scope';\n\n// Kept out of `Scope.tsx`: react-refresh only fast-refreshes a module whose\n// exports are all components, so values exported beside them force a full page reload on every edit.\n\nexport const ScopeShape = Schema.extend(\n ComputeShape,\n Schema.Struct({\n type: Schema.Literal('scope'),\n }),\n);\n\nexport type ScopeShape = Schema.Schema.Type<typeof ScopeShape>;\n\nexport type CreateScopeProps = CreateShapeProps<ScopeShape>;\n\nexport const createScope = (props: CreateScopeProps) =>\n createShape<ScopeShape>({\n type: 'scope',\n size: { width: 128, height: 128 },\n classNames: 'rounded-full border-primary-800',\n ...props,\n });\n\nexport const scopeShape: ShapeDef<ScopeShape> = {\n type: 'scope',\n name: 'Scope',\n icon: 'ph--waveform--regular',\n component: ScopeComponent,\n createShape: createScope,\n getAnchors: (shape) => createAnchorMap(shape, { [createAnchorId('input')]: { x: -1, y: 0 } }),\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Surface } from '@dxos/app-framework/ui';\nimport { AppSurface } from '@dxos/app-toolkit/ui';\nimport { DEFAULT_INPUT } from '@dxos/conductor';\nimport { Card } from '@dxos/react-ui';\nimport { type ShapeComponentProps } from '@dxos/react-ui-canvas-editor';\n\nimport { useComputeNodeState } from '../hooks';\nimport { Box, type BoxActionHandler } from './common';\nimport { type SurfaceShape } from './surface-def';\n\nexport const SurfaceComponent = ({ shape }: ShapeComponentProps<SurfaceShape>) => {\n const { runtime } = useComputeNodeState(shape);\n const input = runtime.inputs[DEFAULT_INPUT];\n const value = input?.type === 'executed' ? input.value : null;\n\n const handleAction: BoxActionHandler = (action) => {\n if (action === 'run') {\n runtime.evalNode();\n }\n };\n\n // TODO(burdon): Subject property?\n return (\n <Box shape={shape} onAction={handleAction}>\n <Card.Root>\n {value !== null && <Surface.Surface type={AppSurface.CardContent} data={{ subject: value }} limit={1} />}\n </Card.Root>\n </Box>\n );\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { type ShapeDef } from '@dxos/react-ui-canvas-editor';\nimport { createAnchorMap } from '@dxos/react-ui-canvas-editor';\n\nimport { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';\nimport { SurfaceComponent } from './Surface';\n\n// Kept out of `Surface.tsx`: react-refresh only fast-refreshes a module whose\n// exports are all components, so values exported beside them force a full page reload on every edit.\n\nexport const SurfaceShape = Schema.extend(\n ComputeShape,\n Schema.Struct({\n type: Schema.Literal('surface'),\n }),\n);\n\nexport type SurfaceShape = Schema.Schema.Type<typeof SurfaceShape>;\n\nexport type CreateSurfaceProps = CreateShapeProps<SurfaceShape>;\n\nexport const createSurface = (props: CreateSurfaceProps) =>\n createShape<SurfaceShape>({\n type: 'surface',\n size: { width: 384, height: 384 },\n ...props,\n });\n\nexport const surfaceShape: ShapeDef<SurfaceShape> = {\n type: 'surface',\n name: 'Surface',\n icon: 'ph--frame-corners--regular',\n component: SurfaceComponent,\n createShape: createSurface,\n getAnchors: (shape) => createAnchorMap(shape, { [createAnchorId('input')]: { x: -1, y: 0 } }),\n resizable: true,\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useEffect, useState } from 'react';\n\nimport { DEFAULT_OUTPUT } from '@dxos/conductor';\nimport { Input } from '@dxos/react-ui';\nimport { type ShapeComponentProps } from '@dxos/react-ui-canvas-editor';\n\nimport { useComputeNodeState } from '../hooks';\nimport { type SwitchShape } from './switch-def';\n\n// TODO(burdon): Should model as a constant.\nexport const SwitchComponent = ({ shape }: ShapeComponentProps<SwitchShape>) => {\n const { runtime } = useComputeNodeState(shape);\n const [value, setValue] = useState(false);\n useEffect(() => {\n runtime.setOutput(DEFAULT_OUTPUT, value);\n }, [value]);\n\n return (\n <div className='flex w-full justify-center items-center' onClick={(ev) => ev.stopPropagation()}>\n <Input.Root>\n <Input.Switch checked={value} onCheckedChange={(value) => setValue(value)} />\n </Input.Root>\n </div>\n );\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { type ShapeDef, createAnchorMap } from '@dxos/react-ui-canvas-editor';\n\nimport { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';\nimport { SwitchComponent } from './Switch';\n\n// Kept out of `Switch.tsx`: react-refresh only fast-refreshes a module whose\n// exports are all components, so values exported beside them force a full page reload on every edit.\n\nexport const SwitchShape = Schema.extend(\n ComputeShape,\n Schema.Struct({\n type: Schema.Literal('switch'),\n }),\n);\n\nexport type SwitchShape = Schema.Schema.Type<typeof SwitchShape>;\n\nexport type CreateSwitchProps = CreateShapeProps<SwitchShape>;\n\nexport const createSwitch = (props: CreateSwitchProps) =>\n createShape<SwitchShape>({ type: 'switch', size: { width: 64, height: 64 }, ...props });\n\nexport const switchShape: ShapeDef<SwitchShape> = {\n type: 'switch',\n name: 'Switch',\n icon: 'ph--toggle-left--regular',\n component: SwitchComponent,\n createShape: createSwitch,\n getAnchors: (shape) => createAnchorMap(shape, { [createAnchorId('output')]: { x: 1, y: 0 } }),\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type ShapeComponentProps } from '@dxos/react-ui-canvas-editor';\n\nimport { Box } from './common';\nimport { type TableShape } from './table-def';\n\nexport const TableComponent = ({ shape }: ShapeComponentProps<TableShape>) => {\n // const items = shape.node.items.value;\n\n return <Box shape={shape}></Box>;\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { createInputSchema, createOutputSchema } from '@dxos/conductor';\nimport { Type } from '@dxos/echo';\nimport { type ShapeDef } from '@dxos/react-ui-canvas-editor';\nimport { Message } from '@dxos/types';\n\nimport { createFunctionAnchors } from './common';\nimport { ComputeShape, type CreateShapeProps, createShape } from './defs';\nimport { TableComponent } from './Table';\n\n// Kept out of `Table.tsx`: react-refresh only fast-refreshes a module whose\n// exports are all components, so values exported beside them force a full page reload on every edit.\n\nconst InputSchema = createInputSchema(Type.getSchema(Message.Message));\n\nconst OutputSchema = createOutputSchema(Schema.mutable(Schema.Array(Type.getSchema(Message.Message))));\n\nexport const TableShape = Schema.extend(\n ComputeShape,\n Schema.Struct({\n type: Schema.Literal('table'),\n }),\n);\n\nexport type TableShape = Schema.Schema.Type<typeof TableShape>;\n\nexport type CreateTableProps = CreateShapeProps<TableShape>;\n\nexport const createTable = (props: CreateTableProps) =>\n createShape<TableShape>({ type: 'table', size: { width: 320, height: 512 }, ...props });\n\nexport const tableShape: ShapeDef<TableShape> = {\n type: 'table',\n name: 'Table',\n icon: 'ph--table--regular',\n component: TableComponent,\n createShape: createTable,\n getAnchors: (shape) => createFunctionAnchors(shape, InputSchema, OutputSchema),\n resizable: true,\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\nimport React, { useRef } from 'react';\n\nimport { ComputeValueType, getTemplateInputSchema } from '@dxos/conductor';\nimport { toJsonSchema } from '@dxos/echo/JsonSchema';\nimport { invariant } from '@dxos/invariant';\nimport {\n type ShapeComponentProps,\n TextBox,\n type TextBoxControl,\n type TextBoxProps,\n} from '@dxos/react-ui-canvas-editor';\n\nimport { useComputeNodeState } from '../hooks';\nimport { Box, TypeSelect } from './common';\nimport { type TemplateShape } from './template-def';\n\n//\n// Component\n//\n\ntype TextInputComponentProps = ShapeComponentProps<TemplateShape> & TextBoxProps & { title?: string };\n\nconst TextInputComponent = ({ shape, title, ...props }: TextInputComponentProps) => {\n const { node } = useComputeNodeState(shape);\n const inputRef = useRef<TextBoxControl>(null);\n\n const handleEnter: TextBoxProps['onEnter'] = (text) => {\n const value = text.trim();\n if (value.length) {\n const schema = getTemplateInputSchema(node);\n\n node.value = value;\n node.inputSchema = toJsonSchema(schema);\n }\n };\n\n const handleTypeChange = (newType: string) => {\n invariant(Schema.is(ComputeValueType)(newType), 'Invalid type');\n\n node.valueType = newType;\n node.inputSchema = toJsonSchema(getTemplateInputSchema(node));\n };\n\n return (\n <Box\n shape={shape}\n title={'Template'}\n status={<TypeSelect value={node.valueType ?? 'string'} onValueChange={handleTypeChange} />}\n >\n <TextBox\n {...props}\n ref={inputRef}\n value={node.value}\n language={node.valueType === 'object' ? 'json' : undefined}\n onBlur={handleEnter}\n onEnter={handleEnter}\n />\n </Box>\n );\n};\n\nexport const TemplateComponent = (props: ShapeComponentProps<TemplateShape>) => (\n <TextInputComponent {...props} placeholder={'Prompt'} />\n);\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { ComputeValueType, TemplateOutput, VoidInput } from '@dxos/conductor';\nimport { type ShapeDef } from '@dxos/react-ui-canvas-editor';\n\nimport { createFunctionAnchors } from './common';\nimport { ComputeShape, type CreateShapeProps, createShape } from './defs';\nimport { TemplateComponent } from './Template';\n\n// Kept out of `Template.tsx`: react-refresh only fast-refreshes a module whose\n// exports are all components, so values exported beside them force a full page reload on every edit.\n\n//\n// Data\n//\n\nexport const TemplateShape = Schema.extend(\n ComputeShape,\n Schema.Struct({\n type: Schema.Literal('template'),\n valueType: Schema.optional(ComputeValueType),\n }),\n);\n\nexport type TemplateShape = Schema.Schema.Type<typeof TemplateShape>;\n\n//\n// Defs\n//\n\nexport type CreateTemplateProps = CreateShapeProps<TemplateShape> & { text?: string };\n\nexport const createTemplate = (props: CreateTemplateProps) =>\n createShape<TemplateShape>({ type: 'template', size: { width: 256, height: 384 }, ...props });\n\nexport const templateShape: ShapeDef<TemplateShape> = {\n type: 'template',\n name: 'Template',\n icon: 'ph--article--regular',\n component: TemplateComponent,\n createShape: createTemplate,\n getAnchors: (shape) => createFunctionAnchors(shape, VoidInput, TemplateOutput),\n resizable: true,\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { DEFAULT_INPUT } from '@dxos/conductor';\nimport { type ShapeComponentProps, TextBox } from '@dxos/react-ui-canvas-editor';\n\nimport { useComputeNodeState } from '../hooks';\nimport { Box, type BoxActionHandler } from './common';\nimport { type TextShape } from './text-def';\n\nexport const TextComponent = ({ shape }: ShapeComponentProps<TextShape>) => {\n const { runtime } = useComputeNodeState(shape);\n const input = runtime.inputs[DEFAULT_INPUT];\n const value = input?.type === 'executed' ? input.value : 0;\n\n const handleAction: BoxActionHandler = (action) => {\n if (action === 'run') {\n runtime.evalNode();\n }\n };\n\n return (\n <Box shape={shape} onAction={handleAction}>\n <TextBox value={value} />\n </Box>\n );\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { type ShapeDef } from '@dxos/react-ui-canvas-editor';\nimport { createAnchorMap } from '@dxos/react-ui-canvas-editor';\n\nimport { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';\nimport { TextComponent } from './Text';\n\n// Kept out of `Text.tsx`: react-refresh only fast-refreshes a module whose\n// exports are all components, so values exported beside them force a full page reload on every edit.\n\nexport const TextShape = Schema.extend(\n ComputeShape,\n Schema.Struct({\n type: Schema.Literal('text'),\n }),\n);\n\nexport type TextShape = Schema.Schema.Type<typeof TextShape>;\n\nexport type CreateTextProps = CreateShapeProps<TextShape>;\n\nexport const createText = (props: CreateTextProps) =>\n createShape<TextShape>({ type: 'text', size: { width: 384, height: 384 }, ...props });\n\nexport const textShape: ShapeDef<TextShape> = {\n type: 'text',\n name: 'Text',\n icon: 'ph--article--regular',\n component: TextComponent,\n createShape: createText,\n getAnchors: (shape) => createAnchorMap(shape, { [createAnchorId('input')]: { x: -1, y: 0 } }),\n resizable: true,\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type ShapeComponentProps } from '@dxos/react-ui-canvas-editor';\n\nimport { Box } from './common';\nimport { type TextToImageShape } from './text-to-image-def';\n\nexport const TextToImageComponent = ({ shape }: ShapeComponentProps<TextToImageShape>) => {\n return <Box shape={shape} />;\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { type ShapeDef } from '@dxos/react-ui-canvas-editor';\nimport { createAnchorMap } from '@dxos/react-ui-canvas-editor';\n\nimport { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';\nimport { TextToImageComponent } from './TextToImage';\n\n// Kept out of `TextToImage.tsx`: react-refresh only fast-refreshes a module whose\n// exports are all components, so values exported beside them force a full page reload on every edit.\n\nexport const TextToImageShape = Schema.extend(\n ComputeShape,\n Schema.Struct({\n type: Schema.Literal('text-to-image'),\n }),\n);\n\nexport type TextToImageShape = Schema.Schema.Type<typeof TextToImageShape>;\n\nexport type CreateTextToImageProps = CreateShapeProps<TextToImageShape>;\n\nexport const createTextToImage = (props: CreateTextToImageProps) =>\n createShape<TextToImageShape>({ type: 'text-to-image', size: { width: 128, height: 64 }, ...props });\n\nexport const textToImageShape: ShapeDef<TextToImageShape> = {\n type: 'text-to-image',\n name: 'Image',\n icon: 'ph--image--regular',\n component: TextToImageComponent,\n createShape: createTextToImage,\n getAnchors: (shape) => createAnchorMap(shape, { [createAnchorId('output')]: { x: 1, y: 0 } }),\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useEffect, useRef } from 'react';\n\nimport { ScrollArea, type ThemedClassName } from '@dxos/react-ui';\nimport { type ShapeComponentProps } from '@dxos/react-ui-canvas-editor';\nimport { mx } from '@dxos/ui-theme';\n\nimport { Box } from './common';\nimport { type ThreadShape } from './thread-def';\n\nexport const ThreadComponent = ({ shape }: ShapeComponentProps<ThreadShape>) => {\n const items: any[] = [];\n const scrollRef = useRef<HTMLDivElement>(null);\n useEffect(() => {\n if (scrollRef.current) {\n scrollRef.current.scrollTop = scrollRef.current.scrollHeight;\n }\n }, [items]);\n\n return (\n <Box shape={shape}>\n <ScrollArea.Root orientation='vertical'>\n <ScrollArea.Viewport classNames='gap-2 p-2' ref={scrollRef}>\n {[...items].map((item, i) => (\n <ThreadItem key={i} item={item} />\n ))}\n </ScrollArea.Viewport>\n </ScrollArea.Root>\n </Box>\n );\n};\n\nexport const ThreadItem = ({ classNames, item }: ThemedClassName<{ item: any }>) => {\n if (typeof item !== 'object') {\n return <div className={mx(classNames)}>{item}</div>;\n }\n\n // TODO(burdon): Hack; introspect type.\n // TODO(burdon): Markdown parser.\n const { role, message } = item;\n return (\n <div className={mx('flex', classNames, role === 'user' && 'justify-end')}>\n <div\n className={mx(\n 'block rounded-md p-1 px-2 text-sm',\n role === 'user'\n ? 'bg-blue-100 dark:bg-blue-800'\n : role === 'system'\n ? 'bg-red-100, dark:bg-red-800'\n : 'whitespace-pre-wrap bg-neutral-50 dark:bg-neutral-800',\n )}\n >\n {message}\n </div>\n </div>\n );\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { createInputSchema, createOutputSchema } from '@dxos/conductor';\nimport { Type } from '@dxos/echo';\nimport { type ShapeDef } from '@dxos/react-ui-canvas-editor';\nimport { Message } from '@dxos/types';\n\nimport { createFunctionAnchors } from './common';\nimport { ComputeShape, type CreateShapeProps, createShape } from './defs';\nimport { ThreadComponent } from './Thread';\n\n// Kept out of `Thread.tsx`: react-refresh only fast-refreshes a module whose\n// exports are all components, so values exported beside them force a full page reload on every edit.\n\nconst InputSchema = createInputSchema(Type.getSchema(Message.Message));\n\nconst OutputSchema = createOutputSchema(Schema.mutable(Schema.Array(Type.getSchema(Message.Message))));\n\nexport const ThreadShape = Schema.extend(\n ComputeShape,\n Schema.Struct({\n type: Schema.Literal('thread'),\n }),\n);\n\nexport type ThreadShape = Schema.Schema.Type<typeof ThreadShape>;\n\nexport type CreateThreadProps = CreateShapeProps<ThreadShape>;\n\nexport const createThread = (props: CreateThreadProps) =>\n createShape<ThreadShape>({ type: 'thread', size: { width: 384, height: 384 }, ...props });\n\nexport const threadShape: ShapeDef<ThreadShape> = {\n type: 'thread',\n name: 'Thread',\n icon: 'ph--chats-circle--regular',\n component: ThreadComponent,\n createShape: createThread,\n getAnchors: (shape) => createFunctionAnchors(shape, InputSchema, OutputSchema),\n resizable: true,\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Trigger, TriggerEvent } from '@dxos/compute';\nimport { Filter, Query } from '@dxos/echo';\nimport { type SpaceId } from '@dxos/keys';\n\n// Kept out of `Trigger.tsx` and shared with `trigger-def.ts`: react-refresh only fast-refreshes a\n// module whose exports are all components, and a value import back from the def module would close\n// a runtime cycle.\n\nexport const createTriggerSpec = (props: { triggerKind?: Trigger.Kind; spaceId?: SpaceId }): Trigger.Spec => {\n const kind = props.triggerKind ?? 'email';\n switch (kind) {\n case 'timer':\n return Trigger.specTimer('*/10 * * * * *');\n case 'webhook':\n return Trigger.specWebhook({ method: 'POST' });\n case 'subscription':\n return Trigger.specSubscription(Query.select(Filter.nothing()));\n case 'email':\n return Trigger.specEmail();\n case 'feed': {\n return { kind: 'feed' } satisfies Trigger.FeedSpec;\n }\n case 'direct':\n return Trigger.specDirect();\n }\n};\n\nexport const getOutputSchema = (kind: Trigger.Kind) => {\n const kindToSchema: Record<Trigger.Kind, Schema.Schema<any>> = {\n ['email']: TriggerEvent.EmailEvent,\n ['subscription']: TriggerEvent.SubscriptionEvent,\n ['timer']: TriggerEvent.TimerEvent,\n ['webhook']: TriggerEvent.WebhookEvent,\n ['feed']: TriggerEvent.FeedEvent,\n ['direct']: TriggerEvent.DirectEvent,\n };\n return kindToSchema[kind];\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useEffect } from 'react';\n\nimport { Trigger } from '@dxos/compute';\nimport { VoidInput } from '@dxos/conductor';\nimport { Obj } from '@dxos/echo';\nimport { type Mutable } from '@dxos/echo/Obj';\nimport { useSpaces } from '@dxos/react-client/echo';\nimport { Select, type SelectRootProps } from '@dxos/react-ui';\nimport { type ShapeComponentProps } from '@dxos/react-ui-canvas-editor';\n\nimport { FunctionBody, getHeight } from './common';\nimport { type TriggerShape } from './trigger-def';\nimport { createTriggerSpec, getOutputSchema } from './trigger-spec';\n\nexport type TriggerComponentProps = ShapeComponentProps<TriggerShape>;\n\nexport const TriggerComponent = ({ shape }: TriggerComponentProps) => {\n const [space] = useSpaces();\n const functionTrigger = shape.functionTrigger?.target;\n\n useEffect(() => {\n if (functionTrigger && !functionTrigger.spec) {\n Obj.update(functionTrigger, (functionTrigger) => {\n functionTrigger.spec = createTriggerSpec({ triggerKind: 'email', spaceId: space?.id }) as Mutable<Trigger.Spec>;\n });\n }\n }, [functionTrigger, functionTrigger?.spec]);\n\n useEffect(() => {\n shape.size.height = getHeight(getOutputSchema(functionTrigger?.spec?.kind ?? 'email'));\n }, [functionTrigger?.spec?.kind]);\n\n const setKind = (kind: Trigger.Kind) => {\n if (functionTrigger?.spec?.kind !== kind) {\n Obj.update(functionTrigger!, (obj) => {\n obj.spec = createTriggerSpec({ triggerKind: kind, spaceId: space?.id }) as Mutable<Trigger.Spec>;\n });\n }\n };\n\n if (!functionTrigger?.spec) {\n return;\n }\n\n return (\n <FunctionBody\n shape={shape}\n status={\n <TriggerKindSelect value={functionTrigger.spec?.kind} onValueChange={(kind) => setKind(kind as Trigger.Kind)} />\n }\n inputSchema={VoidInput}\n outputSchema={getOutputSchema(functionTrigger.spec!.kind!)}\n />\n );\n};\n\n// TODO(burdon): Factor out.\nconst TriggerKindSelect = ({ value, onValueChange }: Pick<SelectRootProps, 'value' | 'onValueChange'>) => {\n return (\n <Select.Root value={value} onValueChange={onValueChange}>\n <Select.TriggerButton variant='ghost' classNames='w-full px-0!' />\n <Select.Portal>\n <Select.Content>\n <Select.ScrollUpButton />\n <Select.Viewport>\n {Trigger.Kinds.map((kind) => (\n <Select.Option key={kind} value={kind}>\n {kind}\n </Select.Option>\n ))}\n </Select.Viewport>\n <Select.ScrollDownButton />\n <Select.Arrow />\n </Select.Content>\n </Select.Portal>\n </Select.Root>\n );\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Trigger, TriggerEvent } from '@dxos/compute';\nimport { VoidInput } from '@dxos/conductor';\nimport { Ref } from '@dxos/echo';\nimport { type SpaceId } from '@dxos/keys';\nimport { type ShapeDef } from '@dxos/react-ui-canvas-editor';\n\nimport { createFunctionAnchors, getHeight } from './common';\nimport { ComputeShape, type CreateShapeProps, createShape } from './defs';\nimport { TriggerComponent } from './Trigger';\nimport { createTriggerSpec, getOutputSchema } from './trigger-spec';\n\n// Kept out of `Trigger.tsx`: react-refresh only fast-refreshes a module whose\n// exports are all components, so values exported beside them force a full page reload on every edit.\n\nconst TriggerShapeSchema = Schema.extend(\n ComputeShape,\n Schema.Struct({\n type: Schema.Literal('trigger'),\n functionTrigger: Schema.optional(Ref.Ref(Trigger.Trigger)),\n }),\n);\n\n// TODO(wittjosiah): Try to clean up this type inference.\nexport interface TriggerShape extends ComputeShape {\n type: 'trigger';\n functionTrigger?: Ref.Ref<Trigger.Trigger>;\n}\n\nexport const TriggerShape: Schema.Schema<TriggerShape> = TriggerShapeSchema as any;\n\nexport type CreateTriggerProps = CreateShapeProps<Omit<TriggerShape, 'functionTrigger'>> & {\n spaceId?: SpaceId;\n triggerKind?: Trigger.Kind;\n};\n\nexport const createTrigger = (props: CreateTriggerProps): TriggerShape => {\n const functionTrigger = Trigger.make({\n enabled: true,\n spec: createTriggerSpec(props),\n });\n return createShape<TriggerShape>({\n type: 'trigger',\n functionTrigger: Ref.make(functionTrigger),\n size: { width: 192, height: getHeight(TriggerEvent.EmailEvent) },\n ...props,\n });\n};\n\nexport const triggerShape: ShapeDef<TriggerShape> = {\n type: 'trigger',\n name: 'Trigger',\n icon: 'ph--lightning--regular',\n component: TriggerComponent,\n createShape: createTrigger,\n getAnchors: (shape) =>\n createFunctionAnchors(shape, VoidInput, getOutputSchema(shape.functionTrigger?.target?.spec?.kind ?? 'email')),\n};\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\nimport React, { type FC } from 'react';\n\nimport { type ShapeDef, getAnchorPoints } from '@dxos/react-ui-canvas-editor';\nimport { createAnchors } from '@dxos/react-ui-canvas-editor';\n\nimport { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';\n\n//\n// Gate utils.\n// https://en.wikipedia.org/wiki/Logic_gate\n//\n\ntype GateType = 'and' | 'or' | 'not';\n\nconst GateShape = Schema.extend(\n ComputeShape,\n Schema.Struct({\n type: Schema.String,\n }),\n);\n\ntype GateShape = Schema.Schema.Type<typeof GateShape>;\n\ntype CreateGateProps = CreateShapeProps<GateShape> & { type: GateType };\n\nconst createGate = (props: CreateGateProps): GateShape =>\n createShape<GateShape>({\n size: { width: 64, height: 64 },\n ...props,\n });\n\n// TODO(burdon): Create custom icons.\nconst defineShape = <S extends GateShape>({\n type,\n name,\n icon,\n symbol: Symbol,\n createShape,\n inputs,\n outputs = [createAnchorId('output')],\n}: {\n type: GateType;\n symbol: FC<GateSymbolProps>;\n createShape: ShapeDef<S>['createShape'];\n inputs: string[];\n outputs?: string[];\n} & Pick<ShapeDef<GateShape>, 'name' | 'icon'>): ShapeDef<GateShape> => ({\n type,\n name,\n icon,\n // NOTE: Preact interprets captitalized properties as React components.\n // Be careful not to name component factories with a capital letter.\n component: () => {\n return (\n <div className='flex w-full justify-center items-center'>\n <Symbol />\n </div>\n );\n },\n createShape,\n getAnchors: (shape) => createAnchors({ shape, inputs, outputs }),\n});\n\n//\n// Symbols\n//\n\ntype PathConstructor = (props: { startX: number; endX: number; height: number }) => string[];\n\ntype GateSymbolProps = {\n width?: number;\n height?: number;\n className?: string;\n strokeWidth?: number;\n};\n\n// TODO(burdon): Note inputs should line up with anchors.\nconst createSymbol =\n (pathConstructor: PathConstructor, inputs: number): FC<GateSymbolProps> =>\n ({\n width = 64,\n height = 32,\n // TODO(burdon): Same as line color.\n className = 'fill-neutral-200 dark:fill-neutral-800 stroke-neutral-500',\n strokeWidth = 1,\n }) => {\n const startX = width * 0.25;\n const endX = width * 0.75;\n const centerY = height / 2;\n const paths = pathConstructor({ startX, endX, height });\n\n return (\n <svg viewBox={`0 0 ${width} ${height}`} className='h-full w-full'>\n {/* Input line. */}\n {getAnchorPoints({ x: 0, y: centerY }, inputs).map(({ x, y }, i) => (\n <line key={i} x1={x} y1={y} x2={startX * 1.3} y2={y} strokeWidth={strokeWidth} className={className} />\n ))}\n\n {/* Output line. */}\n <line x1={endX} y1={centerY} x2={width} y2={centerY} strokeWidth={strokeWidth} className={className} />\n\n {/* And body. */}\n {paths.map((path, i) => (\n <path key={i} d={path} strokeWidth={strokeWidth} className={className} />\n ))}\n </svg>\n );\n };\n\n//\n// AND\n//\n\nconst AndSymbol = createSymbol(({ startX, endX, height }) => {\n const arcRadius = (endX - startX) / 2;\n return [\n `\n M ${startX},${height * 0.1}\n L ${endX - arcRadius},${height * 0.1}\n A ${arcRadius},${height * 0.4} 0 0 1 ${endX - arcRadius},${height * 0.9}\n L ${startX},${height * 0.9}\n Z\n `,\n ];\n}, 2);\n\nexport const AndShape = GateShape;\nexport type AndShape = GateShape;\n\nexport const createAnd = (props: Omit<CreateGateProps, 'type' | 'node'>) => {\n return createGate({ ...props, type: 'and' });\n};\nexport const andShape = defineShape({\n type: 'and',\n name: 'AND',\n icon: 'ph--intersection--regular',\n symbol: AndSymbol,\n createShape: createAnd,\n inputs: ['input.a', 'input.b'],\n});\n\n//\n// OR\n//\n\n// TODO(burdon): Should have sharper point.\nconst OrSymbol = createSymbol(({ startX, endX, height }) => {\n const arcRadius = (endX - startX) / 2;\n return [\n `\n M ${startX},${height * 0.1}\n L ${endX - arcRadius},${height * 0.1}\n A ${arcRadius},${height * 0.4} 0 0 1 ${endX - arcRadius},${height * 0.9}\n L ${startX},${height * 0.9}\n C ${startX * 1.4},${height * 0.5} ${startX * 1.4},${height * 0.5} ${startX},${height * 0.1}\n Z\n `,\n ];\n}, 2);\n\nexport const OrShape = GateShape;\nexport type OrShape = GateShape;\n\nexport const createOr = (props: Omit<CreateGateProps, 'type' | 'node'>) => {\n return createGate({ ...props, type: 'or' });\n};\nexport const orShape = defineShape({\n type: 'or',\n name: 'OR',\n icon: 'ph--union--regular',\n symbol: OrSymbol,\n createShape: createOr,\n inputs: ['input.a', 'input.b'],\n});\n\n//\n// NOT\n//\n\nconst NotSymbol = createSymbol(({ startX, endX, height }) => {\n return [\n `\n M ${startX},${height * 0.1}\n L ${endX * 0.9},${height * 0.5}\n L ${startX},${height * 0.9}\n Z\n `,\n `\n M ${endX - height * 0.2},${height * 0.5}\n A ${height * 0.1} ${height * 0.1} 0 0 1 ${endX},${height * 0.5}\n A ${height * 0.1} ${height * 0.1} 0 0 1 ${endX - height * 0.2},${height * 0.5}\n Z\n `,\n ];\n}, 1);\n\nexport const NotShape = GateShape;\nexport type NotShape = GateShape;\n\nexport const createNot = (props: Omit<CreateGateProps, 'type' | 'node'>) => {\n return createGate({ ...props, type: 'not' });\n};\nexport const notShape = defineShape({\n type: 'not',\n name: 'NOT',\n icon: 'ph--x--regular',\n symbol: NotSymbol,\n createShape: createNot,\n inputs: [createAnchorId('input')],\n});\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport type { ShapeDef } from '@dxos/react-ui-canvas-editor';\nimport { noteShape } from '@dxos/react-ui-canvas-editor';\n\nimport {\n andShape,\n appendShape,\n audioShape,\n beaconShape,\n chatShape,\n constantShape,\n databaseShape,\n feedShape,\n functionShape,\n gptRealtimeShape,\n gptShape,\n ifElseShape,\n ifShape,\n jsonShape,\n jsonTransformShape,\n notShape,\n orShape,\n randomShape,\n reducerShape,\n scopeShape,\n surfaceShape,\n switchShape,\n templateShape,\n textShape,\n textToImageShape,\n threadShape,\n triggerShape,\n} from './shapes';\n\n/**\n * Order used by toolbar.\n */\nexport const computeShapes: { title: string; shapes: ShapeDef[] }[] = [\n {\n title: 'Inputs',\n shapes: [\n //\n constantShape,\n templateShape,\n chatShape,\n switchShape,\n audioShape,\n triggerShape,\n randomShape,\n ],\n },\n {\n title: 'Transform',\n shapes: [\n //\n gptShape,\n gptRealtimeShape,\n functionShape,\n databaseShape,\n textToImageShape,\n appendShape,\n ],\n },\n {\n title: 'Operations',\n shapes: [\n //\n ifShape,\n ifElseShape,\n andShape,\n orShape,\n notShape,\n reducerShape,\n jsonTransformShape,\n ],\n },\n {\n title: 'Outputs',\n shapes: [\n //\n jsonShape,\n feedShape,\n threadShape,\n textShape,\n surfaceShape,\n beaconShape,\n scopeShape,\n ],\n },\n {\n title: 'Misc',\n shapes: [\n //\n noteShape,\n ],\n },\n];\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport { DefaultInput, DefaultOutput } from '@dxos/conductor';\nimport { toEffectSchema } from '@dxos/echo/JsonSchema';\nimport { type Anchor, ShapeLayout, type ShapeRegistry } from '@dxos/react-ui-canvas-editor';\n\nimport { type ComputeGraphController } from './graph';\nimport { type ComputeShape, createFunctionAnchors } from './shapes';\n\n// TODO(burdon): Customize layout. Specialize ComputeShapeDef and registry.\nexport class ComputeShapeLayout extends ShapeLayout {\n constructor(\n private _controller: ComputeGraphController,\n registry: ShapeRegistry,\n ) {\n super(registry);\n }\n\n // TODO(burdon): Doesn't update.\n override getAnchors(shape: ComputeShape): Record<string, Anchor> {\n const shapeDef = this._registry.getShapeDef(shape.type);\n let anchors = shapeDef?.getAnchors?.(shape) ?? {};\n if (shape.node) {\n const node = this._controller.graph.getNode(shape.node);\n if (node.inputSchema || node.outputSchema) {\n // TODO(burdon): Requires that component defined input and output types.\n const inputSchema = node.inputSchema ? toEffectSchema(node.inputSchema) : DefaultInput;\n const outputSchema = node.outputSchema ? toEffectSchema(node.outputSchema) : DefaultOutput;\n anchors = createFunctionAnchors(shape, inputSchema, outputSchema);\n }\n }\n\n return anchors;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,IAAa,iBAAiB,cAAyC,IAAI;AAE3E,IAAa,0BAA0B;CACrC,OAAO,WAAW,cAAc,KAAK,sBAAM,IAAI,MAAM,wBAAwB,CAAC;AAChF;;;ACLA,IAAM,WAAW,GAAG,QAAqB;CACvC,aAAa;EACX,KAAK,MAAM,MAAM,KACf,GAAG;CAEP;AACF;AAOA,IAAa,6BAA6B,EAAE,YAAY,OAAO,gBAAkD;CAC/G,MAAM,GAAG,eAAe,SAAS,CAAC,CAAC;CAEnC,gBAAgB;EACd,IAAI,CAAC,cAAc,CAAC,OAClB;EAGF,WAAgB,KAAK;EACrB,MAAM,MAAM,QACV,WAAW,OAAO,SAAS;GACzB,UAAe,SAAS,OAAO;GAC/B,YAAY,CAAC,CAAC;EAChB,CAAC,GAGD,WAAW,OAAO,IAAI,EAAE,QAAQ,UAAU,YAAY;GACpD,IAAI,MAAM,SAAS,gBAEjB;GAGF,MAAM,OAAO,MAAM,MAAM,MAAM,SAAS;IAEtC,OADe,MAAM,QAAQ,KAAK,MAC1B,CAAA,CAAwB,SAAS,UAAU,KAAK,WAAW;GACrE,CAAC;GAED,IAAI,MACF,UAAe,SAAS,SAAS;IAAE,MAAM;IAAW,OAAO,CAAC,IAAI;GAAE,CAAC;EAEvE,CAAC,CACH;EAEA,aA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;AAmBnC,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAKpB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAKvB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAKnB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAKtB,CAAC;AAEF,eAAO,MAAM,GAAG,EAAE,KAKjB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAQrB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAKtB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAQtB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAKnB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAKnB,CAAC"}
@@ -1,54 +1,5 @@
1
- import * as Schema from 'effect/Schema';
2
1
  import React from 'react';
3
- import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
4
- import { type CreateShapeProps } from './defs';
5
- export declare const AppendShape: Schema.extend<Schema.extend<Schema.mutable<Schema.extend<Schema.extend<Schema.SchemaClass<{
6
- readonly id: string;
7
- readonly data?: any;
8
- }, {
9
- readonly data?: any;
10
- readonly id: string;
11
- }, never>, Schema.Struct<{
12
- type: typeof Schema.String;
13
- text: Schema.optional<typeof Schema.String>;
14
- guide: Schema.optional<typeof Schema.Boolean>;
15
- classNames: Schema.optional<typeof Schema.String>;
16
- }>>, Schema.Struct<{
17
- center: Schema.Struct<{
18
- x: typeof Schema.Number;
19
- y: typeof Schema.Number;
20
- }>;
21
- size: Schema.mutable<Schema.Struct<{
22
- width: typeof Schema.Number;
23
- height: typeof Schema.Number;
24
- }>>;
25
- }>>>, Schema.mutable<Schema.Struct<{
26
- node: Schema.optional<Schema.SchemaClass<string, string, never>>;
27
- }>>>, Schema.Struct<{
28
- type: Schema.Literal<["append"]>;
29
- }>>;
30
- export type AppendShape = Schema.Schema.Type<typeof AppendShape>;
31
- export type CreateAppendProps = CreateShapeProps<AppendShape>;
32
- export declare const createAppend: (props: CreateAppendProps) => {
33
- id: string;
34
- data?: any;
35
- type: string;
36
- text?: string | undefined;
37
- guide?: boolean | undefined;
38
- classNames?: string | undefined;
39
- center: {
40
- readonly x: number;
41
- readonly y: number;
42
- };
43
- size: {
44
- width: number;
45
- height: number;
46
- };
47
- } & {
48
- node?: string | undefined;
49
- } & {
50
- readonly type: "append";
51
- };
2
+ import { type ShapeComponentProps } from '@dxos/react-ui-canvas-editor';
3
+ import { type AppendShape } from './append-def';
52
4
  export declare const AppendComponent: ({ shape }: ShapeComponentProps<AppendShape>) => React.JSX.Element;
53
- export declare const appendShape: ShapeDef<AppendShape>;
54
5
  //# sourceMappingURL=Append.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Append.d.ts","sourceRoot":"","sources":["../../../../src/shapes/Append.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAGvF,OAAO,EAAgB,KAAK,gBAAgB,EAAe,MAAM,QAAQ,CAAC;AAE1E,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;GAKvB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,WAAW,CAAC,CAAC;AAEjE,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;AAE9D,eAAO,MAAM,YAAY,UAAW,iBAAiB;;;;;;;;;;;;;;;;;;;CAKjD,CAAC;AAEL,eAAO,MAAM,eAAe,cAAe,mBAAmB,CAAC,WAAW,CAAC,sBAE1E,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,WAAW,CAO7C,CAAC"}
1
+ {"version":3,"file":"Append.d.ts","sourceRoot":"","sources":["../../../../src/shapes/Append.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAExE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,eAAO,MAAM,eAAe,cAAe,mBAAmB,CAAC,WAAW,CAAC,sBAE1E,CAAC"}
@@ -1,38 +1,6 @@
1
- import * as Schema from 'effect/Schema';
2
1
  import React from 'react';
3
- import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
4
- import { type CreateShapeProps } from './defs';
5
- export declare const ReducerShape: Schema.extend<Schema.extend<Schema.mutable<Schema.extend<Schema.extend<Schema.SchemaClass<{
6
- readonly id: string;
7
- readonly data?: any;
8
- }, {
9
- readonly data?: any;
10
- readonly id: string;
11
- }, never>, Schema.Struct<{
12
- type: typeof Schema.String;
13
- text: Schema.optional<typeof Schema.String>;
14
- guide: Schema.optional<typeof Schema.Boolean>;
15
- classNames: Schema.optional<typeof Schema.String>;
16
- }>>, Schema.Struct<{
17
- center: Schema.Struct<{
18
- x: typeof Schema.Number;
19
- y: typeof Schema.Number;
20
- }>;
21
- size: Schema.mutable<Schema.Struct<{
22
- width: typeof Schema.Number;
23
- height: typeof Schema.Number;
24
- }>>;
25
- }>>>, Schema.mutable<Schema.Struct<{
26
- node: Schema.optional<Schema.SchemaClass<string, string, never>>;
27
- }>>>, Schema.Struct<{
28
- type: Schema.Literal<["reducer"]>;
29
- }>>;
30
- export type ReducerShape = Schema.Schema.Type<typeof ReducerShape>;
2
+ import { type ShapeComponentProps } from '@dxos/react-ui-canvas-editor';
3
+ import { type ReducerShape } from './array-def';
31
4
  export type ReducerComponentProps = ShapeComponentProps<ReducerShape>;
32
5
  export declare const ReducerComponent: ({ shape }: ReducerComponentProps) => React.JSX.Element;
33
- export type CreateReduceProps = CreateShapeProps<ReducerShape> & {
34
- reduce?: string;
35
- };
36
- export declare const createReducer: ({ id, size, ...rest }: CreateReduceProps) => ReducerShape;
37
- export declare const reducerShape: ShapeDef<ReducerShape>;
38
6
  //# sourceMappingURL=Array.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Array.d.ts","sourceRoot":"","sources":["../../../../src/shapes/Array.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAGvF,OAAO,EAAgB,KAAK,gBAAgB,EAAe,MAAM,QAAQ,CAAC;AAM1E,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;GAKxB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,YAAY,CAAC,CAAC;AAMnE,MAAM,MAAM,qBAAqB,GAAG,mBAAmB,CAAC,YAAY,CAAC,CAAC;AAEtE,eAAO,MAAM,gBAAgB,cAAe,qBAAqB,sBAEhE,CAAC;AAMF,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,YAAY,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAErF,eAAO,MAAM,aAAa,0BAIvB,iBAAiB,KAAG,YAKnB,CAAC;AAEL,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,YAAY,CAO/C,CAAC"}
1
+ {"version":3,"file":"Array.d.ts","sourceRoot":"","sources":["../../../../src/shapes/Array.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAExE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAOhD,MAAM,MAAM,qBAAqB,GAAG,mBAAmB,CAAC,YAAY,CAAC,CAAC;AAEtE,eAAO,MAAM,gBAAgB,cAAe,qBAAqB,sBAEhE,CAAC"}
@@ -1,54 +1,5 @@
1
- import * as Schema from 'effect/Schema';
2
1
  import React from 'react';
3
- import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
4
- import { type CreateShapeProps } from './defs';
5
- export declare const AudioShape: Schema.extend<Schema.extend<Schema.mutable<Schema.extend<Schema.extend<Schema.SchemaClass<{
6
- readonly id: string;
7
- readonly data?: any;
8
- }, {
9
- readonly data?: any;
10
- readonly id: string;
11
- }, never>, Schema.Struct<{
12
- type: typeof Schema.String;
13
- text: Schema.optional<typeof Schema.String>;
14
- guide: Schema.optional<typeof Schema.Boolean>;
15
- classNames: Schema.optional<typeof Schema.String>;
16
- }>>, Schema.Struct<{
17
- center: Schema.Struct<{
18
- x: typeof Schema.Number;
19
- y: typeof Schema.Number;
20
- }>;
21
- size: Schema.mutable<Schema.Struct<{
22
- width: typeof Schema.Number;
23
- height: typeof Schema.Number;
24
- }>>;
25
- }>>>, Schema.mutable<Schema.Struct<{
26
- node: Schema.optional<Schema.SchemaClass<string, string, never>>;
27
- }>>>, Schema.Struct<{
28
- type: Schema.Literal<["audio"]>;
29
- }>>;
30
- export type AudioShape = Schema.Schema.Type<typeof AudioShape>;
31
- export type CreateAudioProps = CreateShapeProps<AudioShape>;
32
- export declare const createAudio: (props: CreateAudioProps) => {
33
- id: string;
34
- data?: any;
35
- type: string;
36
- text?: string | undefined;
37
- guide?: boolean | undefined;
38
- classNames?: string | undefined;
39
- center: {
40
- readonly x: number;
41
- readonly y: number;
42
- };
43
- size: {
44
- width: number;
45
- height: number;
46
- };
47
- } & {
48
- node?: string | undefined;
49
- } & {
50
- readonly type: "audio";
51
- };
2
+ import { type ShapeComponentProps } from '@dxos/react-ui-canvas-editor';
3
+ import { type AudioShape } from './audio-def';
52
4
  export declare const AudioComponent: ({ shape }: ShapeComponentProps<AudioShape>) => React.JSX.Element;
53
- export declare const audioShape: ShapeDef<AudioShape>;
54
5
  //# sourceMappingURL=Audio.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Audio.d.ts","sourceRoot":"","sources":["../../../../src/shapes/Audio.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAA8B,MAAM,OAAO,CAAC;AAInD,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,QAAQ,EAAmB,MAAM,8BAA8B,CAAC;AAGxG,OAAO,EAAgB,KAAK,gBAAgB,EAA+B,MAAM,QAAQ,CAAC;AAE1F,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;GAKtB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC,CAAC;AAE/D,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;AAE5D,eAAO,MAAM,WAAW,UAAW,gBAAgB;;;;;;;;;;;;;;;;;;;CACoC,CAAC;AAExF,eAAO,MAAM,cAAc,cAAe,mBAAmB,CAAC,UAAU,CAAC,sBAkBxE,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,UAAU,CAO3C,CAAC"}
1
+ {"version":3,"file":"Audio.d.ts","sourceRoot":"","sources":["../../../../src/shapes/Audio.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAInD,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAGxE,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,eAAO,MAAM,cAAc,cAAe,mBAAmB,CAAC,UAAU,CAAC,sBAkBxE,CAAC"}