@dxos/app-framework 0.8.4-main.a4bbb77 → 0.8.4-main.ae835ea

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 (101) hide show
  1. package/dist/lib/browser/{app-graph-builder-XH4OYQLC.mjs → app-graph-builder-PSA3RESL.mjs} +9 -8
  2. package/dist/lib/browser/app-graph-builder-PSA3RESL.mjs.map +7 -0
  3. package/dist/lib/browser/{chunk-6V54SRFL.mjs → chunk-2VZ4RF4A.mjs} +202 -232
  4. package/dist/lib/browser/chunk-2VZ4RF4A.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-ZZVFNUHZ.mjs → chunk-CPVYIS24.mjs} +9 -25
  6. package/dist/lib/browser/chunk-CPVYIS24.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-RGKMLI6U.mjs → chunk-SCPE4ZO2.mjs} +2 -2
  8. package/dist/lib/browser/chunk-SCPE4ZO2.mjs.map +7 -0
  9. package/dist/lib/browser/index.mjs +6 -6
  10. package/dist/lib/browser/{intent-dispatcher-VFMJVO2M.mjs → intent-dispatcher-BND6IF4U.mjs} +2 -2
  11. package/dist/lib/browser/{intent-resolver-ICAPD4JL.mjs → intent-resolver-27FJAJDE.mjs} +5 -5
  12. package/dist/lib/browser/intent-resolver-27FJAJDE.mjs.map +7 -0
  13. package/dist/lib/browser/meta.json +1 -1
  14. package/dist/lib/browser/{store-7ZGMHOGB.mjs → store-F545UOIR.mjs} +2 -2
  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/browser/worker.mjs +1 -1
  18. package/dist/lib/node-esm/{app-graph-builder-C7H22SOL.mjs → app-graph-builder-VJGZ6KH7.mjs} +9 -8
  19. package/dist/lib/node-esm/app-graph-builder-VJGZ6KH7.mjs.map +7 -0
  20. package/dist/lib/node-esm/{chunk-SOVTUUAY.mjs → chunk-3RRWO5TD.mjs} +202 -232
  21. package/dist/lib/node-esm/chunk-3RRWO5TD.mjs.map +7 -0
  22. package/dist/lib/node-esm/{chunk-AXSZKZFD.mjs → chunk-MN37WUJ2.mjs} +9 -25
  23. package/dist/lib/node-esm/chunk-MN37WUJ2.mjs.map +7 -0
  24. package/dist/lib/node-esm/{chunk-LKPMRTRR.mjs → chunk-ZX63QUGE.mjs} +2 -2
  25. package/dist/lib/node-esm/chunk-ZX63QUGE.mjs.map +7 -0
  26. package/dist/lib/node-esm/index.mjs +6 -6
  27. package/dist/lib/node-esm/{intent-dispatcher-SAPOKSLZ.mjs → intent-dispatcher-254AZ6EE.mjs} +2 -2
  28. package/dist/lib/node-esm/{intent-resolver-CRNJ6BMD.mjs → intent-resolver-NPMOPNFL.mjs} +5 -5
  29. package/dist/lib/node-esm/intent-resolver-NPMOPNFL.mjs.map +7 -0
  30. package/dist/lib/node-esm/meta.json +1 -1
  31. package/dist/lib/node-esm/{store-H4F4RMYD.mjs → store-CINC4R4L.mjs} +2 -2
  32. package/dist/lib/node-esm/testing/index.mjs +5 -4
  33. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  34. package/dist/lib/node-esm/worker.mjs +1 -1
  35. package/dist/types/src/common/capabilities.d.ts +7 -4
  36. package/dist/types/src/common/capabilities.d.ts.map +1 -1
  37. package/dist/types/src/common/collaboration.d.ts +1 -1
  38. package/dist/types/src/common/collaboration.d.ts.map +1 -1
  39. package/dist/types/src/common/file.d.ts +1 -1
  40. package/dist/types/src/common/file.d.ts.map +1 -1
  41. package/dist/types/src/common/layout.d.ts +1 -1
  42. package/dist/types/src/common/layout.d.ts.map +1 -1
  43. package/dist/types/src/common/translations.d.ts +1 -1
  44. package/dist/types/src/common/translations.d.ts.map +1 -1
  45. package/dist/types/src/core/capabilities.d.ts +4 -4
  46. package/dist/types/src/core/capabilities.d.ts.map +1 -1
  47. package/dist/types/src/core/manager.d.ts.map +1 -1
  48. package/dist/types/src/core/plugin.d.ts +4 -0
  49. package/dist/types/src/core/plugin.d.ts.map +1 -1
  50. package/dist/types/src/playground/logger/schema.d.ts +1 -1
  51. package/dist/types/src/playground/logger/schema.d.ts.map +1 -1
  52. package/dist/types/src/plugin-intent/actions.d.ts +1 -1
  53. package/dist/types/src/plugin-intent/actions.d.ts.map +1 -1
  54. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +4 -4
  55. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +1 -1
  56. package/dist/types/src/plugin-intent/intent.d.ts +1 -1
  57. package/dist/types/src/plugin-intent/intent.d.ts.map +1 -1
  58. package/dist/types/src/plugin-settings/actions.d.ts +1 -1
  59. package/dist/types/src/plugin-settings/actions.d.ts.map +1 -1
  60. package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +1 -1
  61. package/dist/types/src/testing/withPluginManager.d.ts +3 -2
  62. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  63. package/dist/types/tsconfig.tsbuildinfo +1 -1
  64. package/package.json +23 -23
  65. package/src/common/capabilities.ts +7 -4
  66. package/src/common/collaboration.ts +1 -1
  67. package/src/common/file.ts +1 -1
  68. package/src/common/layout.ts +1 -1
  69. package/src/common/translations.ts +1 -1
  70. package/src/core/capabilities.test.ts +1 -1
  71. package/src/core/capabilities.ts +10 -6
  72. package/src/core/manager.test.ts +1 -1
  73. package/src/core/manager.ts +12 -5
  74. package/src/core/plugin.ts +5 -0
  75. package/src/playground/generator/generator.ts +1 -1
  76. package/src/playground/logger/schema.ts +1 -1
  77. package/src/plugin-intent/actions.ts +1 -1
  78. package/src/plugin-intent/errors.ts +1 -1
  79. package/src/plugin-intent/intent-dispatcher.test.ts +10 -3
  80. package/src/plugin-intent/intent-dispatcher.ts +8 -5
  81. package/src/plugin-intent/intent.ts +1 -1
  82. package/src/plugin-settings/actions.ts +1 -1
  83. package/src/plugin-settings/app-graph-builder.ts +6 -5
  84. package/src/plugin-settings/intent-resolver.ts +2 -2
  85. package/src/react/ErrorBoundary.tsx +8 -6
  86. package/src/testing/withPluginManager.tsx +8 -3
  87. package/tsconfig.json +1 -1
  88. package/dist/lib/browser/app-graph-builder-XH4OYQLC.mjs.map +0 -7
  89. package/dist/lib/browser/chunk-6V54SRFL.mjs.map +0 -7
  90. package/dist/lib/browser/chunk-RGKMLI6U.mjs.map +0 -7
  91. package/dist/lib/browser/chunk-ZZVFNUHZ.mjs.map +0 -7
  92. package/dist/lib/browser/intent-resolver-ICAPD4JL.mjs.map +0 -7
  93. package/dist/lib/node-esm/app-graph-builder-C7H22SOL.mjs.map +0 -7
  94. package/dist/lib/node-esm/chunk-AXSZKZFD.mjs.map +0 -7
  95. package/dist/lib/node-esm/chunk-LKPMRTRR.mjs.map +0 -7
  96. package/dist/lib/node-esm/chunk-SOVTUUAY.mjs.map +0 -7
  97. package/dist/lib/node-esm/intent-resolver-CRNJ6BMD.mjs.map +0 -7
  98. /package/dist/lib/browser/{intent-dispatcher-VFMJVO2M.mjs.map → intent-dispatcher-BND6IF4U.mjs.map} +0 -0
  99. /package/dist/lib/browser/{store-7ZGMHOGB.mjs.map → store-F545UOIR.mjs.map} +0 -0
  100. /package/dist/lib/node-esm/{intent-dispatcher-SAPOKSLZ.mjs.map → intent-dispatcher-254AZ6EE.mjs.map} +0 -0
  101. /package/dist/lib/node-esm/{store-H4F4RMYD.mjs.map → store-CINC4R4L.mjs.map} +0 -0
@@ -1,30 +1,20 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
2
 
3
3
  // src/plugin-intent/intent-dispatcher.ts
4
- import { Effect as Effect3, Option, Ref as Ref2, pipe as pipe2 } from "effect";
4
+ import * as Effect3 from "effect/Effect";
5
+ import * as Function2 from "effect/Function";
6
+ import * as Option from "effect/Option";
7
+ import * as Ref2 from "effect/Ref";
5
8
  import { live as live2 } from "@dxos/live-object";
6
9
  import { log as log3 } from "@dxos/log";
7
10
  import { byPosition } from "@dxos/util";
8
11
 
9
12
  // src/core/capabilities.ts
10
13
  import { Rx } from "@effect-rx/rx-react";
11
- import { Effect } from "effect";
14
+ import * as Effect from "effect/Effect";
12
15
  import { Trigger } from "@dxos/async";
13
16
  import { invariant } from "@dxos/invariant";
14
17
  import { log } from "@dxos/log";
15
- function _define_property(obj, key, value) {
16
- if (key in obj) {
17
- Object.defineProperty(obj, key, {
18
- value,
19
- enumerable: true,
20
- configurable: true,
21
- writable: true
22
- });
23
- } else {
24
- obj[key] = value;
25
- }
26
- return obj;
27
- }
28
18
  var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/capabilities.ts";
29
19
  var InterfaceDefTypeId = Symbol.for("InterfaceDefTypeId");
30
20
  var defineCapability = (identifier) => {
@@ -33,9 +23,9 @@ var defineCapability = (identifier) => {
33
23
  };
34
24
  };
35
25
  var CapabilityImpl = class {
26
+ moduleId;
27
+ implementation;
36
28
  constructor(moduleId, implementation) {
37
- _define_property(this, "moduleId", void 0);
38
- _define_property(this, "implementation", void 0);
39
29
  this.moduleId = moduleId;
40
30
  this.implementation = implementation;
41
31
  }
@@ -52,6 +42,48 @@ var lazy = (c) => async (props) => {
52
42
  return async () => getCapability(props);
53
43
  };
54
44
  var PluginContext = class {
45
+ _registry;
46
+ _capabilityImpls = Rx.family(() => {
47
+ return Rx.make([]).pipe(Rx.keepAlive);
48
+ });
49
+ _capabilities = Rx.family((id) => {
50
+ return Rx.make((get) => {
51
+ const current = get(this._capabilityImpls(id));
52
+ return current.map((c) => c.implementation);
53
+ });
54
+ });
55
+ _capability = Rx.family((id) => {
56
+ return Rx.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
+ }
55
87
  /**
56
88
  * @internal
57
89
  */
@@ -71,7 +103,7 @@ var PluginContext = class {
71
103
  count: current.length
72
104
  }, {
73
105
  F: __dxlog_file,
74
- L: 166,
106
+ L: 170,
75
107
  S: this,
76
108
  C: (f, a) => f(...a)
77
109
  });
@@ -92,7 +124,7 @@ var PluginContext = class {
92
124
  count: current.length
93
125
  }, {
94
126
  F: __dxlog_file,
95
- L: 185,
127
+ L: 189,
96
128
  S: this,
97
129
  C: (f, a) => f(...a)
98
130
  });
@@ -101,7 +133,7 @@ var PluginContext = class {
101
133
  id: interfaceDef.identifier
102
134
  }, {
103
135
  F: __dxlog_file,
104
- L: 187,
136
+ L: 191,
105
137
  S: this,
106
138
  C: (f, a) => f(...a)
107
139
  });
@@ -166,38 +198,6 @@ var PluginContext = class {
166
198
  async resetPromise(event) {
167
199
  return this.reset(event).pipe(Effect.runPromise);
168
200
  }
169
- constructor({ registry, activate, reset }) {
170
- _define_property(this, "_registry", void 0);
171
- _define_property(this, "_capabilityImpls", Rx.family(() => {
172
- return Rx.make([]).pipe(Rx.keepAlive);
173
- }));
174
- _define_property(this, "_capabilities", Rx.family((id) => {
175
- return Rx.make((get) => {
176
- const current = get(this._capabilityImpls(id));
177
- return current.map((c) => c.implementation);
178
- });
179
- }));
180
- _define_property(this, "_capability", Rx.family((id) => {
181
- return Rx.make((get) => {
182
- const current = get(this._capabilities(id));
183
- invariant(current.length > 0, `No capability found for ${id}`, {
184
- F: __dxlog_file,
185
- L: 122,
186
- S: this,
187
- A: [
188
- "current.length > 0",
189
- "`No capability found for ${id}`"
190
- ]
191
- });
192
- return current[0];
193
- });
194
- }));
195
- _define_property(this, "activate", void 0);
196
- _define_property(this, "reset", void 0);
197
- this._registry = registry;
198
- this.activate = activate;
199
- this.reset = reset;
200
- }
201
201
  };
202
202
 
203
203
  // src/core/events.ts
@@ -225,28 +225,53 @@ var getEvents = (events) => "type" in events ? events.events : [
225
225
  // src/core/manager.ts
226
226
  import { Registry } from "@effect-rx/rx-react";
227
227
  import { untracked } from "@preact/signals-core";
228
- import { Array, Duration, Effect as Effect2, Fiber, HashSet, Match, Ref, pipe } from "effect";
228
+ import * as Array from "effect/Array";
229
+ import * as Duration from "effect/Duration";
230
+ import * as Effect2 from "effect/Effect";
231
+ import * as Fiber from "effect/Fiber";
232
+ import * as Function from "effect/Function";
233
+ import * as HashSet from "effect/HashSet";
234
+ import * as Match from "effect/Match";
235
+ import * as Ref from "effect/Ref";
229
236
  import { Event } from "@dxos/async";
230
237
  import { live } from "@dxos/live-object";
231
238
  import { log as log2 } from "@dxos/log";
232
- function _define_property2(obj, key, value) {
233
- if (key in obj) {
234
- Object.defineProperty(obj, key, {
235
- value,
236
- enumerable: true,
237
- configurable: true,
238
- writable: true
239
- });
240
- } else {
241
- obj[key] = value;
242
- }
243
- return obj;
244
- }
245
239
  var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/manager.ts";
246
- var isPromise = (value) => {
247
- return value !== null && typeof value === "object" && "then" in value;
240
+ var isPromise = (value2) => {
241
+ return value2 !== null && typeof value2 === "object" && "then" in value2;
248
242
  };
249
243
  var PluginManager = class {
244
+ activation = new Event();
245
+ context;
246
+ registry;
247
+ // TODO(wittjosiah): Replace with Rx.
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
+ }
250
275
  /**
251
276
  * Plugins that are currently registered.
252
277
  *
@@ -313,7 +338,7 @@ var PluginManager = class {
313
338
  id
314
339
  }, {
315
340
  F: __dxlog_file2,
316
- L: 157,
341
+ L: 164,
317
342
  S: this,
318
343
  C: (f, a) => f(...a)
319
344
  });
@@ -332,7 +357,7 @@ var PluginManager = class {
332
357
  id
333
358
  }, {
334
359
  F: __dxlog_file2,
335
- L: 170,
360
+ L: 177,
336
361
  S: this,
337
362
  C: (f, a) => f(...a)
338
363
  });
@@ -353,7 +378,7 @@ var PluginManager = class {
353
378
  ]
354
379
  }, {
355
380
  F: __dxlog_file2,
356
- L: 185,
381
+ L: 192,
357
382
  S: this,
358
383
  C: (f, a) => f(...a)
359
384
  });
@@ -373,7 +398,7 @@ var PluginManager = class {
373
398
  id
374
399
  }, {
375
400
  F: __dxlog_file2,
376
- L: 203,
401
+ L: 210,
377
402
  S: this,
378
403
  C: (f, a) => f(...a)
379
404
  });
@@ -395,7 +420,7 @@ var PluginManager = class {
395
420
  id
396
421
  }, {
397
422
  F: __dxlog_file2,
398
- L: 220,
423
+ L: 227,
399
424
  S: this,
400
425
  C: (f, a) => f(...a)
401
426
  });
@@ -447,7 +472,7 @@ var PluginManager = class {
447
472
  id: plugin.meta.id
448
473
  }, {
449
474
  F: __dxlog_file2,
450
- L: 273,
475
+ L: 280,
451
476
  S: this,
452
477
  C: (f, a) => f(...a)
453
478
  });
@@ -462,7 +487,7 @@ var PluginManager = class {
462
487
  id
463
488
  }, {
464
489
  F: __dxlog_file2,
465
- L: 283,
490
+ L: 290,
466
491
  S: this,
467
492
  C: (f, a) => f(...a)
468
493
  });
@@ -478,7 +503,7 @@ var PluginManager = class {
478
503
  id: module.id
479
504
  }, {
480
505
  F: __dxlog_file2,
481
- L: 293,
506
+ L: 300,
482
507
  S: this,
483
508
  C: (f, a) => f(...a)
484
509
  });
@@ -493,7 +518,7 @@ var PluginManager = class {
493
518
  id
494
519
  }, {
495
520
  F: __dxlog_file2,
496
- L: 303,
521
+ L: 310,
497
522
  S: this,
498
523
  C: (f, a) => f(...a)
499
524
  });
@@ -527,7 +552,7 @@ var PluginManager = class {
527
552
  events: pendingReset
528
553
  }, {
529
554
  F: __dxlog_file2,
530
- L: 341,
555
+ L: 348,
531
556
  S: this,
532
557
  C: (f, a) => f(...a)
533
558
  });
@@ -547,7 +572,7 @@ var PluginManager = class {
547
572
  ...params
548
573
  }, {
549
574
  F: __dxlog_file2,
550
- L: 357,
575
+ L: 364,
551
576
  S: this,
552
577
  C: (f, a) => f(...a)
553
578
  });
@@ -572,7 +597,7 @@ var PluginManager = class {
572
597
  key
573
598
  }, {
574
599
  F: __dxlog_file2,
575
- L: 388,
600
+ L: 395,
576
601
  S: this,
577
602
  C: (f, a) => f(...a)
578
603
  });
@@ -586,7 +611,7 @@ var PluginManager = class {
586
611
  modules: modules.map((module) => module.id)
587
612
  }, {
588
613
  F: __dxlog_file2,
589
- L: 395,
614
+ L: 402,
590
615
  S: this,
591
616
  C: (f, a) => f(...a)
592
617
  });
@@ -594,12 +619,12 @@ var PluginManager = class {
594
619
  event: key,
595
620
  state: "activating"
596
621
  });
597
- yield* pipe(modules, Array.flatMap((module) => module.activatesBefore ?? []), HashSet.fromIterable, HashSet.toValues, Array.filter((event2) => !activatingEvents.includes(eventKey(event2))), Array.map((event2) => this._activate(event2, {
622
+ yield* Function.pipe(modules, Array.flatMap((module) => module.activatesBefore ?? []), HashSet.fromIterable, HashSet.toValues, Array.filter((event2) => !activatingEvents.includes(eventKey(event2))), Array.map((event2) => this._activate(event2, {
598
623
  before: key
599
624
  })), Effect2.allWith({
600
625
  concurrency: "unbounded"
601
626
  }));
602
- const getCapabilities = yield* pipe(modules, Array.map((mod) => this._loadModule(mod)), Effect2.allWith({
627
+ const getCapabilities = yield* Function.pipe(modules, Array.map((mod) => this._loadModule(mod)), Effect2.allWith({
603
628
  concurrency: "unbounded"
604
629
  }), Effect2.catchAll((error) => {
605
630
  this.activation.emit({
@@ -609,15 +634,13 @@ var PluginManager = class {
609
634
  });
610
635
  return Effect2.fail(error);
611
636
  }));
612
- yield* pipe(
637
+ yield* Function.pipe(
613
638
  modules,
614
639
  Array.zip(getCapabilities),
615
640
  Array.map(([module, capabilities]) => this._contributeCapabilities(module, capabilities)),
616
- // TODO(wittjosiah): This currently can't be run in parallel.
617
- // Running this with concurrency causes races with `allOf` activation events.
618
641
  Effect2.all
619
642
  );
620
- yield* pipe(modules, Array.flatMap((module) => module.activatesAfter ?? []), HashSet.fromIterable, HashSet.toValues, Array.filter((event2) => !activatingEvents.includes(eventKey(event2))), Array.map((event2) => this._activate(event2, {
643
+ yield* Function.pipe(modules, Array.flatMap((module) => module.activatesAfter ?? []), HashSet.fromIterable, HashSet.toValues, Array.filter((event2) => !activatingEvents.includes(eventKey(event2))), Array.map((event2) => this._activate(event2, {
621
644
  after: key
622
645
  })), Effect2.allWith({
623
646
  concurrency: "unbounded"
@@ -635,13 +658,74 @@ var PluginManager = class {
635
658
  key
636
659
  }, {
637
660
  F: __dxlog_file2,
638
- L: 451,
661
+ L: 458,
639
662
  S: this,
640
663
  C: (f, a) => f(...a)
641
664
  });
642
665
  return true;
643
666
  });
644
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
+ }))))));
645
729
  _contributeCapabilities(module, capabilities) {
646
730
  return Effect2.gen(this, function* () {
647
731
  capabilities.forEach((capability) => {
@@ -674,7 +758,7 @@ var PluginManager = class {
674
758
  id
675
759
  }, {
676
760
  F: __dxlog_file2,
677
- L: 533,
761
+ L: 540,
678
762
  S: this,
679
763
  C: (f, a) => f(...a)
680
764
  });
@@ -684,8 +768,8 @@ var PluginManager = class {
684
768
  for (const capability of capabilities) {
685
769
  this.context.removeCapability(capability.interface, capability.implementation);
686
770
  const program = capability.deactivate?.();
687
- yield* Match.value(program).pipe(Match.when(Effect2.isEffect, (effect) => effect), Match.when(isPromise, (promise) => Effect2.tryPromise({
688
- try: () => promise,
771
+ yield* Match.value(program).pipe(Match.when(Effect2.isEffect, (effect) => effect), Match.when(isPromise, (promise2) => Effect2.tryPromise({
772
+ try: () => promise2,
689
773
  catch: (error) => error
690
774
  })), Match.orElse((program2) => Effect2.succeed(program2)));
691
775
  }
@@ -699,7 +783,7 @@ var PluginManager = class {
699
783
  id
700
784
  }, {
701
785
  F: __dxlog_file2,
702
- L: 560,
786
+ L: 567,
703
787
  S: this,
704
788
  C: (f, a) => f(...a)
705
789
  });
@@ -713,7 +797,7 @@ var PluginManager = class {
713
797
  key
714
798
  }, {
715
799
  F: __dxlog_file2,
716
- L: 568,
800
+ L: 575,
717
801
  S: this,
718
802
  C: (f, a) => f(...a)
719
803
  });
@@ -728,96 +812,6 @@ var PluginManager = class {
728
812
  }
729
813
  });
730
814
  }
731
- constructor({ pluginLoader, plugins = [], core = plugins.map(({ meta: meta2 }) => meta2.id), enabled = [], registry }) {
732
- _define_property2(this, "activation", new Event());
733
- _define_property2(this, "context", void 0);
734
- _define_property2(this, "registry", void 0);
735
- _define_property2(this, "_state", void 0);
736
- _define_property2(this, "_pluginLoader", void 0);
737
- _define_property2(this, "_capabilities", /* @__PURE__ */ new Map());
738
- _define_property2(this, "_moduleMemoMap", /* @__PURE__ */ new Map());
739
- _define_property2(this, "_activatingEvents", Effect2.runSync(Ref.make([])));
740
- _define_property2(this, "_activatingModules", Effect2.runSync(Ref.make([])));
741
- _define_property2(this, "_loadModule", (mod) => Effect2.tryPromise({
742
- try: async () => {
743
- const entry = this._moduleMemoMap.get(mod.id);
744
- if (entry) {
745
- return entry;
746
- }
747
- const promise = (async () => {
748
- const start = performance.now();
749
- let failed = false;
750
- try {
751
- log2("loading module", {
752
- module: mod.id
753
- }, {
754
- F: __dxlog_file2,
755
- L: 470,
756
- S: this,
757
- C: (f, a) => f(...a)
758
- });
759
- let activationResult = await mod.activate(this.context);
760
- if (typeof activationResult === "function") {
761
- activationResult = await activationResult();
762
- }
763
- return Array.isArray(activationResult) ? activationResult : [
764
- activationResult
765
- ];
766
- } catch (error) {
767
- failed = true;
768
- throw error;
769
- } finally {
770
- performance.measure("activate-module", {
771
- start,
772
- end: performance.now(),
773
- detail: {
774
- module: mod.id
775
- }
776
- });
777
- log2("loaded module", {
778
- module: mod.id,
779
- elapsed: performance.now() - start,
780
- failed
781
- }, {
782
- F: __dxlog_file2,
783
- L: 488,
784
- S: this,
785
- C: (f, a) => f(...a)
786
- });
787
- }
788
- })();
789
- this._moduleMemoMap.set(mod.id, promise);
790
- return promise;
791
- },
792
- catch: (error) => error
793
- }).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`, {
794
- module: mod.id
795
- }, {
796
- F: __dxlog_file2,
797
- L: 499,
798
- S: this,
799
- C: (f, a) => f(...a)
800
- })))))));
801
- this.registry = registry ?? Registry.make();
802
- this.context = new PluginContext({
803
- registry: this.registry,
804
- activate: (event) => this._activate(event),
805
- reset: (id) => this._reset(id)
806
- });
807
- this._pluginLoader = pluginLoader;
808
- this._state = live({
809
- plugins,
810
- core,
811
- enabled,
812
- modules: [],
813
- active: [],
814
- eventsFired: [],
815
- pendingReset: []
816
- });
817
- plugins.forEach((plugin) => this._addPlugin(plugin));
818
- core.forEach((id) => this.enable(id));
819
- enabled.forEach((id) => this.enable(id));
820
- }
821
815
  };
822
816
  var together = (togetherEffect) => (effect) => Effect2.gen(function* () {
823
817
  const togetherFiber = yield* Effect2.fork(togetherEffect);
@@ -827,26 +821,13 @@ var together = (togetherEffect) => (effect) => Effect2.gen(function* () {
827
821
  });
828
822
 
829
823
  // src/core/plugin.ts
830
- function _define_property3(obj, key, value) {
831
- if (key in obj) {
832
- Object.defineProperty(obj, key, {
833
- value,
834
- enumerable: true,
835
- configurable: true,
836
- writable: true
837
- });
838
- } else {
839
- obj[key] = value;
840
- }
841
- return obj;
842
- }
843
824
  var PluginModule = class {
825
+ id;
826
+ activatesOn;
827
+ activatesBefore;
828
+ activatesAfter;
829
+ activate;
844
830
  constructor(options) {
845
- _define_property3(this, "id", void 0);
846
- _define_property3(this, "activatesOn", void 0);
847
- _define_property3(this, "activatesBefore", void 0);
848
- _define_property3(this, "activatesAfter", void 0);
849
- _define_property3(this, "activate", void 0);
850
831
  this.id = options.id;
851
832
  this.activatesOn = options.activatesOn;
852
833
  this.activatesBefore = options.activatesBefore;
@@ -856,9 +837,9 @@ var PluginModule = class {
856
837
  };
857
838
  var defineModule = (options) => new PluginModule(options);
858
839
  var Plugin = class {
840
+ meta;
841
+ modules;
859
842
  constructor(meta2, modules) {
860
- _define_property3(this, "meta", void 0);
861
- _define_property3(this, "modules", void 0);
862
843
  this.meta = meta2;
863
844
  this.modules = modules;
864
845
  }
@@ -902,7 +883,7 @@ var definePlugin = (meta2, provider) => {
902
883
  var Capabilities;
903
884
 
904
885
  // src/common/collaboration.ts
905
- import { Schema } from "effect";
886
+ import * as Schema from "effect/Schema";
906
887
  import { DataType } from "@dxos/schema";
907
888
  (function(CollaborationActions2) {
908
889
  class AcceptProposal extends Schema.TaggedClass()("collaboration/accept-proposal", {
@@ -937,7 +918,7 @@ var CollaborationActions;
937
918
  var Events;
938
919
 
939
920
  // src/common/file.ts
940
- import { Schema as Schema2 } from "effect";
921
+ import * as Schema2 from "effect/Schema";
941
922
  var defaultFileTypes = {
942
923
  images: [
943
924
  "png",
@@ -965,13 +946,13 @@ var FileInfoSchema = Schema2.Struct({
965
946
  });
966
947
 
967
948
  // src/common/layout.ts
968
- import { Schema as Schema5 } from "effect";
949
+ import * as Schema5 from "effect/Schema";
969
950
 
970
951
  // src/plugin-intent/actions.ts
971
- import { Schema as Schema4 } from "effect";
952
+ import * as Schema4 from "effect/Schema";
972
953
 
973
954
  // src/plugin-intent/intent.ts
974
- import { Schema as Schema3 } from "effect";
955
+ import * as Schema3 from "effect/Schema";
975
956
  var createIntent = (schema, data = {}, params = {}) => {
976
957
  const _ = Schema3.validateSync(schema.fields.input)(data);
977
958
  const intent = {
@@ -1043,31 +1024,20 @@ var meta = {
1043
1024
  var IntentAction;
1044
1025
 
1045
1026
  // src/plugin-intent/errors.ts
1046
- function _define_property4(obj, key, value) {
1047
- if (key in obj) {
1048
- Object.defineProperty(obj, key, {
1049
- value,
1050
- enumerable: true,
1051
- configurable: true,
1052
- writable: true
1053
- });
1054
- } else {
1055
- obj[key] = value;
1056
- }
1057
- return obj;
1058
- }
1059
1027
  var BaseError = class extends Error {
1028
+ code;
1029
+ context;
1060
1030
  constructor(code, message, context) {
1061
1031
  super(message ?? code, {
1062
1032
  cause: context
1063
- }), _define_property4(this, "code", void 0), _define_property4(this, "context", void 0), this.code = code, this.context = context;
1033
+ }), this.code = code, this.context = context;
1064
1034
  this.name = code;
1065
1035
  Object.setPrototypeOf(this, new.target.prototype);
1066
1036
  }
1067
1037
  };
1068
1038
  var NoResolversError = class extends BaseError {
1069
1039
  constructor(action) {
1070
- super("NO_RESOLVERS", "No resolvers were found for the action", {
1040
+ super("NO_RESOLVERS", `No resolvers were found for the action: ${action}`, {
1071
1041
  action
1072
1042
  });
1073
1043
  }
@@ -1089,7 +1059,7 @@ var IntentPlugin = definePlugin(meta, () => [
1089
1059
  activatesAfter: [
1090
1060
  Events.DispatcherReady
1091
1061
  ],
1092
- activate: lazy(() => import("./intent-dispatcher-SAPOKSLZ.mjs"))
1062
+ activate: lazy(() => import("./intent-dispatcher-254AZ6EE.mjs"))
1093
1063
  })
1094
1064
  ]);
1095
1065
 
@@ -1433,7 +1403,7 @@ var LayoutAction;
1433
1403
  var createSurface = (definition) => definition;
1434
1404
 
1435
1405
  // src/common/translations.ts
1436
- import { Schema as Schema6 } from "effect";
1406
+ import * as Schema6 from "effect/Schema";
1437
1407
  var ResourceKey = Schema6.Union(Schema6.String, Schema6.Record({
1438
1408
  key: Schema6.String,
1439
1409
  value: Schema6.Any
@@ -1508,7 +1478,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1508
1478
  return next;
1509
1479
  });
1510
1480
  if (result.undoable && isUndoable(results)) {
1511
- yield* pipe2(dispatch(createIntent(IntentAction.ShowUndo, {
1481
+ yield* Function2.pipe(dispatch(createIntent(IntentAction.ShowUndo, {
1512
1482
  message: result.undoable.message
1513
1483
  })), Effect3.catchSome((err) => err instanceof NoResolversError ? Option.some(Effect3.succeed(void 0)) : Option.none()));
1514
1484
  }
@@ -1521,7 +1491,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1521
1491
  })).catch((error) => {
1522
1492
  log3.catch(error, void 0, {
1523
1493
  F: __dxlog_file3,
1524
- L: 271,
1494
+ L: 274,
1525
1495
  S: void 0,
1526
1496
  C: (f, a) => f(...a)
1527
1497
  });
@@ -1536,7 +1506,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1536
1506
  const last = history.findLastIndex(isUndoable);
1537
1507
  const result = last !== -1 ? history[last] : void 0;
1538
1508
  if (result) {
1539
- const all = result.map(({ _intent, undoable }) => {
1509
+ const all2 = result.map(({ _intent, undoable }) => {
1540
1510
  const data = _intent.data;
1541
1511
  const undoData = undoable?.data ?? {};
1542
1512
  return {
@@ -1549,9 +1519,9 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1549
1519
  };
1550
1520
  });
1551
1521
  const intent = {
1552
- first: all[0],
1553
- last: all.at(-1),
1554
- all
1522
+ first: all2[0],
1523
+ last: all2.at(-1),
1524
+ all: all2
1555
1525
  };
1556
1526
  yield* Ref2.update(historyRef, (h) => h.filter((_, index) => index !== last));
1557
1527
  return yield* dispatch(intent);
@@ -1637,4 +1607,4 @@ export {
1637
1607
  ResourceLanguage,
1638
1608
  Resource
1639
1609
  };
1640
- //# sourceMappingURL=chunk-SOVTUUAY.mjs.map
1610
+ //# sourceMappingURL=chunk-3RRWO5TD.mjs.map