codexmate 0.1.37 → 0.1.39
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/README.md +2 -2
- package/README.vi.md +2 -2
- package/README.zh.md +2 -2
- package/cli/desktop-release.js +73 -0
- package/cli/update.js +27 -15
- package/cli.js +9 -3
- package/lib/model-test.js +126 -21
- package/package.json +4 -1
- package/plugins/prompt-templates/overview.mjs +1 -7
- package/web-ui/app.js +5 -0
- package/web-ui/modules/app.methods.install.mjs +38 -2
- package/web-ui/modules/app.methods.provider-cache.mjs +3 -0
- package/web-ui/modules/i18n/locales/en.mjs +1945 -2011
- package/web-ui/modules/i18n/locales/expand.mjs +18 -0
- package/web-ui/modules/i18n/locales/ja.mjs +1946 -2012
- package/web-ui/modules/i18n/locales/keys.mjs +1945 -0
- package/web-ui/modules/i18n/locales/vi.mjs +1945 -1980
- package/web-ui/modules/i18n/locales/zh-tw.mjs +1945 -2009
- package/web-ui/modules/i18n/locales/zh.mjs +1944 -2009
- package/web-ui/modules/i18n.mjs +3 -2
- package/web-ui/modules/model-test.mjs +114 -26
- package/web-ui/partials/index/layout-header.html +73 -71
- package/web-ui/partials/index/modals-basic.html +22 -9
- package/web-ui/partials/index/panel-plugins.html +23 -35
- package/web-ui/partials/index/plugin-file-sharing.html +4 -4
- package/web-ui/partials/index/routing-model-test.html +29 -9
- package/web-ui/res/web-ui-render.precompiled.js +1 -14467
- package/web-ui/styles/layout-shell.css +155 -209
- package/web-ui/styles/navigation-panels.css +8 -9
- package/web-ui/styles/plugins-panel.css +78 -132
- package/web-ui/styles/responsive.css +7 -7
- package/web-ui/styles/routing.css +8 -0
- package/web-ui/styles/settings-panel.css +16 -14
- package/web-ui/styles/sub-tabs.css +13 -0
- package/web-ui/styles/theme-dark-tokens.css +4 -0
- package/web-ui/styles/theme-dark.css +5 -13
- package/web-ui/styles/theme-ocean-tokens.css +3 -0
- package/web-ui/styles/theme-ocean.css +3 -12
- package/web-ui/styles/theme-violet-tokens.css +3 -0
- package/web-ui/styles/theme-violet.css +14 -38
package/README.md
CHANGED
|
@@ -128,7 +128,7 @@ Codex Mate manages existing tools and local records. It is not a new AI model or
|
|
|
128
128
|
- **Usage Analytics**: Visualize message trends and top projects
|
|
129
129
|
- **Prompt Templates**: Variable-fill dialog on invocation, one-template JSON sharing, and versioned plugin template configuration with history Diff and rollback. `git_diff` is pasted text, not an executed command.
|
|
130
130
|
- **MCP Integration**: Expose local tools and resources via MCP stdio
|
|
131
|
-
- **
|
|
131
|
+
- **Updates**: Use the update notice to download the matching Windows, macOS, or Linux desktop installer from GitHub without leaving the app. Install it manually. For CLI + Web installs, copy `codexmate update`, run it on the service host, then restart the service.
|
|
132
132
|
|
|
133
133
|
</details>
|
|
134
134
|
|
|
@@ -150,7 +150,7 @@ Choose Light, Dark, Ocean or Violet in Settings. Violet adapts [Catppuccin Latte
|
|
|
150
150
|
<a id="routing-groups"></a>
|
|
151
151
|
### Model test
|
|
152
152
|
|
|
153
|
-
The selected Codex/Pi subtab is saved and restored after reload. Choose a provider and model from existing configuration, enter a message and send it. View the Markdown reply, returned model ID and response time in seconds. Tests consume API credits without starting CLIs, changing configuration or saving test history.
|
|
153
|
+
The selected Codex/Pi subtab is saved and restored after reload. Choose a provider and model from existing configuration, enter a message and send it. View the Markdown reply, returned model ID and response time in seconds. Tests consume API credits without starting CLIs, changing configuration or saving test history. Choose **All** in the model list, then submit to read the selected provider’s full model catalog. After confirmation, it sends the same message once per model and shows each result, even when some tests fail. Generation requests are not retried, have no local response deadline and limit output to 2048 tokens. Supports configured Responses, Chat Completions, Completions and Anthropic Messages; native login and command-based credentials are not integrated. Group settings are no longer shown in the Web UI; existing backend routing and OpenAI Chat API behavior is unchanged. See the [Web UI guide](https://sakurabytecore.github.io/codexmate/guide/web-ui).
|
|
154
154
|
|
|
155
155
|
Tests use Codex UA/Originator or Pi SDK headers, with configured UA overrides taking priority. They read Codex reasoning/output settings and Pi model token limits and compatibility flags. If the installed client version cannot be resolved, requests identify as versioned CodexMate tests rather than inventing a client version.
|
|
156
156
|
|
package/README.vi.md
CHANGED
|
@@ -124,7 +124,7 @@ Codex Mate quản lý công cụ và dữ liệu cục bộ đã có. Đây khô
|
|
|
124
124
|
- **Phân tích sử dụng**: Trực quan hóa xu hướng tin nhắn và dự án nổi bật
|
|
125
125
|
- **Mẫu Prompt**: Hộp thoại điền biến khi gọi, chia sẻ một mẫu bằng JSON, lịch sử Diff và khôi phục cấu hình mẫu plugin. `git_diff` là văn bản được dán, không thực thi lệnh.
|
|
126
126
|
- **Tích hợp MCP**: Expose tool và resource cục bộ qua MCP stdio
|
|
127
|
-
- **
|
|
127
|
+
- **Cập nhật**: Với bản desktop Windows, macOS hoặc Linux, tải bộ cài tương ứng từ GitHub ngay trong hộp thoại cập nhật rồi cài thủ công. Với bản CLI + Web, sao chép `codexmate update`, chạy trên máy chủ dịch vụ rồi khởi động lại dịch vụ.
|
|
128
128
|
- **Trình sửa tệp prompt**: Chỉnh sửa CLAUDE.md / AGENTS.md toàn cục và theo dự án với kho preset chung. Điền biến trước khi áp dụng preset; cần lưu thủ công để ghi tệp. Lịch sử hiển thị Diff; xác nhận khôi phục sẽ ghi phiên bản đã chọn với bản sao lưu nguyên tử và kiểm tra thay đổi bên ngoài. Tab và lựa chọn tệp đích được lưu và khôi phục sau khi tải lại. Pi giữ tệp đã chọn nếu còn trong danh sách; chỉ chuyển về mục đầu khi tệp không còn và không có bản nháp chưa lưu. Tab Pi liệt kê tệp `.md` trực tiếp trong `~/.pi/agent/` hoặc `<cwd>/.pi/`, cập nhật khi mở tab hoặc danh sách tệp; không tự động nạp prompt. Trang sửa prompt không thêm khoảng trống tải cấu hình, tránh nhảy vị trí cuộn khi quá trình tải hoàn tất. Tự động phát hiện đường dẫn dự án; tệp prompt toàn cục của OpenCode nằm tại `~/.config/opencode/AGENTS.md`.
|
|
129
129
|
- **Bridge Provider Claude**: Kết nối Claude Code với provider tương thích OpenAI Chat Completions và Ollama qua proxy tương thích Claude cục bộ tích hợp.
|
|
130
130
|
- **Kho Provider OpenCode**: Lưu nhiều provider trong kho riêng của CodexMate tại `~/.codexmate`, chỉ đưa provider đang chọn vào cấu hình OpenCode gốc, giữ nguyên thiết lập do người dùng quản lý.
|
|
@@ -150,7 +150,7 @@ Chọn Sáng, Tối, Đại dương hoặc Tím dịu trong phần cài đặt.
|
|
|
150
150
|
<a id="nhóm-định-tuyến"></a>
|
|
151
151
|
### Kiểm thử mô hình
|
|
152
152
|
|
|
153
|
-
Lựa chọn tab Codex/Pi được lưu và khôi phục sau khi tải lại. Chọn nhà cung cấp và mô hình trong cấu hình hiện có, nhập nội dung rồi gửi. Xem câu trả lời Markdown, ID mô hình trả về và thời gian tính bằng giây. Kiểm thử tiêu thụ hạn mức API; không mở CLI, đổi cấu hình hoặc lưu lịch sử.
|
|
153
|
+
Lựa chọn tab Codex/Pi được lưu và khôi phục sau khi tải lại. Chọn nhà cung cấp và mô hình trong cấu hình hiện có, nhập nội dung rồi gửi. Xem câu trả lời Markdown, ID mô hình trả về và thời gian tính bằng giây. Kiểm thử tiêu thụ hạn mức API; không mở CLI, đổi cấu hình hoặc lưu lịch sử. Chọn **Tất cả** trong danh sách mô hình rồi gửi để đọc toàn bộ danh mục của nhà cung cấp đã chọn. Sau khi xác nhận, hệ thống gửi cùng một tin nhắn một lần cho từng mô hình và hiển thị từng kết quả, kể cả khi có lỗi. Yêu cầu tạo phản hồi không tự thử lại, không đặt thời hạn cục bộ và giới hạn đầu ra 2048 token. Hỗ trợ Responses, Chat Completions, Completions và Anthropic Messages đã cấu hình; chưa tích hợp đăng nhập gốc hoặc khóa lấy bằng lệnh. Web không còn hiển thị cài đặt nhóm; chức năng phân phối phía máy chủ và OpenAI Chat API giữ nguyên. Xem [hướng dẫn Web UI](https://sakurabytecore.github.io/codexmate/guide/web-ui).
|
|
154
154
|
|
|
155
155
|
Yêu cầu kiểm thử dùng UA/Originator của Codex hoặc header SDK của Pi; UA đã cấu hình được ưu tiên. Đọc thiết lập suy luận/đầu ra Codex và giới hạn token, tham số tương thích của mô hình Pi. Nếu không đọc được phiên bản khách đã cài, yêu cầu dùng định danh kiểm thử CodexMate có phiên bản, không giả tạo phiên bản khách.
|
|
156
156
|
|
package/README.zh.md
CHANGED
|
@@ -127,7 +127,7 @@ Codex Mate 管理已有工具和本地记录,不是新的 AI 模型,也不
|
|
|
127
127
|
- **Usage 统计**: 可视化消息趋势与热门项目统计
|
|
128
128
|
- **提示词模板**: 调用时弹窗填写变量,支持单模板 JSON 分享、插件模板配置历史 Diff 与回滚。`git_diff` 需粘贴差异文本,不执行命令。
|
|
129
129
|
- **MCP 集成**: 通过 MCP stdio 暴露本地工具与资源
|
|
130
|
-
-
|
|
130
|
+
- **版本更新**: Windows、macOS、Linux 桌面安装版可在更新弹窗下载对应的 GitHub 安装包,再手动安装。CLI + Web 版仍可复制 `codexmate update`,在服务主机执行,更新成功后重启服务。
|
|
131
131
|
- **KiloCode 配置桥接**: 在 CLI 或 Web UI 配置 KiloCode Provider,写入 `~/.config/kilo/kilo.jsonc`,保留已存储的 API key。
|
|
132
132
|
|
|
133
133
|
</details>
|
|
@@ -150,7 +150,7 @@ Codex Mate 管理已有工具和本地记录,不是新的 AI 模型,也不
|
|
|
150
150
|
<a id="路由组"></a>
|
|
151
151
|
### 模型测试
|
|
152
152
|
|
|
153
|
-
Codex/Pi 子页签选择会保存,刷新后恢复。选择已有配置中的供应商与模型,手动输入问题后发送。查看 Markdown 回复、返回模型 ID 与耗时秒数。测试消耗 API 额度;不启动 CLI
|
|
153
|
+
Codex/Pi 子页签选择会保存,刷新后恢复。选择已有配置中的供应商与模型,手动输入问题后发送。查看 Markdown 回复、返回模型 ID 与耗时秒数。测试消耗 API 额度;不启动 CLI、不改配置、不保存测试记录。在「模型」下拉中选择「全部」,再点「发送测试」,即可读取所选供应商的完整模型目录。确认后,每个模型接收一次相同内容,单项失败不阻断后续测试。生成请求不自动重试,不设本地响应超时,输出上限 2048 Token。支持配置中的 Responses、Chat Completions、Completions 与 Anthropic Messages;原生登录与命令式凭据暂不接入。Web 已移除模型组设置入口,已有后端分配与 OpenAI Chat API 保持原行为。详见 [Web UI 指南](https://sakurabytecore.github.io/codexmate/guide/web-ui)。
|
|
154
154
|
|
|
155
155
|
测试请求使用 Codex UA/Originator 或 Pi 的 SDK 请求头,已有自定义 UA 优先。读取 Codex 的推理/输出配置及 Pi 模型的 Token 上限与兼容参数。无法读取客户端版本时使用带版本的 CodexMate 测试标识,不伪造客户端版本。
|
|
156
156
|
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const https = require('https');
|
|
4
|
+
|
|
5
|
+
const REPOSITORY = 'SakuraByteCore/codexmate';
|
|
6
|
+
const RELEASE_API = `https://api.github.com/repos/${REPOSITORY}/releases/latest`;
|
|
7
|
+
const DOWNLOAD_BASE = `https://github.com/${REPOSITORY}/releases/download/`;
|
|
8
|
+
const RELEASE_TAG = /^v\d+\.\d+\.\d+$/;
|
|
9
|
+
const METADATA_LIMIT = 1024 * 1024;
|
|
10
|
+
const PACKAGE_NAMES = {
|
|
11
|
+
win32: { stem: 'codexmate-setup', extension: '.exe', defaultArch: 'x64' },
|
|
12
|
+
darwin: { stem: 'Codex.Mate', extension: '.dmg', defaultArch: 'x64' },
|
|
13
|
+
linux: { stem: 'codexmate', extension: '.AppImage', defaultArch: 'x64' }
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
function getDesktopUpdateTarget(env = process.env) {
|
|
17
|
+
const match = /^(win32|darwin|linux)-(x64|arm64|ia32|armv7l)$/.exec(env.CODEXMATE_DESKTOP_PACKAGE || '');
|
|
18
|
+
return match ? { platform: match[1], arch: match[2] } : null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function selectDesktopAsset(release, { platform, arch }) {
|
|
22
|
+
const policy = Object.prototype.hasOwnProperty.call(PACKAGE_NAMES, platform) ? PACKAGE_NAMES[platform] : null;
|
|
23
|
+
if (!policy || !RELEASE_TAG.test(release?.tag_name) || !Array.isArray(release.assets)) return null;
|
|
24
|
+
const tag = release.tag_name;
|
|
25
|
+
const prefix = `${policy.stem}-${tag.slice(1)}`;
|
|
26
|
+
const qualified = `${prefix}-${arch}${policy.extension}`;
|
|
27
|
+
const defaultName = `${prefix}${policy.extension}`;
|
|
28
|
+
// The release workflow builds unqualified Windows/Linux assets on x64 runners.
|
|
29
|
+
// electron-builder's default macOS DMG name omits the suffix for x64.
|
|
30
|
+
const matches = release.assets.filter(asset => {
|
|
31
|
+
if (asset?.state !== 'uploaded' || !Number.isSafeInteger(asset.size) || asset.size <= 0) return false;
|
|
32
|
+
if (asset.name !== qualified && !(arch === policy.defaultArch && asset.name === defaultName)) return false;
|
|
33
|
+
return asset.browser_download_url === `${DOWNLOAD_BASE}${tag}/${asset.name}`;
|
|
34
|
+
});
|
|
35
|
+
if (matches.length !== 1) return null;
|
|
36
|
+
const { name, size, browser_download_url: url } = matches[0];
|
|
37
|
+
return { name, size, url };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function fetchDesktopRelease(timeoutMs = 5000) {
|
|
41
|
+
return new Promise((resolve, reject) => {
|
|
42
|
+
const req = https.get(RELEASE_API, { headers: { 'User-Agent': 'CodexMate', Accept: 'application/vnd.github+json' } }, (res) => {
|
|
43
|
+
if (res.statusCode !== 200) {
|
|
44
|
+
res.resume();
|
|
45
|
+
reject(new Error(`GitHub Release API returned ${res.statusCode}`));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
let body = '';
|
|
49
|
+
res.setEncoding('utf8');
|
|
50
|
+
res.on('data', chunk => {
|
|
51
|
+
body += chunk;
|
|
52
|
+
if (body.length > METADATA_LIMIT) req.destroy(new Error('GitHub Release metadata exceeds limit'));
|
|
53
|
+
});
|
|
54
|
+
res.on('error', reject);
|
|
55
|
+
res.on('end', () => {
|
|
56
|
+
try {
|
|
57
|
+
const release = JSON.parse(body);
|
|
58
|
+
if (!RELEASE_TAG.test(release?.tag_name) || release.draft || release.prerelease || !Array.isArray(release.assets)) {
|
|
59
|
+
throw new Error('Invalid GitHub Release metadata');
|
|
60
|
+
}
|
|
61
|
+
resolve(release);
|
|
62
|
+
} catch (err) {
|
|
63
|
+
reject(err);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
const deadline = setTimeout(() => req.destroy(new Error('GitHub Release check timed out')), timeoutMs);
|
|
68
|
+
req.once('close', () => clearTimeout(deadline));
|
|
69
|
+
req.on('error', reject);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
module.exports = { getDesktopUpdateTarget, fetchDesktopRelease, selectDesktopAsset };
|
package/cli/update.js
CHANGED
|
@@ -3,6 +3,7 @@ const path = require('path');
|
|
|
3
3
|
const os = require('os');
|
|
4
4
|
const https = require('https');
|
|
5
5
|
const { execSync, spawn } = require('child_process');
|
|
6
|
+
const { fetchDesktopRelease, selectDesktopAsset } = require('./desktop-release');
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* 快速更新命令实现
|
|
@@ -125,29 +126,40 @@ function comparePackageVersions(left, right) {
|
|
|
125
126
|
return 0;
|
|
126
127
|
}
|
|
127
128
|
|
|
128
|
-
|
|
129
|
+
const latestVersionStatusCache = new Map();
|
|
129
130
|
|
|
130
131
|
async function fetchLatestVersionStatus(options = {}) {
|
|
132
|
+
const { desktopTarget } = options;
|
|
131
133
|
const currentVersion = normalizePackageVersion(options.currentVersion) || String(options.currentVersion || '');
|
|
132
134
|
const timeoutMs = Number.isFinite(Number(options.timeoutMs)) ? Number(options.timeoutMs) : 5000;
|
|
133
135
|
const cacheTtlMs = Number.isFinite(Number(options.cacheTtlMs)) ? Math.max(0, Number(options.cacheTtlMs)) : 10 * 60 * 1000;
|
|
134
136
|
const now = typeof options.now === 'function' ? options.now() : Date.now();
|
|
135
|
-
|
|
136
|
-
|
|
137
|
+
const source = desktopTarget ? 'github' : 'npm';
|
|
138
|
+
const cacheKey = desktopTarget ? `${source}:${desktopTarget.platform}:${desktopTarget.arch}` : source;
|
|
139
|
+
const cached = latestVersionStatusCache.get(cacheKey);
|
|
140
|
+
const useCache = cached && cacheTtlMs > 0 && now - cached.checkedAtMs < cacheTtlMs;
|
|
141
|
+
if (!useCache) latestVersionStatusCache.delete(cacheKey);
|
|
142
|
+
|
|
143
|
+
let metadata;
|
|
144
|
+
if (useCache) {
|
|
145
|
+
metadata = cached.metadata;
|
|
146
|
+
} else if (desktopTarget) {
|
|
147
|
+
const release = await fetchDesktopRelease(timeoutMs);
|
|
148
|
+
metadata = { latestVersion: normalizePackageVersion(release.tag_name), asset: selectDesktopAsset(release, desktopTarget) };
|
|
149
|
+
} else {
|
|
150
|
+
const raw = await fetchLatestVersion({ timeoutMs });
|
|
151
|
+
metadata = { latestVersion: normalizePackageVersion(raw) || String(raw || '') };
|
|
137
152
|
}
|
|
138
|
-
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
latestVersion,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
cached: false
|
|
153
|
+
const { latestVersion, asset } = metadata;
|
|
154
|
+
const checkedAtMs = useCache ? cached.checkedAtMs : now;
|
|
155
|
+
latestVersionStatusCache.set(cacheKey, { checkedAtMs, metadata });
|
|
156
|
+
const updateAvailable = !!currentVersion && !!latestVersion && comparePackageVersions(currentVersion, latestVersion) < 0;
|
|
157
|
+
return {
|
|
158
|
+
currentVersion, latestVersion, updateAvailable, source,
|
|
159
|
+
checkedAt: new Date(checkedAtMs).toISOString(),
|
|
160
|
+
cached: !!useCache,
|
|
161
|
+
...(desktopTarget ? { updateAction: 'download', asset: updateAvailable ? asset : null } : {})
|
|
148
162
|
};
|
|
149
|
-
latestVersionStatusCache = { checkedAtMs: now, payload };
|
|
150
|
-
return payload;
|
|
151
163
|
}
|
|
152
164
|
|
|
153
165
|
function detectInstallMethod() {
|
package/cli.js
CHANGED
|
@@ -182,6 +182,7 @@ const {
|
|
|
182
182
|
} = require('./cli/skills');
|
|
183
183
|
const { cmdImportSkills: cmdImportSkillsFromUrl } = require('./cli/import-skills-url');
|
|
184
184
|
const { cmdToolUpdate, fetchLatestVersionStatus } = require('./cli/update');
|
|
185
|
+
const { getDesktopUpdateTarget } = require('./cli/desktop-release');
|
|
185
186
|
const {
|
|
186
187
|
getFileStatSafe,
|
|
187
188
|
isBootstrapLikeText,
|
|
@@ -512,7 +513,7 @@ function getModelTestProviders(target) {
|
|
|
512
513
|
const key = typeof provider.apiKey === 'string' ? provider.apiKey.trim() : '';
|
|
513
514
|
const models = Array.isArray(provider.models) ? provider.models : [];
|
|
514
515
|
return { name, baseUrl: provider.baseUrl, api: apis[provider.api] || provider.api,
|
|
515
|
-
apiKey: process.env[key] || key, headers: provider.headers,
|
|
516
|
+
apiKey: process.env[key] || key, headers: provider.headers, compat: provider.compat,
|
|
516
517
|
error: key.startsWith('!') ? '命令式凭据暂不支持真实测试,请使用已有环境变量配置' : '',
|
|
517
518
|
models: models.map(model => model.id).filter(id => typeof id === 'string' && id.trim()),
|
|
518
519
|
modelOptions: Object.fromEntries(models.filter(model => model && model.id).map(model => [model.id, {
|
|
@@ -14718,15 +14719,17 @@ function createWebServer({ htmlPath, assetsDir, webDir, host, port, openBrowser
|
|
|
14718
14719
|
return '';
|
|
14719
14720
|
}
|
|
14720
14721
|
})();
|
|
14722
|
+
const desktopTarget = getDesktopUpdateTarget();
|
|
14721
14723
|
try {
|
|
14722
14724
|
const force = !!(params && params.force);
|
|
14723
|
-
result = await fetchLatestVersionStatus({ currentVersion, timeoutMs: 2000, cacheTtlMs: force ? 0 : undefined });
|
|
14725
|
+
result = await fetchLatestVersionStatus({ currentVersion, desktopTarget, timeoutMs: desktopTarget ? 5000 : 2000, cacheTtlMs: force ? 0 : undefined });
|
|
14724
14726
|
} catch (e) {
|
|
14725
14727
|
result = {
|
|
14726
14728
|
currentVersion,
|
|
14727
14729
|
latestVersion: '',
|
|
14728
14730
|
updateAvailable: false,
|
|
14729
|
-
source: 'npm',
|
|
14731
|
+
source: desktopTarget ? 'github' : 'npm',
|
|
14732
|
+
...(desktopTarget ? { updateAction: 'download', asset: null } : {}),
|
|
14730
14733
|
checkedAt: new Date().toISOString(),
|
|
14731
14734
|
cached: false,
|
|
14732
14735
|
error: e && e.message ? e.message : '获取最新版本失败'
|
|
@@ -15309,6 +15312,9 @@ function createWebServer({ htmlPath, assetsDir, webDir, host, port, openBrowser
|
|
|
15309
15312
|
case 'model-test-catalog':
|
|
15310
15313
|
result = { catalogs: modelTests.catalog() };
|
|
15311
15314
|
break;
|
|
15315
|
+
case 'model-test-discover':
|
|
15316
|
+
result = await modelTests.discover(params || {});
|
|
15317
|
+
break;
|
|
15312
15318
|
case 'model-test-run':
|
|
15313
15319
|
result = await modelTests.run(params || {});
|
|
15314
15320
|
break;
|
package/lib/model-test.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const { createHash, randomUUID } = require('crypto');
|
|
1
2
|
const http = require('http');
|
|
2
3
|
const https = require('https');
|
|
3
4
|
const { modelTestClientHeaders } = require('./model-test-client');
|
|
@@ -6,6 +7,10 @@ const { buildApiProbeUrlCandidates, extractModelResponseText } = require('./cli-
|
|
|
6
7
|
const MAX_PROMPT_LENGTH = 8000;
|
|
7
8
|
const MAX_RESPONSE_BYTES = 256 * 1024;
|
|
8
9
|
const MAX_OUTPUT_TOKENS = 2048;
|
|
10
|
+
const MAX_CATALOG_BYTES = 8 * 1024 * 1024;
|
|
11
|
+
const MAX_CATALOG_PAGES = 1000;
|
|
12
|
+
const MAX_CATALOG_SNAPSHOTS = 32;
|
|
13
|
+
const CATALOG_TIMEOUT_MS = 20000;
|
|
9
14
|
const SUPPORTED_APIS = new Set(['responses', 'chat_completions', 'completions', 'anthropic-messages']);
|
|
10
15
|
const PI_NON_STANDARD_PROVIDERS = new Set(['cerebras', 'xai', 'zai', 'opencode']);
|
|
11
16
|
|
|
@@ -14,14 +19,7 @@ function buildTestRequest(provider, model, prompt) {
|
|
|
14
19
|
if (!SUPPORTED_APIS.has(api)) throw new Error('此配置的接口暂不支持真实测试');
|
|
15
20
|
const paths = { responses: 'responses', chat_completions: 'chat/completions', completions: 'completions', 'anthropic-messages': 'messages' };
|
|
16
21
|
const url = buildApiProbeUrlCandidates(provider.baseUrl, paths[api])[0];
|
|
17
|
-
const
|
|
18
|
-
const authentication = api === 'anthropic-messages'
|
|
19
|
-
? { 'anthropic-version': '2023-06-01', ...(key ? { 'x-api-key': key } : {}) }
|
|
20
|
-
: key ? { authorization: `Bearer ${key}` } : {};
|
|
21
|
-
const headers = Object.fromEntries([
|
|
22
|
-
...Object.entries(provider.clientHeaders || {}), ...Object.entries(authentication),
|
|
23
|
-
...Object.entries(provider.headers || {})
|
|
24
|
-
].map(([name, value]) => [name.toLowerCase(), value]));
|
|
22
|
+
const headers = buildTestHeaders(provider);
|
|
25
23
|
const maxTokens = Number.isFinite(provider.maxTokens) && provider.maxTokens > 0
|
|
26
24
|
? Math.min(provider.maxTokens, MAX_OUTPUT_TOKENS) : MAX_OUTPUT_TOKENS;
|
|
27
25
|
let body;
|
|
@@ -51,22 +49,33 @@ function buildTestRequest(provider, model, prompt) {
|
|
|
51
49
|
return { url, headers, body };
|
|
52
50
|
}
|
|
53
51
|
|
|
52
|
+
function buildTestHeaders(provider) {
|
|
53
|
+
const key = (provider.apiKey || '').replace(/^Bearer\s+/i, '');
|
|
54
|
+
const authentication = provider.api === 'anthropic-messages'
|
|
55
|
+
? { 'anthropic-version': '2023-06-01', ...(key ? { 'x-api-key': key } : {}) }
|
|
56
|
+
: key ? { authorization: `Bearer ${key}` } : {};
|
|
57
|
+
return Object.fromEntries([
|
|
58
|
+
...Object.entries(provider.clientHeaders || {}), ...Object.entries(authentication),
|
|
59
|
+
...Object.entries(provider.headers || {})
|
|
60
|
+
].map(([name, value]) => [name.toLowerCase(), value]));
|
|
61
|
+
}
|
|
62
|
+
|
|
54
63
|
function requestModel({ url, headers, body }, { timeoutMs = 0, maxBytes = MAX_RESPONSE_BYTES } = {}) {
|
|
55
64
|
return new Promise((resolve, reject) => {
|
|
56
65
|
const parsed = new URL(url);
|
|
57
66
|
if (!['http:', 'https:'].includes(parsed.protocol)) throw new Error('供应商地址必须使用 HTTP 或 HTTPS');
|
|
58
|
-
const payload = JSON.stringify(body);
|
|
67
|
+
const payload = body === undefined ? undefined : JSON.stringify(body);
|
|
59
68
|
const transport = parsed.protocol === 'https:' ? https : http;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
...
|
|
69
|
+
const request = transport.request(parsed, { method: payload === undefined ? 'GET' : 'POST', headers: {
|
|
70
|
+
...headers, Accept: 'application/json',
|
|
71
|
+
...(payload === undefined ? {} : { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) })
|
|
63
72
|
} }, response => {
|
|
64
73
|
const chunks = [];
|
|
65
74
|
let size = 0;
|
|
66
75
|
response.on('data', chunk => {
|
|
67
76
|
size += chunk.length;
|
|
68
77
|
if (size > maxBytes) {
|
|
69
|
-
reject(new Error('
|
|
78
|
+
reject(new Error(`回复超过 ${body === undefined ? '8 MiB' : '256 KiB'},测试已停止`));
|
|
70
79
|
response.destroy(); request.destroy(); return;
|
|
71
80
|
}
|
|
72
81
|
chunks.push(chunk);
|
|
@@ -87,7 +96,95 @@ function requestModel({ url, headers, body }, { timeoutMs = 0, maxBytes = MAX_RE
|
|
|
87
96
|
});
|
|
88
97
|
}
|
|
89
98
|
|
|
90
|
-
function
|
|
99
|
+
function readListedModels(payload) {
|
|
100
|
+
const items = Array.isArray(payload) ? payload : payload.data ?? payload.models;
|
|
101
|
+
if (!Array.isArray(items)) throw new Error('上游未返回有效模型目录');
|
|
102
|
+
return items.map(item => {
|
|
103
|
+
const id = typeof item === 'string' ? item : item?.id ?? item?.model ?? item?.name;
|
|
104
|
+
if (typeof id !== 'string' || !id.trim()) throw new Error('上游模型目录缺少模型 ID');
|
|
105
|
+
return id.trim();
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function nextCatalogPage(payload, currentUrl, ids) {
|
|
110
|
+
const next = payload.next ?? payload.links?.next;
|
|
111
|
+
if (next != null && typeof next !== 'string') throw new Error('上游返回无效的模型目录分页地址');
|
|
112
|
+
if (next) {
|
|
113
|
+
const url = new URL(next, currentUrl);
|
|
114
|
+
if (url.origin !== currentUrl.origin || url.pathname !== currentUrl.pathname || url.username || url.password) {
|
|
115
|
+
throw new Error('上游目录分页地址超出当前供应商模型目录');
|
|
116
|
+
}
|
|
117
|
+
url.hash = '';
|
|
118
|
+
return url;
|
|
119
|
+
}
|
|
120
|
+
if (!payload.has_more) return null;
|
|
121
|
+
const cursor = payload.last_id ?? ids.at(-1);
|
|
122
|
+
if (typeof cursor !== 'string' || !cursor) throw new Error('上游模型目录缺少分页游标');
|
|
123
|
+
const url = new URL(currentUrl);
|
|
124
|
+
url.searchParams.set('after', cursor);
|
|
125
|
+
return url;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
async function discoverProviderModels(provider, request) {
|
|
129
|
+
const baseUrl = new URL(provider.baseUrl);
|
|
130
|
+
if (!['http:', 'https:'].includes(baseUrl.protocol)) throw new Error('供应商地址必须使用 HTTP 或 HTTPS');
|
|
131
|
+
const urls = /\/models\/?$/.test(baseUrl.pathname) ? [baseUrl.href]
|
|
132
|
+
: buildApiProbeUrlCandidates(baseUrl.origin + baseUrl.pathname, 'models');
|
|
133
|
+
const headers = buildTestHeaders(provider);
|
|
134
|
+
const deadline = Date.now() + CATALOG_TIMEOUT_MS;
|
|
135
|
+
for (const candidate of urls) {
|
|
136
|
+
let url = new URL(candidate);
|
|
137
|
+
url.search = baseUrl.search;
|
|
138
|
+
url.hash = '';
|
|
139
|
+
const models = new Set();
|
|
140
|
+
const visited = new Set();
|
|
141
|
+
let bytesRead = 0;
|
|
142
|
+
do {
|
|
143
|
+
if (visited.has(url.href) || visited.size >= MAX_CATALOG_PAGES) throw new Error('上游模型目录分页循环或超出上限');
|
|
144
|
+
visited.add(url.href);
|
|
145
|
+
const timeoutMs = deadline - Date.now();
|
|
146
|
+
if (timeoutMs <= 0) throw new Error('读取上游模型目录超时');
|
|
147
|
+
const result = await request({ url: url.href, headers }, { timeoutMs, maxBytes: MAX_CATALOG_BYTES - bytesRead });
|
|
148
|
+
bytesRead += Buffer.byteLength(result.body);
|
|
149
|
+
if (visited.size === 1 && [404, 405, 501].includes(result.status)) break;
|
|
150
|
+
if (result.status !== 200) throw new Error(`读取上游模型目录失败:HTTP ${result.status}`);
|
|
151
|
+
let payload;
|
|
152
|
+
try { payload = JSON.parse(result.body); } catch (_) { throw new Error('上游未返回有效模型目录'); }
|
|
153
|
+
if (!payload || payload.error) throw new Error('上游未返回有效模型目录');
|
|
154
|
+
const ids = readListedModels(payload);
|
|
155
|
+
for (const id of ids) models.add(id);
|
|
156
|
+
url = nextCatalogPage(payload, url, ids);
|
|
157
|
+
} while (url);
|
|
158
|
+
if (!url) return models;
|
|
159
|
+
}
|
|
160
|
+
throw new Error('供应商未开放模型目录');
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function providerFingerprint(provider) {
|
|
164
|
+
return createHash('sha256').update(JSON.stringify(provider)).digest('hex');
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function createModelTestService({ providers, request = requestModel, listRequest = requestModel, clientHeaders = modelTestClientHeaders }) {
|
|
168
|
+
const snapshots = new Map();
|
|
169
|
+
function resolveProvider(target, name) {
|
|
170
|
+
if (!['codex', 'pi'].includes(target)) throw new Error('测试仅支持 Codex 和 Pi');
|
|
171
|
+
const provider = providers(target).find(entry => entry.name === name);
|
|
172
|
+
if (!provider) throw new Error('请选择已有供应商与模型,刷新后重试');
|
|
173
|
+
if (provider.error) throw new Error(provider.error);
|
|
174
|
+
return provider;
|
|
175
|
+
}
|
|
176
|
+
async function discover({ target, provider: name } = {}) {
|
|
177
|
+
try {
|
|
178
|
+
const provider = resolveProvider(target, name);
|
|
179
|
+
if (!provider.baseUrl) throw new Error('供应商未配置模型目录地址');
|
|
180
|
+
const models = await discoverProviderModels({ ...provider, clientHeaders: clientHeaders(target, provider.api) }, listRequest);
|
|
181
|
+
const catalogId = randomUUID();
|
|
182
|
+
// Bind the allowlist to the selected configuration. A changed provider must be rediscovered.
|
|
183
|
+
snapshots.set(catalogId, { target, name, fingerprint: providerFingerprint(provider), models });
|
|
184
|
+
if (snapshots.size > MAX_CATALOG_SNAPSHOTS) snapshots.delete(snapshots.keys().next().value);
|
|
185
|
+
return { models: [...models], catalogId };
|
|
186
|
+
} catch (error) { return { error: error.message }; }
|
|
187
|
+
}
|
|
91
188
|
function catalog() {
|
|
92
189
|
return Object.fromEntries(['codex', 'pi'].map(target => [target, providers(target).map(provider => ({
|
|
93
190
|
name: provider.name, models: provider.models, supported: SUPPORTED_APIS.has(provider.api)
|
|
@@ -98,13 +195,21 @@ function createModelTestService({ providers, request = requestModel, clientHeade
|
|
|
98
195
|
const identity = { target: params.target, provider: params.provider, model: params.model };
|
|
99
196
|
const elapsed = () => Date.now() - started;
|
|
100
197
|
try {
|
|
101
|
-
const { target, provider: name, model, prompt } = params;
|
|
102
|
-
if (!['codex', 'pi'].includes(target)) throw new Error('测试仅支持 Codex 和 Pi');
|
|
198
|
+
const { target, provider: name, model, prompt, catalogId } = params;
|
|
103
199
|
if (typeof prompt !== 'string' || !prompt.trim() || prompt.length > MAX_PROMPT_LENGTH) throw new Error('输入 1–8000 字符的测试内容');
|
|
104
|
-
const provider =
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
|
|
200
|
+
const provider = resolveProvider(target, name);
|
|
201
|
+
if (catalogId !== undefined) {
|
|
202
|
+
const snapshot = snapshots.get(catalogId);
|
|
203
|
+
if (snapshot?.target !== target || snapshot.name !== name || !snapshot.models.has(model)
|
|
204
|
+
|| snapshot.fingerprint !== providerFingerprint(provider)) throw new Error('模型目录已失效,请重新读取供应商目录');
|
|
205
|
+
// Keep active batches in the bounded cache, without persisting any results.
|
|
206
|
+
snapshots.delete(catalogId);
|
|
207
|
+
snapshots.set(catalogId, snapshot);
|
|
208
|
+
} else if (!provider.models.includes(model)) throw new Error('请选择已有供应商与模型,刷新后重试');
|
|
209
|
+
const overrides = provider.modelOptions && Object.hasOwn(provider.modelOptions, model) ? provider.modelOptions[model] : {};
|
|
210
|
+
const selected = { ...provider, ...overrides, target };
|
|
211
|
+
// The batch belongs to the endpoint that advertised these IDs, not a saved model’s alternate endpoint.
|
|
212
|
+
if (catalogId !== undefined) selected.baseUrl = provider.baseUrl;
|
|
108
213
|
selected.clientHeaders = clientHeaders(target, selected.api);
|
|
109
214
|
const result = await request(buildTestRequest(selected, model, prompt.trim()));
|
|
110
215
|
if (result.status < 200 || result.status >= 300) return { ...identity, ok: false, status: result.status, durationMs: elapsed(), error: `HTTP ${result.status}` };
|
|
@@ -120,7 +225,7 @@ function createModelTestService({ providers, request = requestModel, clientHeade
|
|
|
120
225
|
return { ...identity, ok: false, durationMs: elapsed(), error: error.message };
|
|
121
226
|
}
|
|
122
227
|
}
|
|
123
|
-
return { catalog, run };
|
|
228
|
+
return { catalog, discover, run };
|
|
124
229
|
}
|
|
125
230
|
|
|
126
231
|
module.exports = { createModelTestService, buildTestRequest, requestModel };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codexmate",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.39",
|
|
4
4
|
"description": "Codex/Claude Code/OpenClaw 配置、会话与任务编排 CLI + Web 工具",
|
|
5
5
|
"main": "cli.js",
|
|
6
6
|
"bin": {
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
".": "./cli.js",
|
|
24
24
|
"./lib/*": "./lib/*.js",
|
|
25
25
|
"./web-ui/*": "./web-ui/*",
|
|
26
|
+
"./desktop-release": "./cli/desktop-release.js",
|
|
26
27
|
"./res/*": "./web-ui/res/*"
|
|
27
28
|
},
|
|
28
29
|
"scripts": {
|
|
@@ -30,6 +31,8 @@
|
|
|
30
31
|
"start": "node cli.js",
|
|
31
32
|
"reset": "node tools/dev/reset-main.js",
|
|
32
33
|
"release:npm": "node tools/release/publish-npm.js",
|
|
34
|
+
"generate:web-render": "node tools/dev/generate-web-render.js",
|
|
35
|
+
"generate:web-locales": "node tools/dev/generate-web-locales.mjs",
|
|
33
36
|
"docs:dev": "node ./node_modules/vitepress/dist/node/cli.js dev site",
|
|
34
37
|
"docs:build": "node ./node_modules/vitepress/dist/node/cli.js build site",
|
|
35
38
|
"docs:preview": "node ./node_modules/vitepress/dist/node/cli.js preview site",
|
|
@@ -42,17 +42,11 @@ export async function loadPromptTemplatesOverview(ctx, options = {}) {
|
|
|
42
42
|
|
|
43
43
|
app.promptTemplatesLoadedOnce = true;
|
|
44
44
|
|
|
45
|
-
if (!app.promptTemplatesMode) {
|
|
46
|
-
app.promptTemplatesMode = 'compose';
|
|
47
|
-
}
|
|
48
45
|
if (app.promptTemplatesMode !== 'compose' && app.promptTemplatesMode !== 'manage') {
|
|
49
46
|
app.promptTemplatesMode = 'compose';
|
|
50
47
|
}
|
|
51
|
-
if (app.mainTab === 'plugins') {
|
|
52
|
-
app.promptTemplatesMode = 'compose';
|
|
53
|
-
}
|
|
54
48
|
|
|
55
|
-
if (app.mainTab === 'plugins'
|
|
49
|
+
if (app.mainTab === 'plugins') {
|
|
56
50
|
const list = Array.isArray(app.promptTemplatesList) ? app.promptTemplatesList : [];
|
|
57
51
|
const storedSelected = readPromptTemplateSelectedIdFromStorage(localStorage);
|
|
58
52
|
const exists = list.some((item) => item && item.id === app.promptComposerSelectedTemplateId);
|
package/web-ui/app.js
CHANGED
|
@@ -146,6 +146,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
146
146
|
showHealthCheckModal: false,
|
|
147
147
|
showProviderCacheModal: false,
|
|
148
148
|
showProviderCacheAnnouncementModal: false,
|
|
149
|
+
hasReadSideAnnouncement: false,
|
|
149
150
|
showCodexBridgePoolModal: false,
|
|
150
151
|
showClaudeBridgePoolModal: false,
|
|
151
152
|
showWebhookModal: false,
|
|
@@ -462,6 +463,10 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
462
463
|
installStatusTargets: null,
|
|
463
464
|
appLatestVersion: '',
|
|
464
465
|
showAppUpdateModal: false,
|
|
466
|
+
appUpdateAction: 'command',
|
|
467
|
+
appUpdateAsset: null,
|
|
468
|
+
appUpdateDownloadPending: false,
|
|
469
|
+
appUpdateDownloadStatus: '',
|
|
465
470
|
appVersionStatusLoading: false,
|
|
466
471
|
appVersionStatusError: '',
|
|
467
472
|
appVersionStatusChecked: false,
|
|
@@ -72,7 +72,7 @@ export function createInstallMethods(options = {}) {
|
|
|
72
72
|
},
|
|
73
73
|
|
|
74
74
|
appUpdateNoticeMeta() {
|
|
75
|
-
if (this.appVersionStatusLoading) return this.t('side.update.checkingMeta');
|
|
75
|
+
if (this.appVersionStatusLoading) return this.t(this.appUpdateAction === 'download' ? 'side.update.checking' : 'side.update.checkingMeta');
|
|
76
76
|
if (this.appVersionStatusError) return this.appVersionStatusError;
|
|
77
77
|
const current = this.normalizePackageVersion(this.appVersion);
|
|
78
78
|
const latest = this.normalizePackageVersion(this.appLatestVersion);
|
|
@@ -106,10 +106,39 @@ export function createInstallMethods(options = {}) {
|
|
|
106
106
|
return APP_UPDATE_COMMAND;
|
|
107
107
|
},
|
|
108
108
|
|
|
109
|
+
hasNativeAppUpdateDownload() {
|
|
110
|
+
return typeof window !== 'undefined' && typeof window.desktopBridge?.downloadUpdate === 'function';
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
async downloadAppUpdate() {
|
|
114
|
+
const asset = this.appUpdateAsset;
|
|
115
|
+
if (this.appUpdateAction !== 'download' || !asset || this.appUpdateDownloadPending || !this.hasNativeAppUpdateDownload()) return;
|
|
116
|
+
this.appUpdateDownloadStatus = '';
|
|
117
|
+
this.appUpdateDownloadPending = true;
|
|
118
|
+
try {
|
|
119
|
+
const result = await window.desktopBridge.downloadUpdate(asset.url);
|
|
120
|
+
if (this.appUpdateAsset === asset) {
|
|
121
|
+
this.appUpdateDownloadStatus = ['completed', 'cancelled', 'unavailable'].includes(result?.status)
|
|
122
|
+
? result.status : 'failed';
|
|
123
|
+
}
|
|
124
|
+
} catch (_) {
|
|
125
|
+
if (this.appUpdateAsset === asset) this.appUpdateDownloadStatus = 'failed';
|
|
126
|
+
} finally {
|
|
127
|
+
this.appUpdateDownloadPending = false;
|
|
128
|
+
if (this.showAppUpdateModal) this.$nextTick(() => (document.getElementById('app-update-primary') || document.getElementById('app-update-close'))?.focus());
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
async retryAppUpdateDownloadCheck() {
|
|
133
|
+
await this.loadAppVersionStatus({ silent: true, force: true });
|
|
134
|
+
if (this.showAppUpdateModal) this.$nextTick(() => (document.getElementById('app-update-primary') || document.getElementById('app-update-close'))?.focus());
|
|
135
|
+
},
|
|
136
|
+
|
|
109
137
|
openAppUpdateModal(trigger) {
|
|
110
138
|
this._appUpdateTrigger = trigger || document.activeElement;
|
|
111
139
|
this.showAppUpdateModal = true;
|
|
112
|
-
this
|
|
140
|
+
const focusId = this.appUpdateAction === 'download' ? 'app-update-primary' : 'app-update-command';
|
|
141
|
+
this.$nextTick(() => document.getElementById(focusId)?.focus());
|
|
113
142
|
},
|
|
114
143
|
|
|
115
144
|
closeAppUpdateModal() {
|
|
@@ -126,6 +155,8 @@ export function createInstallMethods(options = {}) {
|
|
|
126
155
|
this.appVersionStatusError = '';
|
|
127
156
|
this.appVersionStatusChecked = false;
|
|
128
157
|
this.appLatestVersion = '';
|
|
158
|
+
this.appUpdateAsset = null;
|
|
159
|
+
this.appUpdateDownloadStatus = '';
|
|
129
160
|
this.appVersionStatusSource = '';
|
|
130
161
|
this.appVersionStatusCheckedAt = '';
|
|
131
162
|
try {
|
|
@@ -133,12 +164,17 @@ export function createInstallMethods(options = {}) {
|
|
|
133
164
|
if (!this.appVersion) {
|
|
134
165
|
this.appVersion = this.normalizePackageVersion(res?.currentVersion);
|
|
135
166
|
}
|
|
167
|
+
if (res?.updateAction === 'download') this.appUpdateAction = 'download';
|
|
136
168
|
if (res?.error) throw new Error(res.error);
|
|
137
169
|
const latestVersion = this.normalizePackageVersion(res?.latestVersion);
|
|
138
170
|
if (!latestVersion || !this.normalizePackageVersion(this.appVersion)) {
|
|
139
171
|
throw new Error(this.t('side.update.checkFailed'));
|
|
140
172
|
}
|
|
141
173
|
this.appLatestVersion = latestVersion;
|
|
174
|
+
this.appUpdateAction = res.updateAction === 'download' ? 'download' : 'command';
|
|
175
|
+
if (this.appUpdateAction === 'download' && this.isAppUpdateAvailable() && res.asset?.url && res.asset?.name) {
|
|
176
|
+
this.appUpdateAsset = res.asset;
|
|
177
|
+
}
|
|
142
178
|
this.appVersionStatusSource = typeof res.source === 'string' ? res.source : '';
|
|
143
179
|
this.appVersionStatusCheckedAt = typeof res.checkedAt === 'string' ? res.checkedAt : '';
|
|
144
180
|
this.appVersionStatusChecked = true;
|
|
@@ -17,6 +17,8 @@ export function createProviderCacheMethods(options = {}) {
|
|
|
17
17
|
|
|
18
18
|
async openProviderCacheAnnouncementModal() {
|
|
19
19
|
this.showProviderCacheAnnouncementModal = true;
|
|
20
|
+
this.hasReadSideAnnouncement = true;
|
|
21
|
+
this.$nextTick?.(() => this.$refs.sideAnnouncementClose?.focus());
|
|
20
22
|
if (!this.providerCacheLoadedOnce) {
|
|
21
23
|
await this.loadProviderCacheRecords();
|
|
22
24
|
}
|
|
@@ -24,6 +26,7 @@ export function createProviderCacheMethods(options = {}) {
|
|
|
24
26
|
|
|
25
27
|
closeProviderCacheAnnouncementModal() {
|
|
26
28
|
this.showProviderCacheAnnouncementModal = false;
|
|
29
|
+
this.$nextTick?.(() => this.$refs.sideAnnouncementTrigger?.focus());
|
|
27
30
|
},
|
|
28
31
|
|
|
29
32
|
async openProviderCacheDetailsFromAnnouncement() {
|