@dxos/app-framework 0.8.4-main.dedc0f3 → 0.8.4-main.ead640a

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 (157) hide show
  1. package/.storybook/main.mts +11 -0
  2. package/.storybook/preview.mts +8 -0
  3. package/dist/lib/browser/{app-graph-builder-AFFC6VB2.mjs → app-graph-builder-LG4RG2LM.mjs} +30 -29
  4. package/dist/lib/browser/app-graph-builder-LG4RG2LM.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-OZY7HV2A.mjs → chunk-2GRQ4QXA.mjs} +96 -93
  6. package/dist/lib/browser/chunk-2GRQ4QXA.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-T6M7JB7M.mjs → chunk-FRUTKCPG.mjs} +16 -20
  8. package/dist/lib/browser/chunk-FRUTKCPG.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-ORWHM7CO.mjs → chunk-SCPE4ZO2.mjs} +11 -8
  10. package/dist/lib/browser/chunk-SCPE4ZO2.mjs.map +7 -0
  11. package/dist/lib/browser/index.mjs +14 -28
  12. package/dist/lib/browser/index.mjs.map +3 -3
  13. package/dist/lib/browser/{intent-dispatcher-QG7UPGQX.mjs → intent-dispatcher-6SHA5B3N.mjs} +2 -2
  14. package/dist/lib/browser/{intent-resolver-4S4PSTM5.mjs → intent-resolver-UZZ4OANZ.mjs} +7 -7
  15. package/dist/lib/browser/intent-resolver-UZZ4OANZ.mjs.map +7 -0
  16. package/dist/lib/browser/meta.json +1 -1
  17. package/dist/lib/browser/{store-6E33KLGK.mjs → store-ACBEYK4B.mjs} +4 -4
  18. package/dist/lib/browser/{store-6E33KLGK.mjs.map → store-ACBEYK4B.mjs.map} +1 -1
  19. package/dist/lib/browser/testing/index.mjs +11 -14
  20. package/dist/lib/browser/testing/index.mjs.map +3 -3
  21. package/dist/lib/browser/worker.mjs +1 -9
  22. package/dist/lib/node-esm/{app-graph-builder-S4OAULX5.mjs → app-graph-builder-FMHVHPWA.mjs} +30 -29
  23. package/dist/lib/node-esm/app-graph-builder-FMHVHPWA.mjs.map +7 -0
  24. package/dist/lib/node-esm/{chunk-HJFU7QOR.mjs → chunk-CXT6CYPE.mjs} +16 -20
  25. package/dist/lib/node-esm/chunk-CXT6CYPE.mjs.map +7 -0
  26. package/dist/lib/node-esm/{chunk-F63ZRXMK.mjs → chunk-KSPOOYT3.mjs} +96 -93
  27. package/dist/lib/node-esm/chunk-KSPOOYT3.mjs.map +7 -0
  28. package/dist/lib/node-esm/{chunk-UMZQERLE.mjs → chunk-ZX63QUGE.mjs} +11 -8
  29. package/dist/lib/node-esm/chunk-ZX63QUGE.mjs.map +7 -0
  30. package/dist/lib/node-esm/index.mjs +14 -28
  31. package/dist/lib/node-esm/index.mjs.map +3 -3
  32. package/dist/lib/node-esm/{intent-dispatcher-NXBGPJOX.mjs → intent-dispatcher-SIYQ5ZIU.mjs} +2 -2
  33. package/dist/lib/node-esm/{intent-resolver-2ZKXI5ET.mjs → intent-resolver-7FYJMXAG.mjs} +7 -7
  34. package/dist/lib/node-esm/intent-resolver-7FYJMXAG.mjs.map +7 -0
  35. package/dist/lib/node-esm/meta.json +1 -1
  36. package/dist/lib/node-esm/{store-QQUTQHHT.mjs → store-6OBLTVXC.mjs} +4 -4
  37. package/dist/lib/node-esm/{store-QQUTQHHT.mjs.map → store-6OBLTVXC.mjs.map} +1 -1
  38. package/dist/lib/node-esm/testing/index.mjs +11 -14
  39. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  40. package/dist/lib/node-esm/worker.mjs +1 -9
  41. package/dist/types/src/common/capabilities.d.ts +14 -4
  42. package/dist/types/src/common/capabilities.d.ts.map +1 -1
  43. package/dist/types/src/common/collaboration.d.ts +1 -1
  44. package/dist/types/src/common/collaboration.d.ts.map +1 -1
  45. package/dist/types/src/common/file.d.ts +1 -1
  46. package/dist/types/src/common/file.d.ts.map +1 -1
  47. package/dist/types/src/common/layout.d.ts +1 -3
  48. package/dist/types/src/common/layout.d.ts.map +1 -1
  49. package/dist/types/src/common/surface.d.ts +7 -13
  50. package/dist/types/src/common/surface.d.ts.map +1 -1
  51. package/dist/types/src/common/translations.d.ts +1 -1
  52. package/dist/types/src/common/translations.d.ts.map +1 -1
  53. package/dist/types/src/components/App.stories.d.ts +0 -1
  54. package/dist/types/src/components/App.stories.d.ts.map +1 -1
  55. package/dist/types/src/components/useApp.d.ts.map +1 -1
  56. package/dist/types/src/core/capabilities.d.ts +1 -1
  57. package/dist/types/src/core/capabilities.d.ts.map +1 -1
  58. package/dist/types/src/core/manager.d.ts.map +1 -1
  59. package/dist/types/src/core/plugin.d.ts +4 -1
  60. package/dist/types/src/core/plugin.d.ts.map +1 -1
  61. package/dist/types/src/playground/debug/plugin.d.ts +1 -1
  62. package/dist/types/src/playground/debug/plugin.d.ts.map +1 -1
  63. package/dist/types/src/playground/generator/generator.d.ts +1 -1
  64. package/dist/types/src/playground/generator/generator.d.ts.map +1 -1
  65. package/dist/types/src/playground/generator/plugin.d.ts +1 -1
  66. package/dist/types/src/playground/generator/plugin.d.ts.map +1 -1
  67. package/dist/types/src/playground/layout/plugin.d.ts +1 -1
  68. package/dist/types/src/playground/layout/plugin.d.ts.map +1 -1
  69. package/dist/types/src/playground/logger/plugin.d.ts +1 -1
  70. package/dist/types/src/playground/logger/plugin.d.ts.map +1 -1
  71. package/dist/types/src/playground/logger/schema.d.ts +1 -1
  72. package/dist/types/src/playground/logger/schema.d.ts.map +1 -1
  73. package/dist/types/src/playground/playground.stories.d.ts +0 -1
  74. package/dist/types/src/playground/playground.stories.d.ts.map +1 -1
  75. package/dist/types/src/plugin-intent/IntentPlugin.d.ts +1 -1
  76. package/dist/types/src/plugin-intent/IntentPlugin.d.ts.map +1 -1
  77. package/dist/types/src/plugin-intent/actions.d.ts +5 -7
  78. package/dist/types/src/plugin-intent/actions.d.ts.map +1 -1
  79. package/dist/types/src/plugin-intent/errors.d.ts.map +1 -1
  80. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +4 -4
  81. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +1 -1
  82. package/dist/types/src/plugin-intent/intent.d.ts +1 -1
  83. package/dist/types/src/plugin-intent/intent.d.ts.map +1 -1
  84. package/dist/types/src/plugin-intent/meta.d.ts +3 -0
  85. package/dist/types/src/plugin-intent/meta.d.ts.map +1 -0
  86. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +1 -1
  87. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +1 -1
  88. package/dist/types/src/plugin-settings/actions.d.ts +5 -7
  89. package/dist/types/src/plugin-settings/actions.d.ts.map +1 -1
  90. package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +1 -1
  91. package/dist/types/src/plugin-settings/meta.d.ts +3 -0
  92. package/dist/types/src/plugin-settings/meta.d.ts.map +1 -0
  93. package/dist/types/src/plugin-settings/translations.d.ts +2 -1
  94. package/dist/types/src/plugin-settings/translations.d.ts.map +1 -1
  95. package/dist/types/src/react/ErrorBoundary.d.ts +2 -2
  96. package/dist/types/src/react/ErrorBoundary.d.ts.map +1 -1
  97. package/dist/types/src/react/Surface.d.ts +2 -2
  98. package/dist/types/src/react/Surface.d.ts.map +1 -1
  99. package/dist/types/src/react/Surface.stories.d.ts +0 -1
  100. package/dist/types/src/react/Surface.stories.d.ts.map +1 -1
  101. package/dist/types/src/testing/withPluginManager.d.ts +2 -4
  102. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  103. package/dist/types/tsconfig.tsbuildinfo +1 -1
  104. package/moon.yml +4 -0
  105. package/package.json +31 -30
  106. package/src/common/capabilities.ts +22 -4
  107. package/src/common/collaboration.ts +1 -1
  108. package/src/common/file.ts +1 -1
  109. package/src/common/layout.ts +3 -4
  110. package/src/common/surface.ts +15 -18
  111. package/src/common/translations.ts +1 -1
  112. package/src/components/App.stories.tsx +1 -3
  113. package/src/components/useApp.tsx +9 -11
  114. package/src/core/capabilities.test.ts +1 -1
  115. package/src/core/capabilities.ts +1 -1
  116. package/src/core/manager.test.ts +19 -19
  117. package/src/core/manager.ts +12 -5
  118. package/src/core/plugin.ts +8 -2
  119. package/src/playground/debug/plugin.ts +7 -8
  120. package/src/playground/generator/generator.ts +2 -2
  121. package/src/playground/generator/plugin.ts +12 -13
  122. package/src/playground/layout/plugin.ts +9 -8
  123. package/src/playground/logger/plugin.ts +27 -23
  124. package/src/playground/logger/schema.ts +1 -1
  125. package/src/playground/playground.stories.tsx +5 -6
  126. package/src/plugin-intent/IntentPlugin.ts +12 -13
  127. package/src/plugin-intent/actions.ts +4 -6
  128. package/src/plugin-intent/errors.ts +2 -1
  129. package/src/plugin-intent/intent-dispatcher.test.ts +10 -3
  130. package/src/plugin-intent/intent-dispatcher.ts +8 -6
  131. package/src/plugin-intent/intent.ts +1 -1
  132. package/src/plugin-intent/meta.ts +10 -0
  133. package/src/plugin-settings/SettingsPlugin.ts +25 -27
  134. package/src/plugin-settings/actions.ts +9 -13
  135. package/src/plugin-settings/app-graph-builder.ts +17 -15
  136. package/src/plugin-settings/intent-resolver.ts +2 -2
  137. package/src/plugin-settings/meta.ts +10 -0
  138. package/src/plugin-settings/translations.ts +3 -3
  139. package/src/react/ErrorBoundary.tsx +10 -8
  140. package/src/react/Surface.stories.tsx +2 -5
  141. package/src/react/Surface.tsx +11 -3
  142. package/src/testing/withPluginManager.stories.tsx +1 -1
  143. package/src/testing/withPluginManager.tsx +13 -17
  144. package/tsconfig.json +1 -1
  145. package/vitest.config.ts +8 -6
  146. package/dist/lib/browser/app-graph-builder-AFFC6VB2.mjs.map +0 -7
  147. package/dist/lib/browser/chunk-ORWHM7CO.mjs.map +0 -7
  148. package/dist/lib/browser/chunk-OZY7HV2A.mjs.map +0 -7
  149. package/dist/lib/browser/chunk-T6M7JB7M.mjs.map +0 -7
  150. package/dist/lib/browser/intent-resolver-4S4PSTM5.mjs.map +0 -7
  151. package/dist/lib/node-esm/app-graph-builder-S4OAULX5.mjs.map +0 -7
  152. package/dist/lib/node-esm/chunk-F63ZRXMK.mjs.map +0 -7
  153. package/dist/lib/node-esm/chunk-HJFU7QOR.mjs.map +0 -7
  154. package/dist/lib/node-esm/chunk-UMZQERLE.mjs.map +0 -7
  155. package/dist/lib/node-esm/intent-resolver-2ZKXI5ET.mjs.map +0 -7
  156. /package/dist/lib/browser/{intent-dispatcher-QG7UPGQX.mjs.map → intent-dispatcher-6SHA5B3N.mjs.map} +0 -0
  157. /package/dist/lib/node-esm/{intent-dispatcher-NXBGPJOX.mjs.map → intent-dispatcher-SIYQ5ZIU.mjs.map} +0 -0
@@ -1,25 +1,28 @@
1
1
  // src/plugin-intent/intent-dispatcher.ts
2
- import { Effect as Effect3, Option, Ref as Ref2, pipe as pipe2 } from "effect";
2
+ import * as Effect3 from "effect/Effect";
3
+ import * as Function2 from "effect/Function";
4
+ import * as Option from "effect/Option";
5
+ import * as Ref2 from "effect/Ref";
3
6
  import { live as live2 } from "@dxos/live-object";
4
7
  import { log as log3 } from "@dxos/log";
5
8
  import { byPosition } from "@dxos/util";
6
9
 
7
10
  // src/core/capabilities.ts
8
11
  import { Rx } from "@effect-rx/rx-react";
9
- import { Effect } from "effect";
12
+ import * as Effect from "effect/Effect";
10
13
  import { Trigger } from "@dxos/async";
11
14
  import { invariant } from "@dxos/invariant";
12
15
  import { log } from "@dxos/log";
13
- function _define_property(obj, key, value) {
16
+ function _define_property(obj, key, value2) {
14
17
  if (key in obj) {
15
18
  Object.defineProperty(obj, key, {
16
- value,
19
+ value: value2,
17
20
  enumerable: true,
18
21
  configurable: true,
19
22
  writable: true
20
23
  });
21
24
  } else {
22
- obj[key] = value;
25
+ obj[key] = value2;
23
26
  }
24
27
  return obj;
25
28
  }
@@ -223,26 +226,33 @@ var getEvents = (events) => "type" in events ? events.events : [
223
226
  // src/core/manager.ts
224
227
  import { Registry } from "@effect-rx/rx-react";
225
228
  import { untracked } from "@preact/signals-core";
226
- import { Array, Duration, Effect as Effect2, Fiber, HashSet, Match, Ref, pipe } from "effect";
229
+ import * as Array from "effect/Array";
230
+ import * as Duration from "effect/Duration";
231
+ import * as Effect2 from "effect/Effect";
232
+ import * as Fiber from "effect/Fiber";
233
+ import * as Function from "effect/Function";
234
+ import * as HashSet from "effect/HashSet";
235
+ import * as Match from "effect/Match";
236
+ import * as Ref from "effect/Ref";
227
237
  import { Event } from "@dxos/async";
228
238
  import { live } from "@dxos/live-object";
229
239
  import { log as log2 } from "@dxos/log";
230
- function _define_property2(obj, key, value) {
240
+ function _define_property2(obj, key, value2) {
231
241
  if (key in obj) {
232
242
  Object.defineProperty(obj, key, {
233
- value,
243
+ value: value2,
234
244
  enumerable: true,
235
245
  configurable: true,
236
246
  writable: true
237
247
  });
238
248
  } else {
239
- obj[key] = value;
249
+ obj[key] = value2;
240
250
  }
241
251
  return obj;
242
252
  }
243
253
  var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/manager.ts";
244
- var isPromise = (value) => {
245
- return value !== null && typeof value === "object" && "then" in value;
254
+ var isPromise = (value2) => {
255
+ return value2 !== null && typeof value2 === "object" && "then" in value2;
246
256
  };
247
257
  var PluginManager = class {
248
258
  /**
@@ -311,7 +321,7 @@ var PluginManager = class {
311
321
  id
312
322
  }, {
313
323
  F: __dxlog_file2,
314
- L: 157,
324
+ L: 164,
315
325
  S: this,
316
326
  C: (f, a) => f(...a)
317
327
  });
@@ -330,7 +340,7 @@ var PluginManager = class {
330
340
  id
331
341
  }, {
332
342
  F: __dxlog_file2,
333
- L: 170,
343
+ L: 177,
334
344
  S: this,
335
345
  C: (f, a) => f(...a)
336
346
  });
@@ -351,7 +361,7 @@ var PluginManager = class {
351
361
  ]
352
362
  }, {
353
363
  F: __dxlog_file2,
354
- L: 185,
364
+ L: 192,
355
365
  S: this,
356
366
  C: (f, a) => f(...a)
357
367
  });
@@ -371,7 +381,7 @@ var PluginManager = class {
371
381
  id
372
382
  }, {
373
383
  F: __dxlog_file2,
374
- L: 203,
384
+ L: 210,
375
385
  S: this,
376
386
  C: (f, a) => f(...a)
377
387
  });
@@ -393,7 +403,7 @@ var PluginManager = class {
393
403
  id
394
404
  }, {
395
405
  F: __dxlog_file2,
396
- L: 220,
406
+ L: 227,
397
407
  S: this,
398
408
  C: (f, a) => f(...a)
399
409
  });
@@ -445,7 +455,7 @@ var PluginManager = class {
445
455
  id: plugin.meta.id
446
456
  }, {
447
457
  F: __dxlog_file2,
448
- L: 273,
458
+ L: 280,
449
459
  S: this,
450
460
  C: (f, a) => f(...a)
451
461
  });
@@ -460,7 +470,7 @@ var PluginManager = class {
460
470
  id
461
471
  }, {
462
472
  F: __dxlog_file2,
463
- L: 283,
473
+ L: 290,
464
474
  S: this,
465
475
  C: (f, a) => f(...a)
466
476
  });
@@ -476,7 +486,7 @@ var PluginManager = class {
476
486
  id: module.id
477
487
  }, {
478
488
  F: __dxlog_file2,
479
- L: 293,
489
+ L: 300,
480
490
  S: this,
481
491
  C: (f, a) => f(...a)
482
492
  });
@@ -491,7 +501,7 @@ var PluginManager = class {
491
501
  id
492
502
  }, {
493
503
  F: __dxlog_file2,
494
- L: 303,
504
+ L: 310,
495
505
  S: this,
496
506
  C: (f, a) => f(...a)
497
507
  });
@@ -525,7 +535,7 @@ var PluginManager = class {
525
535
  events: pendingReset
526
536
  }, {
527
537
  F: __dxlog_file2,
528
- L: 341,
538
+ L: 348,
529
539
  S: this,
530
540
  C: (f, a) => f(...a)
531
541
  });
@@ -545,7 +555,7 @@ var PluginManager = class {
545
555
  ...params
546
556
  }, {
547
557
  F: __dxlog_file2,
548
- L: 357,
558
+ L: 364,
549
559
  S: this,
550
560
  C: (f, a) => f(...a)
551
561
  });
@@ -570,7 +580,7 @@ var PluginManager = class {
570
580
  key
571
581
  }, {
572
582
  F: __dxlog_file2,
573
- L: 388,
583
+ L: 395,
574
584
  S: this,
575
585
  C: (f, a) => f(...a)
576
586
  });
@@ -584,7 +594,7 @@ var PluginManager = class {
584
594
  modules: modules.map((module) => module.id)
585
595
  }, {
586
596
  F: __dxlog_file2,
587
- L: 395,
597
+ L: 402,
588
598
  S: this,
589
599
  C: (f, a) => f(...a)
590
600
  });
@@ -592,12 +602,12 @@ var PluginManager = class {
592
602
  event: key,
593
603
  state: "activating"
594
604
  });
595
- 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, {
605
+ 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, {
596
606
  before: key
597
607
  })), Effect2.allWith({
598
608
  concurrency: "unbounded"
599
609
  }));
600
- const getCapabilities = yield* pipe(modules, Array.map((mod) => this._loadModule(mod)), Effect2.allWith({
610
+ const getCapabilities = yield* Function.pipe(modules, Array.map((mod) => this._loadModule(mod)), Effect2.allWith({
601
611
  concurrency: "unbounded"
602
612
  }), Effect2.catchAll((error) => {
603
613
  this.activation.emit({
@@ -607,15 +617,13 @@ var PluginManager = class {
607
617
  });
608
618
  return Effect2.fail(error);
609
619
  }));
610
- yield* pipe(
620
+ yield* Function.pipe(
611
621
  modules,
612
622
  Array.zip(getCapabilities),
613
623
  Array.map(([module, capabilities]) => this._contributeCapabilities(module, capabilities)),
614
- // TODO(wittjosiah): This currently can't be run in parallel.
615
- // Running this with concurrency causes races with `allOf` activation events.
616
624
  Effect2.all
617
625
  );
618
- 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, {
626
+ 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, {
619
627
  after: key
620
628
  })), Effect2.allWith({
621
629
  concurrency: "unbounded"
@@ -633,7 +641,7 @@ var PluginManager = class {
633
641
  key
634
642
  }, {
635
643
  F: __dxlog_file2,
636
- L: 451,
644
+ L: 458,
637
645
  S: this,
638
646
  C: (f, a) => f(...a)
639
647
  });
@@ -672,7 +680,7 @@ var PluginManager = class {
672
680
  id
673
681
  }, {
674
682
  F: __dxlog_file2,
675
- L: 533,
683
+ L: 540,
676
684
  S: this,
677
685
  C: (f, a) => f(...a)
678
686
  });
@@ -682,8 +690,8 @@ var PluginManager = class {
682
690
  for (const capability of capabilities) {
683
691
  this.context.removeCapability(capability.interface, capability.implementation);
684
692
  const program = capability.deactivate?.();
685
- yield* Match.value(program).pipe(Match.when(Effect2.isEffect, (effect) => effect), Match.when(isPromise, (promise) => Effect2.tryPromise({
686
- try: () => promise,
693
+ yield* Match.value(program).pipe(Match.when(Effect2.isEffect, (effect) => effect), Match.when(isPromise, (promise2) => Effect2.tryPromise({
694
+ try: () => promise2,
687
695
  catch: (error) => error
688
696
  })), Match.orElse((program2) => Effect2.succeed(program2)));
689
697
  }
@@ -697,7 +705,7 @@ var PluginManager = class {
697
705
  id
698
706
  }, {
699
707
  F: __dxlog_file2,
700
- L: 560,
708
+ L: 567,
701
709
  S: this,
702
710
  C: (f, a) => f(...a)
703
711
  });
@@ -711,7 +719,7 @@ var PluginManager = class {
711
719
  key
712
720
  }, {
713
721
  F: __dxlog_file2,
714
- L: 568,
722
+ L: 575,
715
723
  S: this,
716
724
  C: (f, a) => f(...a)
717
725
  });
@@ -726,7 +734,7 @@ var PluginManager = class {
726
734
  }
727
735
  });
728
736
  }
729
- constructor({ pluginLoader, plugins = [], core = plugins.map(({ meta }) => meta.id), enabled = [], registry }) {
737
+ constructor({ pluginLoader, plugins = [], core = plugins.map(({ meta: meta2 }) => meta2.id), enabled = [], registry }) {
730
738
  _define_property2(this, "activation", new Event());
731
739
  _define_property2(this, "context", void 0);
732
740
  _define_property2(this, "registry", void 0);
@@ -742,7 +750,7 @@ var PluginManager = class {
742
750
  if (entry) {
743
751
  return entry;
744
752
  }
745
- const promise = (async () => {
753
+ const promise2 = (async () => {
746
754
  const start = performance.now();
747
755
  let failed = false;
748
756
  try {
@@ -750,7 +758,7 @@ var PluginManager = class {
750
758
  module: mod.id
751
759
  }, {
752
760
  F: __dxlog_file2,
753
- L: 470,
761
+ L: 477,
754
762
  S: this,
755
763
  C: (f, a) => f(...a)
756
764
  });
@@ -778,21 +786,21 @@ var PluginManager = class {
778
786
  failed
779
787
  }, {
780
788
  F: __dxlog_file2,
781
- L: 488,
789
+ L: 495,
782
790
  S: this,
783
791
  C: (f, a) => f(...a)
784
792
  });
785
793
  }
786
794
  })();
787
- this._moduleMemoMap.set(mod.id, promise);
788
- return promise;
795
+ this._moduleMemoMap.set(mod.id, promise2);
796
+ return promise2;
789
797
  },
790
798
  catch: (error) => error
791
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`, {
792
800
  module: mod.id
793
801
  }, {
794
802
  F: __dxlog_file2,
795
- L: 499,
803
+ L: 506,
796
804
  S: this,
797
805
  C: (f, a) => f(...a)
798
806
  })))))));
@@ -825,16 +833,16 @@ var together = (togetherEffect) => (effect) => Effect2.gen(function* () {
825
833
  });
826
834
 
827
835
  // src/core/plugin.ts
828
- function _define_property3(obj, key, value) {
836
+ function _define_property3(obj, key, value2) {
829
837
  if (key in obj) {
830
838
  Object.defineProperty(obj, key, {
831
- value,
839
+ value: value2,
832
840
  enumerable: true,
833
841
  configurable: true,
834
842
  writable: true
835
843
  });
836
844
  } else {
837
- obj[key] = value;
845
+ obj[key] = value2;
838
846
  }
839
847
  return obj;
840
848
  }
@@ -854,15 +862,20 @@ var PluginModule = class {
854
862
  };
855
863
  var defineModule = (options) => new PluginModule(options);
856
864
  var Plugin = class {
857
- constructor(meta, modules) {
865
+ constructor(meta2, modules) {
858
866
  _define_property3(this, "meta", void 0);
859
867
  _define_property3(this, "modules", void 0);
860
- this.meta = meta;
868
+ this.meta = meta2;
861
869
  this.modules = modules;
862
870
  }
863
871
  };
864
- var definePlugin = (meta, modules) => {
865
- return new Plugin(meta, modules);
872
+ var definePlugin = (meta2, provider) => {
873
+ const factory = (args) => {
874
+ return new Plugin(meta2, provider(args));
875
+ };
876
+ return Object.assign(factory, {
877
+ meta: meta2
878
+ });
866
879
  };
867
880
 
868
881
  // src/common/capabilities.ts
@@ -886,6 +899,8 @@ var definePlugin = (meta, modules) => {
886
899
  Capabilities2.Toolkit = defineCapability("dxos.org/app-framework/capability/ai-toolkit");
887
900
  Capabilities2.ToolkitHandler = defineCapability("dxos.org/app-framework/capability/ai-toolkit-handler");
888
901
  Capabilities2.BlueprintDefinition = defineCapability("dxos.org/app-framework/capability/blueprint-definition");
902
+ Capabilities2.AiServiceLayer = defineCapability("dxos.org/app-framework/capability/ai-service-factory");
903
+ Capabilities2.AiModelResolver = defineCapability("dxos.org/app-framework/capability/ai-model-resolver");
889
904
  Capabilities2.Functions = defineCapability("dxos.org/app-framework/capability/functions");
890
905
  Capabilities2.FileUploader = defineCapability("dxos.org/app-framework/capability/file-uploader");
891
906
  Capabilities2.AnchorSort = defineCapability("dxos.org/app-framework/capability/anchor-sort");
@@ -893,7 +908,7 @@ var definePlugin = (meta, modules) => {
893
908
  var Capabilities;
894
909
 
895
910
  // src/common/collaboration.ts
896
- import { Schema } from "effect";
911
+ import * as Schema from "effect/Schema";
897
912
  import { DataType } from "@dxos/schema";
898
913
  (function(CollaborationActions2) {
899
914
  class AcceptProposal extends Schema.TaggedClass()("collaboration/accept-proposal", {
@@ -928,7 +943,7 @@ var CollaborationActions;
928
943
  var Events;
929
944
 
930
945
  // src/common/file.ts
931
- import { Schema as Schema2 } from "effect";
946
+ import * as Schema2 from "effect/Schema";
932
947
  var defaultFileTypes = {
933
948
  images: [
934
949
  "png",
@@ -956,13 +971,13 @@ var FileInfoSchema = Schema2.Struct({
956
971
  });
957
972
 
958
973
  // src/common/layout.ts
959
- import { Schema as Schema5 } from "effect";
974
+ import * as Schema5 from "effect/Schema";
960
975
 
961
976
  // src/plugin-intent/actions.ts
962
- import { Schema as Schema4 } from "effect";
977
+ import * as Schema4 from "effect/Schema";
963
978
 
964
979
  // src/plugin-intent/intent.ts
965
- import { Schema as Schema3 } from "effect";
980
+ import * as Schema3 from "effect/Schema";
966
981
  var createIntent = (schema, data = {}, params = {}) => {
967
982
  const _ = Schema3.validateSync(schema.fields.input)(data);
968
983
  const intent = {
@@ -1005,11 +1020,15 @@ var Label = Schema3.Union(Schema3.String, Schema3.mutable(Schema3.Tuple(Schema3.
1005
1020
  defaultValue: Schema3.optional(Schema3.String)
1006
1021
  })))));
1007
1022
 
1023
+ // src/plugin-intent/meta.ts
1024
+ var meta = {
1025
+ id: "dxos.org/plugin/intent",
1026
+ name: "Intent"
1027
+ };
1028
+
1008
1029
  // src/plugin-intent/actions.ts
1009
- var INTENT_PLUGIN = "dxos.org/plugin/intent";
1010
- var INTENT_ACTION = `${INTENT_PLUGIN}/action`;
1011
1030
  (function(IntentAction2) {
1012
- class Track extends Schema4.TaggedClass()(`${INTENT_ACTION}/track`, {
1031
+ class Track extends Schema4.TaggedClass()(`${meta.id}/action/track`, {
1013
1032
  input: Schema4.Struct({
1014
1033
  intents: Schema4.Array(Schema4.String),
1015
1034
  error: Schema4.optional(Schema4.String)
@@ -1018,7 +1037,7 @@ var INTENT_ACTION = `${INTENT_PLUGIN}/action`;
1018
1037
  }) {
1019
1038
  }
1020
1039
  IntentAction2.Track = Track;
1021
- class ShowUndo extends Schema4.TaggedClass()(`${INTENT_ACTION}/show-undo`, {
1040
+ class ShowUndo extends Schema4.TaggedClass()(`${meta.id}/action/show-undo`, {
1022
1041
  input: Schema4.Struct({
1023
1042
  message: Label
1024
1043
  }),
@@ -1030,16 +1049,16 @@ var INTENT_ACTION = `${INTENT_PLUGIN}/action`;
1030
1049
  var IntentAction;
1031
1050
 
1032
1051
  // src/plugin-intent/errors.ts
1033
- function _define_property4(obj, key, value) {
1052
+ function _define_property4(obj, key, value2) {
1034
1053
  if (key in obj) {
1035
1054
  Object.defineProperty(obj, key, {
1036
- value,
1055
+ value: value2,
1037
1056
  enumerable: true,
1038
1057
  configurable: true,
1039
1058
  writable: true
1040
1059
  });
1041
1060
  } else {
1042
- obj[key] = value;
1061
+ obj[key] = value2;
1043
1062
  }
1044
1063
  return obj;
1045
1064
  }
@@ -1054,7 +1073,7 @@ var BaseError = class extends Error {
1054
1073
  };
1055
1074
  var NoResolversError = class extends BaseError {
1056
1075
  constructor(action) {
1057
- super("NO_RESOLVERS", "No resolvers were found for the action", {
1076
+ super("NO_RESOLVERS", `No resolvers were found for the action: ${action}`, {
1058
1077
  action
1059
1078
  });
1060
1079
  }
@@ -1066,12 +1085,9 @@ var CycleDetectedError = class extends BaseError {
1066
1085
  };
1067
1086
 
1068
1087
  // src/plugin-intent/IntentPlugin.ts
1069
- var IntentPlugin = () => definePlugin({
1070
- id: INTENT_PLUGIN,
1071
- name: "Intent"
1072
- }, [
1088
+ var IntentPlugin = definePlugin(meta, () => [
1073
1089
  defineModule({
1074
- id: `${INTENT_PLUGIN}/module/dispatcher`,
1090
+ id: `${meta.id}/module/dispatcher`,
1075
1091
  // TODO(wittjosiah): This will mean that startup needs to be reset when intents are added or removed.
1076
1092
  // This is fine for now because it's how it worked prior to capabilities api anyways.
1077
1093
  // In the future, the intent dispatcher should be able to be reset without resetting the entire app.
@@ -1079,15 +1095,14 @@ var IntentPlugin = () => definePlugin({
1079
1095
  activatesAfter: [
1080
1096
  Events.DispatcherReady
1081
1097
  ],
1082
- activate: lazy(() => import("./intent-dispatcher-QG7UPGQX.mjs"))
1098
+ activate: lazy(() => import("./intent-dispatcher-6SHA5B3N.mjs"))
1083
1099
  })
1084
1100
  ]);
1085
1101
 
1086
1102
  // src/common/layout.ts
1087
1103
  var LAYOUT_PLUGIN = "dxos.org/plugin/layout";
1088
- var LAYOUT_ACTION = `${LAYOUT_PLUGIN}/action`;
1089
1104
  (function(LayoutAction2) {
1090
- LayoutAction2.UPDATE_LAYOUT = `${LAYOUT_ACTION}/update-layout`;
1105
+ LayoutAction2.UPDATE_LAYOUT = `${LAYOUT_PLUGIN}/action/update-layout`;
1091
1106
  class UpdateLayout extends Schema5.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
1092
1107
  input: Schema5.Struct({
1093
1108
  part: Schema5.String.annotations({
@@ -1424,7 +1439,7 @@ var LayoutAction;
1424
1439
  var createSurface = (definition) => definition;
1425
1440
 
1426
1441
  // src/common/translations.ts
1427
- import { Schema as Schema6 } from "effect";
1442
+ import * as Schema6 from "effect/Schema";
1428
1443
  var ResourceKey = Schema6.Union(Schema6.String, Schema6.Record({
1429
1444
  key: Schema6.String,
1430
1445
  value: Schema6.Any
@@ -1449,14 +1464,6 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1449
1464
  const handleIntent = (intent) => Effect3.gen(function* () {
1450
1465
  const candidates = getResolvers().filter((resolver) => resolver.intent._tag === intent.id).filter((resolver) => !resolver.filter || resolver.filter(intent.data)).toSorted(byPosition);
1451
1466
  if (candidates.length === 0) {
1452
- log3.info("no resolvers found", {
1453
- intent: intent.id
1454
- }, {
1455
- F: __dxlog_file3,
1456
- L: 200,
1457
- S: this,
1458
- C: (f, a) => f(...a)
1459
- });
1460
1467
  return yield* Effect3.fail(new NoResolversError(intent.id));
1461
1468
  }
1462
1469
  const effect = candidates[0].resolve(intent.data, intent.undo ?? false);
@@ -1507,7 +1514,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1507
1514
  return next;
1508
1515
  });
1509
1516
  if (result.undoable && isUndoable(results)) {
1510
- yield* pipe2(dispatch(createIntent(IntentAction.ShowUndo, {
1517
+ yield* Function2.pipe(dispatch(createIntent(IntentAction.ShowUndo, {
1511
1518
  message: result.undoable.message
1512
1519
  })), Effect3.catchSome((err) => err instanceof NoResolversError ? Option.some(Effect3.succeed(void 0)) : Option.none()));
1513
1520
  }
@@ -1520,7 +1527,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1520
1527
  })).catch((error) => {
1521
1528
  log3.catch(error, void 0, {
1522
1529
  F: __dxlog_file3,
1523
- L: 272,
1530
+ L: 274,
1524
1531
  S: void 0,
1525
1532
  C: (f, a) => f(...a)
1526
1533
  });
@@ -1535,7 +1542,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1535
1542
  const last = history.findLastIndex(isUndoable);
1536
1543
  const result = last !== -1 ? history[last] : void 0;
1537
1544
  if (result) {
1538
- const all = result.map(({ _intent, undoable }) => {
1545
+ const all2 = result.map(({ _intent, undoable }) => {
1539
1546
  const data = _intent.data;
1540
1547
  const undoData = undoable?.data ?? {};
1541
1548
  return {
@@ -1548,9 +1555,9 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1548
1555
  };
1549
1556
  });
1550
1557
  const intent = {
1551
- first: all[0],
1552
- last: all.at(-1),
1553
- all
1558
+ first: all2[0],
1559
+ last: all2.at(-1),
1560
+ all: all2
1554
1561
  };
1555
1562
  yield* Ref2.update(historyRef, (h) => h.filter((_, index) => index !== last));
1556
1563
  return yield* dispatch(intent);
@@ -1573,7 +1580,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1573
1580
  };
1574
1581
  var defaultEffect = () => Effect3.fail(new Error("Intent runtime not ready"));
1575
1582
  var defaultPromise = () => Effect3.runPromise(defaultEffect());
1576
- var intent_dispatcher_default = (context) => {
1583
+ var intent_dispatcher_default = ((context) => {
1577
1584
  const state = live2({
1578
1585
  dispatch: defaultEffect,
1579
1586
  dispatchPromise: defaultPromise,
@@ -1595,7 +1602,7 @@ var intent_dispatcher_default = (context) => {
1595
1602
  state.undo = undo;
1596
1603
  state.undoPromise = undoPromise;
1597
1604
  return contributes(Capabilities.IntentDispatcher, state);
1598
- };
1605
+ });
1599
1606
 
1600
1607
  export {
1601
1608
  defineCapability,
@@ -1622,8 +1629,6 @@ export {
1622
1629
  createIntent,
1623
1630
  chain,
1624
1631
  Label,
1625
- INTENT_PLUGIN,
1626
- INTENT_ACTION,
1627
1632
  IntentAction,
1628
1633
  BaseError,
1629
1634
  NoResolversError,
@@ -1632,12 +1637,10 @@ export {
1632
1637
  createDispatcher,
1633
1638
  intent_dispatcher_default,
1634
1639
  IntentPlugin,
1635
- LAYOUT_PLUGIN,
1636
- LAYOUT_ACTION,
1637
1640
  LayoutAction,
1638
1641
  createSurface,
1639
1642
  ResourceKey,
1640
1643
  ResourceLanguage,
1641
1644
  Resource
1642
1645
  };
1643
- //# sourceMappingURL=chunk-OZY7HV2A.mjs.map
1646
+ //# sourceMappingURL=chunk-2GRQ4QXA.mjs.map