@dxos/app-framework 0.8.4-main.5ad4a44 → 0.8.4-main.66e292d

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 (123) hide show
  1. package/dist/lib/browser/{app-graph-builder-77MY7KAY.mjs → app-graph-builder-OIEZZC45.mjs} +7 -7
  2. package/dist/lib/browser/app-graph-builder-OIEZZC45.mjs.map +7 -0
  3. package/dist/lib/browser/{chunk-4NFLRSTX.mjs → chunk-6XKO24JP.mjs} +108 -92
  4. package/dist/lib/browser/chunk-6XKO24JP.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-OKF2PAWO.mjs → chunk-WPW5VVAX.mjs} +208 -203
  6. package/dist/lib/browser/chunk-WPW5VVAX.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-Y4LZNOBC.mjs → intent-dispatcher-LZ4AE66E.mjs} +2 -2
  10. package/dist/lib/browser/{intent-resolver-XO5OYWVD.mjs → intent-resolver-QVCKRX6G.mjs} +2 -2
  11. package/dist/lib/browser/meta.json +1 -1
  12. package/dist/lib/browser/react/index.mjs +34 -0
  13. package/dist/lib/browser/{store-E3YSBPJQ.mjs → store-CNPHOYTJ.mjs} +3 -3
  14. package/dist/lib/browser/store-CNPHOYTJ.mjs.map +7 -0
  15. package/dist/lib/browser/testing/index.mjs +5 -4
  16. package/dist/lib/browser/testing/index.mjs.map +3 -3
  17. package/dist/lib/node-esm/{app-graph-builder-WK7WBM6I.mjs → app-graph-builder-EBU4NVWD.mjs} +7 -7
  18. package/dist/lib/node-esm/app-graph-builder-EBU4NVWD.mjs.map +7 -0
  19. package/dist/lib/node-esm/{chunk-AHCD4UYO.mjs → chunk-3UPX5OIS.mjs} +108 -92
  20. package/dist/lib/node-esm/chunk-3UPX5OIS.mjs.map +7 -0
  21. package/dist/lib/node-esm/{chunk-7DNZQ6H2.mjs → chunk-XJZGUJ3H.mjs} +208 -203
  22. package/dist/lib/node-esm/chunk-XJZGUJ3H.mjs.map +7 -0
  23. package/dist/lib/node-esm/index.mjs +5 -33
  24. package/dist/lib/node-esm/index.mjs.map +2 -2
  25. package/dist/lib/node-esm/{intent-dispatcher-R4CCPBHO.mjs → intent-dispatcher-MGOJ3CHD.mjs} +2 -2
  26. package/dist/lib/node-esm/{intent-resolver-NVYY6BQA.mjs → intent-resolver-URF3HN3G.mjs} +2 -2
  27. package/dist/lib/node-esm/meta.json +1 -1
  28. package/dist/lib/node-esm/react/index.mjs +35 -0
  29. package/dist/lib/node-esm/{store-QA5DGTOS.mjs → store-RK5B4XEL.mjs} +3 -3
  30. package/dist/lib/node-esm/store-RK5B4XEL.mjs.map +7 -0
  31. package/dist/lib/node-esm/testing/index.mjs +5 -4
  32. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  33. package/dist/types/src/common/capabilities.d.ts +36 -42
  34. package/dist/types/src/common/capabilities.d.ts.map +1 -1
  35. package/dist/types/src/common/surface.d.ts +16 -7
  36. package/dist/types/src/common/surface.d.ts.map +1 -1
  37. package/dist/types/src/core/capabilities.d.ts +14 -14
  38. package/dist/types/src/core/capabilities.d.ts.map +1 -1
  39. package/dist/types/src/core/manager.d.ts +1 -1
  40. package/dist/types/src/core/manager.d.ts.map +1 -1
  41. package/dist/types/src/core/plugin.d.ts +4 -0
  42. package/dist/types/src/core/plugin.d.ts.map +1 -1
  43. package/dist/types/src/index.d.ts +0 -2
  44. package/dist/types/src/index.d.ts.map +1 -1
  45. package/dist/types/src/playground/generator/Main.d.ts.map +1 -1
  46. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +1 -1
  47. package/dist/types/src/react/App.d.ts.map +1 -0
  48. package/dist/types/src/react/App.stories.d.ts.map +1 -0
  49. package/dist/types/src/react/DefaultFallback.d.ts.map +1 -0
  50. package/dist/types/src/react/Surface.d.ts +4 -4
  51. package/dist/types/src/react/Surface.d.ts.map +1 -1
  52. package/dist/types/src/react/Surface.stories.d.ts +3 -6
  53. package/dist/types/src/react/Surface.stories.d.ts.map +1 -1
  54. package/dist/types/src/react/index.d.ts +2 -0
  55. package/dist/types/src/react/index.d.ts.map +1 -1
  56. package/dist/types/src/react/types.d.ts +14 -0
  57. package/dist/types/src/react/types.d.ts.map +1 -0
  58. package/dist/types/src/{components → react}/useApp.d.ts +2 -2
  59. package/dist/types/src/react/useApp.d.ts.map +1 -0
  60. package/dist/types/src/react/useLoading.d.ts.map +1 -0
  61. package/dist/types/src/testing/withPluginManager.d.ts +4 -3
  62. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  63. package/dist/types/tsconfig.tsbuildinfo +1 -1
  64. package/moon.yml +1 -1
  65. package/package.json +36 -33
  66. package/src/common/capabilities.ts +19 -22
  67. package/src/common/collaboration.ts +2 -2
  68. package/src/common/surface.ts +14 -9
  69. package/src/core/capabilities.test.ts +1 -1
  70. package/src/core/capabilities.ts +25 -21
  71. package/src/core/manager.ts +2 -2
  72. package/src/core/plugin.ts +5 -0
  73. package/src/index.ts +0 -2
  74. package/src/playground/generator/Main.tsx +0 -1
  75. package/src/playground/playground.stories.tsx +1 -1
  76. package/src/plugin-intent/errors.ts +1 -1
  77. package/src/plugin-intent/intent-dispatcher.ts +5 -0
  78. package/src/plugin-settings/app-graph-builder.ts +5 -5
  79. package/src/plugin-settings/store.ts +2 -2
  80. package/src/plugin-settings/translations.ts +1 -1
  81. package/src/{components → react}/App.tsx +1 -1
  82. package/src/{components → react}/DefaultFallback.tsx +1 -1
  83. package/src/react/Surface.stories.tsx +69 -45
  84. package/src/react/Surface.tsx +56 -33
  85. package/src/react/index.ts +4 -0
  86. package/src/react/types.ts +38 -0
  87. package/src/{components → react}/useApp.tsx +15 -14
  88. package/src/react/useCapabilities.ts +2 -2
  89. package/src/testing/withPluginManager.tsx +9 -4
  90. package/tsconfig.json +9 -0
  91. package/dist/lib/browser/app-graph-builder-77MY7KAY.mjs.map +0 -7
  92. package/dist/lib/browser/chunk-4NFLRSTX.mjs.map +0 -7
  93. package/dist/lib/browser/chunk-OKF2PAWO.mjs.map +0 -7
  94. package/dist/lib/browser/store-E3YSBPJQ.mjs.map +0 -7
  95. package/dist/lib/browser/worker.mjs +0 -77
  96. package/dist/lib/node-esm/app-graph-builder-WK7WBM6I.mjs.map +0 -7
  97. package/dist/lib/node-esm/chunk-7DNZQ6H2.mjs.map +0 -7
  98. package/dist/lib/node-esm/chunk-AHCD4UYO.mjs.map +0 -7
  99. package/dist/lib/node-esm/store-QA5DGTOS.mjs.map +0 -7
  100. package/dist/lib/node-esm/worker.mjs +0 -78
  101. package/dist/types/src/components/App.d.ts.map +0 -1
  102. package/dist/types/src/components/App.stories.d.ts.map +0 -1
  103. package/dist/types/src/components/DefaultFallback.d.ts.map +0 -1
  104. package/dist/types/src/components/index.d.ts +0 -2
  105. package/dist/types/src/components/index.d.ts.map +0 -1
  106. package/dist/types/src/components/useApp.d.ts.map +0 -1
  107. package/dist/types/src/components/useLoading.d.ts.map +0 -1
  108. package/dist/types/src/worker.d.ts +0 -4
  109. package/dist/types/src/worker.d.ts.map +0 -1
  110. package/src/components/index.ts +0 -5
  111. package/src/worker.ts +0 -11
  112. /package/dist/lib/browser/{intent-dispatcher-Y4LZNOBC.mjs.map → intent-dispatcher-LZ4AE66E.mjs.map} +0 -0
  113. /package/dist/lib/browser/{intent-resolver-XO5OYWVD.mjs.map → intent-resolver-QVCKRX6G.mjs.map} +0 -0
  114. /package/dist/lib/browser/{worker.mjs.map → react/index.mjs.map} +0 -0
  115. /package/dist/lib/node-esm/{intent-dispatcher-R4CCPBHO.mjs.map → intent-dispatcher-MGOJ3CHD.mjs.map} +0 -0
  116. /package/dist/lib/node-esm/{intent-resolver-NVYY6BQA.mjs.map → intent-resolver-URF3HN3G.mjs.map} +0 -0
  117. /package/dist/lib/node-esm/{worker.mjs.map → react/index.mjs.map} +0 -0
  118. /package/dist/types/src/{components → react}/App.d.ts +0 -0
  119. /package/dist/types/src/{components → react}/App.stories.d.ts +0 -0
  120. /package/dist/types/src/{components → react}/DefaultFallback.d.ts +0 -0
  121. /package/dist/types/src/{components → react}/useLoading.d.ts +0 -0
  122. /package/src/{components → react}/App.stories.tsx +0 -0
  123. /package/src/{components → react}/useLoading.tsx +0 -0
@@ -10,24 +10,11 @@ import { log as log3 } from "@dxos/log";
10
10
  import { byPosition } from "@dxos/util";
11
11
 
12
12
  // src/core/capabilities.ts
13
- import { Rx } from "@effect-rx/rx-react";
13
+ import { Atom } from "@effect-atom/atom-react";
14
14
  import * as Effect from "effect/Effect";
15
15
  import { Trigger } from "@dxos/async";
16
16
  import { invariant } from "@dxos/invariant";
17
17
  import { log } from "@dxos/log";
18
- function _define_property(obj, key, value2) {
19
- if (key in obj) {
20
- Object.defineProperty(obj, key, {
21
- value: value2,
22
- enumerable: true,
23
- configurable: true,
24
- writable: true
25
- });
26
- } else {
27
- obj[key] = value2;
28
- }
29
- return obj;
30
- }
31
18
  var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/capabilities.ts";
32
19
  var InterfaceDefTypeId = Symbol.for("InterfaceDefTypeId");
33
20
  var defineCapability = (identifier) => {
@@ -36,9 +23,9 @@ var defineCapability = (identifier) => {
36
23
  };
37
24
  };
38
25
  var CapabilityImpl = class {
26
+ moduleId;
27
+ implementation;
39
28
  constructor(moduleId, implementation) {
40
- _define_property(this, "moduleId", void 0);
41
- _define_property(this, "implementation", void 0);
42
29
  this.moduleId = moduleId;
43
30
  this.implementation = implementation;
44
31
  }
@@ -55,6 +42,48 @@ var lazy = (c) => async (props) => {
55
42
  return async () => getCapability(props);
56
43
  };
57
44
  var PluginContext = class {
45
+ _registry;
46
+ _capabilityImpls = Atom.family(() => {
47
+ return Atom.make([]).pipe(Atom.keepAlive);
48
+ });
49
+ _capabilities = Atom.family((id) => {
50
+ return Atom.make((get) => {
51
+ const current = get(this._capabilityImpls(id));
52
+ return current.map((c) => c.implementation);
53
+ });
54
+ });
55
+ _capability = Atom.family((id) => {
56
+ return Atom.make((get) => {
57
+ const current = get(this._capabilities(id));
58
+ invariant(current.length > 0, `No capability found for ${id}`, {
59
+ F: __dxlog_file,
60
+ L: 126,
61
+ S: this,
62
+ A: [
63
+ "current.length > 0",
64
+ "`No capability found for ${id}`"
65
+ ]
66
+ });
67
+ return current[0];
68
+ });
69
+ });
70
+ /**
71
+ * Activates plugins based on the activation event.
72
+ * @param event The activation event.
73
+ * @returns Whether the activation was successful.
74
+ */
75
+ activate;
76
+ /**
77
+ * Re-activates the modules that were activated by the event.
78
+ * @param event The activation event.
79
+ * @returns Whether the reset was successful.
80
+ */
81
+ reset;
82
+ constructor({ registry, activate, reset }) {
83
+ this._registry = registry;
84
+ this.activate = activate;
85
+ this.reset = reset;
86
+ }
58
87
  /**
59
88
  * @internal
60
89
  */
@@ -74,7 +103,7 @@ var PluginContext = class {
74
103
  count: current.length
75
104
  }, {
76
105
  F: __dxlog_file,
77
- L: 166,
106
+ L: 170,
78
107
  S: this,
79
108
  C: (f, a) => f(...a)
80
109
  });
@@ -95,7 +124,7 @@ var PluginContext = class {
95
124
  count: current.length
96
125
  }, {
97
126
  F: __dxlog_file,
98
- L: 185,
127
+ L: 189,
99
128
  S: this,
100
129
  C: (f, a) => f(...a)
101
130
  });
@@ -104,26 +133,26 @@ var PluginContext = class {
104
133
  id: interfaceDef.identifier
105
134
  }, {
106
135
  F: __dxlog_file,
107
- L: 187,
136
+ L: 191,
108
137
  S: this,
109
138
  C: (f, a) => f(...a)
110
139
  });
111
140
  }
112
141
  }
113
142
  /**
114
- * Get the Rx reference to the available capabilities for a given interface.
115
- * Primarily useful for deriving other Rx values based on the capabilities or
143
+ * Get the Atom reference to the available capabilities for a given interface.
144
+ * Primarily useful for deriving other Atom values based on the capabilities or
116
145
  * for subscribing to changes in the capabilities.
117
- * @returns An Rx reference to the available capabilities.
146
+ * @returns An atom reference to the available capabilities.
118
147
  */
119
148
  capabilities(interfaceDef) {
120
149
  return this._capabilities(interfaceDef.identifier);
121
150
  }
122
151
  /**
123
- * Get the Rx reference to the available capabilities for a given interface.
124
- * Primarily useful for deriving other Rx values based on the capability or
152
+ * Get the Atom reference to the available capabilities for a given interface.
153
+ * Primarily useful for deriving other Atom values based on the capability or
125
154
  * for subscribing to changes in the capability.
126
- * @returns An Rx reference to the available capability.
155
+ * @returns An atom reference to the available capability.
127
156
  * @throws If no capability is found.
128
157
  */
129
158
  capability(interfaceDef) {
@@ -169,38 +198,6 @@ var PluginContext = class {
169
198
  async resetPromise(event) {
170
199
  return this.reset(event).pipe(Effect.runPromise);
171
200
  }
172
- constructor({ registry, activate, reset }) {
173
- _define_property(this, "_registry", void 0);
174
- _define_property(this, "_capabilityImpls", Rx.family(() => {
175
- return Rx.make([]).pipe(Rx.keepAlive);
176
- }));
177
- _define_property(this, "_capabilities", Rx.family((id) => {
178
- return Rx.make((get) => {
179
- const current = get(this._capabilityImpls(id));
180
- return current.map((c) => c.implementation);
181
- });
182
- }));
183
- _define_property(this, "_capability", Rx.family((id) => {
184
- return Rx.make((get) => {
185
- const current = get(this._capabilities(id));
186
- invariant(current.length > 0, `No capability found for ${id}`, {
187
- F: __dxlog_file,
188
- L: 122,
189
- S: this,
190
- A: [
191
- "current.length > 0",
192
- "`No capability found for ${id}`"
193
- ]
194
- });
195
- return current[0];
196
- });
197
- }));
198
- _define_property(this, "activate", void 0);
199
- _define_property(this, "reset", void 0);
200
- this._registry = registry;
201
- this.activate = activate;
202
- this.reset = reset;
203
- }
204
201
  };
205
202
 
206
203
  // src/core/events.ts
@@ -226,7 +223,7 @@ var getEvents = (events) => "type" in events ? events.events : [
226
223
  ];
227
224
 
228
225
  // src/core/manager.ts
229
- import { Registry } from "@effect-rx/rx-react";
226
+ import { Registry } from "@effect-atom/atom-react";
230
227
  import { untracked } from "@preact/signals-core";
231
228
  import * as Array from "effect/Array";
232
229
  import * as Duration from "effect/Duration";
@@ -239,24 +236,42 @@ import * as Ref from "effect/Ref";
239
236
  import { Event } from "@dxos/async";
240
237
  import { live } from "@dxos/live-object";
241
238
  import { log as log2 } from "@dxos/log";
242
- function _define_property2(obj, key, value2) {
243
- if (key in obj) {
244
- Object.defineProperty(obj, key, {
245
- value: value2,
246
- enumerable: true,
247
- configurable: true,
248
- writable: true
249
- });
250
- } else {
251
- obj[key] = value2;
252
- }
253
- return obj;
254
- }
255
239
  var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/manager.ts";
256
240
  var isPromise = (value2) => {
257
241
  return value2 !== null && typeof value2 === "object" && "then" in value2;
258
242
  };
259
243
  var PluginManager = class {
244
+ activation = new Event();
245
+ context;
246
+ registry;
247
+ // TODO(wittjosiah): Replace with Atom.
248
+ _state;
249
+ _pluginLoader;
250
+ _capabilities = /* @__PURE__ */ new Map();
251
+ _moduleMemoMap = /* @__PURE__ */ new Map();
252
+ _activatingEvents = Effect2.runSync(Ref.make([]));
253
+ _activatingModules = Effect2.runSync(Ref.make([]));
254
+ constructor({ pluginLoader, plugins = [], core = plugins.map(({ meta: meta2 }) => meta2.id), enabled = [], registry }) {
255
+ this.registry = registry ?? Registry.make();
256
+ this.context = new PluginContext({
257
+ registry: this.registry,
258
+ activate: (event) => this._activate(event),
259
+ reset: (id) => this._reset(id)
260
+ });
261
+ this._pluginLoader = pluginLoader;
262
+ this._state = live({
263
+ plugins,
264
+ core,
265
+ enabled,
266
+ modules: [],
267
+ active: [],
268
+ eventsFired: [],
269
+ pendingReset: []
270
+ });
271
+ plugins.forEach((plugin) => this._addPlugin(plugin));
272
+ core.forEach((id) => this.enable(id));
273
+ enabled.forEach((id) => this.enable(id));
274
+ }
260
275
  /**
261
276
  * Plugins that are currently registered.
262
277
  *
@@ -650,6 +665,67 @@ var PluginManager = class {
650
665
  return true;
651
666
  });
652
667
  }
668
+ // Memoized with _moduleMemoMap
669
+ _loadModule = (mod) => Effect2.tryPromise({
670
+ try: async () => {
671
+ const entry = this._moduleMemoMap.get(mod.id);
672
+ if (entry) {
673
+ return entry;
674
+ }
675
+ const promise2 = (async () => {
676
+ const start = performance.now();
677
+ let failed = false;
678
+ try {
679
+ log2("loading module", {
680
+ module: mod.id
681
+ }, {
682
+ F: __dxlog_file2,
683
+ L: 477,
684
+ S: this,
685
+ C: (f, a) => f(...a)
686
+ });
687
+ let activationResult = await mod.activate(this.context);
688
+ if (typeof activationResult === "function") {
689
+ activationResult = await activationResult();
690
+ }
691
+ return Array.isArray(activationResult) ? activationResult : [
692
+ activationResult
693
+ ];
694
+ } catch (error) {
695
+ failed = true;
696
+ throw error;
697
+ } finally {
698
+ performance.measure("activate-module", {
699
+ start,
700
+ end: performance.now(),
701
+ detail: {
702
+ module: mod.id
703
+ }
704
+ });
705
+ log2("loaded module", {
706
+ module: mod.id,
707
+ elapsed: performance.now() - start,
708
+ failed
709
+ }, {
710
+ F: __dxlog_file2,
711
+ L: 495,
712
+ S: this,
713
+ C: (f, a) => f(...a)
714
+ });
715
+ }
716
+ })();
717
+ this._moduleMemoMap.set(mod.id, promise2);
718
+ return promise2;
719
+ },
720
+ catch: (error) => error
721
+ }).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`, {
722
+ module: mod.id
723
+ }, {
724
+ F: __dxlog_file2,
725
+ L: 506,
726
+ S: this,
727
+ C: (f, a) => f(...a)
728
+ }))))));
653
729
  _contributeCapabilities(module, capabilities) {
654
730
  return Effect2.gen(this, function* () {
655
731
  capabilities.forEach((capability) => {
@@ -736,96 +812,6 @@ var PluginManager = class {
736
812
  }
737
813
  });
738
814
  }
739
- constructor({ pluginLoader, plugins = [], core = plugins.map(({ meta: meta2 }) => meta2.id), enabled = [], registry }) {
740
- _define_property2(this, "activation", new Event());
741
- _define_property2(this, "context", void 0);
742
- _define_property2(this, "registry", void 0);
743
- _define_property2(this, "_state", void 0);
744
- _define_property2(this, "_pluginLoader", void 0);
745
- _define_property2(this, "_capabilities", /* @__PURE__ */ new Map());
746
- _define_property2(this, "_moduleMemoMap", /* @__PURE__ */ new Map());
747
- _define_property2(this, "_activatingEvents", Effect2.runSync(Ref.make([])));
748
- _define_property2(this, "_activatingModules", Effect2.runSync(Ref.make([])));
749
- _define_property2(this, "_loadModule", (mod) => Effect2.tryPromise({
750
- try: async () => {
751
- const entry = this._moduleMemoMap.get(mod.id);
752
- if (entry) {
753
- return entry;
754
- }
755
- const promise2 = (async () => {
756
- const start = performance.now();
757
- let failed = false;
758
- try {
759
- log2("loading module", {
760
- module: mod.id
761
- }, {
762
- F: __dxlog_file2,
763
- L: 477,
764
- S: this,
765
- C: (f, a) => f(...a)
766
- });
767
- let activationResult = await mod.activate(this.context);
768
- if (typeof activationResult === "function") {
769
- activationResult = await activationResult();
770
- }
771
- return Array.isArray(activationResult) ? activationResult : [
772
- activationResult
773
- ];
774
- } catch (error) {
775
- failed = true;
776
- throw error;
777
- } finally {
778
- performance.measure("activate-module", {
779
- start,
780
- end: performance.now(),
781
- detail: {
782
- module: mod.id
783
- }
784
- });
785
- log2("loaded module", {
786
- module: mod.id,
787
- elapsed: performance.now() - start,
788
- failed
789
- }, {
790
- F: __dxlog_file2,
791
- L: 495,
792
- S: this,
793
- C: (f, a) => f(...a)
794
- });
795
- }
796
- })();
797
- this._moduleMemoMap.set(mod.id, promise2);
798
- return promise2;
799
- },
800
- catch: (error) => error
801
- }).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`, {
802
- module: mod.id
803
- }, {
804
- F: __dxlog_file2,
805
- L: 506,
806
- S: this,
807
- C: (f, a) => f(...a)
808
- })))))));
809
- this.registry = registry ?? Registry.make();
810
- this.context = new PluginContext({
811
- registry: this.registry,
812
- activate: (event) => this._activate(event),
813
- reset: (id) => this._reset(id)
814
- });
815
- this._pluginLoader = pluginLoader;
816
- this._state = live({
817
- plugins,
818
- core,
819
- enabled,
820
- modules: [],
821
- active: [],
822
- eventsFired: [],
823
- pendingReset: []
824
- });
825
- plugins.forEach((plugin) => this._addPlugin(plugin));
826
- core.forEach((id) => this.enable(id));
827
- enabled.forEach((id) => this.enable(id));
828
- }
829
815
  };
830
816
  var together = (togetherEffect) => (effect) => Effect2.gen(function* () {
831
817
  const togetherFiber = yield* Effect2.fork(togetherEffect);
@@ -835,26 +821,13 @@ var together = (togetherEffect) => (effect) => Effect2.gen(function* () {
835
821
  });
836
822
 
837
823
  // src/core/plugin.ts
838
- function _define_property3(obj, key, value2) {
839
- if (key in obj) {
840
- Object.defineProperty(obj, key, {
841
- value: value2,
842
- enumerable: true,
843
- configurable: true,
844
- writable: true
845
- });
846
- } else {
847
- obj[key] = value2;
848
- }
849
- return obj;
850
- }
851
824
  var PluginModule = class {
825
+ id;
826
+ activatesOn;
827
+ activatesBefore;
828
+ activatesAfter;
829
+ activate;
852
830
  constructor(options) {
853
- _define_property3(this, "id", void 0);
854
- _define_property3(this, "activatesOn", void 0);
855
- _define_property3(this, "activatesBefore", void 0);
856
- _define_property3(this, "activatesAfter", void 0);
857
- _define_property3(this, "activate", void 0);
858
831
  this.id = options.id;
859
832
  this.activatesOn = options.activatesOn;
860
833
  this.activatesBefore = options.activatesBefore;
@@ -864,9 +837,9 @@ var PluginModule = class {
864
837
  };
865
838
  var defineModule = (options) => new PluginModule(options);
866
839
  var Plugin = class {
840
+ meta;
841
+ modules;
867
842
  constructor(meta2, modules) {
868
- _define_property3(this, "meta", void 0);
869
- _define_property3(this, "modules", void 0);
870
843
  this.meta = meta2;
871
844
  this.modules = modules;
872
845
  }
@@ -884,7 +857,7 @@ var definePlugin = (meta2, provider) => {
884
857
  (function(Capabilities2) {
885
858
  Capabilities2.Null = defineCapability("dxos.org/app-framework/capability/null");
886
859
  Capabilities2.PluginManager = defineCapability("dxos.org/app-framework/capability/plugin-manager");
887
- Capabilities2.RxRegistry = defineCapability("dxos.org/app-framework/capability/rx-registry");
860
+ Capabilities2.AtomRegistry = defineCapability("dxos.org/app-framework/capability/atom-registry");
888
861
  Capabilities2.ReactContext = defineCapability("dxos.org/app-framework/capability/react-context");
889
862
  Capabilities2.ReactRoot = defineCapability("dxos.org/app-framework/capability/react-root");
890
863
  Capabilities2.ReactSurface = defineCapability("dxos.org/app-framework/common/react-surface");
@@ -899,7 +872,6 @@ var definePlugin = (meta2, provider) => {
899
872
  Capabilities2.Settings = defineCapability("dxos.org/app-framework/capability/settings");
900
873
  Capabilities2.Metadata = defineCapability("dxos.org/app-framework/capability/metadata");
901
874
  Capabilities2.Toolkit = defineCapability("dxos.org/app-framework/capability/ai-toolkit");
902
- Capabilities2.ToolkitHandler = defineCapability("dxos.org/app-framework/capability/ai-toolkit-handler");
903
875
  Capabilities2.BlueprintDefinition = defineCapability("dxos.org/app-framework/capability/blueprint-definition");
904
876
  Capabilities2.AiServiceLayer = defineCapability("dxos.org/app-framework/capability/ai-service-factory");
905
877
  Capabilities2.AiModelResolver = defineCapability("dxos.org/app-framework/capability/ai-model-resolver");
@@ -911,13 +883,13 @@ var Capabilities;
911
883
 
912
884
  // src/common/collaboration.ts
913
885
  import * as Schema from "effect/Schema";
914
- import { DataType } from "@dxos/schema";
886
+ import { ContentBlock } from "@dxos/types";
915
887
  (function(CollaborationActions2) {
916
888
  class AcceptProposal extends Schema.TaggedClass()("collaboration/accept-proposal", {
917
889
  input: Schema.Struct({
918
890
  subject: Schema.Any,
919
891
  anchor: Schema.String,
920
- proposal: DataType.MessageBlock.Proposal
892
+ proposal: ContentBlock.Proposal
921
893
  }),
922
894
  output: Schema.Void
923
895
  }) {
@@ -1051,31 +1023,20 @@ var meta = {
1051
1023
  var IntentAction;
1052
1024
 
1053
1025
  // src/plugin-intent/errors.ts
1054
- function _define_property4(obj, key, value2) {
1055
- if (key in obj) {
1056
- Object.defineProperty(obj, key, {
1057
- value: value2,
1058
- enumerable: true,
1059
- configurable: true,
1060
- writable: true
1061
- });
1062
- } else {
1063
- obj[key] = value2;
1064
- }
1065
- return obj;
1066
- }
1067
1026
  var BaseError = class extends Error {
1027
+ code;
1028
+ context;
1068
1029
  constructor(code, message, context) {
1069
1030
  super(message ?? code, {
1070
1031
  cause: context
1071
- }), _define_property4(this, "code", void 0), _define_property4(this, "context", void 0), this.code = code, this.context = context;
1032
+ }), this.code = code, this.context = context;
1072
1033
  this.name = code;
1073
1034
  Object.setPrototypeOf(this, new.target.prototype);
1074
1035
  }
1075
1036
  };
1076
1037
  var NoResolversError = class extends BaseError {
1077
1038
  constructor(action) {
1078
- super("NO_RESOLVERS", "No resolvers were found for the action", {
1039
+ super("NO_RESOLVERS", `No resolvers were found for the action: ${action}`, {
1079
1040
  action
1080
1041
  });
1081
1042
  }
@@ -1097,7 +1058,7 @@ var IntentPlugin = definePlugin(meta, () => [
1097
1058
  activatesAfter: [
1098
1059
  Events.DispatcherReady
1099
1060
  ],
1100
- activate: lazy(() => import("./intent-dispatcher-R4CCPBHO.mjs"))
1061
+ activate: lazy(() => import("./intent-dispatcher-MGOJ3CHD.mjs"))
1101
1062
  })
1102
1063
  ]);
1103
1064
 
@@ -1476,12 +1437,29 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1476
1437
  };
1477
1438
  });
1478
1439
  const dispatch = (intentChain, depth = 0) => {
1440
+ log3("dispatch", {
1441
+ intentChain: intentChain.all.map((i) => i.id),
1442
+ depth
1443
+ }, {
1444
+ F: __dxlog_file3,
1445
+ L: 212,
1446
+ S: void 0,
1447
+ C: (f, a) => f(...a)
1448
+ });
1479
1449
  return Effect3.gen(function* () {
1480
1450
  if (depth > executionLimit) {
1481
1451
  return yield* Effect3.fail(new CycleDetectedError());
1482
1452
  }
1483
1453
  const resultsRef = yield* Ref2.make([]);
1484
1454
  for (const intent of intentChain.all) {
1455
+ log3("processing", {
1456
+ intent
1457
+ }, {
1458
+ F: __dxlog_file3,
1459
+ L: 220,
1460
+ S: this,
1461
+ C: (f, a) => f(...a)
1462
+ });
1485
1463
  const { data: prev } = (yield* resultsRef.get)[0] ?? {};
1486
1464
  const result2 = yield* handleIntent({
1487
1465
  ...intent,
@@ -1490,6 +1468,15 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1490
1468
  ...prev
1491
1469
  }
1492
1470
  });
1471
+ log3("ok", {
1472
+ intent: intent.id,
1473
+ result: result2
1474
+ }, {
1475
+ F: __dxlog_file3,
1476
+ L: 223,
1477
+ S: this,
1478
+ C: (f, a) => f(...a)
1479
+ });
1493
1480
  yield* Ref2.update(resultsRef, (results2) => [
1494
1481
  result2,
1495
1482
  ...results2
@@ -1500,6 +1487,15 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1500
1487
  }
1501
1488
  }
1502
1489
  if (result2.error) {
1490
+ log3.error("failed", {
1491
+ intent: intent.id,
1492
+ error: result2.error
1493
+ }, {
1494
+ F: __dxlog_file3,
1495
+ L: 240,
1496
+ S: this,
1497
+ C: (f, a) => f(...a)
1498
+ });
1503
1499
  return yield* Effect3.fail(result2.error);
1504
1500
  }
1505
1501
  }
@@ -1520,6 +1516,15 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1520
1516
  message: result.undoable.message
1521
1517
  })), Effect3.catchSome((err) => err instanceof NoResolversError ? Option.some(Effect3.succeed(void 0)) : Option.none()));
1522
1518
  }
1519
+ log3("done", {
1520
+ intent: intentChain.all.map((i) => i.id),
1521
+ result: result.data
1522
+ }, {
1523
+ F: __dxlog_file3,
1524
+ L: 270,
1525
+ S: this,
1526
+ C: (f, a) => f(...a)
1527
+ });
1523
1528
  return result.data;
1524
1529
  });
1525
1530
  };
@@ -1529,7 +1534,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1529
1534
  })).catch((error) => {
1530
1535
  log3.catch(error, void 0, {
1531
1536
  F: __dxlog_file3,
1532
- L: 274,
1537
+ L: 279,
1533
1538
  S: void 0,
1534
1539
  C: (f, a) => f(...a)
1535
1540
  });
@@ -1645,4 +1650,4 @@ export {
1645
1650
  ResourceLanguage,
1646
1651
  Resource
1647
1652
  };
1648
- //# sourceMappingURL=chunk-7DNZQ6H2.mjs.map
1653
+ //# sourceMappingURL=chunk-XJZGUJ3H.mjs.map