@dxos/app-framework 0.8.4-main.e098934 → 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.
- package/.storybook/main.mts +11 -0
- package/.storybook/preview.mts +8 -0
- package/dist/lib/browser/{app-graph-builder-AFFC6VB2.mjs → app-graph-builder-LG4RG2LM.mjs} +30 -29
- package/dist/lib/browser/app-graph-builder-LG4RG2LM.mjs.map +7 -0
- package/dist/lib/browser/{chunk-OZY7HV2A.mjs → chunk-2GRQ4QXA.mjs} +96 -93
- package/dist/lib/browser/chunk-2GRQ4QXA.mjs.map +7 -0
- package/dist/lib/browser/{chunk-T6M7JB7M.mjs → chunk-FRUTKCPG.mjs} +16 -20
- package/dist/lib/browser/chunk-FRUTKCPG.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ORWHM7CO.mjs → chunk-SCPE4ZO2.mjs} +11 -8
- package/dist/lib/browser/chunk-SCPE4ZO2.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +14 -28
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-dispatcher-QG7UPGQX.mjs → intent-dispatcher-6SHA5B3N.mjs} +2 -2
- package/dist/lib/browser/{intent-resolver-4S4PSTM5.mjs → intent-resolver-UZZ4OANZ.mjs} +7 -7
- package/dist/lib/browser/intent-resolver-UZZ4OANZ.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{store-6E33KLGK.mjs → store-ACBEYK4B.mjs} +4 -4
- package/dist/lib/browser/{store-6E33KLGK.mjs.map → store-ACBEYK4B.mjs.map} +1 -1
- package/dist/lib/browser/testing/index.mjs +11 -14
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/browser/worker.mjs +1 -9
- package/dist/lib/node-esm/{app-graph-builder-S4OAULX5.mjs → app-graph-builder-FMHVHPWA.mjs} +30 -29
- package/dist/lib/node-esm/app-graph-builder-FMHVHPWA.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-HJFU7QOR.mjs → chunk-CXT6CYPE.mjs} +16 -20
- package/dist/lib/node-esm/chunk-CXT6CYPE.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-F63ZRXMK.mjs → chunk-KSPOOYT3.mjs} +96 -93
- package/dist/lib/node-esm/chunk-KSPOOYT3.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UMZQERLE.mjs → chunk-ZX63QUGE.mjs} +11 -8
- package/dist/lib/node-esm/chunk-ZX63QUGE.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +14 -28
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-dispatcher-NXBGPJOX.mjs → intent-dispatcher-SIYQ5ZIU.mjs} +2 -2
- package/dist/lib/node-esm/{intent-resolver-2ZKXI5ET.mjs → intent-resolver-7FYJMXAG.mjs} +7 -7
- package/dist/lib/node-esm/intent-resolver-7FYJMXAG.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{store-QQUTQHHT.mjs → store-6OBLTVXC.mjs} +4 -4
- package/dist/lib/node-esm/{store-QQUTQHHT.mjs.map → store-6OBLTVXC.mjs.map} +1 -1
- package/dist/lib/node-esm/testing/index.mjs +11 -14
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/worker.mjs +1 -9
- package/dist/types/src/common/capabilities.d.ts +14 -4
- package/dist/types/src/common/capabilities.d.ts.map +1 -1
- package/dist/types/src/common/collaboration.d.ts +1 -1
- package/dist/types/src/common/collaboration.d.ts.map +1 -1
- package/dist/types/src/common/file.d.ts +1 -1
- package/dist/types/src/common/file.d.ts.map +1 -1
- package/dist/types/src/common/layout.d.ts +1 -3
- package/dist/types/src/common/layout.d.ts.map +1 -1
- package/dist/types/src/common/surface.d.ts +7 -13
- package/dist/types/src/common/surface.d.ts.map +1 -1
- package/dist/types/src/common/translations.d.ts +1 -1
- package/dist/types/src/common/translations.d.ts.map +1 -1
- package/dist/types/src/components/App.stories.d.ts +0 -1
- package/dist/types/src/components/App.stories.d.ts.map +1 -1
- package/dist/types/src/components/useApp.d.ts.map +1 -1
- package/dist/types/src/core/capabilities.d.ts +1 -1
- package/dist/types/src/core/capabilities.d.ts.map +1 -1
- package/dist/types/src/core/manager.d.ts.map +1 -1
- package/dist/types/src/core/plugin.d.ts +4 -1
- package/dist/types/src/core/plugin.d.ts.map +1 -1
- package/dist/types/src/playground/debug/plugin.d.ts +1 -1
- package/dist/types/src/playground/debug/plugin.d.ts.map +1 -1
- package/dist/types/src/playground/generator/generator.d.ts +1 -1
- package/dist/types/src/playground/generator/generator.d.ts.map +1 -1
- package/dist/types/src/playground/generator/plugin.d.ts +1 -1
- package/dist/types/src/playground/generator/plugin.d.ts.map +1 -1
- package/dist/types/src/playground/layout/plugin.d.ts +1 -1
- package/dist/types/src/playground/layout/plugin.d.ts.map +1 -1
- package/dist/types/src/playground/logger/plugin.d.ts +1 -1
- package/dist/types/src/playground/logger/plugin.d.ts.map +1 -1
- package/dist/types/src/playground/logger/schema.d.ts +1 -1
- package/dist/types/src/playground/logger/schema.d.ts.map +1 -1
- package/dist/types/src/playground/playground.stories.d.ts +0 -1
- package/dist/types/src/playground/playground.stories.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/IntentPlugin.d.ts +1 -1
- package/dist/types/src/plugin-intent/IntentPlugin.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/actions.d.ts +5 -7
- package/dist/types/src/plugin-intent/actions.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/errors.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +4 -4
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/intent.d.ts +1 -1
- package/dist/types/src/plugin-intent/intent.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/meta.d.ts +3 -0
- package/dist/types/src/plugin-intent/meta.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +1 -1
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/actions.d.ts +5 -7
- package/dist/types/src/plugin-settings/actions.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/meta.d.ts +3 -0
- package/dist/types/src/plugin-settings/meta.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/translations.d.ts +2 -1
- package/dist/types/src/plugin-settings/translations.d.ts.map +1 -1
- package/dist/types/src/react/ErrorBoundary.d.ts +2 -2
- package/dist/types/src/react/ErrorBoundary.d.ts.map +1 -1
- package/dist/types/src/react/Surface.d.ts +2 -2
- package/dist/types/src/react/Surface.d.ts.map +1 -1
- package/dist/types/src/react/Surface.stories.d.ts +0 -1
- package/dist/types/src/react/Surface.stories.d.ts.map +1 -1
- package/dist/types/src/testing/withPluginManager.d.ts +2 -4
- package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/moon.yml +4 -0
- package/package.json +31 -30
- package/src/common/capabilities.ts +22 -4
- package/src/common/collaboration.ts +1 -1
- package/src/common/file.ts +1 -1
- package/src/common/layout.ts +3 -4
- package/src/common/surface.ts +15 -18
- package/src/common/translations.ts +1 -1
- package/src/components/App.stories.tsx +1 -3
- package/src/components/useApp.tsx +9 -11
- package/src/core/capabilities.test.ts +1 -1
- package/src/core/capabilities.ts +1 -1
- package/src/core/manager.test.ts +19 -19
- package/src/core/manager.ts +12 -5
- package/src/core/plugin.ts +8 -2
- package/src/playground/debug/plugin.ts +7 -8
- package/src/playground/generator/generator.ts +2 -2
- package/src/playground/generator/plugin.ts +12 -13
- package/src/playground/layout/plugin.ts +9 -8
- package/src/playground/logger/plugin.ts +27 -23
- package/src/playground/logger/schema.ts +1 -1
- package/src/playground/playground.stories.tsx +5 -6
- package/src/plugin-intent/IntentPlugin.ts +12 -13
- package/src/plugin-intent/actions.ts +4 -6
- package/src/plugin-intent/errors.ts +2 -1
- package/src/plugin-intent/intent-dispatcher.test.ts +10 -3
- package/src/plugin-intent/intent-dispatcher.ts +8 -6
- package/src/plugin-intent/intent.ts +1 -1
- package/src/plugin-intent/meta.ts +10 -0
- package/src/plugin-settings/SettingsPlugin.ts +25 -27
- package/src/plugin-settings/actions.ts +9 -13
- package/src/plugin-settings/app-graph-builder.ts +17 -15
- package/src/plugin-settings/intent-resolver.ts +2 -2
- package/src/plugin-settings/meta.ts +10 -0
- package/src/plugin-settings/translations.ts +3 -3
- package/src/react/ErrorBoundary.tsx +10 -8
- package/src/react/Surface.stories.tsx +2 -5
- package/src/react/Surface.tsx +11 -3
- package/src/testing/withPluginManager.stories.tsx +1 -1
- package/src/testing/withPluginManager.tsx +13 -17
- package/tsconfig.json +1 -1
- package/vitest.config.ts +8 -6
- package/dist/lib/browser/app-graph-builder-AFFC6VB2.mjs.map +0 -7
- package/dist/lib/browser/chunk-ORWHM7CO.mjs.map +0 -7
- package/dist/lib/browser/chunk-OZY7HV2A.mjs.map +0 -7
- package/dist/lib/browser/chunk-T6M7JB7M.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-4S4PSTM5.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-S4OAULX5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-F63ZRXMK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HJFU7QOR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UMZQERLE.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-2ZKXI5ET.mjs.map +0 -7
- /package/dist/lib/browser/{intent-dispatcher-QG7UPGQX.mjs.map → intent-dispatcher-6SHA5B3N.mjs.map} +0 -0
- /package/dist/lib/node-esm/{intent-dispatcher-NXBGPJOX.mjs.map → intent-dispatcher-SIYQ5ZIU.mjs.map} +0 -0
|
@@ -1,27 +1,30 @@
|
|
|
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
|
|
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
|
|
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,
|
|
18
|
+
function _define_property(obj, key, value2) {
|
|
16
19
|
if (key in obj) {
|
|
17
20
|
Object.defineProperty(obj, key, {
|
|
18
|
-
value,
|
|
21
|
+
value: value2,
|
|
19
22
|
enumerable: true,
|
|
20
23
|
configurable: true,
|
|
21
24
|
writable: true
|
|
22
25
|
});
|
|
23
26
|
} else {
|
|
24
|
-
obj[key] =
|
|
27
|
+
obj[key] = value2;
|
|
25
28
|
}
|
|
26
29
|
return obj;
|
|
27
30
|
}
|
|
@@ -225,26 +228,33 @@ var getEvents = (events) => "type" in events ? events.events : [
|
|
|
225
228
|
// src/core/manager.ts
|
|
226
229
|
import { Registry } from "@effect-rx/rx-react";
|
|
227
230
|
import { untracked } from "@preact/signals-core";
|
|
228
|
-
import
|
|
231
|
+
import * as Array from "effect/Array";
|
|
232
|
+
import * as Duration from "effect/Duration";
|
|
233
|
+
import * as Effect2 from "effect/Effect";
|
|
234
|
+
import * as Fiber from "effect/Fiber";
|
|
235
|
+
import * as Function from "effect/Function";
|
|
236
|
+
import * as HashSet from "effect/HashSet";
|
|
237
|
+
import * as Match from "effect/Match";
|
|
238
|
+
import * as Ref from "effect/Ref";
|
|
229
239
|
import { Event } from "@dxos/async";
|
|
230
240
|
import { live } from "@dxos/live-object";
|
|
231
241
|
import { log as log2 } from "@dxos/log";
|
|
232
|
-
function _define_property2(obj, key,
|
|
242
|
+
function _define_property2(obj, key, value2) {
|
|
233
243
|
if (key in obj) {
|
|
234
244
|
Object.defineProperty(obj, key, {
|
|
235
|
-
value,
|
|
245
|
+
value: value2,
|
|
236
246
|
enumerable: true,
|
|
237
247
|
configurable: true,
|
|
238
248
|
writable: true
|
|
239
249
|
});
|
|
240
250
|
} else {
|
|
241
|
-
obj[key] =
|
|
251
|
+
obj[key] = value2;
|
|
242
252
|
}
|
|
243
253
|
return obj;
|
|
244
254
|
}
|
|
245
255
|
var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/manager.ts";
|
|
246
|
-
var isPromise = (
|
|
247
|
-
return
|
|
256
|
+
var isPromise = (value2) => {
|
|
257
|
+
return value2 !== null && typeof value2 === "object" && "then" in value2;
|
|
248
258
|
};
|
|
249
259
|
var PluginManager = class {
|
|
250
260
|
/**
|
|
@@ -313,7 +323,7 @@ var PluginManager = class {
|
|
|
313
323
|
id
|
|
314
324
|
}, {
|
|
315
325
|
F: __dxlog_file2,
|
|
316
|
-
L:
|
|
326
|
+
L: 164,
|
|
317
327
|
S: this,
|
|
318
328
|
C: (f, a) => f(...a)
|
|
319
329
|
});
|
|
@@ -332,7 +342,7 @@ var PluginManager = class {
|
|
|
332
342
|
id
|
|
333
343
|
}, {
|
|
334
344
|
F: __dxlog_file2,
|
|
335
|
-
L:
|
|
345
|
+
L: 177,
|
|
336
346
|
S: this,
|
|
337
347
|
C: (f, a) => f(...a)
|
|
338
348
|
});
|
|
@@ -353,7 +363,7 @@ var PluginManager = class {
|
|
|
353
363
|
]
|
|
354
364
|
}, {
|
|
355
365
|
F: __dxlog_file2,
|
|
356
|
-
L:
|
|
366
|
+
L: 192,
|
|
357
367
|
S: this,
|
|
358
368
|
C: (f, a) => f(...a)
|
|
359
369
|
});
|
|
@@ -373,7 +383,7 @@ var PluginManager = class {
|
|
|
373
383
|
id
|
|
374
384
|
}, {
|
|
375
385
|
F: __dxlog_file2,
|
|
376
|
-
L:
|
|
386
|
+
L: 210,
|
|
377
387
|
S: this,
|
|
378
388
|
C: (f, a) => f(...a)
|
|
379
389
|
});
|
|
@@ -395,7 +405,7 @@ var PluginManager = class {
|
|
|
395
405
|
id
|
|
396
406
|
}, {
|
|
397
407
|
F: __dxlog_file2,
|
|
398
|
-
L:
|
|
408
|
+
L: 227,
|
|
399
409
|
S: this,
|
|
400
410
|
C: (f, a) => f(...a)
|
|
401
411
|
});
|
|
@@ -447,7 +457,7 @@ var PluginManager = class {
|
|
|
447
457
|
id: plugin.meta.id
|
|
448
458
|
}, {
|
|
449
459
|
F: __dxlog_file2,
|
|
450
|
-
L:
|
|
460
|
+
L: 280,
|
|
451
461
|
S: this,
|
|
452
462
|
C: (f, a) => f(...a)
|
|
453
463
|
});
|
|
@@ -462,7 +472,7 @@ var PluginManager = class {
|
|
|
462
472
|
id
|
|
463
473
|
}, {
|
|
464
474
|
F: __dxlog_file2,
|
|
465
|
-
L:
|
|
475
|
+
L: 290,
|
|
466
476
|
S: this,
|
|
467
477
|
C: (f, a) => f(...a)
|
|
468
478
|
});
|
|
@@ -478,7 +488,7 @@ var PluginManager = class {
|
|
|
478
488
|
id: module.id
|
|
479
489
|
}, {
|
|
480
490
|
F: __dxlog_file2,
|
|
481
|
-
L:
|
|
491
|
+
L: 300,
|
|
482
492
|
S: this,
|
|
483
493
|
C: (f, a) => f(...a)
|
|
484
494
|
});
|
|
@@ -493,7 +503,7 @@ var PluginManager = class {
|
|
|
493
503
|
id
|
|
494
504
|
}, {
|
|
495
505
|
F: __dxlog_file2,
|
|
496
|
-
L:
|
|
506
|
+
L: 310,
|
|
497
507
|
S: this,
|
|
498
508
|
C: (f, a) => f(...a)
|
|
499
509
|
});
|
|
@@ -527,7 +537,7 @@ var PluginManager = class {
|
|
|
527
537
|
events: pendingReset
|
|
528
538
|
}, {
|
|
529
539
|
F: __dxlog_file2,
|
|
530
|
-
L:
|
|
540
|
+
L: 348,
|
|
531
541
|
S: this,
|
|
532
542
|
C: (f, a) => f(...a)
|
|
533
543
|
});
|
|
@@ -547,7 +557,7 @@ var PluginManager = class {
|
|
|
547
557
|
...params
|
|
548
558
|
}, {
|
|
549
559
|
F: __dxlog_file2,
|
|
550
|
-
L:
|
|
560
|
+
L: 364,
|
|
551
561
|
S: this,
|
|
552
562
|
C: (f, a) => f(...a)
|
|
553
563
|
});
|
|
@@ -572,7 +582,7 @@ var PluginManager = class {
|
|
|
572
582
|
key
|
|
573
583
|
}, {
|
|
574
584
|
F: __dxlog_file2,
|
|
575
|
-
L:
|
|
585
|
+
L: 395,
|
|
576
586
|
S: this,
|
|
577
587
|
C: (f, a) => f(...a)
|
|
578
588
|
});
|
|
@@ -586,7 +596,7 @@ var PluginManager = class {
|
|
|
586
596
|
modules: modules.map((module) => module.id)
|
|
587
597
|
}, {
|
|
588
598
|
F: __dxlog_file2,
|
|
589
|
-
L:
|
|
599
|
+
L: 402,
|
|
590
600
|
S: this,
|
|
591
601
|
C: (f, a) => f(...a)
|
|
592
602
|
});
|
|
@@ -594,12 +604,12 @@ var PluginManager = class {
|
|
|
594
604
|
event: key,
|
|
595
605
|
state: "activating"
|
|
596
606
|
});
|
|
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, {
|
|
607
|
+
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
608
|
before: key
|
|
599
609
|
})), Effect2.allWith({
|
|
600
610
|
concurrency: "unbounded"
|
|
601
611
|
}));
|
|
602
|
-
const getCapabilities = yield* pipe(modules, Array.map((mod) => this._loadModule(mod)), Effect2.allWith({
|
|
612
|
+
const getCapabilities = yield* Function.pipe(modules, Array.map((mod) => this._loadModule(mod)), Effect2.allWith({
|
|
603
613
|
concurrency: "unbounded"
|
|
604
614
|
}), Effect2.catchAll((error) => {
|
|
605
615
|
this.activation.emit({
|
|
@@ -609,15 +619,13 @@ var PluginManager = class {
|
|
|
609
619
|
});
|
|
610
620
|
return Effect2.fail(error);
|
|
611
621
|
}));
|
|
612
|
-
yield* pipe(
|
|
622
|
+
yield* Function.pipe(
|
|
613
623
|
modules,
|
|
614
624
|
Array.zip(getCapabilities),
|
|
615
625
|
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
626
|
Effect2.all
|
|
619
627
|
);
|
|
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, {
|
|
628
|
+
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
629
|
after: key
|
|
622
630
|
})), Effect2.allWith({
|
|
623
631
|
concurrency: "unbounded"
|
|
@@ -635,7 +643,7 @@ var PluginManager = class {
|
|
|
635
643
|
key
|
|
636
644
|
}, {
|
|
637
645
|
F: __dxlog_file2,
|
|
638
|
-
L:
|
|
646
|
+
L: 458,
|
|
639
647
|
S: this,
|
|
640
648
|
C: (f, a) => f(...a)
|
|
641
649
|
});
|
|
@@ -674,7 +682,7 @@ var PluginManager = class {
|
|
|
674
682
|
id
|
|
675
683
|
}, {
|
|
676
684
|
F: __dxlog_file2,
|
|
677
|
-
L:
|
|
685
|
+
L: 540,
|
|
678
686
|
S: this,
|
|
679
687
|
C: (f, a) => f(...a)
|
|
680
688
|
});
|
|
@@ -684,8 +692,8 @@ var PluginManager = class {
|
|
|
684
692
|
for (const capability of capabilities) {
|
|
685
693
|
this.context.removeCapability(capability.interface, capability.implementation);
|
|
686
694
|
const program = capability.deactivate?.();
|
|
687
|
-
yield* Match.value(program).pipe(Match.when(Effect2.isEffect, (effect) => effect), Match.when(isPromise, (
|
|
688
|
-
try: () =>
|
|
695
|
+
yield* Match.value(program).pipe(Match.when(Effect2.isEffect, (effect) => effect), Match.when(isPromise, (promise2) => Effect2.tryPromise({
|
|
696
|
+
try: () => promise2,
|
|
689
697
|
catch: (error) => error
|
|
690
698
|
})), Match.orElse((program2) => Effect2.succeed(program2)));
|
|
691
699
|
}
|
|
@@ -699,7 +707,7 @@ var PluginManager = class {
|
|
|
699
707
|
id
|
|
700
708
|
}, {
|
|
701
709
|
F: __dxlog_file2,
|
|
702
|
-
L:
|
|
710
|
+
L: 567,
|
|
703
711
|
S: this,
|
|
704
712
|
C: (f, a) => f(...a)
|
|
705
713
|
});
|
|
@@ -713,7 +721,7 @@ var PluginManager = class {
|
|
|
713
721
|
key
|
|
714
722
|
}, {
|
|
715
723
|
F: __dxlog_file2,
|
|
716
|
-
L:
|
|
724
|
+
L: 575,
|
|
717
725
|
S: this,
|
|
718
726
|
C: (f, a) => f(...a)
|
|
719
727
|
});
|
|
@@ -728,7 +736,7 @@ var PluginManager = class {
|
|
|
728
736
|
}
|
|
729
737
|
});
|
|
730
738
|
}
|
|
731
|
-
constructor({ pluginLoader, plugins = [], core = plugins.map(({ meta }) =>
|
|
739
|
+
constructor({ pluginLoader, plugins = [], core = plugins.map(({ meta: meta2 }) => meta2.id), enabled = [], registry }) {
|
|
732
740
|
_define_property2(this, "activation", new Event());
|
|
733
741
|
_define_property2(this, "context", void 0);
|
|
734
742
|
_define_property2(this, "registry", void 0);
|
|
@@ -744,7 +752,7 @@ var PluginManager = class {
|
|
|
744
752
|
if (entry) {
|
|
745
753
|
return entry;
|
|
746
754
|
}
|
|
747
|
-
const
|
|
755
|
+
const promise2 = (async () => {
|
|
748
756
|
const start = performance.now();
|
|
749
757
|
let failed = false;
|
|
750
758
|
try {
|
|
@@ -752,7 +760,7 @@ var PluginManager = class {
|
|
|
752
760
|
module: mod.id
|
|
753
761
|
}, {
|
|
754
762
|
F: __dxlog_file2,
|
|
755
|
-
L:
|
|
763
|
+
L: 477,
|
|
756
764
|
S: this,
|
|
757
765
|
C: (f, a) => f(...a)
|
|
758
766
|
});
|
|
@@ -780,21 +788,21 @@ var PluginManager = class {
|
|
|
780
788
|
failed
|
|
781
789
|
}, {
|
|
782
790
|
F: __dxlog_file2,
|
|
783
|
-
L:
|
|
791
|
+
L: 495,
|
|
784
792
|
S: this,
|
|
785
793
|
C: (f, a) => f(...a)
|
|
786
794
|
});
|
|
787
795
|
}
|
|
788
796
|
})();
|
|
789
|
-
this._moduleMemoMap.set(mod.id,
|
|
790
|
-
return
|
|
797
|
+
this._moduleMemoMap.set(mod.id, promise2);
|
|
798
|
+
return promise2;
|
|
791
799
|
},
|
|
792
800
|
catch: (error) => error
|
|
793
801
|
}).pipe(Effect2.withSpan("PluginManager._loadModule"), together(Effect2.sleep(Duration.seconds(10)).pipe(Effect2.andThen(Effect2.sync(() => log2.warn(`module is taking a long time to activate`, {
|
|
794
802
|
module: mod.id
|
|
795
803
|
}, {
|
|
796
804
|
F: __dxlog_file2,
|
|
797
|
-
L:
|
|
805
|
+
L: 506,
|
|
798
806
|
S: this,
|
|
799
807
|
C: (f, a) => f(...a)
|
|
800
808
|
})))))));
|
|
@@ -827,16 +835,16 @@ var together = (togetherEffect) => (effect) => Effect2.gen(function* () {
|
|
|
827
835
|
});
|
|
828
836
|
|
|
829
837
|
// src/core/plugin.ts
|
|
830
|
-
function _define_property3(obj, key,
|
|
838
|
+
function _define_property3(obj, key, value2) {
|
|
831
839
|
if (key in obj) {
|
|
832
840
|
Object.defineProperty(obj, key, {
|
|
833
|
-
value,
|
|
841
|
+
value: value2,
|
|
834
842
|
enumerable: true,
|
|
835
843
|
configurable: true,
|
|
836
844
|
writable: true
|
|
837
845
|
});
|
|
838
846
|
} else {
|
|
839
|
-
obj[key] =
|
|
847
|
+
obj[key] = value2;
|
|
840
848
|
}
|
|
841
849
|
return obj;
|
|
842
850
|
}
|
|
@@ -856,15 +864,20 @@ var PluginModule = class {
|
|
|
856
864
|
};
|
|
857
865
|
var defineModule = (options) => new PluginModule(options);
|
|
858
866
|
var Plugin = class {
|
|
859
|
-
constructor(
|
|
867
|
+
constructor(meta2, modules) {
|
|
860
868
|
_define_property3(this, "meta", void 0);
|
|
861
869
|
_define_property3(this, "modules", void 0);
|
|
862
|
-
this.meta =
|
|
870
|
+
this.meta = meta2;
|
|
863
871
|
this.modules = modules;
|
|
864
872
|
}
|
|
865
873
|
};
|
|
866
|
-
var definePlugin = (
|
|
867
|
-
|
|
874
|
+
var definePlugin = (meta2, provider) => {
|
|
875
|
+
const factory = (args) => {
|
|
876
|
+
return new Plugin(meta2, provider(args));
|
|
877
|
+
};
|
|
878
|
+
return Object.assign(factory, {
|
|
879
|
+
meta: meta2
|
|
880
|
+
});
|
|
868
881
|
};
|
|
869
882
|
|
|
870
883
|
// src/common/capabilities.ts
|
|
@@ -888,6 +901,8 @@ var definePlugin = (meta, modules) => {
|
|
|
888
901
|
Capabilities2.Toolkit = defineCapability("dxos.org/app-framework/capability/ai-toolkit");
|
|
889
902
|
Capabilities2.ToolkitHandler = defineCapability("dxos.org/app-framework/capability/ai-toolkit-handler");
|
|
890
903
|
Capabilities2.BlueprintDefinition = defineCapability("dxos.org/app-framework/capability/blueprint-definition");
|
|
904
|
+
Capabilities2.AiServiceLayer = defineCapability("dxos.org/app-framework/capability/ai-service-factory");
|
|
905
|
+
Capabilities2.AiModelResolver = defineCapability("dxos.org/app-framework/capability/ai-model-resolver");
|
|
891
906
|
Capabilities2.Functions = defineCapability("dxos.org/app-framework/capability/functions");
|
|
892
907
|
Capabilities2.FileUploader = defineCapability("dxos.org/app-framework/capability/file-uploader");
|
|
893
908
|
Capabilities2.AnchorSort = defineCapability("dxos.org/app-framework/capability/anchor-sort");
|
|
@@ -895,7 +910,7 @@ var definePlugin = (meta, modules) => {
|
|
|
895
910
|
var Capabilities;
|
|
896
911
|
|
|
897
912
|
// src/common/collaboration.ts
|
|
898
|
-
import
|
|
913
|
+
import * as Schema from "effect/Schema";
|
|
899
914
|
import { DataType } from "@dxos/schema";
|
|
900
915
|
(function(CollaborationActions2) {
|
|
901
916
|
class AcceptProposal extends Schema.TaggedClass()("collaboration/accept-proposal", {
|
|
@@ -930,7 +945,7 @@ var CollaborationActions;
|
|
|
930
945
|
var Events;
|
|
931
946
|
|
|
932
947
|
// src/common/file.ts
|
|
933
|
-
import
|
|
948
|
+
import * as Schema2 from "effect/Schema";
|
|
934
949
|
var defaultFileTypes = {
|
|
935
950
|
images: [
|
|
936
951
|
"png",
|
|
@@ -958,13 +973,13 @@ var FileInfoSchema = Schema2.Struct({
|
|
|
958
973
|
});
|
|
959
974
|
|
|
960
975
|
// src/common/layout.ts
|
|
961
|
-
import
|
|
976
|
+
import * as Schema5 from "effect/Schema";
|
|
962
977
|
|
|
963
978
|
// src/plugin-intent/actions.ts
|
|
964
|
-
import
|
|
979
|
+
import * as Schema4 from "effect/Schema";
|
|
965
980
|
|
|
966
981
|
// src/plugin-intent/intent.ts
|
|
967
|
-
import
|
|
982
|
+
import * as Schema3 from "effect/Schema";
|
|
968
983
|
var createIntent = (schema, data = {}, params = {}) => {
|
|
969
984
|
const _ = Schema3.validateSync(schema.fields.input)(data);
|
|
970
985
|
const intent = {
|
|
@@ -1007,11 +1022,15 @@ var Label = Schema3.Union(Schema3.String, Schema3.mutable(Schema3.Tuple(Schema3.
|
|
|
1007
1022
|
defaultValue: Schema3.optional(Schema3.String)
|
|
1008
1023
|
})))));
|
|
1009
1024
|
|
|
1025
|
+
// src/plugin-intent/meta.ts
|
|
1026
|
+
var meta = {
|
|
1027
|
+
id: "dxos.org/plugin/intent",
|
|
1028
|
+
name: "Intent"
|
|
1029
|
+
};
|
|
1030
|
+
|
|
1010
1031
|
// src/plugin-intent/actions.ts
|
|
1011
|
-
var INTENT_PLUGIN = "dxos.org/plugin/intent";
|
|
1012
|
-
var INTENT_ACTION = `${INTENT_PLUGIN}/action`;
|
|
1013
1032
|
(function(IntentAction2) {
|
|
1014
|
-
class Track extends Schema4.TaggedClass()(`${
|
|
1033
|
+
class Track extends Schema4.TaggedClass()(`${meta.id}/action/track`, {
|
|
1015
1034
|
input: Schema4.Struct({
|
|
1016
1035
|
intents: Schema4.Array(Schema4.String),
|
|
1017
1036
|
error: Schema4.optional(Schema4.String)
|
|
@@ -1020,7 +1039,7 @@ var INTENT_ACTION = `${INTENT_PLUGIN}/action`;
|
|
|
1020
1039
|
}) {
|
|
1021
1040
|
}
|
|
1022
1041
|
IntentAction2.Track = Track;
|
|
1023
|
-
class ShowUndo extends Schema4.TaggedClass()(`${
|
|
1042
|
+
class ShowUndo extends Schema4.TaggedClass()(`${meta.id}/action/show-undo`, {
|
|
1024
1043
|
input: Schema4.Struct({
|
|
1025
1044
|
message: Label
|
|
1026
1045
|
}),
|
|
@@ -1032,16 +1051,16 @@ var INTENT_ACTION = `${INTENT_PLUGIN}/action`;
|
|
|
1032
1051
|
var IntentAction;
|
|
1033
1052
|
|
|
1034
1053
|
// src/plugin-intent/errors.ts
|
|
1035
|
-
function _define_property4(obj, key,
|
|
1054
|
+
function _define_property4(obj, key, value2) {
|
|
1036
1055
|
if (key in obj) {
|
|
1037
1056
|
Object.defineProperty(obj, key, {
|
|
1038
|
-
value,
|
|
1057
|
+
value: value2,
|
|
1039
1058
|
enumerable: true,
|
|
1040
1059
|
configurable: true,
|
|
1041
1060
|
writable: true
|
|
1042
1061
|
});
|
|
1043
1062
|
} else {
|
|
1044
|
-
obj[key] =
|
|
1063
|
+
obj[key] = value2;
|
|
1045
1064
|
}
|
|
1046
1065
|
return obj;
|
|
1047
1066
|
}
|
|
@@ -1056,7 +1075,7 @@ var BaseError = class extends Error {
|
|
|
1056
1075
|
};
|
|
1057
1076
|
var NoResolversError = class extends BaseError {
|
|
1058
1077
|
constructor(action) {
|
|
1059
|
-
super("NO_RESOLVERS",
|
|
1078
|
+
super("NO_RESOLVERS", `No resolvers were found for the action: ${action}`, {
|
|
1060
1079
|
action
|
|
1061
1080
|
});
|
|
1062
1081
|
}
|
|
@@ -1068,12 +1087,9 @@ var CycleDetectedError = class extends BaseError {
|
|
|
1068
1087
|
};
|
|
1069
1088
|
|
|
1070
1089
|
// src/plugin-intent/IntentPlugin.ts
|
|
1071
|
-
var IntentPlugin = () =>
|
|
1072
|
-
id: INTENT_PLUGIN,
|
|
1073
|
-
name: "Intent"
|
|
1074
|
-
}, [
|
|
1090
|
+
var IntentPlugin = definePlugin(meta, () => [
|
|
1075
1091
|
defineModule({
|
|
1076
|
-
id: `${
|
|
1092
|
+
id: `${meta.id}/module/dispatcher`,
|
|
1077
1093
|
// TODO(wittjosiah): This will mean that startup needs to be reset when intents are added or removed.
|
|
1078
1094
|
// This is fine for now because it's how it worked prior to capabilities api anyways.
|
|
1079
1095
|
// In the future, the intent dispatcher should be able to be reset without resetting the entire app.
|
|
@@ -1081,15 +1097,14 @@ var IntentPlugin = () => definePlugin({
|
|
|
1081
1097
|
activatesAfter: [
|
|
1082
1098
|
Events.DispatcherReady
|
|
1083
1099
|
],
|
|
1084
|
-
activate: lazy(() => import("./intent-dispatcher-
|
|
1100
|
+
activate: lazy(() => import("./intent-dispatcher-SIYQ5ZIU.mjs"))
|
|
1085
1101
|
})
|
|
1086
1102
|
]);
|
|
1087
1103
|
|
|
1088
1104
|
// src/common/layout.ts
|
|
1089
1105
|
var LAYOUT_PLUGIN = "dxos.org/plugin/layout";
|
|
1090
|
-
var LAYOUT_ACTION = `${LAYOUT_PLUGIN}/action`;
|
|
1091
1106
|
(function(LayoutAction2) {
|
|
1092
|
-
LayoutAction2.UPDATE_LAYOUT = `${
|
|
1107
|
+
LayoutAction2.UPDATE_LAYOUT = `${LAYOUT_PLUGIN}/action/update-layout`;
|
|
1093
1108
|
class UpdateLayout extends Schema5.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
1094
1109
|
input: Schema5.Struct({
|
|
1095
1110
|
part: Schema5.String.annotations({
|
|
@@ -1426,7 +1441,7 @@ var LayoutAction;
|
|
|
1426
1441
|
var createSurface = (definition) => definition;
|
|
1427
1442
|
|
|
1428
1443
|
// src/common/translations.ts
|
|
1429
|
-
import
|
|
1444
|
+
import * as Schema6 from "effect/Schema";
|
|
1430
1445
|
var ResourceKey = Schema6.Union(Schema6.String, Schema6.Record({
|
|
1431
1446
|
key: Schema6.String,
|
|
1432
1447
|
value: Schema6.Any
|
|
@@ -1451,14 +1466,6 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1451
1466
|
const handleIntent = (intent) => Effect3.gen(function* () {
|
|
1452
1467
|
const candidates = getResolvers().filter((resolver) => resolver.intent._tag === intent.id).filter((resolver) => !resolver.filter || resolver.filter(intent.data)).toSorted(byPosition);
|
|
1453
1468
|
if (candidates.length === 0) {
|
|
1454
|
-
log3.info("no resolvers found", {
|
|
1455
|
-
intent: intent.id
|
|
1456
|
-
}, {
|
|
1457
|
-
F: __dxlog_file3,
|
|
1458
|
-
L: 200,
|
|
1459
|
-
S: this,
|
|
1460
|
-
C: (f, a) => f(...a)
|
|
1461
|
-
});
|
|
1462
1469
|
return yield* Effect3.fail(new NoResolversError(intent.id));
|
|
1463
1470
|
}
|
|
1464
1471
|
const effect = candidates[0].resolve(intent.data, intent.undo ?? false);
|
|
@@ -1509,7 +1516,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1509
1516
|
return next;
|
|
1510
1517
|
});
|
|
1511
1518
|
if (result.undoable && isUndoable(results)) {
|
|
1512
|
-
yield*
|
|
1519
|
+
yield* Function2.pipe(dispatch(createIntent(IntentAction.ShowUndo, {
|
|
1513
1520
|
message: result.undoable.message
|
|
1514
1521
|
})), Effect3.catchSome((err) => err instanceof NoResolversError ? Option.some(Effect3.succeed(void 0)) : Option.none()));
|
|
1515
1522
|
}
|
|
@@ -1522,7 +1529,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1522
1529
|
})).catch((error) => {
|
|
1523
1530
|
log3.catch(error, void 0, {
|
|
1524
1531
|
F: __dxlog_file3,
|
|
1525
|
-
L:
|
|
1532
|
+
L: 274,
|
|
1526
1533
|
S: void 0,
|
|
1527
1534
|
C: (f, a) => f(...a)
|
|
1528
1535
|
});
|
|
@@ -1537,7 +1544,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1537
1544
|
const last = history.findLastIndex(isUndoable);
|
|
1538
1545
|
const result = last !== -1 ? history[last] : void 0;
|
|
1539
1546
|
if (result) {
|
|
1540
|
-
const
|
|
1547
|
+
const all2 = result.map(({ _intent, undoable }) => {
|
|
1541
1548
|
const data = _intent.data;
|
|
1542
1549
|
const undoData = undoable?.data ?? {};
|
|
1543
1550
|
return {
|
|
@@ -1550,9 +1557,9 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1550
1557
|
};
|
|
1551
1558
|
});
|
|
1552
1559
|
const intent = {
|
|
1553
|
-
first:
|
|
1554
|
-
last:
|
|
1555
|
-
all
|
|
1560
|
+
first: all2[0],
|
|
1561
|
+
last: all2.at(-1),
|
|
1562
|
+
all: all2
|
|
1556
1563
|
};
|
|
1557
1564
|
yield* Ref2.update(historyRef, (h) => h.filter((_, index) => index !== last));
|
|
1558
1565
|
return yield* dispatch(intent);
|
|
@@ -1575,7 +1582,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1575
1582
|
};
|
|
1576
1583
|
var defaultEffect = () => Effect3.fail(new Error("Intent runtime not ready"));
|
|
1577
1584
|
var defaultPromise = () => Effect3.runPromise(defaultEffect());
|
|
1578
|
-
var intent_dispatcher_default = (context) => {
|
|
1585
|
+
var intent_dispatcher_default = ((context) => {
|
|
1579
1586
|
const state = live2({
|
|
1580
1587
|
dispatch: defaultEffect,
|
|
1581
1588
|
dispatchPromise: defaultPromise,
|
|
@@ -1597,7 +1604,7 @@ var intent_dispatcher_default = (context) => {
|
|
|
1597
1604
|
state.undo = undo;
|
|
1598
1605
|
state.undoPromise = undoPromise;
|
|
1599
1606
|
return contributes(Capabilities.IntentDispatcher, state);
|
|
1600
|
-
};
|
|
1607
|
+
});
|
|
1601
1608
|
|
|
1602
1609
|
export {
|
|
1603
1610
|
defineCapability,
|
|
@@ -1624,8 +1631,6 @@ export {
|
|
|
1624
1631
|
createIntent,
|
|
1625
1632
|
chain,
|
|
1626
1633
|
Label,
|
|
1627
|
-
INTENT_PLUGIN,
|
|
1628
|
-
INTENT_ACTION,
|
|
1629
1634
|
IntentAction,
|
|
1630
1635
|
BaseError,
|
|
1631
1636
|
NoResolversError,
|
|
@@ -1634,12 +1639,10 @@ export {
|
|
|
1634
1639
|
createDispatcher,
|
|
1635
1640
|
intent_dispatcher_default,
|
|
1636
1641
|
IntentPlugin,
|
|
1637
|
-
LAYOUT_PLUGIN,
|
|
1638
|
-
LAYOUT_ACTION,
|
|
1639
1642
|
LayoutAction,
|
|
1640
1643
|
createSurface,
|
|
1641
1644
|
ResourceKey,
|
|
1642
1645
|
ResourceLanguage,
|
|
1643
1646
|
Resource
|
|
1644
1647
|
};
|
|
1645
|
-
//# sourceMappingURL=chunk-
|
|
1648
|
+
//# sourceMappingURL=chunk-KSPOOYT3.mjs.map
|