@dxos/plugin-native 0.8.4-main.28f8d3d → 0.8.4-main.406dc2a

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 (36) hide show
  1. package/dist/lib/browser/chunk-HFW3KCZU.mjs +10 -0
  2. package/dist/lib/browser/chunk-HFW3KCZU.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +10 -6
  4. package/dist/lib/browser/index.mjs.map +3 -3
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/ollama-FWIW4XTL.mjs +90 -0
  7. package/dist/lib/browser/ollama-FWIW4XTL.mjs.map +7 -0
  8. package/dist/lib/browser/{updater-MCAQYHED.mjs → updater-3XUIXC4F.mjs} +25 -20
  9. package/dist/lib/browser/updater-3XUIXC4F.mjs.map +7 -0
  10. package/dist/lib/browser/window-6G542FZL.mjs +34 -0
  11. package/dist/lib/browser/window-6G542FZL.mjs.map +7 -0
  12. package/dist/types/src/NativePlugin.d.ts +1 -1
  13. package/dist/types/src/NativePlugin.d.ts.map +1 -1
  14. package/dist/types/src/capabilities/index.d.ts +3 -2
  15. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  16. package/dist/types/src/capabilities/ollama.d.ts +2 -4
  17. package/dist/types/src/capabilities/ollama.d.ts.map +1 -1
  18. package/dist/types/src/capabilities/updater.d.ts +1 -1
  19. package/dist/types/src/capabilities/updater.d.ts.map +1 -1
  20. package/dist/types/src/capabilities/window.d.ts +4 -0
  21. package/dist/types/src/capabilities/window.d.ts.map +1 -0
  22. package/dist/types/src/meta.d.ts +0 -1
  23. package/dist/types/src/meta.d.ts.map +1 -1
  24. package/dist/types/tsconfig.tsbuildinfo +1 -1
  25. package/package.json +16 -15
  26. package/src/NativePlugin.tsx +23 -19
  27. package/src/capabilities/index.ts +2 -1
  28. package/src/capabilities/ollama.ts +10 -7
  29. package/src/capabilities/updater.ts +16 -10
  30. package/src/capabilities/window.ts +49 -0
  31. package/src/meta.ts +1 -3
  32. package/dist/lib/browser/chunk-E2JDGVJI.mjs +0 -12
  33. package/dist/lib/browser/chunk-E2JDGVJI.mjs.map +0 -7
  34. package/dist/lib/browser/ollama-MF7YNEDS.mjs +0 -73
  35. package/dist/lib/browser/ollama-MF7YNEDS.mjs.map +0 -7
  36. package/dist/lib/browser/updater-MCAQYHED.mjs.map +0 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-native",
3
- "version": "0.8.4-main.28f8d3d",
3
+ "version": "0.8.4-main.406dc2a",
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",
@@ -24,27 +24,28 @@
24
24
  "src"
25
25
  ],
26
26
  "dependencies": {
27
- "@effect/platform": "^0.90.2",
28
- "@tauri-apps/plugin-os": "^2.3.0",
27
+ "@effect/platform": "^0.92.1",
28
+ "@tauri-apps/api": "^2.8.0",
29
+ "@tauri-apps/plugin-os": "^2.3.1",
29
30
  "@tauri-apps/plugin-process": "^2.3.0",
30
- "@tauri-apps/plugin-shell": "^2.3.0",
31
+ "@tauri-apps/plugin-shell": "^2.3.1",
31
32
  "@tauri-apps/plugin-updater": "^2.9.0",
32
- "effect": "3.17.7",
33
- "@dxos/ai": "0.8.4-main.28f8d3d",
34
- "@dxos/log": "0.8.4-main.28f8d3d",
35
- "@dxos/app-framework": "0.8.4-main.28f8d3d",
36
- "@dxos/plugin-help": "0.8.4-main.28f8d3d",
37
- "@dxos/plugin-assistant": "0.8.4-main.28f8d3d",
38
- "@dxos/util": "0.8.4-main.28f8d3d",
39
- "@dxos/plugin-navtree": "0.8.4-main.28f8d3d"
33
+ "effect": "3.18.3",
34
+ "@dxos/ai": "0.8.4-main.406dc2a",
35
+ "@dxos/app-framework": "0.8.4-main.406dc2a",
36
+ "@dxos/log": "0.8.4-main.406dc2a",
37
+ "@dxos/plugin-help": "0.8.4-main.406dc2a",
38
+ "@dxos/plugin-navtree": "0.8.4-main.406dc2a",
39
+ "@dxos/util": "0.8.4-main.406dc2a",
40
+ "@dxos/plugin-assistant": "0.8.4-main.406dc2a"
40
41
  },
41
42
  "devDependencies": {
42
- "vite": "5.4.7",
43
- "@dxos/react-ui": "0.8.4-main.28f8d3d"
43
+ "vite": "7.1.9",
44
+ "@dxos/react-ui": "0.8.4-main.406dc2a"
44
45
  },
45
46
  "peerDependencies": {
46
47
  "effect": "^3.13.3",
47
- "@dxos/react-ui": "0.8.4-main.28f8d3d"
48
+ "@dxos/react-ui": "0.8.4-main.406dc2a"
48
49
  },
49
50
  "publishConfig": {
50
51
  "access": "public"
@@ -5,25 +5,29 @@
5
5
  import { Capabilities, Events, contributes, defineModule, definePlugin } from '@dxos/app-framework';
6
6
  import { AssistantEvents } from '@dxos/plugin-assistant';
7
7
 
8
- import { Ollama, Updater } from './capabilities';
8
+ import { Ollama, Updater, Window } from './capabilities';
9
9
  import { meta } from './meta';
10
10
  import { translations } from './translations';
11
11
 
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/ollama`,
26
- activatesOn: AssistantEvents.SetupAiServiceProviders,
27
- activate: Ollama,
28
- }),
29
- ]);
12
+ export const NativePlugin = definePlugin(meta, () => [
13
+ defineModule({
14
+ id: `${meta.id}/module/translations`,
15
+ activatesOn: Events.SetupTranslations,
16
+ activate: () => contributes(Capabilities.Translations, translations),
17
+ }),
18
+ defineModule({
19
+ id: `${meta.id}/module/updater`,
20
+ activatesOn: Events.DispatcherReady,
21
+ activate: Updater,
22
+ }),
23
+ defineModule({
24
+ id: `${meta.id}/module/window`,
25
+ activatesOn: Events.DispatcherReady,
26
+ activate: Window,
27
+ }),
28
+ defineModule({
29
+ id: `${meta.id}/module/ollama`,
30
+ activatesOn: AssistantEvents.SetupAiServiceProviders,
31
+ activate: Ollama,
32
+ }),
33
+ ]);
@@ -4,5 +4,6 @@
4
4
 
5
5
  import { lazy } from '@dxos/app-framework';
6
6
 
7
- export const Updater = lazy(() => import('./updater'));
8
7
  export const Ollama = lazy(() => import('./ollama'));
8
+ export const Updater = lazy(() => import('./updater'));
9
+ export const Window = lazy(() => import('./window'));
@@ -2,19 +2,22 @@
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 PluginContext, contributes } from '@dxos/app-framework';
13
+ import * as AiServiceRouter from '@dxos/ai/AiServiceRouter';
14
+ import { Capabilities, type Capability, type PluginContext, contributes } from '@dxos/app-framework';
11
15
  import { log } from '@dxos/log';
12
- import { AssistantCapabilities } from '@dxos/plugin-assistant';
13
16
 
14
17
  // Running ollama on non-standard port.
15
18
  const OLLAMA_HOST = 'http://localhost:21434';
16
19
 
17
- export default (_context: PluginContext) => {
20
+ export default (_context: PluginContext): Capability<any> => {
18
21
  const runtime = ManagedRuntime.make(OllamaSidecar.layerLive);
19
22
 
20
23
  // Layer for the sidecar but the lifecycle is managed by the runtime.
@@ -23,7 +26,7 @@ export default (_context: PluginContext) => {
23
26
  );
24
27
 
25
28
  return contributes(
26
- AssistantCapabilities.AiModelResolver,
29
+ Capabilities.AiModelResolver,
27
30
  OllamaSidecarModelResolver.pipe(Layer.provide(sidecarLayer)),
28
31
  async () => {
29
32
  await runtime.dispose();
@@ -5,18 +5,24 @@
5
5
  import { type } from '@tauri-apps/plugin-os';
6
6
  import { relaunch } from '@tauri-apps/plugin-process';
7
7
  import { type DownloadEvent, check } from '@tauri-apps/plugin-updater';
8
- import { Duration, Effect, Fiber, Match, Schedule, pipe } from 'effect';
8
+ import * as Duration from 'effect/Duration';
9
+ import * as Effect from 'effect/Effect';
10
+ import * as Fiber from 'effect/Fiber';
11
+ import * as Function from 'effect/Function';
12
+ import * as Match from 'effect/Match';
13
+ import * as Schedule from 'effect/Schedule';
9
14
 
10
15
  import { Capabilities, LayoutAction, type PluginContext, contributes, createIntent } from '@dxos/app-framework';
11
16
  import { log } from '@dxos/log';
12
17
 
13
- import { NATIVE_PLUGIN } from '../meta';
18
+ import { meta } from '../meta';
14
19
 
15
20
  const SUPPORTS_OTA = ['linux', 'macos', 'windows'];
16
21
 
17
22
  export default (context: PluginContext) => {
23
+ // Skip updates if not supported or in dev mode.
18
24
  const platform = type();
19
- if (!SUPPORTS_OTA.includes(platform)) {
25
+ if (!SUPPORTS_OTA.includes(platform) || window.location.hostname === 'localhost') {
20
26
  return contributes(Capabilities.Null, null);
21
27
  }
22
28
 
@@ -39,7 +45,7 @@ export default (context: PluginContext) => {
39
45
  }),
40
46
  Match.when({ event: 'Progress' }, (event) => {
41
47
  downloaded += event.data.chunkLength;
42
- log.info('download progress', { downloaded, contentLength });
48
+ log.verbose('download progress', { downloaded, contentLength });
43
49
  }),
44
50
  Match.when({ event: 'Finished' }, () => {
45
51
  log.info('download completed');
@@ -53,12 +59,12 @@ export default (context: PluginContext) => {
53
59
  createIntent(LayoutAction.AddToast, {
54
60
  part: 'toast',
55
61
  subject: {
56
- id: `${NATIVE_PLUGIN}/update-ready`,
57
- title: ['update ready label', { ns: NATIVE_PLUGIN }],
58
- description: ['update ready description', { ns: NATIVE_PLUGIN }],
62
+ id: `${meta.id}/update-ready`,
63
+ title: ['update ready label', { ns: meta.id }],
64
+ description: ['update ready description', { ns: meta.id }],
59
65
  duration: Infinity,
60
- actionLabel: ['update label', { ns: NATIVE_PLUGIN }],
61
- actionAlt: ['update alt', { ns: NATIVE_PLUGIN }],
66
+ actionLabel: ['update label', { ns: meta.id }],
67
+ actionAlt: ['update alt', { ns: meta.id }],
62
68
  onAction: () => relaunch(),
63
69
  },
64
70
  }),
@@ -66,7 +72,7 @@ export default (context: PluginContext) => {
66
72
  }
67
73
  });
68
74
 
69
- const fiber = pipe(
75
+ const fiber = Function.pipe(
70
76
  // prettier-ignore
71
77
  action,
72
78
  Effect.repeat(Schedule.fixed(Duration.hours(1))),
@@ -0,0 +1,49 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { LogicalPosition, LogicalSize, getCurrentWindow } from '@tauri-apps/api/window';
6
+
7
+ import { Capabilities, type PluginContext, contributes } from '@dxos/app-framework';
8
+
9
+ export default (_context: PluginContext) => {
10
+ return contributes(Capabilities.Null, null, () => {
11
+ const appWindow = getCurrentWindow();
12
+
13
+ // Save window state to localStorage.
14
+ async function saveWindowState() {
15
+ const size = await appWindow.innerSize();
16
+ const position = await appWindow.innerPosition();
17
+ localStorage.setItem(
18
+ 'windowState',
19
+ JSON.stringify({
20
+ width: size.width,
21
+ height: size.height,
22
+ x: position.x,
23
+ y: position.y,
24
+ }),
25
+ );
26
+ }
27
+
28
+ // Restore window state from localStorage.
29
+ async function restoreWindowState() {
30
+ const savedState = localStorage.getItem('windowState');
31
+ if (savedState) {
32
+ const state = JSON.parse(savedState);
33
+
34
+ await appWindow.setSize(new LogicalSize(state.width, state.height));
35
+ await appWindow.setPosition(new LogicalPosition(state.x, state.y));
36
+ }
37
+ }
38
+
39
+ // Listen for window events and save state.
40
+ void appWindow.listen('tauri://resize', saveWindowState);
41
+ void appWindow.listen('tauri://move', saveWindowState);
42
+
43
+ // Restore state when app loads.
44
+ document.addEventListener('DOMContentLoaded', restoreWindowState);
45
+
46
+ // Save state before closing.
47
+ window.addEventListener('beforeunload', saveWindowState);
48
+ });
49
+ };
package/src/meta.ts CHANGED
@@ -4,9 +4,7 @@
4
4
 
5
5
  import { type PluginMeta } from '@dxos/app-framework';
6
6
 
7
- export const NATIVE_PLUGIN = 'dxos.org/plugin/native';
8
-
9
7
  export const meta: PluginMeta = {
10
- id: NATIVE_PLUGIN,
8
+ id: 'dxos.org/plugin/native',
11
9
  name: 'Native',
12
10
  };
@@ -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
- }
@@ -1,73 +0,0 @@
1
- // src/capabilities/ollama.ts
2
- import { FetchHttpClient, HttpClient } from "@effect/platform";
3
- import { Command } from "@tauri-apps/plugin-shell";
4
- import { Context, Effect, Layer, ManagedRuntime } from "effect";
5
- import { AiServiceRouter } from "@dxos/ai";
6
- import { contributes } from "@dxos/app-framework";
7
- import { log } from "@dxos/log";
8
- import { AssistantCapabilities } from "@dxos/plugin-assistant";
9
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-native/src/capabilities/ollama.ts";
10
- var OLLAMA_HOST = "http://localhost:21434";
11
- var ollama_default = (_context) => {
12
- const runtime = ManagedRuntime.make(OllamaSidecar.layerLive);
13
- const sidecarLayer = Layer.effectContext(runtime.runtimeEffect.pipe(Effect.map((rt) => rt.context.pipe(Context.pick(OllamaSidecar)))));
14
- return contributes(AssistantCapabilities.AiModelResolver, OllamaSidecarModelResolver.pipe(Layer.provide(sidecarLayer)), async () => {
15
- await runtime.dispose();
16
- });
17
- };
18
- var OllamaSidecar = class _OllamaSidecar extends Context.Tag("@dxos/plugin-native/OllamaSidecar")() {
19
- static layerLive = Layer.scoped(_OllamaSidecar, Effect.gen(function* () {
20
- const command = Command.sidecar("sidecar/ollama", [
21
- "serve"
22
- ], {
23
- env: {
24
- OLLAMA_HOST,
25
- OLLAMA_ORIGINS: "*"
26
- }
27
- });
28
- command.stdout.on("data", (data) => console.log("[ollama]", data.toString()));
29
- command.stderr.on("data", (data) => console.error("[ollama]", data.toString()));
30
- command.on("close", (code) => log.info("Ollama process exited", {
31
- code
32
- }, {
33
- F: __dxlog_file,
34
- L: 53,
35
- S: this,
36
- C: (f, a) => f(...a)
37
- }));
38
- command.on("error", (error) => log.error("Ollama error", {
39
- error
40
- }, {
41
- F: __dxlog_file,
42
- L: 54,
43
- S: this,
44
- C: (f, a) => f(...a)
45
- }));
46
- const child = yield* Effect.promise(() => command.spawn());
47
- yield* Effect.addFinalizer(Effect.fn(function* () {
48
- yield* Effect.promise(() => child.kill());
49
- }));
50
- log.info("Running ollama", {
51
- pid: child.pid
52
- }, {
53
- F: __dxlog_file,
54
- L: 61,
55
- S: this,
56
- C: (f, a) => f(...a)
57
- });
58
- return {
59
- endpoint: OLLAMA_HOST
60
- };
61
- }));
62
- };
63
- var OllamaSidecarModelResolver = Layer.unwrapEffect(Effect.gen(function* () {
64
- const { endpoint } = yield* OllamaSidecar;
65
- return AiServiceRouter.OllamaResolver({
66
- host: endpoint,
67
- transformClient: HttpClient.withTracerPropagation(false)
68
- });
69
- })).pipe(Layer.provide(FetchHttpClient.layer));
70
- export {
71
- ollama_default as default
72
- };
73
- //# sourceMappingURL=ollama-MF7YNEDS.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 { FetchHttpClient, HttpClient } from '@effect/platform';\nimport { Command } from '@tauri-apps/plugin-shell';\nimport { Context, Effect, Layer, ManagedRuntime } from 'effect';\n\nimport { AiServiceRouter } from '@dxos/ai';\nimport { type PluginContext, contributes } from '@dxos/app-framework';\nimport { log } from '@dxos/log';\nimport { AssistantCapabilities } from '@dxos/plugin-assistant';\n\n// Running ollama on non-standard port.\nconst OLLAMA_HOST = 'http://localhost:21434';\n\nexport default (_context: PluginContext) => {\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 AssistantCapabilities.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,SAASA,iBAAiBC,kBAAkB;AAC5C,SAASC,eAAe;AACxB,SAASC,SAASC,QAAQC,OAAOC,sBAAsB;AAEvD,SAASC,uBAAuB;AAChC,SAA6BC,mBAAmB;AAChD,SAASC,WAAW;AACpB,SAASC,6BAA6B;;AAGtC,IAAMC,cAAc;AAEpB,IAAA,iBAAe,CAACC,aAAAA;AACd,QAAMC,UAAUP,eAAeQ,KAAKC,cAAcC,SAAS;AAG3D,QAAMC,eAAeZ,MAAMa,cACzBL,QAAQM,cAAcC,KAAKhB,OAAOiB,IAAI,CAACC,OAAOA,GAAGC,QAAQH,KAAKjB,QAAQqB,KAAKT,aAAAA,CAAAA,CAAAA,CAAAA,CAAAA;AAG7E,SAAOP,YACLE,sBAAsBe,iBACtBC,2BAA2BN,KAAKf,MAAMsB,QAAQV,YAAAA,CAAAA,GAC9C,YAAA;AACE,UAAMJ,QAAQe,QAAO;EACvB,CAAA;AAEJ;AAEA,IAAMb,gBAAN,MAAMA,uBAAsBZ,QAAQ0B,IAAI,mCAAA,EAAA,EAAA;EAMtC,OAAOb,YAAYX,MAAMyB,OACvBf,gBACAX,OAAO2B,IAAI,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,QAAQ9B,IAAI,YAAY6B,KAAKE,SAAQ,CAAA,CAAA;AACzER,YAAQS,OAAOJ,GAAG,QAAQ,CAACC,SAASC,QAAQG,MAAM,YAAYJ,KAAKE,SAAQ,CAAA,CAAA;AAC3ER,YAAQK,GAAG,SAAS,CAACM,SAASlC,IAAImC,KAAK,yBAAyB;MAAED;IAAK,GAAA;;;;;;AACvEX,YAAQK,GAAG,SAAS,CAACK,UAAUjC,IAAIiC,MAAM,gBAAgB;MAAEA;IAAM,GAAA;;;;;;AACjE,UAAMG,QAAQ,OAAOzC,OAAO0C,QAAQ,MAAMd,QAAQe,MAAK,CAAA;AACvD,WAAO3C,OAAO4C,aACZ5C,OAAO6C,GAAG,aAAA;AACR,aAAO7C,OAAO0C,QAAQ,MAAMD,MAAMK,KAAI,CAAA;IACxC,CAAA,CAAA;AAEFzC,QAAImC,KAAK,kBAAkB;MAAEO,KAAKN,MAAMM;IAAI,GAAA;;;;;;AAE5C,WAAO;MACLC,UAAUzC;IACZ;EACF,CAAA,CAAA;AAEJ;AAEA,IAAMe,6BACJrB,MAAMgD,aACJjD,OAAO2B,IAAI,aAAA;AACT,QAAM,EAAEqB,SAAQ,IAAK,OAAOrC;AAC5B,SAAOR,gBAAgB+C,eAAe;IACpCC,MAAMH;IACNI,iBAAiBvD,WAAWwD,sBAAsB,KAAA;EACpD,CAAA;AACF,CAAA,CAAA,EACArC,KAAKf,MAAMsB,QAAQ3B,gBAAgB0D,KAAK,CAAA;",
6
- "names": ["FetchHttpClient", "HttpClient", "Command", "Context", "Effect", "Layer", "ManagedRuntime", "AiServiceRouter", "contributes", "log", "AssistantCapabilities", "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
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/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 { type DownloadEvent, check } from '@tauri-apps/plugin-updater';\nimport { Duration, Effect, Fiber, Match, Schedule, pipe } from 'effect';\n\nimport { Capabilities, LayoutAction, type PluginContext, contributes, createIntent } from '@dxos/app-framework';\nimport { log } from '@dxos/log';\n\nimport { NATIVE_PLUGIN } from '../meta';\n\nconst SUPPORTS_OTA = ['linux', 'macos', 'windows'];\n\nexport default (context: PluginContext) => {\n const platform = type();\n if (!SUPPORTS_OTA.includes(platform)) {\n return contributes(Capabilities.Null, null);\n }\n\n const { dispatch } = context.getCapability(Capabilities.IntentDispatcher);\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.tryPromise(() => check());\n log.info('checked for updates', { version: update?.version, currentVersion: update?.currentVersion });\n if (update) {\n log.info('update available', update);\n let downloaded = 0;\n let contentLength = 0;\n\n const handleDownload = Match.type<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.info('download progress', { downloaded, contentLength });\n }),\n Match.when({ event: 'Finished' }, () => {\n log.info('download completed');\n }),\n Match.exhaustive,\n );\n\n yield* Effect.tryPromise(() => update.downloadAndInstall(handleDownload));\n\n yield* dispatch(\n createIntent(LayoutAction.AddToast, {\n part: 'toast',\n subject: {\n id: `${NATIVE_PLUGIN}/update-ready`,\n title: ['update ready label', { ns: NATIVE_PLUGIN }],\n description: ['update ready description', { ns: NATIVE_PLUGIN }],\n duration: Infinity,\n actionLabel: ['update label', { ns: NATIVE_PLUGIN }],\n actionAlt: ['update alt', { ns: NATIVE_PLUGIN }],\n onAction: () => relaunch(),\n },\n }),\n );\n }\n });\n\n const fiber = pipe(\n // prettier-ignore\n action,\n Effect.repeat(Schedule.fixed(Duration.hours(1))),\n Effect.runFork,\n );\n\n return contributes(Capabilities.Null, null, () => {\n Effect.runSync(Fiber.interrupt(fiber));\n });\n};\n"],
5
- "mappings": ";;;;;AAIA,SAASA,YAAY;AACrB,SAASC,gBAAgB;AACzB,SAA6BC,aAAa;AAC1C,SAASC,UAAUC,QAAQC,OAAOC,OAAOC,UAAUC,YAAY;AAE/D,SAASC,cAAcC,cAAkCC,aAAaC,oBAAoB;AAC1F,SAASC,WAAW;;AAIpB,IAAMC,eAAe;EAAC;EAAS;EAAS;;AAExC,IAAA,kBAAe,CAACC,YAAAA;AACd,QAAMC,WAAWC,KAAAA;AACjB,MAAI,CAACH,aAAaI,SAASF,QAAAA,GAAW;AACpC,WAAOG,YAAYC,aAAaC,MAAM,IAAA;EACxC;AAEA,QAAM,EAAEC,SAAQ,IAAKP,QAAQQ,cAAcH,aAAaI,gBAAgB;AAGxE,QAAMC,SAASC,OAAOC,IAAI,aAAA;AACxBC,QAAIC,KAAK,wBAAA,QAAA;;;;;;AACT,UAAMC,SAAS,OAAOJ,OAAOK,WAAW,MAAMC,MAAAA,CAAAA;AAC9CJ,QAAIC,KAAK,uBAAuB;MAAEI,SAASH,QAAQG;MAASC,gBAAgBJ,QAAQI;IAAe,GAAA;;;;;;AACnG,QAAIJ,QAAQ;AACVF,UAAIC,KAAK,oBAAoBC,QAAAA;;;;;;AAC7B,UAAIK,aAAa;AACjB,UAAIC,gBAAgB;AAEpB,YAAMC,iBAAiBC,MAAMrB,KAAI,EAAkBsB,KACjDD,MAAME,KAAK;QAAEC,OAAO;MAAU,GAAG,CAACA,UAAAA;AAChCL,wBAAgBK,MAAMC,KAAKN,iBAAiB;AAC5CR,YAAIC,KAAK,oBAAoB;UAAEO;QAAc,GAAA;;;;;;MAC/C,CAAA,GACAE,MAAME,KAAK;QAAEC,OAAO;MAAW,GAAG,CAACA,UAAAA;AACjCN,sBAAcM,MAAMC,KAAKC;AACzBf,YAAIC,KAAK,qBAAqB;UAAEM;UAAYC;QAAc,GAAA;;;;;;MAC5D,CAAA,GACAE,MAAME,KAAK;QAAEC,OAAO;MAAW,GAAG,MAAA;AAChCb,YAAIC,KAAK,sBAAA,QAAA;;;;;;MACX,CAAA,GACAS,MAAMM,UAAU;AAGlB,aAAOlB,OAAOK,WAAW,MAAMD,OAAOe,mBAAmBR,cAAAA,CAAAA;AAEzD,aAAOf,SACLwB,aAAaC,aAAaC,UAAU;QAClCC,MAAM;QACNC,SAAS;UACPC,IAAI,GAAGC,aAAAA;UACPC,OAAO;YAAC;YAAsB;cAAEC,IAAIF;YAAc;;UAClDG,aAAa;YAAC;YAA4B;cAAED,IAAIF;YAAc;;UAC9DI,UAAUC;UACVC,aAAa;YAAC;YAAgB;cAAEJ,IAAIF;YAAc;;UAClDO,WAAW;YAAC;YAAc;cAAEL,IAAIF;YAAc;;UAC9CQ,UAAU,MAAMC,SAAAA;QAClB;MACF,CAAA,CAAA;IAEJ;EACF,CAAA;AAEA,QAAMC,QAAQvB;;IAEZd;IACAC,OAAOqC,OAAOC,SAASC,MAAMC,SAASC,MAAM,CAAA,CAAA,CAAA;IAC5CzC,OAAO0C;EAAO;AAGhB,SAAOjD,YAAYC,aAAaC,MAAM,MAAM,MAAA;AAC1CK,WAAO2C,QAAQC,MAAMC,UAAUT,KAAAA,CAAAA;EACjC,CAAA;AACF;",
6
- "names": ["type", "relaunch", "check", "Duration", "Effect", "Fiber", "Match", "Schedule", "pipe", "Capabilities", "LayoutAction", "contributes", "createIntent", "log", "SUPPORTS_OTA", "context", "platform", "type", "includes", "contributes", "Capabilities", "Null", "dispatch", "getCapability", "IntentDispatcher", "action", "Effect", "gen", "log", "info", "update", "tryPromise", "check", "version", "currentVersion", "downloaded", "contentLength", "handleDownload", "Match", "pipe", "when", "event", "data", "chunkLength", "exhaustive", "downloadAndInstall", "createIntent", "LayoutAction", "AddToast", "part", "subject", "id", "NATIVE_PLUGIN", "title", "ns", "description", "duration", "Infinity", "actionLabel", "actionAlt", "onAction", "relaunch", "fiber", "repeat", "Schedule", "fixed", "Duration", "hours", "runFork", "runSync", "Fiber", "interrupt"]
7
- }