@dxos/app-framework 0.8.4-main.406dc2a → 0.8.4-main.548089c

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 (117) hide show
  1. package/dist/lib/browser/{app-graph-builder-LG4RG2LM.mjs → app-graph-builder-JPUFNED5.mjs} +7 -7
  2. package/dist/lib/browser/app-graph-builder-JPUFNED5.mjs.map +7 -0
  3. package/dist/lib/browser/{chunk-2GRQ4QXA.mjs → chunk-LVSO2N4X.mjs} +160 -199
  4. package/dist/lib/browser/chunk-LVSO2N4X.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-FRUTKCPG.mjs → chunk-XRAWIHTQ.mjs} +101 -90
  6. package/dist/lib/browser/chunk-XRAWIHTQ.mjs.map +7 -0
  7. package/dist/lib/browser/index.mjs +5 -33
  8. package/dist/lib/browser/index.mjs.map +2 -2
  9. package/dist/lib/browser/{intent-dispatcher-6SHA5B3N.mjs → intent-dispatcher-TNEVDPI6.mjs} +2 -2
  10. package/dist/lib/browser/{intent-resolver-UZZ4OANZ.mjs → intent-resolver-SYLXP62Y.mjs} +2 -2
  11. package/dist/lib/browser/meta.json +1 -1
  12. package/dist/lib/browser/react/index.mjs +32 -0
  13. package/dist/lib/browser/{store-ACBEYK4B.mjs → store-3HDXKFXP.mjs} +2 -2
  14. package/dist/lib/browser/testing/index.mjs +5 -4
  15. package/dist/lib/browser/testing/index.mjs.map +3 -3
  16. package/dist/lib/node-esm/{app-graph-builder-FMHVHPWA.mjs → app-graph-builder-VO6RTSOS.mjs} +7 -7
  17. package/dist/lib/node-esm/app-graph-builder-VO6RTSOS.mjs.map +7 -0
  18. package/dist/lib/node-esm/{chunk-KSPOOYT3.mjs → chunk-FO5NIDOR.mjs} +160 -199
  19. package/dist/lib/node-esm/chunk-FO5NIDOR.mjs.map +7 -0
  20. package/dist/lib/node-esm/{chunk-CXT6CYPE.mjs → chunk-JH3SFOXA.mjs} +101 -90
  21. package/dist/lib/node-esm/chunk-JH3SFOXA.mjs.map +7 -0
  22. package/dist/lib/node-esm/index.mjs +5 -33
  23. package/dist/lib/node-esm/index.mjs.map +2 -2
  24. package/dist/lib/node-esm/{intent-dispatcher-SIYQ5ZIU.mjs → intent-dispatcher-WUNOPJES.mjs} +2 -2
  25. package/dist/lib/node-esm/{intent-resolver-7FYJMXAG.mjs → intent-resolver-VTZI3NO7.mjs} +2 -2
  26. package/dist/lib/node-esm/meta.json +1 -1
  27. package/dist/lib/node-esm/react/index.mjs +33 -0
  28. package/dist/lib/node-esm/{store-6OBLTVXC.mjs → store-PAJPVOLG.mjs} +2 -2
  29. package/dist/lib/node-esm/testing/index.mjs +5 -4
  30. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  31. package/dist/types/src/common/capabilities.d.ts +36 -42
  32. package/dist/types/src/common/capabilities.d.ts.map +1 -1
  33. package/dist/types/src/common/surface.d.ts +1 -0
  34. package/dist/types/src/common/surface.d.ts.map +1 -1
  35. package/dist/types/src/core/capabilities.d.ts +12 -12
  36. package/dist/types/src/core/capabilities.d.ts.map +1 -1
  37. package/dist/types/src/core/manager.d.ts +1 -1
  38. package/dist/types/src/core/manager.d.ts.map +1 -1
  39. package/dist/types/src/core/plugin.d.ts +4 -0
  40. package/dist/types/src/core/plugin.d.ts.map +1 -1
  41. package/dist/types/src/index.d.ts +0 -2
  42. package/dist/types/src/index.d.ts.map +1 -1
  43. package/dist/types/src/playground/generator/Main.d.ts.map +1 -1
  44. package/dist/types/src/react/App.d.ts.map +1 -0
  45. package/dist/types/src/react/App.stories.d.ts.map +1 -0
  46. package/dist/types/src/react/DefaultFallback.d.ts.map +1 -0
  47. package/dist/types/src/react/Surface.d.ts +4 -4
  48. package/dist/types/src/react/Surface.d.ts.map +1 -1
  49. package/dist/types/src/react/Surface.stories.d.ts +3 -6
  50. package/dist/types/src/react/Surface.stories.d.ts.map +1 -1
  51. package/dist/types/src/react/index.d.ts +2 -0
  52. package/dist/types/src/react/index.d.ts.map +1 -1
  53. package/dist/types/src/react/types.d.ts +6 -0
  54. package/dist/types/src/react/types.d.ts.map +1 -0
  55. package/dist/types/src/{components → react}/useApp.d.ts +2 -2
  56. package/dist/types/src/react/useApp.d.ts.map +1 -0
  57. package/dist/types/src/react/useLoading.d.ts.map +1 -0
  58. package/dist/types/src/testing/withPluginManager.d.ts +4 -3
  59. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  60. package/dist/types/tsconfig.tsbuildinfo +1 -1
  61. package/moon.yml +1 -1
  62. package/package.json +36 -33
  63. package/src/common/capabilities.ts +18 -19
  64. package/src/common/collaboration.ts +2 -2
  65. package/src/common/surface.ts +1 -0
  66. package/src/core/capabilities.test.ts +1 -1
  67. package/src/core/capabilities.ts +23 -19
  68. package/src/core/manager.ts +2 -2
  69. package/src/core/plugin.ts +5 -0
  70. package/src/index.ts +0 -2
  71. package/src/playground/generator/Main.tsx +0 -1
  72. package/src/playground/playground.stories.tsx +1 -1
  73. package/src/plugin-settings/app-graph-builder.ts +5 -5
  74. package/src/plugin-settings/translations.ts +1 -1
  75. package/src/{components → react}/App.tsx +1 -1
  76. package/src/{components → react}/DefaultFallback.tsx +1 -1
  77. package/src/react/Surface.stories.tsx +69 -45
  78. package/src/react/Surface.tsx +56 -33
  79. package/src/react/index.ts +4 -0
  80. package/src/react/types.ts +13 -0
  81. package/src/{components → react}/useApp.tsx +13 -12
  82. package/src/react/useCapabilities.ts +2 -2
  83. package/src/testing/withPluginManager.tsx +9 -4
  84. package/tsconfig.json +9 -0
  85. package/dist/lib/browser/app-graph-builder-LG4RG2LM.mjs.map +0 -7
  86. package/dist/lib/browser/chunk-2GRQ4QXA.mjs.map +0 -7
  87. package/dist/lib/browser/chunk-FRUTKCPG.mjs.map +0 -7
  88. package/dist/lib/browser/worker.mjs +0 -77
  89. package/dist/lib/node-esm/app-graph-builder-FMHVHPWA.mjs.map +0 -7
  90. package/dist/lib/node-esm/chunk-CXT6CYPE.mjs.map +0 -7
  91. package/dist/lib/node-esm/chunk-KSPOOYT3.mjs.map +0 -7
  92. package/dist/lib/node-esm/worker.mjs +0 -78
  93. package/dist/types/src/components/App.d.ts.map +0 -1
  94. package/dist/types/src/components/App.stories.d.ts.map +0 -1
  95. package/dist/types/src/components/DefaultFallback.d.ts.map +0 -1
  96. package/dist/types/src/components/index.d.ts +0 -2
  97. package/dist/types/src/components/index.d.ts.map +0 -1
  98. package/dist/types/src/components/useApp.d.ts.map +0 -1
  99. package/dist/types/src/components/useLoading.d.ts.map +0 -1
  100. package/dist/types/src/worker.d.ts +0 -4
  101. package/dist/types/src/worker.d.ts.map +0 -1
  102. package/src/components/index.ts +0 -5
  103. package/src/worker.ts +0 -11
  104. /package/dist/lib/browser/{intent-dispatcher-6SHA5B3N.mjs.map → intent-dispatcher-TNEVDPI6.mjs.map} +0 -0
  105. /package/dist/lib/browser/{intent-resolver-UZZ4OANZ.mjs.map → intent-resolver-SYLXP62Y.mjs.map} +0 -0
  106. /package/dist/lib/browser/{worker.mjs.map → react/index.mjs.map} +0 -0
  107. /package/dist/lib/browser/{store-ACBEYK4B.mjs.map → store-3HDXKFXP.mjs.map} +0 -0
  108. /package/dist/lib/node-esm/{intent-dispatcher-SIYQ5ZIU.mjs.map → intent-dispatcher-WUNOPJES.mjs.map} +0 -0
  109. /package/dist/lib/node-esm/{intent-resolver-7FYJMXAG.mjs.map → intent-resolver-VTZI3NO7.mjs.map} +0 -0
  110. /package/dist/lib/node-esm/{worker.mjs.map → react/index.mjs.map} +0 -0
  111. /package/dist/lib/node-esm/{store-6OBLTVXC.mjs.map → store-PAJPVOLG.mjs.map} +0 -0
  112. /package/dist/types/src/{components → react}/App.d.ts +0 -0
  113. /package/dist/types/src/{components → react}/App.stories.d.ts +0 -0
  114. /package/dist/types/src/{components → react}/DefaultFallback.d.ts +0 -0
  115. /package/dist/types/src/{components → react}/useLoading.d.ts +0 -0
  116. /package/src/{components → react}/App.stories.tsx +0 -0
  117. /package/src/{components → react}/useLoading.tsx +0 -0
@@ -8,10 +8,10 @@ import {
8
8
  Capabilities,
9
9
  contributes,
10
10
  createIntent
11
- } from "./chunk-2GRQ4QXA.mjs";
11
+ } from "./chunk-LVSO2N4X.mjs";
12
12
 
13
13
  // src/plugin-settings/app-graph-builder.ts
14
- import { Rx } from "@effect-rx/rx-react";
14
+ import { Atom } from "@effect-atom/atom-react";
15
15
  import * as Function from "effect/Function";
16
16
  import * as Option from "effect/Option";
17
17
  import { ROOT_ID, createExtension } from "@dxos/app-graph";
@@ -19,7 +19,7 @@ import { isNonNullable } from "@dxos/util";
19
19
  var app_graph_builder_default = ((context) => contributes(Capabilities.AppGraphBuilder, [
20
20
  createExtension({
21
21
  id: `${meta.id}/action`,
22
- actions: (node) => Rx.make((get) => Function.pipe(get(node), Option.flatMap((node2) => node2.id === ROOT_ID ? Option.some(node2) : Option.none()), Option.map(() => [
22
+ actions: (node) => Atom.make((get) => Function.pipe(get(node), Option.flatMap((node2) => node2.id === ROOT_ID ? Option.some(node2) : Option.none()), Option.map(() => [
23
23
  {
24
24
  id: meta.id,
25
25
  data: async () => {
@@ -45,7 +45,7 @@ var app_graph_builder_default = ((context) => contributes(Capabilities.AppGraphB
45
45
  }),
46
46
  createExtension({
47
47
  id: `${meta.id}/core`,
48
- connector: (node) => Rx.make((get) => Function.pipe(get(node), Option.flatMap((node2) => node2.id === ROOT_ID ? Option.some(node2) : Option.none()), Option.map(() => [
48
+ connector: (node) => Atom.make((get) => Function.pipe(get(node), Option.flatMap((node2) => node2.id === ROOT_ID ? Option.some(node2) : Option.none()), Option.map(() => [
49
49
  {
50
50
  id: SETTINGS_ID,
51
51
  type: meta.id,
@@ -66,7 +66,7 @@ var app_graph_builder_default = ((context) => contributes(Capabilities.AppGraphB
66
66
  }),
67
67
  createExtension({
68
68
  id: `${meta.id}/core-plugins`,
69
- connector: (node) => Rx.make((get) => Function.pipe(get(node), Option.flatMap((node2) => node2.id !== SETTINGS_ID ? Option.none() : Option.some(node2)), Option.map(() => {
69
+ connector: (node) => Atom.make((get) => Function.pipe(get(node), Option.flatMap((node2) => node2.id !== SETTINGS_ID ? Option.none() : Option.some(node2)), Option.map(() => {
70
70
  const manager = get(context.capability(Capabilities.PluginManager));
71
71
  const [settingsStore] = get(context.capabilities(Capabilities.SettingsStore));
72
72
  return [
@@ -108,7 +108,7 @@ var app_graph_builder_default = ((context) => contributes(Capabilities.AppGraphB
108
108
  }),
109
109
  createExtension({
110
110
  id: `${meta.id}/custom-plugins`,
111
- connector: (node) => Rx.make((get) => Function.pipe(get(node), Option.flatMap((node2) => node2.id !== `${SETTINGS_KEY}:custom-plugins` ? Option.none() : Option.some(node2)), Option.map(() => {
111
+ connector: (node) => Atom.make((get) => Function.pipe(get(node), Option.flatMap((node2) => node2.id !== `${SETTINGS_KEY}:custom-plugins` ? Option.none() : Option.some(node2)), Option.map(() => {
112
112
  const manager = get(context.capability(Capabilities.PluginManager));
113
113
  const [settingsStore] = get(context.capabilities(Capabilities.SettingsStore));
114
114
  return manager.plugins.filter((plugin) => !manager.core.includes(plugin.meta.id)).map((plugin) => {
@@ -135,4 +135,4 @@ var app_graph_builder_default = ((context) => contributes(Capabilities.AppGraphB
135
135
  export {
136
136
  app_graph_builder_default as default
137
137
  };
138
- //# sourceMappingURL=app-graph-builder-LG4RG2LM.mjs.map
138
+ //# sourceMappingURL=app-graph-builder-JPUFNED5.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/plugin-settings/app-graph-builder.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Atom } from '@effect-atom/atom-react';\nimport * as Function from 'effect/Function';\nimport * as Option from 'effect/Option';\n\nimport { ROOT_ID, createExtension } from '@dxos/app-graph';\nimport { type SettingsStore, type SettingsValue } from '@dxos/local-storage';\nimport { isNonNullable } from '@dxos/util';\n\nimport { Capabilities } from '../common';\nimport { type PluginContext, type PluginMeta, contributes } from '../core';\nimport { createIntent } from '../plugin-intent';\n\nimport { SETTINGS_ID, SETTINGS_KEY, SettingsAction } from './actions';\nimport { meta } from './meta';\n\nexport default (context: PluginContext) =>\n contributes(Capabilities.AppGraphBuilder, [\n createExtension({\n id: `${meta.id}/action`,\n actions: (node) =>\n Atom.make((get) =>\n Function.pipe(\n get(node),\n Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),\n Option.map(() => [\n {\n id: meta.id,\n data: async () => {\n const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);\n await dispatch(createIntent(SettingsAction.Open));\n },\n properties: {\n label: ['open settings label', { ns: meta.id }],\n icon: 'ph--gear--regular',\n disposition: 'menu',\n keyBinding: {\n macos: 'meta+,',\n windows: 'alt+,',\n },\n },\n },\n ]),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n createExtension({\n id: `${meta.id}/core`,\n connector: (node) =>\n Atom.make((get) =>\n Function.pipe(\n get(node),\n Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),\n Option.map(() => [\n {\n id: SETTINGS_ID,\n type: meta.id,\n properties: {\n label: ['app settings label', { ns: meta.id }],\n icon: 'ph--gear--regular',\n disposition: 'pin-end',\n position: 'hoist',\n testId: 'treeView.appSettings',\n },\n },\n ]),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n createExtension({\n id: `${meta.id}/core-plugins`,\n connector: (node) =>\n Atom.make((get) =>\n Function.pipe(\n get(node),\n Option.flatMap((node) => (node.id !== SETTINGS_ID ? Option.none() : Option.some(node))),\n Option.map(() => {\n const manager = get(context.capability(Capabilities.PluginManager));\n const [settingsStore] = get(context.capabilities(Capabilities.SettingsStore));\n return [\n ...manager.plugins\n .filter((plugin) => manager.core.includes(plugin.meta.id))\n .map((plugin): [PluginMeta, SettingsStore<SettingsValue>] | null => {\n const settings = settingsStore?.getStore(plugin.meta.id);\n if (!settings) {\n return null;\n }\n\n return [plugin.meta, settings];\n })\n .filter(isNonNullable)\n .map(([meta, settings]) => ({\n id: `${SETTINGS_KEY}:${meta.id.replaceAll('/', ':')}`,\n type: 'category',\n data: settings,\n properties: {\n label: meta.name ?? meta.id,\n icon: meta.icon ?? 'ph--circle--regular',\n },\n })),\n\n {\n id: `${SETTINGS_KEY}:custom-plugins`,\n type: 'category',\n properties: {\n label: ['custom plugins label', { ns: meta.id }],\n icon: 'ph--squares-four--regular',\n role: 'branch',\n disposition: 'collection',\n },\n },\n ];\n }),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n createExtension({\n id: `${meta.id}/custom-plugins`,\n connector: (node) =>\n Atom.make((get) =>\n Function.pipe(\n get(node),\n Option.flatMap((node) =>\n node.id !== `${SETTINGS_KEY}:custom-plugins` ? Option.none() : Option.some(node),\n ),\n Option.map(() => {\n const manager = get(context.capability(Capabilities.PluginManager));\n const [settingsStore] = get(context.capabilities(Capabilities.SettingsStore));\n return manager.plugins\n .filter((plugin) => !manager.core.includes(plugin.meta.id))\n .map((plugin): [PluginMeta, SettingsStore<SettingsValue>] | null => {\n const settings = settingsStore?.getStore(plugin.meta.id);\n if (!settings) {\n return null;\n }\n\n return [plugin.meta, settings];\n })\n .filter(isNonNullable)\n .map(([meta, settings]) => ({\n id: `${SETTINGS_KEY}:${meta.id.replaceAll('/', ':')}`,\n type: 'category',\n data: settings,\n properties: {\n label: meta.name ?? meta.id,\n icon: meta.icon ?? 'ph--circle--regular',\n },\n }));\n }),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n ]);\n"],
5
+ "mappings": ";;;;;;;;;;;;;AAIA,SAASA,YAAY;AACrB,YAAYC,cAAc;AAC1B,YAAYC,YAAY;AAExB,SAASC,SAASC,uBAAuB;AAEzC,SAASC,qBAAqB;AAS9B,IAAA,6BAAe,CAACC,YACdC,YAAYC,aAAaC,iBAAiB;EACxCC,gBAAgB;IACdC,IAAI,GAAGC,KAAKD,EAAE;IACdE,SAAS,CAACC,SACRC,KAAKC,KAAK,CAACC,QACAC,cACPD,IAAIH,IAAAA,GACGK,eAAQ,CAACL,UAAUA,MAAKH,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A;AAC3E,aAAOL,QAAQM,QACZC,OAAO,CAACC,WAAW,CAACR,QAAQS,KAAKC,SAASF,OAAO1C,KAAKD,EAAE,CAAA,EACxDY,IAAI,CAAC+B,WAAAA;AACJ,cAAMG,WAAWR,eAAeS,SAASJ,OAAO1C,KAAKD,EAAE;AACvD,YAAI,CAAC8C,UAAU;AACb,iBAAO;QACT;AAEA,eAAO;UAACH,OAAO1C;UAAM6C;;MACvB,CAAA,EACCJ,OAAOM,aAAAA,EACPpC,IAAI,CAAC,CAACX,OAAM6C,QAAAA,OAAe;QAC1B9C,IAAI,GAAGiD,YAAAA,IAAgBhD,MAAKD,GAAGkD,WAAW,KAAK,GAAA,CAAA;QAC/ClB,MAAM;QACNnB,MAAMiC;QACNzB,YAAY;UACVC,OAAOrB,MAAKkD,QAAQlD,MAAKD;UACzBwB,MAAMvB,MAAKuB,QAAQ;QACrB;MACF,EAAA;IACJ,CAAA,GACOK,iBAAU,MAAM,CAAA,CAAE,CAAA,CAAA;EAGjC,CAAA;CACD;",
6
+ "names": ["Atom", "Function", "Option", "ROOT_ID", "createExtension", "isNonNullable", "context", "contributes", "Capabilities", "AppGraphBuilder", "createExtension", "id", "meta", "actions", "node", "Atom", "make", "get", "pipe", "flatMap", "ROOT_ID", "some", "none", "map", "data", "dispatchPromise", "dispatch", "getCapability", "IntentDispatcher", "createIntent", "SettingsAction", "Open", "properties", "label", "ns", "icon", "disposition", "keyBinding", "macos", "windows", "getOrElse", "connector", "SETTINGS_ID", "type", "position", "testId", "manager", "capability", "PluginManager", "settingsStore", "capabilities", "SettingsStore", "plugins", "filter", "plugin", "core", "includes", "settings", "getStore", "isNonNullable", "SETTINGS_KEY", "replaceAll", "name", "role"]
7
+ }
@@ -8,24 +8,11 @@ import { log as log3 } from "@dxos/log";
8
8
  import { byPosition } from "@dxos/util";
9
9
 
10
10
  // src/core/capabilities.ts
11
- import { Rx } from "@effect-rx/rx-react";
11
+ import { Atom } from "@effect-atom/atom-react";
12
12
  import * as Effect from "effect/Effect";
13
13
  import { Trigger } from "@dxos/async";
14
14
  import { invariant } from "@dxos/invariant";
15
15
  import { log } from "@dxos/log";
16
- function _define_property(obj, key, value2) {
17
- if (key in obj) {
18
- Object.defineProperty(obj, key, {
19
- value: value2,
20
- enumerable: true,
21
- configurable: true,
22
- writable: true
23
- });
24
- } else {
25
- obj[key] = value2;
26
- }
27
- return obj;
28
- }
29
16
  var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/capabilities.ts";
30
17
  var InterfaceDefTypeId = Symbol.for("InterfaceDefTypeId");
31
18
  var defineCapability = (identifier) => {
@@ -34,9 +21,9 @@ var defineCapability = (identifier) => {
34
21
  };
35
22
  };
36
23
  var CapabilityImpl = class {
24
+ moduleId;
25
+ implementation;
37
26
  constructor(moduleId, implementation) {
38
- _define_property(this, "moduleId", void 0);
39
- _define_property(this, "implementation", void 0);
40
27
  this.moduleId = moduleId;
41
28
  this.implementation = implementation;
42
29
  }
@@ -53,6 +40,48 @@ var lazy = (c) => async (props) => {
53
40
  return async () => getCapability(props);
54
41
  };
55
42
  var PluginContext = class {
43
+ _registry;
44
+ _capabilityImpls = Atom.family(() => {
45
+ return Atom.make([]).pipe(Atom.keepAlive);
46
+ });
47
+ _capabilities = Atom.family((id) => {
48
+ return Atom.make((get) => {
49
+ const current = get(this._capabilityImpls(id));
50
+ return current.map((c) => c.implementation);
51
+ });
52
+ });
53
+ _capability = Atom.family((id) => {
54
+ return Atom.make((get) => {
55
+ const current = get(this._capabilities(id));
56
+ invariant(current.length > 0, `No capability found for ${id}`, {
57
+ F: __dxlog_file,
58
+ L: 126,
59
+ S: this,
60
+ A: [
61
+ "current.length > 0",
62
+ "`No capability found for ${id}`"
63
+ ]
64
+ });
65
+ return current[0];
66
+ });
67
+ });
68
+ /**
69
+ * Activates plugins based on the activation event.
70
+ * @param event The activation event.
71
+ * @returns Whether the activation was successful.
72
+ */
73
+ activate;
74
+ /**
75
+ * Re-activates the modules that were activated by the event.
76
+ * @param event The activation event.
77
+ * @returns Whether the reset was successful.
78
+ */
79
+ reset;
80
+ constructor({ registry, activate, reset }) {
81
+ this._registry = registry;
82
+ this.activate = activate;
83
+ this.reset = reset;
84
+ }
56
85
  /**
57
86
  * @internal
58
87
  */
@@ -72,7 +101,7 @@ var PluginContext = class {
72
101
  count: current.length
73
102
  }, {
74
103
  F: __dxlog_file,
75
- L: 166,
104
+ L: 170,
76
105
  S: this,
77
106
  C: (f, a) => f(...a)
78
107
  });
@@ -93,7 +122,7 @@ var PluginContext = class {
93
122
  count: current.length
94
123
  }, {
95
124
  F: __dxlog_file,
96
- L: 185,
125
+ L: 189,
97
126
  S: this,
98
127
  C: (f, a) => f(...a)
99
128
  });
@@ -102,15 +131,15 @@ var PluginContext = class {
102
131
  id: interfaceDef.identifier
103
132
  }, {
104
133
  F: __dxlog_file,
105
- L: 187,
134
+ L: 191,
106
135
  S: this,
107
136
  C: (f, a) => f(...a)
108
137
  });
109
138
  }
110
139
  }
111
140
  /**
112
- * Get the Rx reference to the available capabilities for a given interface.
113
- * Primarily useful for deriving other Rx values based on the capabilities or
141
+ * Get the Atom reference to the available capabilities for a given interface.
142
+ * Primarily useful for deriving other Atom values based on the capabilities or
114
143
  * for subscribing to changes in the capabilities.
115
144
  * @returns An Rx reference to the available capabilities.
116
145
  */
@@ -118,8 +147,8 @@ var PluginContext = class {
118
147
  return this._capabilities(interfaceDef.identifier);
119
148
  }
120
149
  /**
121
- * Get the Rx reference to the available capabilities for a given interface.
122
- * Primarily useful for deriving other Rx values based on the capability or
150
+ * Get the Atom reference to the available capabilities for a given interface.
151
+ * Primarily useful for deriving other Atom values based on the capability or
123
152
  * for subscribing to changes in the capability.
124
153
  * @returns An Rx reference to the available capability.
125
154
  * @throws If no capability is found.
@@ -167,38 +196,6 @@ var PluginContext = class {
167
196
  async resetPromise(event) {
168
197
  return this.reset(event).pipe(Effect.runPromise);
169
198
  }
170
- constructor({ registry, activate, reset }) {
171
- _define_property(this, "_registry", void 0);
172
- _define_property(this, "_capabilityImpls", Rx.family(() => {
173
- return Rx.make([]).pipe(Rx.keepAlive);
174
- }));
175
- _define_property(this, "_capabilities", Rx.family((id) => {
176
- return Rx.make((get) => {
177
- const current = get(this._capabilityImpls(id));
178
- return current.map((c) => c.implementation);
179
- });
180
- }));
181
- _define_property(this, "_capability", Rx.family((id) => {
182
- return Rx.make((get) => {
183
- const current = get(this._capabilities(id));
184
- invariant(current.length > 0, `No capability found for ${id}`, {
185
- F: __dxlog_file,
186
- L: 122,
187
- S: this,
188
- A: [
189
- "current.length > 0",
190
- "`No capability found for ${id}`"
191
- ]
192
- });
193
- return current[0];
194
- });
195
- }));
196
- _define_property(this, "activate", void 0);
197
- _define_property(this, "reset", void 0);
198
- this._registry = registry;
199
- this.activate = activate;
200
- this.reset = reset;
201
- }
202
199
  };
203
200
 
204
201
  // src/core/events.ts
@@ -224,7 +221,7 @@ var getEvents = (events) => "type" in events ? events.events : [
224
221
  ];
225
222
 
226
223
  // src/core/manager.ts
227
- import { Registry } from "@effect-rx/rx-react";
224
+ import { Registry } from "@effect-atom/atom-react";
228
225
  import { untracked } from "@preact/signals-core";
229
226
  import * as Array from "effect/Array";
230
227
  import * as Duration from "effect/Duration";
@@ -237,24 +234,42 @@ import * as Ref from "effect/Ref";
237
234
  import { Event } from "@dxos/async";
238
235
  import { live } from "@dxos/live-object";
239
236
  import { log as log2 } from "@dxos/log";
240
- function _define_property2(obj, key, value2) {
241
- if (key in obj) {
242
- Object.defineProperty(obj, key, {
243
- value: value2,
244
- enumerable: true,
245
- configurable: true,
246
- writable: true
247
- });
248
- } else {
249
- obj[key] = value2;
250
- }
251
- return obj;
252
- }
253
237
  var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/manager.ts";
254
238
  var isPromise = (value2) => {
255
239
  return value2 !== null && typeof value2 === "object" && "then" in value2;
256
240
  };
257
241
  var PluginManager = class {
242
+ activation = new Event();
243
+ context;
244
+ registry;
245
+ // TODO(wittjosiah): Replace with Atom.
246
+ _state;
247
+ _pluginLoader;
248
+ _capabilities = /* @__PURE__ */ new Map();
249
+ _moduleMemoMap = /* @__PURE__ */ new Map();
250
+ _activatingEvents = Effect2.runSync(Ref.make([]));
251
+ _activatingModules = Effect2.runSync(Ref.make([]));
252
+ constructor({ pluginLoader, plugins = [], core = plugins.map(({ meta: meta2 }) => meta2.id), enabled = [], registry }) {
253
+ this.registry = registry ?? Registry.make();
254
+ this.context = new PluginContext({
255
+ registry: this.registry,
256
+ activate: (event) => this._activate(event),
257
+ reset: (id) => this._reset(id)
258
+ });
259
+ this._pluginLoader = pluginLoader;
260
+ this._state = live({
261
+ plugins,
262
+ core,
263
+ enabled,
264
+ modules: [],
265
+ active: [],
266
+ eventsFired: [],
267
+ pendingReset: []
268
+ });
269
+ plugins.forEach((plugin) => this._addPlugin(plugin));
270
+ core.forEach((id) => this.enable(id));
271
+ enabled.forEach((id) => this.enable(id));
272
+ }
258
273
  /**
259
274
  * Plugins that are currently registered.
260
275
  *
@@ -648,6 +663,67 @@ var PluginManager = class {
648
663
  return true;
649
664
  });
650
665
  }
666
+ // Memoized with _moduleMemoMap
667
+ _loadModule = (mod) => Effect2.tryPromise({
668
+ try: async () => {
669
+ const entry = this._moduleMemoMap.get(mod.id);
670
+ if (entry) {
671
+ return entry;
672
+ }
673
+ const promise2 = (async () => {
674
+ const start = performance.now();
675
+ let failed = false;
676
+ try {
677
+ log2("loading module", {
678
+ module: mod.id
679
+ }, {
680
+ F: __dxlog_file2,
681
+ L: 477,
682
+ S: this,
683
+ C: (f, a) => f(...a)
684
+ });
685
+ let activationResult = await mod.activate(this.context);
686
+ if (typeof activationResult === "function") {
687
+ activationResult = await activationResult();
688
+ }
689
+ return Array.isArray(activationResult) ? activationResult : [
690
+ activationResult
691
+ ];
692
+ } catch (error) {
693
+ failed = true;
694
+ throw error;
695
+ } finally {
696
+ performance.measure("activate-module", {
697
+ start,
698
+ end: performance.now(),
699
+ detail: {
700
+ module: mod.id
701
+ }
702
+ });
703
+ log2("loaded module", {
704
+ module: mod.id,
705
+ elapsed: performance.now() - start,
706
+ failed
707
+ }, {
708
+ F: __dxlog_file2,
709
+ L: 495,
710
+ S: this,
711
+ C: (f, a) => f(...a)
712
+ });
713
+ }
714
+ })();
715
+ this._moduleMemoMap.set(mod.id, promise2);
716
+ return promise2;
717
+ },
718
+ catch: (error) => error
719
+ }).pipe(Effect2.withSpan("PluginManager._loadModule"), together(Effect2.sleep(Duration.seconds(10)).pipe(Effect2.andThen(Effect2.sync(() => log2.warn(`module is taking a long time to activate`, {
720
+ module: mod.id
721
+ }, {
722
+ F: __dxlog_file2,
723
+ L: 506,
724
+ S: this,
725
+ C: (f, a) => f(...a)
726
+ }))))));
651
727
  _contributeCapabilities(module, capabilities) {
652
728
  return Effect2.gen(this, function* () {
653
729
  capabilities.forEach((capability) => {
@@ -734,96 +810,6 @@ var PluginManager = class {
734
810
  }
735
811
  });
736
812
  }
737
- constructor({ pluginLoader, plugins = [], core = plugins.map(({ meta: meta2 }) => meta2.id), enabled = [], registry }) {
738
- _define_property2(this, "activation", new Event());
739
- _define_property2(this, "context", void 0);
740
- _define_property2(this, "registry", void 0);
741
- _define_property2(this, "_state", void 0);
742
- _define_property2(this, "_pluginLoader", void 0);
743
- _define_property2(this, "_capabilities", /* @__PURE__ */ new Map());
744
- _define_property2(this, "_moduleMemoMap", /* @__PURE__ */ new Map());
745
- _define_property2(this, "_activatingEvents", Effect2.runSync(Ref.make([])));
746
- _define_property2(this, "_activatingModules", Effect2.runSync(Ref.make([])));
747
- _define_property2(this, "_loadModule", (mod) => Effect2.tryPromise({
748
- try: async () => {
749
- const entry = this._moduleMemoMap.get(mod.id);
750
- if (entry) {
751
- return entry;
752
- }
753
- const promise2 = (async () => {
754
- const start = performance.now();
755
- let failed = false;
756
- try {
757
- log2("loading module", {
758
- module: mod.id
759
- }, {
760
- F: __dxlog_file2,
761
- L: 477,
762
- S: this,
763
- C: (f, a) => f(...a)
764
- });
765
- let activationResult = await mod.activate(this.context);
766
- if (typeof activationResult === "function") {
767
- activationResult = await activationResult();
768
- }
769
- return Array.isArray(activationResult) ? activationResult : [
770
- activationResult
771
- ];
772
- } catch (error) {
773
- failed = true;
774
- throw error;
775
- } finally {
776
- performance.measure("activate-module", {
777
- start,
778
- end: performance.now(),
779
- detail: {
780
- module: mod.id
781
- }
782
- });
783
- log2("loaded module", {
784
- module: mod.id,
785
- elapsed: performance.now() - start,
786
- failed
787
- }, {
788
- F: __dxlog_file2,
789
- L: 495,
790
- S: this,
791
- C: (f, a) => f(...a)
792
- });
793
- }
794
- })();
795
- this._moduleMemoMap.set(mod.id, promise2);
796
- return promise2;
797
- },
798
- catch: (error) => error
799
- }).pipe(Effect2.withSpan("PluginManager._loadModule"), together(Effect2.sleep(Duration.seconds(10)).pipe(Effect2.andThen(Effect2.sync(() => log2.warn(`module is taking a long time to activate`, {
800
- module: mod.id
801
- }, {
802
- F: __dxlog_file2,
803
- L: 506,
804
- S: this,
805
- C: (f, a) => f(...a)
806
- })))))));
807
- this.registry = registry ?? Registry.make();
808
- this.context = new PluginContext({
809
- registry: this.registry,
810
- activate: (event) => this._activate(event),
811
- reset: (id) => this._reset(id)
812
- });
813
- this._pluginLoader = pluginLoader;
814
- this._state = live({
815
- plugins,
816
- core,
817
- enabled,
818
- modules: [],
819
- active: [],
820
- eventsFired: [],
821
- pendingReset: []
822
- });
823
- plugins.forEach((plugin) => this._addPlugin(plugin));
824
- core.forEach((id) => this.enable(id));
825
- enabled.forEach((id) => this.enable(id));
826
- }
827
813
  };
828
814
  var together = (togetherEffect) => (effect) => Effect2.gen(function* () {
829
815
  const togetherFiber = yield* Effect2.fork(togetherEffect);
@@ -833,26 +819,13 @@ var together = (togetherEffect) => (effect) => Effect2.gen(function* () {
833
819
  });
834
820
 
835
821
  // src/core/plugin.ts
836
- function _define_property3(obj, key, value2) {
837
- if (key in obj) {
838
- Object.defineProperty(obj, key, {
839
- value: value2,
840
- enumerable: true,
841
- configurable: true,
842
- writable: true
843
- });
844
- } else {
845
- obj[key] = value2;
846
- }
847
- return obj;
848
- }
849
822
  var PluginModule = class {
823
+ id;
824
+ activatesOn;
825
+ activatesBefore;
826
+ activatesAfter;
827
+ activate;
850
828
  constructor(options) {
851
- _define_property3(this, "id", void 0);
852
- _define_property3(this, "activatesOn", void 0);
853
- _define_property3(this, "activatesBefore", void 0);
854
- _define_property3(this, "activatesAfter", void 0);
855
- _define_property3(this, "activate", void 0);
856
829
  this.id = options.id;
857
830
  this.activatesOn = options.activatesOn;
858
831
  this.activatesBefore = options.activatesBefore;
@@ -862,9 +835,9 @@ var PluginModule = class {
862
835
  };
863
836
  var defineModule = (options) => new PluginModule(options);
864
837
  var Plugin = class {
838
+ meta;
839
+ modules;
865
840
  constructor(meta2, modules) {
866
- _define_property3(this, "meta", void 0);
867
- _define_property3(this, "modules", void 0);
868
841
  this.meta = meta2;
869
842
  this.modules = modules;
870
843
  }
@@ -882,7 +855,7 @@ var definePlugin = (meta2, provider) => {
882
855
  (function(Capabilities2) {
883
856
  Capabilities2.Null = defineCapability("dxos.org/app-framework/capability/null");
884
857
  Capabilities2.PluginManager = defineCapability("dxos.org/app-framework/capability/plugin-manager");
885
- Capabilities2.RxRegistry = defineCapability("dxos.org/app-framework/capability/rx-registry");
858
+ Capabilities2.RxRegistry = defineCapability("dxos.org/app-framework/capability/atom-registry");
886
859
  Capabilities2.ReactContext = defineCapability("dxos.org/app-framework/capability/react-context");
887
860
  Capabilities2.ReactRoot = defineCapability("dxos.org/app-framework/capability/react-root");
888
861
  Capabilities2.ReactSurface = defineCapability("dxos.org/app-framework/common/react-surface");
@@ -897,7 +870,6 @@ var definePlugin = (meta2, provider) => {
897
870
  Capabilities2.Settings = defineCapability("dxos.org/app-framework/capability/settings");
898
871
  Capabilities2.Metadata = defineCapability("dxos.org/app-framework/capability/metadata");
899
872
  Capabilities2.Toolkit = defineCapability("dxos.org/app-framework/capability/ai-toolkit");
900
- Capabilities2.ToolkitHandler = defineCapability("dxos.org/app-framework/capability/ai-toolkit-handler");
901
873
  Capabilities2.BlueprintDefinition = defineCapability("dxos.org/app-framework/capability/blueprint-definition");
902
874
  Capabilities2.AiServiceLayer = defineCapability("dxos.org/app-framework/capability/ai-service-factory");
903
875
  Capabilities2.AiModelResolver = defineCapability("dxos.org/app-framework/capability/ai-model-resolver");
@@ -909,13 +881,13 @@ var Capabilities;
909
881
 
910
882
  // src/common/collaboration.ts
911
883
  import * as Schema from "effect/Schema";
912
- import { DataType } from "@dxos/schema";
884
+ import { ContentBlock } from "@dxos/types";
913
885
  (function(CollaborationActions2) {
914
886
  class AcceptProposal extends Schema.TaggedClass()("collaboration/accept-proposal", {
915
887
  input: Schema.Struct({
916
888
  subject: Schema.Any,
917
889
  anchor: Schema.String,
918
- proposal: DataType.MessageBlock.Proposal
890
+ proposal: ContentBlock.Proposal
919
891
  }),
920
892
  output: Schema.Void
921
893
  }) {
@@ -1049,24 +1021,13 @@ var meta = {
1049
1021
  var IntentAction;
1050
1022
 
1051
1023
  // src/plugin-intent/errors.ts
1052
- function _define_property4(obj, key, value2) {
1053
- if (key in obj) {
1054
- Object.defineProperty(obj, key, {
1055
- value: value2,
1056
- enumerable: true,
1057
- configurable: true,
1058
- writable: true
1059
- });
1060
- } else {
1061
- obj[key] = value2;
1062
- }
1063
- return obj;
1064
- }
1065
1024
  var BaseError = class extends Error {
1025
+ code;
1026
+ context;
1066
1027
  constructor(code, message, context) {
1067
1028
  super(message ?? code, {
1068
1029
  cause: context
1069
- }), _define_property4(this, "code", void 0), _define_property4(this, "context", void 0), this.code = code, this.context = context;
1030
+ }), this.code = code, this.context = context;
1070
1031
  this.name = code;
1071
1032
  Object.setPrototypeOf(this, new.target.prototype);
1072
1033
  }
@@ -1095,7 +1056,7 @@ var IntentPlugin = definePlugin(meta, () => [
1095
1056
  activatesAfter: [
1096
1057
  Events.DispatcherReady
1097
1058
  ],
1098
- activate: lazy(() => import("./intent-dispatcher-6SHA5B3N.mjs"))
1059
+ activate: lazy(() => import("./intent-dispatcher-TNEVDPI6.mjs"))
1099
1060
  })
1100
1061
  ]);
1101
1062
 
@@ -1643,4 +1604,4 @@ export {
1643
1604
  ResourceLanguage,
1644
1605
  Resource
1645
1606
  };
1646
- //# sourceMappingURL=chunk-2GRQ4QXA.mjs.map
1607
+ //# sourceMappingURL=chunk-LVSO2N4X.mjs.map