@dxos/plugin-graph 0.8.4-main.f5c0578 → 0.8.4-main.fcc0d83b33

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 (40) hide show
  1. package/dist/lib/browser/graph-RCKCHDM6.mjs +48 -0
  2. package/dist/lib/browser/graph-RCKCHDM6.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +69 -29
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/node-esm/graph-P7F6HXZB.mjs +50 -0
  7. package/dist/lib/node-esm/graph-P7F6HXZB.mjs.map +7 -0
  8. package/dist/lib/node-esm/index.mjs +69 -29
  9. package/dist/lib/node-esm/index.mjs.map +4 -4
  10. package/dist/lib/node-esm/meta.json +1 -1
  11. package/dist/types/src/GraphPlugin.d.ts +2 -1
  12. package/dist/types/src/GraphPlugin.d.ts.map +1 -1
  13. package/dist/types/src/action.d.ts +12 -0
  14. package/dist/types/src/action.d.ts.map +1 -0
  15. package/dist/types/src/graph.d.ts +7 -3
  16. package/dist/types/src/graph.d.ts.map +1 -1
  17. package/dist/types/src/hooks/index.d.ts +1 -0
  18. package/dist/types/src/hooks/index.d.ts.map +1 -1
  19. package/dist/types/src/hooks/useActionRunner.d.ts +7 -0
  20. package/dist/types/src/hooks/useActionRunner.d.ts.map +1 -0
  21. package/dist/types/src/hooks/useNode.d.ts +19 -4
  22. package/dist/types/src/hooks/useNode.d.ts.map +1 -1
  23. package/dist/types/src/index.d.ts +1 -0
  24. package/dist/types/src/index.d.ts.map +1 -1
  25. package/dist/types/src/meta.d.ts +2 -3
  26. package/dist/types/src/meta.d.ts.map +1 -1
  27. package/dist/types/tsconfig.tsbuildinfo +1 -1
  28. package/package.json +32 -24
  29. package/src/GraphPlugin.ts +14 -12
  30. package/src/action.ts +34 -0
  31. package/src/graph.ts +53 -37
  32. package/src/hooks/index.ts +1 -0
  33. package/src/hooks/useActionRunner.ts +25 -0
  34. package/src/hooks/useNode.ts +35 -9
  35. package/src/index.ts +1 -0
  36. package/src/meta.ts +8 -5
  37. package/dist/lib/browser/graph-WYYTSA5Q.mjs +0 -37
  38. package/dist/lib/browser/graph-WYYTSA5Q.mjs.map +0 -7
  39. package/dist/lib/node-esm/graph-UPSQNHOM.mjs +0 -39
  40. package/dist/lib/node-esm/graph-UPSQNHOM.mjs.map +0 -7
@@ -0,0 +1,48 @@
1
+ // src/graph.ts
2
+ import * as Effect from "effect/Effect";
3
+ import * as Record from "effect/Record";
4
+ import { Capabilities, Capability } from "@dxos/app-framework";
5
+ import { Graph, GraphBuilder, Node } from "@dxos/app-graph";
6
+ import { AppCapabilities } from "@dxos/app-toolkit";
7
+ var graph_default = Capability.makeModule(Effect.fnUntraced(function* () {
8
+ const registry = yield* Capability.get(Capabilities.AtomRegistry);
9
+ const extensionsByModuleAtom = yield* Capability.atomByModule(AppCapabilities.AppGraphBuilder);
10
+ const builder = GraphBuilder.from(
11
+ /* localStorage.getItem(KEY) ?? */
12
+ void 0,
13
+ registry
14
+ );
15
+ const unsubscribe = registry.subscribe(extensionsByModuleAtom, (extensionsByModule) => {
16
+ const next = [];
17
+ for (const [moduleId, extensions] of Object.entries(extensionsByModule)) {
18
+ for (const ext of GraphBuilder.flattenExtensions(extensions)) {
19
+ next.push({
20
+ ...ext,
21
+ id: `${moduleId}.${ext.id}`
22
+ });
23
+ }
24
+ }
25
+ const current = Record.values(registry.get(builder.extensions));
26
+ const removed = current.filter(({ id }) => !next.some(({ id: nextId }) => nextId === id));
27
+ removed.forEach((extension) => GraphBuilder.removeExtension(builder, extension.id));
28
+ next.forEach((extension) => GraphBuilder.addExtension(builder, extension));
29
+ }, {
30
+ immediate: true
31
+ });
32
+ void Graph.expand(builder.graph, Node.RootId, "child");
33
+ setupDevtools(builder.graph);
34
+ return Capability.contributes(AppCapabilities.AppGraph, {
35
+ graph: builder.graph,
36
+ explore: GraphBuilder.explore
37
+ }, () => Effect.sync(() => {
38
+ unsubscribe();
39
+ }));
40
+ }));
41
+ var setupDevtools = (graph) => {
42
+ globalThis.composer ??= {};
43
+ globalThis.composer.graph = graph;
44
+ };
45
+ export {
46
+ graph_default as default
47
+ };
48
+ //# sourceMappingURL=graph-RCKCHDM6.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/graph.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Record from 'effect/Record';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { Graph, GraphBuilder, Node } from '@dxos/app-graph';\nimport { AppCapabilities } from '@dxos/app-toolkit';\n\n// TODO(wittjosiah): Remove or restore graph caching.\n// import { meta } from './meta';\n\n// const KEY = `${meta.id}.app-graph`;\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n const registry = yield* Capability.get(Capabilities.AtomRegistry);\n const extensionsByModuleAtom = yield* Capability.atomByModule(AppCapabilities.AppGraphBuilder);\n\n const builder = GraphBuilder.from(/* localStorage.getItem(KEY) ?? */ undefined, registry);\n // const interval = setInterval(() => {\n // localStorage.setItem(KEY, builder.graph.pickle());\n // }, 5_000);\n\n const unsubscribe = registry.subscribe(\n extensionsByModuleAtom,\n (extensionsByModule) => {\n const next: GraphBuilder.BuilderExtension[] = [];\n for (const [moduleId, extensions] of Object.entries(extensionsByModule)) {\n for (const ext of GraphBuilder.flattenExtensions(extensions)) {\n next.push({ ...ext, id: `${moduleId}.${ext.id}` });\n }\n }\n const current = Record.values(registry.get(builder.extensions));\n const removed = current.filter(({ id }) => !next.some(({ id: nextId }) => nextId === id));\n removed.forEach((extension) => GraphBuilder.removeExtension(builder, extension.id));\n next.forEach((extension) => GraphBuilder.addExtension(builder, extension));\n },\n { immediate: true },\n );\n\n // await builder.initialize();\n void Graph.expand(builder.graph, Node.RootId, 'child');\n\n setupDevtools(builder.graph);\n\n return Capability.contributes(\n AppCapabilities.AppGraph,\n { graph: builder.graph, explore: GraphBuilder.explore },\n () =>\n Effect.sync(() => {\n // clearInterval(interval);\n unsubscribe();\n }),\n );\n }),\n);\n\n// Expose the graph to the window for debugging.\nconst setupDevtools = (graph: Graph.ExpandableGraph) => {\n (globalThis as any).composer ??= {};\n (globalThis as any).composer.graph = graph;\n};\n"],
5
+ "mappings": ";AAIA,YAAYA,YAAY;AACxB,YAAYC,YAAY;AAExB,SAASC,cAAcC,kBAAkB;AACzC,SAASC,OAAOC,cAAcC,YAAY;AAC1C,SAASC,uBAAuB;AAOhC,IAAA,gBAAeJ,WAAWK,WACjBC,kBAAW,aAAA;AAChB,QAAMC,WAAW,OAAOP,WAAWQ,IAAIT,aAAaU,YAAY;AAChE,QAAMC,yBAAyB,OAAOV,WAAWW,aAAaP,gBAAgBQ,eAAe;AAE7F,QAAMC,UAAUX,aAAaY;;IAAwCC;IAAWR;EAAAA;AAKhF,QAAMS,cAAcT,SAASU,UAC3BP,wBACA,CAACQ,uBAAAA;AACC,UAAMC,OAAwC,CAAA;AAC9C,eAAW,CAACC,UAAUC,UAAAA,KAAeC,OAAOC,QAAQL,kBAAAA,GAAqB;AACvE,iBAAWM,OAAOtB,aAAauB,kBAAkBJ,UAAAA,GAAa;AAC5DF,aAAKO,KAAK;UAAE,GAAGF;UAAKG,IAAI,GAAGP,QAAAA,IAAYI,IAAIG,EAAE;QAAG,CAAA;MAClD;IACF;AACA,UAAMC,UAAiBC,cAAOtB,SAASC,IAAIK,QAAQQ,UAAU,CAAA;AAC7D,UAAMS,UAAUF,QAAQG,OAAO,CAAC,EAAEJ,GAAE,MAAO,CAACR,KAAKa,KAAK,CAAC,EAAEL,IAAIM,OAAM,MAAOA,WAAWN,EAAAA,CAAAA;AACrFG,YAAQI,QAAQ,CAACC,cAAcjC,aAAakC,gBAAgBvB,SAASsB,UAAUR,EAAE,CAAA;AACjFR,SAAKe,QAAQ,CAACC,cAAcjC,aAAamC,aAAaxB,SAASsB,SAAAA,CAAAA;EACjE,GACA;IAAEG,WAAW;EAAK,CAAA;AAIpB,OAAKrC,MAAMsC,OAAO1B,QAAQ2B,OAAOrC,KAAKsC,QAAQ,OAAA;AAE9CC,gBAAc7B,QAAQ2B,KAAK;AAE3B,SAAOxC,WAAW2C,YAChBvC,gBAAgBwC,UAChB;IAAEJ,OAAO3B,QAAQ2B;IAAOK,SAAS3C,aAAa2C;EAAQ,GACtD,MACSC,YAAK,MAAA;AAEV9B,gBAAAA;EACF,CAAA,CAAA;AAEN,CAAA,CAAA;AAIF,IAAM0B,gBAAgB,CAACF,UAAAA;AACpBO,aAAmBC,aAAa,CAAC;AACjCD,aAAmBC,SAASR,QAAQA;AACvC;",
6
+ "names": ["Effect", "Record", "Capabilities", "Capability", "Graph", "GraphBuilder", "Node", "AppCapabilities", "makeModule", "fnUntraced", "registry", "get", "AtomRegistry", "extensionsByModuleAtom", "atomByModule", "AppGraphBuilder", "builder", "from", "undefined", "unsubscribe", "subscribe", "extensionsByModule", "next", "moduleId", "extensions", "Object", "entries", "ext", "flattenExtensions", "push", "id", "current", "values", "removed", "filter", "some", "nextId", "forEach", "extension", "removeExtension", "addExtension", "immediate", "expand", "graph", "RootId", "setupDevtools", "contributes", "AppGraph", "explore", "sync", "globalThis", "composer"]
7
+ }
@@ -1,50 +1,90 @@
1
1
  // src/index.ts
2
2
  export * from "@dxos/app-graph";
3
3
 
4
+ // src/action.ts
5
+ import * as Effect from "effect/Effect";
6
+ import * as Function from "effect/Function";
7
+ import { Capability } from "@dxos/app-framework";
8
+ import { Operation } from "@dxos/compute";
9
+ import { runAndForwardErrors } from "@dxos/effect";
10
+ var runAction = async (invoker, capabilityManager, action, params = {}) => runAndForwardErrors(action.data(params).pipe(Effect.provideService(Operation.Service, invoker), Effect.provideService(Capability.Service, capabilityManager), action._actionContext ? Effect.provide(action._actionContext) : Function.identity));
11
+
4
12
  // src/GraphPlugin.ts
5
- import { Events, defineModule, definePlugin, lazy } from "@dxos/app-framework";
13
+ import { ActivationEvents, Capability as Capability2, Plugin } from "@dxos/app-framework";
14
+ import { AppActivationEvents } from "@dxos/app-toolkit";
15
+ import { meta } from "#meta";
16
+ var Graph = Capability2.lazy("Graph", () => import("./graph-RCKCHDM6.mjs"));
17
+ var GraphPlugin = Plugin.define(meta).pipe(Plugin.addModule({
18
+ activatesOn: ActivationEvents.Startup,
19
+ firesBeforeActivation: [
20
+ AppActivationEvents.SetupAppGraph,
21
+ AppActivationEvents.SetupMetadata
22
+ ],
23
+ firesAfterActivation: [
24
+ AppActivationEvents.AppGraphReady
25
+ ],
26
+ activate: Graph
27
+ }), Plugin.make);
6
28
 
7
- // src/meta.ts
8
- var GRAPH_PLUGIN = "dxos.org/plugin/graph";
9
- var meta = {
10
- id: GRAPH_PLUGIN,
11
- name: "Graph"
29
+ // src/hooks/useActionRunner.ts
30
+ import { useCallback } from "react";
31
+ import { useOperationInvoker, usePluginManager } from "@dxos/app-framework/ui";
32
+ var useActionRunner = () => {
33
+ const invoker = useOperationInvoker();
34
+ const pluginManager = usePluginManager();
35
+ return useCallback((action, params = {}) => runAction(invoker, pluginManager.capabilities, action, params), [
36
+ invoker,
37
+ pluginManager.capabilities
38
+ ]);
12
39
  };
13
40
 
14
- // src/GraphPlugin.ts
15
- var GraphPlugin = () => definePlugin(meta, [
16
- defineModule({
17
- id: `${meta.id}/module/graph`,
18
- activatesOn: Events.Startup,
19
- activatesBefore: [
20
- Events.SetupAppGraph,
21
- Events.SetupMetadata
22
- ],
23
- activatesAfter: [
24
- Events.AppGraphReady
25
- ],
26
- activate: lazy(() => import("./graph-WYYTSA5Q.mjs"))
27
- })
28
- ]);
29
-
30
41
  // src/hooks/useNode.ts
31
- import { useRxValue } from "@effect-rx/rx-react";
32
- import { Option } from "effect";
42
+ import { useAtomValue } from "@effect-atom/atom-react";
43
+ import * as Option from "effect/Option";
44
+ import { useMemo } from "react";
33
45
  var useNode = (graph, id) => {
34
- return Option.getOrElse(useRxValue(graph.node(id ?? "")), () => void 0);
46
+ const atom = useMemo(() => graph.node(id ?? ""), [
47
+ graph,
48
+ id
49
+ ]);
50
+ return Option.getOrElse(useAtomValue(atom), () => void 0);
35
51
  };
36
52
  var useConnections = (graph, id, relation) => {
37
- return useRxValue(graph.connections(id ?? "", relation));
53
+ return useAtomValue(graph.connections(id ?? "", relation));
38
54
  };
39
55
  var useActions = (graph, id) => {
40
- return useRxValue(graph.actions(id ?? ""));
56
+ const atom = useMemo(() => graph.actions(id ?? ""), [
57
+ graph,
58
+ id
59
+ ]);
60
+ return useAtomValue(atom);
61
+ };
62
+ var useEdges = (graph, id) => {
63
+ const atom = useMemo(() => graph.edges(id ?? ""), [
64
+ graph,
65
+ id
66
+ ]);
67
+ return useAtomValue(atom);
68
+ };
69
+
70
+ // src/meta.ts
71
+ import { trim } from "@dxos/util";
72
+ var meta2 = {
73
+ id: "org.dxos.plugin.graph",
74
+ name: "Graph",
75
+ description: trim`
76
+ Graph database layer providing relationship modeling and queries for workspace objects.
77
+ Build knowledge graphs and explore complex data relationships.
78
+ `
41
79
  };
42
80
  export {
43
- GRAPH_PLUGIN,
44
81
  GraphPlugin,
45
- meta,
82
+ meta2 as meta,
83
+ runAction,
84
+ useActionRunner,
46
85
  useActions,
47
86
  useConnections,
87
+ useEdges,
48
88
  useNode
49
89
  };
50
90
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/index.ts", "../../../src/GraphPlugin.ts", "../../../src/meta.ts", "../../../src/hooks/useNode.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport * from '@dxos/app-graph';\n\nexport * from './GraphPlugin';\nexport * from './hooks';\nexport * from './meta';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Events, defineModule, definePlugin, lazy } from '@dxos/app-framework';\n\nimport { meta } from './meta';\n\n/**\n * Manages the state of the graph for the application.\n * Enables other plugins to register node builders to add nodes to the graph.\n * This includes actions and annotation each other's nodes.\n */\nexport const GraphPlugin = () =>\n definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/graph`,\n activatesOn: Events.Startup,\n activatesBefore: [Events.SetupAppGraph, Events.SetupMetadata],\n activatesAfter: [Events.AppGraphReady],\n activate: lazy(() => import('./graph')),\n }),\n ]);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const GRAPH_PLUGIN = 'dxos.org/plugin/graph';\n\nexport const meta: PluginMeta = {\n id: GRAPH_PLUGIN,\n name: 'Graph',\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { useRxValue } from '@effect-rx/rx-react';\nimport { Option } from 'effect';\n\nimport { type Node, type ReadableGraph, type Relation } from '@dxos/app-graph';\n\n/**\n * React hook to get a node from the graph.\n *\n * @param graph Graph to find the node in.\n * @param id Id of the node to find.\n * @param timeout Optional timeout in milliseconds to wait for the node to be found.\n * @returns Node if found, undefined otherwise.\n */\n// TODO(wittjosiah): Factor out to @dxos/app-graph/react.\nexport const useNode = <T = any>(graph: ReadableGraph, id?: string): Node<T> | undefined => {\n return Option.getOrElse(useRxValue(graph.node(id ?? '')), () => undefined);\n};\n\nexport const useConnections = (graph: ReadableGraph, id?: string, relation?: Relation): Node[] => {\n return useRxValue(graph.connections(id ?? '', relation));\n};\n\nexport const useActions = (graph: ReadableGraph, id?: string): Node[] => {\n return useRxValue(graph.actions(id ?? ''));\n};\n"],
5
- "mappings": ";AAIA,cAAc;;;ACAd,SAASA,QAAQC,cAAcC,cAAcC,YAAY;;;ACElD,IAAMC,eAAe;AAErB,IAAMC,OAAmB;EAC9BC,IAAIF;EACJG,MAAM;AACR;;;ADEO,IAAMC,cAAc,MACzBC,aAAaC,MAAM;EACjBC,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOC;IACpBC,iBAAiB;MAACF,OAAOG;MAAeH,OAAOI;;IAC/CC,gBAAgB;MAACL,OAAOM;;IACxBC,UAAUC,KAAK,MAAM,OAAO,sBAAA,CAAA;EAC9B,CAAA;CACD;;;AElBH,SAASC,kBAAkB;AAC3B,SAASC,cAAc;AAahB,IAAMC,UAAU,CAAUC,OAAsBC,OAAAA;AACrD,SAAOC,OAAOC,UAAUC,WAAWJ,MAAMK,KAAKJ,MAAM,EAAA,CAAA,GAAM,MAAMK,MAAAA;AAClE;AAEO,IAAMC,iBAAiB,CAACP,OAAsBC,IAAaO,aAAAA;AAChE,SAAOJ,WAAWJ,MAAMS,YAAYR,MAAM,IAAIO,QAAAA,CAAAA;AAChD;AAEO,IAAME,aAAa,CAACV,OAAsBC,OAAAA;AAC/C,SAAOG,WAAWJ,MAAMW,QAAQV,MAAM,EAAA,CAAA;AACxC;",
6
- "names": ["Events", "defineModule", "definePlugin", "lazy", "GRAPH_PLUGIN", "meta", "id", "name", "GraphPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "Startup", "activatesBefore", "SetupAppGraph", "SetupMetadata", "activatesAfter", "AppGraphReady", "activate", "lazy", "useRxValue", "Option", "useNode", "graph", "id", "Option", "getOrElse", "useRxValue", "node", "undefined", "useConnections", "relation", "connections", "useActions", "actions"]
3
+ "sources": ["../../../src/index.ts", "../../../src/action.ts", "../../../src/GraphPlugin.ts", "../../../src/hooks/useActionRunner.ts", "../../../src/hooks/useNode.ts", "../../../src/meta.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport * from '@dxos/app-graph';\n\nexport * from './action';\nexport * from './GraphPlugin';\nexport * from './hooks';\nexport * from './meta';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Function from 'effect/Function';\n\nimport { Capability, type CapabilityManager } from '@dxos/app-framework';\nimport { type Node } from '@dxos/app-graph';\nimport { Operation, type OperationInvoker } from '@dxos/compute';\nimport { runAndForwardErrors } from '@dxos/effect';\n\n/**\n * Run an action with required layers: Operation.Service, Capability.Service, and captured context.\n * @param invoker The operation invoker to use for Operation.Service.\n * @param capabilityManager The capability manager for Capability.Service.\n * @param action The action to execute.\n * @param params Parameters to pass to the action.\n */\nexport const runAction = async (\n invoker: OperationInvoker.OperationInvoker,\n capabilityManager: CapabilityManager.CapabilityManager,\n action: Node.Action,\n params: Node.InvokeProps = {},\n): Promise<void> =>\n runAndForwardErrors(\n action\n .data(params)\n .pipe(\n Effect.provideService(Operation.Service, invoker),\n Effect.provideService(Capability.Service, capabilityManager),\n action._actionContext ? Effect.provide(action._actionContext) : Function.identity,\n ),\n );\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { ActivationEvents, Capability, Plugin } from '@dxos/app-framework';\nimport { AppActivationEvents } from '@dxos/app-toolkit';\n\nimport { meta } from '#meta';\n\nconst Graph = Capability.lazy('Graph', () => import('./graph'));\n\n/**\n * Manages the state of the graph for the application.\n * Enables other plugins to register node builders to add nodes to the graph.\n * This includes actions and annotation each other's nodes.\n */\nexport const GraphPlugin = Plugin.define(meta).pipe(\n Plugin.addModule({\n activatesOn: ActivationEvents.Startup,\n firesBeforeActivation: [AppActivationEvents.SetupAppGraph, AppActivationEvents.SetupMetadata],\n firesAfterActivation: [AppActivationEvents.AppGraphReady],\n activate: Graph,\n }),\n Plugin.make,\n);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCallback } from 'react';\n\nimport { useOperationInvoker, usePluginManager } from '@dxos/app-framework/ui';\nimport { type Node } from '@dxos/app-graph';\n\nimport { runAction } from '../action';\n\n/**\n * Hook that returns a function to run action Effects.\n * Provides Operation.Service, PluginContextService, and captured plugin context.\n */\nexport const useActionRunner = () => {\n const invoker = useOperationInvoker();\n const pluginManager = usePluginManager();\n\n return useCallback(\n (action: Node.Action, params: Node.InvokeProps = {}) =>\n runAction(invoker, pluginManager.capabilities, action, params),\n [invoker, pluginManager.capabilities],\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { useAtomValue } from '@effect-atom/atom-react';\nimport * as Option from 'effect/Option';\nimport { useMemo } from 'react';\n\nimport { type Graph, type Node } from '@dxos/app-graph';\n\n/**\n * React hook to get a node from the graph.\n *\n * @param graph Graph to find the node in.\n * @param id Id of the node to find.\n * @param timeout Optional timeout in milliseconds to wait for the node to be found.\n * @returns Node if found, undefined otherwise.\n */\n// TODO(wittjosiah): Factor out to @dxos/app-graph/react.\nexport const useNode = <T = any>(graph: Graph.ReadableGraph, id?: string): Node.Node<T> | undefined => {\n const atom = useMemo(() => graph.node(id ?? ''), [graph, id]);\n return Option.getOrElse(useAtomValue(atom), () => undefined);\n};\n\nexport const useConnections = (\n graph: Graph.ReadableGraph,\n id: string | undefined,\n relation: Node.RelationInput,\n): Node.Node[] => {\n return useAtomValue(graph.connections(id ?? '', relation));\n};\n\n/**\n * React hook to get actions available for a node.\n *\n * @param graph Graph containing the node.\n * @param id Id of the node.\n * @returns Actions available for the node.\n */\nexport const useActions = (graph: Graph.ReadableGraph, id?: string): Node.Node[] => {\n const atom = useMemo(() => graph.actions(id ?? ''), [graph, id]);\n return useAtomValue(atom);\n};\n\n/**\n * Subscribe to just the edge topology (inbound/outbound IDs) of a node without subscribing to node content.\n *\n * @param graph Graph containing the node.\n * @param id Id of the node.\n * @returns Edge topology for the node.\n */\nexport const useEdges = (graph: Graph.ReadableGraph, id?: string): Graph.Edges => {\n const atom = useMemo(() => graph.edges(id ?? ''), [graph, id]);\n return useAtomValue(atom);\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'org.dxos.plugin.graph',\n name: 'Graph',\n description: trim`\n Graph database layer providing relationship modeling and queries for workspace objects.\n Build knowledge graphs and explore complex data relationships.\n `,\n};\n"],
5
+ "mappings": ";AAIA,cAAc;;;ACAd,YAAYA,YAAY;AACxB,YAAYC,cAAc;AAE1B,SAASC,kBAA0C;AAEnD,SAASC,iBAAwC;AACjD,SAASC,2BAA2B;AAS7B,IAAMC,YAAY,OACvBC,SACAC,mBACAC,QACAC,SAA2B,CAAC,MAE5BL,oBACEI,OACGE,KAAKD,MAAAA,EACLE,KACQC,sBAAeT,UAAUU,SAASP,OAAAA,GAClCM,sBAAeV,WAAWW,SAASN,iBAAAA,GAC1CC,OAAOM,iBAAwBC,eAAQP,OAAOM,cAAc,IAAaE,iBAAQ,CAAA;;;AC3BzF,SAASC,kBAAkBC,cAAAA,aAAYC,cAAc;AACrD,SAASC,2BAA2B;AAEpC,SAASC,YAAY;AAErB,IAAMC,QAAQJ,YAAWK,KAAK,SAAS,MAAM,OAAO,sBAAA,CAAA;AAO7C,IAAMC,cAAcL,OAAOM,OAAOJ,IAAAA,EAAMK,KAC7CP,OAAOQ,UAAU;EACfC,aAAaX,iBAAiBY;EAC9BC,uBAAuB;IAACV,oBAAoBW;IAAeX,oBAAoBY;;EAC/EC,sBAAsB;IAACb,oBAAoBc;;EAC3CC,UAAUb;AACZ,CAAA,GACAH,OAAOiB,IAAI;;;ACnBb,SAASC,mBAAmB;AAE5B,SAASC,qBAAqBC,wBAAwB;AAS/C,IAAMC,kBAAkB,MAAA;AAC7B,QAAMC,UAAUC,oBAAAA;AAChB,QAAMC,gBAAgBC,iBAAAA;AAEtB,SAAOC,YACL,CAACC,QAAqBC,SAA2B,CAAC,MAChDC,UAAUP,SAASE,cAAcM,cAAcH,QAAQC,MAAAA,GACzD;IAACN;IAASE,cAAcM;GAAa;AAEzC;;;ACpBA,SAASC,oBAAoB;AAC7B,YAAYC,YAAY;AACxB,SAASC,eAAe;AAajB,IAAMC,UAAU,CAAUC,OAA4BC,OAAAA;AAC3D,QAAMC,OAAOJ,QAAQ,MAAME,MAAMG,KAAKF,MAAM,EAAA,GAAK;IAACD;IAAOC;GAAG;AAC5D,SAAcG,iBAAUR,aAAaM,IAAAA,GAAO,MAAMG,MAAAA;AACpD;AAEO,IAAMC,iBAAiB,CAC5BN,OACAC,IACAM,aAAAA;AAEA,SAAOX,aAAaI,MAAMQ,YAAYP,MAAM,IAAIM,QAAAA,CAAAA;AAClD;AASO,IAAME,aAAa,CAACT,OAA4BC,OAAAA;AACrD,QAAMC,OAAOJ,QAAQ,MAAME,MAAMU,QAAQT,MAAM,EAAA,GAAK;IAACD;IAAOC;GAAG;AAC/D,SAAOL,aAAaM,IAAAA;AACtB;AASO,IAAMS,WAAW,CAACX,OAA4BC,OAAAA;AACnD,QAAMC,OAAOJ,QAAQ,MAAME,MAAMY,MAAMX,MAAM,EAAA,GAAK;IAACD;IAAOC;GAAG;AAC7D,SAAOL,aAAaM,IAAAA;AACtB;;;ACjDA,SAASW,YAAY;AAEd,IAAMC,QAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaJ;;;;AAIf;",
6
+ "names": ["Effect", "Function", "Capability", "Operation", "runAndForwardErrors", "runAction", "invoker", "capabilityManager", "action", "params", "data", "pipe", "provideService", "Service", "_actionContext", "provide", "identity", "ActivationEvents", "Capability", "Plugin", "AppActivationEvents", "meta", "Graph", "lazy", "GraphPlugin", "define", "pipe", "addModule", "activatesOn", "Startup", "firesBeforeActivation", "SetupAppGraph", "SetupMetadata", "firesAfterActivation", "AppGraphReady", "activate", "make", "useCallback", "useOperationInvoker", "usePluginManager", "useActionRunner", "invoker", "useOperationInvoker", "pluginManager", "usePluginManager", "useCallback", "action", "params", "runAction", "capabilities", "useAtomValue", "Option", "useMemo", "useNode", "graph", "id", "atom", "node", "getOrElse", "undefined", "useConnections", "relation", "connections", "useActions", "actions", "useEdges", "edges", "trim", "meta", "id", "name", "description"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"src/meta.ts":{"bytes":901,"imports":[],"format":"esm"},"src/graph.ts":{"bytes":6304,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true}],"format":"esm"},"src/GraphPlugin.ts":{"bytes":2737,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/graph.ts","kind":"dynamic-import","original":"./graph"}],"format":"esm"},"src/hooks/useNode.ts":{"bytes":3124,"imports":[{"path":"@effect-rx/rx-react","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"src/hooks/index.ts":{"bytes":461,"imports":[{"path":"src/hooks/useNode.ts","kind":"import-statement","original":"./useNode"}],"format":"esm"},"src/index.ts":{"bytes":733,"imports":[{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"src/GraphPlugin.ts","kind":"import-statement","original":"./GraphPlugin"},{"path":"src/hooks/index.ts","kind":"import-statement","original":"./hooks"},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3456},"dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"dist/lib/browser/graph-WYYTSA5Q.mjs","kind":"dynamic-import"},{"path":"@effect-rx/rx-react","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true}],"exports":["GRAPH_PLUGIN","GraphPlugin","meta","useActions","useConnections","useNode"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":33},"src/GraphPlugin.ts":{"bytesInOutput":417},"src/meta.ts":{"bytesInOutput":96},"src/hooks/useNode.ts":{"bytesInOutput":386},"src/hooks/index.ts":{"bytesInOutput":0}},"bytes":1163},"dist/lib/browser/graph-WYYTSA5Q.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3329},"dist/lib/browser/graph-WYYTSA5Q.mjs":{"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/graph.ts","inputs":{"src/graph.ts":{"bytesInOutput":1200}},"bytes":1299}}}
1
+ {"inputs":{"src/action.ts":{"bytes":3632,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Function","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"@dxos/effect","kind":"import-statement","external":true}],"format":"esm"},"src/graph.ts":{"bytes":8304,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Record","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true}],"format":"esm"},"src/GraphPlugin.ts":{"bytes":3009,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true},{"path":"src/graph.ts","kind":"dynamic-import","original":"./graph"}],"format":"esm"},"src/hooks/useActionRunner.ts":{"bytes":2430,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework/ui","kind":"import-statement","external":true},{"path":"src/action.ts","kind":"import-statement","original":"../action"}],"format":"esm"},"src/hooks/useNode.ts":{"bytes":5318,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/hooks/index.ts":{"bytes":482,"imports":[{"path":"src/hooks/useActionRunner.ts","kind":"import-statement","original":"./useActionRunner"},{"path":"src/hooks/useNode.ts","kind":"import-statement","original":"./useNode"}],"format":"esm"},"src/meta.ts":{"bytes":1286,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":735,"imports":[{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"src/action.ts","kind":"import-statement","original":"./action"},{"path":"src/GraphPlugin.ts","kind":"import-statement","original":"./GraphPlugin"},{"path":"src/hooks/index.ts","kind":"import-statement","original":"./hooks"},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":8026},"dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Function","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"@dxos/effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true},{"path":"dist/lib/browser/graph-RCKCHDM6.mjs","kind":"dynamic-import"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework/ui","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["GraphPlugin","meta","runAction","useActionRunner","useActions","useConnections","useEdges","useNode"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":33},"src/action.ts":{"bytesInOutput":549},"src/GraphPlugin.ts":{"bytesInOutput":572},"src/hooks/useActionRunner.ts":{"bytesInOutput":397},"src/hooks/index.ts":{"bytesInOutput":0},"src/hooks/useNode.ts":{"bytesInOutput":703},"src/meta.ts":{"bytesInOutput":284}},"bytes":2834},"dist/lib/browser/graph-RCKCHDM6.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4327},"dist/lib/browser/graph-RCKCHDM6.mjs":{"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Record","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/graph.ts","inputs":{"src/graph.ts":{"bytesInOutput":1712}},"bytes":1811}}}
@@ -0,0 +1,50 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+
3
+ // src/graph.ts
4
+ import * as Effect from "effect/Effect";
5
+ import * as Record from "effect/Record";
6
+ import { Capabilities, Capability } from "@dxos/app-framework";
7
+ import { Graph, GraphBuilder, Node } from "@dxos/app-graph";
8
+ import { AppCapabilities } from "@dxos/app-toolkit";
9
+ var graph_default = Capability.makeModule(Effect.fnUntraced(function* () {
10
+ const registry = yield* Capability.get(Capabilities.AtomRegistry);
11
+ const extensionsByModuleAtom = yield* Capability.atomByModule(AppCapabilities.AppGraphBuilder);
12
+ const builder = GraphBuilder.from(
13
+ /* localStorage.getItem(KEY) ?? */
14
+ void 0,
15
+ registry
16
+ );
17
+ const unsubscribe = registry.subscribe(extensionsByModuleAtom, (extensionsByModule) => {
18
+ const next = [];
19
+ for (const [moduleId, extensions] of Object.entries(extensionsByModule)) {
20
+ for (const ext of GraphBuilder.flattenExtensions(extensions)) {
21
+ next.push({
22
+ ...ext,
23
+ id: `${moduleId}.${ext.id}`
24
+ });
25
+ }
26
+ }
27
+ const current = Record.values(registry.get(builder.extensions));
28
+ const removed = current.filter(({ id }) => !next.some(({ id: nextId }) => nextId === id));
29
+ removed.forEach((extension) => GraphBuilder.removeExtension(builder, extension.id));
30
+ next.forEach((extension) => GraphBuilder.addExtension(builder, extension));
31
+ }, {
32
+ immediate: true
33
+ });
34
+ void Graph.expand(builder.graph, Node.RootId, "child");
35
+ setupDevtools(builder.graph);
36
+ return Capability.contributes(AppCapabilities.AppGraph, {
37
+ graph: builder.graph,
38
+ explore: GraphBuilder.explore
39
+ }, () => Effect.sync(() => {
40
+ unsubscribe();
41
+ }));
42
+ }));
43
+ var setupDevtools = (graph) => {
44
+ globalThis.composer ??= {};
45
+ globalThis.composer.graph = graph;
46
+ };
47
+ export {
48
+ graph_default as default
49
+ };
50
+ //# sourceMappingURL=graph-P7F6HXZB.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/graph.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Record from 'effect/Record';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { Graph, GraphBuilder, Node } from '@dxos/app-graph';\nimport { AppCapabilities } from '@dxos/app-toolkit';\n\n// TODO(wittjosiah): Remove or restore graph caching.\n// import { meta } from './meta';\n\n// const KEY = `${meta.id}.app-graph`;\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n const registry = yield* Capability.get(Capabilities.AtomRegistry);\n const extensionsByModuleAtom = yield* Capability.atomByModule(AppCapabilities.AppGraphBuilder);\n\n const builder = GraphBuilder.from(/* localStorage.getItem(KEY) ?? */ undefined, registry);\n // const interval = setInterval(() => {\n // localStorage.setItem(KEY, builder.graph.pickle());\n // }, 5_000);\n\n const unsubscribe = registry.subscribe(\n extensionsByModuleAtom,\n (extensionsByModule) => {\n const next: GraphBuilder.BuilderExtension[] = [];\n for (const [moduleId, extensions] of Object.entries(extensionsByModule)) {\n for (const ext of GraphBuilder.flattenExtensions(extensions)) {\n next.push({ ...ext, id: `${moduleId}.${ext.id}` });\n }\n }\n const current = Record.values(registry.get(builder.extensions));\n const removed = current.filter(({ id }) => !next.some(({ id: nextId }) => nextId === id));\n removed.forEach((extension) => GraphBuilder.removeExtension(builder, extension.id));\n next.forEach((extension) => GraphBuilder.addExtension(builder, extension));\n },\n { immediate: true },\n );\n\n // await builder.initialize();\n void Graph.expand(builder.graph, Node.RootId, 'child');\n\n setupDevtools(builder.graph);\n\n return Capability.contributes(\n AppCapabilities.AppGraph,\n { graph: builder.graph, explore: GraphBuilder.explore },\n () =>\n Effect.sync(() => {\n // clearInterval(interval);\n unsubscribe();\n }),\n );\n }),\n);\n\n// Expose the graph to the window for debugging.\nconst setupDevtools = (graph: Graph.ExpandableGraph) => {\n (globalThis as any).composer ??= {};\n (globalThis as any).composer.graph = graph;\n};\n"],
5
+ "mappings": ";;;AAIA,YAAYA,YAAY;AACxB,YAAYC,YAAY;AAExB,SAASC,cAAcC,kBAAkB;AACzC,SAASC,OAAOC,cAAcC,YAAY;AAC1C,SAASC,uBAAuB;AAOhC,IAAA,gBAAeJ,WAAWK,WACjBC,kBAAW,aAAA;AAChB,QAAMC,WAAW,OAAOP,WAAWQ,IAAIT,aAAaU,YAAY;AAChE,QAAMC,yBAAyB,OAAOV,WAAWW,aAAaP,gBAAgBQ,eAAe;AAE7F,QAAMC,UAAUX,aAAaY;;IAAwCC;IAAWR;EAAAA;AAKhF,QAAMS,cAAcT,SAASU,UAC3BP,wBACA,CAACQ,uBAAAA;AACC,UAAMC,OAAwC,CAAA;AAC9C,eAAW,CAACC,UAAUC,UAAAA,KAAeC,OAAOC,QAAQL,kBAAAA,GAAqB;AACvE,iBAAWM,OAAOtB,aAAauB,kBAAkBJ,UAAAA,GAAa;AAC5DF,aAAKO,KAAK;UAAE,GAAGF;UAAKG,IAAI,GAAGP,QAAAA,IAAYI,IAAIG,EAAE;QAAG,CAAA;MAClD;IACF;AACA,UAAMC,UAAiBC,cAAOtB,SAASC,IAAIK,QAAQQ,UAAU,CAAA;AAC7D,UAAMS,UAAUF,QAAQG,OAAO,CAAC,EAAEJ,GAAE,MAAO,CAACR,KAAKa,KAAK,CAAC,EAAEL,IAAIM,OAAM,MAAOA,WAAWN,EAAAA,CAAAA;AACrFG,YAAQI,QAAQ,CAACC,cAAcjC,aAAakC,gBAAgBvB,SAASsB,UAAUR,EAAE,CAAA;AACjFR,SAAKe,QAAQ,CAACC,cAAcjC,aAAamC,aAAaxB,SAASsB,SAAAA,CAAAA;EACjE,GACA;IAAEG,WAAW;EAAK,CAAA;AAIpB,OAAKrC,MAAMsC,OAAO1B,QAAQ2B,OAAOrC,KAAKsC,QAAQ,OAAA;AAE9CC,gBAAc7B,QAAQ2B,KAAK;AAE3B,SAAOxC,WAAW2C,YAChBvC,gBAAgBwC,UAChB;IAAEJ,OAAO3B,QAAQ2B;IAAOK,SAAS3C,aAAa2C;EAAQ,GACtD,MACSC,YAAK,MAAA;AAEV9B,gBAAAA;EACF,CAAA,CAAA;AAEN,CAAA,CAAA;AAIF,IAAM0B,gBAAgB,CAACF,UAAAA;AACpBO,aAAmBC,aAAa,CAAC;AACjCD,aAAmBC,SAASR,QAAQA;AACvC;",
6
+ "names": ["Effect", "Record", "Capabilities", "Capability", "Graph", "GraphBuilder", "Node", "AppCapabilities", "makeModule", "fnUntraced", "registry", "get", "AtomRegistry", "extensionsByModuleAtom", "atomByModule", "AppGraphBuilder", "builder", "from", "undefined", "unsubscribe", "subscribe", "extensionsByModule", "next", "moduleId", "extensions", "Object", "entries", "ext", "flattenExtensions", "push", "id", "current", "values", "removed", "filter", "some", "nextId", "forEach", "extension", "removeExtension", "addExtension", "immediate", "expand", "graph", "RootId", "setupDevtools", "contributes", "AppGraph", "explore", "sync", "globalThis", "composer"]
7
+ }
@@ -3,50 +3,90 @@ import { createRequire } from 'node:module';const require = createRequire(import
3
3
  // src/index.ts
4
4
  export * from "@dxos/app-graph";
5
5
 
6
+ // src/action.ts
7
+ import * as Effect from "effect/Effect";
8
+ import * as Function from "effect/Function";
9
+ import { Capability } from "@dxos/app-framework";
10
+ import { Operation } from "@dxos/compute";
11
+ import { runAndForwardErrors } from "@dxos/effect";
12
+ var runAction = async (invoker, capabilityManager, action, params = {}) => runAndForwardErrors(action.data(params).pipe(Effect.provideService(Operation.Service, invoker), Effect.provideService(Capability.Service, capabilityManager), action._actionContext ? Effect.provide(action._actionContext) : Function.identity));
13
+
6
14
  // src/GraphPlugin.ts
7
- import { Events, defineModule, definePlugin, lazy } from "@dxos/app-framework";
15
+ import { ActivationEvents, Capability as Capability2, Plugin } from "@dxos/app-framework";
16
+ import { AppActivationEvents } from "@dxos/app-toolkit";
17
+ import { meta } from "#meta";
18
+ var Graph = Capability2.lazy("Graph", () => import("./graph-P7F6HXZB.mjs"));
19
+ var GraphPlugin = Plugin.define(meta).pipe(Plugin.addModule({
20
+ activatesOn: ActivationEvents.Startup,
21
+ firesBeforeActivation: [
22
+ AppActivationEvents.SetupAppGraph,
23
+ AppActivationEvents.SetupMetadata
24
+ ],
25
+ firesAfterActivation: [
26
+ AppActivationEvents.AppGraphReady
27
+ ],
28
+ activate: Graph
29
+ }), Plugin.make);
8
30
 
9
- // src/meta.ts
10
- var GRAPH_PLUGIN = "dxos.org/plugin/graph";
11
- var meta = {
12
- id: GRAPH_PLUGIN,
13
- name: "Graph"
31
+ // src/hooks/useActionRunner.ts
32
+ import { useCallback } from "react";
33
+ import { useOperationInvoker, usePluginManager } from "@dxos/app-framework/ui";
34
+ var useActionRunner = () => {
35
+ const invoker = useOperationInvoker();
36
+ const pluginManager = usePluginManager();
37
+ return useCallback((action, params = {}) => runAction(invoker, pluginManager.capabilities, action, params), [
38
+ invoker,
39
+ pluginManager.capabilities
40
+ ]);
14
41
  };
15
42
 
16
- // src/GraphPlugin.ts
17
- var GraphPlugin = () => definePlugin(meta, [
18
- defineModule({
19
- id: `${meta.id}/module/graph`,
20
- activatesOn: Events.Startup,
21
- activatesBefore: [
22
- Events.SetupAppGraph,
23
- Events.SetupMetadata
24
- ],
25
- activatesAfter: [
26
- Events.AppGraphReady
27
- ],
28
- activate: lazy(() => import("./graph-UPSQNHOM.mjs"))
29
- })
30
- ]);
31
-
32
43
  // src/hooks/useNode.ts
33
- import { useRxValue } from "@effect-rx/rx-react";
34
- import { Option } from "effect";
44
+ import { useAtomValue } from "@effect-atom/atom-react";
45
+ import * as Option from "effect/Option";
46
+ import { useMemo } from "react";
35
47
  var useNode = (graph, id) => {
36
- return Option.getOrElse(useRxValue(graph.node(id ?? "")), () => void 0);
48
+ const atom = useMemo(() => graph.node(id ?? ""), [
49
+ graph,
50
+ id
51
+ ]);
52
+ return Option.getOrElse(useAtomValue(atom), () => void 0);
37
53
  };
38
54
  var useConnections = (graph, id, relation) => {
39
- return useRxValue(graph.connections(id ?? "", relation));
55
+ return useAtomValue(graph.connections(id ?? "", relation));
40
56
  };
41
57
  var useActions = (graph, id) => {
42
- return useRxValue(graph.actions(id ?? ""));
58
+ const atom = useMemo(() => graph.actions(id ?? ""), [
59
+ graph,
60
+ id
61
+ ]);
62
+ return useAtomValue(atom);
63
+ };
64
+ var useEdges = (graph, id) => {
65
+ const atom = useMemo(() => graph.edges(id ?? ""), [
66
+ graph,
67
+ id
68
+ ]);
69
+ return useAtomValue(atom);
70
+ };
71
+
72
+ // src/meta.ts
73
+ import { trim } from "@dxos/util";
74
+ var meta2 = {
75
+ id: "org.dxos.plugin.graph",
76
+ name: "Graph",
77
+ description: trim`
78
+ Graph database layer providing relationship modeling and queries for workspace objects.
79
+ Build knowledge graphs and explore complex data relationships.
80
+ `
43
81
  };
44
82
  export {
45
- GRAPH_PLUGIN,
46
83
  GraphPlugin,
47
- meta,
84
+ meta2 as meta,
85
+ runAction,
86
+ useActionRunner,
48
87
  useActions,
49
88
  useConnections,
89
+ useEdges,
50
90
  useNode
51
91
  };
52
92
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/index.ts", "../../../src/GraphPlugin.ts", "../../../src/meta.ts", "../../../src/hooks/useNode.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport * from '@dxos/app-graph';\n\nexport * from './GraphPlugin';\nexport * from './hooks';\nexport * from './meta';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Events, defineModule, definePlugin, lazy } from '@dxos/app-framework';\n\nimport { meta } from './meta';\n\n/**\n * Manages the state of the graph for the application.\n * Enables other plugins to register node builders to add nodes to the graph.\n * This includes actions and annotation each other's nodes.\n */\nexport const GraphPlugin = () =>\n definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/graph`,\n activatesOn: Events.Startup,\n activatesBefore: [Events.SetupAppGraph, Events.SetupMetadata],\n activatesAfter: [Events.AppGraphReady],\n activate: lazy(() => import('./graph')),\n }),\n ]);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const GRAPH_PLUGIN = 'dxos.org/plugin/graph';\n\nexport const meta: PluginMeta = {\n id: GRAPH_PLUGIN,\n name: 'Graph',\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { useRxValue } from '@effect-rx/rx-react';\nimport { Option } from 'effect';\n\nimport { type Node, type ReadableGraph, type Relation } from '@dxos/app-graph';\n\n/**\n * React hook to get a node from the graph.\n *\n * @param graph Graph to find the node in.\n * @param id Id of the node to find.\n * @param timeout Optional timeout in milliseconds to wait for the node to be found.\n * @returns Node if found, undefined otherwise.\n */\n// TODO(wittjosiah): Factor out to @dxos/app-graph/react.\nexport const useNode = <T = any>(graph: ReadableGraph, id?: string): Node<T> | undefined => {\n return Option.getOrElse(useRxValue(graph.node(id ?? '')), () => undefined);\n};\n\nexport const useConnections = (graph: ReadableGraph, id?: string, relation?: Relation): Node[] => {\n return useRxValue(graph.connections(id ?? '', relation));\n};\n\nexport const useActions = (graph: ReadableGraph, id?: string): Node[] => {\n return useRxValue(graph.actions(id ?? ''));\n};\n"],
5
- "mappings": ";;;AAIA,cAAc;;;ACAd,SAASA,QAAQC,cAAcC,cAAcC,YAAY;;;ACElD,IAAMC,eAAe;AAErB,IAAMC,OAAmB;EAC9BC,IAAIF;EACJG,MAAM;AACR;;;ADEO,IAAMC,cAAc,MACzBC,aAAaC,MAAM;EACjBC,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOC;IACpBC,iBAAiB;MAACF,OAAOG;MAAeH,OAAOI;;IAC/CC,gBAAgB;MAACL,OAAOM;;IACxBC,UAAUC,KAAK,MAAM,OAAO,sBAAA,CAAA;EAC9B,CAAA;CACD;;;AElBH,SAASC,kBAAkB;AAC3B,SAASC,cAAc;AAahB,IAAMC,UAAU,CAAUC,OAAsBC,OAAAA;AACrD,SAAOC,OAAOC,UAAUC,WAAWJ,MAAMK,KAAKJ,MAAM,EAAA,CAAA,GAAM,MAAMK,MAAAA;AAClE;AAEO,IAAMC,iBAAiB,CAACP,OAAsBC,IAAaO,aAAAA;AAChE,SAAOJ,WAAWJ,MAAMS,YAAYR,MAAM,IAAIO,QAAAA,CAAAA;AAChD;AAEO,IAAME,aAAa,CAACV,OAAsBC,OAAAA;AAC/C,SAAOG,WAAWJ,MAAMW,QAAQV,MAAM,EAAA,CAAA;AACxC;",
6
- "names": ["Events", "defineModule", "definePlugin", "lazy", "GRAPH_PLUGIN", "meta", "id", "name", "GraphPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "Startup", "activatesBefore", "SetupAppGraph", "SetupMetadata", "activatesAfter", "AppGraphReady", "activate", "lazy", "useRxValue", "Option", "useNode", "graph", "id", "Option", "getOrElse", "useRxValue", "node", "undefined", "useConnections", "relation", "connections", "useActions", "actions"]
3
+ "sources": ["../../../src/index.ts", "../../../src/action.ts", "../../../src/GraphPlugin.ts", "../../../src/hooks/useActionRunner.ts", "../../../src/hooks/useNode.ts", "../../../src/meta.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport * from '@dxos/app-graph';\n\nexport * from './action';\nexport * from './GraphPlugin';\nexport * from './hooks';\nexport * from './meta';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Function from 'effect/Function';\n\nimport { Capability, type CapabilityManager } from '@dxos/app-framework';\nimport { type Node } from '@dxos/app-graph';\nimport { Operation, type OperationInvoker } from '@dxos/compute';\nimport { runAndForwardErrors } from '@dxos/effect';\n\n/**\n * Run an action with required layers: Operation.Service, Capability.Service, and captured context.\n * @param invoker The operation invoker to use for Operation.Service.\n * @param capabilityManager The capability manager for Capability.Service.\n * @param action The action to execute.\n * @param params Parameters to pass to the action.\n */\nexport const runAction = async (\n invoker: OperationInvoker.OperationInvoker,\n capabilityManager: CapabilityManager.CapabilityManager,\n action: Node.Action,\n params: Node.InvokeProps = {},\n): Promise<void> =>\n runAndForwardErrors(\n action\n .data(params)\n .pipe(\n Effect.provideService(Operation.Service, invoker),\n Effect.provideService(Capability.Service, capabilityManager),\n action._actionContext ? Effect.provide(action._actionContext) : Function.identity,\n ),\n );\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { ActivationEvents, Capability, Plugin } from '@dxos/app-framework';\nimport { AppActivationEvents } from '@dxos/app-toolkit';\n\nimport { meta } from '#meta';\n\nconst Graph = Capability.lazy('Graph', () => import('./graph'));\n\n/**\n * Manages the state of the graph for the application.\n * Enables other plugins to register node builders to add nodes to the graph.\n * This includes actions and annotation each other's nodes.\n */\nexport const GraphPlugin = Plugin.define(meta).pipe(\n Plugin.addModule({\n activatesOn: ActivationEvents.Startup,\n firesBeforeActivation: [AppActivationEvents.SetupAppGraph, AppActivationEvents.SetupMetadata],\n firesAfterActivation: [AppActivationEvents.AppGraphReady],\n activate: Graph,\n }),\n Plugin.make,\n);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCallback } from 'react';\n\nimport { useOperationInvoker, usePluginManager } from '@dxos/app-framework/ui';\nimport { type Node } from '@dxos/app-graph';\n\nimport { runAction } from '../action';\n\n/**\n * Hook that returns a function to run action Effects.\n * Provides Operation.Service, PluginContextService, and captured plugin context.\n */\nexport const useActionRunner = () => {\n const invoker = useOperationInvoker();\n const pluginManager = usePluginManager();\n\n return useCallback(\n (action: Node.Action, params: Node.InvokeProps = {}) =>\n runAction(invoker, pluginManager.capabilities, action, params),\n [invoker, pluginManager.capabilities],\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { useAtomValue } from '@effect-atom/atom-react';\nimport * as Option from 'effect/Option';\nimport { useMemo } from 'react';\n\nimport { type Graph, type Node } from '@dxos/app-graph';\n\n/**\n * React hook to get a node from the graph.\n *\n * @param graph Graph to find the node in.\n * @param id Id of the node to find.\n * @param timeout Optional timeout in milliseconds to wait for the node to be found.\n * @returns Node if found, undefined otherwise.\n */\n// TODO(wittjosiah): Factor out to @dxos/app-graph/react.\nexport const useNode = <T = any>(graph: Graph.ReadableGraph, id?: string): Node.Node<T> | undefined => {\n const atom = useMemo(() => graph.node(id ?? ''), [graph, id]);\n return Option.getOrElse(useAtomValue(atom), () => undefined);\n};\n\nexport const useConnections = (\n graph: Graph.ReadableGraph,\n id: string | undefined,\n relation: Node.RelationInput,\n): Node.Node[] => {\n return useAtomValue(graph.connections(id ?? '', relation));\n};\n\n/**\n * React hook to get actions available for a node.\n *\n * @param graph Graph containing the node.\n * @param id Id of the node.\n * @returns Actions available for the node.\n */\nexport const useActions = (graph: Graph.ReadableGraph, id?: string): Node.Node[] => {\n const atom = useMemo(() => graph.actions(id ?? ''), [graph, id]);\n return useAtomValue(atom);\n};\n\n/**\n * Subscribe to just the edge topology (inbound/outbound IDs) of a node without subscribing to node content.\n *\n * @param graph Graph containing the node.\n * @param id Id of the node.\n * @returns Edge topology for the node.\n */\nexport const useEdges = (graph: Graph.ReadableGraph, id?: string): Graph.Edges => {\n const atom = useMemo(() => graph.edges(id ?? ''), [graph, id]);\n return useAtomValue(atom);\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'org.dxos.plugin.graph',\n name: 'Graph',\n description: trim`\n Graph database layer providing relationship modeling and queries for workspace objects.\n Build knowledge graphs and explore complex data relationships.\n `,\n};\n"],
5
+ "mappings": ";;;AAIA,cAAc;;;ACAd,YAAYA,YAAY;AACxB,YAAYC,cAAc;AAE1B,SAASC,kBAA0C;AAEnD,SAASC,iBAAwC;AACjD,SAASC,2BAA2B;AAS7B,IAAMC,YAAY,OACvBC,SACAC,mBACAC,QACAC,SAA2B,CAAC,MAE5BL,oBACEI,OACGE,KAAKD,MAAAA,EACLE,KACQC,sBAAeT,UAAUU,SAASP,OAAAA,GAClCM,sBAAeV,WAAWW,SAASN,iBAAAA,GAC1CC,OAAOM,iBAAwBC,eAAQP,OAAOM,cAAc,IAAaE,iBAAQ,CAAA;;;AC3BzF,SAASC,kBAAkBC,cAAAA,aAAYC,cAAc;AACrD,SAASC,2BAA2B;AAEpC,SAASC,YAAY;AAErB,IAAMC,QAAQJ,YAAWK,KAAK,SAAS,MAAM,OAAO,sBAAA,CAAA;AAO7C,IAAMC,cAAcL,OAAOM,OAAOJ,IAAAA,EAAMK,KAC7CP,OAAOQ,UAAU;EACfC,aAAaX,iBAAiBY;EAC9BC,uBAAuB;IAACV,oBAAoBW;IAAeX,oBAAoBY;;EAC/EC,sBAAsB;IAACb,oBAAoBc;;EAC3CC,UAAUb;AACZ,CAAA,GACAH,OAAOiB,IAAI;;;ACnBb,SAASC,mBAAmB;AAE5B,SAASC,qBAAqBC,wBAAwB;AAS/C,IAAMC,kBAAkB,MAAA;AAC7B,QAAMC,UAAUC,oBAAAA;AAChB,QAAMC,gBAAgBC,iBAAAA;AAEtB,SAAOC,YACL,CAACC,QAAqBC,SAA2B,CAAC,MAChDC,UAAUP,SAASE,cAAcM,cAAcH,QAAQC,MAAAA,GACzD;IAACN;IAASE,cAAcM;GAAa;AAEzC;;;ACpBA,SAASC,oBAAoB;AAC7B,YAAYC,YAAY;AACxB,SAASC,eAAe;AAajB,IAAMC,UAAU,CAAUC,OAA4BC,OAAAA;AAC3D,QAAMC,OAAOJ,QAAQ,MAAME,MAAMG,KAAKF,MAAM,EAAA,GAAK;IAACD;IAAOC;GAAG;AAC5D,SAAcG,iBAAUR,aAAaM,IAAAA,GAAO,MAAMG,MAAAA;AACpD;AAEO,IAAMC,iBAAiB,CAC5BN,OACAC,IACAM,aAAAA;AAEA,SAAOX,aAAaI,MAAMQ,YAAYP,MAAM,IAAIM,QAAAA,CAAAA;AAClD;AASO,IAAME,aAAa,CAACT,OAA4BC,OAAAA;AACrD,QAAMC,OAAOJ,QAAQ,MAAME,MAAMU,QAAQT,MAAM,EAAA,GAAK;IAACD;IAAOC;GAAG;AAC/D,SAAOL,aAAaM,IAAAA;AACtB;AASO,IAAMS,WAAW,CAACX,OAA4BC,OAAAA;AACnD,QAAMC,OAAOJ,QAAQ,MAAME,MAAMY,MAAMX,MAAM,EAAA,GAAK;IAACD;IAAOC;GAAG;AAC7D,SAAOL,aAAaM,IAAAA;AACtB;;;ACjDA,SAASW,YAAY;AAEd,IAAMC,QAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaJ;;;;AAIf;",
6
+ "names": ["Effect", "Function", "Capability", "Operation", "runAndForwardErrors", "runAction", "invoker", "capabilityManager", "action", "params", "data", "pipe", "provideService", "Service", "_actionContext", "provide", "identity", "ActivationEvents", "Capability", "Plugin", "AppActivationEvents", "meta", "Graph", "lazy", "GraphPlugin", "define", "pipe", "addModule", "activatesOn", "Startup", "firesBeforeActivation", "SetupAppGraph", "SetupMetadata", "firesAfterActivation", "AppGraphReady", "activate", "make", "useCallback", "useOperationInvoker", "usePluginManager", "useActionRunner", "invoker", "useOperationInvoker", "pluginManager", "usePluginManager", "useCallback", "action", "params", "runAction", "capabilities", "useAtomValue", "Option", "useMemo", "useNode", "graph", "id", "atom", "node", "getOrElse", "undefined", "useConnections", "relation", "connections", "useActions", "actions", "useEdges", "edges", "trim", "meta", "id", "name", "description"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"src/meta.ts":{"bytes":901,"imports":[],"format":"esm"},"src/graph.ts":{"bytes":6304,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true}],"format":"esm"},"src/GraphPlugin.ts":{"bytes":2737,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/graph.ts","kind":"dynamic-import","original":"./graph"}],"format":"esm"},"src/hooks/useNode.ts":{"bytes":3124,"imports":[{"path":"@effect-rx/rx-react","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"src/hooks/index.ts":{"bytes":461,"imports":[{"path":"src/hooks/useNode.ts","kind":"import-statement","original":"./useNode"}],"format":"esm"},"src/index.ts":{"bytes":733,"imports":[{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"src/GraphPlugin.ts","kind":"import-statement","original":"./GraphPlugin"},{"path":"src/hooks/index.ts","kind":"import-statement","original":"./hooks"},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3458},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"dist/lib/node-esm/graph-UPSQNHOM.mjs","kind":"dynamic-import"},{"path":"@effect-rx/rx-react","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true}],"exports":["GRAPH_PLUGIN","GraphPlugin","meta","useActions","useConnections","useNode"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":33},"src/GraphPlugin.ts":{"bytesInOutput":417},"src/meta.ts":{"bytesInOutput":96},"src/hooks/useNode.ts":{"bytesInOutput":386},"src/hooks/index.ts":{"bytesInOutput":0}},"bytes":1256},"dist/lib/node-esm/graph-UPSQNHOM.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3331},"dist/lib/node-esm/graph-UPSQNHOM.mjs":{"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/graph.ts","inputs":{"src/graph.ts":{"bytesInOutput":1200}},"bytes":1392}}}
1
+ {"inputs":{"src/action.ts":{"bytes":3632,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Function","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"@dxos/effect","kind":"import-statement","external":true}],"format":"esm"},"src/graph.ts":{"bytes":8304,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Record","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true}],"format":"esm"},"src/GraphPlugin.ts":{"bytes":3009,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true},{"path":"src/graph.ts","kind":"dynamic-import","original":"./graph"}],"format":"esm"},"src/hooks/useActionRunner.ts":{"bytes":2430,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework/ui","kind":"import-statement","external":true},{"path":"src/action.ts","kind":"import-statement","original":"../action"}],"format":"esm"},"src/hooks/useNode.ts":{"bytes":5318,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/hooks/index.ts":{"bytes":482,"imports":[{"path":"src/hooks/useActionRunner.ts","kind":"import-statement","original":"./useActionRunner"},{"path":"src/hooks/useNode.ts","kind":"import-statement","original":"./useNode"}],"format":"esm"},"src/meta.ts":{"bytes":1286,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":735,"imports":[{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"src/action.ts","kind":"import-statement","original":"./action"},{"path":"src/GraphPlugin.ts","kind":"import-statement","original":"./GraphPlugin"},{"path":"src/hooks/index.ts","kind":"import-statement","original":"./hooks"},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":8028},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Function","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"@dxos/effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true},{"path":"dist/lib/node-esm/graph-P7F6HXZB.mjs","kind":"dynamic-import"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework/ui","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["GraphPlugin","meta","runAction","useActionRunner","useActions","useConnections","useEdges","useNode"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":33},"src/action.ts":{"bytesInOutput":549},"src/GraphPlugin.ts":{"bytesInOutput":572},"src/hooks/useActionRunner.ts":{"bytesInOutput":397},"src/hooks/index.ts":{"bytesInOutput":0},"src/hooks/useNode.ts":{"bytesInOutput":703},"src/meta.ts":{"bytesInOutput":284}},"bytes":2927},"dist/lib/node-esm/graph-P7F6HXZB.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4329},"dist/lib/node-esm/graph-P7F6HXZB.mjs":{"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Record","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/graph.ts","inputs":{"src/graph.ts":{"bytesInOutput":1712}},"bytes":1904}}}
@@ -1,7 +1,8 @@
1
+ import { Plugin } from '@dxos/app-framework';
1
2
  /**
2
3
  * Manages the state of the graph for the application.
3
4
  * Enables other plugins to register node builders to add nodes to the graph.
4
5
  * This includes actions and annotation each other's nodes.
5
6
  */
6
- export declare const GraphPlugin: () => import("@dxos/app-framework").Plugin;
7
+ export declare const GraphPlugin: Plugin.PluginFactory<void>;
7
8
  //# sourceMappingURL=GraphPlugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GraphPlugin.d.ts","sourceRoot":"","sources":["../../../src/GraphPlugin.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,eAAO,MAAM,WAAW,4CASpB,CAAC"}
1
+ {"version":3,"file":"GraphPlugin.d.ts","sourceRoot":"","sources":["../../../src/GraphPlugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgC,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAO3E;;;;GAIG;AACH,eAAO,MAAM,WAAW,4BAQvB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { type CapabilityManager } from '@dxos/app-framework';
2
+ import { type Node } from '@dxos/app-graph';
3
+ import { type OperationInvoker } from '@dxos/compute';
4
+ /**
5
+ * Run an action with required layers: Operation.Service, Capability.Service, and captured context.
6
+ * @param invoker The operation invoker to use for Operation.Service.
7
+ * @param capabilityManager The capability manager for Capability.Service.
8
+ * @param action The action to execute.
9
+ * @param params Parameters to pass to the action.
10
+ */
11
+ export declare const runAction: (invoker: OperationInvoker.OperationInvoker, capabilityManager: CapabilityManager.CapabilityManager, action: Node.Action, params?: Node.InvokeProps) => Promise<void>;
12
+ //# sourceMappingURL=action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/action.ts"],"names":[],"mappings":"AAOA,OAAO,EAAc,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGjE;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,YACX,gBAAgB,CAAC,gBAAgB,qBACvB,iBAAiB,CAAC,iBAAiB,UAC9C,IAAI,CAAC,MAAM,WACX,IAAI,CAAC,WAAW,KACvB,OAAO,CAAC,IAAI,CASZ,CAAC"}
@@ -1,5 +1,9 @@
1
- import { type PluginContext } from '@dxos/app-framework';
2
- import { GraphBuilder } from '@dxos/app-graph';
3
- declare const _default: (context: PluginContext) => Promise<import("@dxos/app-framework").Capability<Readonly<Pick<GraphBuilder, "graph" | "explore">>>>;
1
+ import * as Effect from 'effect/Effect';
2
+ import { Capability } from '@dxos/app-framework';
3
+ import { Graph, GraphBuilder } from '@dxos/app-graph';
4
+ declare const _default: (props: void) => Effect.Effect<Capability.Capability<Capability.InterfaceDef<Readonly<{
5
+ graph: Graph.ExpandableGraph;
6
+ explore: typeof GraphBuilder.explore;
7
+ }>>>, Error, Capability.Service>;
4
8
  export default _default;
5
9
  //# sourceMappingURL=graph.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../src/graph.ts"],"names":[],"mappings":"AAMA,OAAO,EAAgB,KAAK,aAAa,EAAe,MAAM,qBAAqB,CAAC;AACpF,OAAO,EAAwB,YAAY,EAA8B,MAAM,iBAAiB,CAAC;yBAO3E,SAAS,aAAa;AAA5C,wBA4BE"}
1
+ {"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../src/graph.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAgB,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,YAAY,EAAQ,MAAM,iBAAiB,CAAC"}
@@ -1,2 +1,3 @@
1
+ export * from './useActionRunner';
1
2
  export * from './useNode';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAIA,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type Node } from '@dxos/app-graph';
2
+ /**
3
+ * Hook that returns a function to run action Effects.
4
+ * Provides Operation.Service, PluginContextService, and captured plugin context.
5
+ */
6
+ export declare const useActionRunner: () => (action: Node.Action, params?: Node.InvokeProps) => Promise<void>;
7
+ //# sourceMappingURL=useActionRunner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useActionRunner.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useActionRunner.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAI5C;;;GAGG;AACH,eAAO,MAAM,eAAe,iBAKf,IAAI,CAAC,MAAM,WAAU,IAAI,CAAC,WAAW,kBAIjD,CAAC"}