@dxos/app-framework 0.8.4-main.406dc2a → 0.8.4-main.548089c
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-LG4RG2LM.mjs → app-graph-builder-JPUFNED5.mjs} +7 -7
- package/dist/lib/browser/app-graph-builder-JPUFNED5.mjs.map +7 -0
- package/dist/lib/browser/{chunk-2GRQ4QXA.mjs → chunk-LVSO2N4X.mjs} +160 -199
- package/dist/lib/browser/chunk-LVSO2N4X.mjs.map +7 -0
- package/dist/lib/browser/{chunk-FRUTKCPG.mjs → chunk-XRAWIHTQ.mjs} +101 -90
- package/dist/lib/browser/chunk-XRAWIHTQ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +5 -33
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/{intent-dispatcher-6SHA5B3N.mjs → intent-dispatcher-TNEVDPI6.mjs} +2 -2
- package/dist/lib/browser/{intent-resolver-UZZ4OANZ.mjs → intent-resolver-SYLXP62Y.mjs} +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react/index.mjs +32 -0
- package/dist/lib/browser/{store-ACBEYK4B.mjs → store-3HDXKFXP.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/node-esm/{app-graph-builder-FMHVHPWA.mjs → app-graph-builder-VO6RTSOS.mjs} +7 -7
- package/dist/lib/node-esm/app-graph-builder-VO6RTSOS.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-KSPOOYT3.mjs → chunk-FO5NIDOR.mjs} +160 -199
- package/dist/lib/node-esm/chunk-FO5NIDOR.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-CXT6CYPE.mjs → chunk-JH3SFOXA.mjs} +101 -90
- package/dist/lib/node-esm/chunk-JH3SFOXA.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +5 -33
- package/dist/lib/node-esm/index.mjs.map +2 -2
- package/dist/lib/node-esm/{intent-dispatcher-SIYQ5ZIU.mjs → intent-dispatcher-WUNOPJES.mjs} +2 -2
- package/dist/lib/node-esm/{intent-resolver-7FYJMXAG.mjs → intent-resolver-VTZI3NO7.mjs} +2 -2
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react/index.mjs +33 -0
- package/dist/lib/node-esm/{store-6OBLTVXC.mjs → store-PAJPVOLG.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/types/src/common/capabilities.d.ts +36 -42
- package/dist/types/src/common/capabilities.d.ts.map +1 -1
- package/dist/types/src/common/surface.d.ts +1 -0
- package/dist/types/src/common/surface.d.ts.map +1 -1
- package/dist/types/src/core/capabilities.d.ts +12 -12
- package/dist/types/src/core/capabilities.d.ts.map +1 -1
- package/dist/types/src/core/manager.d.ts +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/index.d.ts +0 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/playground/generator/Main.d.ts.map +1 -1
- package/dist/types/src/react/App.d.ts.map +1 -0
- package/dist/types/src/react/App.stories.d.ts.map +1 -0
- package/dist/types/src/react/DefaultFallback.d.ts.map +1 -0
- package/dist/types/src/react/Surface.d.ts +4 -4
- package/dist/types/src/react/Surface.d.ts.map +1 -1
- package/dist/types/src/react/Surface.stories.d.ts +3 -6
- package/dist/types/src/react/Surface.stories.d.ts.map +1 -1
- package/dist/types/src/react/index.d.ts +2 -0
- package/dist/types/src/react/index.d.ts.map +1 -1
- package/dist/types/src/react/types.d.ts +6 -0
- package/dist/types/src/react/types.d.ts.map +1 -0
- package/dist/types/src/{components → react}/useApp.d.ts +2 -2
- package/dist/types/src/react/useApp.d.ts.map +1 -0
- package/dist/types/src/react/useLoading.d.ts.map +1 -0
- package/dist/types/src/testing/withPluginManager.d.ts +4 -3
- package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/moon.yml +1 -1
- package/package.json +36 -33
- package/src/common/capabilities.ts +18 -19
- package/src/common/collaboration.ts +2 -2
- package/src/common/surface.ts +1 -0
- package/src/core/capabilities.test.ts +1 -1
- package/src/core/capabilities.ts +23 -19
- package/src/core/manager.ts +2 -2
- package/src/core/plugin.ts +5 -0
- package/src/index.ts +0 -2
- package/src/playground/generator/Main.tsx +0 -1
- package/src/playground/playground.stories.tsx +1 -1
- package/src/plugin-settings/app-graph-builder.ts +5 -5
- package/src/plugin-settings/translations.ts +1 -1
- package/src/{components → react}/App.tsx +1 -1
- package/src/{components → react}/DefaultFallback.tsx +1 -1
- package/src/react/Surface.stories.tsx +69 -45
- package/src/react/Surface.tsx +56 -33
- package/src/react/index.ts +4 -0
- package/src/react/types.ts +13 -0
- package/src/{components → react}/useApp.tsx +13 -12
- package/src/react/useCapabilities.ts +2 -2
- package/src/testing/withPluginManager.tsx +9 -4
- package/tsconfig.json +9 -0
- package/dist/lib/browser/app-graph-builder-LG4RG2LM.mjs.map +0 -7
- package/dist/lib/browser/chunk-2GRQ4QXA.mjs.map +0 -7
- package/dist/lib/browser/chunk-FRUTKCPG.mjs.map +0 -7
- package/dist/lib/browser/worker.mjs +0 -77
- package/dist/lib/node-esm/app-graph-builder-FMHVHPWA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CXT6CYPE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KSPOOYT3.mjs.map +0 -7
- package/dist/lib/node-esm/worker.mjs +0 -78
- package/dist/types/src/components/App.d.ts.map +0 -1
- package/dist/types/src/components/App.stories.d.ts.map +0 -1
- package/dist/types/src/components/DefaultFallback.d.ts.map +0 -1
- package/dist/types/src/components/index.d.ts +0 -2
- package/dist/types/src/components/index.d.ts.map +0 -1
- package/dist/types/src/components/useApp.d.ts.map +0 -1
- package/dist/types/src/components/useLoading.d.ts.map +0 -1
- package/dist/types/src/worker.d.ts +0 -4
- package/dist/types/src/worker.d.ts.map +0 -1
- package/src/components/index.ts +0 -5
- package/src/worker.ts +0 -11
- /package/dist/lib/browser/{intent-dispatcher-6SHA5B3N.mjs.map → intent-dispatcher-TNEVDPI6.mjs.map} +0 -0
- /package/dist/lib/browser/{intent-resolver-UZZ4OANZ.mjs.map → intent-resolver-SYLXP62Y.mjs.map} +0 -0
- /package/dist/lib/browser/{worker.mjs.map → react/index.mjs.map} +0 -0
- /package/dist/lib/browser/{store-ACBEYK4B.mjs.map → store-3HDXKFXP.mjs.map} +0 -0
- /package/dist/lib/node-esm/{intent-dispatcher-SIYQ5ZIU.mjs.map → intent-dispatcher-WUNOPJES.mjs.map} +0 -0
- /package/dist/lib/node-esm/{intent-resolver-7FYJMXAG.mjs.map → intent-resolver-VTZI3NO7.mjs.map} +0 -0
- /package/dist/lib/node-esm/{worker.mjs.map → react/index.mjs.map} +0 -0
- /package/dist/lib/node-esm/{store-6OBLTVXC.mjs.map → store-PAJPVOLG.mjs.map} +0 -0
- /package/dist/types/src/{components → react}/App.d.ts +0 -0
- /package/dist/types/src/{components → react}/App.stories.d.ts +0 -0
- /package/dist/types/src/{components → react}/DefaultFallback.d.ts +0 -0
- /package/dist/types/src/{components → react}/useLoading.d.ts +0 -0
- /package/src/{components → react}/App.stories.tsx +0 -0
- /package/src/{components → react}/useLoading.tsx +0 -0
|
@@ -10,24 +10,11 @@ import { log as log3 } from "@dxos/log";
|
|
|
10
10
|
import { byPosition } from "@dxos/util";
|
|
11
11
|
|
|
12
12
|
// src/core/capabilities.ts
|
|
13
|
-
import {
|
|
13
|
+
import { Atom } from "@effect-atom/atom-react";
|
|
14
14
|
import * as Effect from "effect/Effect";
|
|
15
15
|
import { Trigger } from "@dxos/async";
|
|
16
16
|
import { invariant } from "@dxos/invariant";
|
|
17
17
|
import { log } from "@dxos/log";
|
|
18
|
-
function _define_property(obj, key, value2) {
|
|
19
|
-
if (key in obj) {
|
|
20
|
-
Object.defineProperty(obj, key, {
|
|
21
|
-
value: value2,
|
|
22
|
-
enumerable: true,
|
|
23
|
-
configurable: true,
|
|
24
|
-
writable: true
|
|
25
|
-
});
|
|
26
|
-
} else {
|
|
27
|
-
obj[key] = value2;
|
|
28
|
-
}
|
|
29
|
-
return obj;
|
|
30
|
-
}
|
|
31
18
|
var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/capabilities.ts";
|
|
32
19
|
var InterfaceDefTypeId = Symbol.for("InterfaceDefTypeId");
|
|
33
20
|
var defineCapability = (identifier) => {
|
|
@@ -36,9 +23,9 @@ var defineCapability = (identifier) => {
|
|
|
36
23
|
};
|
|
37
24
|
};
|
|
38
25
|
var CapabilityImpl = class {
|
|
26
|
+
moduleId;
|
|
27
|
+
implementation;
|
|
39
28
|
constructor(moduleId, implementation) {
|
|
40
|
-
_define_property(this, "moduleId", void 0);
|
|
41
|
-
_define_property(this, "implementation", void 0);
|
|
42
29
|
this.moduleId = moduleId;
|
|
43
30
|
this.implementation = implementation;
|
|
44
31
|
}
|
|
@@ -55,6 +42,48 @@ var lazy = (c) => async (props) => {
|
|
|
55
42
|
return async () => getCapability(props);
|
|
56
43
|
};
|
|
57
44
|
var PluginContext = class {
|
|
45
|
+
_registry;
|
|
46
|
+
_capabilityImpls = Atom.family(() => {
|
|
47
|
+
return Atom.make([]).pipe(Atom.keepAlive);
|
|
48
|
+
});
|
|
49
|
+
_capabilities = Atom.family((id) => {
|
|
50
|
+
return Atom.make((get) => {
|
|
51
|
+
const current = get(this._capabilityImpls(id));
|
|
52
|
+
return current.map((c) => c.implementation);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
_capability = Atom.family((id) => {
|
|
56
|
+
return Atom.make((get) => {
|
|
57
|
+
const current = get(this._capabilities(id));
|
|
58
|
+
invariant(current.length > 0, `No capability found for ${id}`, {
|
|
59
|
+
F: __dxlog_file,
|
|
60
|
+
L: 126,
|
|
61
|
+
S: this,
|
|
62
|
+
A: [
|
|
63
|
+
"current.length > 0",
|
|
64
|
+
"`No capability found for ${id}`"
|
|
65
|
+
]
|
|
66
|
+
});
|
|
67
|
+
return current[0];
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* Activates plugins based on the activation event.
|
|
72
|
+
* @param event The activation event.
|
|
73
|
+
* @returns Whether the activation was successful.
|
|
74
|
+
*/
|
|
75
|
+
activate;
|
|
76
|
+
/**
|
|
77
|
+
* Re-activates the modules that were activated by the event.
|
|
78
|
+
* @param event The activation event.
|
|
79
|
+
* @returns Whether the reset was successful.
|
|
80
|
+
*/
|
|
81
|
+
reset;
|
|
82
|
+
constructor({ registry, activate, reset }) {
|
|
83
|
+
this._registry = registry;
|
|
84
|
+
this.activate = activate;
|
|
85
|
+
this.reset = reset;
|
|
86
|
+
}
|
|
58
87
|
/**
|
|
59
88
|
* @internal
|
|
60
89
|
*/
|
|
@@ -74,7 +103,7 @@ var PluginContext = class {
|
|
|
74
103
|
count: current.length
|
|
75
104
|
}, {
|
|
76
105
|
F: __dxlog_file,
|
|
77
|
-
L:
|
|
106
|
+
L: 170,
|
|
78
107
|
S: this,
|
|
79
108
|
C: (f, a) => f(...a)
|
|
80
109
|
});
|
|
@@ -95,7 +124,7 @@ var PluginContext = class {
|
|
|
95
124
|
count: current.length
|
|
96
125
|
}, {
|
|
97
126
|
F: __dxlog_file,
|
|
98
|
-
L:
|
|
127
|
+
L: 189,
|
|
99
128
|
S: this,
|
|
100
129
|
C: (f, a) => f(...a)
|
|
101
130
|
});
|
|
@@ -104,15 +133,15 @@ var PluginContext = class {
|
|
|
104
133
|
id: interfaceDef.identifier
|
|
105
134
|
}, {
|
|
106
135
|
F: __dxlog_file,
|
|
107
|
-
L:
|
|
136
|
+
L: 191,
|
|
108
137
|
S: this,
|
|
109
138
|
C: (f, a) => f(...a)
|
|
110
139
|
});
|
|
111
140
|
}
|
|
112
141
|
}
|
|
113
142
|
/**
|
|
114
|
-
* Get the
|
|
115
|
-
* Primarily useful for deriving other
|
|
143
|
+
* Get the Atom reference to the available capabilities for a given interface.
|
|
144
|
+
* Primarily useful for deriving other Atom values based on the capabilities or
|
|
116
145
|
* for subscribing to changes in the capabilities.
|
|
117
146
|
* @returns An Rx reference to the available capabilities.
|
|
118
147
|
*/
|
|
@@ -120,8 +149,8 @@ var PluginContext = class {
|
|
|
120
149
|
return this._capabilities(interfaceDef.identifier);
|
|
121
150
|
}
|
|
122
151
|
/**
|
|
123
|
-
* Get the
|
|
124
|
-
* Primarily useful for deriving other
|
|
152
|
+
* Get the Atom reference to the available capabilities for a given interface.
|
|
153
|
+
* Primarily useful for deriving other Atom values based on the capability or
|
|
125
154
|
* for subscribing to changes in the capability.
|
|
126
155
|
* @returns An Rx reference to the available capability.
|
|
127
156
|
* @throws If no capability is found.
|
|
@@ -169,38 +198,6 @@ var PluginContext = class {
|
|
|
169
198
|
async resetPromise(event) {
|
|
170
199
|
return this.reset(event).pipe(Effect.runPromise);
|
|
171
200
|
}
|
|
172
|
-
constructor({ registry, activate, reset }) {
|
|
173
|
-
_define_property(this, "_registry", void 0);
|
|
174
|
-
_define_property(this, "_capabilityImpls", Rx.family(() => {
|
|
175
|
-
return Rx.make([]).pipe(Rx.keepAlive);
|
|
176
|
-
}));
|
|
177
|
-
_define_property(this, "_capabilities", Rx.family((id) => {
|
|
178
|
-
return Rx.make((get) => {
|
|
179
|
-
const current = get(this._capabilityImpls(id));
|
|
180
|
-
return current.map((c) => c.implementation);
|
|
181
|
-
});
|
|
182
|
-
}));
|
|
183
|
-
_define_property(this, "_capability", Rx.family((id) => {
|
|
184
|
-
return Rx.make((get) => {
|
|
185
|
-
const current = get(this._capabilities(id));
|
|
186
|
-
invariant(current.length > 0, `No capability found for ${id}`, {
|
|
187
|
-
F: __dxlog_file,
|
|
188
|
-
L: 122,
|
|
189
|
-
S: this,
|
|
190
|
-
A: [
|
|
191
|
-
"current.length > 0",
|
|
192
|
-
"`No capability found for ${id}`"
|
|
193
|
-
]
|
|
194
|
-
});
|
|
195
|
-
return current[0];
|
|
196
|
-
});
|
|
197
|
-
}));
|
|
198
|
-
_define_property(this, "activate", void 0);
|
|
199
|
-
_define_property(this, "reset", void 0);
|
|
200
|
-
this._registry = registry;
|
|
201
|
-
this.activate = activate;
|
|
202
|
-
this.reset = reset;
|
|
203
|
-
}
|
|
204
201
|
};
|
|
205
202
|
|
|
206
203
|
// src/core/events.ts
|
|
@@ -226,7 +223,7 @@ var getEvents = (events) => "type" in events ? events.events : [
|
|
|
226
223
|
];
|
|
227
224
|
|
|
228
225
|
// src/core/manager.ts
|
|
229
|
-
import { Registry } from "@effect-
|
|
226
|
+
import { Registry } from "@effect-atom/atom-react";
|
|
230
227
|
import { untracked } from "@preact/signals-core";
|
|
231
228
|
import * as Array from "effect/Array";
|
|
232
229
|
import * as Duration from "effect/Duration";
|
|
@@ -239,24 +236,42 @@ import * as Ref from "effect/Ref";
|
|
|
239
236
|
import { Event } from "@dxos/async";
|
|
240
237
|
import { live } from "@dxos/live-object";
|
|
241
238
|
import { log as log2 } from "@dxos/log";
|
|
242
|
-
function _define_property2(obj, key, value2) {
|
|
243
|
-
if (key in obj) {
|
|
244
|
-
Object.defineProperty(obj, key, {
|
|
245
|
-
value: value2,
|
|
246
|
-
enumerable: true,
|
|
247
|
-
configurable: true,
|
|
248
|
-
writable: true
|
|
249
|
-
});
|
|
250
|
-
} else {
|
|
251
|
-
obj[key] = value2;
|
|
252
|
-
}
|
|
253
|
-
return obj;
|
|
254
|
-
}
|
|
255
239
|
var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/manager.ts";
|
|
256
240
|
var isPromise = (value2) => {
|
|
257
241
|
return value2 !== null && typeof value2 === "object" && "then" in value2;
|
|
258
242
|
};
|
|
259
243
|
var PluginManager = class {
|
|
244
|
+
activation = new Event();
|
|
245
|
+
context;
|
|
246
|
+
registry;
|
|
247
|
+
// TODO(wittjosiah): Replace with Atom.
|
|
248
|
+
_state;
|
|
249
|
+
_pluginLoader;
|
|
250
|
+
_capabilities = /* @__PURE__ */ new Map();
|
|
251
|
+
_moduleMemoMap = /* @__PURE__ */ new Map();
|
|
252
|
+
_activatingEvents = Effect2.runSync(Ref.make([]));
|
|
253
|
+
_activatingModules = Effect2.runSync(Ref.make([]));
|
|
254
|
+
constructor({ pluginLoader, plugins = [], core = plugins.map(({ meta: meta2 }) => meta2.id), enabled = [], registry }) {
|
|
255
|
+
this.registry = registry ?? Registry.make();
|
|
256
|
+
this.context = new PluginContext({
|
|
257
|
+
registry: this.registry,
|
|
258
|
+
activate: (event) => this._activate(event),
|
|
259
|
+
reset: (id) => this._reset(id)
|
|
260
|
+
});
|
|
261
|
+
this._pluginLoader = pluginLoader;
|
|
262
|
+
this._state = live({
|
|
263
|
+
plugins,
|
|
264
|
+
core,
|
|
265
|
+
enabled,
|
|
266
|
+
modules: [],
|
|
267
|
+
active: [],
|
|
268
|
+
eventsFired: [],
|
|
269
|
+
pendingReset: []
|
|
270
|
+
});
|
|
271
|
+
plugins.forEach((plugin) => this._addPlugin(plugin));
|
|
272
|
+
core.forEach((id) => this.enable(id));
|
|
273
|
+
enabled.forEach((id) => this.enable(id));
|
|
274
|
+
}
|
|
260
275
|
/**
|
|
261
276
|
* Plugins that are currently registered.
|
|
262
277
|
*
|
|
@@ -650,6 +665,67 @@ var PluginManager = class {
|
|
|
650
665
|
return true;
|
|
651
666
|
});
|
|
652
667
|
}
|
|
668
|
+
// Memoized with _moduleMemoMap
|
|
669
|
+
_loadModule = (mod) => Effect2.tryPromise({
|
|
670
|
+
try: async () => {
|
|
671
|
+
const entry = this._moduleMemoMap.get(mod.id);
|
|
672
|
+
if (entry) {
|
|
673
|
+
return entry;
|
|
674
|
+
}
|
|
675
|
+
const promise2 = (async () => {
|
|
676
|
+
const start = performance.now();
|
|
677
|
+
let failed = false;
|
|
678
|
+
try {
|
|
679
|
+
log2("loading module", {
|
|
680
|
+
module: mod.id
|
|
681
|
+
}, {
|
|
682
|
+
F: __dxlog_file2,
|
|
683
|
+
L: 477,
|
|
684
|
+
S: this,
|
|
685
|
+
C: (f, a) => f(...a)
|
|
686
|
+
});
|
|
687
|
+
let activationResult = await mod.activate(this.context);
|
|
688
|
+
if (typeof activationResult === "function") {
|
|
689
|
+
activationResult = await activationResult();
|
|
690
|
+
}
|
|
691
|
+
return Array.isArray(activationResult) ? activationResult : [
|
|
692
|
+
activationResult
|
|
693
|
+
];
|
|
694
|
+
} catch (error) {
|
|
695
|
+
failed = true;
|
|
696
|
+
throw error;
|
|
697
|
+
} finally {
|
|
698
|
+
performance.measure("activate-module", {
|
|
699
|
+
start,
|
|
700
|
+
end: performance.now(),
|
|
701
|
+
detail: {
|
|
702
|
+
module: mod.id
|
|
703
|
+
}
|
|
704
|
+
});
|
|
705
|
+
log2("loaded module", {
|
|
706
|
+
module: mod.id,
|
|
707
|
+
elapsed: performance.now() - start,
|
|
708
|
+
failed
|
|
709
|
+
}, {
|
|
710
|
+
F: __dxlog_file2,
|
|
711
|
+
L: 495,
|
|
712
|
+
S: this,
|
|
713
|
+
C: (f, a) => f(...a)
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
})();
|
|
717
|
+
this._moduleMemoMap.set(mod.id, promise2);
|
|
718
|
+
return promise2;
|
|
719
|
+
},
|
|
720
|
+
catch: (error) => error
|
|
721
|
+
}).pipe(Effect2.withSpan("PluginManager._loadModule"), together(Effect2.sleep(Duration.seconds(10)).pipe(Effect2.andThen(Effect2.sync(() => log2.warn(`module is taking a long time to activate`, {
|
|
722
|
+
module: mod.id
|
|
723
|
+
}, {
|
|
724
|
+
F: __dxlog_file2,
|
|
725
|
+
L: 506,
|
|
726
|
+
S: this,
|
|
727
|
+
C: (f, a) => f(...a)
|
|
728
|
+
}))))));
|
|
653
729
|
_contributeCapabilities(module, capabilities) {
|
|
654
730
|
return Effect2.gen(this, function* () {
|
|
655
731
|
capabilities.forEach((capability) => {
|
|
@@ -736,96 +812,6 @@ var PluginManager = class {
|
|
|
736
812
|
}
|
|
737
813
|
});
|
|
738
814
|
}
|
|
739
|
-
constructor({ pluginLoader, plugins = [], core = plugins.map(({ meta: meta2 }) => meta2.id), enabled = [], registry }) {
|
|
740
|
-
_define_property2(this, "activation", new Event());
|
|
741
|
-
_define_property2(this, "context", void 0);
|
|
742
|
-
_define_property2(this, "registry", void 0);
|
|
743
|
-
_define_property2(this, "_state", void 0);
|
|
744
|
-
_define_property2(this, "_pluginLoader", void 0);
|
|
745
|
-
_define_property2(this, "_capabilities", /* @__PURE__ */ new Map());
|
|
746
|
-
_define_property2(this, "_moduleMemoMap", /* @__PURE__ */ new Map());
|
|
747
|
-
_define_property2(this, "_activatingEvents", Effect2.runSync(Ref.make([])));
|
|
748
|
-
_define_property2(this, "_activatingModules", Effect2.runSync(Ref.make([])));
|
|
749
|
-
_define_property2(this, "_loadModule", (mod) => Effect2.tryPromise({
|
|
750
|
-
try: async () => {
|
|
751
|
-
const entry = this._moduleMemoMap.get(mod.id);
|
|
752
|
-
if (entry) {
|
|
753
|
-
return entry;
|
|
754
|
-
}
|
|
755
|
-
const promise2 = (async () => {
|
|
756
|
-
const start = performance.now();
|
|
757
|
-
let failed = false;
|
|
758
|
-
try {
|
|
759
|
-
log2("loading module", {
|
|
760
|
-
module: mod.id
|
|
761
|
-
}, {
|
|
762
|
-
F: __dxlog_file2,
|
|
763
|
-
L: 477,
|
|
764
|
-
S: this,
|
|
765
|
-
C: (f, a) => f(...a)
|
|
766
|
-
});
|
|
767
|
-
let activationResult = await mod.activate(this.context);
|
|
768
|
-
if (typeof activationResult === "function") {
|
|
769
|
-
activationResult = await activationResult();
|
|
770
|
-
}
|
|
771
|
-
return Array.isArray(activationResult) ? activationResult : [
|
|
772
|
-
activationResult
|
|
773
|
-
];
|
|
774
|
-
} catch (error) {
|
|
775
|
-
failed = true;
|
|
776
|
-
throw error;
|
|
777
|
-
} finally {
|
|
778
|
-
performance.measure("activate-module", {
|
|
779
|
-
start,
|
|
780
|
-
end: performance.now(),
|
|
781
|
-
detail: {
|
|
782
|
-
module: mod.id
|
|
783
|
-
}
|
|
784
|
-
});
|
|
785
|
-
log2("loaded module", {
|
|
786
|
-
module: mod.id,
|
|
787
|
-
elapsed: performance.now() - start,
|
|
788
|
-
failed
|
|
789
|
-
}, {
|
|
790
|
-
F: __dxlog_file2,
|
|
791
|
-
L: 495,
|
|
792
|
-
S: this,
|
|
793
|
-
C: (f, a) => f(...a)
|
|
794
|
-
});
|
|
795
|
-
}
|
|
796
|
-
})();
|
|
797
|
-
this._moduleMemoMap.set(mod.id, promise2);
|
|
798
|
-
return promise2;
|
|
799
|
-
},
|
|
800
|
-
catch: (error) => error
|
|
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`, {
|
|
802
|
-
module: mod.id
|
|
803
|
-
}, {
|
|
804
|
-
F: __dxlog_file2,
|
|
805
|
-
L: 506,
|
|
806
|
-
S: this,
|
|
807
|
-
C: (f, a) => f(...a)
|
|
808
|
-
})))))));
|
|
809
|
-
this.registry = registry ?? Registry.make();
|
|
810
|
-
this.context = new PluginContext({
|
|
811
|
-
registry: this.registry,
|
|
812
|
-
activate: (event) => this._activate(event),
|
|
813
|
-
reset: (id) => this._reset(id)
|
|
814
|
-
});
|
|
815
|
-
this._pluginLoader = pluginLoader;
|
|
816
|
-
this._state = live({
|
|
817
|
-
plugins,
|
|
818
|
-
core,
|
|
819
|
-
enabled,
|
|
820
|
-
modules: [],
|
|
821
|
-
active: [],
|
|
822
|
-
eventsFired: [],
|
|
823
|
-
pendingReset: []
|
|
824
|
-
});
|
|
825
|
-
plugins.forEach((plugin) => this._addPlugin(plugin));
|
|
826
|
-
core.forEach((id) => this.enable(id));
|
|
827
|
-
enabled.forEach((id) => this.enable(id));
|
|
828
|
-
}
|
|
829
815
|
};
|
|
830
816
|
var together = (togetherEffect) => (effect) => Effect2.gen(function* () {
|
|
831
817
|
const togetherFiber = yield* Effect2.fork(togetherEffect);
|
|
@@ -835,26 +821,13 @@ var together = (togetherEffect) => (effect) => Effect2.gen(function* () {
|
|
|
835
821
|
});
|
|
836
822
|
|
|
837
823
|
// src/core/plugin.ts
|
|
838
|
-
function _define_property3(obj, key, value2) {
|
|
839
|
-
if (key in obj) {
|
|
840
|
-
Object.defineProperty(obj, key, {
|
|
841
|
-
value: value2,
|
|
842
|
-
enumerable: true,
|
|
843
|
-
configurable: true,
|
|
844
|
-
writable: true
|
|
845
|
-
});
|
|
846
|
-
} else {
|
|
847
|
-
obj[key] = value2;
|
|
848
|
-
}
|
|
849
|
-
return obj;
|
|
850
|
-
}
|
|
851
824
|
var PluginModule = class {
|
|
825
|
+
id;
|
|
826
|
+
activatesOn;
|
|
827
|
+
activatesBefore;
|
|
828
|
+
activatesAfter;
|
|
829
|
+
activate;
|
|
852
830
|
constructor(options) {
|
|
853
|
-
_define_property3(this, "id", void 0);
|
|
854
|
-
_define_property3(this, "activatesOn", void 0);
|
|
855
|
-
_define_property3(this, "activatesBefore", void 0);
|
|
856
|
-
_define_property3(this, "activatesAfter", void 0);
|
|
857
|
-
_define_property3(this, "activate", void 0);
|
|
858
831
|
this.id = options.id;
|
|
859
832
|
this.activatesOn = options.activatesOn;
|
|
860
833
|
this.activatesBefore = options.activatesBefore;
|
|
@@ -864,9 +837,9 @@ var PluginModule = class {
|
|
|
864
837
|
};
|
|
865
838
|
var defineModule = (options) => new PluginModule(options);
|
|
866
839
|
var Plugin = class {
|
|
840
|
+
meta;
|
|
841
|
+
modules;
|
|
867
842
|
constructor(meta2, modules) {
|
|
868
|
-
_define_property3(this, "meta", void 0);
|
|
869
|
-
_define_property3(this, "modules", void 0);
|
|
870
843
|
this.meta = meta2;
|
|
871
844
|
this.modules = modules;
|
|
872
845
|
}
|
|
@@ -884,7 +857,7 @@ var definePlugin = (meta2, provider) => {
|
|
|
884
857
|
(function(Capabilities2) {
|
|
885
858
|
Capabilities2.Null = defineCapability("dxos.org/app-framework/capability/null");
|
|
886
859
|
Capabilities2.PluginManager = defineCapability("dxos.org/app-framework/capability/plugin-manager");
|
|
887
|
-
Capabilities2.RxRegistry = defineCapability("dxos.org/app-framework/capability/
|
|
860
|
+
Capabilities2.RxRegistry = defineCapability("dxos.org/app-framework/capability/atom-registry");
|
|
888
861
|
Capabilities2.ReactContext = defineCapability("dxos.org/app-framework/capability/react-context");
|
|
889
862
|
Capabilities2.ReactRoot = defineCapability("dxos.org/app-framework/capability/react-root");
|
|
890
863
|
Capabilities2.ReactSurface = defineCapability("dxos.org/app-framework/common/react-surface");
|
|
@@ -899,7 +872,6 @@ var definePlugin = (meta2, provider) => {
|
|
|
899
872
|
Capabilities2.Settings = defineCapability("dxos.org/app-framework/capability/settings");
|
|
900
873
|
Capabilities2.Metadata = defineCapability("dxos.org/app-framework/capability/metadata");
|
|
901
874
|
Capabilities2.Toolkit = defineCapability("dxos.org/app-framework/capability/ai-toolkit");
|
|
902
|
-
Capabilities2.ToolkitHandler = defineCapability("dxos.org/app-framework/capability/ai-toolkit-handler");
|
|
903
875
|
Capabilities2.BlueprintDefinition = defineCapability("dxos.org/app-framework/capability/blueprint-definition");
|
|
904
876
|
Capabilities2.AiServiceLayer = defineCapability("dxos.org/app-framework/capability/ai-service-factory");
|
|
905
877
|
Capabilities2.AiModelResolver = defineCapability("dxos.org/app-framework/capability/ai-model-resolver");
|
|
@@ -911,13 +883,13 @@ var Capabilities;
|
|
|
911
883
|
|
|
912
884
|
// src/common/collaboration.ts
|
|
913
885
|
import * as Schema from "effect/Schema";
|
|
914
|
-
import {
|
|
886
|
+
import { ContentBlock } from "@dxos/types";
|
|
915
887
|
(function(CollaborationActions2) {
|
|
916
888
|
class AcceptProposal extends Schema.TaggedClass()("collaboration/accept-proposal", {
|
|
917
889
|
input: Schema.Struct({
|
|
918
890
|
subject: Schema.Any,
|
|
919
891
|
anchor: Schema.String,
|
|
920
|
-
proposal:
|
|
892
|
+
proposal: ContentBlock.Proposal
|
|
921
893
|
}),
|
|
922
894
|
output: Schema.Void
|
|
923
895
|
}) {
|
|
@@ -1051,24 +1023,13 @@ var meta = {
|
|
|
1051
1023
|
var IntentAction;
|
|
1052
1024
|
|
|
1053
1025
|
// src/plugin-intent/errors.ts
|
|
1054
|
-
function _define_property4(obj, key, value2) {
|
|
1055
|
-
if (key in obj) {
|
|
1056
|
-
Object.defineProperty(obj, key, {
|
|
1057
|
-
value: value2,
|
|
1058
|
-
enumerable: true,
|
|
1059
|
-
configurable: true,
|
|
1060
|
-
writable: true
|
|
1061
|
-
});
|
|
1062
|
-
} else {
|
|
1063
|
-
obj[key] = value2;
|
|
1064
|
-
}
|
|
1065
|
-
return obj;
|
|
1066
|
-
}
|
|
1067
1026
|
var BaseError = class extends Error {
|
|
1027
|
+
code;
|
|
1028
|
+
context;
|
|
1068
1029
|
constructor(code, message, context) {
|
|
1069
1030
|
super(message ?? code, {
|
|
1070
1031
|
cause: context
|
|
1071
|
-
}),
|
|
1032
|
+
}), this.code = code, this.context = context;
|
|
1072
1033
|
this.name = code;
|
|
1073
1034
|
Object.setPrototypeOf(this, new.target.prototype);
|
|
1074
1035
|
}
|
|
@@ -1097,7 +1058,7 @@ var IntentPlugin = definePlugin(meta, () => [
|
|
|
1097
1058
|
activatesAfter: [
|
|
1098
1059
|
Events.DispatcherReady
|
|
1099
1060
|
],
|
|
1100
|
-
activate: lazy(() => import("./intent-dispatcher-
|
|
1061
|
+
activate: lazy(() => import("./intent-dispatcher-WUNOPJES.mjs"))
|
|
1101
1062
|
})
|
|
1102
1063
|
]);
|
|
1103
1064
|
|
|
@@ -1645,4 +1606,4 @@ export {
|
|
|
1645
1606
|
ResourceLanguage,
|
|
1646
1607
|
Resource
|
|
1647
1608
|
};
|
|
1648
|
-
//# sourceMappingURL=chunk-
|
|
1609
|
+
//# sourceMappingURL=chunk-FO5NIDOR.mjs.map
|