@dxos/plugin-native 0.8.4-main.f5c0578 → 0.8.4-main.fcc0d83b33
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/index.mjs +31 -45
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/translations.mjs +18 -0
- package/dist/lib/browser/translations.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 +4 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/ollama.d.ts +5 -4
- package/dist/types/src/capabilities/ollama.d.ts.map +1 -1
- package/dist/types/src/capabilities/spotlight-listener.d.ts +8 -0
- package/dist/types/src/capabilities/spotlight-listener.d.ts.map +1 -0
- package/dist/types/src/capabilities/updater.d.ts +3 -2
- package/dist/types/src/capabilities/updater.d.ts.map +1 -1
- package/dist/types/src/constants.d.ts +2 -0
- package/dist/types/src/constants.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +5 -6
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +34 -19
- package/src/NativePlugin.tsx +25 -23
- package/src/capabilities/index.ts +4 -3
- package/src/capabilities/ollama.ts +32 -23
- package/src/capabilities/spotlight-listener.ts +58 -0
- package/src/capabilities/updater.ts +107 -57
- package/src/constants.ts +7 -0
- package/src/meta.ts +8 -5
- package/src/translations.ts +5 -5
- package/dist/lib/browser/chunk-E2JDGVJI.mjs +0 -12
- package/dist/lib/browser/chunk-E2JDGVJI.mjs.map +0 -7
- package/dist/lib/browser/ollama-MF7YNEDS.mjs +0 -73
- package/dist/lib/browser/ollama-MF7YNEDS.mjs.map +0 -7
- package/dist/lib/browser/updater-MCAQYHED.mjs +0 -133
- package/dist/lib/browser/updater-MCAQYHED.mjs.map +0 -7
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
NATIVE_PLUGIN
|
|
3
|
-
} from "./chunk-E2JDGVJI.mjs";
|
|
4
|
-
|
|
5
|
-
// src/capabilities/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 { Duration, Effect, Fiber, Match, Schedule, pipe } from "effect";
|
|
10
|
-
import { Capabilities, LayoutAction, contributes, createIntent } from "@dxos/app-framework";
|
|
11
|
-
import { log } from "@dxos/log";
|
|
12
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-native/src/capabilities/updater.ts";
|
|
13
|
-
var SUPPORTS_OTA = [
|
|
14
|
-
"linux",
|
|
15
|
-
"macos",
|
|
16
|
-
"windows"
|
|
17
|
-
];
|
|
18
|
-
var updater_default = (context) => {
|
|
19
|
-
const platform = type();
|
|
20
|
-
if (!SUPPORTS_OTA.includes(platform)) {
|
|
21
|
-
return contributes(Capabilities.Null, null);
|
|
22
|
-
}
|
|
23
|
-
const { dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
24
|
-
const action = Effect.gen(function* () {
|
|
25
|
-
log.info("checking for updates", void 0, {
|
|
26
|
-
F: __dxlog_file,
|
|
27
|
-
L: 27,
|
|
28
|
-
S: this,
|
|
29
|
-
C: (f, a) => f(...a)
|
|
30
|
-
});
|
|
31
|
-
const update = yield* Effect.tryPromise(() => check());
|
|
32
|
-
log.info("checked for updates", {
|
|
33
|
-
version: update?.version,
|
|
34
|
-
currentVersion: update?.currentVersion
|
|
35
|
-
}, {
|
|
36
|
-
F: __dxlog_file,
|
|
37
|
-
L: 29,
|
|
38
|
-
S: this,
|
|
39
|
-
C: (f, a) => f(...a)
|
|
40
|
-
});
|
|
41
|
-
if (update) {
|
|
42
|
-
log.info("update available", update, {
|
|
43
|
-
F: __dxlog_file,
|
|
44
|
-
L: 31,
|
|
45
|
-
S: this,
|
|
46
|
-
C: (f, a) => f(...a)
|
|
47
|
-
});
|
|
48
|
-
let downloaded = 0;
|
|
49
|
-
let contentLength = 0;
|
|
50
|
-
const handleDownload = Match.type().pipe(Match.when({
|
|
51
|
-
event: "Started"
|
|
52
|
-
}, (event) => {
|
|
53
|
-
contentLength = event.data.contentLength ?? 0;
|
|
54
|
-
log.info("download started", {
|
|
55
|
-
contentLength
|
|
56
|
-
}, {
|
|
57
|
-
F: __dxlog_file,
|
|
58
|
-
L: 38,
|
|
59
|
-
S: this,
|
|
60
|
-
C: (f, a) => f(...a)
|
|
61
|
-
});
|
|
62
|
-
}), Match.when({
|
|
63
|
-
event: "Progress"
|
|
64
|
-
}, (event) => {
|
|
65
|
-
downloaded += event.data.chunkLength;
|
|
66
|
-
log.info("download progress", {
|
|
67
|
-
downloaded,
|
|
68
|
-
contentLength
|
|
69
|
-
}, {
|
|
70
|
-
F: __dxlog_file,
|
|
71
|
-
L: 42,
|
|
72
|
-
S: this,
|
|
73
|
-
C: (f, a) => f(...a)
|
|
74
|
-
});
|
|
75
|
-
}), Match.when({
|
|
76
|
-
event: "Finished"
|
|
77
|
-
}, () => {
|
|
78
|
-
log.info("download completed", void 0, {
|
|
79
|
-
F: __dxlog_file,
|
|
80
|
-
L: 45,
|
|
81
|
-
S: this,
|
|
82
|
-
C: (f, a) => f(...a)
|
|
83
|
-
});
|
|
84
|
-
}), Match.exhaustive);
|
|
85
|
-
yield* Effect.tryPromise(() => update.downloadAndInstall(handleDownload));
|
|
86
|
-
yield* dispatch(createIntent(LayoutAction.AddToast, {
|
|
87
|
-
part: "toast",
|
|
88
|
-
subject: {
|
|
89
|
-
id: `${NATIVE_PLUGIN}/update-ready`,
|
|
90
|
-
title: [
|
|
91
|
-
"update ready label",
|
|
92
|
-
{
|
|
93
|
-
ns: NATIVE_PLUGIN
|
|
94
|
-
}
|
|
95
|
-
],
|
|
96
|
-
description: [
|
|
97
|
-
"update ready description",
|
|
98
|
-
{
|
|
99
|
-
ns: NATIVE_PLUGIN
|
|
100
|
-
}
|
|
101
|
-
],
|
|
102
|
-
duration: Infinity,
|
|
103
|
-
actionLabel: [
|
|
104
|
-
"update label",
|
|
105
|
-
{
|
|
106
|
-
ns: NATIVE_PLUGIN
|
|
107
|
-
}
|
|
108
|
-
],
|
|
109
|
-
actionAlt: [
|
|
110
|
-
"update alt",
|
|
111
|
-
{
|
|
112
|
-
ns: NATIVE_PLUGIN
|
|
113
|
-
}
|
|
114
|
-
],
|
|
115
|
-
onAction: () => relaunch()
|
|
116
|
-
}
|
|
117
|
-
}));
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
const fiber = pipe(
|
|
121
|
-
// prettier-ignore
|
|
122
|
-
action,
|
|
123
|
-
Effect.repeat(Schedule.fixed(Duration.hours(1))),
|
|
124
|
-
Effect.runFork
|
|
125
|
-
);
|
|
126
|
-
return contributes(Capabilities.Null, null, () => {
|
|
127
|
-
Effect.runSync(Fiber.interrupt(fiber));
|
|
128
|
-
});
|
|
129
|
-
};
|
|
130
|
-
export {
|
|
131
|
-
updater_default as default
|
|
132
|
-
};
|
|
133
|
-
//# sourceMappingURL=updater-MCAQYHED.mjs.map
|
|
@@ -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,c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aC,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
|
-
}
|