@dxos/plugin-native 0.8.4-main.69d29f4 → 0.8.4-main.6fa680abb7
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.
- package/dist/lib/browser/{chunk-6374DBU4.mjs → chunk-C7OU2UF6.mjs} +2 -2
- package/dist/lib/browser/{chunk-6374DBU4.mjs.map → chunk-C7OU2UF6.mjs.map} +1 -1
- package/dist/lib/browser/index.mjs +9 -8
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{ollama-KSB3XG6S.mjs → ollama-QOB3EVAJ.mjs} +7 -6
- package/dist/lib/browser/ollama-QOB3EVAJ.mjs.map +7 -0
- package/dist/lib/browser/updater-XFTSQ4BS.mjs +190 -0
- package/dist/lib/browser/updater-XFTSQ4BS.mjs.map +7 -0
- package/dist/lib/browser/{window-JDFVLF4U.mjs → window-GKYYTCEI.mjs} +5 -5
- package/dist/lib/browser/window-GKYYTCEI.mjs.map +7 -0
- package/dist/types/src/NativePlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/ollama/ollama.d.ts +4 -3
- package/dist/types/src/capabilities/ollama/ollama.d.ts.map +1 -1
- package/dist/types/src/capabilities/updater/updater.d.ts +1 -1
- package/dist/types/src/capabilities/updater/updater.d.ts.map +1 -1
- package/dist/types/src/capabilities/window/window.d.ts +1 -1
- package/dist/types/src/capabilities/window/window.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +16 -15
- package/src/NativePlugin.tsx +5 -4
- package/src/capabilities/ollama/ollama.ts +4 -3
- package/src/capabilities/updater/updater.ts +64 -26
- package/src/capabilities/window/window.ts +6 -6
- package/src/meta.ts +1 -1
- package/dist/lib/browser/ollama-KSB3XG6S.mjs.map +0 -7
- package/dist/lib/browser/updater-XQTSH4ZZ.mjs +0 -133
- package/dist/lib/browser/updater-XQTSH4ZZ.mjs.map +0 -7
- package/dist/lib/browser/window-JDFVLF4U.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.
|
|
3
|
+
"version": "0.8.4-main.6fa680abb7",
|
|
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",
|
|
@@ -28,29 +28,30 @@
|
|
|
28
28
|
"src"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@effect/platform": "0.
|
|
31
|
+
"@effect/platform": "0.94.4",
|
|
32
32
|
"@tauri-apps/api": "^2.8.0",
|
|
33
33
|
"@tauri-apps/plugin-os": "^2.3.1",
|
|
34
34
|
"@tauri-apps/plugin-process": "^2.3.0",
|
|
35
35
|
"@tauri-apps/plugin-shell": "^2.3.1",
|
|
36
36
|
"@tauri-apps/plugin-updater": "^2.9.0",
|
|
37
|
-
"effect": "3.19.
|
|
38
|
-
"@dxos/ai": "0.8.4-main.
|
|
39
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
40
|
-
"@dxos/log": "0.8.4-main.
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/plugin-
|
|
44
|
-
"@dxos/plugin-navtree": "0.8.4-main.
|
|
45
|
-
"@dxos/
|
|
37
|
+
"effect": "3.19.16",
|
|
38
|
+
"@dxos/ai": "0.8.4-main.6fa680abb7",
|
|
39
|
+
"@dxos/app-framework": "0.8.4-main.6fa680abb7",
|
|
40
|
+
"@dxos/log": "0.8.4-main.6fa680abb7",
|
|
41
|
+
"@dxos/app-toolkit": "0.8.4-main.6fa680abb7",
|
|
42
|
+
"@dxos/operation": "0.8.4-main.6fa680abb7",
|
|
43
|
+
"@dxos/plugin-assistant": "0.8.4-main.6fa680abb7",
|
|
44
|
+
"@dxos/plugin-navtree": "0.8.4-main.6fa680abb7",
|
|
45
|
+
"@dxos/plugin-help": "0.8.4-main.6fa680abb7",
|
|
46
|
+
"@dxos/util": "0.8.4-main.6fa680abb7"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
|
-
"vite": "7.1.
|
|
49
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
49
|
+
"vite": "^7.1.11",
|
|
50
|
+
"@dxos/react-ui": "0.8.4-main.6fa680abb7"
|
|
50
51
|
},
|
|
51
52
|
"peerDependencies": {
|
|
52
|
-
"effect": "3.19.
|
|
53
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
53
|
+
"effect": "3.19.16",
|
|
54
|
+
"@dxos/react-ui": "0.8.4-main.6fa680abb7"
|
|
54
55
|
},
|
|
55
56
|
"publishConfig": {
|
|
56
57
|
"access": "public"
|
package/src/NativePlugin.tsx
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
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
9
|
import { Ollama, Updater, Window } from './capabilities';
|
|
@@ -10,15 +11,15 @@ import { meta } from './meta';
|
|
|
10
11
|
import { translations } from './translations';
|
|
11
12
|
|
|
12
13
|
export const NativePlugin = Plugin.define(meta).pipe(
|
|
13
|
-
|
|
14
|
+
AppPlugin.addTranslationsModule({ translations }),
|
|
14
15
|
Plugin.addModule({
|
|
15
16
|
id: 'updater',
|
|
16
|
-
activatesOn:
|
|
17
|
+
activatesOn: ActivationEvents.OperationInvokerReady,
|
|
17
18
|
activate: Updater,
|
|
18
19
|
}),
|
|
19
20
|
Plugin.addModule({
|
|
20
21
|
id: 'window',
|
|
21
|
-
activatesOn:
|
|
22
|
+
activatesOn: ActivationEvents.OperationInvokerReady,
|
|
22
23
|
activate: Window,
|
|
23
24
|
}),
|
|
24
25
|
Plugin.addModule({
|
|
@@ -12,13 +12,14 @@ import * as ManagedRuntime from 'effect/ManagedRuntime';
|
|
|
12
12
|
|
|
13
13
|
import { type AiModelResolver } from '@dxos/ai';
|
|
14
14
|
import { OllamaResolver } from '@dxos/ai/resolvers';
|
|
15
|
-
import { Capability
|
|
15
|
+
import { Capability } from '@dxos/app-framework';
|
|
16
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
16
17
|
import { log } from '@dxos/log';
|
|
17
18
|
|
|
18
19
|
// NOTE: Running ollama on non-standard port (config Tauri).
|
|
19
20
|
const OLLAMA_HOST = 'http://localhost:21434';
|
|
20
21
|
|
|
21
|
-
export type OllamaCapabilities = Capability.Capability<typeof
|
|
22
|
+
export type OllamaCapabilities = Capability.Capability<typeof AppCapabilities.AiModelResolver>;
|
|
22
23
|
|
|
23
24
|
export default Capability.makeModule<[], OllamaCapabilities>(() =>
|
|
24
25
|
Effect.sync(() => {
|
|
@@ -30,7 +31,7 @@ export default Capability.makeModule<[], OllamaCapabilities>(() =>
|
|
|
30
31
|
);
|
|
31
32
|
|
|
32
33
|
return Capability.contributes(
|
|
33
|
-
|
|
34
|
+
AppCapabilities.AiModelResolver,
|
|
34
35
|
OllamaSidecarModelResolver.pipe(Layer.provide(sidecarLayer)),
|
|
35
36
|
() => Effect.tryPromise(() => runtime.dispose()),
|
|
36
37
|
);
|
|
@@ -4,42 +4,81 @@
|
|
|
4
4
|
|
|
5
5
|
import { type } from '@tauri-apps/plugin-os';
|
|
6
6
|
import { relaunch } from '@tauri-apps/plugin-process';
|
|
7
|
-
import
|
|
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 {
|
|
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
18
|
import { meta } from '../../meta';
|
|
19
19
|
|
|
20
20
|
const SUPPORTS_OTA = ['linux', 'macos', 'windows'];
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Safely check for updates with error logging.
|
|
24
|
+
*/
|
|
25
|
+
const check = async (): Promise<Updater.Update | null> => {
|
|
26
|
+
try {
|
|
27
|
+
return await Updater.check();
|
|
28
|
+
} catch (error) {
|
|
29
|
+
log.error('failed to check for updates', { error });
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Safely download and install update with error logging.
|
|
36
|
+
*/
|
|
37
|
+
const downloadAndInstall = async (
|
|
38
|
+
update: Updater.Update,
|
|
39
|
+
handleDownload: (event: Updater.DownloadEvent) => void,
|
|
40
|
+
): Promise<boolean> => {
|
|
41
|
+
try {
|
|
42
|
+
await update.downloadAndInstall(handleDownload);
|
|
43
|
+
return true;
|
|
44
|
+
} catch (error) {
|
|
45
|
+
log.error('failed to download and install update', { error });
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
22
50
|
export default Capability.makeModule(
|
|
23
51
|
Effect.fnUntraced(function* () {
|
|
24
52
|
// Skip updates if not supported or in dev mode.
|
|
25
53
|
const platform = type();
|
|
26
54
|
if (!SUPPORTS_OTA.includes(platform) || window.location.hostname === 'localhost') {
|
|
55
|
+
log.info('skipping updater', { platform, hostname: window.location.hostname });
|
|
27
56
|
return;
|
|
28
57
|
}
|
|
29
58
|
|
|
30
|
-
const { invoke } = yield* Capability.get(
|
|
59
|
+
const { invoke } = yield* Capability.get(Capabilities.OperationInvoker);
|
|
31
60
|
|
|
32
61
|
// https://tauri.app/plugin/updater/#checking-for-updates
|
|
33
62
|
const action = Effect.gen(function* () {
|
|
34
63
|
log.info('checking for updates');
|
|
35
|
-
const update = yield* Effect.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
64
|
+
const update = yield* Effect.promise(() => check());
|
|
65
|
+
if (!update) {
|
|
66
|
+
log.info('no update available');
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
log.info('update check complete', {
|
|
70
|
+
available: update.available,
|
|
71
|
+
currentVersion: update.currentVersion,
|
|
72
|
+
version: update.version,
|
|
73
|
+
date: update.date,
|
|
74
|
+
body: update.body,
|
|
75
|
+
});
|
|
76
|
+
if (update.available) {
|
|
77
|
+
log.info('update available, starting download', { version: update.version });
|
|
39
78
|
let downloaded = 0;
|
|
40
79
|
let contentLength = 0;
|
|
41
80
|
|
|
42
|
-
const handleDownload = Match.type<DownloadEvent>().pipe(
|
|
81
|
+
const handleDownload = Match.type<Updater.DownloadEvent>().pipe(
|
|
43
82
|
Match.when({ event: 'Started' }, (event) => {
|
|
44
83
|
contentLength = event.data.contentLength ?? 0;
|
|
45
84
|
log.info('download started', { contentLength });
|
|
@@ -54,28 +93,27 @@ export default Capability.makeModule(
|
|
|
54
93
|
Match.exhaustive,
|
|
55
94
|
);
|
|
56
95
|
|
|
57
|
-
yield* Effect.
|
|
96
|
+
const downloadSuccess = yield* Effect.promise(() => downloadAndInstall(update, handleDownload));
|
|
58
97
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
98
|
+
if (downloadSuccess) {
|
|
99
|
+
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 }],
|
|
103
|
+
duration: Infinity,
|
|
104
|
+
actionLabel: ['update label', { ns: meta.id }],
|
|
105
|
+
actionAlt: ['update alt', { ns: meta.id }],
|
|
106
|
+
onAction: () => relaunch(),
|
|
107
|
+
});
|
|
108
|
+
}
|
|
68
109
|
}
|
|
69
110
|
});
|
|
70
111
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
Effect.repeat(Schedule.fixed(Duration.hours(1))),
|
|
75
|
-
Effect.runFork,
|
|
76
|
-
);
|
|
112
|
+
// Run immediately on startup, then repeat every hour.
|
|
113
|
+
const fiber = yield* action.pipe(Effect.repeat(Schedule.fixed(Duration.hours(1))), Effect.forkDaemon);
|
|
114
|
+
log.info('updater module initialized, update check scheduled');
|
|
77
115
|
|
|
78
|
-
return Capability.contributes(
|
|
116
|
+
return Capability.contributes(Capabilities.Null, null, () =>
|
|
79
117
|
Effect.sync(() => Effect.runSync(Fiber.interrupt(fiber))),
|
|
80
118
|
);
|
|
81
119
|
}),
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Window capability module.
|
|
@@ -21,7 +21,7 @@ export default Capability.makeModule(
|
|
|
21
21
|
const cleanupDragRegions = setupWindowDrag(appWindow);
|
|
22
22
|
|
|
23
23
|
return Capability.contributes(
|
|
24
|
-
|
|
24
|
+
Capabilities.Null,
|
|
25
25
|
null,
|
|
26
26
|
Effect.fnUntraced(function* () {
|
|
27
27
|
cleanupDragRegions();
|
|
@@ -33,13 +33,13 @@ export default Capability.makeModule(
|
|
|
33
33
|
/**
|
|
34
34
|
* Interactive element selectors that should not trigger window dragging.
|
|
35
35
|
*/
|
|
36
|
-
const INTERACTIVE_SELECTORS = '.app-no-drag, button, a, input, select, textarea, [role="button"], [role="menuitem"]';
|
|
36
|
+
const INTERACTIVE_SELECTORS = '.dx-app-no-drag, button, a, input, select, textarea, [role="button"], [role="menuitem"]';
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Sets up window drag regions.
|
|
40
40
|
*
|
|
41
41
|
* Tauri 2.0 does not support the `-webkit-app-region` CSS property with overlay titlebars.
|
|
42
|
-
* This uses the Tauri window API to enable dragging on elements with the `app-drag` class.
|
|
42
|
+
* This uses the Tauri window API to enable dragging on elements with the `dx-app-drag` class.
|
|
43
43
|
*/
|
|
44
44
|
const setupWindowDrag = (appWindow: ReturnType<typeof getCurrentWindow>): (() => void) => {
|
|
45
45
|
const handleMouseDown = (event: MouseEvent) => {
|
|
@@ -48,8 +48,8 @@ const setupWindowDrag = (appWindow: ReturnType<typeof getCurrentWindow>): (() =>
|
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
// Check if the click target or any ancestor has the app-drag class.
|
|
52
|
-
const dragElement = target.closest('.app-drag');
|
|
51
|
+
// Check if the click target or any ancestor has the dx-app-drag class.
|
|
52
|
+
const dragElement = target.closest('.dx-app-drag');
|
|
53
53
|
if (!dragElement) {
|
|
54
54
|
return;
|
|
55
55
|
}
|
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.
|
|
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.
|
|
@@ -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, Common } from '@dxos/app-framework';\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 Common.Capability.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 Common.Capability.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,YAAYC,cAAc;AACnC,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,OAAOD,WAAWmB,iBAClBC,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", "Common", "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,133 +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 { check } 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 Function from "effect/Function";
|
|
13
|
-
import * as Match from "effect/Match";
|
|
14
|
-
import * as Schedule from "effect/Schedule";
|
|
15
|
-
import { Capability, Common } from "@dxos/app-framework";
|
|
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 updater_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
24
|
-
const platform = type();
|
|
25
|
-
if (!SUPPORTS_OTA.includes(platform) || window.location.hostname === "localhost") {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const { invoke } = yield* Capability.get(Common.Capability.OperationInvoker);
|
|
29
|
-
const action = Effect.gen(function* () {
|
|
30
|
-
log.info("checking for updates", void 0, {
|
|
31
|
-
F: __dxlog_file,
|
|
32
|
-
L: 34,
|
|
33
|
-
S: this,
|
|
34
|
-
C: (f, a) => f(...a)
|
|
35
|
-
});
|
|
36
|
-
const update = yield* Effect.tryPromise(() => check());
|
|
37
|
-
log.info("checked for updates", {
|
|
38
|
-
version: update?.version,
|
|
39
|
-
currentVersion: update?.currentVersion
|
|
40
|
-
}, {
|
|
41
|
-
F: __dxlog_file,
|
|
42
|
-
L: 36,
|
|
43
|
-
S: this,
|
|
44
|
-
C: (f, a) => f(...a)
|
|
45
|
-
});
|
|
46
|
-
if (update) {
|
|
47
|
-
log.info("update available", update, {
|
|
48
|
-
F: __dxlog_file,
|
|
49
|
-
L: 38,
|
|
50
|
-
S: this,
|
|
51
|
-
C: (f, a) => f(...a)
|
|
52
|
-
});
|
|
53
|
-
let downloaded = 0;
|
|
54
|
-
let contentLength = 0;
|
|
55
|
-
const handleDownload = Match.type().pipe(Match.when({
|
|
56
|
-
event: "Started"
|
|
57
|
-
}, (event) => {
|
|
58
|
-
contentLength = event.data.contentLength ?? 0;
|
|
59
|
-
log.info("download started", {
|
|
60
|
-
contentLength
|
|
61
|
-
}, {
|
|
62
|
-
F: __dxlog_file,
|
|
63
|
-
L: 45,
|
|
64
|
-
S: this,
|
|
65
|
-
C: (f, a) => f(...a)
|
|
66
|
-
});
|
|
67
|
-
}), Match.when({
|
|
68
|
-
event: "Progress"
|
|
69
|
-
}, (event) => {
|
|
70
|
-
downloaded += event.data.chunkLength;
|
|
71
|
-
log.verbose("download progress", {
|
|
72
|
-
downloaded,
|
|
73
|
-
contentLength
|
|
74
|
-
}, {
|
|
75
|
-
F: __dxlog_file,
|
|
76
|
-
L: 49,
|
|
77
|
-
S: this,
|
|
78
|
-
C: (f, a) => f(...a)
|
|
79
|
-
});
|
|
80
|
-
}), Match.when({
|
|
81
|
-
event: "Finished"
|
|
82
|
-
}, () => {
|
|
83
|
-
log.info("download completed", void 0, {
|
|
84
|
-
F: __dxlog_file,
|
|
85
|
-
L: 52,
|
|
86
|
-
S: this,
|
|
87
|
-
C: (f, a) => f(...a)
|
|
88
|
-
});
|
|
89
|
-
}), Match.exhaustive);
|
|
90
|
-
yield* Effect.tryPromise(() => update.downloadAndInstall(handleDownload));
|
|
91
|
-
yield* invoke(Common.LayoutOperation.AddToast, {
|
|
92
|
-
id: `${meta.id}/update-ready`,
|
|
93
|
-
title: [
|
|
94
|
-
"update ready label",
|
|
95
|
-
{
|
|
96
|
-
ns: meta.id
|
|
97
|
-
}
|
|
98
|
-
],
|
|
99
|
-
description: [
|
|
100
|
-
"update ready description",
|
|
101
|
-
{
|
|
102
|
-
ns: meta.id
|
|
103
|
-
}
|
|
104
|
-
],
|
|
105
|
-
duration: Infinity,
|
|
106
|
-
actionLabel: [
|
|
107
|
-
"update label",
|
|
108
|
-
{
|
|
109
|
-
ns: meta.id
|
|
110
|
-
}
|
|
111
|
-
],
|
|
112
|
-
actionAlt: [
|
|
113
|
-
"update alt",
|
|
114
|
-
{
|
|
115
|
-
ns: meta.id
|
|
116
|
-
}
|
|
117
|
-
],
|
|
118
|
-
onAction: () => relaunch()
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
const fiber = Function.pipe(
|
|
123
|
-
// prettier-ignore
|
|
124
|
-
action,
|
|
125
|
-
Effect.repeat(Schedule.fixed(Duration.hours(1))),
|
|
126
|
-
Effect.runFork
|
|
127
|
-
);
|
|
128
|
-
return Capability.contributes(Common.Capability.Null, null, () => Effect.sync(() => Effect.runSync(Fiber.interrupt(fiber))));
|
|
129
|
-
}));
|
|
130
|
-
export {
|
|
131
|
-
updater_default as default
|
|
132
|
-
};
|
|
133
|
-
//# sourceMappingURL=updater-XQTSH4ZZ.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 { type DownloadEvent, check } 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 Function from 'effect/Function';\nimport * as Match from 'effect/Match';\nimport * as Schedule from 'effect/Schedule';\n\nimport { Capability, Common } from '@dxos/app-framework';\nimport { log } from '@dxos/log';\n\nimport { meta } from '../../meta';\n\nconst SUPPORTS_OTA = ['linux', 'macos', 'windows'];\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 return;\n }\n\n const { invoke } = yield* Capability.get(Common.Capability.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.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.verbose('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* invoke(Common.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 const fiber: Fiber.RuntimeFiber<number, unknown> = Function.pipe(\n // prettier-ignore\n action,\n Effect.repeat(Schedule.fixed(Duration.hours(1))),\n Effect.runFork,\n );\n\n return Capability.contributes(Common.Capability.Null, null, () =>\n Effect.sync(() => Effect.runSync(Fiber.interrupt(fiber))),\n );\n }),\n);\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,SAASA,YAAY;AACrB,SAASC,gBAAgB;AACzB,SAA6BC,aAAa;AAC1C,YAAYC,cAAc;AAC1B,YAAYC,YAAY;AACxB,YAAYC,WAAW;AACvB,YAAYC,cAAc;AAC1B,YAAYC,WAAW;AACvB,YAAYC,cAAc;AAE1B,SAASC,YAAYC,cAAc;AACnC,SAASC,WAAW;;AAIpB,IAAMC,eAAe;EAAC;EAAS;EAAS;;AAExC,IAAA,kBAAeC,WAAWC,WACjBC,kBAAW,aAAA;AAEhB,QAAMC,WAAWC,KAAAA;AACjB,MAAI,CAACL,aAAaM,SAASF,QAAAA,KAAaG,OAAOC,SAASC,aAAa,aAAa;AAChF;EACF;AAEA,QAAM,EAAEC,OAAM,IAAK,OAAOT,WAAWU,IAAIC,OAAOX,WAAWY,gBAAgB;AAG3E,QAAMC,SAAgBC,WAAI,aAAA;AACxBC,QAAIC,KAAK,wBAAA,QAAA;;;;;;AACT,UAAMC,SAAS,OAAcC,kBAAW,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,iBAAuBpB,WAAI,EAAkBqB,KAC3CC,WAAK;QAAEC,OAAO;MAAU,GAAG,CAACA,UAAAA;AAChCJ,wBAAgBI,MAAMC,KAAKL,iBAAiB;AAC5CR,YAAIC,KAAK,oBAAoB;UAAEO;QAAc,GAAA;;;;;;MAC/C,CAAA,GACMG,WAAK;QAAEC,OAAO;MAAW,GAAG,CAACA,UAAAA;AACjCL,sBAAcK,MAAMC,KAAKC;AACzBd,YAAIe,QAAQ,qBAAqB;UAAER;UAAYC;QAAc,GAAA;;;;;;MAC/D,CAAA,GACMG,WAAK;QAAEC,OAAO;MAAW,GAAG,MAAA;AAChCZ,YAAIC,KAAK,sBAAA,QAAA;;;;;;MACX,CAAA,GACMe,gBAAU;AAGlB,aAAcb,kBAAW,MAAMD,OAAOe,mBAAmBR,cAAAA,CAAAA;AAEzD,aAAOf,OAAOE,OAAOsB,gBAAgBC,UAAU;QAC7CC,IAAI,GAAGC,KAAKD,EAAE;QACdE,OAAO;UAAC;UAAsB;YAAEC,IAAIF,KAAKD;UAAG;;QAC5CI,aAAa;UAAC;UAA4B;YAAED,IAAIF,KAAKD;UAAG;;QACxDK,UAAUC;QACVC,aAAa;UAAC;UAAgB;YAAEJ,IAAIF,KAAKD;UAAG;;QAC5CQ,WAAW;UAAC;UAAc;YAAEL,IAAIF,KAAKD;UAAG;;QACxCS,UAAU,MAAMC,SAAAA;MAClB,CAAA;IACF;EACF,CAAA;AAEA,QAAMC,QAAsDrB;;IAE1DZ;IACOkC,cAAgBC,eAAeC,eAAM,CAAA,CAAA,CAAA;IACrCC;EAAO;AAGhB,SAAOlD,WAAWmD,YAAYxC,OAAOX,WAAWoD,MAAM,MAAM,MACnDC,YAAK,MAAaC,eAAcC,gBAAUT,KAAAA,CAAAA,CAAAA,CAAAA;AAErD,CAAA,CAAA;",
|
|
6
|
-
"names": ["type", "relaunch", "check", "Duration", "Effect", "Fiber", "Function", "Match", "Schedule", "Capability", "Common", "log", "SUPPORTS_OTA", "Capability", "makeModule", "fnUntraced", "platform", "type", "includes", "window", "location", "hostname", "invoke", "get", "Common", "OperationInvoker", "action", "gen", "log", "info", "update", "tryPromise", "check", "version", "currentVersion", "downloaded", "contentLength", "handleDownload", "pipe", "when", "event", "data", "chunkLength", "verbose", "exhaustive", "downloadAndInstall", "LayoutOperation", "AddToast", "id", "meta", "title", "ns", "description", "duration", "Infinity", "actionLabel", "actionAlt", "onAction", "relaunch", "fiber", "repeat", "fixed", "hours", "runFork", "contributes", "Null", "sync", "runSync", "interrupt"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/window/window.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { getCurrentWindow } from '@tauri-apps/api/window';\nimport * as Effect from 'effect/Effect';\n\nimport { Capability, Common } from '@dxos/app-framework';\n\n/**\n * Window capability module.\n * Sets up window drag regions for Tauri windows.\n * Note: Window state persistence (size/position) is handled on the Rust side\n * in src-tauri/src/window_state.rs for instant restoration on startup.\n */\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n const appWindow = getCurrentWindow();\n\n // Set up drag regions for window dragging.\n const cleanupDragRegions = setupWindowDrag(appWindow);\n\n return Capability.contributes(\n Common.Capability.Null,\n null,\n Effect.fnUntraced(function* () {\n cleanupDragRegions();\n }),\n );\n }),\n);\n\n/**\n * Interactive element selectors that should not trigger window dragging.\n */\nconst INTERACTIVE_SELECTORS = '.app-no-drag, button, a, input, select, textarea, [role=\"button\"], [role=\"menuitem\"]';\n\n/**\n * Sets up window drag regions.\n *\n * Tauri 2.0 does not support the `-webkit-app-region` CSS property with overlay titlebars.\n * This uses the Tauri window API to enable dragging on elements with the `app-drag` class.\n */\nconst setupWindowDrag = (appWindow: ReturnType<typeof getCurrentWindow>): (() => void) => {\n const handleMouseDown = (event: MouseEvent) => {\n const target = event.target as Element | null;\n if (!target) {\n return;\n }\n\n // Check if the click target or any ancestor has the app-drag class.\n const dragElement = target.closest('.app-drag');\n if (!dragElement) {\n return;\n }\n\n // Don't trigger drag on interactive elements within the drag region.\n const interactiveElement = target.closest(INTERACTIVE_SELECTORS);\n if (interactiveElement && dragElement.contains(interactiveElement)) {\n return;\n }\n\n event.preventDefault();\n void appWindow.startDragging();\n };\n\n document.addEventListener('mousedown', handleMouseDown);\n\n return () => {\n document.removeEventListener('mousedown', handleMouseDown);\n };\n};\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,wBAAwB;AACjC,YAAYC,YAAY;AAExB,SAASC,YAAYC,cAAc;AAQnC,IAAA,iBAAeC,WAAWC,WACjBC,kBAAW,aAAA;AAChB,QAAMC,YAAYC,iBAAAA;AAGlB,QAAMC,qBAAqBC,gBAAgBH,SAAAA;AAE3C,SAAOH,WAAWO,YAChBC,OAAOR,WAAWS,MAClB,MACOP,kBAAW,aAAA;AAChBG,uBAAAA;EACF,CAAA,CAAA;AAEJ,CAAA,CAAA;AAMF,IAAMK,wBAAwB;AAQ9B,IAAMJ,kBAAkB,CAACH,cAAAA;AACvB,QAAMQ,kBAAkB,CAACC,UAAAA;AACvB,UAAMC,SAASD,MAAMC;AACrB,QAAI,CAACA,QAAQ;AACX;IACF;AAGA,UAAMC,cAAcD,OAAOE,QAAQ,WAAA;AACnC,QAAI,CAACD,aAAa;AAChB;IACF;AAGA,UAAME,qBAAqBH,OAAOE,QAAQL,qBAAAA;AAC1C,QAAIM,sBAAsBF,YAAYG,SAASD,kBAAAA,GAAqB;AAClE;IACF;AAEAJ,UAAMM,eAAc;AACpB,SAAKf,UAAUgB,cAAa;EAC9B;AAEAC,WAASC,iBAAiB,aAAaV,eAAAA;AAEvC,SAAO,MAAA;AACLS,aAASE,oBAAoB,aAAaX,eAAAA;EAC5C;AACF;",
|
|
6
|
-
"names": ["getCurrentWindow", "Effect", "Capability", "Common", "Capability", "makeModule", "fnUntraced", "appWindow", "getCurrentWindow", "cleanupDragRegions", "setupWindowDrag", "contributes", "Common", "Null", "INTERACTIVE_SELECTORS", "handleMouseDown", "event", "target", "dragElement", "closest", "interactiveElement", "contains", "preventDefault", "startDragging", "document", "addEventListener", "removeEventListener"]
|
|
7
|
-
}
|