@dxos/plugin-graph 0.8.4-main.c85a9c8dae → 0.8.4-main.cb12b3f963

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 (47) hide show
  1. package/dist/lib/browser/GraphPlugin-6JDSI47S.mjs +9 -0
  2. package/dist/lib/browser/GraphPlugin-6JDSI47S.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-S2DLYPRU.mjs +22 -0
  4. package/dist/lib/browser/chunk-S2DLYPRU.mjs.map +7 -0
  5. package/dist/lib/browser/{graph-KGMD75RR.mjs → graph-RCKCHDM6.mjs} +12 -4
  6. package/dist/lib/browser/graph-RCKCHDM6.mjs.map +7 -0
  7. package/dist/lib/browser/index.mjs +31 -30
  8. package/dist/lib/browser/index.mjs.map +4 -4
  9. package/dist/lib/browser/meta.json +1 -1
  10. package/dist/lib/browser/plugin.mjs +7 -0
  11. package/dist/lib/browser/plugin.mjs.map +7 -0
  12. package/dist/lib/node-esm/GraphPlugin-76Z465LW.mjs +10 -0
  13. package/dist/lib/node-esm/GraphPlugin-76Z465LW.mjs.map +7 -0
  14. package/dist/lib/node-esm/chunk-L7LOKNKX.mjs +24 -0
  15. package/dist/lib/node-esm/chunk-L7LOKNKX.mjs.map +7 -0
  16. package/dist/lib/node-esm/{graph-AKMWV2C7.mjs → graph-P7F6HXZB.mjs} +12 -4
  17. package/dist/lib/node-esm/graph-P7F6HXZB.mjs.map +7 -0
  18. package/dist/lib/node-esm/index.mjs +31 -30
  19. package/dist/lib/node-esm/index.mjs.map +4 -4
  20. package/dist/lib/node-esm/meta.json +1 -1
  21. package/dist/lib/node-esm/plugin.mjs +8 -0
  22. package/dist/lib/node-esm/plugin.mjs.map +7 -0
  23. package/dist/types/src/GraphPlugin.d.ts +1 -0
  24. package/dist/types/src/GraphPlugin.d.ts.map +1 -1
  25. package/dist/types/src/GraphPlugin.test.d.ts +2 -0
  26. package/dist/types/src/GraphPlugin.test.d.ts.map +1 -0
  27. package/dist/types/src/action.d.ts +1 -1
  28. package/dist/types/src/action.d.ts.map +1 -1
  29. package/dist/types/src/graph.d.ts.map +1 -1
  30. package/dist/types/src/hooks/useNode.d.ts +14 -1
  31. package/dist/types/src/hooks/useNode.d.ts.map +1 -1
  32. package/dist/types/src/index.d.ts +3 -2
  33. package/dist/types/src/index.d.ts.map +1 -1
  34. package/dist/types/src/plugin.d.ts +2 -0
  35. package/dist/types/src/plugin.d.ts.map +1 -0
  36. package/dist/types/tsconfig.tsbuildinfo +1 -1
  37. package/package.json +26 -17
  38. package/src/GraphPlugin.test.ts +26 -0
  39. package/src/GraphPlugin.ts +5 -3
  40. package/src/action.ts +2 -1
  41. package/src/graph.ts +10 -5
  42. package/src/hooks/useNode.ts +21 -4
  43. package/src/index.ts +10 -2
  44. package/src/meta.ts +1 -1
  45. package/src/plugin.ts +7 -0
  46. package/dist/lib/browser/graph-KGMD75RR.mjs.map +0 -7
  47. package/dist/lib/node-esm/graph-AKMWV2C7.mjs.map +0 -7
@@ -0,0 +1,9 @@
1
+ import {
2
+ GraphPlugin,
3
+ GraphPlugin_default
4
+ } from "./chunk-S2DLYPRU.mjs";
5
+ export {
6
+ GraphPlugin,
7
+ GraphPlugin_default as default
8
+ };
9
+ //# sourceMappingURL=GraphPlugin-6JDSI47S.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,22 @@
1
+ // src/GraphPlugin.ts
2
+ import { ActivationEvents, Capability, Plugin } from "@dxos/app-framework";
3
+ import { AppActivationEvents } from "@dxos/app-toolkit";
4
+ import { meta } from "#meta";
5
+ var Graph = Capability.lazy("Graph", () => import("./graph-RCKCHDM6.mjs"));
6
+ var GraphPlugin = Plugin.define(meta).pipe(Plugin.addModule({
7
+ activatesOn: ActivationEvents.Startup,
8
+ firesBeforeActivation: [
9
+ AppActivationEvents.SetupAppGraph
10
+ ],
11
+ firesAfterActivation: [
12
+ AppActivationEvents.AppGraphReady
13
+ ],
14
+ activate: Graph
15
+ }), Plugin.make);
16
+ var GraphPlugin_default = GraphPlugin;
17
+
18
+ export {
19
+ GraphPlugin,
20
+ GraphPlugin_default
21
+ };
22
+ //# sourceMappingURL=chunk-S2DLYPRU.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/GraphPlugin.ts"],
4
+ "sourcesContent": ["//\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],\n firesAfterActivation: [AppActivationEvents.AppGraphReady],\n activate: Graph,\n }),\n Plugin.make,\n);\n\nexport default GraphPlugin;\n"],
5
+ "mappings": ";AAIA,SAASA,kBAAkBC,YAAYC,cAAc;AACrD,SAASC,2BAA2B;AAEpC,SAASC,YAAY;AAErB,IAAMC,QAAQJ,WAAWK,KAAK,SAAS,MAAM,OAAO,sBAAA,CAAA;AAO7C,IAAMC,cAAcL,OAAOM,OAAOJ,IAAAA,EAAMK,KAC7CP,OAAOQ,UAAU;EACfC,aAAaX,iBAAiBY;EAC9BC,uBAAuB;IAACV,oBAAoBW;;EAC5CC,sBAAsB;IAACZ,oBAAoBa;;EAC3CC,UAAUZ;AACZ,CAAA,GACAH,OAAOgB,IAAI;AAGb,IAAA,sBAAeX;",
6
+ "names": ["ActivationEvents", "Capability", "Plugin", "AppActivationEvents", "meta", "Graph", "lazy", "GraphPlugin", "define", "pipe", "addModule", "activatesOn", "Startup", "firesBeforeActivation", "SetupAppGraph", "firesAfterActivation", "AppGraphReady", "activate", "make"]
7
+ }
@@ -6,14 +6,22 @@ import { Graph, GraphBuilder, Node } from "@dxos/app-graph";
6
6
  import { AppCapabilities } from "@dxos/app-toolkit";
7
7
  var graph_default = Capability.makeModule(Effect.fnUntraced(function* () {
8
8
  const registry = yield* Capability.get(Capabilities.AtomRegistry);
9
- const extensionsAtom = yield* Capability.atom(AppCapabilities.AppGraphBuilder);
9
+ const extensionsByModuleAtom = yield* Capability.atomByModule(AppCapabilities.AppGraphBuilder);
10
10
  const builder = GraphBuilder.from(
11
11
  /* localStorage.getItem(KEY) ?? */
12
12
  void 0,
13
13
  registry
14
14
  );
15
- const unsubscribe = registry.subscribe(extensionsAtom, (extensions) => {
16
- const next = GraphBuilder.flattenExtensions(extensions);
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
+ }
17
25
  const current = Record.values(registry.get(builder.extensions));
18
26
  const removed = current.filter(({ id }) => !next.some(({ id: nextId }) => nextId === id));
19
27
  removed.forEach((extension) => GraphBuilder.removeExtension(builder, extension.id));
@@ -37,4 +45,4 @@ var setupDevtools = (graph) => {
37
45
  export {
38
46
  graph_default as default
39
47
  };
40
- //# sourceMappingURL=graph-KGMD75RR.mjs.map
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,22 +1,10 @@
1
1
  // src/index.ts
2
- export * from "@dxos/app-graph";
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 { runAndForwardErrors } from "@dxos/effect";
9
- import { Operation } from "@dxos/operation";
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
-
12
- // src/GraphPlugin.ts
13
- import { ActivationEvents, Capability as Capability2, Plugin } from "@dxos/app-framework";
14
- import { AppActivationEvents } from "@dxos/app-toolkit";
2
+ import { Plugin } from "@dxos/app-framework";
15
3
 
16
4
  // src/meta.ts
17
5
  import { trim } from "@dxos/util";
18
6
  var meta = {
19
- id: "dxos.org/plugin/graph",
7
+ id: "org.dxos.plugin.graph",
20
8
  name: "Graph",
21
9
  description: trim`
22
10
  Graph database layer providing relationship modeling and queries for workspace objects.
@@ -24,19 +12,16 @@ var meta = {
24
12
  `
25
13
  };
26
14
 
27
- // src/GraphPlugin.ts
28
- var Graph = Capability2.lazy("Graph", () => import("./graph-KGMD75RR.mjs"));
29
- var GraphPlugin = Plugin.define(meta).pipe(Plugin.addModule({
30
- activatesOn: ActivationEvents.Startup,
31
- activatesBefore: [
32
- AppActivationEvents.SetupAppGraph,
33
- AppActivationEvents.SetupMetadata
34
- ],
35
- activatesAfter: [
36
- AppActivationEvents.AppGraphReady
37
- ],
38
- activate: Graph
39
- }), Plugin.make);
15
+ // src/index.ts
16
+ export * from "@dxos/app-graph";
17
+
18
+ // src/action.ts
19
+ import * as Effect from "effect/Effect";
20
+ import * as Function from "effect/Function";
21
+ import { Capability } from "@dxos/app-framework";
22
+ import { Operation } from "@dxos/compute";
23
+ import { runAndForwardErrors } from "@dxos/effect";
24
+ 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));
40
25
 
41
26
  // src/hooks/useActionRunner.ts
42
27
  import { useCallback } from "react";
@@ -53,18 +38,34 @@ var useActionRunner = () => {
53
38
  // src/hooks/useNode.ts
54
39
  import { useAtomValue } from "@effect-atom/atom-react";
55
40
  import * as Option from "effect/Option";
41
+ import { useMemo } from "react";
56
42
  var useNode = (graph, id) => {
57
- return Option.getOrElse(useAtomValue(graph.node(id ?? "")), () => void 0);
43
+ const atom = useMemo(() => graph.node(id ?? ""), [
44
+ graph,
45
+ id
46
+ ]);
47
+ return Option.getOrElse(useAtomValue(atom), () => void 0);
58
48
  };
59
49
  var useConnections = (graph, id, relation) => {
60
50
  return useAtomValue(graph.connections(id ?? "", relation));
61
51
  };
62
52
  var useActions = (graph, id) => {
63
- return useAtomValue(graph.actions(id ?? ""));
53
+ const atom = useMemo(() => graph.actions(id ?? ""), [
54
+ graph,
55
+ id
56
+ ]);
57
+ return useAtomValue(atom);
64
58
  };
65
59
  var useEdges = (graph, id) => {
66
- return useAtomValue(graph.edges(id ?? ""));
60
+ const atom = useMemo(() => graph.edges(id ?? ""), [
61
+ graph,
62
+ id
63
+ ]);
64
+ return useAtomValue(atom);
67
65
  };
66
+
67
+ // src/index.ts
68
+ var GraphPlugin = Plugin.lazy(meta, () => import("./GraphPlugin-6JDSI47S.mjs"));
68
69
  export {
69
70
  GraphPlugin,
70
71
  meta,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/index.ts", "../../../src/action.ts", "../../../src/GraphPlugin.ts", "../../../src/meta.ts", "../../../src/hooks/useActionRunner.ts", "../../../src/hooks/useNode.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 { runAndForwardErrors } from '@dxos/effect';\nimport { Operation, type OperationInvoker } from '@dxos/operation';\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 activatesBefore: [AppActivationEvents.SetupAppGraph, AppActivationEvents.SetupMetadata],\n activatesAfter: [AppActivationEvents.AppGraphReady],\n activate: Graph,\n }),\n Plugin.make,\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: 'dxos.org/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", "//\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';\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 return Option.getOrElse(useAtomValue(graph.node(id ?? '')), () => 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\nexport const useActions = (graph: Graph.ReadableGraph, id?: string): Node.Node[] => {\n return useAtomValue(graph.actions(id ?? ''));\n};\n\n/** Subscribe to just the edge topology (inbound/outbound IDs) of a node without subscribing to node content. */\nexport const useEdges = (graph: Graph.ReadableGraph, id?: string): Graph.Edges => {\n return useAtomValue(graph.edges(id ?? ''));\n};\n"],
5
- "mappings": ";AAIA,cAAc;;;ACAd,YAAYA,YAAY;AACxB,YAAYC,cAAc;AAE1B,SAASC,kBAA0C;AAEnD,SAASC,2BAA2B;AACpC,SAASC,iBAAwC;AAS1C,IAAMC,YAAY,OACvBC,SACAC,mBACAC,QACAC,SAA2B,CAAC,MAE5BC,oBACEF,OACGG,KAAKF,MAAAA,EACLG,KACQC,sBAAeC,UAAUC,SAAST,OAAAA,GAClCO,sBAAeG,WAAWD,SAASR,iBAAAA,GAC1CC,OAAOS,iBAAwBC,eAAQV,OAAOS,cAAc,IAAaE,iBAAQ,CAAA;;;AC3BzF,SAASC,kBAAkBC,cAAAA,aAAYC,cAAc;AACrD,SAASC,2BAA2B;;;ACApC,SAASC,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;AAIf;;;ADLA,IAAMC,QAAQC,YAAWC,KAAK,SAAS,MAAM,OAAO,sBAAA,CAAA;AAO7C,IAAMC,cAAcC,OAAOC,OAAOC,IAAAA,EAAMC,KAC7CH,OAAOI,UAAU;EACfC,aAAaC,iBAAiBC;EAC9BC,iBAAiB;IAACC,oBAAoBC;IAAeD,oBAAoBE;;EACzEC,gBAAgB;IAACH,oBAAoBI;;EACrCC,UAAUlB;AACZ,CAAA,GACAI,OAAOe,IAAI;;;AEnBb,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;AAajB,IAAMC,UAAU,CAAUC,OAA4BC,OAAAA;AAC3D,SAAcC,iBAAUC,aAAaH,MAAMI,KAAKH,MAAM,EAAA,CAAA,GAAM,MAAMI,MAAAA;AACpE;AAEO,IAAMC,iBAAiB,CAC5BN,OACAC,IACAM,aAAAA;AAEA,SAAOJ,aAAaH,MAAMQ,YAAYP,MAAM,IAAIM,QAAAA,CAAAA;AAClD;AAEO,IAAME,aAAa,CAACT,OAA4BC,OAAAA;AACrD,SAAOE,aAAaH,MAAMU,QAAQT,MAAM,EAAA,CAAA;AAC1C;AAGO,IAAMU,WAAW,CAACX,OAA4BC,OAAAA;AACnD,SAAOE,aAAaH,MAAMY,MAAMX,MAAM,EAAA,CAAA;AACxC;",
6
- "names": ["Effect", "Function", "Capability", "runAndForwardErrors", "Operation", "runAction", "invoker", "capabilityManager", "action", "params", "runAndForwardErrors", "data", "pipe", "provideService", "Operation", "Service", "Capability", "_actionContext", "provide", "identity", "ActivationEvents", "Capability", "Plugin", "AppActivationEvents", "trim", "meta", "id", "name", "description", "trim", "Graph", "Capability", "lazy", "GraphPlugin", "Plugin", "define", "meta", "pipe", "addModule", "activatesOn", "ActivationEvents", "Startup", "activatesBefore", "AppActivationEvents", "SetupAppGraph", "SetupMetadata", "activatesAfter", "AppGraphReady", "activate", "make", "useCallback", "useOperationInvoker", "usePluginManager", "useActionRunner", "invoker", "useOperationInvoker", "pluginManager", "usePluginManager", "useCallback", "action", "params", "runAction", "capabilities", "useAtomValue", "Option", "useNode", "graph", "id", "getOrElse", "useAtomValue", "node", "undefined", "useConnections", "relation", "connections", "useActions", "actions", "useEdges", "edges"]
3
+ "sources": ["../../../src/index.ts", "../../../src/meta.ts", "../../../src/action.ts", "../../../src/hooks/useActionRunner.ts", "../../../src/hooks/useNode.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\n\nimport { meta } from './meta';\n\nexport const GraphPlugin = Plugin.lazy(meta, () => import('./GraphPlugin'));\n\nexport * from './meta';\n\nexport * from '@dxos/app-graph';\n\nexport * from './action';\n// TODO(wittjosiah): Hooks should not be exported from the plugin package at all.\n// Either refactor callers to not need them or factor them out to a shared package.\nexport * from './hooks';\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", "//\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 } from '@dxos/compute';\nimport { runAndForwardErrors } from '@dxos/effect';\nimport { OperationInvoker } from '@dxos/operation';\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 { 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"],
5
+ "mappings": ";AAIA,SAASA,cAAc;;;ACCvB,SAASC,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaJ;;;;AAIf;;;ADFA,cAAc;;;AERd,YAAYK,YAAY;AACxB,YAAYC,cAAc;AAE1B,SAASC,kBAA0C;AAEnD,SAASC,iBAAiB;AAC1B,SAASC,2BAA2B;AAU7B,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;;;AC5BzF,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;;;AJ9CO,IAAMW,cAAcC,OAAOC,KAAKC,MAAM,MAAM,OAAO,4BAAA,CAAA;",
6
+ "names": ["Plugin", "trim", "meta", "id", "name", "description", "Effect", "Function", "Capability", "Operation", "runAndForwardErrors", "runAction", "invoker", "capabilityManager", "action", "params", "data", "pipe", "provideService", "Service", "_actionContext", "provide", "identity", "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", "GraphPlugin", "Plugin", "lazy", "meta"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"src/action.ts":{"bytes":3719,"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/effect","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true}],"format":"esm"},"src/meta.ts":{"bytes":1365,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/graph.ts":{"bytes":7347,"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":3056,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","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/useActionRunner.ts":{"bytes":2530,"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":3919,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true}],"format":"esm"},"src/hooks/index.ts":{"bytes":568,"imports":[{"path":"src/hooks/useActionRunner.ts","kind":"import-statement","original":"./useActionRunner"},{"path":"src/hooks/useNode.ts","kind":"import-statement","original":"./useNode"}],"format":"esm"},"src/index.ts":{"bytes":815,"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":7444},"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/effect","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"dist/lib/browser/graph-KGMD75RR.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}],"exports":["GraphPlugin","meta","runAction","useActionRunner","useActions","useConnections","useEdges","useNode"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":33},"src/action.ts":{"bytesInOutput":551},"src/GraphPlugin.ts":{"bytesInOutput":530},"src/meta.ts":{"bytesInOutput":283},"src/hooks/useActionRunner.ts":{"bytesInOutput":397},"src/hooks/index.ts":{"bytesInOutput":0},"src/hooks/useNode.ts":{"bytesInOutput":487}},"bytes":2591},"dist/lib/browser/graph-KGMD75RR.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3865},"dist/lib/browser/graph-KGMD75RR.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":1469}},"bytes":1568}}}
1
+ {"inputs":{"src/meta.ts":{"bytes":1286,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/action.ts":{"bytes":3672,"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/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/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":2966,"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/index.ts":{"bytes":1648,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"src/action.ts","kind":"import-statement","original":"./action"},{"path":"src/hooks/index.ts","kind":"import-statement","original":"./hooks"},{"path":"src/GraphPlugin.ts","kind":"dynamic-import","original":"./GraphPlugin"}],"format":"esm"},"src/plugin.ts":{"bytes":653,"imports":[{"path":"src/GraphPlugin.ts","kind":"import-statement","original":"./GraphPlugin"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7029},"dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"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":"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":"dist/lib/browser/GraphPlugin-6JDSI47S.mjs","kind":"dynamic-import"}],"exports":["GraphPlugin","meta","runAction","useActionRunner","useActions","useConnections","useEdges","useNode"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":160},"src/meta.ts":{"bytesInOutput":283},"src/action.ts":{"bytesInOutput":549},"src/hooks/useActionRunner.ts":{"bytesInOutput":397},"src/hooks/index.ts":{"bytesInOutput":0},"src/hooks/useNode.ts":{"bytesInOutput":703}},"bytes":2390},"dist/lib/browser/plugin.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/browser/plugin.mjs":{"imports":[{"path":"dist/lib/browser/chunk-S2DLYPRU.mjs","kind":"import-statement"}],"exports":["GraphPlugin"],"entryPoint":"src/plugin.ts","inputs":{"src/plugin.ts":{"bytesInOutput":0}},"bytes":116},"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},"dist/lib/browser/GraphPlugin-6JDSI47S.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/browser/GraphPlugin-6JDSI47S.mjs":{"imports":[{"path":"dist/lib/browser/chunk-S2DLYPRU.mjs","kind":"import-statement"}],"exports":["GraphPlugin","default"],"entryPoint":"src/GraphPlugin.ts","inputs":{},"bytes":187},"dist/lib/browser/chunk-S2DLYPRU.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1518},"dist/lib/browser/chunk-S2DLYPRU.mjs":{"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":"dist/lib/browser/graph-RCKCHDM6.mjs","kind":"dynamic-import"}],"exports":["GraphPlugin","GraphPlugin_default"],"inputs":{"src/GraphPlugin.ts":{"bytesInOutput":556}},"bytes":672}}}
@@ -0,0 +1,7 @@
1
+ import {
2
+ GraphPlugin
3
+ } from "./chunk-S2DLYPRU.mjs";
4
+ export {
5
+ GraphPlugin
6
+ };
7
+ //# sourceMappingURL=plugin.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,10 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import {
3
+ GraphPlugin,
4
+ GraphPlugin_default
5
+ } from "./chunk-L7LOKNKX.mjs";
6
+ export {
7
+ GraphPlugin,
8
+ GraphPlugin_default as default
9
+ };
10
+ //# sourceMappingURL=GraphPlugin-76Z465LW.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,24 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+
3
+ // src/GraphPlugin.ts
4
+ import { ActivationEvents, Capability, Plugin } from "@dxos/app-framework";
5
+ import { AppActivationEvents } from "@dxos/app-toolkit";
6
+ import { meta } from "#meta";
7
+ var Graph = Capability.lazy("Graph", () => import("./graph-P7F6HXZB.mjs"));
8
+ var GraphPlugin = Plugin.define(meta).pipe(Plugin.addModule({
9
+ activatesOn: ActivationEvents.Startup,
10
+ firesBeforeActivation: [
11
+ AppActivationEvents.SetupAppGraph
12
+ ],
13
+ firesAfterActivation: [
14
+ AppActivationEvents.AppGraphReady
15
+ ],
16
+ activate: Graph
17
+ }), Plugin.make);
18
+ var GraphPlugin_default = GraphPlugin;
19
+
20
+ export {
21
+ GraphPlugin,
22
+ GraphPlugin_default
23
+ };
24
+ //# sourceMappingURL=chunk-L7LOKNKX.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/GraphPlugin.ts"],
4
+ "sourcesContent": ["//\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],\n firesAfterActivation: [AppActivationEvents.AppGraphReady],\n activate: Graph,\n }),\n Plugin.make,\n);\n\nexport default GraphPlugin;\n"],
5
+ "mappings": ";;;AAIA,SAASA,kBAAkBC,YAAYC,cAAc;AACrD,SAASC,2BAA2B;AAEpC,SAASC,YAAY;AAErB,IAAMC,QAAQJ,WAAWK,KAAK,SAAS,MAAM,OAAO,sBAAA,CAAA;AAO7C,IAAMC,cAAcL,OAAOM,OAAOJ,IAAAA,EAAMK,KAC7CP,OAAOQ,UAAU;EACfC,aAAaX,iBAAiBY;EAC9BC,uBAAuB;IAACV,oBAAoBW;;EAC5CC,sBAAsB;IAACZ,oBAAoBa;;EAC3CC,UAAUZ;AACZ,CAAA,GACAH,OAAOgB,IAAI;AAGb,IAAA,sBAAeX;",
6
+ "names": ["ActivationEvents", "Capability", "Plugin", "AppActivationEvents", "meta", "Graph", "lazy", "GraphPlugin", "define", "pipe", "addModule", "activatesOn", "Startup", "firesBeforeActivation", "SetupAppGraph", "firesAfterActivation", "AppGraphReady", "activate", "make"]
7
+ }
@@ -8,14 +8,22 @@ import { Graph, GraphBuilder, Node } from "@dxos/app-graph";
8
8
  import { AppCapabilities } from "@dxos/app-toolkit";
9
9
  var graph_default = Capability.makeModule(Effect.fnUntraced(function* () {
10
10
  const registry = yield* Capability.get(Capabilities.AtomRegistry);
11
- const extensionsAtom = yield* Capability.atom(AppCapabilities.AppGraphBuilder);
11
+ const extensionsByModuleAtom = yield* Capability.atomByModule(AppCapabilities.AppGraphBuilder);
12
12
  const builder = GraphBuilder.from(
13
13
  /* localStorage.getItem(KEY) ?? */
14
14
  void 0,
15
15
  registry
16
16
  );
17
- const unsubscribe = registry.subscribe(extensionsAtom, (extensions) => {
18
- const next = GraphBuilder.flattenExtensions(extensions);
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
+ }
19
27
  const current = Record.values(registry.get(builder.extensions));
20
28
  const removed = current.filter(({ id }) => !next.some(({ id: nextId }) => nextId === id));
21
29
  removed.forEach((extension) => GraphBuilder.removeExtension(builder, extension.id));
@@ -39,4 +47,4 @@ var setupDevtools = (graph) => {
39
47
  export {
40
48
  graph_default as default
41
49
  };
42
- //# sourceMappingURL=graph-AKMWV2C7.mjs.map
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
+ }
@@ -1,24 +1,12 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
2
 
3
3
  // src/index.ts
4
- export * from "@dxos/app-graph";
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 { runAndForwardErrors } from "@dxos/effect";
11
- import { Operation } from "@dxos/operation";
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
-
14
- // src/GraphPlugin.ts
15
- import { ActivationEvents, Capability as Capability2, Plugin } from "@dxos/app-framework";
16
- import { AppActivationEvents } from "@dxos/app-toolkit";
4
+ import { Plugin } from "@dxos/app-framework";
17
5
 
18
6
  // src/meta.ts
19
7
  import { trim } from "@dxos/util";
20
8
  var meta = {
21
- id: "dxos.org/plugin/graph",
9
+ id: "org.dxos.plugin.graph",
22
10
  name: "Graph",
23
11
  description: trim`
24
12
  Graph database layer providing relationship modeling and queries for workspace objects.
@@ -26,19 +14,16 @@ var meta = {
26
14
  `
27
15
  };
28
16
 
29
- // src/GraphPlugin.ts
30
- var Graph = Capability2.lazy("Graph", () => import("./graph-AKMWV2C7.mjs"));
31
- var GraphPlugin = Plugin.define(meta).pipe(Plugin.addModule({
32
- activatesOn: ActivationEvents.Startup,
33
- activatesBefore: [
34
- AppActivationEvents.SetupAppGraph,
35
- AppActivationEvents.SetupMetadata
36
- ],
37
- activatesAfter: [
38
- AppActivationEvents.AppGraphReady
39
- ],
40
- activate: Graph
41
- }), Plugin.make);
17
+ // src/index.ts
18
+ export * from "@dxos/app-graph";
19
+
20
+ // src/action.ts
21
+ import * as Effect from "effect/Effect";
22
+ import * as Function from "effect/Function";
23
+ import { Capability } from "@dxos/app-framework";
24
+ import { Operation } from "@dxos/compute";
25
+ import { runAndForwardErrors } from "@dxos/effect";
26
+ 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));
42
27
 
43
28
  // src/hooks/useActionRunner.ts
44
29
  import { useCallback } from "react";
@@ -55,18 +40,34 @@ var useActionRunner = () => {
55
40
  // src/hooks/useNode.ts
56
41
  import { useAtomValue } from "@effect-atom/atom-react";
57
42
  import * as Option from "effect/Option";
43
+ import { useMemo } from "react";
58
44
  var useNode = (graph, id) => {
59
- return Option.getOrElse(useAtomValue(graph.node(id ?? "")), () => void 0);
45
+ const atom = useMemo(() => graph.node(id ?? ""), [
46
+ graph,
47
+ id
48
+ ]);
49
+ return Option.getOrElse(useAtomValue(atom), () => void 0);
60
50
  };
61
51
  var useConnections = (graph, id, relation) => {
62
52
  return useAtomValue(graph.connections(id ?? "", relation));
63
53
  };
64
54
  var useActions = (graph, id) => {
65
- return useAtomValue(graph.actions(id ?? ""));
55
+ const atom = useMemo(() => graph.actions(id ?? ""), [
56
+ graph,
57
+ id
58
+ ]);
59
+ return useAtomValue(atom);
66
60
  };
67
61
  var useEdges = (graph, id) => {
68
- return useAtomValue(graph.edges(id ?? ""));
62
+ const atom = useMemo(() => graph.edges(id ?? ""), [
63
+ graph,
64
+ id
65
+ ]);
66
+ return useAtomValue(atom);
69
67
  };
68
+
69
+ // src/index.ts
70
+ var GraphPlugin = Plugin.lazy(meta, () => import("./GraphPlugin-76Z465LW.mjs"));
70
71
  export {
71
72
  GraphPlugin,
72
73
  meta,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/index.ts", "../../../src/action.ts", "../../../src/GraphPlugin.ts", "../../../src/meta.ts", "../../../src/hooks/useActionRunner.ts", "../../../src/hooks/useNode.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 { runAndForwardErrors } from '@dxos/effect';\nimport { Operation, type OperationInvoker } from '@dxos/operation';\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 activatesBefore: [AppActivationEvents.SetupAppGraph, AppActivationEvents.SetupMetadata],\n activatesAfter: [AppActivationEvents.AppGraphReady],\n activate: Graph,\n }),\n Plugin.make,\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: 'dxos.org/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", "//\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';\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 return Option.getOrElse(useAtomValue(graph.node(id ?? '')), () => 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\nexport const useActions = (graph: Graph.ReadableGraph, id?: string): Node.Node[] => {\n return useAtomValue(graph.actions(id ?? ''));\n};\n\n/** Subscribe to just the edge topology (inbound/outbound IDs) of a node without subscribing to node content. */\nexport const useEdges = (graph: Graph.ReadableGraph, id?: string): Graph.Edges => {\n return useAtomValue(graph.edges(id ?? ''));\n};\n"],
5
- "mappings": ";;;AAIA,cAAc;;;ACAd,YAAYA,YAAY;AACxB,YAAYC,cAAc;AAE1B,SAASC,kBAA0C;AAEnD,SAASC,2BAA2B;AACpC,SAASC,iBAAwC;AAS1C,IAAMC,YAAY,OACvBC,SACAC,mBACAC,QACAC,SAA2B,CAAC,MAE5BC,oBACEF,OACGG,KAAKF,MAAAA,EACLG,KACQC,sBAAeC,UAAUC,SAAST,OAAAA,GAClCO,sBAAeG,WAAWD,SAASR,iBAAAA,GAC1CC,OAAOS,iBAAwBC,eAAQV,OAAOS,cAAc,IAAaE,iBAAQ,CAAA;;;AC3BzF,SAASC,kBAAkBC,cAAAA,aAAYC,cAAc;AACrD,SAASC,2BAA2B;;;ACApC,SAASC,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;AAIf;;;ADLA,IAAMC,QAAQC,YAAWC,KAAK,SAAS,MAAM,OAAO,sBAAA,CAAA;AAO7C,IAAMC,cAAcC,OAAOC,OAAOC,IAAAA,EAAMC,KAC7CH,OAAOI,UAAU;EACfC,aAAaC,iBAAiBC;EAC9BC,iBAAiB;IAACC,oBAAoBC;IAAeD,oBAAoBE;;EACzEC,gBAAgB;IAACH,oBAAoBI;;EACrCC,UAAUlB;AACZ,CAAA,GACAI,OAAOe,IAAI;;;AEnBb,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;AAajB,IAAMC,UAAU,CAAUC,OAA4BC,OAAAA;AAC3D,SAAcC,iBAAUC,aAAaH,MAAMI,KAAKH,MAAM,EAAA,CAAA,GAAM,MAAMI,MAAAA;AACpE;AAEO,IAAMC,iBAAiB,CAC5BN,OACAC,IACAM,aAAAA;AAEA,SAAOJ,aAAaH,MAAMQ,YAAYP,MAAM,IAAIM,QAAAA,CAAAA;AAClD;AAEO,IAAME,aAAa,CAACT,OAA4BC,OAAAA;AACrD,SAAOE,aAAaH,MAAMU,QAAQT,MAAM,EAAA,CAAA;AAC1C;AAGO,IAAMU,WAAW,CAACX,OAA4BC,OAAAA;AACnD,SAAOE,aAAaH,MAAMY,MAAMX,MAAM,EAAA,CAAA;AACxC;",
6
- "names": ["Effect", "Function", "Capability", "runAndForwardErrors", "Operation", "runAction", "invoker", "capabilityManager", "action", "params", "runAndForwardErrors", "data", "pipe", "provideService", "Operation", "Service", "Capability", "_actionContext", "provide", "identity", "ActivationEvents", "Capability", "Plugin", "AppActivationEvents", "trim", "meta", "id", "name", "description", "trim", "Graph", "Capability", "lazy", "GraphPlugin", "Plugin", "define", "meta", "pipe", "addModule", "activatesOn", "ActivationEvents", "Startup", "activatesBefore", "AppActivationEvents", "SetupAppGraph", "SetupMetadata", "activatesAfter", "AppGraphReady", "activate", "make", "useCallback", "useOperationInvoker", "usePluginManager", "useActionRunner", "invoker", "useOperationInvoker", "pluginManager", "usePluginManager", "useCallback", "action", "params", "runAction", "capabilities", "useAtomValue", "Option", "useNode", "graph", "id", "getOrElse", "useAtomValue", "node", "undefined", "useConnections", "relation", "connections", "useActions", "actions", "useEdges", "edges"]
3
+ "sources": ["../../../src/index.ts", "../../../src/meta.ts", "../../../src/action.ts", "../../../src/hooks/useActionRunner.ts", "../../../src/hooks/useNode.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\n\nimport { meta } from './meta';\n\nexport const GraphPlugin = Plugin.lazy(meta, () => import('./GraphPlugin'));\n\nexport * from './meta';\n\nexport * from '@dxos/app-graph';\n\nexport * from './action';\n// TODO(wittjosiah): Hooks should not be exported from the plugin package at all.\n// Either refactor callers to not need them or factor them out to a shared package.\nexport * from './hooks';\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", "//\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 } from '@dxos/compute';\nimport { runAndForwardErrors } from '@dxos/effect';\nimport { OperationInvoker } from '@dxos/operation';\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 { 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"],
5
+ "mappings": ";;;AAIA,SAASA,cAAc;;;ACCvB,SAASC,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaJ;;;;AAIf;;;ADFA,cAAc;;;AERd,YAAYK,YAAY;AACxB,YAAYC,cAAc;AAE1B,SAASC,kBAA0C;AAEnD,SAASC,iBAAiB;AAC1B,SAASC,2BAA2B;AAU7B,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;;;AC5BzF,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;;;AJ9CO,IAAMW,cAAcC,OAAOC,KAAKC,MAAM,MAAM,OAAO,4BAAA,CAAA;",
6
+ "names": ["Plugin", "trim", "meta", "id", "name", "description", "Effect", "Function", "Capability", "Operation", "runAndForwardErrors", "runAction", "invoker", "capabilityManager", "action", "params", "data", "pipe", "provideService", "Service", "_actionContext", "provide", "identity", "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", "GraphPlugin", "Plugin", "lazy", "meta"]
7
7
  }