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

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 (153) hide show
  1. package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
  2. package/.swc/plugins/{v7_linux_x86_64_13.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429 → linux_x86_64_19.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429.wasmer-v7} +0 -0
  3. package/dist/lib/browser/{app-graph-builder-LYF7EKNN.mjs → app-graph-builder-AFFC6VB2.mjs} +3 -3
  4. package/dist/lib/browser/app-graph-builder-AFFC6VB2.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-FMN65HSW.mjs → chunk-OZY7HV2A.mjs} +376 -252
  6. package/dist/lib/browser/chunk-OZY7HV2A.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-FO2PH7M3.mjs → chunk-T6M7JB7M.mjs} +186 -130
  8. package/dist/lib/browser/chunk-T6M7JB7M.mjs.map +7 -0
  9. package/dist/lib/browser/index.mjs +11 -5
  10. package/dist/lib/browser/index.mjs.map +2 -2
  11. package/dist/lib/browser/{intent-dispatcher-LSYQZSEB.mjs → intent-dispatcher-QG7UPGQX.mjs} +2 -2
  12. package/dist/lib/browser/{intent-resolver-ZTNOSO3A.mjs → intent-resolver-4S4PSTM5.mjs} +2 -2
  13. package/dist/lib/browser/intent-resolver-4S4PSTM5.mjs.map +7 -0
  14. package/dist/lib/browser/meta.json +1 -1
  15. package/dist/lib/browser/{store-KML2R4IE.mjs → store-6E33KLGK.mjs} +2 -2
  16. package/dist/lib/browser/{store-KML2R4IE.mjs.map → store-6E33KLGK.mjs.map} +1 -1
  17. package/dist/lib/browser/testing/index.mjs +5 -7
  18. package/dist/lib/browser/testing/index.mjs.map +3 -3
  19. package/dist/lib/browser/worker.mjs +7 -1
  20. package/dist/lib/node-esm/{app-graph-builder-SAOWGJDK.mjs → app-graph-builder-S4OAULX5.mjs} +3 -3
  21. package/dist/lib/node-esm/app-graph-builder-S4OAULX5.mjs.map +7 -0
  22. package/dist/lib/node-esm/{chunk-ZEZ4FVEU.mjs → chunk-F63ZRXMK.mjs} +376 -252
  23. package/dist/lib/node-esm/chunk-F63ZRXMK.mjs.map +7 -0
  24. package/dist/lib/node-esm/{chunk-73HGSHKE.mjs → chunk-HJFU7QOR.mjs} +186 -130
  25. package/dist/lib/node-esm/chunk-HJFU7QOR.mjs.map +7 -0
  26. package/dist/lib/node-esm/index.mjs +11 -5
  27. package/dist/lib/node-esm/index.mjs.map +2 -2
  28. package/dist/lib/node-esm/{intent-dispatcher-6CYNGPSW.mjs → intent-dispatcher-NXBGPJOX.mjs} +2 -2
  29. package/dist/lib/node-esm/{intent-resolver-W7Z7WFFM.mjs → intent-resolver-2ZKXI5ET.mjs} +2 -2
  30. package/dist/lib/node-esm/intent-resolver-2ZKXI5ET.mjs.map +7 -0
  31. package/dist/lib/node-esm/meta.json +1 -1
  32. package/dist/lib/node-esm/{store-QEXGXLWZ.mjs → store-QQUTQHHT.mjs} +2 -2
  33. package/dist/lib/node-esm/{store-QEXGXLWZ.mjs.map → store-QQUTQHHT.mjs.map} +1 -1
  34. package/dist/lib/node-esm/testing/index.mjs +5 -7
  35. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  36. package/dist/lib/node-esm/worker.mjs +7 -1
  37. package/dist/types/src/common/capabilities.d.ts +75 -8
  38. package/dist/types/src/common/capabilities.d.ts.map +1 -1
  39. package/dist/types/src/common/collaboration.d.ts +9 -8
  40. package/dist/types/src/common/collaboration.d.ts.map +1 -1
  41. package/dist/types/src/common/events.d.ts.map +1 -1
  42. package/dist/types/src/common/index.d.ts +1 -1
  43. package/dist/types/src/common/index.d.ts.map +1 -1
  44. package/dist/types/src/common/surface.d.ts +1 -1
  45. package/dist/types/src/common/surface.d.ts.map +1 -1
  46. package/dist/types/src/components/App.d.ts +10 -0
  47. package/dist/types/src/components/App.d.ts.map +1 -0
  48. package/dist/types/src/components/App.stories.d.ts +15 -0
  49. package/dist/types/src/components/App.stories.d.ts.map +1 -0
  50. package/dist/types/src/components/DefaultFallback.d.ts +8 -0
  51. package/dist/types/src/components/DefaultFallback.d.ts.map +1 -0
  52. package/dist/types/src/components/index.d.ts +2 -0
  53. package/dist/types/src/components/index.d.ts.map +1 -0
  54. package/dist/types/src/{App.d.ts → components/useApp.d.ts} +7 -6
  55. package/dist/types/src/components/useApp.d.ts.map +1 -0
  56. package/dist/types/src/components/useLoading.d.ts +19 -0
  57. package/dist/types/src/components/useLoading.d.ts.map +1 -0
  58. package/dist/types/src/core/capabilities.d.ts +4 -1
  59. package/dist/types/src/core/capabilities.d.ts.map +1 -1
  60. package/dist/types/src/core/manager.d.ts +6 -2
  61. package/dist/types/src/core/manager.d.ts.map +1 -1
  62. package/dist/types/src/index.d.ts +1 -1
  63. package/dist/types/src/index.d.ts.map +1 -1
  64. package/dist/types/src/playground/debug/Debug.d.ts +1 -1
  65. package/dist/types/src/playground/generator/Main.d.ts +1 -1
  66. package/dist/types/src/playground/generator/Toolbar.d.ts +1 -1
  67. package/dist/types/src/playground/generator/Toolbar.d.ts.map +1 -1
  68. package/dist/types/src/playground/generator/generator.d.ts.map +1 -1
  69. package/dist/types/src/playground/layout/Layout.d.ts +2 -2
  70. package/dist/types/src/playground/logger/Toolbar.d.ts +1 -1
  71. package/dist/types/src/playground/logger/Toolbar.d.ts.map +1 -1
  72. package/dist/types/src/playground/logger/plugin.d.ts.map +1 -1
  73. package/dist/types/src/playground/playground.stories.d.ts +5 -3
  74. package/dist/types/src/playground/playground.stories.d.ts.map +1 -1
  75. package/dist/types/src/plugin-intent/IntentPlugin.d.ts.map +1 -1
  76. package/dist/types/src/plugin-intent/index.d.ts +1 -0
  77. package/dist/types/src/plugin-intent/index.d.ts.map +1 -1
  78. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +3 -3
  79. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +1 -1
  80. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +1 -1
  81. package/dist/types/src/plugin-settings/app-graph-builder.d.ts +1 -1
  82. package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +1 -1
  83. package/dist/types/src/plugin-settings/intent-resolver.d.ts +1 -1
  84. package/dist/types/src/plugin-settings/intent-resolver.d.ts.map +1 -1
  85. package/dist/types/src/plugin-settings/store.d.ts +1 -1
  86. package/dist/types/src/plugin-settings/store.d.ts.map +1 -1
  87. package/dist/types/src/react/ErrorBoundary.d.ts +13 -14
  88. package/dist/types/src/react/ErrorBoundary.d.ts.map +1 -1
  89. package/dist/types/src/react/IntentContext.d.ts.map +1 -1
  90. package/dist/types/src/react/Surface.d.ts.map +1 -1
  91. package/dist/types/src/react/Surface.stories.d.ts +6 -4
  92. package/dist/types/src/react/Surface.stories.d.ts.map +1 -1
  93. package/dist/types/src/react/common.d.ts.map +1 -1
  94. package/dist/types/src/react/useCapabilities.d.ts.map +1 -1
  95. package/dist/types/src/testing/withPluginManager.d.ts +4 -2
  96. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  97. package/dist/types/src/testing/withPluginManager.stories.d.ts +9 -3
  98. package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
  99. package/dist/types/tsconfig.tsbuildinfo +1 -1
  100. package/package.json +28 -24
  101. package/src/common/capabilities.ts +91 -10
  102. package/src/common/collaboration.ts +5 -8
  103. package/src/common/events.ts +3 -1
  104. package/src/common/index.ts +1 -1
  105. package/src/common/surface.ts +1 -1
  106. package/src/components/App.stories.tsx +35 -0
  107. package/src/components/App.tsx +59 -0
  108. package/src/components/DefaultFallback.tsx +26 -0
  109. package/src/components/index.ts +5 -0
  110. package/src/{App.tsx → components/useApp.tsx} +20 -130
  111. package/src/components/useLoading.tsx +70 -0
  112. package/src/core/capabilities.test.ts +1 -1
  113. package/src/core/capabilities.ts +11 -6
  114. package/src/core/manager.test.ts +4 -3
  115. package/src/core/manager.ts +132 -54
  116. package/src/helpers.test.ts +1 -1
  117. package/src/index.ts +1 -1
  118. package/src/playground/debug/Debug.tsx +1 -1
  119. package/src/playground/generator/Toolbar.tsx +2 -1
  120. package/src/playground/generator/generator.ts +2 -2
  121. package/src/playground/layout/plugin.ts +1 -1
  122. package/src/playground/logger/Toolbar.tsx +2 -1
  123. package/src/playground/logger/plugin.ts +3 -2
  124. package/src/playground/playground.stories.tsx +15 -10
  125. package/src/plugin-intent/IntentPlugin.ts +2 -1
  126. package/src/plugin-intent/index.ts +1 -0
  127. package/src/plugin-intent/intent-dispatcher.test.ts +1 -1
  128. package/src/plugin-intent/intent-dispatcher.ts +10 -8
  129. package/src/plugin-settings/SettingsPlugin.ts +3 -2
  130. package/src/plugin-settings/app-graph-builder.ts +4 -3
  131. package/src/plugin-settings/intent-resolver.ts +3 -2
  132. package/src/plugin-settings/store.ts +1 -1
  133. package/src/react/ErrorBoundary.tsx +24 -15
  134. package/src/react/IntentContext.tsx +3 -2
  135. package/src/react/Surface.stories.tsx +21 -13
  136. package/src/react/Surface.tsx +4 -3
  137. package/src/react/common.ts +2 -1
  138. package/src/react/useCapabilities.ts +2 -1
  139. package/src/testing/withPluginManager.stories.tsx +9 -5
  140. package/src/testing/withPluginManager.tsx +13 -13
  141. package/tsconfig.json +1 -8
  142. package/.swc/plugins/v7_linux_x86_64_13.0.0/f45bdff002284d9e8f9ef3f0be909de12da36c049cbcf261ac78fc00abb09a2d +0 -0
  143. package/dist/lib/browser/app-graph-builder-LYF7EKNN.mjs.map +0 -7
  144. package/dist/lib/browser/chunk-FMN65HSW.mjs.map +0 -7
  145. package/dist/lib/browser/chunk-FO2PH7M3.mjs.map +0 -7
  146. package/dist/lib/browser/intent-resolver-ZTNOSO3A.mjs.map +0 -7
  147. package/dist/lib/node-esm/app-graph-builder-SAOWGJDK.mjs.map +0 -7
  148. package/dist/lib/node-esm/chunk-73HGSHKE.mjs.map +0 -7
  149. package/dist/lib/node-esm/chunk-ZEZ4FVEU.mjs.map +0 -7
  150. package/dist/lib/node-esm/intent-resolver-W7Z7WFFM.mjs.map +0 -7
  151. package/dist/types/src/App.d.ts.map +0 -1
  152. /package/dist/lib/browser/{intent-dispatcher-LSYQZSEB.mjs.map → intent-dispatcher-QG7UPGQX.mjs.map} +0 -0
  153. /package/dist/lib/node-esm/{intent-dispatcher-6CYNGPSW.mjs.map → intent-dispatcher-NXBGPJOX.mjs.map} +0 -0
@@ -1,109 +1,28 @@
1
1
  // src/plugin-intent/intent-dispatcher.ts
2
- import { Effect as Effect3, Option, pipe as pipe2, Ref as Ref2 } from "effect";
2
+ import { Effect as Effect3, Option, Ref as Ref2, pipe as pipe2 } from "effect";
3
3
  import { live as live2 } from "@dxos/live-object";
4
4
  import { log as log3 } from "@dxos/log";
5
5
  import { byPosition } from "@dxos/util";
6
6
 
7
- // src/plugin-intent/actions.ts
8
- import { Schema as Schema2 } from "effect";
9
-
10
- // src/plugin-intent/intent.ts
11
- import { Schema } from "effect";
12
- var createIntent = (schema, data = {}, params = {}) => {
13
- const _ = Schema.validateSync(schema.fields.input)(data);
14
- const intent = {
15
- ...params,
16
- _schema: schema,
17
- id: schema._tag,
18
- data
19
- };
20
- return {
21
- first: intent,
22
- last: intent,
23
- all: [
24
- intent
25
- ]
26
- };
27
- };
28
- var chain = (schema, data = {}, params = {}) => (intent) => {
29
- const intents = "all" in intent ? intent.all : [
30
- intent
31
- ];
32
- const first = intents[0];
33
- const last = {
34
- ...params,
35
- _schema: schema,
36
- id: schema._tag,
37
- data
38
- };
39
- return {
40
- first,
41
- last,
42
- all: [
43
- ...intents,
44
- last
45
- ]
46
- };
47
- };
48
- var Label = Schema.Union(Schema.String, Schema.mutable(Schema.Tuple(Schema.String, Schema.mutable(Schema.Struct({
49
- ns: Schema.String,
50
- count: Schema.optional(Schema.Number),
51
- defaultValue: Schema.optional(Schema.String)
52
- })))));
53
-
54
- // src/plugin-intent/actions.ts
55
- var INTENT_PLUGIN = "dxos.org/plugin/intent";
56
- var INTENT_ACTION = `${INTENT_PLUGIN}/action`;
57
- (function(IntentAction2) {
58
- class Track extends Schema2.TaggedClass()(`${INTENT_ACTION}/track`, {
59
- input: Schema2.Struct({
60
- intents: Schema2.Array(Schema2.String),
61
- error: Schema2.optional(Schema2.String)
62
- }),
63
- output: Schema2.Void
64
- }) {
65
- }
66
- IntentAction2.Track = Track;
67
- class ShowUndo extends Schema2.TaggedClass()(`${INTENT_ACTION}/show-undo`, {
68
- input: Schema2.Struct({
69
- message: Label
70
- }),
71
- output: Schema2.Void
72
- }) {
73
- }
74
- IntentAction2.ShowUndo = ShowUndo;
75
- })(IntentAction || (IntentAction = {}));
76
- var IntentAction;
77
-
78
- // src/plugin-intent/errors.ts
79
- var BaseError = class extends Error {
80
- constructor(code, message, context) {
81
- super(message ?? code, {
82
- cause: context
83
- }), this.code = code, this.context = context;
84
- this.name = code;
85
- Object.setPrototypeOf(this, new.target.prototype);
86
- }
87
- };
88
- var NoResolversError = class extends BaseError {
89
- constructor(action) {
90
- super("NO_RESOLVERS", "No resolvers were found for the action", {
91
- action
92
- });
93
- }
94
- };
95
- var CycleDetectedError = class extends BaseError {
96
- constructor(context) {
97
- super("CYCLE_DETECTED", "Intent execution limit exceeded. This is likely due to an infinite loop within intent resolvers.", context);
98
- }
99
- };
100
-
101
7
  // src/core/capabilities.ts
102
8
  import { Rx } from "@effect-rx/rx-react";
103
9
  import { Effect } from "effect";
104
10
  import { Trigger } from "@dxos/async";
105
11
  import { invariant } from "@dxos/invariant";
106
12
  import { log } from "@dxos/log";
13
+ function _define_property(obj, key, value) {
14
+ if (key in obj) {
15
+ Object.defineProperty(obj, key, {
16
+ value,
17
+ enumerable: true,
18
+ configurable: true,
19
+ writable: true
20
+ });
21
+ } else {
22
+ obj[key] = value;
23
+ }
24
+ return obj;
25
+ }
107
26
  var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/capabilities.ts";
108
27
  var InterfaceDefTypeId = Symbol.for("InterfaceDefTypeId");
109
28
  var defineCapability = (identifier) => {
@@ -113,6 +32,8 @@ var defineCapability = (identifier) => {
113
32
  };
114
33
  var CapabilityImpl = class {
115
34
  constructor(moduleId, implementation) {
35
+ _define_property(this, "moduleId", void 0);
36
+ _define_property(this, "implementation", void 0);
116
37
  this.moduleId = moduleId;
117
38
  this.implementation = implementation;
118
39
  }
@@ -129,35 +50,6 @@ var lazy = (c) => async (props) => {
129
50
  return async () => getCapability(props);
130
51
  };
131
52
  var PluginContext = class {
132
- constructor({ registry, activate, reset }) {
133
- this._capabilityImpls = Rx.family(() => {
134
- return Rx.make([]).pipe(Rx.keepAlive);
135
- });
136
- this._capabilities = Rx.family((id) => {
137
- return Rx.make((get) => {
138
- const current = get(this._capabilityImpls(id));
139
- return current.map((c) => c.implementation);
140
- });
141
- });
142
- this._capability = Rx.family((id) => {
143
- return Rx.make((get) => {
144
- const current = get(this._capabilities(id));
145
- invariant(current.length > 0, `No capability found for ${id}`, {
146
- F: __dxlog_file,
147
- L: 117,
148
- S: this,
149
- A: [
150
- "current.length > 0",
151
- "`No capability found for ${id}`"
152
- ]
153
- });
154
- return current[0];
155
- });
156
- });
157
- this._registry = registry;
158
- this.activate = activate;
159
- this.reset = reset;
160
- }
161
53
  /**
162
54
  * @internal
163
55
  */
@@ -177,7 +69,7 @@ var PluginContext = class {
177
69
  count: current.length
178
70
  }, {
179
71
  F: __dxlog_file,
180
- L: 161,
72
+ L: 166,
181
73
  S: this,
182
74
  C: (f, a) => f(...a)
183
75
  });
@@ -198,7 +90,7 @@ var PluginContext = class {
198
90
  count: current.length
199
91
  }, {
200
92
  F: __dxlog_file,
201
- L: 180,
93
+ L: 185,
202
94
  S: this,
203
95
  C: (f, a) => f(...a)
204
96
  });
@@ -207,7 +99,7 @@ var PluginContext = class {
207
99
  id: interfaceDef.identifier
208
100
  }, {
209
101
  F: __dxlog_file,
210
- L: 182,
102
+ L: 187,
211
103
  S: this,
212
104
  C: (f, a) => f(...a)
213
105
  });
@@ -272,6 +164,38 @@ var PluginContext = class {
272
164
  async resetPromise(event) {
273
165
  return this.reset(event).pipe(Effect.runPromise);
274
166
  }
167
+ constructor({ registry, activate, reset }) {
168
+ _define_property(this, "_registry", void 0);
169
+ _define_property(this, "_capabilityImpls", Rx.family(() => {
170
+ return Rx.make([]).pipe(Rx.keepAlive);
171
+ }));
172
+ _define_property(this, "_capabilities", Rx.family((id) => {
173
+ return Rx.make((get) => {
174
+ const current = get(this._capabilityImpls(id));
175
+ return current.map((c) => c.implementation);
176
+ });
177
+ }));
178
+ _define_property(this, "_capability", Rx.family((id) => {
179
+ return Rx.make((get) => {
180
+ const current = get(this._capabilities(id));
181
+ invariant(current.length > 0, `No capability found for ${id}`, {
182
+ F: __dxlog_file,
183
+ L: 122,
184
+ S: this,
185
+ A: [
186
+ "current.length > 0",
187
+ "`No capability found for ${id}`"
188
+ ]
189
+ });
190
+ return current[0];
191
+ });
192
+ }));
193
+ _define_property(this, "activate", void 0);
194
+ _define_property(this, "reset", void 0);
195
+ this._registry = registry;
196
+ this.activate = activate;
197
+ this.reset = reset;
198
+ }
275
199
  };
276
200
 
277
201
  // src/core/events.ts
@@ -299,38 +223,28 @@ var getEvents = (events) => "type" in events ? events.events : [
299
223
  // src/core/manager.ts
300
224
  import { Registry } from "@effect-rx/rx-react";
301
225
  import { untracked } from "@preact/signals-core";
302
- import { Array as A, Effect as Effect2, Either, Match, pipe } from "effect";
226
+ import { Array, Duration, Effect as Effect2, Fiber, HashSet, Match, Ref, pipe } from "effect";
303
227
  import { Event } from "@dxos/async";
304
228
  import { live } from "@dxos/live-object";
305
229
  import { log as log2 } from "@dxos/log";
230
+ function _define_property2(obj, key, value) {
231
+ if (key in obj) {
232
+ Object.defineProperty(obj, key, {
233
+ value,
234
+ enumerable: true,
235
+ configurable: true,
236
+ writable: true
237
+ });
238
+ } else {
239
+ obj[key] = value;
240
+ }
241
+ return obj;
242
+ }
306
243
  var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/manager.ts";
307
244
  var isPromise = (value) => {
308
245
  return value !== null && typeof value === "object" && "then" in value;
309
246
  };
310
247
  var PluginManager = class {
311
- constructor({ pluginLoader, plugins = [], core = plugins.map(({ meta }) => meta.id), enabled = [], registry }) {
312
- this.activation = new Event();
313
- this._capabilities = /* @__PURE__ */ new Map();
314
- this.registry = registry ?? Registry.make();
315
- this.context = new PluginContext({
316
- registry: this.registry,
317
- activate: (event) => this._activate(event),
318
- reset: (id) => this._reset(id)
319
- });
320
- this._pluginLoader = pluginLoader;
321
- this._state = live({
322
- plugins,
323
- core,
324
- enabled,
325
- modules: [],
326
- active: [],
327
- pendingReset: [],
328
- eventsFired: []
329
- });
330
- plugins.forEach((plugin) => this._addPlugin(plugin));
331
- core.forEach((id) => this.enable(id));
332
- enabled.forEach((id) => this.enable(id));
333
- }
334
248
  /**
335
249
  * Plugins that are currently registered.
336
250
  *
@@ -397,7 +311,7 @@ var PluginManager = class {
397
311
  id
398
312
  }, {
399
313
  F: __dxlog_file2,
400
- L: 154,
314
+ L: 157,
401
315
  S: this,
402
316
  C: (f, a) => f(...a)
403
317
  });
@@ -416,7 +330,7 @@ var PluginManager = class {
416
330
  id
417
331
  }, {
418
332
  F: __dxlog_file2,
419
- L: 167,
333
+ L: 170,
420
334
  S: this,
421
335
  C: (f, a) => f(...a)
422
336
  });
@@ -437,7 +351,7 @@ var PluginManager = class {
437
351
  ]
438
352
  }, {
439
353
  F: __dxlog_file2,
440
- L: 182,
354
+ L: 185,
441
355
  S: this,
442
356
  C: (f, a) => f(...a)
443
357
  });
@@ -457,7 +371,7 @@ var PluginManager = class {
457
371
  id
458
372
  }, {
459
373
  F: __dxlog_file2,
460
- L: 200,
374
+ L: 203,
461
375
  S: this,
462
376
  C: (f, a) => f(...a)
463
377
  });
@@ -479,7 +393,7 @@ var PluginManager = class {
479
393
  id
480
394
  }, {
481
395
  F: __dxlog_file2,
482
- L: 217,
396
+ L: 220,
483
397
  S: this,
484
398
  C: (f, a) => f(...a)
485
399
  });
@@ -531,7 +445,7 @@ var PluginManager = class {
531
445
  id: plugin.meta.id
532
446
  }, {
533
447
  F: __dxlog_file2,
534
- L: 270,
448
+ L: 273,
535
449
  S: this,
536
450
  C: (f, a) => f(...a)
537
451
  });
@@ -546,7 +460,7 @@ var PluginManager = class {
546
460
  id
547
461
  }, {
548
462
  F: __dxlog_file2,
549
- L: 279,
463
+ L: 283,
550
464
  S: this,
551
465
  C: (f, a) => f(...a)
552
466
  });
@@ -562,7 +476,7 @@ var PluginManager = class {
562
476
  id: module.id
563
477
  }, {
564
478
  F: __dxlog_file2,
565
- L: 289,
479
+ L: 293,
566
480
  S: this,
567
481
  C: (f, a) => f(...a)
568
482
  });
@@ -577,7 +491,7 @@ var PluginManager = class {
577
491
  id
578
492
  }, {
579
493
  F: __dxlog_file2,
580
- L: 298,
494
+ L: 303,
581
495
  S: this,
582
496
  C: (f, a) => f(...a)
583
497
  });
@@ -605,13 +519,13 @@ var PluginManager = class {
605
519
  _setPendingResetByModule(module) {
606
520
  return untracked(() => {
607
521
  const activationEvents = getEvents(module.activatesOn).map(eventKey).filter((key) => this._state.eventsFired.includes(key));
608
- const pendingReset = Array.from(new Set(activationEvents)).filter((event) => !this._state.pendingReset.includes(event));
522
+ const pendingReset = Array.fromIterable(new Set(activationEvents)).filter((event) => !this._state.pendingReset.includes(event));
609
523
  if (pendingReset.length > 0) {
610
524
  log2("pending reset", {
611
525
  events: pendingReset
612
526
  }, {
613
527
  F: __dxlog_file2,
614
- L: 336,
528
+ L: 341,
615
529
  S: this,
616
530
  C: (f, a) => f(...a)
617
531
  });
@@ -623,35 +537,40 @@ var PluginManager = class {
623
537
  * @internal
624
538
  */
625
539
  // TODO(wittjosiah): Improve error typing.
626
- _activate(event) {
540
+ _activate(event, params) {
627
541
  return Effect2.gen(this, function* () {
628
542
  const key = typeof event === "string" ? event : eventKey(event);
629
543
  log2("activating", {
630
- key
544
+ key,
545
+ ...params
631
546
  }, {
632
547
  F: __dxlog_file2,
633
- L: 349,
548
+ L: 357,
634
549
  S: this,
635
550
  C: (f, a) => f(...a)
636
551
  });
552
+ yield* Ref.update(this._activatingEvents, (activating) => Array.append(activating, key));
637
553
  const pendingIndex = this._state.pendingReset.findIndex((event2) => event2 === key);
638
554
  if (pendingIndex !== -1) {
639
555
  this._state.pendingReset.splice(pendingIndex, 1);
640
556
  }
557
+ const activatingEvents = yield* this._activatingEvents;
558
+ const activatingModules = yield* this._activatingModules;
641
559
  const modules = this._getInactiveModulesByEvent(key).filter((module) => {
642
560
  const allOf2 = isAllOf(module.activatesOn);
643
561
  if (!allOf2) {
644
562
  return true;
645
563
  }
646
564
  const events = module.activatesOn.events.filter((event2) => eventKey(event2) !== key);
647
- return events.every((event2) => this._state.eventsFired.includes(eventKey(event2)));
565
+ return events.every((event2) => this._state.eventsFired.includes(eventKey(event2)) || activatingEvents.includes(eventKey(event2))) && !activatingModules.includes(module.id);
648
566
  });
567
+ yield* Ref.update(this._activatingModules, (activating) => Array.appendAll(activating, modules.map((module) => module.id)));
649
568
  if (modules.length === 0) {
650
569
  log2("no modules to activate", {
651
570
  key
652
571
  }, {
653
572
  F: __dxlog_file2,
654
- L: 365,
573
+ L: 388,
655
574
  S: this,
656
575
  C: (f, a) => f(...a)
657
576
  });
@@ -665,7 +584,7 @@ var PluginManager = class {
665
584
  modules: modules.map((module) => module.id)
666
585
  }, {
667
586
  F: __dxlog_file2,
668
- L: 372,
587
+ L: 395,
669
588
  S: this,
670
589
  C: (f, a) => f(...a)
671
590
  });
@@ -673,29 +592,36 @@ var PluginManager = class {
673
592
  event: key,
674
593
  state: "activating"
675
594
  });
676
- const getCapabilities = yield* Effect2.all(modules.map(({ activate }) => Effect2.tryPromise({
677
- try: async () => activate(this.context),
678
- catch: (error) => error
679
- })), {
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, {
596
+ before: key
597
+ })), Effect2.allWith({
680
598
  concurrency: "unbounded"
681
- });
682
- const result = yield* pipe(
683
- modules,
684
- A.zip(getCapabilities),
685
- A.map(([module, getCapabilities2]) => this._activateModule(module, getCapabilities2)),
686
- // TODO(wittjosiah): This currently can't be run in parallel.
687
- // Running this with concurrency causes races with `allOf` activation events.
688
- Effect2.all,
689
- Effect2.either
690
- );
691
- if (Either.isLeft(result)) {
599
+ }));
600
+ const getCapabilities = yield* pipe(modules, Array.map((mod) => this._loadModule(mod)), Effect2.allWith({
601
+ concurrency: "unbounded"
602
+ }), Effect2.catchAll((error) => {
692
603
  this.activation.emit({
693
604
  event: key,
694
605
  state: "error",
695
- error: result.left
606
+ error
696
607
  });
697
- yield* Effect2.fail(result.left);
698
- }
608
+ return Effect2.fail(error);
609
+ }));
610
+ yield* pipe(
611
+ modules,
612
+ Array.zip(getCapabilities),
613
+ 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
+ Effect2.all
617
+ );
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, {
619
+ after: key
620
+ })), Effect2.allWith({
621
+ concurrency: "unbounded"
622
+ }));
623
+ yield* Ref.update(this._activatingEvents, (activating) => Array.filter(activating, (event2) => event2 !== key));
624
+ yield* Ref.update(this._activatingModules, (activating) => Array.filter(activating, (module) => !modules.map((module2) => module2.id).includes(module)));
699
625
  if (!this._state.eventsFired.includes(key)) {
700
626
  this._state.eventsFired.push(key);
701
627
  }
@@ -707,39 +633,15 @@ var PluginManager = class {
707
633
  key
708
634
  }, {
709
635
  F: __dxlog_file2,
710
- L: 406,
636
+ L: 451,
711
637
  S: this,
712
638
  C: (f, a) => f(...a)
713
639
  });
714
640
  return true;
715
641
  });
716
642
  }
717
- _activateModule(module, getCapabilities) {
643
+ _contributeCapabilities(module, capabilities) {
718
644
  return Effect2.gen(this, function* () {
719
- yield* Effect2.all(module.activatesBefore?.map((event) => this._activate(event)) ?? [], {
720
- concurrency: "unbounded"
721
- });
722
- log2("activating module...", {
723
- module: module.id
724
- }, {
725
- F: __dxlog_file2,
726
- L: 421,
727
- S: this,
728
- C: (f, a) => f(...a)
729
- });
730
- const maybeCapabilities = typeof getCapabilities === "function" ? getCapabilities() : getCapabilities;
731
- const resolvedCapabilities = yield* Match.value(maybeCapabilities).pipe(
732
- // TODO(wittjosiah): Activate with an effect?
733
- // Match.when(Effect.isEffect, (effect) => effect),
734
- Match.when(isPromise, (promise) => Effect2.tryPromise({
735
- try: () => promise,
736
- catch: (error) => error
737
- })),
738
- Match.orElse((program) => Effect2.succeed(program))
739
- );
740
- const capabilities = Match.value(resolvedCapabilities).pipe(Match.when(Array.isArray, (array) => array), Match.orElse((value) => [
741
- value
742
- ]));
743
645
  capabilities.forEach((capability) => {
744
646
  this.context.contributeCapability({
745
647
  module: module.id,
@@ -748,17 +650,6 @@ var PluginManager = class {
748
650
  });
749
651
  this._state.active.push(module.id);
750
652
  this._capabilities.set(module.id, capabilities);
751
- log2("activated module", {
752
- module: module.id
753
- }, {
754
- F: __dxlog_file2,
755
- L: 444,
756
- S: this,
757
- C: (f, a) => f(...a)
758
- });
759
- yield* Effect2.all(module.activatesAfter?.map((event) => this._activate(event)) ?? [], {
760
- concurrency: "unbounded"
761
- });
762
653
  });
763
654
  }
764
655
  _deactivate(id) {
@@ -781,10 +672,11 @@ var PluginManager = class {
781
672
  id
782
673
  }, {
783
674
  F: __dxlog_file2,
784
- L: 471,
675
+ L: 533,
785
676
  S: this,
786
677
  C: (f, a) => f(...a)
787
678
  });
679
+ this._moduleMemoMap.delete(id);
788
680
  const capabilities = this._capabilities.get(id);
789
681
  if (capabilities) {
790
682
  for (const capability of capabilities) {
@@ -805,7 +697,7 @@ var PluginManager = class {
805
697
  id
806
698
  }, {
807
699
  F: __dxlog_file2,
808
- L: 497,
700
+ L: 560,
809
701
  S: this,
810
702
  C: (f, a) => f(...a)
811
703
  });
@@ -819,7 +711,7 @@ var PluginManager = class {
819
711
  key
820
712
  }, {
821
713
  F: __dxlog_file2,
822
- L: 505,
714
+ L: 568,
823
715
  S: this,
824
716
  C: (f, a) => f(...a)
825
717
  });
@@ -834,11 +726,125 @@ var PluginManager = class {
834
726
  }
835
727
  });
836
728
  }
729
+ constructor({ pluginLoader, plugins = [], core = plugins.map(({ meta }) => meta.id), enabled = [], registry }) {
730
+ _define_property2(this, "activation", new Event());
731
+ _define_property2(this, "context", void 0);
732
+ _define_property2(this, "registry", void 0);
733
+ _define_property2(this, "_state", void 0);
734
+ _define_property2(this, "_pluginLoader", void 0);
735
+ _define_property2(this, "_capabilities", /* @__PURE__ */ new Map());
736
+ _define_property2(this, "_moduleMemoMap", /* @__PURE__ */ new Map());
737
+ _define_property2(this, "_activatingEvents", Effect2.runSync(Ref.make([])));
738
+ _define_property2(this, "_activatingModules", Effect2.runSync(Ref.make([])));
739
+ _define_property2(this, "_loadModule", (mod) => Effect2.tryPromise({
740
+ try: async () => {
741
+ const entry = this._moduleMemoMap.get(mod.id);
742
+ if (entry) {
743
+ return entry;
744
+ }
745
+ const promise = (async () => {
746
+ const start = performance.now();
747
+ let failed = false;
748
+ try {
749
+ log2("loading module", {
750
+ module: mod.id
751
+ }, {
752
+ F: __dxlog_file2,
753
+ L: 470,
754
+ S: this,
755
+ C: (f, a) => f(...a)
756
+ });
757
+ let activationResult = await mod.activate(this.context);
758
+ if (typeof activationResult === "function") {
759
+ activationResult = await activationResult();
760
+ }
761
+ return Array.isArray(activationResult) ? activationResult : [
762
+ activationResult
763
+ ];
764
+ } catch (error) {
765
+ failed = true;
766
+ throw error;
767
+ } finally {
768
+ performance.measure("activate-module", {
769
+ start,
770
+ end: performance.now(),
771
+ detail: {
772
+ module: mod.id
773
+ }
774
+ });
775
+ log2("loaded module", {
776
+ module: mod.id,
777
+ elapsed: performance.now() - start,
778
+ failed
779
+ }, {
780
+ F: __dxlog_file2,
781
+ L: 488,
782
+ S: this,
783
+ C: (f, a) => f(...a)
784
+ });
785
+ }
786
+ })();
787
+ this._moduleMemoMap.set(mod.id, promise);
788
+ return promise;
789
+ },
790
+ catch: (error) => error
791
+ }).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
+ module: mod.id
793
+ }, {
794
+ F: __dxlog_file2,
795
+ L: 499,
796
+ S: this,
797
+ C: (f, a) => f(...a)
798
+ })))))));
799
+ this.registry = registry ?? Registry.make();
800
+ this.context = new PluginContext({
801
+ registry: this.registry,
802
+ activate: (event) => this._activate(event),
803
+ reset: (id) => this._reset(id)
804
+ });
805
+ this._pluginLoader = pluginLoader;
806
+ this._state = live({
807
+ plugins,
808
+ core,
809
+ enabled,
810
+ modules: [],
811
+ active: [],
812
+ eventsFired: [],
813
+ pendingReset: []
814
+ });
815
+ plugins.forEach((plugin) => this._addPlugin(plugin));
816
+ core.forEach((id) => this.enable(id));
817
+ enabled.forEach((id) => this.enable(id));
818
+ }
837
819
  };
820
+ var together = (togetherEffect) => (effect) => Effect2.gen(function* () {
821
+ const togetherFiber = yield* Effect2.fork(togetherEffect);
822
+ const result = yield* effect;
823
+ yield* Fiber.interrupt(togetherFiber);
824
+ return result;
825
+ });
838
826
 
839
827
  // src/core/plugin.ts
828
+ function _define_property3(obj, key, value) {
829
+ if (key in obj) {
830
+ Object.defineProperty(obj, key, {
831
+ value,
832
+ enumerable: true,
833
+ configurable: true,
834
+ writable: true
835
+ });
836
+ } else {
837
+ obj[key] = value;
838
+ }
839
+ return obj;
840
+ }
840
841
  var PluginModule = class {
841
842
  constructor(options) {
843
+ _define_property3(this, "id", void 0);
844
+ _define_property3(this, "activatesOn", void 0);
845
+ _define_property3(this, "activatesBefore", void 0);
846
+ _define_property3(this, "activatesAfter", void 0);
847
+ _define_property3(this, "activate", void 0);
842
848
  this.id = options.id;
843
849
  this.activatesOn = options.activatesOn;
844
850
  this.activatesBefore = options.activatesBefore;
@@ -849,6 +855,8 @@ var PluginModule = class {
849
855
  var defineModule = (options) => new PluginModule(options);
850
856
  var Plugin = class {
851
857
  constructor(meta, modules) {
858
+ _define_property3(this, "meta", void 0);
859
+ _define_property3(this, "modules", void 0);
852
860
  this.meta = meta;
853
861
  this.modules = modules;
854
862
  }
@@ -875,8 +883,9 @@ var definePlugin = (meta, modules) => {
875
883
  Capabilities2.SettingsStore = defineCapability("dxos.org/app-framework/capability/settings-store");
876
884
  Capabilities2.Settings = defineCapability("dxos.org/app-framework/capability/settings");
877
885
  Capabilities2.Metadata = defineCapability("dxos.org/app-framework/capability/metadata");
878
- Capabilities2.Tools = defineCapability("dxos.org/app-framework/capability/tools");
879
- Capabilities2.ArtifactDefinition = defineCapability("dxos.org/app-framework/capability/artifact-definition");
886
+ Capabilities2.Toolkit = defineCapability("dxos.org/app-framework/capability/ai-toolkit");
887
+ Capabilities2.ToolkitHandler = defineCapability("dxos.org/app-framework/capability/ai-toolkit-handler");
888
+ Capabilities2.BlueprintDefinition = defineCapability("dxos.org/app-framework/capability/blueprint-definition");
880
889
  Capabilities2.Functions = defineCapability("dxos.org/app-framework/capability/functions");
881
890
  Capabilities2.FileUploader = defineCapability("dxos.org/app-framework/capability/file-uploader");
882
891
  Capabilities2.AnchorSort = defineCapability("dxos.org/app-framework/capability/anchor-sort");
@@ -884,22 +893,19 @@ var definePlugin = (meta, modules) => {
884
893
  var Capabilities;
885
894
 
886
895
  // src/common/collaboration.ts
887
- import { Schema as Schema3 } from "effect";
888
- import { Expando, Ref } from "@dxos/echo-schema";
896
+ import { Schema } from "effect";
897
+ import { DataType } from "@dxos/schema";
889
898
  (function(CollaborationActions2) {
890
- class InsertContent extends Schema3.TaggedClass()("assistant/intent-content", {
891
- input: Schema3.Struct({
892
- target: Expando,
893
- object: Ref(Expando),
894
- at: Schema3.optional(Schema3.String),
895
- label: Schema3.String.pipe(Schema3.optional)
896
- }).annotations({
897
- description: "Enables plugins to inject content blocks or references into a related entity."
899
+ class AcceptProposal extends Schema.TaggedClass()("collaboration/accept-proposal", {
900
+ input: Schema.Struct({
901
+ subject: Schema.Any,
902
+ anchor: Schema.String,
903
+ proposal: DataType.MessageBlock.Proposal
898
904
  }),
899
- output: Schema3.Void
905
+ output: Schema.Void
900
906
  }) {
901
907
  }
902
- CollaborationActions2.InsertContent = InsertContent;
908
+ CollaborationActions2.AcceptProposal = AcceptProposal;
903
909
  })(CollaborationActions || (CollaborationActions = {}));
904
910
  var CollaborationActions;
905
911
 
@@ -922,7 +928,7 @@ var CollaborationActions;
922
928
  var Events;
923
929
 
924
930
  // src/common/file.ts
925
- import { Schema as Schema4 } from "effect";
931
+ import { Schema as Schema2 } from "effect";
926
932
  var defaultFileTypes = {
927
933
  images: [
928
934
  "png",
@@ -942,16 +948,123 @@ var defaultFileTypes = {
942
948
  "md"
943
949
  ]
944
950
  };
945
- var FileInfoSchema = Schema4.Struct({
946
- name: Schema4.String,
947
- type: Schema4.String,
948
- url: Schema4.optional(Schema4.String),
949
- cid: Schema4.optional(Schema4.String)
951
+ var FileInfoSchema = Schema2.Struct({
952
+ name: Schema2.String,
953
+ type: Schema2.String,
954
+ url: Schema2.optional(Schema2.String),
955
+ cid: Schema2.optional(Schema2.String)
950
956
  });
951
957
 
952
958
  // src/common/layout.ts
953
959
  import { Schema as Schema5 } from "effect";
954
960
 
961
+ // src/plugin-intent/actions.ts
962
+ import { Schema as Schema4 } from "effect";
963
+
964
+ // src/plugin-intent/intent.ts
965
+ import { Schema as Schema3 } from "effect";
966
+ var createIntent = (schema, data = {}, params = {}) => {
967
+ const _ = Schema3.validateSync(schema.fields.input)(data);
968
+ const intent = {
969
+ ...params,
970
+ _schema: schema,
971
+ id: schema._tag,
972
+ data
973
+ };
974
+ return {
975
+ first: intent,
976
+ last: intent,
977
+ all: [
978
+ intent
979
+ ]
980
+ };
981
+ };
982
+ var chain = (schema, data = {}, params = {}) => (intent) => {
983
+ const intents = "all" in intent ? intent.all : [
984
+ intent
985
+ ];
986
+ const first = intents[0];
987
+ const last = {
988
+ ...params,
989
+ _schema: schema,
990
+ id: schema._tag,
991
+ data
992
+ };
993
+ return {
994
+ first,
995
+ last,
996
+ all: [
997
+ ...intents,
998
+ last
999
+ ]
1000
+ };
1001
+ };
1002
+ var Label = Schema3.Union(Schema3.String, Schema3.mutable(Schema3.Tuple(Schema3.String, Schema3.mutable(Schema3.Struct({
1003
+ ns: Schema3.String,
1004
+ count: Schema3.optional(Schema3.Number),
1005
+ defaultValue: Schema3.optional(Schema3.String)
1006
+ })))));
1007
+
1008
+ // src/plugin-intent/actions.ts
1009
+ var INTENT_PLUGIN = "dxos.org/plugin/intent";
1010
+ var INTENT_ACTION = `${INTENT_PLUGIN}/action`;
1011
+ (function(IntentAction2) {
1012
+ class Track extends Schema4.TaggedClass()(`${INTENT_ACTION}/track`, {
1013
+ input: Schema4.Struct({
1014
+ intents: Schema4.Array(Schema4.String),
1015
+ error: Schema4.optional(Schema4.String)
1016
+ }),
1017
+ output: Schema4.Void
1018
+ }) {
1019
+ }
1020
+ IntentAction2.Track = Track;
1021
+ class ShowUndo extends Schema4.TaggedClass()(`${INTENT_ACTION}/show-undo`, {
1022
+ input: Schema4.Struct({
1023
+ message: Label
1024
+ }),
1025
+ output: Schema4.Void
1026
+ }) {
1027
+ }
1028
+ IntentAction2.ShowUndo = ShowUndo;
1029
+ })(IntentAction || (IntentAction = {}));
1030
+ var IntentAction;
1031
+
1032
+ // src/plugin-intent/errors.ts
1033
+ function _define_property4(obj, key, value) {
1034
+ if (key in obj) {
1035
+ Object.defineProperty(obj, key, {
1036
+ value,
1037
+ enumerable: true,
1038
+ configurable: true,
1039
+ writable: true
1040
+ });
1041
+ } else {
1042
+ obj[key] = value;
1043
+ }
1044
+ return obj;
1045
+ }
1046
+ var BaseError = class extends Error {
1047
+ constructor(code, message, context) {
1048
+ super(message ?? code, {
1049
+ cause: context
1050
+ }), _define_property4(this, "code", void 0), _define_property4(this, "context", void 0), this.code = code, this.context = context;
1051
+ this.name = code;
1052
+ Object.setPrototypeOf(this, new.target.prototype);
1053
+ }
1054
+ };
1055
+ var NoResolversError = class extends BaseError {
1056
+ constructor(action) {
1057
+ super("NO_RESOLVERS", "No resolvers were found for the action", {
1058
+ action
1059
+ });
1060
+ }
1061
+ };
1062
+ var CycleDetectedError = class extends BaseError {
1063
+ constructor(context) {
1064
+ super("CYCLE_DETECTED", "Intent execution limit exceeded. This is likely due to an infinite loop within intent resolvers.", context);
1065
+ }
1066
+ };
1067
+
955
1068
  // src/plugin-intent/IntentPlugin.ts
956
1069
  var IntentPlugin = () => definePlugin({
957
1070
  id: INTENT_PLUGIN,
@@ -966,7 +1079,7 @@ var IntentPlugin = () => definePlugin({
966
1079
  activatesAfter: [
967
1080
  Events.DispatcherReady
968
1081
  ],
969
- activate: lazy(() => import("./intent-dispatcher-LSYQZSEB.mjs"))
1082
+ activate: lazy(() => import("./intent-dispatcher-QG7UPGQX.mjs"))
970
1083
  })
971
1084
  ]);
972
1085
 
@@ -1336,7 +1449,15 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1336
1449
  const handleIntent = (intent) => Effect3.gen(function* () {
1337
1450
  const candidates = getResolvers().filter((resolver) => resolver.intent._tag === intent.id).filter((resolver) => !resolver.filter || resolver.filter(intent.data)).toSorted(byPosition);
1338
1451
  if (candidates.length === 0) {
1339
- yield* Effect3.fail(new NoResolversError(intent.id));
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
+ return yield* Effect3.fail(new NoResolversError(intent.id));
1340
1461
  }
1341
1462
  const effect = candidates[0].resolve(intent.data, intent.undo ?? false);
1342
1463
  const result = Effect3.isEffect(effect) ? yield* effect : yield* Effect3.promise(async () => effect);
@@ -1348,7 +1469,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1348
1469
  const dispatch = (intentChain, depth = 0) => {
1349
1470
  return Effect3.gen(function* () {
1350
1471
  if (depth > executionLimit) {
1351
- yield* Effect3.fail(new CycleDetectedError());
1472
+ return yield* Effect3.fail(new CycleDetectedError());
1352
1473
  }
1353
1474
  const resultsRef = yield* Ref2.make([]);
1354
1475
  for (const intent of intentChain.all) {
@@ -1370,7 +1491,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1370
1491
  }
1371
1492
  }
1372
1493
  if (result2.error) {
1373
- yield* Effect3.fail(result2.error);
1494
+ return yield* Effect3.fail(result2.error);
1374
1495
  }
1375
1496
  }
1376
1497
  const results = yield* resultsRef.get;
@@ -1399,7 +1520,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1399
1520
  })).catch((error) => {
1400
1521
  log3.catch(error, void 0, {
1401
1522
  F: __dxlog_file3,
1402
- L: 270,
1523
+ L: 272,
1403
1524
  S: void 0,
1404
1525
  C: (f, a) => f(...a)
1405
1526
  });
@@ -1504,6 +1625,9 @@ export {
1504
1625
  INTENT_PLUGIN,
1505
1626
  INTENT_ACTION,
1506
1627
  IntentAction,
1628
+ BaseError,
1629
+ NoResolversError,
1630
+ CycleDetectedError,
1507
1631
  createResolver,
1508
1632
  createDispatcher,
1509
1633
  intent_dispatcher_default,
@@ -1516,4 +1640,4 @@ export {
1516
1640
  ResourceLanguage,
1517
1641
  Resource
1518
1642
  };
1519
- //# sourceMappingURL=chunk-FMN65HSW.mjs.map
1643
+ //# sourceMappingURL=chunk-OZY7HV2A.mjs.map