@dxos/plugin-native 0.8.4-main.67995b8 → 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-C7OU2UF6.mjs +15 -0
- package/dist/lib/browser/chunk-C7OU2UF6.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +34 -20
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/ollama-QOB3EVAJ.mjs +75 -0
- 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-GKYYTCEI.mjs +38 -0
- package/dist/lib/browser/window-GKYYTCEI.mjs.map +7 -0
- package/dist/types/src/NativePlugin.d.ts +2 -1
- package/dist/types/src/NativePlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +3 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/ollama/index.d.ts +3 -0
- package/dist/types/src/capabilities/ollama/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/ollama/ollama.d.ts +7 -0
- package/dist/types/src/capabilities/ollama/ollama.d.ts.map +1 -0
- package/dist/types/src/capabilities/updater/index.d.ts +3 -0
- package/dist/types/src/capabilities/updater/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/updater/updater.d.ts +5 -0
- package/dist/types/src/capabilities/updater/updater.d.ts.map +1 -0
- package/dist/types/src/capabilities/window/index.d.ts +3 -0
- package/dist/types/src/capabilities/window/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/window/window.d.ts +11 -0
- package/dist/types/src/capabilities/window/window.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +25 -14
- package/src/NativePlugin.tsx +23 -15
- package/src/capabilities/index.ts +3 -3
- package/src/capabilities/ollama/index.ts +7 -0
- package/src/capabilities/ollama/ollama.ts +88 -0
- package/src/capabilities/updater/index.ts +7 -0
- package/src/capabilities/updater/updater.ts +120 -0
- package/src/capabilities/window/index.ts +7 -0
- package/src/capabilities/window/window.ts +72 -0
- package/src/index.ts +1 -0
- package/src/meta.ts +8 -5
- package/dist/lib/browser/chunk-E2JDGVJI.mjs +0 -12
- package/dist/lib/browser/chunk-E2JDGVJI.mjs.map +0 -7
- package/dist/lib/browser/updater-KSM3TUHI.mjs +0 -133
- package/dist/lib/browser/updater-KSM3TUHI.mjs.map +0 -7
- package/dist/types/src/capabilities/updater.d.ts +0 -4
- package/dist/types/src/capabilities/updater.d.ts.map +0 -1
- package/src/capabilities/updater.ts +0 -79
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type } from '@tauri-apps/plugin-os';
|
|
6
|
-
import { relaunch } from '@tauri-apps/plugin-process';
|
|
7
|
-
import { check, type DownloadEvent } from '@tauri-apps/plugin-updater';
|
|
8
|
-
import { Duration, Effect, Fiber, Match, pipe, Schedule } from 'effect';
|
|
9
|
-
|
|
10
|
-
import { Capabilities, contributes, createIntent, LayoutAction, type PluginContext } from '@dxos/app-framework';
|
|
11
|
-
import { log } from '@dxos/log';
|
|
12
|
-
|
|
13
|
-
import { NATIVE_PLUGIN } from '../meta';
|
|
14
|
-
|
|
15
|
-
const SUPPORTS_OTA = ['linux', 'macos', 'windows'];
|
|
16
|
-
|
|
17
|
-
export default (context: PluginContext) => {
|
|
18
|
-
const platform = type();
|
|
19
|
-
if (!SUPPORTS_OTA.includes(platform)) {
|
|
20
|
-
return contributes(Capabilities.Null, null);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const { dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
24
|
-
|
|
25
|
-
// https://tauri.app/plugin/updater/#checking-for-updates
|
|
26
|
-
const action = Effect.gen(function* () {
|
|
27
|
-
log.info('checking for updates');
|
|
28
|
-
const update = yield* Effect.tryPromise(() => check());
|
|
29
|
-
log.info('checked for updates', { version: update?.version, currentVersion: update?.currentVersion });
|
|
30
|
-
if (update) {
|
|
31
|
-
log.info('update available', update);
|
|
32
|
-
let downloaded = 0;
|
|
33
|
-
let contentLength = 0;
|
|
34
|
-
|
|
35
|
-
const handleDownload = Match.type<DownloadEvent>().pipe(
|
|
36
|
-
Match.when({ event: 'Started' }, (event) => {
|
|
37
|
-
contentLength = event.data.contentLength ?? 0;
|
|
38
|
-
log.info('download started', { contentLength });
|
|
39
|
-
}),
|
|
40
|
-
Match.when({ event: 'Progress' }, (event) => {
|
|
41
|
-
downloaded += event.data.chunkLength;
|
|
42
|
-
log.info('download progress', { downloaded, contentLength });
|
|
43
|
-
}),
|
|
44
|
-
Match.when({ event: 'Finished' }, () => {
|
|
45
|
-
log.info('download completed');
|
|
46
|
-
}),
|
|
47
|
-
Match.exhaustive,
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
yield* Effect.tryPromise(() => update.downloadAndInstall(handleDownload));
|
|
51
|
-
|
|
52
|
-
yield* dispatch(
|
|
53
|
-
createIntent(LayoutAction.AddToast, {
|
|
54
|
-
part: 'toast',
|
|
55
|
-
subject: {
|
|
56
|
-
id: `${NATIVE_PLUGIN}/update-ready`,
|
|
57
|
-
title: ['update ready label', { ns: NATIVE_PLUGIN }],
|
|
58
|
-
description: ['update ready description', { ns: NATIVE_PLUGIN }],
|
|
59
|
-
duration: Infinity,
|
|
60
|
-
actionLabel: ['update label', { ns: NATIVE_PLUGIN }],
|
|
61
|
-
actionAlt: ['update alt', { ns: NATIVE_PLUGIN }],
|
|
62
|
-
onAction: () => relaunch(),
|
|
63
|
-
},
|
|
64
|
-
}),
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
const fiber = pipe(
|
|
70
|
-
// prettier-ignore
|
|
71
|
-
action,
|
|
72
|
-
Effect.repeat(Schedule.fixed(Duration.hours(1))),
|
|
73
|
-
Effect.runFork,
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
return contributes(Capabilities.Null, null, () => {
|
|
77
|
-
Effect.runSync(Fiber.interrupt(fiber));
|
|
78
|
-
});
|
|
79
|
-
};
|