@dxos/plugin-native 0.8.4-main.7ace549 → 0.8.4-main.8baae0fced
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/LICENSE +102 -5
- package/README.md +1 -1
- package/dist/lib/neutral/NativePlugin.mjs +34 -0
- package/dist/lib/neutral/NativePlugin.mjs.map +7 -0
- package/dist/lib/neutral/NativeSettings-CLYG5TJH.mjs +113 -0
- package/dist/lib/neutral/NativeSettings-CLYG5TJH.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +17 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/{browser/chunk-SP3MEGKI.mjs → neutral/chunk-X3A57PRH.mjs} +9 -4
- package/dist/lib/neutral/chunk-X3A57PRH.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +9 -0
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +8 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/meta.mjs.map +7 -0
- package/dist/lib/{browser/ollama-CQE7ZIWL.mjs → neutral/ollama-BHWFTROM.mjs} +14 -28
- package/dist/lib/neutral/ollama-BHWFTROM.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +12 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-W46XEBPK.mjs +27 -0
- package/dist/lib/neutral/react-surface-W46XEBPK.mjs.map +7 -0
- package/dist/lib/neutral/settings-HF6TQNU4.mjs +28 -0
- package/dist/lib/neutral/settings-HF6TQNU4.mjs.map +7 -0
- package/dist/lib/neutral/spotlight-listener-K7S6LGL3.mjs +48 -0
- package/dist/lib/neutral/spotlight-listener-K7S6LGL3.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +35 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +31 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/lib/neutral/updater-JEBXWSSK.mjs +244 -0
- package/dist/lib/neutral/updater-JEBXWSSK.mjs.map +7 -0
- package/dist/types/src/NativePlugin.d.ts +3 -1
- package/dist/types/src/NativePlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +6 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/ollama.d.ts +5 -2
- package/dist/types/src/capabilities/ollama.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings.d.ts +7 -0
- package/dist/types/src/capabilities/settings.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 +4 -2
- package/dist/types/src/capabilities/updater.d.ts.map +1 -1
- package/dist/types/src/components/NativeSettings/NativeSettings.d.ts +6 -0
- package/dist/types/src/components/NativeSettings/NativeSettings.d.ts.map +1 -0
- package/dist/types/src/components/NativeSettings/index.d.ts +2 -0
- package/dist/types/src/components/NativeSettings/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +3 -0
- package/dist/types/src/components/index.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 +0 -1
- 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/src/plugin.d.ts +3 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +20 -6
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/NativeCapabilities.d.ts +5 -0
- package/dist/types/src/types/NativeCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/Settings.d.ts +5 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/Update.d.ts +30 -0
- package/dist/types/src/types/Update.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +4 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +77 -24
- package/src/NativePlugin.tsx +22 -20
- package/src/capabilities/index.ts +6 -4
- package/src/capabilities/ollama.ts +26 -20
- package/src/capabilities/react-surface.tsx +29 -0
- package/src/capabilities/settings.ts +31 -0
- package/src/capabilities/spotlight-listener.ts +58 -0
- package/src/capabilities/updater.ts +159 -50
- package/src/components/NativeSettings/NativeSettings.tsx +132 -0
- package/src/components/NativeSettings/index.ts +5 -0
- package/src/components/index.ts +7 -0
- package/src/constants.ts +7 -0
- package/src/index.ts +0 -1
- package/src/meta.ts +8 -4
- package/src/plugin.ts +9 -0
- package/src/translations.ts +20 -5
- package/src/types/NativeCapabilities.ts +16 -0
- package/src/types/Settings.ts +11 -0
- package/src/types/Update.ts +24 -0
- package/src/types/index.ts +7 -0
- package/dist/lib/browser/chunk-SP3MEGKI.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -56
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/ollama-CQE7ZIWL.mjs.map +0 -7
- package/dist/lib/browser/updater-SDBPTCXA.mjs +0 -138
- package/dist/lib/browser/updater-SDBPTCXA.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/window.d.ts +0 -4
- package/dist/types/src/capabilities/window.d.ts.map +0 -1
- package/src/capabilities/window.ts +0 -49
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useAtomValue } from '@effect-atom/atom-react';
|
|
6
|
+
import { formatDistanceToNow } from 'date-fns/formatDistanceToNow';
|
|
7
|
+
import * as Match from 'effect/Match';
|
|
8
|
+
import React, { type ReactNode, useState } from 'react';
|
|
9
|
+
|
|
10
|
+
import { useCapability } from '@dxos/app-framework/ui';
|
|
11
|
+
import { type AppSurface } from '@dxos/app-toolkit/ui';
|
|
12
|
+
import { Button, useTranslation } from '@dxos/react-ui';
|
|
13
|
+
import { Settings as SettingsForm } from '@dxos/react-ui-form';
|
|
14
|
+
|
|
15
|
+
import { meta } from '#meta';
|
|
16
|
+
import { NativeCapabilities, type Settings, type Update } from '#types';
|
|
17
|
+
|
|
18
|
+
export type NativeSettingsProps = AppSurface.SettingsArticleProps<Settings.Settings>;
|
|
19
|
+
|
|
20
|
+
type Pending = null | 'check' | 'install' | 'relaunch';
|
|
21
|
+
|
|
22
|
+
type UpdateActions = {
|
|
23
|
+
onCheck: () => Promise<void>;
|
|
24
|
+
onInstall: () => Promise<void>;
|
|
25
|
+
onRelaunch: () => Promise<void>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
type UpdateRow = { description: string; button: ReactNode };
|
|
29
|
+
|
|
30
|
+
export const NativeSettings = (_props: NativeSettingsProps) => {
|
|
31
|
+
const { t } = useTranslation(meta.id);
|
|
32
|
+
const manager = useCapability(NativeCapabilities.UpdateManager);
|
|
33
|
+
const status = useAtomValue(manager.status);
|
|
34
|
+
|
|
35
|
+
// UI-level pending flag. The status atom can flip between `checking` and `up-to-date` faster
|
|
36
|
+
// than the user can perceive, so we also gate the button on the click handler's lifetime to
|
|
37
|
+
// guarantee no duplicate triggers and a visible busy state.
|
|
38
|
+
const [pending, setPending] = useState<Pending>(null);
|
|
39
|
+
|
|
40
|
+
const runAction = (kind: Exclude<Pending, null>, action: () => Promise<void>) => async () => {
|
|
41
|
+
setPending(kind);
|
|
42
|
+
try {
|
|
43
|
+
await action();
|
|
44
|
+
} finally {
|
|
45
|
+
setPending(null);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const { description, button } = renderUpdateRow(status, pending, t, {
|
|
50
|
+
onCheck: runAction('check', manager.check),
|
|
51
|
+
onInstall: runAction('install', manager.install),
|
|
52
|
+
onRelaunch: runAction('relaunch', manager.relaunch),
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<SettingsForm.Viewport>
|
|
57
|
+
<SettingsForm.Section title={t('settings.title')}>
|
|
58
|
+
<SettingsForm.Item title={t('settings.updates.label')} description={description}>
|
|
59
|
+
{button}
|
|
60
|
+
</SettingsForm.Item>
|
|
61
|
+
</SettingsForm.Section>
|
|
62
|
+
</SettingsForm.Viewport>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const renderUpdateRow = (
|
|
67
|
+
status: Update.Status,
|
|
68
|
+
pending: Pending,
|
|
69
|
+
t: (key: string, options?: Record<string, unknown>) => string,
|
|
70
|
+
{ onCheck, onInstall, onRelaunch }: UpdateActions,
|
|
71
|
+
): UpdateRow => {
|
|
72
|
+
const isChecking = pending === 'check' || status.kind === 'checking';
|
|
73
|
+
const isInstalling = pending === 'install' || status.kind === 'downloading';
|
|
74
|
+
|
|
75
|
+
const checkButton = (disabled = false) => (
|
|
76
|
+
<Button disabled={disabled || isChecking || isInstalling || pending === 'relaunch'} onClick={() => void onCheck()}>
|
|
77
|
+
{isChecking ? t('settings.updates.checking.label') : t('settings.updates.check.label')}
|
|
78
|
+
</Button>
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
return Match.value(status).pipe(
|
|
82
|
+
Match.withReturnType<UpdateRow>(),
|
|
83
|
+
Match.when({ kind: 'unsupported' }, () => ({
|
|
84
|
+
description: t('settings.updates.unsupported.message'),
|
|
85
|
+
button: checkButton(true),
|
|
86
|
+
})),
|
|
87
|
+
Match.when({ kind: 'idle' }, () => ({
|
|
88
|
+
description: isChecking ? t('settings.updates.checking.message') : t('settings.updates.idle.message'),
|
|
89
|
+
button: checkButton(),
|
|
90
|
+
})),
|
|
91
|
+
Match.when({ kind: 'checking' }, () => ({
|
|
92
|
+
description: t('settings.updates.checking.message'),
|
|
93
|
+
button: checkButton(),
|
|
94
|
+
})),
|
|
95
|
+
Match.when({ kind: 'up-to-date' }, (s) => ({
|
|
96
|
+
description: isChecking
|
|
97
|
+
? t('settings.updates.checking.message')
|
|
98
|
+
: t('settings.updates.up-to-date.message', {
|
|
99
|
+
checkedAt: formatDistanceToNow(new Date(s.checkedAt), { addSuffix: true }),
|
|
100
|
+
}),
|
|
101
|
+
button: checkButton(),
|
|
102
|
+
})),
|
|
103
|
+
Match.when({ kind: 'available' }, (s) => ({
|
|
104
|
+
description: t('settings.updates.available.message', { version: s.version }),
|
|
105
|
+
button: (
|
|
106
|
+
<Button variant='primary' disabled={isInstalling} onClick={() => void onInstall()}>
|
|
107
|
+
{isInstalling ? t('settings.updates.downloading.label') : t('settings.updates.update-now.label')}
|
|
108
|
+
</Button>
|
|
109
|
+
),
|
|
110
|
+
})),
|
|
111
|
+
Match.when({ kind: 'downloading' }, (s) => {
|
|
112
|
+
const percent = s.contentLength > 0 ? Math.round((s.downloaded / s.contentLength) * 100) : 0;
|
|
113
|
+
return {
|
|
114
|
+
description: t('settings.updates.downloading.message', { percent }),
|
|
115
|
+
button: <Button disabled>{t('settings.updates.downloading.label')}</Button>,
|
|
116
|
+
};
|
|
117
|
+
}),
|
|
118
|
+
Match.when({ kind: 'ready' }, () => ({
|
|
119
|
+
description: t('settings.updates.ready.message'),
|
|
120
|
+
button: (
|
|
121
|
+
<Button variant='primary' disabled={pending === 'relaunch'} onClick={() => void onRelaunch()}>
|
|
122
|
+
{t('settings.updates.relaunch.label')}
|
|
123
|
+
</Button>
|
|
124
|
+
),
|
|
125
|
+
})),
|
|
126
|
+
Match.when({ kind: 'failed' }, (s) => ({
|
|
127
|
+
description: t('settings.updates.failed.message', { error: s.error }),
|
|
128
|
+
button: checkButton(),
|
|
129
|
+
})),
|
|
130
|
+
Match.exhaustive,
|
|
131
|
+
);
|
|
132
|
+
};
|
package/src/constants.ts
ADDED
package/src/index.ts
CHANGED
package/src/meta.ts
CHANGED
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
// TODO(wittjosiah): Rename plugin (package + id) from `native` to `app` to match the user-facing name.
|
|
9
|
+
export const meta: Plugin.Meta = {
|
|
10
|
+
id: 'org.dxos.plugin.native',
|
|
11
|
+
name: 'App',
|
|
12
|
+
author: 'DXOS',
|
|
11
13
|
description: trim`
|
|
12
14
|
Native platform integration providing desktop-specific features and system-level capabilities.
|
|
13
15
|
Access native file dialogs, notifications, and OS integrations.
|
|
14
16
|
`,
|
|
17
|
+
icon: 'ph--app-window--regular',
|
|
18
|
+
tags: ['system'],
|
|
15
19
|
};
|
package/src/plugin.ts
ADDED
package/src/translations.ts
CHANGED
|
@@ -4,16 +4,31 @@
|
|
|
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
|
+
'settings.title': 'App',
|
|
18
|
+
'settings.updates.label': 'Updates',
|
|
19
|
+
'settings.updates.check.label': 'Check for updates',
|
|
20
|
+
'settings.updates.checking.label': 'Checking…',
|
|
21
|
+
'settings.updates.update-now.label': 'Update now',
|
|
22
|
+
'settings.updates.downloading.label': 'Downloading…',
|
|
23
|
+
'settings.updates.relaunch.label': 'Restart to install',
|
|
24
|
+
'settings.updates.idle.message': 'Check now for a newer version of Composer.',
|
|
25
|
+
'settings.updates.checking.message': 'Checking for updates…',
|
|
26
|
+
'settings.updates.up-to-date.message': 'You are running the latest version of Composer. Checked {{checkedAt}}.',
|
|
27
|
+
'settings.updates.available.message': 'Version {{version}} is available.',
|
|
28
|
+
'settings.updates.downloading.message': 'Downloading… {{percent}}%',
|
|
29
|
+
'settings.updates.ready.message': 'Update ready. Restart Composer to apply.',
|
|
30
|
+
'settings.updates.failed.message': 'Update failed: {{error}}',
|
|
31
|
+
'settings.updates.unsupported.message': 'Updates are not available on this platform.',
|
|
17
32
|
},
|
|
18
33
|
},
|
|
19
34
|
},
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import type { Atom } from '@effect-atom/atom-react';
|
|
8
|
+
|
|
9
|
+
import { Capability } from '@dxos/app-framework';
|
|
10
|
+
|
|
11
|
+
import { meta } from '#meta';
|
|
12
|
+
|
|
13
|
+
// Inline imports to avoid `Settings` / `Update` namespace aliases colliding with the
|
|
14
|
+
// capability constants exported below.
|
|
15
|
+
export const Settings = Capability.make<Atom.Writable<import('./Settings').Settings>>(`${meta.id}.capability.settings`);
|
|
16
|
+
export const UpdateManager = Capability.make<import('./Update').Manager>(`${meta.id}.capability.update-manager`);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Atom } from '@effect-atom/atom-react';
|
|
6
|
+
|
|
7
|
+
// @import-as-namespace
|
|
8
|
+
|
|
9
|
+
export type Status =
|
|
10
|
+
| { kind: 'unsupported' }
|
|
11
|
+
| { kind: 'idle' }
|
|
12
|
+
| { kind: 'checking' }
|
|
13
|
+
| { kind: 'up-to-date'; checkedAt: number }
|
|
14
|
+
| { kind: 'available'; version: string }
|
|
15
|
+
| { kind: 'downloading'; downloaded: number; contentLength: number }
|
|
16
|
+
| { kind: 'ready' }
|
|
17
|
+
| { kind: 'failed'; error: string };
|
|
18
|
+
|
|
19
|
+
export type Manager = {
|
|
20
|
+
status: Atom.Writable<Status>;
|
|
21
|
+
check: () => Promise<void>;
|
|
22
|
+
install: () => Promise<void>;
|
|
23
|
+
relaunch: () => Promise<void>;
|
|
24
|
+
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: PluginMeta = {\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,OAAmB;EAC9BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;AAIf;",
|
|
6
|
-
"names": ["trim", "meta", "id", "name", "description", "trim"]
|
|
7
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
meta
|
|
3
|
-
} from "./chunk-SP3MEGKI.mjs";
|
|
4
|
-
|
|
5
|
-
// src/NativePlugin.tsx
|
|
6
|
-
import { Capabilities, Events, contributes, defineModule, definePlugin } from "@dxos/app-framework";
|
|
7
|
-
import { AssistantEvents } from "@dxos/plugin-assistant";
|
|
8
|
-
|
|
9
|
-
// src/capabilities/index.ts
|
|
10
|
-
import { lazy } from "@dxos/app-framework";
|
|
11
|
-
var Ollama = lazy(() => import("./ollama-CQE7ZIWL.mjs"));
|
|
12
|
-
var Updater = lazy(() => import("./updater-SDBPTCXA.mjs"));
|
|
13
|
-
var Window = lazy(() => import("./window-6G542FZL.mjs"));
|
|
14
|
-
|
|
15
|
-
// src/translations.ts
|
|
16
|
-
var translations = [
|
|
17
|
-
{
|
|
18
|
-
"en-US": {
|
|
19
|
-
[meta.id]: {
|
|
20
|
-
"update ready label": "Ready to update",
|
|
21
|
-
"update ready description": "A new version of Composer is available.",
|
|
22
|
-
"update label": "Update",
|
|
23
|
-
"update alt": "Relaunch the app to update"
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
];
|
|
28
|
-
|
|
29
|
-
// src/NativePlugin.tsx
|
|
30
|
-
var NativePlugin = definePlugin(meta, () => [
|
|
31
|
-
defineModule({
|
|
32
|
-
id: `${meta.id}/module/translations`,
|
|
33
|
-
activatesOn: Events.SetupTranslations,
|
|
34
|
-
activate: () => contributes(Capabilities.Translations, translations)
|
|
35
|
-
}),
|
|
36
|
-
defineModule({
|
|
37
|
-
id: `${meta.id}/module/updater`,
|
|
38
|
-
activatesOn: Events.DispatcherReady,
|
|
39
|
-
activate: Updater
|
|
40
|
-
}),
|
|
41
|
-
defineModule({
|
|
42
|
-
id: `${meta.id}/module/window`,
|
|
43
|
-
activatesOn: Events.DispatcherReady,
|
|
44
|
-
activate: Window
|
|
45
|
-
}),
|
|
46
|
-
defineModule({
|
|
47
|
-
id: `${meta.id}/module/ollama`,
|
|
48
|
-
activatesOn: AssistantEvents.SetupAiServiceProviders,
|
|
49
|
-
activate: Ollama
|
|
50
|
-
})
|
|
51
|
-
]);
|
|
52
|
-
export {
|
|
53
|
-
NativePlugin,
|
|
54
|
-
meta
|
|
55
|
-
};
|
|
56
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/NativePlugin.tsx", "../../../src/capabilities/index.ts", "../../../src/translations.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Capabilities, Events, contributes, defineModule, definePlugin } 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 = definePlugin(meta, () => [\n defineModule({\n id: `${meta.id}/module/translations`,\n activatesOn: Events.SetupTranslations,\n activate: () => contributes(Capabilities.Translations, translations),\n }),\n defineModule({\n id: `${meta.id}/module/updater`,\n activatesOn: Events.DispatcherReady,\n activate: Updater,\n }),\n defineModule({\n id: `${meta.id}/module/window`,\n activatesOn: Events.DispatcherReady,\n activate: Window,\n }),\n defineModule({\n id: `${meta.id}/module/ollama`,\n activatesOn: AssistantEvents.SetupAiServiceProviders,\n activate: Ollama,\n }),\n]);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { lazy } from '@dxos/app-framework';\n\nexport const Ollama = lazy(() => import('./ollama'));\nexport const Updater = lazy(() => import('./updater'));\nexport const Window = lazy(() => import('./window'));\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,cAAcC,QAAQC,aAAaC,cAAcC,oBAAoB;AAC9E,SAASC,uBAAuB;;;ACDhC,SAASC,YAAY;AAEd,IAAMC,SAASC,KAAK,MAAM,OAAO,uBAAA,CAAA;AACjC,IAAMC,UAAUD,KAAK,MAAM,OAAO,wBAAA,CAAA;AAClC,IAAME,SAASF,KAAK,MAAM,OAAO,uBAAA,CAAA;;;ACAjC,IAAMG,eAAe;EAC1B;IACE,SAAS;MACP,CAACC,KAAKC,EAAE,GAAG;QACT,sBAAsB;QACtB,4BAA4B;QAC5B,gBAAgB;QAChB,cAAc;MAChB;IACF;EACF;;;;AFPK,IAAMC,eAAeC,aAAaC,MAAM,MAAM;EACnDC,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOC;IACpBC,UAAU,MAAMC,YAAYC,aAAaC,cAAcC,YAAAA;EACzD,CAAA;EACAT,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOO;IACpBL,UAAUM;EACZ,CAAA;EACAX,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOO;IACpBL,UAAUO;EACZ,CAAA;EACAZ,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaW,gBAAgBC;IAC7BT,UAAUU;EACZ,CAAA;CACD;",
|
|
6
|
-
"names": ["Capabilities", "Events", "contributes", "defineModule", "definePlugin", "AssistantEvents", "lazy", "Ollama", "lazy", "Updater", "Window", "translations", "meta", "id", "NativePlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "SetupTranslations", "activate", "contributes", "Capabilities", "Translations", "translations", "DispatcherReady", "Updater", "Window", "AssistantEvents", "SetupAiServiceProviders", "Ollama"]
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"inputs":{"src/meta.ts":{"bytes":1396,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/capabilities/ollama.ts":{"bytes":10161,"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/AiServiceRouter","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/updater.ts":{"bytes":12408,"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/window.ts":{"bytes":5689,"imports":[{"path":"@tauri-apps/api/window","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true}],"format":"esm"},"src/capabilities/index.ts":{"bytes":1148,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"src/capabilities/ollama.ts","kind":"dynamic-import","original":"./ollama"},{"path":"src/capabilities/updater.ts","kind":"dynamic-import","original":"./updater"},{"path":"src/capabilities/window.ts","kind":"dynamic-import","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":3973,"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":549,"imports":[{"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":3100},"dist/lib/browser/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-SP3MEGKI.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-assistant","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"dist/lib/browser/ollama-CQE7ZIWL.mjs","kind":"dynamic-import"},{"path":"dist/lib/browser/updater-SDBPTCXA.mjs","kind":"dynamic-import"},{"path":"dist/lib/browser/window-6G542FZL.mjs","kind":"dynamic-import"}],"exports":["NativePlugin","meta"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0},"src/NativePlugin.tsx":{"bytesInOutput":771},"src/capabilities/index.ts":{"bytesInOutput":220},"src/translations.ts":{"bytesInOutput":293}},"bytes":1505},"dist/lib/browser/ollama-CQE7ZIWL.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5092},"dist/lib/browser/ollama-CQE7ZIWL.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/AiServiceRouter","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.ts","inputs":{"src/capabilities/ollama.ts":{"bytesInOutput":2600}},"bytes":2715},"dist/lib/browser/updater-SDBPTCXA.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5657},"dist/lib/browser/updater-SDBPTCXA.mjs":{"imports":[{"path":"dist/lib/browser/chunk-SP3MEGKI.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.ts","inputs":{"src/capabilities/updater.ts":{"bytesInOutput":3611}},"bytes":3777},"dist/lib/browser/chunk-SP3MEGKI.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":665},"dist/lib/browser/chunk-SP3MEGKI.mjs":{"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["meta"],"inputs":{"src/meta.ts":{"bytesInOutput":293}},"bytes":372},"dist/lib/browser/window-6G542FZL.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2974},"dist/lib/browser/window-6G542FZL.mjs":{"imports":[{"path":"@tauri-apps/api/window","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/capabilities/window.ts","inputs":{"src/capabilities/window.ts":{"bytesInOutput":1214}},"bytes":1329}}}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/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 * as AiServiceRouter from '@dxos/ai/AiServiceRouter';\nimport { Capabilities, type Capability, type PluginContext, contributes } from '@dxos/app-framework';\nimport { log } from '@dxos/log';\n\n// Running ollama on non-standard port.\nconst OLLAMA_HOST = 'http://localhost:21434';\n\nexport default (_context: PluginContext): Capability<any> => {\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 contributes(\n Capabilities.AiModelResolver,\n OllamaSidecarModelResolver.pipe(Layer.provide(sidecarLayer)),\n async () => {\n await 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 command.stdout.on('data', (data) => console.log('[ollama]', data.toString()));\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<AiServiceRouter.AiModelResolver, never, OllamaSidecar> =\n Layer.unwrapEffect(\n Effect.gen(function* () {\n const { endpoint } = yield* OllamaSidecar;\n return AiServiceRouter.OllamaResolver({\n host: 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;AAEhC,YAAYC,qBAAqB;AACjC,SAASC,cAAmDC,mBAAmB;AAC/E,SAASC,WAAW;;AAGpB,IAAMC,cAAc;AAEpB,IAAA,kBAAe,CAACC,aAAAA;AACd,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,SAAON,YACLD,aAAaiB,iBACbC,2BAA2BN,KAAWO,cAAQV,YAAAA,CAAAA,GAC9C,YAAA;AACE,UAAMJ,QAAQe,QAAO;EACvB,CAAA;AAEJ;AAEA,IAAMb,gBAAN,MAAMA,uBAA8Bc,YAAI,mCAAA,EAAA,EAAA;EAMtC,OAAOb,YAAkBc,aACvBf,gBACOgB,WAAI,aAAA;AACT,UAAMC,UAAU9B,QAAQ+B,QAAQ,kBAAkB;MAAC;OAAU;MAC3DC,KAAK;QACHvB;QACAwB,gBAAgB;MAClB;IACF,CAAA;AAGAH,YAAQI,OAAOC,GAAG,QAAQ,CAACC,SAASC,QAAQ7B,IAAI,YAAY4B,KAAKE,SAAQ,CAAA,CAAA;AACzER,YAAQS,OAAOJ,GAAG,QAAQ,CAACC,SAASC,QAAQG,MAAM,YAAYJ,KAAKE,SAAQ,CAAA,CAAA;AAC3ER,YAAQK,GAAG,SAAS,CAACM,SAASjC,IAAIkC,KAAK,yBAAyB;MAAED;IAAK,GAAA;;;;;;AACvEX,YAAQK,GAAG,SAAS,CAACK,UAAUhC,IAAIgC,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;AAEFxC,QAAIkC,KAAK,kBAAkB;MAAEO,KAAKN,MAAMM;IAAI,GAAA;;;;;;AAE5C,WAAO;MACLC,UAAUzC;IACZ;EACF,CAAA,CAAA;AAEJ;AAEA,IAAMe,6BACE2B,mBACGtB,WAAI,aAAA;AACT,QAAM,EAAEqB,SAAQ,IAAK,OAAOrC;AAC5B,SAAuBuC,+BAAe;IACpCC,MAAMH;IACNI,iBAA4BC,iCAAsB,KAAA;EACpD,CAAA;AACF,CAAA,CAAA,EACArC,KAAWO,cAAwB+B,qBAAK,CAAA;",
|
|
6
|
-
"names": ["FetchHttpClient", "HttpClient", "Command", "Context", "Effect", "Layer", "ManagedRuntime", "AiServiceRouter", "Capabilities", "contributes", "log", "OLLAMA_HOST", "_context", "runtime", "make", "OllamaSidecar", "layerLive", "sidecarLayer", "effectContext", "runtimeEffect", "pipe", "map", "rt", "context", "pick", "AiModelResolver", "OllamaSidecarModelResolver", "provide", "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", "OllamaResolver", "host", "transformClient", "withTracerPropagation", "layer"]
|
|
7
|
-
}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
meta
|
|
3
|
-
} from "./chunk-SP3MEGKI.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-SDBPTCXA.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":"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"}
|