@dxos/plugin-native 0.8.4-main.937b3ca → 0.8.4-main.abd8ff62ef
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/NativePlugin-QANFCCIM.mjs +28 -0
- package/dist/lib/browser/NativePlugin-QANFCCIM.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +14 -51
- 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 +1 -0
- package/dist/types/src/NativePlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +4 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/ollama.d.ts +7 -0
- package/dist/types/src/capabilities/ollama.d.ts.map +1 -0
- 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 +5 -0
- package/dist/types/src/capabilities/updater.d.ts.map +1 -0
- package/dist/types/src/constants.d.ts +2 -0
- package/dist/types/src/constants.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +2 -2
- package/dist/types/src/index.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 +28 -18
- package/src/NativePlugin.tsx +15 -12
- package/src/capabilities/index.ts +5 -3
- package/src/capabilities/{ollama/ollama.ts → ollama.ts} +4 -3
- package/src/capabilities/spotlight-listener.ts +58 -0
- package/src/capabilities/updater.ts +129 -0
- package/src/constants.ts +7 -0
- package/src/index.ts +6 -2
- package/src/meta.ts +1 -1
- package/src/translations.ts +5 -5
- package/dist/lib/browser/chunk-6374DBU4.mjs +0 -15
- package/dist/lib/browser/chunk-6374DBU4.mjs.map +0 -7
- package/dist/lib/browser/ollama-KSB3XG6S.mjs +0 -74
- 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 +0 -38
- package/dist/lib/browser/window-JDFVLF4U.mjs.map +0 -7
- package/dist/types/src/capabilities/ollama/index.d.ts +0 -3
- package/dist/types/src/capabilities/ollama/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/ollama/ollama.d.ts +0 -6
- package/dist/types/src/capabilities/ollama/ollama.d.ts.map +0 -1
- package/dist/types/src/capabilities/updater/index.d.ts +0 -3
- package/dist/types/src/capabilities/updater/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/updater/updater.d.ts +0 -5
- package/dist/types/src/capabilities/updater/updater.d.ts.map +0 -1
- package/dist/types/src/capabilities/window/index.d.ts +0 -3
- package/dist/types/src/capabilities/window/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/window/window.d.ts +0 -11
- package/dist/types/src/capabilities/window/window.d.ts.map +0 -1
- package/src/capabilities/ollama/index.ts +0 -7
- package/src/capabilities/updater/index.ts +0 -7
- package/src/capabilities/updater/updater.ts +0 -82
- package/src/capabilities/window/index.ts +0 -7
- package/src/capabilities/window/window.ts +0 -72
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.abd8ff62ef",
|
|
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",
|
|
@@ -12,45 +12,55 @@
|
|
|
12
12
|
"author": "DXOS.org",
|
|
13
13
|
"sideEffects": true,
|
|
14
14
|
"type": "module",
|
|
15
|
+
"imports": {
|
|
16
|
+
"#capabilities": "./src/capabilities/index.ts",
|
|
17
|
+
"#meta": "./src/meta.ts",
|
|
18
|
+
"#translations": "./src/translations.ts"
|
|
19
|
+
},
|
|
15
20
|
"exports": {
|
|
16
21
|
".": {
|
|
17
22
|
"source": "./src/index.ts",
|
|
18
23
|
"types": "./dist/types/src/index.d.ts",
|
|
19
24
|
"browser": "./dist/lib/browser/index.mjs"
|
|
25
|
+
},
|
|
26
|
+
"./translations": {
|
|
27
|
+
"source": "./src/translations.ts",
|
|
28
|
+
"types": "./dist/types/src/translations.d.ts",
|
|
29
|
+
"browser": "./dist/lib/browser/translations.mjs",
|
|
30
|
+
"node": "./dist/lib/node-esm/translations.mjs"
|
|
20
31
|
}
|
|
21
32
|
},
|
|
22
33
|
"types": "dist/types/src/index.d.ts",
|
|
23
|
-
"typesVersions": {
|
|
24
|
-
"*": {}
|
|
25
|
-
},
|
|
26
34
|
"files": [
|
|
27
35
|
"dist",
|
|
28
36
|
"src"
|
|
29
37
|
],
|
|
30
38
|
"dependencies": {
|
|
31
|
-
"@effect/platform": "0.
|
|
39
|
+
"@effect/platform": "0.94.4",
|
|
32
40
|
"@tauri-apps/api": "^2.8.0",
|
|
33
41
|
"@tauri-apps/plugin-os": "^2.3.1",
|
|
34
42
|
"@tauri-apps/plugin-process": "^2.3.0",
|
|
35
43
|
"@tauri-apps/plugin-shell": "^2.3.1",
|
|
36
44
|
"@tauri-apps/plugin-updater": "^2.9.0",
|
|
37
|
-
"effect": "3.
|
|
38
|
-
"@dxos/ai": "0.8.4-main.
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/app-
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/plugin-navtree": "0.8.4-main.
|
|
45
|
-
"@dxos/
|
|
45
|
+
"effect": "3.20.0",
|
|
46
|
+
"@dxos/ai": "0.8.4-main.abd8ff62ef",
|
|
47
|
+
"@dxos/app-framework": "0.8.4-main.abd8ff62ef",
|
|
48
|
+
"@dxos/app-toolkit": "0.8.4-main.abd8ff62ef",
|
|
49
|
+
"@dxos/log": "0.8.4-main.abd8ff62ef",
|
|
50
|
+
"@dxos/operation": "0.8.4-main.abd8ff62ef",
|
|
51
|
+
"@dxos/plugin-help": "0.8.4-main.abd8ff62ef",
|
|
52
|
+
"@dxos/plugin-navtree": "0.8.4-main.abd8ff62ef",
|
|
53
|
+
"@dxos/plugin-assistant": "0.8.4-main.abd8ff62ef",
|
|
54
|
+
"@dxos/util": "0.8.4-main.abd8ff62ef"
|
|
46
55
|
},
|
|
47
56
|
"devDependencies": {
|
|
48
|
-
"vite": "
|
|
49
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
57
|
+
"vite": "^8.0.10",
|
|
58
|
+
"@dxos/react-ui": "0.8.4-main.abd8ff62ef",
|
|
59
|
+
"@dxos/plugin-testing": "0.8.4-main.abd8ff62ef"
|
|
50
60
|
},
|
|
51
61
|
"peerDependencies": {
|
|
52
|
-
"effect": "3.
|
|
53
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
62
|
+
"effect": "3.20.0",
|
|
63
|
+
"@dxos/react-ui": "0.8.4-main.abd8ff62ef"
|
|
54
64
|
},
|
|
55
65
|
"publishConfig": {
|
|
56
66
|
"access": "public"
|
package/src/NativePlugin.tsx
CHANGED
|
@@ -2,24 +2,25 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { ActivationEvents, Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { AppPlugin } from '@dxos/app-toolkit';
|
|
7
|
+
import { AssistantEvents } from '@dxos/plugin-assistant/types';
|
|
7
8
|
|
|
8
|
-
import { Ollama,
|
|
9
|
-
import { meta } from '
|
|
10
|
-
import { translations } from '
|
|
9
|
+
import { Ollama, SpotlightListener, Updater } from '#capabilities';
|
|
10
|
+
import { meta } from '#meta';
|
|
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
|
-
id: '
|
|
16
|
-
activatesOn:
|
|
17
|
-
activate:
|
|
16
|
+
id: 'spotlight-listener',
|
|
17
|
+
activatesOn: ActivationEvents.OperationInvokerReady,
|
|
18
|
+
activate: SpotlightListener,
|
|
18
19
|
}),
|
|
19
20
|
Plugin.addModule({
|
|
20
|
-
id: '
|
|
21
|
-
activatesOn:
|
|
22
|
-
activate:
|
|
21
|
+
id: 'updater',
|
|
22
|
+
activatesOn: ActivationEvents.OperationInvokerReady,
|
|
23
|
+
activate: Updater,
|
|
23
24
|
}),
|
|
24
25
|
Plugin.addModule({
|
|
25
26
|
id: 'ollama',
|
|
@@ -28,3 +29,5 @@ export const NativePlugin = Plugin.define(meta).pipe(
|
|
|
28
29
|
}),
|
|
29
30
|
Plugin.make,
|
|
30
31
|
);
|
|
32
|
+
|
|
33
|
+
export default NativePlugin;
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export
|
|
5
|
+
import { Capability } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
export const Ollama = Capability.lazy('Ollama', () => import('./ollama'));
|
|
8
|
+
export const SpotlightListener = Capability.lazy('SpotlightListener', () => import('./spotlight-listener'));
|
|
9
|
+
export const Updater = Capability.lazy('Updater', () => import('./updater'));
|
|
@@ -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
|
);
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
9
|
+
import { log } from '@dxos/log';
|
|
10
|
+
|
|
11
|
+
// TODO(wittjosiah): Formalize with a stricter schema if we evolve this protocol.
|
|
12
|
+
type SpotlightInvokePayload = {
|
|
13
|
+
operation: string;
|
|
14
|
+
payload?: Record<string, any>;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Listens for spotlight:invoke events from the popover window and dispatches the corresponding operation.
|
|
19
|
+
*/
|
|
20
|
+
export default Capability.makeModule(
|
|
21
|
+
Effect.fnUntraced(function* () {
|
|
22
|
+
const { invokePromise } = yield* Capability.get(Capabilities.OperationInvoker);
|
|
23
|
+
|
|
24
|
+
const unlisten = yield* Effect.promise(async () => {
|
|
25
|
+
const { listen } = await import('@tauri-apps/api/event');
|
|
26
|
+
const { getCurrentWindow } = await import('@tauri-apps/api/window');
|
|
27
|
+
|
|
28
|
+
return listen<SpotlightInvokePayload>('spotlight:invoke', async (event) => {
|
|
29
|
+
const { operation, payload } = event.payload;
|
|
30
|
+
log.info('Received spotlight invoke event', { operation, payload });
|
|
31
|
+
try {
|
|
32
|
+
switch (operation) {
|
|
33
|
+
case 'open':
|
|
34
|
+
await invokePromise(LayoutOperation.Open, payload as any);
|
|
35
|
+
break;
|
|
36
|
+
case 'switch-workspace':
|
|
37
|
+
await invokePromise(LayoutOperation.SwitchWorkspace, payload as any);
|
|
38
|
+
break;
|
|
39
|
+
default:
|
|
40
|
+
log.warn('Unknown spotlight operation', { operation });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const mainWindow = getCurrentWindow();
|
|
44
|
+
await mainWindow.show();
|
|
45
|
+
await mainWindow.setFocus();
|
|
46
|
+
} catch (err) {
|
|
47
|
+
log.catch(err);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
return Capability.contributes(Capabilities.Null, null, () =>
|
|
53
|
+
Effect.sync(() => {
|
|
54
|
+
unlisten();
|
|
55
|
+
}),
|
|
56
|
+
);
|
|
57
|
+
}),
|
|
58
|
+
);
|
|
@@ -0,0 +1,129 @@
|
|
|
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 * as Updater 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 Match from 'effect/Match';
|
|
12
|
+
import * as Schedule from 'effect/Schedule';
|
|
13
|
+
|
|
14
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
15
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
16
|
+
import { log } from '@dxos/log';
|
|
17
|
+
|
|
18
|
+
import { meta } from '#meta';
|
|
19
|
+
|
|
20
|
+
import { TAURI_LOCALHOST_PORT } from '../constants';
|
|
21
|
+
|
|
22
|
+
const SUPPORTS_OTA = ['linux', 'macos', 'windows'];
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Safely check for updates with error logging.
|
|
26
|
+
*/
|
|
27
|
+
const check = async (): Promise<Updater.Update | null> => {
|
|
28
|
+
try {
|
|
29
|
+
return await Updater.check();
|
|
30
|
+
} catch (error) {
|
|
31
|
+
log.error('failed to check for updates', { error });
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Safely download and install update with error logging.
|
|
38
|
+
*/
|
|
39
|
+
const downloadAndInstall = async (
|
|
40
|
+
update: Updater.Update,
|
|
41
|
+
handleDownload: (event: Updater.DownloadEvent) => void,
|
|
42
|
+
): Promise<boolean> => {
|
|
43
|
+
try {
|
|
44
|
+
await update.downloadAndInstall(handleDownload);
|
|
45
|
+
return true;
|
|
46
|
+
} catch (error) {
|
|
47
|
+
log.error('failed to download and install update', { error });
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default Capability.makeModule(
|
|
53
|
+
Effect.fnUntraced(function* () {
|
|
54
|
+
// Skip updates if not supported or in dev mode.
|
|
55
|
+
const platform = type();
|
|
56
|
+
const isDevServer = window.location.port !== TAURI_LOCALHOST_PORT;
|
|
57
|
+
if (!SUPPORTS_OTA.includes(platform) || isDevServer) {
|
|
58
|
+
log.info('skipping updater', { platform, port: window.location.port });
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const { invoke } = yield* Capability.get(Capabilities.OperationInvoker);
|
|
63
|
+
|
|
64
|
+
// https://tauri.app/plugin/updater/#checking-for-updates
|
|
65
|
+
// Returns true to keep checking, false to stop.
|
|
66
|
+
const action = Effect.gen(function* () {
|
|
67
|
+
log.info('checking for updates');
|
|
68
|
+
const update = yield* Effect.promise(() => check());
|
|
69
|
+
if (!update) {
|
|
70
|
+
log.info('no update available');
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
log.info('update check complete', {
|
|
74
|
+
available: update.available,
|
|
75
|
+
currentVersion: update.currentVersion,
|
|
76
|
+
version: update.version,
|
|
77
|
+
date: update.date,
|
|
78
|
+
body: update.body,
|
|
79
|
+
});
|
|
80
|
+
if (update.available) {
|
|
81
|
+
log.info('update available, starting download', { version: update.version });
|
|
82
|
+
let downloaded = 0;
|
|
83
|
+
let contentLength = 0;
|
|
84
|
+
|
|
85
|
+
const handleDownload = Match.type<Updater.DownloadEvent>().pipe(
|
|
86
|
+
Match.when({ event: 'Started' }, (event) => {
|
|
87
|
+
contentLength = event.data.contentLength ?? 0;
|
|
88
|
+
log.info('download started', { contentLength });
|
|
89
|
+
}),
|
|
90
|
+
Match.when({ event: 'Progress' }, (event) => {
|
|
91
|
+
downloaded += event.data.chunkLength;
|
|
92
|
+
log.verbose('download progress', { downloaded, contentLength });
|
|
93
|
+
}),
|
|
94
|
+
Match.when({ event: 'Finished' }, () => {
|
|
95
|
+
log.info('download completed');
|
|
96
|
+
}),
|
|
97
|
+
Match.exhaustive,
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
const downloadSuccess = yield* Effect.promise(() => downloadAndInstall(update, handleDownload));
|
|
101
|
+
|
|
102
|
+
if (downloadSuccess) {
|
|
103
|
+
yield* invoke(LayoutOperation.AddToast, {
|
|
104
|
+
id: `${meta.id}.update-ready`,
|
|
105
|
+
title: ['update-ready.label', { ns: meta.id }],
|
|
106
|
+
description: ['update-ready.description', { ns: meta.id }],
|
|
107
|
+
duration: Infinity,
|
|
108
|
+
actionLabel: ['update.label', { ns: meta.id }],
|
|
109
|
+
actionAlt: ['update.alt', { ns: meta.id }],
|
|
110
|
+
onAction: () => relaunch(),
|
|
111
|
+
});
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return true;
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// Run immediately on startup, then repeat every hour. Stop once an update is found.
|
|
119
|
+
const schedule = Schedule.fixed(Duration.hours(1)).pipe(
|
|
120
|
+
Schedule.whileInput((keepChecking: boolean) => keepChecking),
|
|
121
|
+
);
|
|
122
|
+
const fiber = yield* action.pipe(Effect.repeat(schedule), Effect.forkDaemon);
|
|
123
|
+
log.info('updater module initialized, update check scheduled');
|
|
124
|
+
|
|
125
|
+
return Capability.contributes(Capabilities.Null, null, () =>
|
|
126
|
+
Effect.sync(() => Effect.runSync(Fiber.interrupt(fiber))),
|
|
127
|
+
);
|
|
128
|
+
}),
|
|
129
|
+
);
|
package/src/constants.ts
ADDED
package/src/index.ts
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from './meta';
|
|
8
|
+
|
|
9
|
+
export const NativePlugin = Plugin.lazy(meta, () => import('./NativePlugin'));
|
|
10
|
+
|
|
6
11
|
export * from './meta';
|
|
7
|
-
export * from './NativePlugin';
|
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.
|
package/src/translations.ts
CHANGED
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
6
|
|
|
7
|
-
import { meta } from '
|
|
7
|
+
import { meta } from '#meta';
|
|
8
8
|
|
|
9
9
|
export const translations = [
|
|
10
10
|
{
|
|
11
11
|
'en-US': {
|
|
12
12
|
[meta.id]: {
|
|
13
|
-
'update
|
|
14
|
-
'update
|
|
15
|
-
'update
|
|
16
|
-
'update
|
|
13
|
+
'update-ready.label': 'Ready to update',
|
|
14
|
+
'update-ready.description': 'A new version of Composer is available.',
|
|
15
|
+
'update.label': 'Update',
|
|
16
|
+
'update.alt': 'Relaunch the app to update',
|
|
17
17
|
},
|
|
18
18
|
},
|
|
19
19
|
},
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// src/meta.ts
|
|
2
|
-
import { trim } from "@dxos/util";
|
|
3
|
-
var meta = {
|
|
4
|
-
id: "dxos.org/plugin/native",
|
|
5
|
-
name: "Native",
|
|
6
|
-
description: trim`
|
|
7
|
-
Native platform integration providing desktop-specific features and system-level capabilities.
|
|
8
|
-
Access native file dialogs, notifications, and OS integrations.
|
|
9
|
-
`
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
meta
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=chunk-6374DBU4.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 Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'dxos.org/plugin/native',\n name: 'Native',\n description: trim`\n Native platform integration providing desktop-specific features and system-level capabilities.\n Access native file dialogs, notifications, and OS integrations.\n `,\n};\n"],
|
|
5
|
-
"mappings": ";AAKA,SAASA,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;AAIf;",
|
|
6
|
-
"names": ["trim", "meta", "id", "name", "description", "trim"]
|
|
7
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
// src/capabilities/ollama/ollama.ts
|
|
2
|
-
import * as FetchHttpClient from "@effect/platform/FetchHttpClient";
|
|
3
|
-
import * as HttpClient from "@effect/platform/HttpClient";
|
|
4
|
-
import { Command } from "@tauri-apps/plugin-shell";
|
|
5
|
-
import * as Context from "effect/Context";
|
|
6
|
-
import * as Effect from "effect/Effect";
|
|
7
|
-
import * as Layer from "effect/Layer";
|
|
8
|
-
import * as ManagedRuntime from "effect/ManagedRuntime";
|
|
9
|
-
import { OllamaResolver } from "@dxos/ai/resolvers";
|
|
10
|
-
import { Capability, Common } from "@dxos/app-framework";
|
|
11
|
-
import { log } from "@dxos/log";
|
|
12
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-native/src/capabilities/ollama/ollama.ts";
|
|
13
|
-
var OLLAMA_HOST = "http://localhost:21434";
|
|
14
|
-
var ollama_default = Capability.makeModule(() => Effect.sync(() => {
|
|
15
|
-
const runtime = ManagedRuntime.make(OllamaSidecar.layerLive);
|
|
16
|
-
const sidecarLayer = Layer.effectContext(runtime.runtimeEffect.pipe(Effect.map((rt) => rt.context.pipe(Context.pick(OllamaSidecar)))));
|
|
17
|
-
return Capability.contributes(Common.Capability.AiModelResolver, OllamaSidecarModelResolver.pipe(Layer.provide(sidecarLayer)), () => Effect.tryPromise(() => runtime.dispose()));
|
|
18
|
-
}));
|
|
19
|
-
var OllamaSidecar = class _OllamaSidecar extends Context.Tag("@dxos/plugin-native/OllamaSidecar")() {
|
|
20
|
-
static layerLive = Layer.scoped(_OllamaSidecar, Effect.gen(function* () {
|
|
21
|
-
const command = Command.sidecar("sidecar/ollama", [
|
|
22
|
-
"serve"
|
|
23
|
-
], {
|
|
24
|
-
env: {
|
|
25
|
-
OLLAMA_HOST,
|
|
26
|
-
OLLAMA_ORIGINS: "*"
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
command.stdout.on("data", (data) => console.log("[ollama]", data.toString()));
|
|
30
|
-
command.stderr.on("data", (data) => console.error("[ollama]", data.toString()));
|
|
31
|
-
command.on("close", (code) => log.info("Ollama process exited", {
|
|
32
|
-
code
|
|
33
|
-
}, {
|
|
34
|
-
F: __dxlog_file,
|
|
35
|
-
L: 61,
|
|
36
|
-
S: this,
|
|
37
|
-
C: (f, a) => f(...a)
|
|
38
|
-
}));
|
|
39
|
-
command.on("error", (error) => log.error("Ollama error", {
|
|
40
|
-
error
|
|
41
|
-
}, {
|
|
42
|
-
F: __dxlog_file,
|
|
43
|
-
L: 62,
|
|
44
|
-
S: this,
|
|
45
|
-
C: (f, a) => f(...a)
|
|
46
|
-
}));
|
|
47
|
-
const child = yield* Effect.promise(() => command.spawn());
|
|
48
|
-
yield* Effect.addFinalizer(Effect.fn(function* () {
|
|
49
|
-
yield* Effect.promise(() => child.kill());
|
|
50
|
-
}));
|
|
51
|
-
log.info("Running ollama", {
|
|
52
|
-
pid: child.pid
|
|
53
|
-
}, {
|
|
54
|
-
F: __dxlog_file,
|
|
55
|
-
L: 69,
|
|
56
|
-
S: this,
|
|
57
|
-
C: (f, a) => f(...a)
|
|
58
|
-
});
|
|
59
|
-
return {
|
|
60
|
-
endpoint: OLLAMA_HOST
|
|
61
|
-
};
|
|
62
|
-
}));
|
|
63
|
-
};
|
|
64
|
-
var OllamaSidecarModelResolver = Layer.unwrapEffect(Effect.gen(function* () {
|
|
65
|
-
const { endpoint } = yield* OllamaSidecar;
|
|
66
|
-
return OllamaResolver.make({
|
|
67
|
-
endpoint,
|
|
68
|
-
transformClient: HttpClient.withTracerPropagation(false)
|
|
69
|
-
});
|
|
70
|
-
})).pipe(Layer.provide(FetchHttpClient.layer));
|
|
71
|
-
export {
|
|
72
|
-
ollama_default as default
|
|
73
|
-
};
|
|
74
|
-
//# sourceMappingURL=ollama-KSB3XG6S.mjs.map
|
|
@@ -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
|