@dxos/app-framework 0.14.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/dist/lib/App.mjs +1 -2
  3. package/dist/lib/Hooks.mjs +1 -2
  4. package/dist/lib/chunk-App.mjs +11 -0
  5. package/dist/lib/chunk-App.mjs.map +1 -0
  6. package/dist/lib/chunk-Cli.mjs +8 -0
  7. package/dist/lib/chunk-Cli.mjs.map +1 -0
  8. package/dist/lib/chunk-Devtools.mjs +112 -0
  9. package/dist/lib/chunk-Devtools.mjs.map +1 -0
  10. package/dist/lib/chunk-Hooks2.mjs +35 -0
  11. package/dist/lib/chunk-Hooks2.mjs.map +1 -0
  12. package/dist/lib/chunk-PluginManagerProvider.mjs +12 -0
  13. package/dist/lib/chunk-PluginManagerProvider.mjs.map +1 -0
  14. package/dist/lib/chunk-ProcessManagerPlugin.mjs +3 -3
  15. package/dist/lib/chunk-ProcessManagerPlugin.mjs.map +1 -1
  16. package/dist/lib/chunk-Role.mjs +19 -0
  17. package/dist/lib/chunk-Role.mjs.map +1 -0
  18. package/dist/lib/chunk-SharedPackages.mjs +11 -0
  19. package/dist/lib/chunk-SharedPackages.mjs.map +1 -0
  20. package/dist/lib/chunk-Surface.mjs.map +1 -1
  21. package/dist/lib/chunk-Surface2.mjs +37 -0
  22. package/dist/lib/chunk-Surface2.mjs.map +1 -0
  23. package/dist/lib/chunk-SurfaceManager.mjs +3 -3
  24. package/dist/lib/chunk-SurfaceManager.mjs.map +1 -1
  25. package/dist/lib/chunk-activation-event.mjs +86 -0
  26. package/dist/lib/chunk-activation-event.mjs.map +1 -0
  27. package/dist/lib/chunk-activation-events.mjs +66 -0
  28. package/dist/lib/chunk-activation-events.mjs.map +1 -0
  29. package/dist/lib/chunk-capabilities.mjs +202 -0
  30. package/dist/lib/chunk-capabilities.mjs.map +1 -0
  31. package/dist/lib/chunk-capability-manager.mjs +203 -0
  32. package/dist/lib/chunk-capability-manager.mjs.map +1 -0
  33. package/dist/lib/chunk-capability2.mjs +2 -2
  34. package/dist/lib/chunk-capability2.mjs.map +1 -1
  35. package/dist/lib/chunk-history-tracker.mjs +1 -1
  36. package/dist/lib/chunk-hooks.mjs +5 -5
  37. package/dist/lib/chunk-hooks.mjs.map +1 -1
  38. package/dist/lib/chunk-plugin-asset-cache.mjs +28 -0
  39. package/dist/lib/chunk-plugin-asset-cache.mjs.map +1 -0
  40. package/dist/lib/chunk-plugin-manager.mjs +68 -35
  41. package/dist/lib/chunk-plugin-manager.mjs.map +1 -1
  42. package/dist/lib/chunk-plugin-manager2.mjs +22 -0
  43. package/dist/lib/chunk-plugin-manager2.mjs.map +1 -0
  44. package/dist/lib/chunk-plugin-manifest.mjs +126 -0
  45. package/dist/lib/chunk-plugin-manifest.mjs.map +1 -0
  46. package/dist/lib/chunk-plugin.mjs +354 -0
  47. package/dist/lib/chunk-plugin.mjs.map +1 -0
  48. package/dist/lib/chunk-process-manager-capability.mjs +11 -10
  49. package/dist/lib/chunk-process-manager-capability.mjs.map +1 -1
  50. package/dist/lib/chunk-registry.mjs.map +1 -1
  51. package/dist/lib/chunk-undo-mapping.mjs +47 -0
  52. package/dist/lib/{plugin-process-manager/history/undo-mapping.mjs.map → chunk-undo-mapping.mjs.map} +1 -1
  53. package/dist/lib/chunk-undo-registry.mjs +22 -0
  54. package/dist/lib/{plugin-process-manager/history/undo-registry.mjs.map → chunk-undo-registry.mjs.map} +1 -1
  55. package/dist/lib/chunk-url-loader.mjs +345 -0
  56. package/dist/lib/chunk-url-loader.mjs.map +1 -0
  57. package/dist/lib/cli.mjs +3 -3
  58. package/dist/lib/cli.mjs.map +1 -1
  59. package/dist/lib/common/Role.mjs +1 -19
  60. package/dist/lib/common/activation-events.mjs +1 -57
  61. package/dist/lib/common/capabilities.mjs +1 -202
  62. package/dist/lib/config.mjs +1 -2
  63. package/dist/lib/core/activation-event.mjs +1 -86
  64. package/dist/lib/core/capability-manager.mjs +1 -203
  65. package/dist/lib/core/capability.mjs +1 -2
  66. package/dist/lib/core/plugin-asset-cache.mjs +1 -28
  67. package/dist/lib/core/plugin-manager.mjs +2 -19
  68. package/dist/lib/core/plugin-manifest.mjs +1 -126
  69. package/dist/lib/core/plugin.mjs +1 -354
  70. package/dist/lib/core/registry.mjs +1 -2
  71. package/dist/lib/core/url-loader.mjs +1 -345
  72. package/dist/lib/index.mjs +19 -19
  73. package/dist/lib/ns/App.mjs +2 -11
  74. package/dist/lib/ns/Cli.mjs +2 -8
  75. package/dist/lib/ns/Devtools.mjs +1 -112
  76. package/dist/lib/ns/Hooks.mjs +2 -35
  77. package/dist/lib/ns/PluginManagerProvider.mjs +2 -12
  78. package/dist/lib/ns/SharedPackages.mjs +2 -11
  79. package/dist/lib/ns/Surface.mjs +2 -35
  80. package/dist/lib/ns/Translations.mjs +1 -2
  81. package/dist/lib/plugin-cli.mjs +2 -4
  82. package/dist/lib/plugin-cli.mjs.map +1 -1
  83. package/dist/lib/plugin-process-manager/ProcessManagerPlugin.mjs +1 -2
  84. package/dist/lib/plugin-process-manager/history/history-tracker.mjs +1 -2
  85. package/dist/lib/plugin-process-manager/history/undo-mapping.mjs +1 -47
  86. package/dist/lib/plugin-process-manager/history/undo-registry.mjs +1 -22
  87. package/dist/lib/testing/react.mjs +1 -1
  88. package/dist/lib/testing/react.mjs.map +1 -1
  89. package/dist/lib/testing.mjs +5 -5
  90. package/dist/lib/testing.mjs.map +1 -1
  91. package/dist/lib/vite-plugin.mjs +3 -3
  92. package/dist/lib/vite-plugin.mjs.map +1 -1
  93. package/dist/types/src/common/activation-events.d.ts +8 -0
  94. package/dist/types/src/common/activation-events.d.ts.map +1 -1
  95. package/dist/types/src/core/plugin-manager/manager-state.d.ts.map +1 -1
  96. package/dist/types/src/core/plugin-manager/module-loader.d.ts +0 -10
  97. package/dist/types/src/core/plugin-manager/module-loader.d.ts.map +1 -1
  98. package/dist/types/src/core/plugin-manager/plugin-manager.d.ts.map +1 -1
  99. package/dist/types/src/plugin-process-manager/process-manager-capability.d.ts.map +1 -1
  100. package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -1
  101. package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -1
  102. package/dist/types/tsconfig.tsbuildinfo +1 -1
  103. package/package.json +32 -32
  104. package/src/common/activation-events.ts +9 -0
  105. package/src/core/plugin-manager/manager-state.ts +14 -12
  106. package/src/core/plugin-manager/module-loader.ts +43 -7
  107. package/src/core/plugin-manager/plugin-manager.ts +2 -1
  108. package/src/plugin-process-manager/process-manager-capability.test.ts +66 -1
  109. package/src/plugin-process-manager/process-manager-capability.ts +22 -2
  110. package/src/ui/components/Surface/SurfaceComponent.stories.tsx +9 -7
  111. package/src/ui/hooks/useApp.tsx +2 -1
  112. package/src/vite-plugin/boot-loader/loader-app/boot-loader.css +19 -1
  113. package/dist/lib/common/Role.mjs.map +0 -1
  114. package/dist/lib/common/activation-events.mjs.map +0 -1
  115. package/dist/lib/common/capabilities.mjs.map +0 -1
  116. package/dist/lib/core/activation-event.mjs.map +0 -1
  117. package/dist/lib/core/capability-manager.mjs.map +0 -1
  118. package/dist/lib/core/plugin-asset-cache.mjs.map +0 -1
  119. package/dist/lib/core/plugin-manager.mjs.map +0 -1
  120. package/dist/lib/core/plugin-manifest.mjs.map +0 -1
  121. package/dist/lib/core/plugin.mjs.map +0 -1
  122. package/dist/lib/core/url-loader.mjs.map +0 -1
  123. package/dist/lib/ns/App.mjs.map +0 -1
  124. package/dist/lib/ns/Cli.mjs.map +0 -1
  125. package/dist/lib/ns/Devtools.mjs.map +0 -1
  126. package/dist/lib/ns/Hooks.mjs.map +0 -1
  127. package/dist/lib/ns/PluginManagerProvider.mjs.map +0 -1
  128. package/dist/lib/ns/SharedPackages.mjs.map +0 -1
  129. package/dist/lib/ns/Surface.mjs.map +0 -1
@@ -1,345 +1 @@
1
- import { t as __exportAll } from "../chunk-rolldown-runtime.mjs";
2
- import { isPlugin } from "./plugin.mjs";
3
- import { noop } from "./plugin-asset-cache.mjs";
4
- import { fetchManifest } from "./plugin-manifest.mjs";
5
- import * as Effect from "effect/Effect";
6
- import { log } from "@dxos/log";
7
- import * as Option from "effect/Option";
8
- import { BaseError } from "@dxos/errors";
9
- //#region src/core/url-loader.ts
10
- var url_loader_exports = /* @__PURE__ */ __exportAll({
11
- RemotePluginLoadError: () => RemotePluginLoadError,
12
- getInstalledVersion: () => getInstalledVersion,
13
- getRemoteEntries: () => getRemoteEntries,
14
- isLocalUrl: () => isLocalUrl,
15
- make: () => make,
16
- preload: () => preload,
17
- setInstalledVersion: () => setInstalledVersion,
18
- setRemoteEntries: () => setRemoteEntries,
19
- uninstall: () => uninstall
20
- });
21
- var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/url-loader.ts";
22
- var DEFAULT_KEY = "org.dxos.composer.remote-plugins";
23
- /**
24
- * Tagged error for any failure during remote plugin loading. Construction sites
25
- * set `context.locator` and `context.reason` (one of `'invalid-locator' |
26
- * 'manifest-error' | 'cache-error' | 'import-failed' | 'meta-missing' |
27
- * 'meta-mismatch' | 'duplicate-id'`) so handlers can route on the failure mode.
28
- */
29
- var RemotePluginLoadError = class extends BaseError.extend("RemotePluginLoadError", "Failed to load remote plugin") {};
30
- var defaultStorage = () => ({
31
- get: (key) => localStorage.getItem(key),
32
- set: (key, value) => localStorage.setItem(key, value)
33
- });
34
- var getPersistedRemotePlugins = (storage, key) => {
35
- try {
36
- const parsed = JSON.parse(storage.get(key) ?? "[]");
37
- if (!Array.isArray(parsed)) return [];
38
- return parsed.filter((entry) => typeof entry === "object" && entry !== null && typeof entry.id === "string" && typeof entry.url === "string" && (entry.version === void 0 || typeof entry.version === "string"));
39
- } catch {
40
- return [];
41
- }
42
- };
43
- var persistRemotePlugin = (storage, key, entry) => {
44
- try {
45
- const entries = getPersistedRemotePlugins(storage, key).filter((existing) => existing.id !== entry.id);
46
- entries.push(entry);
47
- storage.set(key, JSON.stringify(entries));
48
- } catch (error) {
49
- log.warn("failed to persist remote plugin entry", {
50
- entry,
51
- error
52
- }, {
53
- "~LogMeta": "~LogMeta",
54
- F: __dxlog_file,
55
- L: 99,
56
- S: void 0
57
- });
58
- }
59
- };
60
- var removePersistedRemotePlugin = (storage, key, pluginId) => {
61
- try {
62
- const entries = getPersistedRemotePlugins(storage, key).filter((existing) => existing.id !== pluginId);
63
- storage.set(key, JSON.stringify(entries));
64
- } catch (error) {
65
- log.warn("failed to remove remote plugin entry", {
66
- pluginId,
67
- error
68
- }, {
69
- "~LogMeta": "~LogMeta",
70
- F: __dxlog_file,
71
- L: 108,
72
- S: void 0
73
- });
74
- }
75
- };
76
- var isUrl = (locator) => {
77
- try {
78
- const url = new URL(locator);
79
- return url.protocol === "http:" || url.protocol === "https:";
80
- } catch {
81
- return false;
82
- }
83
- };
84
- /**
85
- * Returns true when the URL's hostname is the local host (localhost, 127.0.0.1, or ::1).
86
- */
87
- var isLocalUrl = (locator) => {
88
- try {
89
- const hostname = new URL(locator).hostname.toLowerCase();
90
- return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1" || hostname === "[::1]";
91
- } catch {
92
- return false;
93
- }
94
- };
95
- /**
96
- * Returns the list of remote plugin entries previously persisted by {@link make}.
97
- * Useful for UI code that needs to know which loaded plugins were installed from a URL
98
- * (e.g. to surface a tag on remote or localhost-hosted plugins).
99
- */
100
- var getRemoteEntries = (options = {}) => {
101
- return getPersistedRemotePlugins(options.storage ?? defaultStorage(), options.key ?? DEFAULT_KEY);
102
- };
103
- /**
104
- * Replaces the persisted remote plugin entries wholesale. Entries are read during {@link preload},
105
- * so a replacement takes effect on the next reload.
106
- */
107
- var setRemoteEntries = (entries, options = {}) => {
108
- const storage = options.storage ?? defaultStorage();
109
- const key = options.key ?? DEFAULT_KEY;
110
- try {
111
- storage.set(key, JSON.stringify(entries));
112
- } catch (error) {
113
- log.warn("failed to replace remote plugin entries", { error }, {
114
- "~LogMeta": "~LogMeta",
115
- F: __dxlog_file,
116
- L: 155,
117
- S: void 0
118
- });
119
- }
120
- };
121
- /**
122
- * Updates the persisted installed version for an already-stored remote plugin entry.
123
- * Does nothing if the plugin has not been persisted yet.
124
- */
125
- var setInstalledVersion = (id, version, options = {}) => {
126
- const storage = options.storage ?? defaultStorage();
127
- const key = options.key ?? DEFAULT_KEY;
128
- const entries = getPersistedRemotePlugins(storage, key);
129
- const index = entries.findIndex((entry) => entry.id === id);
130
- if (index === -1) return;
131
- entries[index] = {
132
- ...entries[index],
133
- version
134
- };
135
- try {
136
- storage.set(key, JSON.stringify(entries));
137
- } catch (error) {
138
- log.warn("failed to update installed version for remote plugin", {
139
- id,
140
- version,
141
- error
142
- }, {
143
- "~LogMeta": "~LogMeta",
144
- F: __dxlog_file,
145
- L: 175,
146
- S: void 0
147
- });
148
- }
149
- };
150
- /**
151
- * Returns the installed version string for the given plugin id, or `undefined` if
152
- * the plugin was installed without version tracking (legacy install) or is not found.
153
- */
154
- var getInstalledVersion = (id, options = {}) => {
155
- return getPersistedRemotePlugins(options.storage ?? defaultStorage(), options.key ?? DEFAULT_KEY).find((entry) => entry.id === id)?.version;
156
- };
157
- var normalizePluginExport = (mod) => {
158
- const exported = mod.default;
159
- if (isPlugin(exported)) return exported;
160
- if (typeof exported === "function") {
161
- const result = exported();
162
- if (isPlugin(result)) return result;
163
- }
164
- throw new Error("Remote module default export is not a Plugin or a zero-arg plugin factory.");
165
- };
166
- /**
167
- * Loads stylesheets declared in the manifest by appending `<link rel="stylesheet">` elements to the host document.
168
- * Each link is tagged with `data-dxos-plugin-id` so `uninstall` can clean them up.
169
- */
170
- var loadStylesheets = (manifest, cache) => Effect.gen(function* () {
171
- if (typeof document === "undefined") return;
172
- const cssUrls = manifest.assetUrls.filter((url) => url.endsWith(".css"));
173
- for (const url of cssUrls) {
174
- const resolved = yield* cache.resolve(manifest.key, url);
175
- if (document.querySelector(`link[data-dxos-plugin-id="${manifest.key}"][href="${resolved}"]`)) continue;
176
- const link = document.createElement("link");
177
- link.rel = "stylesheet";
178
- link.href = resolved;
179
- link.dataset.dxosPluginId = manifest.key;
180
- document.head.appendChild(link);
181
- }
182
- });
183
- var loadFromManifest = (manifestUrl, cache) => Effect.gen(function* () {
184
- log.info("loading remote plugin", { manifestUrl }, {
185
- "~LogMeta": "~LogMeta",
186
- F: __dxlog_file,
187
- L: 234,
188
- S: this
189
- });
190
- const manifest = yield* fetchManifest(manifestUrl).pipe(Effect.mapError((cause) => new RemotePluginLoadError({
191
- context: {
192
- locator: manifestUrl,
193
- reason: "manifest-error"
194
- },
195
- cause
196
- })));
197
- const wrapCacheError = Effect.mapError((cause) => new RemotePluginLoadError({
198
- context: {
199
- locator: manifestUrl,
200
- reason: "cache-error"
201
- },
202
- cause
203
- }));
204
- if (!manifest.dev) {
205
- const cachedUrls = manifest.assetUrls.indexOf(manifestUrl) === -1 ? [manifestUrl, ...manifest.assetUrls] : manifest.assetUrls;
206
- yield* cache.cache(manifest.key, cachedUrls).pipe(wrapCacheError);
207
- }
208
- const entryUrl = manifest.dev ? manifest.entryUrl : yield* cache.resolve(manifest.key, manifest.entryUrl).pipe(wrapCacheError);
209
- const plugin = normalizePluginExport(yield* Effect.tryPromise({
210
- try: () => import(
211
- /* @vite-ignore */
212
- entryUrl
213
- ),
214
- catch: (cause) => new RemotePluginLoadError({
215
- context: {
216
- locator: manifestUrl,
217
- reason: "import-failed"
218
- },
219
- cause
220
- })
221
- }));
222
- if (!plugin.meta.profile.key || !plugin.meta.profile.name) return yield* Effect.fail(new RemotePluginLoadError({ context: {
223
- locator: manifestUrl,
224
- reason: "meta-missing"
225
- } }));
226
- if (plugin.meta.profile.key !== manifest.key) return yield* Effect.fail(new RemotePluginLoadError({ context: {
227
- locator: manifestUrl,
228
- reason: "meta-mismatch",
229
- metaId: plugin.meta.profile.key,
230
- manifestId: manifest.key
231
- } }));
232
- if (!manifest.dev) yield* loadStylesheets(manifest, cache).pipe(wrapCacheError);
233
- return {
234
- plugin,
235
- manifest
236
- };
237
- });
238
- /**
239
- * Preloads previously persisted remote plugins from storage. Per-entry failures
240
- * are logged and swallowed — the returned effect always succeeds with whichever
241
- * plugins loaded cleanly, so a single bad entry can't block the host's startup.
242
- */
243
- var preload = (options = {}) => Effect.gen(function* () {
244
- const storage = options.storage ?? defaultStorage();
245
- const key = options.key ?? DEFAULT_KEY;
246
- const cache = options.cache ?? noop();
247
- const onPluginLoaded = options.onPluginLoaded;
248
- const entries = getPersistedRemotePlugins(storage, key);
249
- if (entries.length === 0) return [];
250
- log.info("preloading remote plugins", { count: entries.length }, {
251
- "~LogMeta": "~LogMeta",
252
- F: __dxlog_file,
253
- L: 310,
254
- S: this
255
- });
256
- const total = entries.length;
257
- let loaded = 0;
258
- return (yield* Effect.all(entries.map((entry) => loadFromManifest(entry.url, cache).pipe(Effect.tapError((error) => Effect.sync(() => log.warn("failed to preload remote plugin", {
259
- entry,
260
- error
261
- }, {
262
- "~LogMeta": "~LogMeta",
263
- F: __dxlog_file,
264
- L: 316,
265
- S: this
266
- }))), Effect.option, Effect.tap(() => Effect.sync(() => {
267
- loaded += 1;
268
- }).pipe(Effect.andThen(Effect.try(() => onPluginLoaded?.(loaded, total))), Effect.tapError((error) => Effect.sync(() => log.warn("onPluginLoaded threw", {
269
- loaded,
270
- total,
271
- error
272
- }, {
273
- "~LogMeta": "~LogMeta",
274
- F: __dxlog_file,
275
- L: 328,
276
- S: this
277
- }))), Effect.ignore)))), { concurrency: "unbounded" })).flatMap((result) => Option.match(result, {
278
- onNone: () => [],
279
- onSome: ({ plugin }) => [plugin]
280
- }));
281
- });
282
- /**
283
- * Creates a plugin loader that resolves built-in plugins by ID or loads remote plugins from URLs.
284
- *
285
- * Remote URLs must point at a plugin manifest (`plugin.json`). The loader fetches the manifest,
286
- * eagerly persists every declared asset via the configured `PluginAssetCache`, then dynamic-imports
287
- * the entry module.
288
- */
289
- var make = (builtinPlugins, options = {}) => {
290
- const storage = options.storage ?? defaultStorage();
291
- const key = options.key ?? DEFAULT_KEY;
292
- const cache = options.cache ?? noop();
293
- return (locator) => Effect.gen(function* () {
294
- const builtin = builtinPlugins.find((plugin) => plugin.meta.profile.key === locator);
295
- if (builtin) return { plugin: builtin };
296
- if (!isUrl(locator)) return yield* Effect.fail(new RemotePluginLoadError({ context: {
297
- locator,
298
- reason: "invalid-locator"
299
- } }));
300
- const { plugin, manifest } = yield* loadFromManifest(locator, cache);
301
- if (!manifest.dev) {
302
- if (builtinPlugins.find((existing) => existing.meta.profile.key === plugin.meta.profile.key)) return yield* Effect.fail(new RemotePluginLoadError({ context: {
303
- locator,
304
- reason: "duplicate-id",
305
- id: plugin.meta.profile.key
306
- } }));
307
- persistRemotePlugin(storage, key, {
308
- id: plugin.meta.profile.key,
309
- url: locator
310
- });
311
- }
312
- return {
313
- plugin,
314
- dev: manifest.dev
315
- };
316
- });
317
- };
318
- /**
319
- * Removes a previously installed remote plugin: drops the persisted entry, evicts cached
320
- * assets, and removes any stylesheet `<link>` tags that {@link loadFromManifest} appended.
321
- *
322
- * Cache eviction failures are logged and swallowed — the persisted entry has already been
323
- * dropped so the user-visible state is consistent regardless of whether the platform
324
- * cache cooperated.
325
- */
326
- var uninstall = (pluginId, options = {}) => Effect.gen(function* () {
327
- const storage = options.storage ?? defaultStorage();
328
- const key = options.key ?? DEFAULT_KEY;
329
- const cache = options.cache ?? noop();
330
- removePersistedRemotePlugin(storage, key, pluginId);
331
- if (typeof document !== "undefined") document.querySelectorAll(`link[data-dxos-plugin-id="${pluginId}"]`).forEach((node) => node.remove());
332
- yield* cache.evict(pluginId).pipe(Effect.tapError((error) => Effect.sync(() => log.warn("failed to evict plugin assets", {
333
- pluginId,
334
- error
335
- }, {
336
- "~LogMeta": "~LogMeta",
337
- F: __dxlog_file,
338
- L: 403,
339
- S: this
340
- }))), Effect.ignore);
341
- });
342
- //#endregion
343
- export { RemotePluginLoadError, getInstalledVersion, getRemoteEntries, isLocalUrl, make, preload, setInstalledVersion, setRemoteEntries, url_loader_exports as t, uninstall };
344
-
345
- //# sourceMappingURL=url-loader.mjs.map
1
+ export { t as RemotePluginLoadError, n as getInstalledVersion, r as getRemoteEntries, i as isLocalUrl, a as make, o as preload, s as setInstalledVersion, c as setRemoteEntries, l as uninstall } from "../chunk-url-loader.mjs";
@@ -1,25 +1,25 @@
1
- import { t as activation_event_exports } from "./core/activation-event.mjs";
1
+ import { r as activation_event_exports } from "./chunk-activation-event.mjs";
2
2
  import { l as capability_exports } from "./chunk-capability.mjs";
3
- import { t as capability_manager_exports } from "./core/capability-manager.mjs";
4
- import { t as plugin_exports } from "./core/plugin.mjs";
5
- import { t as plugin_asset_cache_exports } from "./core/plugin-asset-cache.mjs";
3
+ import { t as capability_manager_exports } from "./chunk-capability-manager.mjs";
4
+ import { b as plugin_exports } from "./chunk-plugin.mjs";
5
+ import { r as plugin_asset_cache_exports } from "./chunk-plugin-asset-cache.mjs";
6
6
  import { n as registry_exports } from "./chunk-registry.mjs";
7
- import { t as plugin_manager_exports } from "./core/plugin-manager.mjs";
8
- import { t as plugin_manifest_exports } from "./core/plugin-manifest.mjs";
9
- import { t as url_loader_exports } from "./core/url-loader.mjs";
10
- import { t as capabilities_exports } from "./common/capabilities.mjs";
11
- import { t as activation_events_exports } from "./common/activation-events.mjs";
12
- import { t as Role_exports } from "./common/Role.mjs";
13
- import { t as Surface_exports } from "./ns/Surface.mjs";
14
- import { t as SharedPackages_exports } from "./ns/SharedPackages.mjs";
15
- import { t as PluginManagerProvider_exports } from "./ns/PluginManagerProvider.mjs";
16
- import { t as Devtools_exports } from "./ns/Devtools.mjs";
17
- import { t as Hooks_exports } from "./ns/Hooks.mjs";
18
- import { t as Cli_exports } from "./ns/Cli.mjs";
19
- import { t as App_exports } from "./ns/App.mjs";
7
+ import { t as plugin_manager_exports } from "./chunk-plugin-manager2.mjs";
8
+ import { o as plugin_manifest_exports } from "./chunk-plugin-manifest.mjs";
9
+ import { u as url_loader_exports } from "./chunk-url-loader.mjs";
10
+ import { x as capabilities_exports } from "./chunk-capabilities.mjs";
11
+ import { s as activation_events_exports } from "./chunk-activation-events.mjs";
12
+ import { t as Role_exports } from "./chunk-Role.mjs";
13
+ import { t as Surface_exports } from "./chunk-Surface2.mjs";
14
+ import { t as SharedPackages_exports } from "./chunk-SharedPackages.mjs";
15
+ import { t as PluginManagerProvider_exports } from "./chunk-PluginManagerProvider.mjs";
16
+ import { t as Devtools_exports } from "./chunk-Devtools.mjs";
17
+ import { t as Hooks_exports } from "./chunk-Hooks2.mjs";
18
+ import { t as Cli_exports } from "./chunk-Cli.mjs";
19
+ import { t as App_exports } from "./chunk-App.mjs";
20
20
  import { t as Translations_exports } from "./chunk-Translations.mjs";
21
- import { t as undo_mapping_exports } from "./plugin-process-manager/history/undo-mapping.mjs";
22
- import { t as undo_registry_exports } from "./plugin-process-manager/history/undo-registry.mjs";
21
+ import { r as undo_mapping_exports } from "./chunk-undo-mapping.mjs";
22
+ import { n as undo_registry_exports } from "./chunk-undo-registry.mjs";
23
23
  import { t as history_tracker_exports } from "./chunk-history-tracker.mjs";
24
24
  import { t as ProcessManagerPlugin_exports } from "./chunk-ProcessManagerPlugin.mjs";
25
25
  export { activation_event_exports as ActivationEvent, activation_events_exports as ActivationEvents, App_exports as App, capabilities_exports as Capabilities, capability_exports as Capability, capability_manager_exports as CapabilityManager, Cli_exports as Cli, Devtools_exports as Devtools, history_tracker_exports as HistoryTracker, Hooks_exports as Hooks, plugin_exports as Plugin, plugin_asset_cache_exports as PluginAssetCache, plugin_manager_exports as PluginManager, PluginManagerProvider_exports as PluginManagerProvider, plugin_manifest_exports as PluginManifest, ProcessManagerPlugin_exports as ProcessManagerPlugin, registry_exports as Registry, Role_exports as Role, SharedPackages_exports as SharedPackages, Surface_exports as Surface, Translations_exports as Translations, undo_mapping_exports as UndoMapping, undo_registry_exports as UndoRegistry, url_loader_exports as UrlLoader };
@@ -1,11 +1,2 @@
1
- import { t as __exportAll } from "../chunk-rolldown-runtime.mjs";
2
- import { D as bootLoader, E as App } from "../chunk-hooks.mjs";
3
- //#region src/App.ts
4
- var App_exports = /* @__PURE__ */ __exportAll({
5
- Root: () => App,
6
- bootLoader: () => bootLoader
7
- });
8
- //#endregion
9
- export { App as Root, bootLoader, App_exports as t };
10
-
11
- //# sourceMappingURL=App.mjs.map
1
+ export { E as Root, D as bootLoader } from "../chunk-hooks.mjs";
2
+ import "../chunk-App.mjs";
@@ -1,8 +1,2 @@
1
- import { t as __exportAll } from "../chunk-rolldown-runtime.mjs";
2
- import { createCliApp } from "../cli.mjs";
3
- //#region src/Cli.ts
4
- var Cli_exports = /* @__PURE__ */ __exportAll({ createCliApp: () => createCliApp });
5
- //#endregion
6
- export { createCliApp, Cli_exports as t };
7
-
8
- //# sourceMappingURL=Cli.mjs.map
1
+ export { createCliApp } from "../cli.mjs";
2
+ import "../chunk-Cli.mjs";
@@ -1,112 +1 @@
1
- import { t as __exportAll } from "../chunk-rolldown-runtime.mjs";
2
- import { OperationHandler, OperationInvoker } from "../common/capabilities.mjs";
3
- import { DXN } from "@dxos/keys";
4
- import * as Schema from "effect/Schema";
5
- import * as Result from "effect/Result";
6
- import * as SchemaIssue from "effect/SchemaIssue";
7
- import * as SchemaAST from "@dxos/effect/SchemaAST";
8
- //#region src/Devtools.ts
9
- var Devtools_exports = /* @__PURE__ */ __exportAll({ setup: () => setup });
10
- /**
11
- * Module ids are `org.dxos.plugin.<slug>.module.<name>`; the plugin id is everything before
12
- * `.module.`. Returns undefined for ids that do not follow the convention.
13
- */
14
- var pluginIdOf = (moduleId) => {
15
- const index = moduleId.indexOf(".module.");
16
- return index === -1 ? void 0 : moduleId.slice(0, index);
17
- };
18
- /** Rendered types carry the field's description annotation, which can be a paragraph. */
19
- var MAX_TYPE_LENGTH = 60;
20
- /**
21
- * Top-level fields of a struct schema, so `operations()` says what an operation takes rather than
22
- * only what it is called. Non-struct schemas (`Schema.Void`, unions) have no field list.
23
- */
24
- var formatIssue = SchemaIssue.makeFormatterStandardSchemaV1();
25
- var fieldsOf = (schema) => {
26
- const ast = schema?.ast;
27
- if (!ast || !SchemaAST.isObjects(ast)) return;
28
- return SchemaAST.getPropertySignatures(ast).map((property) => {
29
- const type = String(property.type);
30
- return {
31
- name: String(property.name),
32
- optional: SchemaAST.isOptional(property.type),
33
- type: type.length > MAX_TYPE_LENGTH ? `${type.slice(0, MAX_TYPE_LENGTH)}…` : type
34
- };
35
- });
36
- };
37
- /**
38
- * Attaches the plugin/operation console API to `globalThis.composer`.
39
- *
40
- * Lives at the framework level rather than in a devtools plugin so it is present in any app and
41
- * does not depend on which plugins happen to be enabled — inspecting a broken plugin set is
42
- * exactly when this is wanted.
43
- */
44
- var setup = (manager) => {
45
- const listOperations = (pluginId) => {
46
- const byModule = manager.registry.get(manager.capabilities.atomByModule(OperationHandler));
47
- return Object.entries(byModule).flatMap(([moduleId, sets]) => {
48
- const owner = pluginIdOf(moduleId);
49
- if (pluginId && owner !== pluginId) return [];
50
- return sets.flatMap((set) => set.definitions().map((definition) => ({
51
- key: definition.meta.key,
52
- name: definition.meta.name,
53
- description: definition.meta.description,
54
- pluginId: owner,
55
- moduleId,
56
- input: fieldsOf(definition.input),
57
- output: fieldsOf(definition.output)
58
- })));
59
- });
60
- };
61
- const normalizeKey = (key) => {
62
- if (!DXN.isDXN(key)) return key;
63
- try {
64
- return DXN.getName(key);
65
- } catch {
66
- return key;
67
- }
68
- };
69
- const findDefinition = (key) => {
70
- const wanted = normalizeKey(key);
71
- for (const set of manager.capabilities.getAll(OperationHandler)) {
72
- const definition = set.definitions().find((candidate) => normalizeKey(candidate.meta.key) === wanted);
73
- if (definition) return definition;
74
- }
75
- };
76
- const composer = globalThis.composer ??= {};
77
- composer.manager = manager;
78
- composer.plugins = () => {
79
- const core = new Set(manager.getCore());
80
- const enabled = new Set(manager.getEnabled());
81
- const active = new Set(manager.getActive());
82
- return manager.getPlugins().map((plugin) => {
83
- const id = plugin.meta.profile.key;
84
- return {
85
- id,
86
- name: plugin.meta.profile.name,
87
- description: plugin.meta.profile.description,
88
- core: core.has(id),
89
- enabled: enabled.has(id),
90
- active: plugin.modules.some((module) => active.has(module.id)),
91
- moduleIds: plugin.modules.map((module) => module.id)
92
- };
93
- });
94
- };
95
- composer.operations = listOperations;
96
- composer.invoke = async (key, input, options) => {
97
- const definition = findDefinition(key);
98
- if (!definition) throw new Error(`Unknown operation: ${key} (try composer.operations())`);
99
- const validation = Schema.decodeUnknownResult(Schema.make(SchemaAST.toType(definition.input.ast)), { errors: "all" })(input);
100
- if (Result.isFailure(validation)) {
101
- const issues = formatIssue(validation.failure.issue).issues.map((issue) => `${issue.path?.join(".") || "(root)"}: ${issue.message}`).join("; ");
102
- throw new Error(`Invalid input for ${key} — ${issues}`);
103
- }
104
- const { data, error } = await manager.capabilities.get(OperationInvoker).invokePromise(definition, input, options);
105
- if (error) throw error;
106
- return data;
107
- };
108
- };
109
- //#endregion
110
- export { setup, Devtools_exports as t };
111
-
112
- //# sourceMappingURL=Devtools.mjs.map
1
+ export { n as setup } from "../chunk-Devtools.mjs";
@@ -1,35 +1,2 @@
1
- import { t as __exportAll } from "../chunk-rolldown-runtime.mjs";
2
- import { C as pluginSlugOf, O as useActivationSignal, S as StartupTimeoutError, T as useApp, _ as useOptionalCapabilities, a as useSpaceService, b as STARTUP_ACTIVATED_EVENT, c as useAtomCapability, d as useCapability, f as useOperation, g as useOptionalAtomCapabilityState, h as useOptionalAtomCapability, i as useSpaceCallback, l as useAtomCapabilityState, m as useOperationInvoker, n as useSettingsState, o as LoadingState, p as useOperationHandler, r as useProcessManagerRuntime, s as useLoading, t as useSurface, u as useCapabilities, v as useOptionalCapability, w as pluginSlugOfKey, x as STARTUP_FAILED_EVENT, y as FIRST_INTERACTIVE_EVENT } from "../chunk-hooks.mjs";
3
- //#region src/Hooks.ts
4
- var Hooks_exports = /* @__PURE__ */ __exportAll({
5
- FIRST_INTERACTIVE_EVENT: () => FIRST_INTERACTIVE_EVENT,
6
- LoadingState: () => LoadingState,
7
- STARTUP_ACTIVATED_EVENT: () => STARTUP_ACTIVATED_EVENT,
8
- STARTUP_FAILED_EVENT: () => STARTUP_FAILED_EVENT,
9
- StartupTimeoutError: () => StartupTimeoutError,
10
- pluginSlugOf: () => pluginSlugOf,
11
- pluginSlugOfKey: () => pluginSlugOfKey,
12
- useActivationSignal: () => useActivationSignal,
13
- useApp: () => useApp,
14
- useAtomCapability: () => useAtomCapability,
15
- useAtomCapabilityState: () => useAtomCapabilityState,
16
- useCapabilities: () => useCapabilities,
17
- useCapability: () => useCapability,
18
- useLoading: () => useLoading,
19
- useOperation: () => useOperation,
20
- useOperationHandler: () => useOperationHandler,
21
- useOperationInvoker: () => useOperationInvoker,
22
- useOptionalAtomCapability: () => useOptionalAtomCapability,
23
- useOptionalAtomCapabilityState: () => useOptionalAtomCapabilityState,
24
- useOptionalCapabilities: () => useOptionalCapabilities,
25
- useOptionalCapability: () => useOptionalCapability,
26
- useProcessManagerRuntime: () => useProcessManagerRuntime,
27
- useSettingsState: () => useSettingsState,
28
- useSpaceCallback: () => useSpaceCallback,
29
- useSpaceService: () => useSpaceService,
30
- useSurface: () => useSurface
31
- });
32
- //#endregion
33
- export { FIRST_INTERACTIVE_EVENT, LoadingState, STARTUP_ACTIVATED_EVENT, STARTUP_FAILED_EVENT, StartupTimeoutError, pluginSlugOf, pluginSlugOfKey, Hooks_exports as t, useActivationSignal, useApp, useAtomCapability, useAtomCapabilityState, useCapabilities, useCapability, useLoading, useOperation, useOperationHandler, useOperationInvoker, useOptionalAtomCapability, useOptionalAtomCapabilityState, useOptionalCapabilities, useOptionalCapability, useProcessManagerRuntime, useSettingsState, useSpaceCallback, useSpaceService, useSurface };
34
-
35
- //# sourceMappingURL=Hooks.mjs.map
1
+ export { y as FIRST_INTERACTIVE_EVENT, o as LoadingState, b as STARTUP_ACTIVATED_EVENT, x as STARTUP_FAILED_EVENT, S as StartupTimeoutError, C as pluginSlugOf, w as pluginSlugOfKey, O as useActivationSignal, T as useApp, c as useAtomCapability, l as useAtomCapabilityState, u as useCapabilities, d as useCapability, s as useLoading, f as useOperation, p as useOperationHandler, m as useOperationInvoker, h as useOptionalAtomCapability, g as useOptionalAtomCapabilityState, _ as useOptionalCapabilities, v as useOptionalCapability, r as useProcessManagerRuntime, n as useSettingsState, i as useSpaceCallback, a as useSpaceService, t as useSurface } from "../chunk-hooks.mjs";
2
+ import "../chunk-Hooks2.mjs";
@@ -1,12 +1,2 @@
1
- import { t as __exportAll } from "../chunk-rolldown-runtime.mjs";
2
- import { PluginManagerProvider, useOptionalPluginManager, usePluginManager } from "../PluginManagerProvider.mjs";
3
- //#region src/PluginManagerProvider.ts
4
- var PluginManagerProvider_exports = /* @__PURE__ */ __exportAll({
5
- Root: () => PluginManagerProvider,
6
- useOptionalPluginManager: () => useOptionalPluginManager,
7
- usePluginManager: () => usePluginManager
8
- });
9
- //#endregion
10
- export { PluginManagerProvider as Root, PluginManagerProvider_exports as t, useOptionalPluginManager, usePluginManager };
11
-
12
- //# sourceMappingURL=PluginManagerProvider.mjs.map
1
+ export { PluginManagerProvider as Root, useOptionalPluginManager, usePluginManager } from "../PluginManagerProvider.mjs";
2
+ import "../chunk-PluginManagerProvider.mjs";
@@ -1,11 +1,2 @@
1
- import { t as __exportAll } from "../chunk-rolldown-runtime.mjs";
2
- import { DEFAULT_PACKAGES, isSharedPackage } from "../vite-plugin/packages.mjs";
3
- //#region src/SharedPackages.ts
4
- var SharedPackages_exports = /* @__PURE__ */ __exportAll({
5
- DEFAULT_PACKAGES: () => DEFAULT_PACKAGES,
6
- isSharedPackage: () => isSharedPackage
7
- });
8
- //#endregion
9
- export { DEFAULT_PACKAGES, isSharedPackage, SharedPackages_exports as t };
10
-
11
- //# sourceMappingURL=SharedPackages.mjs.map
1
+ export { DEFAULT_PACKAGES, isSharedPackage } from "../vite-plugin/packages.mjs";
2
+ import "../chunk-SharedPackages.mjs";
@@ -1,37 +1,4 @@
1
- import { t as __exportAll } from "../chunk-rolldown-runtime.mjs";
2
1
  import { d as SurfaceManagerProvider, f as useSurfaceManager, t as SurfaceManager } from "../chunk-SurfaceManager.mjs";
3
2
  import { C as useProfilerSnapshot, S as useProfilerEntries, T as useSelected, _ as useIsAvailable, a as aggregateProfilerStats, b as useProfilerCallback, c as createWeb, d as getSelected, f as isDebugEnabled, g as setDebug, h as select, l as getMetrics, m as makeFilter, n as ProfilerProvider, o as clearMetrics, p as isFilter, r as Surface, s as create, t as Context, u as getMounted, v as useMetrics, w as useProfilerStats, x as useProfilerClear, y as useMounted } from "../chunk-Surface.mjs";
4
- //#region src/Surface.ts
5
- var Surface_exports = /* @__PURE__ */ __exportAll({
6
- Context: () => Context,
7
- Manager: () => SurfaceManager,
8
- ManagerProvider: () => SurfaceManagerProvider,
9
- ProfilerProvider: () => ProfilerProvider,
10
- Surface: () => Surface,
11
- aggregateProfilerStats: () => aggregateProfilerStats,
12
- clearMetrics: () => clearMetrics,
13
- create: () => create,
14
- createWeb: () => createWeb,
15
- getMetrics: () => getMetrics,
16
- getMounted: () => getMounted,
17
- getSelected: () => getSelected,
18
- isDebugEnabled: () => isDebugEnabled,
19
- isFilter: () => isFilter,
20
- makeFilter: () => makeFilter,
21
- select: () => select,
22
- setDebug: () => setDebug,
23
- useIsAvailable: () => useIsAvailable,
24
- useMetrics: () => useMetrics,
25
- useMounted: () => useMounted,
26
- useProfilerCallback: () => useProfilerCallback,
27
- useProfilerClear: () => useProfilerClear,
28
- useProfilerEntries: () => useProfilerEntries,
29
- useProfilerSnapshot: () => useProfilerSnapshot,
30
- useProfilerStats: () => useProfilerStats,
31
- useSelected: () => useSelected,
32
- useSurfaceManager: () => useSurfaceManager
33
- });
34
- //#endregion
35
- export { Context, SurfaceManager as Manager, SurfaceManagerProvider as ManagerProvider, ProfilerProvider, Surface, aggregateProfilerStats, clearMetrics, create, createWeb, getMetrics, getMounted, getSelected, isDebugEnabled, isFilter, makeFilter, select, setDebug, Surface_exports as t, useIsAvailable, useMetrics, useMounted, useProfilerCallback, useProfilerClear, useProfilerEntries, useProfilerSnapshot, useProfilerStats, useSelected, useSurfaceManager };
36
-
37
- //# sourceMappingURL=Surface.mjs.map
3
+ import "../chunk-Surface2.mjs";
4
+ export { Context, SurfaceManager as Manager, SurfaceManagerProvider as ManagerProvider, ProfilerProvider, Surface, aggregateProfilerStats, clearMetrics, create, createWeb, getMetrics, getMounted, getSelected, isDebugEnabled, isFilter, makeFilter, select, setDebug, useIsAvailable, useMetrics, useMounted, useProfilerCallback, useProfilerClear, useProfilerEntries, useProfilerSnapshot, useProfilerStats, useSelected, useSurfaceManager };
@@ -1,2 +1 @@
1
- import { n as Label } from "../chunk-Translations.mjs";
2
- export { Label };
1
+ export { n as Label } from "../chunk-Translations.mjs";
@@ -1,7 +1,5 @@
1
- import * as path$1 from "@dxos/node-std/path";
2
- import path from "@dxos/node-std/path";
3
- import * as fs$1 from "@dxos/node-std/fs";
4
- import fs from "@dxos/node-std/fs";
1
+ import path, * as path$1 from "@dxos/node-std/path";
2
+ import fs, * as fs$1 from "@dxos/node-std/fs";
5
3
  import { createRequire } from "node:module";
6
4
  //#region src/plugin-cli/ts-util.ts
7
5
  var TYPESCRIPT_CANDIDATES = ["@typescript/typescript6", "typescript"];