@dxos/app-framework 0.8.4-main.a4bbb77 → 0.8.4-main.ae835ea
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{app-graph-builder-XH4OYQLC.mjs → app-graph-builder-PSA3RESL.mjs} +9 -8
- package/dist/lib/browser/app-graph-builder-PSA3RESL.mjs.map +7 -0
- package/dist/lib/browser/{chunk-6V54SRFL.mjs → chunk-2VZ4RF4A.mjs} +202 -232
- package/dist/lib/browser/chunk-2VZ4RF4A.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ZZVFNUHZ.mjs → chunk-CPVYIS24.mjs} +9 -25
- package/dist/lib/browser/chunk-CPVYIS24.mjs.map +7 -0
- package/dist/lib/browser/{chunk-RGKMLI6U.mjs → chunk-SCPE4ZO2.mjs} +2 -2
- package/dist/lib/browser/chunk-SCPE4ZO2.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +6 -6
- package/dist/lib/browser/{intent-dispatcher-VFMJVO2M.mjs → intent-dispatcher-BND6IF4U.mjs} +2 -2
- package/dist/lib/browser/{intent-resolver-ICAPD4JL.mjs → intent-resolver-27FJAJDE.mjs} +5 -5
- package/dist/lib/browser/intent-resolver-27FJAJDE.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{store-7ZGMHOGB.mjs → store-F545UOIR.mjs} +2 -2
- package/dist/lib/browser/testing/index.mjs +5 -4
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/browser/worker.mjs +1 -1
- package/dist/lib/node-esm/{app-graph-builder-C7H22SOL.mjs → app-graph-builder-VJGZ6KH7.mjs} +9 -8
- package/dist/lib/node-esm/app-graph-builder-VJGZ6KH7.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-SOVTUUAY.mjs → chunk-3RRWO5TD.mjs} +202 -232
- package/dist/lib/node-esm/chunk-3RRWO5TD.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-AXSZKZFD.mjs → chunk-MN37WUJ2.mjs} +9 -25
- package/dist/lib/node-esm/chunk-MN37WUJ2.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-LKPMRTRR.mjs → chunk-ZX63QUGE.mjs} +2 -2
- package/dist/lib/node-esm/chunk-ZX63QUGE.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +6 -6
- package/dist/lib/node-esm/{intent-dispatcher-SAPOKSLZ.mjs → intent-dispatcher-254AZ6EE.mjs} +2 -2
- package/dist/lib/node-esm/{intent-resolver-CRNJ6BMD.mjs → intent-resolver-NPMOPNFL.mjs} +5 -5
- package/dist/lib/node-esm/intent-resolver-NPMOPNFL.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{store-H4F4RMYD.mjs → store-CINC4R4L.mjs} +2 -2
- package/dist/lib/node-esm/testing/index.mjs +5 -4
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/worker.mjs +1 -1
- package/dist/types/src/common/capabilities.d.ts +7 -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 -1
- package/dist/types/src/common/layout.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/core/capabilities.d.ts +4 -4
- 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 -0
- package/dist/types/src/core/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/plugin-intent/actions.d.ts +1 -1
- package/dist/types/src/plugin-intent/actions.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-settings/actions.d.ts +1 -1
- 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/testing/withPluginManager.d.ts +3 -2
- package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +23 -23
- package/src/common/capabilities.ts +7 -4
- package/src/common/collaboration.ts +1 -1
- package/src/common/file.ts +1 -1
- package/src/common/layout.ts +1 -1
- package/src/common/translations.ts +1 -1
- package/src/core/capabilities.test.ts +1 -1
- package/src/core/capabilities.ts +10 -6
- package/src/core/manager.test.ts +1 -1
- package/src/core/manager.ts +12 -5
- package/src/core/plugin.ts +5 -0
- package/src/playground/generator/generator.ts +1 -1
- package/src/playground/logger/schema.ts +1 -1
- package/src/plugin-intent/actions.ts +1 -1
- package/src/plugin-intent/errors.ts +1 -1
- package/src/plugin-intent/intent-dispatcher.test.ts +10 -3
- package/src/plugin-intent/intent-dispatcher.ts +8 -5
- package/src/plugin-intent/intent.ts +1 -1
- package/src/plugin-settings/actions.ts +1 -1
- package/src/plugin-settings/app-graph-builder.ts +6 -5
- package/src/plugin-settings/intent-resolver.ts +2 -2
- package/src/react/ErrorBoundary.tsx +8 -6
- package/src/testing/withPluginManager.tsx +8 -3
- package/tsconfig.json +1 -1
- package/dist/lib/browser/app-graph-builder-XH4OYQLC.mjs.map +0 -7
- package/dist/lib/browser/chunk-6V54SRFL.mjs.map +0 -7
- package/dist/lib/browser/chunk-RGKMLI6U.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZZVFNUHZ.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-ICAPD4JL.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-C7H22SOL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AXSZKZFD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LKPMRTRR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SOVTUUAY.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-CRNJ6BMD.mjs.map +0 -7
- /package/dist/lib/browser/{intent-dispatcher-VFMJVO2M.mjs.map → intent-dispatcher-BND6IF4U.mjs.map} +0 -0
- /package/dist/lib/browser/{store-7ZGMHOGB.mjs.map → store-F545UOIR.mjs.map} +0 -0
- /package/dist/lib/node-esm/{intent-dispatcher-SAPOKSLZ.mjs.map → intent-dispatcher-254AZ6EE.mjs.map} +0 -0
- /package/dist/lib/node-esm/{store-H4F4RMYD.mjs.map → store-CINC4R4L.mjs.map} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/app-framework",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.ae835ea",
|
|
4
4
|
"description": "A framework for building applications from composible plugins.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -44,35 +44,35 @@
|
|
|
44
44
|
"@effect/experimental": "0.56.0",
|
|
45
45
|
"@preact-signals/safe-react": "^0.9.0",
|
|
46
46
|
"@preact/signals-core": "^1.12.1",
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/functions": "0.8.4-main.
|
|
55
|
-
"@dxos/invariant": "0.8.4-main.
|
|
56
|
-
"@dxos/keys": "0.8.4-main.
|
|
57
|
-
"@dxos/live-object": "0.8.4-main.
|
|
58
|
-
"@dxos/local-storage": "0.8.4-main.
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/util": "0.8.4-main.
|
|
47
|
+
"@dxos/ai": "0.8.4-main.ae835ea",
|
|
48
|
+
"@dxos/app-graph": "0.8.4-main.ae835ea",
|
|
49
|
+
"@dxos/async": "0.8.4-main.ae835ea",
|
|
50
|
+
"@dxos/blueprints": "0.8.4-main.ae835ea",
|
|
51
|
+
"@dxos/debug": "0.8.4-main.ae835ea",
|
|
52
|
+
"@dxos/echo": "0.8.4-main.ae835ea",
|
|
53
|
+
"@dxos/client-protocol": "0.8.4-main.ae835ea",
|
|
54
|
+
"@dxos/functions": "0.8.4-main.ae835ea",
|
|
55
|
+
"@dxos/invariant": "0.8.4-main.ae835ea",
|
|
56
|
+
"@dxos/keys": "0.8.4-main.ae835ea",
|
|
57
|
+
"@dxos/live-object": "0.8.4-main.ae835ea",
|
|
58
|
+
"@dxos/local-storage": "0.8.4-main.ae835ea",
|
|
59
|
+
"@dxos/react-hooks": "0.8.4-main.ae835ea",
|
|
60
|
+
"@dxos/log": "0.8.4-main.ae835ea",
|
|
61
|
+
"@dxos/schema": "0.8.4-main.ae835ea",
|
|
62
|
+
"@dxos/util": "0.8.4-main.ae835ea"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@effect-rx/rx-react": "0.42.4",
|
|
66
66
|
"@effect/platform": "0.92.1",
|
|
67
|
-
"@types/react": "~19.2.
|
|
67
|
+
"@types/react": "~19.2.2",
|
|
68
68
|
"effect": "3.18.3",
|
|
69
69
|
"react": "~19.2.0",
|
|
70
70
|
"typedoc": "0.28.1",
|
|
71
|
-
"@dxos/echo-signals": "0.8.4-main.
|
|
72
|
-
"@dxos/random": "0.8.4-main.
|
|
73
|
-
"@dxos/react-ui
|
|
74
|
-
"@dxos/
|
|
75
|
-
"@dxos/
|
|
71
|
+
"@dxos/echo-signals": "0.8.4-main.ae835ea",
|
|
72
|
+
"@dxos/random": "0.8.4-main.ae835ea",
|
|
73
|
+
"@dxos/react-ui": "0.8.4-main.ae835ea",
|
|
74
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.4-main.ae835ea",
|
|
75
|
+
"@dxos/storybook-utils": "0.8.4-main.ae835ea"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"@effect-rx/rx-react": "^0.34.1",
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import type * as Tool from '@effect/ai/Tool';
|
|
6
|
+
import type * as Toolkit from '@effect/ai/Toolkit';
|
|
6
7
|
import { type Registry } from '@effect-rx/rx-react';
|
|
7
|
-
import
|
|
8
|
+
import type * as Layer from 'effect/Layer';
|
|
9
|
+
import type * as Schema from 'effect/Schema';
|
|
8
10
|
import { type FC, type PropsWithChildren } from 'react';
|
|
9
11
|
|
|
10
|
-
import { type AiService
|
|
12
|
+
import { type AiService } from '@dxos/ai';
|
|
13
|
+
import type * as AiServiceRouter from '@dxos/ai/AiServiceRouter';
|
|
11
14
|
import { type BuilderExtensions, type GraphBuilder } from '@dxos/app-graph';
|
|
12
15
|
import { type Blueprint } from '@dxos/blueprints';
|
|
13
16
|
import { type Space } from '@dxos/client-protocol';
|
|
@@ -195,7 +198,7 @@ export namespace Capabilities {
|
|
|
195
198
|
'dxos.org/app-framework/capability/functions',
|
|
196
199
|
);
|
|
197
200
|
|
|
198
|
-
export type FileUploader = (
|
|
201
|
+
export type FileUploader = (space: Space, file: File) => Promise<FileInfo | undefined>;
|
|
199
202
|
|
|
200
203
|
/**
|
|
201
204
|
* @category Capability
|
package/src/common/file.ts
CHANGED
package/src/common/layout.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
7
|
export const ResourceKey = Schema.Union(Schema.String, Schema.Record({ key: Schema.String, value: Schema.Any }));
|
|
8
8
|
export type ResourceKey = Schema.Schema.Type<typeof ResourceKey>;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Registry } from '@effect-rx/rx-react';
|
|
6
|
-
import
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
7
|
import { describe, expect, it, onTestFinished } from 'vitest';
|
|
8
8
|
|
|
9
9
|
import { PluginContext, defineCapability } from './capabilities';
|
package/src/core/capabilities.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Registry, Rx } from '@effect-rx/rx-react';
|
|
6
|
-
import
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
7
|
|
|
8
8
|
import { Trigger } from '@dxos/async';
|
|
9
9
|
import { invariant } from '@dxos/invariant';
|
|
@@ -41,12 +41,12 @@ export type Capability<T> = {
|
|
|
41
41
|
/**
|
|
42
42
|
* The interface definition of the capability.
|
|
43
43
|
*/
|
|
44
|
-
interface: InterfaceDef<T>;
|
|
44
|
+
readonly interface: InterfaceDef<T>;
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* The implementation of the capability.
|
|
48
48
|
*/
|
|
49
|
-
implementation: T;
|
|
49
|
+
readonly implementation: T;
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Called when the capability is deactivated.
|
|
@@ -73,12 +73,16 @@ class CapabilityImpl<T> {
|
|
|
73
73
|
/**
|
|
74
74
|
* Helper to define the implementation of a capability.
|
|
75
75
|
*/
|
|
76
|
-
export const contributes = <I extends InterfaceDef<any>>(
|
|
76
|
+
export const contributes = <I extends InterfaceDef<any>, T = InterfaceDef.Implementation<I>>(
|
|
77
77
|
interfaceDef: I,
|
|
78
|
-
implementation:
|
|
78
|
+
implementation: T,
|
|
79
79
|
deactivate?: Capability<InterfaceDef.Implementation<I>>['deactivate'],
|
|
80
80
|
): Capability<I> => {
|
|
81
|
-
return {
|
|
81
|
+
return {
|
|
82
|
+
interface: interfaceDef,
|
|
83
|
+
implementation: implementation as any, // NOTE: Added to allow providing readonly implementation.
|
|
84
|
+
deactivate,
|
|
85
|
+
} satisfies Capability<I>;
|
|
82
86
|
};
|
|
83
87
|
|
|
84
88
|
type LoadCapability<T, U> = () => Promise<{ default: (props: T) => MaybePromise<Capability<U>> }>;
|
package/src/core/manager.test.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { afterEach, describe, expect, it } from 'vitest';
|
|
|
7
7
|
|
|
8
8
|
import { Trigger } from '@dxos/async';
|
|
9
9
|
import { raise } from '@dxos/debug';
|
|
10
|
-
import { updateCounter } from '@dxos/echo
|
|
10
|
+
import { updateCounter } from '@dxos/echo/testing';
|
|
11
11
|
import { registerSignalsRuntime } from '@dxos/echo-signals';
|
|
12
12
|
import { invariant } from '@dxos/invariant';
|
|
13
13
|
import { live } from '@dxos/live-object';
|
package/src/core/manager.ts
CHANGED
|
@@ -4,7 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import { Registry } from '@effect-rx/rx-react';
|
|
6
6
|
import { untracked } from '@preact/signals-core';
|
|
7
|
-
import
|
|
7
|
+
import * as Array from 'effect/Array';
|
|
8
|
+
import * as Duration from 'effect/Duration';
|
|
9
|
+
import * as Effect from 'effect/Effect';
|
|
10
|
+
import * as Fiber from 'effect/Fiber';
|
|
11
|
+
import * as Function from 'effect/Function';
|
|
12
|
+
import * as HashSet from 'effect/HashSet';
|
|
13
|
+
import * as Match from 'effect/Match';
|
|
14
|
+
import * as Ref from 'effect/Ref';
|
|
8
15
|
|
|
9
16
|
import { Event } from '@dxos/async';
|
|
10
17
|
import { type Live, live } from '@dxos/live-object';
|
|
@@ -396,7 +403,7 @@ export class PluginManager {
|
|
|
396
403
|
this.activation.emit({ event: key, state: 'activating' });
|
|
397
404
|
|
|
398
405
|
// Fire activatesBefore events.
|
|
399
|
-
yield* pipe(
|
|
406
|
+
yield* Function.pipe(
|
|
400
407
|
modules,
|
|
401
408
|
Array.flatMap((module) => module.activatesBefore ?? []),
|
|
402
409
|
HashSet.fromIterable,
|
|
@@ -407,7 +414,7 @@ export class PluginManager {
|
|
|
407
414
|
);
|
|
408
415
|
|
|
409
416
|
// Concurrently triggers loading of lazy capabilities.
|
|
410
|
-
const getCapabilities = yield* pipe(
|
|
417
|
+
const getCapabilities = yield* Function.pipe(
|
|
411
418
|
modules,
|
|
412
419
|
Array.map((mod) => this._loadModule(mod)),
|
|
413
420
|
Effect.allWith({ concurrency: 'unbounded' }),
|
|
@@ -418,7 +425,7 @@ export class PluginManager {
|
|
|
418
425
|
);
|
|
419
426
|
|
|
420
427
|
// Contribute the capabilities from the activated modules.
|
|
421
|
-
yield* pipe(
|
|
428
|
+
yield* Function.pipe(
|
|
422
429
|
modules,
|
|
423
430
|
Array.zip(getCapabilities),
|
|
424
431
|
Array.map(([module, capabilities]) => this._contributeCapabilities(module, capabilities)),
|
|
@@ -428,7 +435,7 @@ export class PluginManager {
|
|
|
428
435
|
);
|
|
429
436
|
|
|
430
437
|
// Fire activatesAfter events.
|
|
431
|
-
yield* pipe(
|
|
438
|
+
yield* Function.pipe(
|
|
432
439
|
modules,
|
|
433
440
|
Array.flatMap((module) => module.activatesAfter ?? []),
|
|
434
441
|
HashSet.fromIterable,
|
package/src/core/plugin.ts
CHANGED
|
@@ -110,6 +110,11 @@ export type PluginMeta = {
|
|
|
110
110
|
* A grep-able symbol string which can be resolved to an icon asset by @ch-ui/icons, via @ch-ui/vite-plugin-icons.
|
|
111
111
|
*/
|
|
112
112
|
icon?: string;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Icon hue (ChromaticPalette).
|
|
116
|
+
*/
|
|
117
|
+
iconHue?: string;
|
|
113
118
|
};
|
|
114
119
|
|
|
115
120
|
/**
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
7
|
import { Capabilities, Events } from '../../common';
|
|
8
8
|
import { contributes, defineCapability, defineEvent, defineModule, definePlugin } from '../../core';
|
|
@@ -24,7 +24,7 @@ export class BaseError extends Error {
|
|
|
24
24
|
|
|
25
25
|
export class NoResolversError extends BaseError {
|
|
26
26
|
constructor(action: string) {
|
|
27
|
-
super('NO_RESOLVERS',
|
|
27
|
+
super('NO_RESOLVERS', `No resolvers were found for the action: ${action}`, { action });
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Fiber from 'effect/Fiber';
|
|
7
|
+
import * as Function from 'effect/Function';
|
|
8
|
+
import * as Schema from 'effect/Schema';
|
|
6
9
|
import { describe, expect, test } from 'vitest';
|
|
7
10
|
|
|
8
11
|
import { chain, createIntent } from './intent';
|
|
@@ -104,7 +107,11 @@ describe('Intent dispatcher', () => {
|
|
|
104
107
|
|
|
105
108
|
test('chain intents', async () => {
|
|
106
109
|
const { dispatch } = createDispatcher(() => [computeResolver, toStringResolver, concatResolver]);
|
|
107
|
-
const intent = pipe(
|
|
110
|
+
const intent = Function.pipe(
|
|
111
|
+
createIntent(Compute, { value: 1 }),
|
|
112
|
+
chain(ToString, {}),
|
|
113
|
+
chain(Concat, { plus: '!' }),
|
|
114
|
+
);
|
|
108
115
|
|
|
109
116
|
expect(intent.first.id).toBe(Compute._tag);
|
|
110
117
|
expect(intent.last.id).toBe(Concat._tag);
|
|
@@ -120,7 +127,7 @@ describe('Intent dispatcher', () => {
|
|
|
120
127
|
|
|
121
128
|
test('undo chained intent', async () => {
|
|
122
129
|
const { dispatch, undo } = createDispatcher(() => [computeResolver, toStringResolver, concatResolver]);
|
|
123
|
-
const intent = pipe(createIntent(Compute, { value: 1 }), chain(Compute, {}), chain(Compute, {}));
|
|
130
|
+
const intent = Function.pipe(createIntent(Compute, { value: 1 }), chain(Compute, {}), chain(Compute, {}));
|
|
124
131
|
const program = Effect.gen(function* () {
|
|
125
132
|
const a = yield* dispatch(intent);
|
|
126
133
|
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Function from 'effect/Function';
|
|
7
|
+
import * as Option from 'effect/Option';
|
|
8
|
+
import * as Ref from 'effect/Ref';
|
|
9
|
+
import type * as Types from 'effect/Types';
|
|
7
10
|
|
|
8
11
|
import { live } from '@dxos/live-object';
|
|
9
12
|
import { log } from '@dxos/log';
|
|
@@ -132,7 +135,7 @@ export const createResolver = <Tag extends string, Fields extends IntentParams,
|
|
|
132
135
|
*/
|
|
133
136
|
export type PromiseIntentDispatcher = <Fields extends IntentParams>(
|
|
134
137
|
intent: IntentChain<any, any, any, Fields>,
|
|
135
|
-
) => Promise<Simplify<IntentDispatcherResult<IntentData<Fields>, IntentResultData<Fields>>>>;
|
|
138
|
+
) => Promise<Types.Simplify<IntentDispatcherResult<IntentData<Fields>, IntentResultData<Fields>>>>;
|
|
136
139
|
|
|
137
140
|
/**
|
|
138
141
|
* Creates an effect for intents.
|
|
@@ -141,7 +144,7 @@ export type IntentDispatcher = <Fields extends IntentParams>(
|
|
|
141
144
|
intent: IntentChain<any, any, any, Fields>,
|
|
142
145
|
depth?: number,
|
|
143
146
|
) => Effect.Effect<
|
|
144
|
-
Simplify<Required<IntentDispatcherResult<IntentData<Fields>, IntentResultData<Fields>>>['data']>,
|
|
147
|
+
Types.Simplify<Required<IntentDispatcherResult<IntentData<Fields>, IntentResultData<Fields>>>['data']>,
|
|
145
148
|
Error
|
|
146
149
|
>;
|
|
147
150
|
|
|
@@ -252,7 +255,7 @@ export const createDispatcher = (
|
|
|
252
255
|
|
|
253
256
|
if (result.undoable && isUndoable(results)) {
|
|
254
257
|
// TODO(wittjosiah): Is there a better way to handle showing undo for chains?
|
|
255
|
-
yield* pipe(
|
|
258
|
+
yield* Function.pipe(
|
|
256
259
|
dispatch(createIntent(IntentAction.ShowUndo, { message: result.undoable.message })),
|
|
257
260
|
Effect.catchSome((err) =>
|
|
258
261
|
err instanceof NoResolversError ? Option.some(Effect.succeed(undefined)) : Option.none(),
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Rx } from '@effect-rx/rx-react';
|
|
6
|
-
import
|
|
6
|
+
import * as Function from 'effect/Function';
|
|
7
|
+
import * as Option from 'effect/Option';
|
|
7
8
|
|
|
8
9
|
import { ROOT_ID, createExtension } from '@dxos/app-graph';
|
|
9
10
|
import { type SettingsStore, type SettingsValue } from '@dxos/local-storage';
|
|
@@ -22,7 +23,7 @@ export default (context: PluginContext) =>
|
|
|
22
23
|
id: `${meta.id}/action`,
|
|
23
24
|
actions: (node) =>
|
|
24
25
|
Rx.make((get) =>
|
|
25
|
-
pipe(
|
|
26
|
+
Function.pipe(
|
|
26
27
|
get(node),
|
|
27
28
|
Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),
|
|
28
29
|
Option.map(() => [
|
|
@@ -51,7 +52,7 @@ export default (context: PluginContext) =>
|
|
|
51
52
|
id: `${meta.id}/core`,
|
|
52
53
|
connector: (node) =>
|
|
53
54
|
Rx.make((get) =>
|
|
54
|
-
pipe(
|
|
55
|
+
Function.pipe(
|
|
55
56
|
get(node),
|
|
56
57
|
Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),
|
|
57
58
|
Option.map(() => [
|
|
@@ -75,7 +76,7 @@ export default (context: PluginContext) =>
|
|
|
75
76
|
id: `${meta.id}/core-plugins`,
|
|
76
77
|
connector: (node) =>
|
|
77
78
|
Rx.make((get) =>
|
|
78
|
-
pipe(
|
|
79
|
+
Function.pipe(
|
|
79
80
|
get(node),
|
|
80
81
|
Option.flatMap((node) => (node.id !== SETTINGS_ID ? Option.none() : Option.some(node))),
|
|
81
82
|
Option.map(() => {
|
|
@@ -123,7 +124,7 @@ export default (context: PluginContext) =>
|
|
|
123
124
|
id: `${meta.id}/custom-plugins`,
|
|
124
125
|
connector: (node) =>
|
|
125
126
|
Rx.make((get) =>
|
|
126
|
-
pipe(
|
|
127
|
+
Function.pipe(
|
|
127
128
|
get(node),
|
|
128
129
|
Option.flatMap((node) =>
|
|
129
130
|
node.id !== `${SETTINGS_KEY}:custom-plugins` ? Option.none() : Option.some(node),
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Function from 'effect/Function';
|
|
6
6
|
|
|
7
7
|
import { Capabilities, LayoutAction } from '../common';
|
|
8
8
|
import { contributes } from '../core';
|
|
@@ -20,7 +20,7 @@ export default () =>
|
|
|
20
20
|
return {
|
|
21
21
|
intents: [
|
|
22
22
|
plugin
|
|
23
|
-
? pipe(
|
|
23
|
+
? Function.pipe(
|
|
24
24
|
openSettings,
|
|
25
25
|
chain(LayoutAction.Open, {
|
|
26
26
|
part: 'main',
|
|
@@ -46,9 +46,11 @@ export class ErrorBoundary extends Component<ErrorBoundaryProps, State> {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
const DefaultFallback: NonNullable<ErrorBoundaryProps['fallback']> = ({ data, error }) =>
|
|
50
|
-
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
const DefaultFallback: NonNullable<ErrorBoundaryProps['fallback']> = ({ data, error }) => {
|
|
50
|
+
return (
|
|
51
|
+
<div className='flex flex-col gap-2 overflow-hidden border border-red-500 rounded-sm'>
|
|
52
|
+
<h1 className='p-2'>ERROR: {error.message}</h1>
|
|
53
|
+
<pre className='p-2 overflow-y-auto text-sm text-subdued'>{JSON.stringify(data, null, 2)}</pre>
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type Decorator } from '@storybook/react';
|
|
5
|
+
import { type Decorator, type StoryContext } from '@storybook/react';
|
|
6
6
|
import React, { useEffect, useMemo } from 'react';
|
|
7
7
|
|
|
8
8
|
import { raise } from '@dxos/debug';
|
|
@@ -57,13 +57,18 @@ export type WithPluginManagerOptions = UseAppOptions & {
|
|
|
57
57
|
fireEvents?: (ActivationEvent | string)[];
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
+
export type WithPluginManagerInitializer<Args = void> =
|
|
61
|
+
| WithPluginManagerOptions
|
|
62
|
+
| ((context: StoryContext<Args>) => WithPluginManagerOptions);
|
|
63
|
+
|
|
60
64
|
/**
|
|
61
65
|
* Wraps a story with a plugin manager.
|
|
62
66
|
* NOTE: This builds up and tears down the plugin manager on every render.
|
|
63
67
|
*/
|
|
64
|
-
export const withPluginManager = (
|
|
68
|
+
export const withPluginManager = <Args,>(init: WithPluginManagerInitializer<Args> = {}): Decorator => {
|
|
65
69
|
return (Story, context) => {
|
|
66
|
-
const
|
|
70
|
+
const options = typeof init === 'function' ? init(context as any) : init;
|
|
71
|
+
const pluginManager = useMemo(() => setupPluginManager(options), [init]);
|
|
67
72
|
|
|
68
73
|
// Set-up root capability.
|
|
69
74
|
useEffect(() => {
|
package/tsconfig.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugin-settings/app-graph-builder.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Rx } from '@effect-rx/rx-react';\nimport { Option, pipe } from 'effect';\n\nimport { ROOT_ID, createExtension } from '@dxos/app-graph';\nimport { type SettingsStore, type SettingsValue } from '@dxos/local-storage';\nimport { isNonNullable } from '@dxos/util';\n\nimport { Capabilities } from '../common';\nimport { type PluginContext, type PluginMeta, contributes } from '../core';\nimport { createIntent } from '../plugin-intent';\n\nimport { SETTINGS_ID, SETTINGS_KEY, SettingsAction } from './actions';\nimport { meta } from './meta';\n\nexport default (context: PluginContext) =>\n contributes(Capabilities.AppGraphBuilder, [\n createExtension({\n id: `${meta.id}/action`,\n actions: (node) =>\n Rx.make((get) =>\n pipe(\n get(node),\n Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),\n Option.map(() => [\n {\n id: meta.id,\n data: async () => {\n const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);\n await dispatch(createIntent(SettingsAction.Open));\n },\n properties: {\n label: ['open settings label', { ns: meta.id }],\n icon: 'ph--gear--regular',\n disposition: 'menu',\n keyBinding: {\n macos: 'meta+,',\n windows: 'alt+,',\n },\n },\n },\n ]),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n createExtension({\n id: `${meta.id}/core`,\n connector: (node) =>\n Rx.make((get) =>\n pipe(\n get(node),\n Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),\n Option.map(() => [\n {\n id: SETTINGS_ID,\n type: meta.id,\n properties: {\n label: ['app settings label', { ns: meta.id }],\n icon: 'ph--gear--regular',\n disposition: 'pin-end',\n position: 'hoist',\n testId: 'treeView.appSettings',\n },\n },\n ]),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n createExtension({\n id: `${meta.id}/core-plugins`,\n connector: (node) =>\n Rx.make((get) =>\n pipe(\n get(node),\n Option.flatMap((node) => (node.id !== SETTINGS_ID ? Option.none() : Option.some(node))),\n Option.map(() => {\n const manager = get(context.capability(Capabilities.PluginManager));\n const [settingsStore] = get(context.capabilities(Capabilities.SettingsStore));\n return [\n ...manager.plugins\n .filter((plugin) => manager.core.includes(plugin.meta.id))\n .map((plugin): [PluginMeta, SettingsStore<SettingsValue>] | null => {\n const settings = settingsStore?.getStore(plugin.meta.id);\n if (!settings) {\n return null;\n }\n\n return [plugin.meta, settings];\n })\n .filter(isNonNullable)\n .map(([meta, settings]) => ({\n id: `${SETTINGS_KEY}:${meta.id.replaceAll('/', ':')}`,\n type: 'category',\n data: settings,\n properties: {\n label: meta.name ?? meta.id,\n icon: meta.icon ?? 'ph--circle--regular',\n },\n })),\n\n {\n id: `${SETTINGS_KEY}:custom-plugins`,\n type: 'category',\n properties: {\n label: ['custom plugins label', { ns: meta.id }],\n icon: 'ph--squares-four--regular',\n role: 'branch',\n disposition: 'collection',\n },\n },\n ];\n }),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n createExtension({\n id: `${meta.id}/custom-plugins`,\n connector: (node) =>\n Rx.make((get) =>\n pipe(\n get(node),\n Option.flatMap((node) =>\n node.id !== `${SETTINGS_KEY}:custom-plugins` ? Option.none() : Option.some(node),\n ),\n Option.map(() => {\n const manager = get(context.capability(Capabilities.PluginManager));\n const [settingsStore] = get(context.capabilities(Capabilities.SettingsStore));\n return manager.plugins\n .filter((plugin) => !manager.core.includes(plugin.meta.id))\n .map((plugin): [PluginMeta, SettingsStore<SettingsValue>] | null => {\n const settings = settingsStore?.getStore(plugin.meta.id);\n if (!settings) {\n return null;\n }\n\n return [plugin.meta, settings];\n })\n .filter(isNonNullable)\n .map(([meta, settings]) => ({\n id: `${SETTINGS_KEY}:${meta.id.replaceAll('/', ':')}`,\n type: 'category',\n data: settings,\n properties: {\n label: meta.name ?? meta.id,\n icon: meta.icon ?? 'ph--circle--regular',\n },\n }));\n }),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n ]);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;AAIA,SAASA,UAAU;AACnB,SAASC,QAAQC,YAAY;AAE7B,SAASC,SAASC,uBAA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AKD,EAAE;IACd+B,WAAW,CAAC5B,SACVC,GAAGC,KAAK,CAACC,QACPC,KACED,IAAIH,IAAAA,GACJK,OAAOC,QAAQ,CAACN,UACdA,MAAKH,OAAO,GAAGkD,YAAAA,oBAAgC1C,OAAOI,KAAI,IAAKJ,OAAOG,KAAKR,KAAAA,CAAAA,GAE7EK,OAAOK,IAAI,MAAA;AACT,YAAMuB,UAAU9B,IAAIX,QAAQ0C,WAAWxC,aAAayC,aAAa,CAAA;AACjE,YAAM,CAACC,aAAAA,IAAiBjC,IAAIX,QAAQ6C,aAAa3C,aAAa4C,aAAa,CAAA;AAC3E,aAAOL,QAAQM,QACZC,OAAO,CAACC,WAAW,CAACR,QAAQS,KAAKC,SAASF,OAAO3C,KAAKD,EAAE,CAAA,EACxDa,IAAI,CAAC+B,WAAAA;AACJ,cAAMG,WAAWR,eAAeS,SAASJ,OAAO3C,KAAKD,EAAE;AACvD,YAAI,CAAC+C,UAAU;AACb,iBAAO;QACT;AAEA,eAAO;UAACH,OAAO3C;UAAM8C;;MACvB,CAAA,EACCJ,OAAOM,aAAAA,EACPpC,IAAI,CAAC,CAACZ,OAAM8C,QAAAA,OAAe;QAC1B/C,IAAI,GAAGkD,YAAAA,IAAgBjD,MAAKD,GAAGmD,WAAW,KAAK,GAAA,CAAA;QAC/ClB,MAAM;QACNnB,MAAMiC;QACNzB,YAAY;UACVC,OAAOtB,MAAKmD,QAAQnD,MAAKD;UACzByB,MAAMxB,MAAKwB,QAAQ;QACrB;MACF,EAAA;IACJ,CAAA,GACAjB,OAAOsB,UAAU,MAAM,CAAA,CAAE,CAAA,CAAA;EAGjC,CAAA;CACD;",
|
|
6
|
-
"names": ["Rx", "Option", "pipe", "ROOT_ID", "createExtension", "isNonNullable", "context", "contributes", "Capabilities", "AppGraphBuilder", "createExtension", "id", "meta", "actions", "node", "Rx", "make", "get", "pipe", "Option", "flatMap", "ROOT_ID", "some", "none", "map", "data", "dispatchPromise", "dispatch", "getCapability", "IntentDispatcher", "createIntent", "SettingsAction", "Open", "properties", "label", "ns", "icon", "disposition", "keyBinding", "macos", "windows", "getOrElse", "connector", "SETTINGS_ID", "type", "position", "testId", "manager", "capability", "PluginManager", "settingsStore", "capabilities", "SettingsStore", "plugins", "filter", "plugin", "core", "includes", "settings", "getStore", "isNonNullable", "SETTINGS_KEY", "replaceAll", "name", "role"]
|
|
7
|
-
}
|