@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
@@ -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,26 +131,26 @@ 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
- * @returns An Rx reference to the available capabilities.
144
+ * @returns An atom reference to the available capabilities.
116
145
  */
117
146
  capabilities(interfaceDef) {
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
- * @returns An Rx reference to the available capability.
153
+ * @returns An atom reference to the available capability.
125
154
  * @throws If no capability is found.
126
155
  */
127
156
  capability(interfaceDef) {
@@ -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.AtomRegistry = 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,31 +1021,20 @@ 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
  }
1073
1034
  };
1074
1035
  var NoResolversError = class extends BaseError {
1075
1036
  constructor(action) {
1076
- super("NO_RESOLVERS", "No resolvers were found for the action", {
1037
+ super("NO_RESOLVERS", `No resolvers were found for the action: ${action}`, {
1077
1038
  action
1078
1039
  });
1079
1040
  }
@@ -1095,7 +1056,7 @@ var IntentPlugin = definePlugin(meta, () => [
1095
1056
  activatesAfter: [
1096
1057
  Events.DispatcherReady
1097
1058
  ],
1098
- activate: lazy(() => import("./intent-dispatcher-Y4LZNOBC.mjs"))
1059
+ activate: lazy(() => import("./intent-dispatcher-LZ4AE66E.mjs"))
1099
1060
  })
1100
1061
  ]);
1101
1062
 
@@ -1474,12 +1435,29 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1474
1435
  };
1475
1436
  });
1476
1437
  const dispatch = (intentChain, depth = 0) => {
1438
+ log3("dispatch", {
1439
+ intentChain: intentChain.all.map((i) => i.id),
1440
+ depth
1441
+ }, {
1442
+ F: __dxlog_file3,
1443
+ L: 212,
1444
+ S: void 0,
1445
+ C: (f, a) => f(...a)
1446
+ });
1477
1447
  return Effect3.gen(function* () {
1478
1448
  if (depth > executionLimit) {
1479
1449
  return yield* Effect3.fail(new CycleDetectedError());
1480
1450
  }
1481
1451
  const resultsRef = yield* Ref2.make([]);
1482
1452
  for (const intent of intentChain.all) {
1453
+ log3("processing", {
1454
+ intent
1455
+ }, {
1456
+ F: __dxlog_file3,
1457
+ L: 220,
1458
+ S: this,
1459
+ C: (f, a) => f(...a)
1460
+ });
1483
1461
  const { data: prev } = (yield* resultsRef.get)[0] ?? {};
1484
1462
  const result2 = yield* handleIntent({
1485
1463
  ...intent,
@@ -1488,6 +1466,15 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1488
1466
  ...prev
1489
1467
  }
1490
1468
  });
1469
+ log3("ok", {
1470
+ intent: intent.id,
1471
+ result: result2
1472
+ }, {
1473
+ F: __dxlog_file3,
1474
+ L: 223,
1475
+ S: this,
1476
+ C: (f, a) => f(...a)
1477
+ });
1491
1478
  yield* Ref2.update(resultsRef, (results2) => [
1492
1479
  result2,
1493
1480
  ...results2
@@ -1498,6 +1485,15 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1498
1485
  }
1499
1486
  }
1500
1487
  if (result2.error) {
1488
+ log3.error("failed", {
1489
+ intent: intent.id,
1490
+ error: result2.error
1491
+ }, {
1492
+ F: __dxlog_file3,
1493
+ L: 240,
1494
+ S: this,
1495
+ C: (f, a) => f(...a)
1496
+ });
1501
1497
  return yield* Effect3.fail(result2.error);
1502
1498
  }
1503
1499
  }
@@ -1518,6 +1514,15 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1518
1514
  message: result.undoable.message
1519
1515
  })), Effect3.catchSome((err) => err instanceof NoResolversError ? Option.some(Effect3.succeed(void 0)) : Option.none()));
1520
1516
  }
1517
+ log3("done", {
1518
+ intent: intentChain.all.map((i) => i.id),
1519
+ result: result.data
1520
+ }, {
1521
+ F: __dxlog_file3,
1522
+ L: 270,
1523
+ S: this,
1524
+ C: (f, a) => f(...a)
1525
+ });
1521
1526
  return result.data;
1522
1527
  });
1523
1528
  };
@@ -1527,7 +1532,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1527
1532
  })).catch((error) => {
1528
1533
  log3.catch(error, void 0, {
1529
1534
  F: __dxlog_file3,
1530
- L: 274,
1535
+ L: 279,
1531
1536
  S: void 0,
1532
1537
  C: (f, a) => f(...a)
1533
1538
  });
@@ -1643,4 +1648,4 @@ export {
1643
1648
  ResourceLanguage,
1644
1649
  Resource
1645
1650
  };
1646
- //# sourceMappingURL=chunk-OKF2PAWO.mjs.map
1651
+ //# sourceMappingURL=chunk-WPW5VVAX.mjs.map