@dxos/plugin-native 0.8.4-main.dedc0f3 → 0.8.4-main.dfabb4ec29

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 (67) hide show
  1. package/dist/lib/neutral/NativePlugin.mjs +28 -0
  2. package/dist/lib/neutral/NativePlugin.mjs.map +7 -0
  3. package/dist/lib/neutral/capabilities/index.mjs +11 -0
  4. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  5. package/dist/lib/neutral/chunk-254JXXJC.mjs +18 -0
  6. package/dist/lib/neutral/chunk-254JXXJC.mjs.map +7 -0
  7. package/dist/lib/neutral/index.mjs +7 -0
  8. package/dist/lib/neutral/index.mjs.map +7 -0
  9. package/dist/lib/neutral/meta.json +1 -0
  10. package/dist/lib/neutral/meta.mjs +7 -0
  11. package/dist/lib/neutral/meta.mjs.map +7 -0
  12. package/dist/lib/neutral/ollama-CYD5M6XB.mjs +60 -0
  13. package/dist/lib/neutral/ollama-CYD5M6XB.mjs.map +7 -0
  14. package/dist/lib/neutral/plugin.mjs +11 -0
  15. package/dist/lib/neutral/plugin.mjs.map +7 -0
  16. package/dist/lib/neutral/spotlight-listener-TRCJXLOQ.mjs +46 -0
  17. package/dist/lib/neutral/spotlight-listener-TRCJXLOQ.mjs.map +7 -0
  18. package/dist/lib/neutral/translations.mjs +18 -0
  19. package/dist/lib/neutral/translations.mjs.map +7 -0
  20. package/dist/lib/neutral/updater-ZAJJC24D.mjs +141 -0
  21. package/dist/lib/neutral/updater-ZAJJC24D.mjs.map +7 -0
  22. package/dist/types/src/NativePlugin.d.ts +3 -1
  23. package/dist/types/src/NativePlugin.d.ts.map +1 -1
  24. package/dist/types/src/capabilities/index.d.ts +4 -3
  25. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  26. package/dist/types/src/capabilities/ollama.d.ts +5 -2
  27. package/dist/types/src/capabilities/ollama.d.ts.map +1 -1
  28. package/dist/types/src/capabilities/spotlight-listener.d.ts +8 -0
  29. package/dist/types/src/capabilities/spotlight-listener.d.ts.map +1 -0
  30. package/dist/types/src/capabilities/updater.d.ts +3 -2
  31. package/dist/types/src/capabilities/updater.d.ts.map +1 -1
  32. package/dist/types/src/constants.d.ts +2 -0
  33. package/dist/types/src/constants.d.ts.map +1 -0
  34. package/dist/types/src/index.d.ts +0 -1
  35. package/dist/types/src/index.d.ts.map +1 -1
  36. package/dist/types/src/meta.d.ts +2 -3
  37. package/dist/types/src/meta.d.ts.map +1 -1
  38. package/dist/types/src/plugin.d.ts +3 -0
  39. package/dist/types/src/plugin.d.ts.map +1 -0
  40. package/dist/types/src/translations.d.ts +5 -6
  41. package/dist/types/src/translations.d.ts.map +1 -1
  42. package/dist/types/tsconfig.tsbuildinfo +1 -1
  43. package/package.json +57 -21
  44. package/src/NativePlugin.tsx +26 -27
  45. package/src/capabilities/index.ts +4 -4
  46. package/src/capabilities/ollama.ts +32 -23
  47. package/src/capabilities/spotlight-listener.ts +58 -0
  48. package/src/capabilities/updater.ts +107 -58
  49. package/src/constants.ts +7 -0
  50. package/src/index.ts +0 -1
  51. package/src/meta.ts +9 -5
  52. package/src/plugin.ts +9 -0
  53. package/src/translations.ts +5 -5
  54. package/dist/lib/browser/chunk-E2JDGVJI.mjs +0 -12
  55. package/dist/lib/browser/chunk-E2JDGVJI.mjs.map +0 -7
  56. package/dist/lib/browser/index.mjs +0 -58
  57. package/dist/lib/browser/index.mjs.map +0 -7
  58. package/dist/lib/browser/meta.json +0 -1
  59. package/dist/lib/browser/ollama-7VZCJLY5.mjs +0 -87
  60. package/dist/lib/browser/ollama-7VZCJLY5.mjs.map +0 -7
  61. package/dist/lib/browser/updater-MNSUJ5ER.mjs +0 -133
  62. package/dist/lib/browser/updater-MNSUJ5ER.mjs.map +0 -7
  63. package/dist/lib/browser/window-5EBHZJJ4.mjs +0 -34
  64. package/dist/lib/browser/window-5EBHZJJ4.mjs.map +0 -7
  65. package/dist/types/src/capabilities/window.d.ts +0 -4
  66. package/dist/types/src/capabilities/window.d.ts.map +0 -1
  67. package/src/capabilities/window.ts +0 -49
package/package.json CHANGED
@@ -1,51 +1,87 @@
1
1
  {
2
2
  "name": "@dxos/plugin-native",
3
- "version": "0.8.4-main.dedc0f3",
3
+ "version": "0.8.4-main.dfabb4ec29",
4
4
  "description": "Composer plugin that runs when on a native device.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/dxos/dxos"
10
+ },
7
11
  "license": "MIT",
8
12
  "author": "DXOS.org",
9
13
  "sideEffects": true,
10
14
  "type": "module",
15
+ "imports": {
16
+ "#capabilities": {
17
+ "source": "./src/capabilities/index.ts",
18
+ "types": "./dist/types/src/capabilities/index.d.ts",
19
+ "default": "./dist/lib/neutral/capabilities/index.mjs"
20
+ },
21
+ "#meta": {
22
+ "source": "./src/meta.ts",
23
+ "types": "./dist/types/src/meta.d.ts",
24
+ "default": "./dist/lib/neutral/meta.mjs"
25
+ },
26
+ "#plugin": {
27
+ "source": "./src/NativePlugin.tsx",
28
+ "types": "./dist/types/src/NativePlugin.d.ts",
29
+ "default": "./dist/lib/neutral/NativePlugin.mjs"
30
+ },
31
+ "#translations": {
32
+ "source": "./src/translations.ts",
33
+ "types": "./dist/types/src/translations.d.ts",
34
+ "default": "./dist/lib/neutral/translations.mjs"
35
+ }
36
+ },
11
37
  "exports": {
12
38
  ".": {
13
39
  "source": "./src/index.ts",
14
40
  "types": "./dist/types/src/index.d.ts",
15
- "browser": "./dist/lib/browser/index.mjs"
41
+ "default": "./dist/lib/neutral/index.mjs"
42
+ },
43
+ "./plugin": {
44
+ "source": "./src/plugin.ts",
45
+ "types": "./dist/types/src/plugin.d.ts",
46
+ "default": "./dist/lib/neutral/plugin.mjs"
47
+ },
48
+ "./translations": {
49
+ "source": "./src/translations.ts",
50
+ "types": "./dist/types/src/translations.d.ts",
51
+ "default": "./dist/lib/neutral/translations.mjs"
16
52
  }
17
53
  },
18
54
  "types": "dist/types/src/index.d.ts",
19
- "typesVersions": {
20
- "*": {}
21
- },
22
55
  "files": [
23
56
  "dist",
24
57
  "src"
25
58
  ],
26
59
  "dependencies": {
27
- "@effect/platform": "^0.90.2",
28
- "@tauri-apps/api": "^2.3.0",
29
- "@tauri-apps/plugin-os": "^2.3.0",
60
+ "@effect/platform": "0.94.4",
61
+ "@tauri-apps/api": "^2.8.0",
62
+ "@tauri-apps/plugin-os": "^2.3.1",
30
63
  "@tauri-apps/plugin-process": "^2.3.0",
31
- "@tauri-apps/plugin-shell": "^2.3.0",
64
+ "@tauri-apps/plugin-shell": "^2.3.1",
32
65
  "@tauri-apps/plugin-updater": "^2.9.0",
33
- "effect": "3.17.7",
34
- "@dxos/app-framework": "0.8.4-main.dedc0f3",
35
- "@dxos/ai": "0.8.4-main.dedc0f3",
36
- "@dxos/log": "0.8.4-main.dedc0f3",
37
- "@dxos/plugin-assistant": "0.8.4-main.dedc0f3",
38
- "@dxos/plugin-help": "0.8.4-main.dedc0f3",
39
- "@dxos/plugin-navtree": "0.8.4-main.dedc0f3",
40
- "@dxos/util": "0.8.4-main.dedc0f3"
66
+ "effect": "3.20.0",
67
+ "@dxos/app-framework": "0.8.4-main.dfabb4ec29",
68
+ "@dxos/ai": "0.8.4-main.dfabb4ec29",
69
+ "@dxos/app-toolkit": "0.8.4-main.dfabb4ec29",
70
+ "@dxos/log": "0.8.4-main.dfabb4ec29",
71
+ "@dxos/operation": "0.8.4-main.dfabb4ec29",
72
+ "@dxos/plugin-assistant": "0.8.4-main.dfabb4ec29",
73
+ "@dxos/plugin-navtree": "0.8.4-main.dfabb4ec29",
74
+ "@dxos/util": "0.8.4-main.dfabb4ec29",
75
+ "@dxos/plugin-help": "0.8.4-main.dfabb4ec29"
41
76
  },
42
77
  "devDependencies": {
43
- "vite": "7.1.1",
44
- "@dxos/react-ui": "0.8.4-main.dedc0f3"
78
+ "vite": "^8.0.10",
79
+ "@dxos/plugin-testing": "0.8.4-main.dfabb4ec29",
80
+ "@dxos/react-ui": "0.8.4-main.dfabb4ec29"
45
81
  },
46
82
  "peerDependencies": {
47
- "effect": "^3.13.3",
48
- "@dxos/react-ui": "0.8.4-main.dedc0f3"
83
+ "effect": "3.20.0",
84
+ "@dxos/react-ui": "0.8.4-main.dfabb4ec29"
49
85
  },
50
86
  "publishConfig": {
51
87
  "access": "public"
@@ -2,33 +2,32 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { Capabilities, Events, contributes, defineModule, definePlugin } from '@dxos/app-framework';
5
+ import { ActivationEvents, Plugin } from '@dxos/app-framework';
6
+ import { AppPlugin } from '@dxos/app-toolkit';
6
7
  import { AssistantEvents } from '@dxos/plugin-assistant';
7
8
 
8
- import { Ollama, Updater, Window } from './capabilities';
9
- import { meta } from './meta';
10
- import { translations } from './translations';
9
+ import { Ollama, SpotlightListener, Updater } from '#capabilities';
10
+ import { meta } from '#meta';
11
+ import { translations } from '#translations';
11
12
 
12
- export const NativePlugin = () =>
13
- definePlugin(meta, [
14
- defineModule({
15
- id: `${meta.id}/module/translations`,
16
- activatesOn: Events.SetupTranslations,
17
- activate: () => contributes(Capabilities.Translations, translations),
18
- }),
19
- defineModule({
20
- id: `${meta.id}/module/updater`,
21
- activatesOn: Events.DispatcherReady,
22
- activate: Updater,
23
- }),
24
- defineModule({
25
- id: `${meta.id}/module/window`,
26
- activatesOn: Events.DispatcherReady,
27
- activate: Window,
28
- }),
29
- defineModule({
30
- id: `${meta.id}/module/ollama`,
31
- activatesOn: AssistantEvents.SetupAiServiceProviders,
32
- activate: Ollama,
33
- }),
34
- ]);
13
+ export const NativePlugin = Plugin.define(meta).pipe(
14
+ AppPlugin.addTranslationsModule({ translations }),
15
+ Plugin.addModule({
16
+ id: 'spotlight-listener',
17
+ activatesOn: ActivationEvents.OperationInvokerReady,
18
+ activate: SpotlightListener,
19
+ }),
20
+ Plugin.addModule({
21
+ id: 'updater',
22
+ activatesOn: ActivationEvents.OperationInvokerReady,
23
+ activate: Updater,
24
+ }),
25
+ Plugin.addModule({
26
+ id: 'ollama',
27
+ activatesOn: AssistantEvents.SetupAiServiceProviders,
28
+ activate: Ollama,
29
+ }),
30
+ Plugin.make,
31
+ );
32
+
33
+ export default NativePlugin;
@@ -2,8 +2,8 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { lazy } from '@dxos/app-framework';
5
+ import { Capability } from '@dxos/app-framework';
6
6
 
7
- export const Ollama = lazy(() => import('./ollama'));
8
- export const Updater = lazy(() => import('./updater'));
9
- export const Window = lazy(() => import('./window'));
7
+ export const Ollama = Capability.lazy('Ollama', () => import('./ollama'));
8
+ export const SpotlightListener = Capability.lazy('SpotlightListener', () => import('./spotlight-listener'));
9
+ export const Updater = Capability.lazy('Updater', () => import('./updater'));
@@ -2,34 +2,41 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { FetchHttpClient, HttpClient } from '@effect/platform';
5
+ import * as FetchHttpClient from '@effect/platform/FetchHttpClient';
6
+ import * as HttpClient from '@effect/platform/HttpClient';
6
7
  import { Command } from '@tauri-apps/plugin-shell';
7
- import { Context, Effect, Layer, ManagedRuntime } from 'effect';
8
+ import * as Context from 'effect/Context';
9
+ import * as Effect from 'effect/Effect';
10
+ import * as Layer from 'effect/Layer';
11
+ import * as ManagedRuntime from 'effect/ManagedRuntime';
8
12
 
9
- import { AiServiceRouter } from '@dxos/ai';
10
- import { type Capability, type PluginContext, contributes } from '@dxos/app-framework';
13
+ import { type AiModelResolver } from '@dxos/ai';
14
+ import { OllamaResolver } from '@dxos/ai/resolvers';
15
+ import { Capability } from '@dxos/app-framework';
16
+ import { AppCapabilities } from '@dxos/app-toolkit';
11
17
  import { log } from '@dxos/log';
12
- import { AssistantCapabilities } from '@dxos/plugin-assistant';
13
18
 
14
- // Running ollama on non-standard port.
19
+ // NOTE: Running ollama on non-standard port (config Tauri).
15
20
  const OLLAMA_HOST = 'http://localhost:21434';
16
21
 
17
- export default (_context: PluginContext): Capability<any> => {
18
- const runtime = ManagedRuntime.make(OllamaSidecar.layerLive);
22
+ export type OllamaCapabilities = Capability.Capability<typeof AppCapabilities.AiModelResolver>;
19
23
 
20
- // Layer for the sidecar but the lifecycle is managed by the runtime.
21
- const sidecarLayer = Layer.effectContext(
22
- runtime.runtimeEffect.pipe(Effect.map((rt) => rt.context.pipe(Context.pick(OllamaSidecar)))),
23
- );
24
+ export default Capability.makeModule<[], OllamaCapabilities>(() =>
25
+ Effect.sync(() => {
26
+ const runtime = ManagedRuntime.make(OllamaSidecar.layerLive);
24
27
 
25
- return contributes(
26
- AssistantCapabilities.AiModelResolver,
27
- OllamaSidecarModelResolver.pipe(Layer.provide(sidecarLayer)),
28
- async () => {
29
- await runtime.dispose();
30
- },
31
- );
32
- };
28
+ // Layer for the sidecar but the lifecycle is managed by the runtime.
29
+ const sidecarLayer = Layer.effectContext(
30
+ runtime.runtimeEffect.pipe(Effect.map((rt) => rt.context.pipe(Context.pick(OllamaSidecar)))),
31
+ );
32
+
33
+ return Capability.contributes(
34
+ AppCapabilities.AiModelResolver,
35
+ OllamaSidecarModelResolver.pipe(Layer.provide(sidecarLayer)),
36
+ () => Effect.tryPromise(() => runtime.dispose()),
37
+ );
38
+ }),
39
+ );
33
40
 
34
41
  class OllamaSidecar extends Context.Tag('@dxos/plugin-native/OllamaSidecar')<
35
42
  OllamaSidecar,
@@ -48,7 +55,9 @@ class OllamaSidecar extends Context.Tag('@dxos/plugin-native/OllamaSidecar')<
48
55
  });
49
56
 
50
57
  // NOTE: Keeping those as console.log for consistent formatting.
58
+ // eslint-disable-next-line no-console
51
59
  command.stdout.on('data', (data) => console.log('[ollama]', data.toString()));
60
+ // eslint-disable-next-line no-console
52
61
  command.stderr.on('data', (data) => console.error('[ollama]', data.toString()));
53
62
  command.on('close', (code) => log.info('Ollama process exited', { code }));
54
63
  command.on('error', (error) => log.error('Ollama error', { error }));
@@ -67,12 +76,12 @@ class OllamaSidecar extends Context.Tag('@dxos/plugin-native/OllamaSidecar')<
67
76
  );
68
77
  }
69
78
 
70
- const OllamaSidecarModelResolver: Layer.Layer<AiServiceRouter.AiModelResolver, never, OllamaSidecar> =
79
+ const OllamaSidecarModelResolver: Layer.Layer<AiModelResolver.AiModelResolver, never, OllamaSidecar> =
71
80
  Layer.unwrapEffect(
72
81
  Effect.gen(function* () {
73
82
  const { endpoint } = yield* OllamaSidecar;
74
- return AiServiceRouter.OllamaResolver({
75
- host: endpoint,
83
+ return OllamaResolver.make({
84
+ endpoint,
76
85
  transformClient: HttpClient.withTracerPropagation(false),
77
86
  });
78
87
  }),
@@ -0,0 +1,58 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+
7
+ import { Capabilities, Capability } from '@dxos/app-framework';
8
+ import { LayoutOperation } from '@dxos/app-toolkit';
9
+ import { log } from '@dxos/log';
10
+
11
+ // TODO(wittjosiah): Formalize with a stricter schema if we evolve this protocol.
12
+ type SpotlightInvokePayload = {
13
+ operation: string;
14
+ payload?: Record<string, any>;
15
+ };
16
+
17
+ /**
18
+ * Listens for spotlight:invoke events from the popover window and dispatches the corresponding operation.
19
+ */
20
+ export default Capability.makeModule(
21
+ Effect.fnUntraced(function* () {
22
+ const { invokePromise } = yield* Capability.get(Capabilities.OperationInvoker);
23
+
24
+ const unlisten = yield* Effect.promise(async () => {
25
+ const { listen } = await import('@tauri-apps/api/event');
26
+ const { getCurrentWindow } = await import('@tauri-apps/api/window');
27
+
28
+ return listen<SpotlightInvokePayload>('spotlight:invoke', async (event) => {
29
+ const { operation, payload } = event.payload;
30
+ log.info('Received spotlight invoke event', { operation, payload });
31
+ try {
32
+ switch (operation) {
33
+ case 'open':
34
+ await invokePromise(LayoutOperation.Open, payload as any);
35
+ break;
36
+ case 'switch-workspace':
37
+ await invokePromise(LayoutOperation.SwitchWorkspace, payload as any);
38
+ break;
39
+ default:
40
+ log.warn('Unknown spotlight operation', { operation });
41
+ }
42
+
43
+ const mainWindow = getCurrentWindow();
44
+ await mainWindow.show();
45
+ await mainWindow.setFocus();
46
+ } catch (err) {
47
+ log.catch(err);
48
+ }
49
+ });
50
+ });
51
+
52
+ return Capability.contributes(Capabilities.Null, null, () =>
53
+ Effect.sync(() => {
54
+ unlisten();
55
+ }),
56
+ );
57
+ }),
58
+ );
@@ -4,77 +4,126 @@
4
4
 
5
5
  import { type } from '@tauri-apps/plugin-os';
6
6
  import { relaunch } from '@tauri-apps/plugin-process';
7
- import { type DownloadEvent, check } from '@tauri-apps/plugin-updater';
8
- import { Duration, Effect, Fiber, Match, Schedule, pipe } from 'effect';
7
+ import * as Updater from '@tauri-apps/plugin-updater';
8
+ import * as Duration from 'effect/Duration';
9
+ import * as Effect from 'effect/Effect';
10
+ import * as Fiber from 'effect/Fiber';
11
+ import * as Match from 'effect/Match';
12
+ import * as Schedule from 'effect/Schedule';
9
13
 
10
- import { Capabilities, LayoutAction, type PluginContext, contributes, createIntent } from '@dxos/app-framework';
14
+ import { Capabilities, Capability } from '@dxos/app-framework';
15
+ import { LayoutOperation } from '@dxos/app-toolkit';
11
16
  import { log } from '@dxos/log';
12
17
 
13
- import { NATIVE_PLUGIN } from '../meta';
18
+ import { meta } from '#meta';
19
+
20
+ import { TAURI_LOCALHOST_PORT } from '../constants';
14
21
 
15
22
  const SUPPORTS_OTA = ['linux', 'macos', 'windows'];
16
23
 
17
- export default (context: PluginContext) => {
18
- // Skip updates if not supported or in dev mode.
19
- const platform = type();
20
- if (!SUPPORTS_OTA.includes(platform) || window.location.hostname === 'localhost') {
21
- return contributes(Capabilities.Null, null);
24
+ /**
25
+ * Safely check for updates with error logging.
26
+ */
27
+ const check = async (): Promise<Updater.Update | null> => {
28
+ try {
29
+ return await Updater.check();
30
+ } catch (error) {
31
+ log.error('failed to check for updates', { error });
32
+ return null;
22
33
  }
34
+ };
23
35
 
24
- const { dispatch } = context.getCapability(Capabilities.IntentDispatcher);
36
+ /**
37
+ * Safely download and install update with error logging.
38
+ */
39
+ const downloadAndInstall = async (
40
+ update: Updater.Update,
41
+ handleDownload: (event: Updater.DownloadEvent) => void,
42
+ ): Promise<boolean> => {
43
+ try {
44
+ await update.downloadAndInstall(handleDownload);
45
+ return true;
46
+ } catch (error) {
47
+ log.error('failed to download and install update', { error });
48
+ return false;
49
+ }
50
+ };
25
51
 
26
- // https://tauri.app/plugin/updater/#checking-for-updates
27
- const action = Effect.gen(function* () {
28
- log.info('checking for updates');
29
- const update = yield* Effect.tryPromise(() => check());
30
- log.info('checked for updates', { version: update?.version, currentVersion: update?.currentVersion });
31
- if (update) {
32
- log.info('update available', update);
33
- let downloaded = 0;
34
- let contentLength = 0;
52
+ export default Capability.makeModule(
53
+ Effect.fnUntraced(function* () {
54
+ // Skip updates if not supported or in dev mode.
55
+ const platform = type();
56
+ const isDevServer = window.location.port !== TAURI_LOCALHOST_PORT;
57
+ if (!SUPPORTS_OTA.includes(platform) || isDevServer) {
58
+ log.info('skipping updater', { platform, port: window.location.port });
59
+ return;
60
+ }
35
61
 
36
- const handleDownload = Match.type<DownloadEvent>().pipe(
37
- Match.when({ event: 'Started' }, (event) => {
38
- contentLength = event.data.contentLength ?? 0;
39
- log.info('download started', { contentLength });
40
- }),
41
- Match.when({ event: 'Progress' }, (event) => {
42
- downloaded += event.data.chunkLength;
43
- log.verbose('download progress', { downloaded, contentLength });
44
- }),
45
- Match.when({ event: 'Finished' }, () => {
46
- log.info('download completed');
47
- }),
48
- Match.exhaustive,
49
- );
62
+ const { invoke } = yield* Capability.get(Capabilities.OperationInvoker);
50
63
 
51
- yield* Effect.tryPromise(() => update.downloadAndInstall(handleDownload));
64
+ // https://tauri.app/plugin/updater/#checking-for-updates
65
+ // Returns true to keep checking, false to stop.
66
+ const action = Effect.gen(function* () {
67
+ log.info('checking for updates');
68
+ const update = yield* Effect.promise(() => check());
69
+ if (!update) {
70
+ log.info('no update available');
71
+ return true;
72
+ }
73
+ log.info('update check complete', {
74
+ available: update.available,
75
+ currentVersion: update.currentVersion,
76
+ version: update.version,
77
+ date: update.date,
78
+ body: update.body,
79
+ });
80
+ if (update.available) {
81
+ log.info('update available, starting download', { version: update.version });
82
+ let downloaded = 0;
83
+ let contentLength = 0;
52
84
 
53
- yield* dispatch(
54
- createIntent(LayoutAction.AddToast, {
55
- part: 'toast',
56
- subject: {
57
- id: `${NATIVE_PLUGIN}/update-ready`,
58
- title: ['update ready label', { ns: NATIVE_PLUGIN }],
59
- description: ['update ready description', { ns: NATIVE_PLUGIN }],
85
+ const handleDownload = Match.type<Updater.DownloadEvent>().pipe(
86
+ Match.when({ event: 'Started' }, (event) => {
87
+ contentLength = event.data.contentLength ?? 0;
88
+ log.info('download started', { contentLength });
89
+ }),
90
+ Match.when({ event: 'Progress' }, (event) => {
91
+ downloaded += event.data.chunkLength;
92
+ log.verbose('download progress', { downloaded, contentLength });
93
+ }),
94
+ Match.when({ event: 'Finished' }, () => {
95
+ log.info('download completed');
96
+ }),
97
+ Match.exhaustive,
98
+ );
99
+
100
+ const downloadSuccess = yield* Effect.promise(() => downloadAndInstall(update, handleDownload));
101
+
102
+ if (downloadSuccess) {
103
+ yield* invoke(LayoutOperation.AddToast, {
104
+ id: `${meta.id}.update-ready`,
105
+ title: ['update-ready.label', { ns: meta.id }],
106
+ description: ['update-ready.description', { ns: meta.id }],
60
107
  duration: Infinity,
61
- actionLabel: ['update label', { ns: NATIVE_PLUGIN }],
62
- actionAlt: ['update alt', { ns: NATIVE_PLUGIN }],
108
+ actionLabel: ['update.label', { ns: meta.id }],
109
+ actionAlt: ['update.alt', { ns: meta.id }],
63
110
  onAction: () => relaunch(),
64
- },
65
- }),
66
- );
67
- }
68
- });
111
+ });
112
+ return false;
113
+ }
114
+ }
115
+ return true;
116
+ });
69
117
 
70
- const fiber = pipe(
71
- // prettier-ignore
72
- action,
73
- Effect.repeat(Schedule.fixed(Duration.hours(1))),
74
- Effect.runFork,
75
- );
118
+ // Run immediately on startup, then repeat every hour. Stop once an update is found.
119
+ const schedule = Schedule.fixed(Duration.hours(1)).pipe(
120
+ Schedule.whileInput((keepChecking: boolean) => keepChecking),
121
+ );
122
+ const fiber = yield* action.pipe(Effect.repeat(schedule), Effect.forkDaemon);
123
+ log.info('updater module initialized, update check scheduled');
76
124
 
77
- return contributes(Capabilities.Null, null, () => {
78
- Effect.runSync(Fiber.interrupt(fiber));
79
- });
80
- };
125
+ return Capability.contributes(Capabilities.Null, null, () =>
126
+ Effect.sync(() => Effect.runSync(Fiber.interrupt(fiber))),
127
+ );
128
+ }),
129
+ );
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ /// Stable port for the Tauri localhost asset server in production builds.
6
+ /// Must match LOCALHOST_PORT in src-tauri/src/lib.rs.
7
+ export const TAURI_LOCALHOST_PORT = '26777';
package/src/index.ts CHANGED
@@ -3,4 +3,3 @@
3
3
  //
4
4
 
5
5
  export * from './meta';
6
- export * from './NativePlugin';
package/src/meta.ts CHANGED
@@ -2,11 +2,15 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { type PluginMeta } from '@dxos/app-framework';
5
+ import { type Plugin } from '@dxos/app-framework';
6
+ import { trim } from '@dxos/util';
6
7
 
7
- export const NATIVE_PLUGIN = 'dxos.org/plugin/native';
8
-
9
- export const meta: PluginMeta = {
10
- id: NATIVE_PLUGIN,
8
+ export const meta: Plugin.Meta = {
9
+ id: 'org.dxos.plugin.native',
11
10
  name: 'Native',
11
+ description: trim`
12
+ Native platform integration providing desktop-specific features and system-level capabilities.
13
+ Access native file dialogs, notifications, and OS integrations.
14
+ `,
15
+ tags: ['system'],
12
16
  };
package/src/plugin.ts ADDED
@@ -0,0 +1,9 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { Plugin } from '@dxos/app-framework';
6
+
7
+ import { meta } from './meta';
8
+
9
+ export const NativePlugin = Plugin.lazy(meta, () => import('#plugin'));
@@ -4,16 +4,16 @@
4
4
 
5
5
  import { type Resource } from '@dxos/react-ui';
6
6
 
7
- import { meta } from './meta';
7
+ import { meta } from '#meta';
8
8
 
9
9
  export const translations = [
10
10
  {
11
11
  'en-US': {
12
12
  [meta.id]: {
13
- 'update ready label': 'Ready to update',
14
- 'update ready description': 'A new version of Composer is available.',
15
- 'update label': 'Update',
16
- 'update alt': 'Relaunch the app to update',
13
+ 'update-ready.label': 'Ready to update',
14
+ 'update-ready.description': 'A new version of Composer is available.',
15
+ 'update.label': 'Update',
16
+ 'update.alt': 'Relaunch the app to update',
17
17
  },
18
18
  },
19
19
  },
@@ -1,12 +0,0 @@
1
- // src/meta.ts
2
- var NATIVE_PLUGIN = "dxos.org/plugin/native";
3
- var meta = {
4
- id: NATIVE_PLUGIN,
5
- name: "Native"
6
- };
7
-
8
- export {
9
- NATIVE_PLUGIN,
10
- meta
11
- };
12
- //# sourceMappingURL=chunk-E2JDGVJI.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/meta.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const NATIVE_PLUGIN = 'dxos.org/plugin/native';\n\nexport const meta: PluginMeta = {\n id: NATIVE_PLUGIN,\n name: 'Native',\n};\n"],
5
- "mappings": ";AAMO,IAAMA,gBAAgB;AAEtB,IAAMC,OAAmB;EAC9BC,IAAIF;EACJG,MAAM;AACR;",
6
- "names": ["NATIVE_PLUGIN", "meta", "id", "name"]
7
- }