@dxos/plugin-native 0.8.4-main.406dc2a → 0.8.4-main.4a85c3132b
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 +15 -0
- package/dist/lib/browser/chunk-6374DBU4.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +33 -30
- 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-AR27PYM4.mjs +190 -0
- package/dist/lib/browser/updater-AR27PYM4.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 -3
- 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 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +20 -14
- package/src/NativePlugin.tsx +14 -16
- package/src/capabilities/index.ts +3 -5
- package/src/capabilities/ollama/index.ts +7 -0
- package/src/capabilities/{ollama.ts → ollama/ollama.ts} +26 -20
- 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 +7 -2
- package/dist/lib/browser/chunk-HFW3KCZU.mjs +0 -10
- package/dist/lib/browser/chunk-HFW3KCZU.mjs.map +0 -7
- package/dist/lib/browser/ollama-FWIW4XTL.mjs +0 -90
- package/dist/lib/browser/ollama-FWIW4XTL.mjs.map +0 -7
- package/dist/lib/browser/updater-3XUIXC4F.mjs +0 -138
- package/dist/lib/browser/updater-3XUIXC4F.mjs.map +0 -7
- package/dist/lib/browser/window-6G542FZL.mjs +0 -34
- package/dist/lib/browser/window-6G542FZL.mjs.map +0 -7
- package/dist/types/src/capabilities/ollama.d.ts +0 -4
- package/dist/types/src/capabilities/ollama.d.ts.map +0 -1
- package/dist/types/src/capabilities/updater.d.ts +0 -4
- package/dist/types/src/capabilities/updater.d.ts.map +0 -1
- package/dist/types/src/capabilities/window.d.ts +0 -4
- package/dist/types/src/capabilities/window.d.ts.map +0 -1
- package/src/capabilities/updater.ts +0 -85
- package/src/capabilities/window.ts +0 -49
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
meta
|
|
3
|
-
} from "./chunk-HFW3KCZU.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 * 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 { Capabilities, LayoutAction, contributes, createIntent } from "@dxos/app-framework";
|
|
16
|
-
import { log } from "@dxos/log";
|
|
17
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-native/src/capabilities/updater.ts";
|
|
18
|
-
var SUPPORTS_OTA = [
|
|
19
|
-
"linux",
|
|
20
|
-
"macos",
|
|
21
|
-
"windows"
|
|
22
|
-
];
|
|
23
|
-
var updater_default = ((context) => {
|
|
24
|
-
const platform = type();
|
|
25
|
-
if (!SUPPORTS_OTA.includes(platform) || window.location.hostname === "localhost") {
|
|
26
|
-
return contributes(Capabilities.Null, null);
|
|
27
|
-
}
|
|
28
|
-
const { dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
29
|
-
const action = Effect.gen(function* () {
|
|
30
|
-
log.info("checking for updates", void 0, {
|
|
31
|
-
F: __dxlog_file,
|
|
32
|
-
L: 33,
|
|
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: 35,
|
|
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: 37,
|
|
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: 44,
|
|
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: 48,
|
|
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: 51,
|
|
86
|
-
S: this,
|
|
87
|
-
C: (f, a) => f(...a)
|
|
88
|
-
});
|
|
89
|
-
}), Match.exhaustive);
|
|
90
|
-
yield* Effect.tryPromise(() => update.downloadAndInstall(handleDownload));
|
|
91
|
-
yield* dispatch(createIntent(LayoutAction.AddToast, {
|
|
92
|
-
part: "toast",
|
|
93
|
-
subject: {
|
|
94
|
-
id: `${meta.id}/update-ready`,
|
|
95
|
-
title: [
|
|
96
|
-
"update ready label",
|
|
97
|
-
{
|
|
98
|
-
ns: meta.id
|
|
99
|
-
}
|
|
100
|
-
],
|
|
101
|
-
description: [
|
|
102
|
-
"update ready description",
|
|
103
|
-
{
|
|
104
|
-
ns: meta.id
|
|
105
|
-
}
|
|
106
|
-
],
|
|
107
|
-
duration: Infinity,
|
|
108
|
-
actionLabel: [
|
|
109
|
-
"update label",
|
|
110
|
-
{
|
|
111
|
-
ns: meta.id
|
|
112
|
-
}
|
|
113
|
-
],
|
|
114
|
-
actionAlt: [
|
|
115
|
-
"update alt",
|
|
116
|
-
{
|
|
117
|
-
ns: meta.id
|
|
118
|
-
}
|
|
119
|
-
],
|
|
120
|
-
onAction: () => relaunch()
|
|
121
|
-
}
|
|
122
|
-
}));
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
const fiber = Function.pipe(
|
|
126
|
-
// prettier-ignore
|
|
127
|
-
action,
|
|
128
|
-
Effect.repeat(Schedule.fixed(Duration.hours(1))),
|
|
129
|
-
Effect.runFork
|
|
130
|
-
);
|
|
131
|
-
return contributes(Capabilities.Null, null, () => {
|
|
132
|
-
Effect.runSync(Fiber.interrupt(fiber));
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
export {
|
|
136
|
-
updater_default as default
|
|
137
|
-
};
|
|
138
|
-
//# sourceMappingURL=updater-3XUIXC4F.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 * 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 { Capabilities, LayoutAction, type PluginContext, contributes, createIntent } from '@dxos/app-framework';\nimport { log } from '@dxos/log';\n\nimport { meta } from '../meta';\n\nconst SUPPORTS_OTA = ['linux', 'macos', 'windows'];\n\nexport default (context: PluginContext) => {\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 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.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* dispatch(\n createIntent(LayoutAction.AddToast, {\n part: 'toast',\n subject: {\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\n const fiber = Function.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,YAAYC,cAAc;AAC1B,YAAYC,YAAY;AACxB,YAAYC,WAAW;AACvB,YAAYC,cAAc;AAC1B,YAAYC,WAAW;AACvB,YAAYC,cAAc;AAE1B,SAASC,cAAcC,cAAkCC,aAAaC,oBAAoB;AAC1F,SAASC,WAAW;;AAIpB,IAAMC,eAAe;EAAC;EAAS;EAAS;;AAExC,IAAA,mBAAe,CAACC,YAAAA;AAEd,QAAMC,WAAWC,KAAAA;AACjB,MAAI,CAACH,aAAaI,SAASF,QAAAA,KAAaG,OAAOC,SAASC,aAAa,aAAa;AAChF,WAAOC,YAAYC,aAAaC,MAAM,IAAA;EACxC;AAEA,QAAM,EAAEC,SAAQ,IAAKV,QAAQW,cAAcH,aAAaI,gBAAgB;AAGxE,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,iBAAuBtB,WAAI,EAAkBuB,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,aAAOd,SACLuB,aAAaC,aAAaC,UAAU;QAClCC,MAAM;QACNC,SAAS;UACPC,IAAI,GAAGC,KAAKD,EAAE;UACdE,OAAO;YAAC;YAAsB;cAAEC,IAAIF,KAAKD;YAAG;;UAC5CI,aAAa;YAAC;YAA4B;cAAED,IAAIF,KAAKD;YAAG;;UACxDK,UAAUC;UACVC,aAAa;YAAC;YAAgB;cAAEJ,IAAIF,KAAKD;YAAG;;UAC5CQ,WAAW;YAAC;YAAc;cAAEL,IAAIF,KAAKD;YAAG;;UACxCS,UAAU,MAAMC,SAAAA;QAClB;MACF,CAAA,CAAA;IAEJ;EACF,CAAA;AAEA,QAAMC,QAAiBxB;;IAErBZ;IACOqC,cAAgBC,eAAeC,eAAM,CAAA,CAAA,CAAA;IACrCC;EAAO;AAGhB,SAAO9C,YAAYC,aAAaC,MAAM,MAAM,MAAA;AAC1C6C,IAAOC,eAAcC,gBAAUP,KAAAA,CAAAA;EACjC,CAAA;AACF;",
|
|
6
|
-
"names": ["type", "relaunch", "check", "Duration", "Effect", "Fiber", "Function", "Match", "Schedule", "Capabilities", "LayoutAction", "contributes", "createIntent", "log", "SUPPORTS_OTA", "context", "platform", "type", "includes", "window", "location", "hostname", "contributes", "Capabilities", "Null", "dispatch", "getCapability", "IntentDispatcher", "action", "gen", "log", "info", "update", "tryPromise", "check", "version", "currentVersion", "downloaded", "contentLength", "handleDownload", "pipe", "when", "event", "data", "chunkLength", "verbose", "exhaustive", "downloadAndInstall", "createIntent", "LayoutAction", "AddToast", "part", "subject", "id", "meta", "title", "ns", "description", "duration", "Infinity", "actionLabel", "actionAlt", "onAction", "relaunch", "fiber", "repeat", "fixed", "hours", "runFork", "Effect", "runSync", "interrupt"]
|
|
7
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// src/capabilities/window.ts
|
|
2
|
-
import { LogicalPosition, LogicalSize, getCurrentWindow } from "@tauri-apps/api/window";
|
|
3
|
-
import { Capabilities, contributes } from "@dxos/app-framework";
|
|
4
|
-
var window_default = ((_context) => {
|
|
5
|
-
return contributes(Capabilities.Null, null, () => {
|
|
6
|
-
const appWindow = getCurrentWindow();
|
|
7
|
-
async function saveWindowState() {
|
|
8
|
-
const size = await appWindow.innerSize();
|
|
9
|
-
const position = await appWindow.innerPosition();
|
|
10
|
-
localStorage.setItem("windowState", JSON.stringify({
|
|
11
|
-
width: size.width,
|
|
12
|
-
height: size.height,
|
|
13
|
-
x: position.x,
|
|
14
|
-
y: position.y
|
|
15
|
-
}));
|
|
16
|
-
}
|
|
17
|
-
async function restoreWindowState() {
|
|
18
|
-
const savedState = localStorage.getItem("windowState");
|
|
19
|
-
if (savedState) {
|
|
20
|
-
const state = JSON.parse(savedState);
|
|
21
|
-
await appWindow.setSize(new LogicalSize(state.width, state.height));
|
|
22
|
-
await appWindow.setPosition(new LogicalPosition(state.x, state.y));
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
void appWindow.listen("tauri://resize", saveWindowState);
|
|
26
|
-
void appWindow.listen("tauri://move", saveWindowState);
|
|
27
|
-
document.addEventListener("DOMContentLoaded", restoreWindowState);
|
|
28
|
-
window.addEventListener("beforeunload", saveWindowState);
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
export {
|
|
32
|
-
window_default as default
|
|
33
|
-
};
|
|
34
|
-
//# sourceMappingURL=window-6G542FZL.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/window.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { LogicalPosition, LogicalSize, getCurrentWindow } from '@tauri-apps/api/window';\n\nimport { Capabilities, type PluginContext, contributes } from '@dxos/app-framework';\n\nexport default (_context: PluginContext) => {\n return contributes(Capabilities.Null, null, () => {\n const appWindow = getCurrentWindow();\n\n // Save window state to localStorage.\n async function saveWindowState() {\n const size = await appWindow.innerSize();\n const position = await appWindow.innerPosition();\n localStorage.setItem(\n 'windowState',\n JSON.stringify({\n width: size.width,\n height: size.height,\n x: position.x,\n y: position.y,\n }),\n );\n }\n\n // Restore window state from localStorage.\n async function restoreWindowState() {\n const savedState = localStorage.getItem('windowState');\n if (savedState) {\n const state = JSON.parse(savedState);\n\n await appWindow.setSize(new LogicalSize(state.width, state.height));\n await appWindow.setPosition(new LogicalPosition(state.x, state.y));\n }\n }\n\n // Listen for window events and save state.\n void appWindow.listen('tauri://resize', saveWindowState);\n void appWindow.listen('tauri://move', saveWindowState);\n\n // Restore state when app loads.\n document.addEventListener('DOMContentLoaded', restoreWindowState);\n\n // Save state before closing.\n window.addEventListener('beforeunload', saveWindowState);\n });\n};\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,iBAAiBC,aAAaC,wBAAwB;AAE/D,SAASC,cAAkCC,mBAAmB;AAE9D,IAAA,kBAAe,CAACC,aAAAA;AACd,SAAOC,YAAYC,aAAaC,MAAM,MAAM,MAAA;AAC1C,UAAMC,YAAYC,iBAAAA;AAGlB,mBAAeC,kBAAAA;AACb,YAAMC,OAAO,MAAMH,UAAUI,UAAS;AACtC,YAAMC,WAAW,MAAML,UAAUM,cAAa;AAC9CC,mBAAaC,QACX,eACAC,KAAKC,UAAU;QACbC,OAAOR,KAAKQ;QACZC,QAAQT,KAAKS;QACbC,GAAGR,SAASQ;QACZC,GAAGT,SAASS;MACd,CAAA,CAAA;IAEJ;AAGA,mBAAeC,qBAAAA;AACb,YAAMC,aAAaT,aAAaU,QAAQ,aAAA;AACxC,UAAID,YAAY;AACd,cAAME,QAAQT,KAAKU,MAAMH,UAAAA;AAEzB,cAAMhB,UAAUoB,QAAQ,IAAIC,YAAYH,MAAMP,OAAOO,MAAMN,MAAM,CAAA;AACjE,cAAMZ,UAAUsB,YAAY,IAAIC,gBAAgBL,MAAML,GAAGK,MAAMJ,CAAC,CAAA;MAClE;IACF;AAGA,SAAKd,UAAUwB,OAAO,kBAAkBtB,eAAAA;AACxC,SAAKF,UAAUwB,OAAO,gBAAgBtB,eAAAA;AAGtCuB,aAASC,iBAAiB,oBAAoBX,kBAAAA;AAG9CY,WAAOD,iBAAiB,gBAAgBxB,eAAAA;EAC1C,CAAA;AACF;",
|
|
6
|
-
"names": ["LogicalPosition", "LogicalSize", "getCurrentWindow", "Capabilities", "contributes", "_context", "contributes", "Capabilities", "Null", "appWindow", "getCurrentWindow", "saveWindowState", "size", "innerSize", "position", "innerPosition", "localStorage", "setItem", "JSON", "stringify", "width", "height", "x", "y", "restoreWindowState", "savedState", "getItem", "state", "parse", "setSize", "LogicalSize", "setPosition", "LogicalPosition", "listen", "document", "addEventListener", "window"]
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ollama.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/ollama.ts"],"names":[],"mappings":"AAaA,OAAO,EAAgB,KAAK,UAAU,EAAE,KAAK,aAAa,EAAe,MAAM,qBAAqB,CAAC;yBAMrF,UAAU,aAAa,KAAG,UAAU,CAAC,GAAG,CAAC;AAAzD,wBAeE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"updater.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/updater.ts"],"names":[],"mappings":"AAcA,OAAO,EAA8B,KAAK,aAAa,EAA6B,MAAM,qBAAqB,CAAC;yBAOhG,SAAS,aAAa;AAAtC,wBA+DE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/window.ts"],"names":[],"mappings":"AAMA,OAAO,EAAgB,KAAK,aAAa,EAAe,MAAM,qBAAqB,CAAC;yBAEpE,UAAU,aAAa;AAAvC,wBAwCE"}
|
|
@@ -1,85 +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 { type DownloadEvent, check } from '@tauri-apps/plugin-updater';
|
|
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';
|
|
14
|
-
|
|
15
|
-
import { Capabilities, LayoutAction, type PluginContext, contributes, createIntent } from '@dxos/app-framework';
|
|
16
|
-
import { log } from '@dxos/log';
|
|
17
|
-
|
|
18
|
-
import { meta } from '../meta';
|
|
19
|
-
|
|
20
|
-
const SUPPORTS_OTA = ['linux', 'macos', 'windows'];
|
|
21
|
-
|
|
22
|
-
export default (context: PluginContext) => {
|
|
23
|
-
// Skip updates if not supported or in dev mode.
|
|
24
|
-
const platform = type();
|
|
25
|
-
if (!SUPPORTS_OTA.includes(platform) || window.location.hostname === 'localhost') {
|
|
26
|
-
return contributes(Capabilities.Null, null);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const { dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
30
|
-
|
|
31
|
-
// https://tauri.app/plugin/updater/#checking-for-updates
|
|
32
|
-
const action = Effect.gen(function* () {
|
|
33
|
-
log.info('checking for updates');
|
|
34
|
-
const update = yield* Effect.tryPromise(() => check());
|
|
35
|
-
log.info('checked for updates', { version: update?.version, currentVersion: update?.currentVersion });
|
|
36
|
-
if (update) {
|
|
37
|
-
log.info('update available', update);
|
|
38
|
-
let downloaded = 0;
|
|
39
|
-
let contentLength = 0;
|
|
40
|
-
|
|
41
|
-
const handleDownload = Match.type<DownloadEvent>().pipe(
|
|
42
|
-
Match.when({ event: 'Started' }, (event) => {
|
|
43
|
-
contentLength = event.data.contentLength ?? 0;
|
|
44
|
-
log.info('download started', { contentLength });
|
|
45
|
-
}),
|
|
46
|
-
Match.when({ event: 'Progress' }, (event) => {
|
|
47
|
-
downloaded += event.data.chunkLength;
|
|
48
|
-
log.verbose('download progress', { downloaded, contentLength });
|
|
49
|
-
}),
|
|
50
|
-
Match.when({ event: 'Finished' }, () => {
|
|
51
|
-
log.info('download completed');
|
|
52
|
-
}),
|
|
53
|
-
Match.exhaustive,
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
yield* Effect.tryPromise(() => update.downloadAndInstall(handleDownload));
|
|
57
|
-
|
|
58
|
-
yield* dispatch(
|
|
59
|
-
createIntent(LayoutAction.AddToast, {
|
|
60
|
-
part: 'toast',
|
|
61
|
-
subject: {
|
|
62
|
-
id: `${meta.id}/update-ready`,
|
|
63
|
-
title: ['update ready label', { ns: meta.id }],
|
|
64
|
-
description: ['update ready description', { ns: meta.id }],
|
|
65
|
-
duration: Infinity,
|
|
66
|
-
actionLabel: ['update label', { ns: meta.id }],
|
|
67
|
-
actionAlt: ['update alt', { ns: meta.id }],
|
|
68
|
-
onAction: () => relaunch(),
|
|
69
|
-
},
|
|
70
|
-
}),
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
const fiber = Function.pipe(
|
|
76
|
-
// prettier-ignore
|
|
77
|
-
action,
|
|
78
|
-
Effect.repeat(Schedule.fixed(Duration.hours(1))),
|
|
79
|
-
Effect.runFork,
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
return contributes(Capabilities.Null, null, () => {
|
|
83
|
-
Effect.runSync(Fiber.interrupt(fiber));
|
|
84
|
-
});
|
|
85
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
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
|
-
};
|