@dxos/plugin-native 0.8.4-main.4a85c3132b → 0.8.4-main.51f1e5ca51

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 (52) hide show
  1. package/dist/lib/browser/index.mjs +19 -40
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/browser/translations.mjs +18 -0
  5. package/dist/lib/browser/translations.mjs.map +7 -0
  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.map +1 -0
  9. package/dist/types/src/capabilities/spotlight-listener.d.ts +8 -0
  10. package/dist/types/src/capabilities/spotlight-listener.d.ts.map +1 -0
  11. package/dist/types/src/capabilities/updater.d.ts.map +1 -0
  12. package/dist/types/src/constants.d.ts +2 -0
  13. package/dist/types/src/constants.d.ts.map +1 -0
  14. package/dist/types/src/index.d.ts +0 -1
  15. package/dist/types/src/index.d.ts.map +1 -1
  16. package/dist/types/src/translations.d.ts +5 -6
  17. package/dist/types/src/translations.d.ts.map +1 -1
  18. package/dist/types/tsconfig.tsbuildinfo +1 -1
  19. package/package.json +26 -18
  20. package/src/NativePlugin.tsx +8 -8
  21. package/src/capabilities/index.ts +5 -3
  22. package/src/capabilities/spotlight-listener.ts +58 -0
  23. package/src/capabilities/{updater/updater.ts → updater.ts} +20 -11
  24. package/src/constants.ts +7 -0
  25. package/src/index.ts +0 -1
  26. package/src/meta.ts +1 -1
  27. package/src/translations.ts +5 -5
  28. package/dist/lib/browser/chunk-6374DBU4.mjs +0 -15
  29. package/dist/lib/browser/chunk-6374DBU4.mjs.map +0 -7
  30. package/dist/lib/browser/ollama-QOB3EVAJ.mjs +0 -75
  31. package/dist/lib/browser/ollama-QOB3EVAJ.mjs.map +0 -7
  32. package/dist/lib/browser/updater-AR27PYM4.mjs +0 -190
  33. package/dist/lib/browser/updater-AR27PYM4.mjs.map +0 -7
  34. package/dist/lib/browser/window-GKYYTCEI.mjs +0 -38
  35. package/dist/lib/browser/window-GKYYTCEI.mjs.map +0 -7
  36. package/dist/types/src/capabilities/ollama/index.d.ts +0 -3
  37. package/dist/types/src/capabilities/ollama/index.d.ts.map +0 -1
  38. package/dist/types/src/capabilities/ollama/ollama.d.ts.map +0 -1
  39. package/dist/types/src/capabilities/updater/index.d.ts +0 -3
  40. package/dist/types/src/capabilities/updater/index.d.ts.map +0 -1
  41. package/dist/types/src/capabilities/updater/updater.d.ts.map +0 -1
  42. package/dist/types/src/capabilities/window/index.d.ts +0 -3
  43. package/dist/types/src/capabilities/window/index.d.ts.map +0 -1
  44. package/dist/types/src/capabilities/window/window.d.ts +0 -11
  45. package/dist/types/src/capabilities/window/window.d.ts.map +0 -1
  46. package/src/capabilities/ollama/index.ts +0 -7
  47. package/src/capabilities/updater/index.ts +0 -7
  48. package/src/capabilities/window/index.ts +0 -7
  49. package/src/capabilities/window/window.ts +0 -72
  50. /package/dist/types/src/capabilities/{ollama/ollama.d.ts → ollama.d.ts} +0 -0
  51. /package/dist/types/src/capabilities/{updater/updater.d.ts → updater.d.ts} +0 -0
  52. /package/src/capabilities/{ollama/ollama.ts → ollama.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-native",
3
- "version": "0.8.4-main.4a85c3132b",
3
+ "version": "0.8.4-main.51f1e5ca51",
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",
@@ -12,17 +12,25 @@
12
12
  "author": "DXOS.org",
13
13
  "sideEffects": true,
14
14
  "type": "module",
15
+ "imports": {
16
+ "#capabilities": "./src/capabilities/index.ts",
17
+ "#meta": "./src/meta.ts",
18
+ "#translations": "./src/translations.ts"
19
+ },
15
20
  "exports": {
16
21
  ".": {
17
22
  "source": "./src/index.ts",
18
23
  "types": "./dist/types/src/index.d.ts",
19
24
  "browser": "./dist/lib/browser/index.mjs"
25
+ },
26
+ "./translations": {
27
+ "source": "./src/translations.ts",
28
+ "types": "./dist/types/src/translations.d.ts",
29
+ "browser": "./dist/lib/browser/translations.mjs",
30
+ "node": "./dist/lib/node-esm/translations.mjs"
20
31
  }
21
32
  },
22
33
  "types": "dist/types/src/index.d.ts",
23
- "typesVersions": {
24
- "*": {}
25
- },
26
34
  "files": [
27
35
  "dist",
28
36
  "src"
@@ -34,24 +42,24 @@
34
42
  "@tauri-apps/plugin-process": "^2.3.0",
35
43
  "@tauri-apps/plugin-shell": "^2.3.1",
36
44
  "@tauri-apps/plugin-updater": "^2.9.0",
37
- "effect": "3.19.16",
38
- "@dxos/ai": "0.8.4-main.4a85c3132b",
39
- "@dxos/app-framework": "0.8.4-main.4a85c3132b",
40
- "@dxos/app-toolkit": "0.8.4-main.4a85c3132b",
41
- "@dxos/operation": "0.8.4-main.4a85c3132b",
42
- "@dxos/plugin-assistant": "0.8.4-main.4a85c3132b",
43
- "@dxos/log": "0.8.4-main.4a85c3132b",
44
- "@dxos/plugin-help": "0.8.4-main.4a85c3132b",
45
- "@dxos/util": "0.8.4-main.4a85c3132b",
46
- "@dxos/plugin-navtree": "0.8.4-main.4a85c3132b"
45
+ "effect": "3.20.0",
46
+ "@dxos/ai": "0.8.4-main.51f1e5ca51",
47
+ "@dxos/app-framework": "0.8.4-main.51f1e5ca51",
48
+ "@dxos/operation": "0.8.4-main.51f1e5ca51",
49
+ "@dxos/log": "0.8.4-main.51f1e5ca51",
50
+ "@dxos/plugin-assistant": "0.8.4-main.51f1e5ca51",
51
+ "@dxos/plugin-navtree": "0.8.4-main.51f1e5ca51",
52
+ "@dxos/app-toolkit": "0.8.4-main.51f1e5ca51",
53
+ "@dxos/plugin-help": "0.8.4-main.51f1e5ca51",
54
+ "@dxos/util": "0.8.4-main.51f1e5ca51"
47
55
  },
48
56
  "devDependencies": {
49
- "vite": "^7.1.11",
50
- "@dxos/react-ui": "0.8.4-main.4a85c3132b"
57
+ "vite": "^8.0.10",
58
+ "@dxos/react-ui": "0.8.4-main.51f1e5ca51"
51
59
  },
52
60
  "peerDependencies": {
53
- "effect": "3.19.16",
54
- "@dxos/react-ui": "0.8.4-main.4a85c3132b"
61
+ "effect": "3.20.0",
62
+ "@dxos/react-ui": "0.8.4-main.51f1e5ca51"
55
63
  },
56
64
  "publishConfig": {
57
65
  "access": "public"
@@ -4,23 +4,23 @@
4
4
 
5
5
  import { ActivationEvents, Plugin } from '@dxos/app-framework';
6
6
  import { AppPlugin } from '@dxos/app-toolkit';
7
- import { AssistantEvents } from '@dxos/plugin-assistant';
7
+ import { AssistantEvents } from '@dxos/plugin-assistant/types';
8
8
 
9
- import { Ollama, Updater, Window } from './capabilities';
10
- import { meta } from './meta';
11
- import { translations } from './translations';
9
+ import { Ollama, SpotlightListener, Updater } from '#capabilities';
10
+ import { meta } from '#meta';
11
+ import { translations } from '#translations';
12
12
 
13
13
  export const NativePlugin = Plugin.define(meta).pipe(
14
14
  AppPlugin.addTranslationsModule({ translations }),
15
15
  Plugin.addModule({
16
- id: 'updater',
16
+ id: 'spotlight-listener',
17
17
  activatesOn: ActivationEvents.OperationInvokerReady,
18
- activate: Updater,
18
+ activate: SpotlightListener,
19
19
  }),
20
20
  Plugin.addModule({
21
- id: 'window',
21
+ id: 'updater',
22
22
  activatesOn: ActivationEvents.OperationInvokerReady,
23
- activate: Window,
23
+ activate: Updater,
24
24
  }),
25
25
  Plugin.addModule({
26
26
  id: 'ollama',
@@ -2,6 +2,8 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- export * from './ollama';
6
- export * from './updater';
7
- export * from './window';
5
+ import { Capability } from '@dxos/app-framework';
6
+
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'));
@@ -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
+ );
@@ -15,7 +15,9 @@ import { Capabilities, Capability } from '@dxos/app-framework';
15
15
  import { LayoutOperation } from '@dxos/app-toolkit';
16
16
  import { log } from '@dxos/log';
17
17
 
18
- import { meta } from '../../meta';
18
+ import { meta } from '#meta';
19
+
20
+ import { TAURI_LOCALHOST_PORT } from '../constants';
19
21
 
20
22
  const SUPPORTS_OTA = ['linux', 'macos', 'windows'];
21
23
 
@@ -51,20 +53,22 @@ export default Capability.makeModule(
51
53
  Effect.fnUntraced(function* () {
52
54
  // Skip updates if not supported or in dev mode.
53
55
  const platform = type();
54
- if (!SUPPORTS_OTA.includes(platform) || window.location.hostname === 'localhost') {
55
- log.info('skipping updater', { platform, hostname: window.location.hostname });
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 });
56
59
  return;
57
60
  }
58
61
 
59
62
  const { invoke } = yield* Capability.get(Capabilities.OperationInvoker);
60
63
 
61
64
  // https://tauri.app/plugin/updater/#checking-for-updates
65
+ // Returns true to keep checking, false to stop.
62
66
  const action = Effect.gen(function* () {
63
67
  log.info('checking for updates');
64
68
  const update = yield* Effect.promise(() => check());
65
69
  if (!update) {
66
70
  log.info('no update available');
67
- return;
71
+ return true;
68
72
  }
69
73
  log.info('update check complete', {
70
74
  available: update.available,
@@ -97,20 +101,25 @@ export default Capability.makeModule(
97
101
 
98
102
  if (downloadSuccess) {
99
103
  yield* invoke(LayoutOperation.AddToast, {
100
- id: `${meta.id}/update-ready`,
101
- title: ['update ready label', { ns: meta.id }],
102
- description: ['update ready description', { ns: meta.id }],
104
+ id: `${meta.id}.update-ready`,
105
+ title: ['update-ready.label', { ns: meta.id }],
106
+ description: ['update-ready.description', { ns: meta.id }],
103
107
  duration: Infinity,
104
- actionLabel: ['update label', { ns: meta.id }],
105
- actionAlt: ['update alt', { ns: meta.id }],
108
+ actionLabel: ['update.label', { ns: meta.id }],
109
+ actionAlt: ['update.alt', { ns: meta.id }],
106
110
  onAction: () => relaunch(),
107
111
  });
112
+ return false;
108
113
  }
109
114
  }
115
+ return true;
110
116
  });
111
117
 
112
- // Run immediately on startup, then repeat every hour.
113
- const fiber = yield* action.pipe(Effect.repeat(Schedule.fixed(Duration.hours(1))), Effect.forkDaemon);
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);
114
123
  log.info('updater module initialized, update check scheduled');
115
124
 
116
125
  return Capability.contributes(Capabilities.Null, null, () =>
@@ -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
@@ -2,6 +2,5 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- export * from './capabilities';
6
5
  export * from './meta';
7
6
  export * from './NativePlugin';
package/src/meta.ts CHANGED
@@ -6,7 +6,7 @@ import { type Plugin } from '@dxos/app-framework';
6
6
  import { trim } from '@dxos/util';
7
7
 
8
8
  export const meta: Plugin.Meta = {
9
- id: 'dxos.org/plugin/native',
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-6374DBU4.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 Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\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,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;AAIf;",
6
- "names": ["trim", "meta", "id", "name", "description", "trim"]
7
- }
@@ -1,75 +0,0 @@
1
- // src/capabilities/ollama/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 { OllamaResolver } from "@dxos/ai/resolvers";
10
- import { Capability } from "@dxos/app-framework";
11
- import { AppCapabilities } from "@dxos/app-toolkit";
12
- import { log } from "@dxos/log";
13
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-native/src/capabilities/ollama/ollama.ts";
14
- var OLLAMA_HOST = "http://localhost:21434";
15
- var ollama_default = Capability.makeModule(() => Effect.sync(() => {
16
- const runtime = ManagedRuntime.make(OllamaSidecar.layerLive);
17
- const sidecarLayer = Layer.effectContext(runtime.runtimeEffect.pipe(Effect.map((rt) => rt.context.pipe(Context.pick(OllamaSidecar)))));
18
- return Capability.contributes(AppCapabilities.AiModelResolver, OllamaSidecarModelResolver.pipe(Layer.provide(sidecarLayer)), () => Effect.tryPromise(() => runtime.dispose()));
19
- }));
20
- var OllamaSidecar = class _OllamaSidecar extends Context.Tag("@dxos/plugin-native/OllamaSidecar")() {
21
- static layerLive = Layer.scoped(_OllamaSidecar, Effect.gen(function* () {
22
- const command = Command.sidecar("sidecar/ollama", [
23
- "serve"
24
- ], {
25
- env: {
26
- OLLAMA_HOST,
27
- OLLAMA_ORIGINS: "*"
28
- }
29
- });
30
- command.stdout.on("data", (data) => console.log("[ollama]", data.toString()));
31
- command.stderr.on("data", (data) => console.error("[ollama]", data.toString()));
32
- command.on("close", (code) => log.info("Ollama process exited", {
33
- code
34
- }, {
35
- F: __dxlog_file,
36
- L: 62,
37
- S: this,
38
- C: (f, a) => f(...a)
39
- }));
40
- command.on("error", (error) => log.error("Ollama error", {
41
- error
42
- }, {
43
- F: __dxlog_file,
44
- L: 63,
45
- S: this,
46
- C: (f, a) => f(...a)
47
- }));
48
- const child = yield* Effect.promise(() => command.spawn());
49
- yield* Effect.addFinalizer(Effect.fn(function* () {
50
- yield* Effect.promise(() => child.kill());
51
- }));
52
- log.info("Running ollama", {
53
- pid: child.pid
54
- }, {
55
- F: __dxlog_file,
56
- L: 70,
57
- S: this,
58
- C: (f, a) => f(...a)
59
- });
60
- return {
61
- endpoint: OLLAMA_HOST
62
- };
63
- }));
64
- };
65
- var OllamaSidecarModelResolver = Layer.unwrapEffect(Effect.gen(function* () {
66
- const { endpoint } = yield* OllamaSidecar;
67
- return OllamaResolver.make({
68
- endpoint,
69
- transformClient: HttpClient.withTracerPropagation(false)
70
- });
71
- })).pipe(Layer.provide(FetchHttpClient.layer));
72
- export {
73
- ollama_default as default
74
- };
75
- //# sourceMappingURL=ollama-QOB3EVAJ.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/ollama/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 { type AiModelResolver } from '@dxos/ai';\nimport { OllamaResolver } from '@dxos/ai/resolvers';\nimport { Capability } from '@dxos/app-framework';\nimport { AppCapabilities } from '@dxos/app-toolkit';\nimport { log } from '@dxos/log';\n\n// NOTE: Running ollama on non-standard port (config Tauri).\nconst OLLAMA_HOST = 'http://localhost:21434';\n\nexport type OllamaCapabilities = Capability.Capability<typeof AppCapabilities.AiModelResolver>;\n\nexport default Capability.makeModule<[], OllamaCapabilities>(() =>\n Effect.sync(() => {\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 Capability.contributes(\n AppCapabilities.AiModelResolver,\n OllamaSidecarModelResolver.pipe(Layer.provide(sidecarLayer)),\n () => Effect.tryPromise(() => 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 // eslint-disable-next-line no-console\n command.stdout.on('data', (data) => console.log('[ollama]', data.toString()));\n // eslint-disable-next-line no-console\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<AiModelResolver.AiModelResolver, never, OllamaSidecar> =\n Layer.unwrapEffect(\n Effect.gen(function* () {\n const { endpoint } = yield* OllamaSidecar;\n return OllamaResolver.make({\n 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;AAGhC,SAASC,sBAAsB;AAC/B,SAASC,kBAAkB;AAC3B,SAASC,uBAAuB;AAChC,SAASC,WAAW;;AAGpB,IAAMC,cAAc;AAIpB,IAAA,iBAAeH,WAAWI,WAAmC,MACpDC,YAAK,MAAA;AACV,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,SAAOR,WAAWkB,YAChBjB,gBAAgBkB,iBAChBC,2BAA2BP,KAAWQ,cAAQX,YAAAA,CAAAA,GAC9C,MAAaY,kBAAW,MAAMhB,QAAQiB,QAAO,CAAA,CAAA;AAEjD,CAAA,CAAA;AAGF,IAAMf,gBAAN,MAAMA,uBAA8BgB,YAAI,mCAAA,EAAA,EAAA;EAMtC,OAAOf,YAAkBgB,aACvBjB,gBACOkB,WAAI,aAAA;AACT,UAAMC,UAAUjC,QAAQkC,QAAQ,kBAAkB;MAAC;OAAU;MAC3DC,KAAK;QACH1B;QACA2B,gBAAgB;MAClB;IACF,CAAA;AAIAH,YAAQI,OAAOC,GAAG,QAAQ,CAACC,SAASC,QAAQhC,IAAI,YAAY+B,KAAKE,SAAQ,CAAA,CAAA;AAEzER,YAAQS,OAAOJ,GAAG,QAAQ,CAACC,SAASC,QAAQG,MAAM,YAAYJ,KAAKE,SAAQ,CAAA,CAAA;AAC3ER,YAAQK,GAAG,SAAS,CAACM,SAASpC,IAAIqC,KAAK,yBAAyB;MAAED;IAAK,GAAA;;;;;;AACvEX,YAAQK,GAAG,SAAS,CAACK,UAAUnC,IAAImC,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;AAEF3C,QAAIqC,KAAK,kBAAkB;MAAEO,KAAKN,MAAMM;IAAI,GAAA;;;;;;AAE5C,WAAO;MACLC,UAAU5C;IACZ;EACF,CAAA,CAAA;AAEJ;AAEA,IAAMiB,6BACE4B,mBACGtB,WAAI,aAAA;AACT,QAAM,EAAEqB,SAAQ,IAAK,OAAOvC;AAC5B,SAAOT,eAAeQ,KAAK;IACzBwC;IACAE,iBAA4BC,iCAAsB,KAAA;EACpD,CAAA;AACF,CAAA,CAAA,EACArC,KAAWQ,cAAwB8B,qBAAK,CAAA;",
6
- "names": ["FetchHttpClient", "HttpClient", "Command", "Context", "Effect", "Layer", "ManagedRuntime", "OllamaResolver", "Capability", "AppCapabilities", "log", "OLLAMA_HOST", "makeModule", "sync", "runtime", "make", "OllamaSidecar", "layerLive", "sidecarLayer", "effectContext", "runtimeEffect", "pipe", "map", "rt", "context", "pick", "contributes", "AiModelResolver", "OllamaSidecarModelResolver", "provide", "tryPromise", "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", "transformClient", "withTracerPropagation", "layer"]
7
- }
@@ -1,190 +0,0 @@
1
- import {
2
- meta
3
- } from "./chunk-6374DBU4.mjs";
4
-
5
- // src/capabilities/updater/updater.ts
6
- import { type } from "@tauri-apps/plugin-os";
7
- import { relaunch } from "@tauri-apps/plugin-process";
8
- import * as Updater from "@tauri-apps/plugin-updater";
9
- import * as Duration from "effect/Duration";
10
- import * as Effect from "effect/Effect";
11
- import * as Fiber from "effect/Fiber";
12
- import * as Match from "effect/Match";
13
- import * as Schedule from "effect/Schedule";
14
- import { Capabilities, Capability } from "@dxos/app-framework";
15
- import { LayoutOperation } from "@dxos/app-toolkit";
16
- import { log } from "@dxos/log";
17
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-native/src/capabilities/updater/updater.ts";
18
- var SUPPORTS_OTA = [
19
- "linux",
20
- "macos",
21
- "windows"
22
- ];
23
- var check2 = async () => {
24
- try {
25
- return await Updater.check();
26
- } catch (error) {
27
- log.error("failed to check for updates", {
28
- error
29
- }, {
30
- F: __dxlog_file,
31
- L: 29,
32
- S: void 0,
33
- C: (f, a) => f(...a)
34
- });
35
- return null;
36
- }
37
- };
38
- var downloadAndInstall = async (update, handleDownload) => {
39
- try {
40
- await update.downloadAndInstall(handleDownload);
41
- return true;
42
- } catch (error) {
43
- log.error("failed to download and install update", {
44
- error
45
- }, {
46
- F: __dxlog_file,
47
- L: 45,
48
- S: void 0,
49
- C: (f, a) => f(...a)
50
- });
51
- return false;
52
- }
53
- };
54
- var updater_default = Capability.makeModule(Effect.fnUntraced(function* () {
55
- const platform = type();
56
- if (!SUPPORTS_OTA.includes(platform) || window.location.hostname === "localhost") {
57
- log.info("skipping updater", {
58
- platform,
59
- hostname: window.location.hostname
60
- }, {
61
- F: __dxlog_file,
62
- L: 55,
63
- S: this,
64
- C: (f, a) => f(...a)
65
- });
66
- return;
67
- }
68
- const { invoke } = yield* Capability.get(Capabilities.OperationInvoker);
69
- const action = Effect.gen(function* () {
70
- log.info("checking for updates", void 0, {
71
- F: __dxlog_file,
72
- L: 63,
73
- S: this,
74
- C: (f, a) => f(...a)
75
- });
76
- const update = yield* Effect.promise(() => check2());
77
- if (!update) {
78
- log.info("no update available", void 0, {
79
- F: __dxlog_file,
80
- L: 66,
81
- S: this,
82
- C: (f, a) => f(...a)
83
- });
84
- return;
85
- }
86
- log.info("update check complete", {
87
- available: update.available,
88
- currentVersion: update.currentVersion,
89
- version: update.version,
90
- date: update.date,
91
- body: update.body
92
- }, {
93
- F: __dxlog_file,
94
- L: 69,
95
- S: this,
96
- C: (f, a) => f(...a)
97
- });
98
- if (update.available) {
99
- log.info("update available, starting download", {
100
- version: update.version
101
- }, {
102
- F: __dxlog_file,
103
- L: 77,
104
- S: this,
105
- C: (f, a) => f(...a)
106
- });
107
- let downloaded = 0;
108
- let contentLength = 0;
109
- const handleDownload = Match.type().pipe(Match.when({
110
- event: "Started"
111
- }, (event) => {
112
- contentLength = event.data.contentLength ?? 0;
113
- log.info("download started", {
114
- contentLength
115
- }, {
116
- F: __dxlog_file,
117
- L: 84,
118
- S: this,
119
- C: (f, a) => f(...a)
120
- });
121
- }), Match.when({
122
- event: "Progress"
123
- }, (event) => {
124
- downloaded += event.data.chunkLength;
125
- log.verbose("download progress", {
126
- downloaded,
127
- contentLength
128
- }, {
129
- F: __dxlog_file,
130
- L: 88,
131
- S: this,
132
- C: (f, a) => f(...a)
133
- });
134
- }), Match.when({
135
- event: "Finished"
136
- }, () => {
137
- log.info("download completed", void 0, {
138
- F: __dxlog_file,
139
- L: 91,
140
- S: this,
141
- C: (f, a) => f(...a)
142
- });
143
- }), Match.exhaustive);
144
- const downloadSuccess = yield* Effect.promise(() => downloadAndInstall(update, handleDownload));
145
- if (downloadSuccess) {
146
- yield* invoke(LayoutOperation.AddToast, {
147
- id: `${meta.id}/update-ready`,
148
- title: [
149
- "update ready label",
150
- {
151
- ns: meta.id
152
- }
153
- ],
154
- description: [
155
- "update ready description",
156
- {
157
- ns: meta.id
158
- }
159
- ],
160
- duration: Infinity,
161
- actionLabel: [
162
- "update label",
163
- {
164
- ns: meta.id
165
- }
166
- ],
167
- actionAlt: [
168
- "update alt",
169
- {
170
- ns: meta.id
171
- }
172
- ],
173
- onAction: () => relaunch()
174
- });
175
- }
176
- }
177
- });
178
- const fiber = yield* action.pipe(Effect.repeat(Schedule.fixed(Duration.hours(1))), Effect.forkDaemon);
179
- log.info("updater module initialized, update check scheduled", void 0, {
180
- F: __dxlog_file,
181
- L: 114,
182
- S: this,
183
- C: (f, a) => f(...a)
184
- });
185
- return Capability.contributes(Capabilities.Null, null, () => Effect.sync(() => Effect.runSync(Fiber.interrupt(fiber))));
186
- }));
187
- export {
188
- updater_default as default
189
- };
190
- //# sourceMappingURL=updater-AR27PYM4.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/updater/updater.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type } from '@tauri-apps/plugin-os';\nimport { relaunch } from '@tauri-apps/plugin-process';\nimport * as Updater from '@tauri-apps/plugin-updater';\nimport * as Duration from 'effect/Duration';\nimport * as Effect from 'effect/Effect';\nimport * as Fiber from 'effect/Fiber';\nimport * as Match from 'effect/Match';\nimport * as Schedule from 'effect/Schedule';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { LayoutOperation } from '@dxos/app-toolkit';\nimport { log } from '@dxos/log';\n\nimport { meta } from '../../meta';\n\nconst SUPPORTS_OTA = ['linux', 'macos', 'windows'];\n\n/**\n * Safely check for updates with error logging.\n */\nconst check = async (): Promise<Updater.Update | null> => {\n try {\n return await Updater.check();\n } catch (error) {\n log.error('failed to check for updates', { error });\n return null;\n }\n};\n\n/**\n * Safely download and install update with error logging.\n */\nconst downloadAndInstall = async (\n update: Updater.Update,\n handleDownload: (event: Updater.DownloadEvent) => void,\n): Promise<boolean> => {\n try {\n await update.downloadAndInstall(handleDownload);\n return true;\n } catch (error) {\n log.error('failed to download and install update', { error });\n return false;\n }\n};\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n // Skip updates if not supported or in dev mode.\n const platform = type();\n if (!SUPPORTS_OTA.includes(platform) || window.location.hostname === 'localhost') {\n log.info('skipping updater', { platform, hostname: window.location.hostname });\n return;\n }\n\n const { invoke } = yield* Capability.get(Capabilities.OperationInvoker);\n\n // https://tauri.app/plugin/updater/#checking-for-updates\n const action = Effect.gen(function* () {\n log.info('checking for updates');\n const update = yield* Effect.promise(() => check());\n if (!update) {\n log.info('no update available');\n return;\n }\n log.info('update check complete', {\n available: update.available,\n currentVersion: update.currentVersion,\n version: update.version,\n date: update.date,\n body: update.body,\n });\n if (update.available) {\n log.info('update available, starting download', { version: update.version });\n let downloaded = 0;\n let contentLength = 0;\n\n const handleDownload = Match.type<Updater.DownloadEvent>().pipe(\n Match.when({ event: 'Started' }, (event) => {\n contentLength = event.data.contentLength ?? 0;\n log.info('download started', { contentLength });\n }),\n Match.when({ event: 'Progress' }, (event) => {\n downloaded += event.data.chunkLength;\n log.verbose('download progress', { downloaded, contentLength });\n }),\n Match.when({ event: 'Finished' }, () => {\n log.info('download completed');\n }),\n Match.exhaustive,\n );\n\n const downloadSuccess = yield* Effect.promise(() => downloadAndInstall(update, handleDownload));\n\n if (downloadSuccess) {\n yield* invoke(LayoutOperation.AddToast, {\n id: `${meta.id}/update-ready`,\n title: ['update ready label', { ns: meta.id }],\n description: ['update ready description', { ns: meta.id }],\n duration: Infinity,\n actionLabel: ['update label', { ns: meta.id }],\n actionAlt: ['update alt', { ns: meta.id }],\n onAction: () => relaunch(),\n });\n }\n }\n });\n\n // Run immediately on startup, then repeat every hour.\n const fiber = yield* action.pipe(Effect.repeat(Schedule.fixed(Duration.hours(1))), Effect.forkDaemon);\n log.info('updater module initialized, update check scheduled');\n\n return Capability.contributes(Capabilities.Null, null, () =>\n Effect.sync(() => Effect.runSync(Fiber.interrupt(fiber))),\n );\n }),\n);\n"],
5
- "mappings": "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",
6
- "names": ["type", "relaunch", "Updater", "Duration", "Effect", "Fiber", "Match", "Schedule", "Capabilities", "Capability", "LayoutOperation", "log", "SUPPORTS_OTA", "check", "error", "log", "downloadAndInstall", "update", "handleDownload", "Capability", "makeModule", "fnUntraced", "platform", "type", "includes", "window", "location", "hostname", "info", "invoke", "get", "Capabilities", "OperationInvoker", "action", "gen", "promise", "available", "currentVersion", "version", "date", "body", "downloaded", "contentLength", "pipe", "when", "event", "data", "chunkLength", "verbose", "exhaustive", "downloadSuccess", "LayoutOperation", "AddToast", "id", "meta", "title", "ns", "description", "duration", "Infinity", "actionLabel", "actionAlt", "onAction", "relaunch", "fiber", "repeat", "fixed", "hours", "forkDaemon", "contributes", "Null", "sync", "runSync", "interrupt"]
7
- }