@dxos/plugin-native 0.8.4-main.67995b8 → 0.8.4-main.69d29f4
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 -20
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/ollama-KSB3XG6S.mjs +74 -0
- package/dist/lib/browser/ollama-KSB3XG6S.mjs.map +7 -0
- package/dist/lib/browser/{updater-KSM3TUHI.mjs → updater-XQTSH4ZZ.mjs} +55 -55
- package/dist/lib/browser/updater-XQTSH4ZZ.mjs.map +7 -0
- package/dist/lib/browser/window-JDFVLF4U.mjs +38 -0
- package/dist/lib/browser/window-JDFVLF4U.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 +6 -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 +24 -14
- package/src/NativePlugin.tsx +22 -15
- package/src/capabilities/index.ts +3 -3
- package/src/capabilities/ollama/index.ts +7 -0
- package/src/capabilities/ollama/ollama.ts +87 -0
- package/src/capabilities/updater/index.ts +7 -0
- package/src/capabilities/updater/updater.ts +82 -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.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
|
@@ -0,0 +1,15 @@
|
|
|
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
|
|
@@ -0,0 +1,7 @@
|
|
|
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,14 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
|
-
NATIVE_PLUGIN,
|
|
3
2
|
meta
|
|
4
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6374DBU4.mjs";
|
|
5
4
|
|
|
6
|
-
// src/
|
|
7
|
-
import {
|
|
5
|
+
// src/capabilities/ollama/index.ts
|
|
6
|
+
import { Capability } from "@dxos/app-framework";
|
|
7
|
+
var Ollama = Capability.lazy("Ollama", () => import("./ollama-KSB3XG6S.mjs"));
|
|
8
|
+
|
|
9
|
+
// src/capabilities/updater/index.ts
|
|
10
|
+
import { Capability as Capability2 } from "@dxos/app-framework";
|
|
11
|
+
var Updater = Capability2.lazy("Updater", () => import("./updater-XQTSH4ZZ.mjs"));
|
|
8
12
|
|
|
9
|
-
// src/capabilities/index.ts
|
|
10
|
-
import {
|
|
11
|
-
var
|
|
13
|
+
// src/capabilities/window/index.ts
|
|
14
|
+
import { Capability as Capability3 } from "@dxos/app-framework";
|
|
15
|
+
var Window = Capability3.lazy("Window", () => import("./window-JDFVLF4U.mjs"));
|
|
16
|
+
|
|
17
|
+
// src/NativePlugin.tsx
|
|
18
|
+
import { Common, Plugin } from "@dxos/app-framework";
|
|
19
|
+
import { AssistantEvents } from "@dxos/plugin-assistant";
|
|
12
20
|
|
|
13
21
|
// src/translations.ts
|
|
14
22
|
var translations = [
|
|
@@ -25,21 +33,26 @@ var translations = [
|
|
|
25
33
|
];
|
|
26
34
|
|
|
27
35
|
// src/NativePlugin.tsx
|
|
28
|
-
var NativePlugin = ()
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
var NativePlugin = Plugin.define(meta).pipe(Common.Plugin.addTranslationsModule({
|
|
37
|
+
translations
|
|
38
|
+
}), Plugin.addModule({
|
|
39
|
+
id: "updater",
|
|
40
|
+
activatesOn: Common.ActivationEvent.OperationInvokerReady,
|
|
41
|
+
activate: Updater
|
|
42
|
+
}), Plugin.addModule({
|
|
43
|
+
id: "window",
|
|
44
|
+
activatesOn: Common.ActivationEvent.OperationInvokerReady,
|
|
45
|
+
activate: Window
|
|
46
|
+
}), Plugin.addModule({
|
|
47
|
+
id: "ollama",
|
|
48
|
+
activatesOn: AssistantEvents.SetupAiServiceProviders,
|
|
49
|
+
activate: Ollama
|
|
50
|
+
}), Plugin.make);
|
|
40
51
|
export {
|
|
41
|
-
NATIVE_PLUGIN,
|
|
42
52
|
NativePlugin,
|
|
53
|
+
Ollama,
|
|
54
|
+
Updater,
|
|
55
|
+
Window,
|
|
43
56
|
meta
|
|
44
57
|
};
|
|
45
58
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/
|
|
4
|
-
"sourcesContent": ["//\n// Copyright
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["
|
|
3
|
+
"sources": ["../../../src/capabilities/ollama/index.ts", "../../../src/capabilities/updater/index.ts", "../../../src/capabilities/window/index.ts", "../../../src/NativePlugin.tsx", "../../../src/translations.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n\nexport const Ollama = Capability.lazy('Ollama', () => import('./ollama'));\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n\nexport const Updater = Capability.lazy('Updater', () => import('./updater'));\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n\nexport const Window = Capability.lazy('Window', () => import('./window'));\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Common, Plugin } from '@dxos/app-framework';\nimport { AssistantEvents } from '@dxos/plugin-assistant';\n\nimport { Ollama, Updater, Window } from './capabilities';\nimport { meta } from './meta';\nimport { translations } from './translations';\n\nexport const NativePlugin = Plugin.define(meta).pipe(\n Common.Plugin.addTranslationsModule({ translations }),\n Plugin.addModule({\n id: 'updater',\n activatesOn: Common.ActivationEvent.OperationInvokerReady,\n activate: Updater,\n }),\n Plugin.addModule({\n id: 'window',\n activatesOn: Common.ActivationEvent.OperationInvokerReady,\n activate: Window,\n }),\n Plugin.addModule({\n id: 'ollama',\n activatesOn: AssistantEvents.SetupAiServiceProviders,\n activate: Ollama,\n }),\n Plugin.make,\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Resource } from '@dxos/react-ui';\n\nimport { meta } from './meta';\n\nexport const translations = [\n {\n 'en-US': {\n [meta.id]: {\n 'update ready label': 'Ready to update',\n 'update ready description': 'A new version of Composer is available.',\n 'update label': 'Update',\n 'update alt': 'Relaunch the app to update',\n },\n },\n },\n] as const satisfies Resource[];\n"],
|
|
5
|
+
"mappings": ";;;;;AAIA,SAASA,kBAAkB;AAEpB,IAAMC,SAASC,WAAWC,KAAK,UAAU,MAAM,OAAO,uBAAA,CAAA;;;ACF7D,SAASC,cAAAA,mBAAkB;AAEpB,IAAMC,UAAUC,YAAWC,KAAK,WAAW,MAAM,OAAO,wBAAA,CAAA;;;ACF/D,SAASC,cAAAA,mBAAkB;AAEpB,IAAMC,SAASC,YAAWC,KAAK,UAAU,MAAM,OAAO,uBAAA,CAAA;;;ACF7D,SAASC,QAAQC,cAAc;AAC/B,SAASC,uBAAuB;;;ACGzB,IAAMC,eAAe;EAC1B;IACE,SAAS;MACP,CAACC,KAAKC,EAAE,GAAG;QACT,sBAAsB;QACtB,4BAA4B;QAC5B,gBAAgB;QAChB,cAAc;MAChB;IACF;EACF;;;;ADPK,IAAMC,eAAeC,OAAOC,OAAOC,IAAAA,EAAMC,KAC9CC,OAAOJ,OAAOK,sBAAsB;EAAEC;AAAa,CAAA,GACnDN,OAAOO,UAAU;EACfC,IAAI;EACJC,aAAaL,OAAOM,gBAAgBC;EACpCC,UAAUC;AACZ,CAAA,GACAb,OAAOO,UAAU;EACfC,IAAI;EACJC,aAAaL,OAAOM,gBAAgBC;EACpCC,UAAUE;AACZ,CAAA,GACAd,OAAOO,UAAU;EACfC,IAAI;EACJC,aAAaM,gBAAgBC;EAC7BJ,UAAUK;AACZ,CAAA,GACAjB,OAAOkB,IAAI;",
|
|
6
|
+
"names": ["Capability", "Ollama", "Capability", "lazy", "Capability", "Updater", "Capability", "lazy", "Capability", "Window", "Capability", "lazy", "Common", "Plugin", "AssistantEvents", "translations", "meta", "id", "NativePlugin", "Plugin", "define", "meta", "pipe", "Common", "addTranslationsModule", "translations", "addModule", "id", "activatesOn", "ActivationEvent", "OperationInvokerReady", "activate", "Updater", "Window", "AssistantEvents", "SetupAiServiceProviders", "Ollama", "make"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/meta.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/capabilities/ollama/ollama.ts":{"bytes":10783,"imports":[{"path":"@effect/platform/FetchHttpClient","kind":"import-statement","external":true},{"path":"@effect/platform/HttpClient","kind":"import-statement","external":true},{"path":"@tauri-apps/plugin-shell","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/ManagedRuntime","kind":"import-statement","external":true},{"path":"@dxos/ai/resolvers","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/capabilities/ollama/index.ts":{"bytes":848,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"src/capabilities/ollama/ollama.ts","kind":"dynamic-import","original":"./ollama"}],"format":"esm"},"src/meta.ts":{"bytes":1392,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/capabilities/updater/updater.ts":{"bytes":12209,"imports":[{"path":"@tauri-apps/plugin-os","kind":"import-statement","external":true},{"path":"@tauri-apps/plugin-process","kind":"import-statement","external":true},{"path":"@tauri-apps/plugin-updater","kind":"import-statement","external":true},{"path":"effect/Duration","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Fiber","kind":"import-statement","external":true},{"path":"effect/Function","kind":"import-statement","external":true},{"path":"effect/Match","kind":"import-statement","external":true},{"path":"effect/Schedule","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"src/meta.ts","kind":"import-statement","original":"../../meta"}],"format":"esm"},"src/capabilities/updater/index.ts":{"bytes":856,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"src/capabilities/updater/updater.ts","kind":"dynamic-import","original":"./updater"}],"format":"esm"},"src/capabilities/window/window.ts":{"bytes":6809,"imports":[{"path":"@tauri-apps/api/window","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true}],"format":"esm"},"src/capabilities/window/index.ts":{"bytes":848,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"src/capabilities/window/window.ts","kind":"dynamic-import","original":"./window"}],"format":"esm"},"src/capabilities/index.ts":{"bytes":637,"imports":[{"path":"src/capabilities/ollama/index.ts","kind":"import-statement","original":"./ollama"},{"path":"src/capabilities/updater/index.ts","kind":"import-statement","original":"./updater"},{"path":"src/capabilities/window/index.ts","kind":"import-statement","original":"./window"}],"format":"esm"},"src/translations.ts":{"bytes":1625,"imports":[{"path":"src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"src/NativePlugin.tsx":{"bytes":3267,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-assistant","kind":"import-statement","external":true},{"path":"src/capabilities/index.ts","kind":"import-statement","original":"./capabilities"},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"src/index.ts":{"bytes":649,"imports":[{"path":"src/capabilities/index.ts","kind":"import-statement","original":"./capabilities"},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/NativePlugin.tsx","kind":"import-statement","original":"./NativePlugin"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3343},"dist/lib/browser/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-6374DBU4.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"dist/lib/browser/ollama-KSB3XG6S.mjs","kind":"dynamic-import"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"dist/lib/browser/updater-XQTSH4ZZ.mjs","kind":"dynamic-import"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"dist/lib/browser/window-JDFVLF4U.mjs","kind":"dynamic-import"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-assistant","kind":"import-statement","external":true}],"exports":["NativePlugin","Ollama","Updater","Window","meta"],"entryPoint":"src/index.ts","inputs":{"src/capabilities/ollama/index.ts":{"bytesInOutput":129},"src/capabilities/index.ts":{"bytesInOutput":0},"src/capabilities/updater/index.ts":{"bytesInOutput":148},"src/capabilities/window/index.ts":{"bytesInOutput":145},"src/index.ts":{"bytesInOutput":0},"src/NativePlugin.tsx":{"bytesInOutput":581},"src/translations.ts":{"bytesInOutput":293}},"bytes":1630},"dist/lib/browser/ollama-KSB3XG6S.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5412},"dist/lib/browser/ollama-KSB3XG6S.mjs":{"imports":[{"path":"@effect/platform/FetchHttpClient","kind":"import-statement","external":true},{"path":"@effect/platform/HttpClient","kind":"import-statement","external":true},{"path":"@tauri-apps/plugin-shell","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/ManagedRuntime","kind":"import-statement","external":true},{"path":"@dxos/ai/resolvers","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/capabilities/ollama/ollama.ts","inputs":{"src/capabilities/ollama/ollama.ts":{"bytesInOutput":2625}},"bytes":2747},"dist/lib/browser/updater-XQTSH4ZZ.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5584},"dist/lib/browser/updater-XQTSH4ZZ.mjs":{"imports":[{"path":"dist/lib/browser/chunk-6374DBU4.mjs","kind":"import-statement"},{"path":"@tauri-apps/plugin-os","kind":"import-statement","external":true},{"path":"@tauri-apps/plugin-process","kind":"import-statement","external":true},{"path":"@tauri-apps/plugin-updater","kind":"import-statement","external":true},{"path":"effect/Duration","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Fiber","kind":"import-statement","external":true},{"path":"effect/Function","kind":"import-statement","external":true},{"path":"effect/Match","kind":"import-statement","external":true},{"path":"effect/Schedule","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/capabilities/updater/updater.ts","inputs":{"src/capabilities/updater/updater.ts":{"bytesInOutput":3502}},"bytes":3676},"dist/lib/browser/chunk-6374DBU4.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":662},"dist/lib/browser/chunk-6374DBU4.mjs":{"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["meta"],"inputs":{"src/meta.ts":{"bytesInOutput":293}},"bytes":372},"dist/lib/browser/window-JDFVLF4U.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3444},"dist/lib/browser/window-JDFVLF4U.mjs":{"imports":[{"path":"@tauri-apps/api/window","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/capabilities/window/window.ts","inputs":{"src/capabilities/window/window.ts":{"bytesInOutput":1208}},"bytes":1330}}}
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
|
@@ -0,0 +1,7 @@
|
|
|
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,30 +1,35 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
meta
|
|
3
|
+
} from "./chunk-6374DBU4.mjs";
|
|
4
4
|
|
|
5
|
-
// src/capabilities/updater.ts
|
|
5
|
+
// src/capabilities/updater/updater.ts
|
|
6
6
|
import { type } from "@tauri-apps/plugin-os";
|
|
7
7
|
import { relaunch } from "@tauri-apps/plugin-process";
|
|
8
8
|
import { check } from "@tauri-apps/plugin-updater";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
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";
|
|
11
16
|
import { log } from "@dxos/log";
|
|
12
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-native/src/capabilities/updater.ts";
|
|
17
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-native/src/capabilities/updater/updater.ts";
|
|
13
18
|
var SUPPORTS_OTA = [
|
|
14
19
|
"linux",
|
|
15
20
|
"macos",
|
|
16
21
|
"windows"
|
|
17
22
|
];
|
|
18
|
-
var updater_default = (
|
|
23
|
+
var updater_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
19
24
|
const platform = type();
|
|
20
|
-
if (!SUPPORTS_OTA.includes(platform)) {
|
|
21
|
-
return
|
|
25
|
+
if (!SUPPORTS_OTA.includes(platform) || window.location.hostname === "localhost") {
|
|
26
|
+
return;
|
|
22
27
|
}
|
|
23
|
-
const {
|
|
28
|
+
const { invoke } = yield* Capability.get(Common.Capability.OperationInvoker);
|
|
24
29
|
const action = Effect.gen(function* () {
|
|
25
30
|
log.info("checking for updates", void 0, {
|
|
26
31
|
F: __dxlog_file,
|
|
27
|
-
L:
|
|
32
|
+
L: 34,
|
|
28
33
|
S: this,
|
|
29
34
|
C: (f, a) => f(...a)
|
|
30
35
|
});
|
|
@@ -34,14 +39,14 @@ var updater_default = (context) => {
|
|
|
34
39
|
currentVersion: update?.currentVersion
|
|
35
40
|
}, {
|
|
36
41
|
F: __dxlog_file,
|
|
37
|
-
L:
|
|
42
|
+
L: 36,
|
|
38
43
|
S: this,
|
|
39
44
|
C: (f, a) => f(...a)
|
|
40
45
|
});
|
|
41
46
|
if (update) {
|
|
42
47
|
log.info("update available", update, {
|
|
43
48
|
F: __dxlog_file,
|
|
44
|
-
L:
|
|
49
|
+
L: 38,
|
|
45
50
|
S: this,
|
|
46
51
|
C: (f, a) => f(...a)
|
|
47
52
|
});
|
|
@@ -55,7 +60,7 @@ var updater_default = (context) => {
|
|
|
55
60
|
contentLength
|
|
56
61
|
}, {
|
|
57
62
|
F: __dxlog_file,
|
|
58
|
-
L:
|
|
63
|
+
L: 45,
|
|
59
64
|
S: this,
|
|
60
65
|
C: (f, a) => f(...a)
|
|
61
66
|
});
|
|
@@ -63,12 +68,12 @@ var updater_default = (context) => {
|
|
|
63
68
|
event: "Progress"
|
|
64
69
|
}, (event) => {
|
|
65
70
|
downloaded += event.data.chunkLength;
|
|
66
|
-
log.
|
|
71
|
+
log.verbose("download progress", {
|
|
67
72
|
downloaded,
|
|
68
73
|
contentLength
|
|
69
74
|
}, {
|
|
70
75
|
F: __dxlog_file,
|
|
71
|
-
L:
|
|
76
|
+
L: 49,
|
|
72
77
|
S: this,
|
|
73
78
|
C: (f, a) => f(...a)
|
|
74
79
|
});
|
|
@@ -77,57 +82,52 @@ var updater_default = (context) => {
|
|
|
77
82
|
}, () => {
|
|
78
83
|
log.info("download completed", void 0, {
|
|
79
84
|
F: __dxlog_file,
|
|
80
|
-
L:
|
|
85
|
+
L: 52,
|
|
81
86
|
S: this,
|
|
82
87
|
C: (f, a) => f(...a)
|
|
83
88
|
});
|
|
84
89
|
}), Match.exhaustive);
|
|
85
90
|
yield* Effect.tryPromise(() => update.downloadAndInstall(handleDownload));
|
|
86
|
-
yield*
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
onAction: () => relaunch()
|
|
116
|
-
}
|
|
117
|
-
}));
|
|
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
|
+
});
|
|
118
120
|
}
|
|
119
121
|
});
|
|
120
|
-
const fiber = pipe(
|
|
122
|
+
const fiber = Function.pipe(
|
|
121
123
|
// prettier-ignore
|
|
122
124
|
action,
|
|
123
125
|
Effect.repeat(Schedule.fixed(Duration.hours(1))),
|
|
124
126
|
Effect.runFork
|
|
125
127
|
);
|
|
126
|
-
return contributes(
|
|
127
|
-
|
|
128
|
-
});
|
|
129
|
-
};
|
|
128
|
+
return Capability.contributes(Common.Capability.Null, null, () => Effect.sync(() => Effect.runSync(Fiber.interrupt(fiber))));
|
|
129
|
+
}));
|
|
130
130
|
export {
|
|
131
131
|
updater_default as default
|
|
132
132
|
};
|
|
133
|
-
//# sourceMappingURL=updater-
|
|
133
|
+
//# sourceMappingURL=updater-XQTSH4ZZ.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// src/capabilities/window/window.ts
|
|
2
|
+
import { getCurrentWindow } from "@tauri-apps/api/window";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import { Capability, Common } from "@dxos/app-framework";
|
|
5
|
+
var window_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
6
|
+
const appWindow = getCurrentWindow();
|
|
7
|
+
const cleanupDragRegions = setupWindowDrag(appWindow);
|
|
8
|
+
return Capability.contributes(Common.Capability.Null, null, Effect.fnUntraced(function* () {
|
|
9
|
+
cleanupDragRegions();
|
|
10
|
+
}));
|
|
11
|
+
}));
|
|
12
|
+
var INTERACTIVE_SELECTORS = '.app-no-drag, button, a, input, select, textarea, [role="button"], [role="menuitem"]';
|
|
13
|
+
var setupWindowDrag = (appWindow) => {
|
|
14
|
+
const handleMouseDown = (event) => {
|
|
15
|
+
const target = event.target;
|
|
16
|
+
if (!target) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const dragElement = target.closest(".app-drag");
|
|
20
|
+
if (!dragElement) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const interactiveElement = target.closest(INTERACTIVE_SELECTORS);
|
|
24
|
+
if (interactiveElement && dragElement.contains(interactiveElement)) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
event.preventDefault();
|
|
28
|
+
void appWindow.startDragging();
|
|
29
|
+
};
|
|
30
|
+
document.addEventListener("mousedown", handleMouseDown);
|
|
31
|
+
return () => {
|
|
32
|
+
document.removeEventListener("mousedown", handleMouseDown);
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
window_default as default
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=window-JDFVLF4U.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativePlugin.d.ts","sourceRoot":"","sources":["../../../src/NativePlugin.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NativePlugin.d.ts","sourceRoot":"","sources":["../../../src/NativePlugin.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAU,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAOrD,eAAO,MAAM,YAAY,4BAkBxB,CAAC"}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './ollama';
|
|
2
|
+
export * from './updater';
|
|
3
|
+
export * from './window';
|
|
2
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/ollama/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,eAAO,MAAM,MAAM,6EAAsD,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as Effect from 'effect/Effect';
|
|
2
|
+
import { Capability, Common } from '@dxos/app-framework';
|
|
3
|
+
export type OllamaCapabilities = Capability.Capability<typeof Common.Capability.AiModelResolver>;
|
|
4
|
+
declare const _default: (props?: [] | undefined) => Effect.Effect<OllamaCapabilities, Error, Capability.Service>;
|
|
5
|
+
export default _default;
|
|
6
|
+
//# sourceMappingURL=ollama.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ollama.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/ollama/ollama.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAMxC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAMzD,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,UAAU,CAAC,OAAO,MAAM,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;;AAEjG,wBAeE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/updater/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,eAAO,MAAM,OAAO,0GAAwD,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as Effect from 'effect/Effect';
|
|
2
|
+
import { Capability } from '@dxos/app-framework';
|
|
3
|
+
declare const _default: (props?: void | undefined) => Effect.Effect<Capability.Capability<Capability.InterfaceDef<null>> | undefined, Error, Capability.Service>;
|
|
4
|
+
export default _default;
|
|
5
|
+
//# sourceMappingURL=updater.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updater.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/updater/updater.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAMxC,OAAO,EAAE,UAAU,EAAU,MAAM,qBAAqB,CAAC;;AAOzD,wBA4DE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/window/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,eAAO,MAAM,MAAM,8FAAsD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as Effect from 'effect/Effect';
|
|
2
|
+
import { Capability } from '@dxos/app-framework';
|
|
3
|
+
/**
|
|
4
|
+
* Window capability module.
|
|
5
|
+
* Sets up window drag regions for Tauri windows.
|
|
6
|
+
* Note: Window state persistence (size/position) is handled on the Rust side
|
|
7
|
+
* in src-tauri/src/window_state.rs for instant restoration on startup.
|
|
8
|
+
*/
|
|
9
|
+
declare const _default: (props?: void | undefined) => Effect.Effect<Capability.Capability<Capability.InterfaceDef<null>>, never, never>;
|
|
10
|
+
export default _default;
|
|
11
|
+
//# sourceMappingURL=window.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/window/window.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,UAAU,EAAU,MAAM,qBAAqB,CAAC;AAEzD;;;;;GAKG;;AACH,wBAeE"}
|