@dxos/plugin-native 0.8.4-main.ae835ea → 0.8.4-main.bcb3aa67d6

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 (40) hide show
  1. package/dist/lib/browser/index.mjs +35 -37
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/types/src/NativePlugin.d.ts +2 -1
  5. package/dist/types/src/NativePlugin.d.ts.map +1 -1
  6. package/dist/types/src/capabilities/index.d.ts +4 -3
  7. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  8. package/dist/types/src/capabilities/ollama.d.ts +5 -2
  9. package/dist/types/src/capabilities/ollama.d.ts.map +1 -1
  10. package/dist/types/src/capabilities/spotlight-listener.d.ts +8 -0
  11. package/dist/types/src/capabilities/spotlight-listener.d.ts.map +1 -0
  12. package/dist/types/src/capabilities/updater.d.ts +3 -2
  13. package/dist/types/src/capabilities/updater.d.ts.map +1 -1
  14. package/dist/types/src/constants.d.ts +2 -0
  15. package/dist/types/src/constants.d.ts.map +1 -0
  16. package/dist/types/src/meta.d.ts +2 -2
  17. package/dist/types/src/meta.d.ts.map +1 -1
  18. package/dist/types/src/translations.d.ts +5 -5
  19. package/dist/types/src/translations.d.ts.map +1 -1
  20. package/dist/types/tsconfig.tsbuildinfo +1 -1
  21. package/package.json +24 -14
  22. package/src/NativePlugin.tsx +18 -19
  23. package/src/capabilities/index.ts +4 -4
  24. package/src/capabilities/ollama.ts +26 -20
  25. package/src/capabilities/spotlight-listener.ts +58 -0
  26. package/src/capabilities/updater.ts +101 -58
  27. package/src/constants.ts +7 -0
  28. package/src/meta.ts +3 -3
  29. package/src/translations.ts +5 -5
  30. package/dist/lib/browser/chunk-SP3MEGKI.mjs +0 -15
  31. package/dist/lib/browser/chunk-SP3MEGKI.mjs.map +0 -7
  32. package/dist/lib/browser/ollama-CQE7ZIWL.mjs +0 -76
  33. package/dist/lib/browser/ollama-CQE7ZIWL.mjs.map +0 -7
  34. package/dist/lib/browser/updater-SDBPTCXA.mjs +0 -138
  35. package/dist/lib/browser/updater-SDBPTCXA.mjs.map +0 -7
  36. package/dist/lib/browser/window-6G542FZL.mjs +0 -34
  37. package/dist/lib/browser/window-6G542FZL.mjs.map +0 -7
  38. package/dist/types/src/capabilities/window.d.ts +0 -4
  39. package/dist/types/src/capabilities/window.d.ts.map +0 -1
  40. package/src/capabilities/window.ts +0 -49
package/package.json CHANGED
@@ -1,13 +1,21 @@
1
1
  {
2
2
  "name": "@dxos/plugin-native",
3
- "version": "0.8.4-main.ae835ea",
3
+ "version": "0.8.4-main.bcb3aa67d6",
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": "./src/capabilities/index.ts",
17
+ "#meta": "./src/meta.ts"
18
+ },
11
19
  "exports": {
12
20
  ".": {
13
21
  "source": "./src/index.ts",
@@ -24,28 +32,30 @@
24
32
  "src"
25
33
  ],
26
34
  "dependencies": {
27
- "@effect/platform": "^0.92.1",
35
+ "@effect/platform": "0.94.4",
28
36
  "@tauri-apps/api": "^2.8.0",
29
37
  "@tauri-apps/plugin-os": "^2.3.1",
30
38
  "@tauri-apps/plugin-process": "^2.3.0",
31
39
  "@tauri-apps/plugin-shell": "^2.3.1",
32
40
  "@tauri-apps/plugin-updater": "^2.9.0",
33
- "effect": "3.18.3",
34
- "@dxos/ai": "0.8.4-main.ae835ea",
35
- "@dxos/log": "0.8.4-main.ae835ea",
36
- "@dxos/app-framework": "0.8.4-main.ae835ea",
37
- "@dxos/plugin-assistant": "0.8.4-main.ae835ea",
38
- "@dxos/plugin-help": "0.8.4-main.ae835ea",
39
- "@dxos/util": "0.8.4-main.ae835ea",
40
- "@dxos/plugin-navtree": "0.8.4-main.ae835ea"
41
+ "effect": "3.20.0",
42
+ "@dxos/ai": "0.8.4-main.bcb3aa67d6",
43
+ "@dxos/log": "0.8.4-main.bcb3aa67d6",
44
+ "@dxos/app-toolkit": "0.8.4-main.bcb3aa67d6",
45
+ "@dxos/operation": "0.8.4-main.bcb3aa67d6",
46
+ "@dxos/app-framework": "0.8.4-main.bcb3aa67d6",
47
+ "@dxos/plugin-help": "0.8.4-main.bcb3aa67d6",
48
+ "@dxos/plugin-assistant": "0.8.4-main.bcb3aa67d6",
49
+ "@dxos/util": "0.8.4-main.bcb3aa67d6",
50
+ "@dxos/plugin-navtree": "0.8.4-main.bcb3aa67d6"
41
51
  },
42
52
  "devDependencies": {
43
- "vite": "7.1.9",
44
- "@dxos/react-ui": "0.8.4-main.ae835ea"
53
+ "vite": "^7.1.11",
54
+ "@dxos/react-ui": "0.8.4-main.bcb3aa67d6"
45
55
  },
46
56
  "peerDependencies": {
47
- "effect": "^3.13.3",
48
- "@dxos/react-ui": "0.8.4-main.ae835ea"
57
+ "effect": "3.20.0",
58
+ "@dxos/react-ui": "0.8.4-main.bcb3aa67d6"
49
59
  },
50
60
  "publishConfig": {
51
61
  "access": "public"
@@ -2,32 +2,31 @@
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';
9
+ import { meta } from '#meta';
10
10
  import { translations } from './translations';
11
11
 
12
- export const NativePlugin = definePlugin(meta, () => [
13
- defineModule({
14
- id: `${meta.id}/module/translations`,
15
- activatesOn: Events.SetupTranslations,
16
- activate: () => contributes(Capabilities.Translations, translations),
12
+ import { Ollama, SpotlightListener, Updater } from '#capabilities';
13
+
14
+ export const NativePlugin = Plugin.define(meta).pipe(
15
+ AppPlugin.addTranslationsModule({ translations }),
16
+ Plugin.addModule({
17
+ id: 'spotlight-listener',
18
+ activatesOn: ActivationEvents.OperationInvokerReady,
19
+ activate: SpotlightListener,
17
20
  }),
18
- defineModule({
19
- id: `${meta.id}/module/updater`,
20
- activatesOn: Events.DispatcherReady,
21
+ Plugin.addModule({
22
+ id: 'updater',
23
+ activatesOn: ActivationEvents.OperationInvokerReady,
21
24
  activate: Updater,
22
25
  }),
23
- defineModule({
24
- id: `${meta.id}/module/window`,
25
- activatesOn: Events.DispatcherReady,
26
- activate: Window,
27
- }),
28
- defineModule({
29
- id: `${meta.id}/module/ollama`,
26
+ Plugin.addModule({
27
+ id: 'ollama',
30
28
  activatesOn: AssistantEvents.SetupAiServiceProviders,
31
29
  activate: Ollama,
32
30
  }),
33
- ]);
31
+ Plugin.make,
32
+ );
@@ -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'));
@@ -10,29 +10,33 @@ import * as Effect from 'effect/Effect';
10
10
  import * as Layer from 'effect/Layer';
11
11
  import * as ManagedRuntime from 'effect/ManagedRuntime';
12
12
 
13
- import * as AiServiceRouter from '@dxos/ai/AiServiceRouter';
14
- import { Capabilities, 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';
15
17
  import { log } from '@dxos/log';
16
18
 
17
- // Running ollama on non-standard port.
19
+ // NOTE: Running ollama on non-standard port (config Tauri).
18
20
  const OLLAMA_HOST = 'http://localhost:21434';
19
21
 
20
- export default (_context: PluginContext): Capability<any> => {
21
- const runtime = ManagedRuntime.make(OllamaSidecar.layerLive);
22
+ export type OllamaCapabilities = Capability.Capability<typeof AppCapabilities.AiModelResolver>;
22
23
 
23
- // Layer for the sidecar but the lifecycle is managed by the runtime.
24
- const sidecarLayer = Layer.effectContext(
25
- runtime.runtimeEffect.pipe(Effect.map((rt) => rt.context.pipe(Context.pick(OllamaSidecar)))),
26
- );
24
+ export default Capability.makeModule<[], OllamaCapabilities>(() =>
25
+ Effect.sync(() => {
26
+ const runtime = ManagedRuntime.make(OllamaSidecar.layerLive);
27
27
 
28
- return contributes(
29
- Capabilities.AiModelResolver,
30
- OllamaSidecarModelResolver.pipe(Layer.provide(sidecarLayer)),
31
- async () => {
32
- await runtime.dispose();
33
- },
34
- );
35
- };
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
+ );
36
40
 
37
41
  class OllamaSidecar extends Context.Tag('@dxos/plugin-native/OllamaSidecar')<
38
42
  OllamaSidecar,
@@ -51,7 +55,9 @@ class OllamaSidecar extends Context.Tag('@dxos/plugin-native/OllamaSidecar')<
51
55
  });
52
56
 
53
57
  // NOTE: Keeping those as console.log for consistent formatting.
58
+ // eslint-disable-next-line no-console
54
59
  command.stdout.on('data', (data) => console.log('[ollama]', data.toString()));
60
+ // eslint-disable-next-line no-console
55
61
  command.stderr.on('data', (data) => console.error('[ollama]', data.toString()));
56
62
  command.on('close', (code) => log.info('Ollama process exited', { code }));
57
63
  command.on('error', (error) => log.error('Ollama error', { error }));
@@ -70,12 +76,12 @@ class OllamaSidecar extends Context.Tag('@dxos/plugin-native/OllamaSidecar')<
70
76
  );
71
77
  }
72
78
 
73
- const OllamaSidecarModelResolver: Layer.Layer<AiServiceRouter.AiModelResolver, never, OllamaSidecar> =
79
+ const OllamaSidecarModelResolver: Layer.Layer<AiModelResolver.AiModelResolver, never, OllamaSidecar> =
74
80
  Layer.unwrapEffect(
75
81
  Effect.gen(function* () {
76
82
  const { endpoint } = yield* OllamaSidecar;
77
- return AiServiceRouter.OllamaResolver({
78
- host: endpoint,
83
+ return OllamaResolver.make({
84
+ endpoint,
79
85
  transformClient: HttpClient.withTracerPropagation(false),
80
86
  });
81
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,82 +4,125 @@
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';
7
+ import * as Updater from '@tauri-apps/plugin-updater';
8
8
  import * as Duration from 'effect/Duration';
9
9
  import * as Effect from 'effect/Effect';
10
10
  import * as Fiber from 'effect/Fiber';
11
- import * as Function from 'effect/Function';
12
11
  import * as Match from 'effect/Match';
13
12
  import * as Schedule from 'effect/Schedule';
14
13
 
15
- 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';
16
16
  import { log } from '@dxos/log';
17
17
 
18
- import { meta } from '../meta';
18
+ import { TAURI_LOCALHOST_PORT } from '../constants';
19
+ import { meta } from '#meta';
19
20
 
20
21
  const SUPPORTS_OTA = ['linux', 'macos', 'windows'];
21
22
 
22
- export default (context: PluginContext) => {
23
- // Skip updates if not supported or in dev mode.
24
- const platform = type();
25
- if (!SUPPORTS_OTA.includes(platform) || window.location.hostname === 'localhost') {
26
- return contributes(Capabilities.Null, null);
23
+ /**
24
+ * Safely check for updates with error logging.
25
+ */
26
+ const check = async (): Promise<Updater.Update | null> => {
27
+ try {
28
+ return await Updater.check();
29
+ } catch (error) {
30
+ log.error('failed to check for updates', { error });
31
+ return null;
27
32
  }
33
+ };
34
+
35
+ /**
36
+ * Safely download and install update with error logging.
37
+ */
38
+ const downloadAndInstall = async (
39
+ update: Updater.Update,
40
+ handleDownload: (event: Updater.DownloadEvent) => void,
41
+ ): Promise<boolean> => {
42
+ try {
43
+ await update.downloadAndInstall(handleDownload);
44
+ return true;
45
+ } catch (error) {
46
+ log.error('failed to download and install update', { error });
47
+ return false;
48
+ }
49
+ };
28
50
 
29
- const { dispatch } = context.getCapability(Capabilities.IntentDispatcher);
51
+ export default Capability.makeModule(
52
+ Effect.fnUntraced(function* () {
53
+ // Skip updates if not supported or in dev mode.
54
+ const platform = type();
55
+ const isDevServer = window.location.port !== TAURI_LOCALHOST_PORT;
56
+ if (!SUPPORTS_OTA.includes(platform) || isDevServer) {
57
+ log.info('skipping updater', { platform, port: window.location.port });
58
+ return;
59
+ }
60
+
61
+ const { invoke } = yield* Capability.get(Capabilities.OperationInvoker);
30
62
 
31
- // https://tauri.app/plugin/updater/#checking-for-updates
32
- const action = Effect.gen(function* () {
33
- log.info('checking for updates');
34
- const update = yield* Effect.tryPromise(() => check());
35
- log.info('checked for updates', { version: update?.version, currentVersion: update?.currentVersion });
36
- if (update) {
37
- log.info('update available', update);
38
- let downloaded = 0;
39
- let contentLength = 0;
63
+ // https://tauri.app/plugin/updater/#checking-for-updates
64
+ // Returns true to keep checking, false to stop.
65
+ const action = Effect.gen(function* () {
66
+ log.info('checking for updates');
67
+ const update = yield* Effect.promise(() => check());
68
+ if (!update) {
69
+ log.info('no update available');
70
+ return true;
71
+ }
72
+ log.info('update check complete', {
73
+ available: update.available,
74
+ currentVersion: update.currentVersion,
75
+ version: update.version,
76
+ date: update.date,
77
+ body: update.body,
78
+ });
79
+ if (update.available) {
80
+ log.info('update available, starting download', { version: update.version });
81
+ let downloaded = 0;
82
+ let contentLength = 0;
40
83
 
41
- const handleDownload = Match.type<DownloadEvent>().pipe(
42
- Match.when({ event: 'Started' }, (event) => {
43
- contentLength = event.data.contentLength ?? 0;
44
- log.info('download started', { contentLength });
45
- }),
46
- Match.when({ event: 'Progress' }, (event) => {
47
- downloaded += event.data.chunkLength;
48
- log.verbose('download progress', { downloaded, contentLength });
49
- }),
50
- Match.when({ event: 'Finished' }, () => {
51
- log.info('download completed');
52
- }),
53
- Match.exhaustive,
54
- );
84
+ const handleDownload = Match.type<Updater.DownloadEvent>().pipe(
85
+ Match.when({ event: 'Started' }, (event) => {
86
+ contentLength = event.data.contentLength ?? 0;
87
+ log.info('download started', { contentLength });
88
+ }),
89
+ Match.when({ event: 'Progress' }, (event) => {
90
+ downloaded += event.data.chunkLength;
91
+ log.verbose('download progress', { downloaded, contentLength });
92
+ }),
93
+ Match.when({ event: 'Finished' }, () => {
94
+ log.info('download completed');
95
+ }),
96
+ Match.exhaustive,
97
+ );
55
98
 
56
- yield* Effect.tryPromise(() => update.downloadAndInstall(handleDownload));
99
+ const downloadSuccess = yield* Effect.promise(() => downloadAndInstall(update, handleDownload));
57
100
 
58
- yield* dispatch(
59
- createIntent(LayoutAction.AddToast, {
60
- part: 'toast',
61
- subject: {
62
- id: `${meta.id}/update-ready`,
63
- title: ['update ready label', { ns: meta.id }],
64
- description: ['update ready description', { ns: meta.id }],
101
+ if (downloadSuccess) {
102
+ yield* invoke(LayoutOperation.AddToast, {
103
+ id: `${meta.id}.update-ready`,
104
+ title: ['update-ready.label', { ns: meta.id }],
105
+ description: ['update-ready.description', { ns: meta.id }],
65
106
  duration: Infinity,
66
- actionLabel: ['update label', { ns: meta.id }],
67
- actionAlt: ['update alt', { ns: meta.id }],
107
+ actionLabel: ['update.label', { ns: meta.id }],
108
+ actionAlt: ['update.alt', { ns: meta.id }],
68
109
  onAction: () => relaunch(),
69
- },
70
- }),
71
- );
72
- }
73
- });
110
+ });
111
+ return false;
112
+ }
113
+ }
114
+ return true;
115
+ });
74
116
 
75
- const fiber = Function.pipe(
76
- // prettier-ignore
77
- action,
78
- Effect.repeat(Schedule.fixed(Duration.hours(1))),
79
- Effect.runFork,
80
- );
117
+ // Run immediately on startup, then repeat every hour. Stop once an update is found.
118
+ const schedule = Schedule.fixed(Duration.hours(1)).pipe(
119
+ Schedule.whileInput((keepChecking: boolean) => keepChecking),
120
+ );
121
+ const fiber = yield* action.pipe(Effect.repeat(schedule), Effect.forkDaemon);
122
+ log.info('updater module initialized, update check scheduled');
81
123
 
82
- return contributes(Capabilities.Null, null, () => {
83
- Effect.runSync(Fiber.interrupt(fiber));
84
- });
85
- };
124
+ return Capability.contributes(Capabilities.Null, null, () =>
125
+ Effect.sync(() => Effect.runSync(Fiber.interrupt(fiber))),
126
+ );
127
+ }),
128
+ );
@@ -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/meta.ts CHANGED
@@ -2,11 +2,11 @@
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
6
  import { trim } from '@dxos/util';
7
7
 
8
- export const meta: PluginMeta = {
9
- id: 'dxos.org/plugin/native',
8
+ export const meta: Plugin.Meta = {
9
+ id: 'org.dxos.plugin.native',
10
10
  name: 'Native',
11
11
  description: trim`
12
12
  Native platform integration providing desktop-specific features and system-level capabilities.
@@ -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,15 +0,0 @@
1
- // src/meta.ts
2
- import { trim } from "@dxos/util";
3
- var meta = {
4
- id: "dxos.org/plugin/native",
5
- name: "Native",
6
- description: trim`
7
- Native platform integration providing desktop-specific features and system-level capabilities.
8
- Access native file dialogs, notifications, and OS integrations.
9
- `
10
- };
11
-
12
- export {
13
- meta
14
- };
15
- //# sourceMappingURL=chunk-SP3MEGKI.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';\nimport { trim } from '@dxos/util';\n\nexport const meta: PluginMeta = {\n id: 'dxos.org/plugin/native',\n name: 'Native',\n description: trim`\n Native platform integration providing desktop-specific features and system-level capabilities.\n Access native file dialogs, notifications, and OS integrations.\n `,\n};\n"],
5
- "mappings": ";AAKA,SAASA,YAAY;AAEd,IAAMC,OAAmB;EAC9BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;AAIf;",
6
- "names": ["trim", "meta", "id", "name", "description", "trim"]
7
- }
@@ -1,76 +0,0 @@
1
- // src/capabilities/ollama.ts
2
- import * as FetchHttpClient from "@effect/platform/FetchHttpClient";
3
- import * as HttpClient from "@effect/platform/HttpClient";
4
- import { Command } from "@tauri-apps/plugin-shell";
5
- import * as Context from "effect/Context";
6
- import * as Effect from "effect/Effect";
7
- import * as Layer from "effect/Layer";
8
- import * as ManagedRuntime from "effect/ManagedRuntime";
9
- import * as AiServiceRouter from "@dxos/ai/AiServiceRouter";
10
- import { Capabilities, contributes } from "@dxos/app-framework";
11
- import { log } from "@dxos/log";
12
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-native/src/capabilities/ollama.ts";
13
- var OLLAMA_HOST = "http://localhost:21434";
14
- var ollama_default = ((_context) => {
15
- const runtime = ManagedRuntime.make(OllamaSidecar.layerLive);
16
- const sidecarLayer = Layer.effectContext(runtime.runtimeEffect.pipe(Effect.map((rt) => rt.context.pipe(Context.pick(OllamaSidecar)))));
17
- return contributes(Capabilities.AiModelResolver, OllamaSidecarModelResolver.pipe(Layer.provide(sidecarLayer)), async () => {
18
- await runtime.dispose();
19
- });
20
- });
21
- var OllamaSidecar = class _OllamaSidecar extends Context.Tag("@dxos/plugin-native/OllamaSidecar")() {
22
- static layerLive = Layer.scoped(_OllamaSidecar, Effect.gen(function* () {
23
- const command = Command.sidecar("sidecar/ollama", [
24
- "serve"
25
- ], {
26
- env: {
27
- OLLAMA_HOST,
28
- OLLAMA_ORIGINS: "*"
29
- }
30
- });
31
- command.stdout.on("data", (data) => console.log("[ollama]", data.toString()));
32
- command.stderr.on("data", (data) => console.error("[ollama]", data.toString()));
33
- command.on("close", (code) => log.info("Ollama process exited", {
34
- code
35
- }, {
36
- F: __dxlog_file,
37
- L: 56,
38
- S: this,
39
- C: (f, a) => f(...a)
40
- }));
41
- command.on("error", (error) => log.error("Ollama error", {
42
- error
43
- }, {
44
- F: __dxlog_file,
45
- L: 57,
46
- S: this,
47
- C: (f, a) => f(...a)
48
- }));
49
- const child = yield* Effect.promise(() => command.spawn());
50
- yield* Effect.addFinalizer(Effect.fn(function* () {
51
- yield* Effect.promise(() => child.kill());
52
- }));
53
- log.info("Running ollama", {
54
- pid: child.pid
55
- }, {
56
- F: __dxlog_file,
57
- L: 64,
58
- S: this,
59
- C: (f, a) => f(...a)
60
- });
61
- return {
62
- endpoint: OLLAMA_HOST
63
- };
64
- }));
65
- };
66
- var OllamaSidecarModelResolver = Layer.unwrapEffect(Effect.gen(function* () {
67
- const { endpoint } = yield* OllamaSidecar;
68
- return AiServiceRouter.OllamaResolver({
69
- host: endpoint,
70
- transformClient: HttpClient.withTracerPropagation(false)
71
- });
72
- })).pipe(Layer.provide(FetchHttpClient.layer));
73
- export {
74
- ollama_default as default
75
- };
76
- //# sourceMappingURL=ollama-CQE7ZIWL.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/ollama.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as FetchHttpClient from '@effect/platform/FetchHttpClient';\nimport * as HttpClient from '@effect/platform/HttpClient';\nimport { Command } from '@tauri-apps/plugin-shell';\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\nimport * as ManagedRuntime from 'effect/ManagedRuntime';\n\nimport * as AiServiceRouter from '@dxos/ai/AiServiceRouter';\nimport { Capabilities, type Capability, type PluginContext, contributes } from '@dxos/app-framework';\nimport { log } from '@dxos/log';\n\n// Running ollama on non-standard port.\nconst OLLAMA_HOST = 'http://localhost:21434';\n\nexport default (_context: PluginContext): Capability<any> => {\n const runtime = ManagedRuntime.make(OllamaSidecar.layerLive);\n\n // Layer for the sidecar but the lifecycle is managed by the runtime.\n const sidecarLayer = Layer.effectContext(\n runtime.runtimeEffect.pipe(Effect.map((rt) => rt.context.pipe(Context.pick(OllamaSidecar)))),\n );\n\n return contributes(\n Capabilities.AiModelResolver,\n OllamaSidecarModelResolver.pipe(Layer.provide(sidecarLayer)),\n async () => {\n await runtime.dispose();\n },\n );\n};\n\nclass OllamaSidecar extends Context.Tag('@dxos/plugin-native/OllamaSidecar')<\n OllamaSidecar,\n {\n endpoint: string;\n }\n>() {\n static layerLive = Layer.scoped(\n OllamaSidecar,\n Effect.gen(function* () {\n const command = Command.sidecar('sidecar/ollama', ['serve'], {\n env: {\n OLLAMA_HOST,\n OLLAMA_ORIGINS: '*', // CORS\n },\n });\n\n // NOTE: Keeping those as console.log for consistent formatting.\n command.stdout.on('data', (data) => console.log('[ollama]', data.toString()));\n command.stderr.on('data', (data) => console.error('[ollama]', data.toString()));\n command.on('close', (code) => log.info('Ollama process exited', { code }));\n command.on('error', (error) => log.error('Ollama error', { error }));\n const child = yield* Effect.promise(() => command.spawn());\n yield* Effect.addFinalizer(\n Effect.fn(function* () {\n yield* Effect.promise(() => child.kill());\n }),\n );\n log.info('Running ollama', { pid: child.pid });\n\n return {\n endpoint: OLLAMA_HOST,\n };\n }),\n );\n}\n\nconst OllamaSidecarModelResolver: Layer.Layer<AiServiceRouter.AiModelResolver, never, OllamaSidecar> =\n Layer.unwrapEffect(\n Effect.gen(function* () {\n const { endpoint } = yield* OllamaSidecar;\n return AiServiceRouter.OllamaResolver({\n host: endpoint,\n transformClient: HttpClient.withTracerPropagation(false),\n });\n }),\n ).pipe(Layer.provide(FetchHttpClient.layer));\n"],
5
- "mappings": ";AAIA,YAAYA,qBAAqB;AACjC,YAAYC,gBAAgB;AAC5B,SAASC,eAAe;AACxB,YAAYC,aAAa;AACzB,YAAYC,YAAY;AACxB,YAAYC,WAAW;AACvB,YAAYC,oBAAoB;AAEhC,YAAYC,qBAAqB;AACjC,SAASC,cAAmDC,mBAAmB;AAC/E,SAASC,WAAW;;AAGpB,IAAMC,cAAc;AAEpB,IAAA,kBAAe,CAACC,aAAAA;AACd,QAAMC,UAAyBC,oBAAKC,cAAcC,SAAS;AAG3D,QAAMC,eAAqBC,oBACzBL,QAAQM,cAAcC,KAAYC,WAAI,CAACC,OAAOA,GAAGC,QAAQH,KAAaI,aAAKT,aAAAA,CAAAA,CAAAA,CAAAA,CAAAA;AAG7E,SAAON,YACLD,aAAaiB,iBACbC,2BAA2BN,KAAWO,cAAQV,YAAAA,CAAAA,GAC9C,YAAA;AACE,UAAMJ,QAAQe,QAAO;EACvB,CAAA;AAEJ;AAEA,IAAMb,gBAAN,MAAMA,uBAA8Bc,YAAI,mCAAA,EAAA,EAAA;EAMtC,OAAOb,YAAkBc,aACvBf,gBACOgB,WAAI,aAAA;AACT,UAAMC,UAAU9B,QAAQ+B,QAAQ,kBAAkB;MAAC;OAAU;MAC3DC,KAAK;QACHvB;QACAwB,gBAAgB;MAClB;IACF,CAAA;AAGAH,YAAQI,OAAOC,GAAG,QAAQ,CAACC,SAASC,QAAQ7B,IAAI,YAAY4B,KAAKE,SAAQ,CAAA,CAAA;AACzER,YAAQS,OAAOJ,GAAG,QAAQ,CAACC,SAASC,QAAQG,MAAM,YAAYJ,KAAKE,SAAQ,CAAA,CAAA;AAC3ER,YAAQK,GAAG,SAAS,CAACM,SAASjC,IAAIkC,KAAK,yBAAyB;MAAED;IAAK,GAAA;;;;;;AACvEX,YAAQK,GAAG,SAAS,CAACK,UAAUhC,IAAIgC,MAAM,gBAAgB;MAAEA;IAAM,GAAA;;;;;;AACjE,UAAMG,QAAQ,OAAcC,eAAQ,MAAMd,QAAQe,MAAK,CAAA;AACvD,WAAcC,oBACLC,UAAG,aAAA;AACR,aAAcH,eAAQ,MAAMD,MAAMK,KAAI,CAAA;IACxC,CAAA,CAAA;AAEFxC,QAAIkC,KAAK,kBAAkB;MAAEO,KAAKN,MAAMM;IAAI,GAAA;;;;;;AAE5C,WAAO;MACLC,UAAUzC;IACZ;EACF,CAAA,CAAA;AAEJ;AAEA,IAAMe,6BACE2B,mBACGtB,WAAI,aAAA;AACT,QAAM,EAAEqB,SAAQ,IAAK,OAAOrC;AAC5B,SAAuBuC,+BAAe;IACpCC,MAAMH;IACNI,iBAA4BC,iCAAsB,KAAA;EACpD,CAAA;AACF,CAAA,CAAA,EACArC,KAAWO,cAAwB+B,qBAAK,CAAA;",
6
- "names": ["FetchHttpClient", "HttpClient", "Command", "Context", "Effect", "Layer", "ManagedRuntime", "AiServiceRouter", "Capabilities", "contributes", "log", "OLLAMA_HOST", "_context", "runtime", "make", "OllamaSidecar", "layerLive", "sidecarLayer", "effectContext", "runtimeEffect", "pipe", "map", "rt", "context", "pick", "AiModelResolver", "OllamaSidecarModelResolver", "provide", "dispose", "Tag", "scoped", "gen", "command", "sidecar", "env", "OLLAMA_ORIGINS", "stdout", "on", "data", "console", "toString", "stderr", "error", "code", "info", "child", "promise", "spawn", "addFinalizer", "fn", "kill", "pid", "endpoint", "unwrapEffect", "OllamaResolver", "host", "transformClient", "withTracerPropagation", "layer"]
7
- }