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

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.
@@ -37,4 +37,4 @@ var setupDevtools = (graph) => {
37
37
  export {
38
38
  graph_default as default
39
39
  };
40
- //# sourceMappingURL=graph-KGMD75RR.mjs.map
40
+ //# sourceMappingURL=graph-MX5UQYEY.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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 extensionsAtom = yield* Capability.atom(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 extensionsAtom,\n (extensions) => {\n const next = GraphBuilder.flattenExtensions(extensions);\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"],
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 extensionsAtom = yield* Capability.atom(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 extensionsAtom,\n (extensions) => {\n const next = GraphBuilder.flattenExtensions(extensions);\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
5
  "mappings": ";AAIA,YAAYA,YAAY;AACxB,YAAYC,YAAY;AAExB,SAASC,cAAcC,kBAAkB;AACzC,SAASC,OAAOC,cAAcC,YAAY;AAC1C,SAASC,uBAAuB;AAOhC,IAAA,gBAAeC,WAAWC,WACjBC,kBAAW,aAAA;AAChB,QAAMC,WAAW,OAAOH,WAAWI,IAAIC,aAAaC,YAAY;AAChE,QAAMC,iBAAiB,OAAOP,WAAWQ,KAAKC,gBAAgBC,eAAe;AAE7E,QAAMC,UAAUC,aAAaC;;IAAwCC;IAAWX;EAAAA;AAKhF,QAAMY,cAAcZ,SAASa,UAC3BT,gBACA,CAACU,eAAAA;AACC,UAAMC,OAAON,aAAaO,kBAAkBF,UAAAA;AAC5C,UAAMG,UAAiBC,cAAOlB,SAASC,IAAIO,QAAQM,UAAU,CAAA;AAC7D,UAAMK,UAAUF,QAAQG,OAAO,CAAC,EAAEC,GAAE,MAAO,CAACN,KAAKO,KAAK,CAAC,EAAED,IAAIE,OAAM,MAAOA,WAAWF,EAAAA,CAAAA;AACrFF,YAAQK,QAAQ,CAACC,cAAchB,aAAaiB,gBAAgBlB,SAASiB,UAAUJ,EAAE,CAAA;AACjFN,SAAKS,QAAQ,CAACC,cAAchB,aAAakB,aAAanB,SAASiB,SAAAA,CAAAA;EACjE,GACA;IAAEG,WAAW;EAAK,CAAA;AAIpB,OAAKC,MAAMC,OAAOtB,QAAQuB,OAAOC,KAAKC,QAAQ,OAAA;AAE9CC,gBAAc1B,QAAQuB,KAAK;AAE3B,SAAOlC,WAAWsC,YAChB7B,gBAAgB8B,UAChB;IAAEL,OAAOvB,QAAQuB;IAAOM,SAAS5B,aAAa4B;EAAQ,GACtD,MACSC,YAAK,MAAA;AAEV1B,gBAAAA;EACF,CAAA,CAAA;AAEN,CAAA,CAAA;AAIF,IAAMsB,gBAAgB,CAACH,UAAAA;AACpBQ,aAAmBC,aAAa,CAAC;AACjCD,aAAmBC,SAAST,QAAQA;AACvC;",
6
6
  "names": ["Effect", "Record", "Capabilities", "Capability", "Graph", "GraphBuilder", "Node", "AppCapabilities", "Capability", "makeModule", "fnUntraced", "registry", "get", "Capabilities", "AtomRegistry", "extensionsAtom", "atom", "AppCapabilities", "AppGraphBuilder", "builder", "GraphBuilder", "from", "undefined", "unsubscribe", "subscribe", "extensions", "next", "flattenExtensions", "current", "values", "removed", "filter", "id", "some", "nextId", "forEach", "extension", "removeExtension", "addExtension", "immediate", "Graph", "expand", "graph", "Node", "RootId", "setupDevtools", "contributes", "AppGraph", "explore", "sync", "globalThis", "composer"]
7
7
  }
@@ -16,7 +16,7 @@ import { AppActivationEvents } from "@dxos/app-toolkit";
16
16
  // src/meta.ts
17
17
  import { trim } from "@dxos/util";
18
18
  var meta = {
19
- id: "dxos.org/plugin/graph",
19
+ id: "org.dxos.plugin.graph",
20
20
  name: "Graph",
21
21
  description: trim`
22
22
  Graph database layer providing relationship modeling and queries for workspace objects.
@@ -25,7 +25,7 @@ var meta = {
25
25
  };
26
26
 
27
27
  // src/GraphPlugin.ts
28
- var Graph = Capability2.lazy("Graph", () => import("./graph-KGMD75RR.mjs"));
28
+ var Graph = Capability2.lazy("Graph", () => import("./graph-MX5UQYEY.mjs"));
29
29
  var GraphPlugin = Plugin.define(meta).pipe(Plugin.addModule({
30
30
  activatesOn: ActivationEvents.Startup,
31
31
  activatesBefore: [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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"],
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: '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 { 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
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
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"]
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/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-MX5UQYEY.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-MX5UQYEY.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3865},"dist/lib/browser/graph-MX5UQYEY.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}}}
@@ -39,4 +39,4 @@ var setupDevtools = (graph) => {
39
39
  export {
40
40
  graph_default as default
41
41
  };
42
- //# sourceMappingURL=graph-AKMWV2C7.mjs.map
42
+ //# sourceMappingURL=graph-2RMPUX7I.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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 extensionsAtom = yield* Capability.atom(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 extensionsAtom,\n (extensions) => {\n const next = GraphBuilder.flattenExtensions(extensions);\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"],
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 extensionsAtom = yield* Capability.atom(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 extensionsAtom,\n (extensions) => {\n const next = GraphBuilder.flattenExtensions(extensions);\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
5
  "mappings": ";;;AAIA,YAAYA,YAAY;AACxB,YAAYC,YAAY;AAExB,SAASC,cAAcC,kBAAkB;AACzC,SAASC,OAAOC,cAAcC,YAAY;AAC1C,SAASC,uBAAuB;AAOhC,IAAA,gBAAeC,WAAWC,WACjBC,kBAAW,aAAA;AAChB,QAAMC,WAAW,OAAOH,WAAWI,IAAIC,aAAaC,YAAY;AAChE,QAAMC,iBAAiB,OAAOP,WAAWQ,KAAKC,gBAAgBC,eAAe;AAE7E,QAAMC,UAAUC,aAAaC;;IAAwCC;IAAWX;EAAAA;AAKhF,QAAMY,cAAcZ,SAASa,UAC3BT,gBACA,CAACU,eAAAA;AACC,UAAMC,OAAON,aAAaO,kBAAkBF,UAAAA;AAC5C,UAAMG,UAAiBC,cAAOlB,SAASC,IAAIO,QAAQM,UAAU,CAAA;AAC7D,UAAMK,UAAUF,QAAQG,OAAO,CAAC,EAAEC,GAAE,MAAO,CAACN,KAAKO,KAAK,CAAC,EAAED,IAAIE,OAAM,MAAOA,WAAWF,EAAAA,CAAAA;AACrFF,YAAQK,QAAQ,CAACC,cAAchB,aAAaiB,gBAAgBlB,SAASiB,UAAUJ,EAAE,CAAA;AACjFN,SAAKS,QAAQ,CAACC,cAAchB,aAAakB,aAAanB,SAASiB,SAAAA,CAAAA;EACjE,GACA;IAAEG,WAAW;EAAK,CAAA;AAIpB,OAAKC,MAAMC,OAAOtB,QAAQuB,OAAOC,KAAKC,QAAQ,OAAA;AAE9CC,gBAAc1B,QAAQuB,KAAK;AAE3B,SAAOlC,WAAWsC,YAChB7B,gBAAgB8B,UAChB;IAAEL,OAAOvB,QAAQuB;IAAOM,SAAS5B,aAAa4B;EAAQ,GACtD,MACSC,YAAK,MAAA;AAEV1B,gBAAAA;EACF,CAAA,CAAA;AAEN,CAAA,CAAA;AAIF,IAAMsB,gBAAgB,CAACH,UAAAA;AACpBQ,aAAmBC,aAAa,CAAC;AACjCD,aAAmBC,SAAST,QAAQA;AACvC;",
6
6
  "names": ["Effect", "Record", "Capabilities", "Capability", "Graph", "GraphBuilder", "Node", "AppCapabilities", "Capability", "makeModule", "fnUntraced", "registry", "get", "Capabilities", "AtomRegistry", "extensionsAtom", "atom", "AppCapabilities", "AppGraphBuilder", "builder", "GraphBuilder", "from", "undefined", "unsubscribe", "subscribe", "extensions", "next", "flattenExtensions", "current", "values", "removed", "filter", "id", "some", "nextId", "forEach", "extension", "removeExtension", "addExtension", "immediate", "Graph", "expand", "graph", "Node", "RootId", "setupDevtools", "contributes", "AppGraph", "explore", "sync", "globalThis", "composer"]
7
7
  }
@@ -18,7 +18,7 @@ import { AppActivationEvents } from "@dxos/app-toolkit";
18
18
  // src/meta.ts
19
19
  import { trim } from "@dxos/util";
20
20
  var meta = {
21
- id: "dxos.org/plugin/graph",
21
+ id: "org.dxos.plugin.graph",
22
22
  name: "Graph",
23
23
  description: trim`
24
24
  Graph database layer providing relationship modeling and queries for workspace objects.
@@ -27,7 +27,7 @@ var meta = {
27
27
  };
28
28
 
29
29
  // src/GraphPlugin.ts
30
- var Graph = Capability2.lazy("Graph", () => import("./graph-AKMWV2C7.mjs"));
30
+ var Graph = Capability2.lazy("Graph", () => import("./graph-2RMPUX7I.mjs"));
31
31
  var GraphPlugin = Plugin.define(meta).pipe(Plugin.addModule({
32
32
  activatesOn: ActivationEvents.Startup,
33
33
  activatesBefore: [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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"],
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: '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 { 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
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
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"]
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/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7446},"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/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/node-esm/graph-AKMWV2C7.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":2684},"dist/lib/node-esm/graph-AKMWV2C7.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3867},"dist/lib/node-esm/graph-AKMWV2C7.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":1661}}}
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/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7446},"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/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/node-esm/graph-2RMPUX7I.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":2684},"dist/lib/node-esm/graph-2RMPUX7I.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3867},"dist/lib/node-esm/graph-2RMPUX7I.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":1661}}}