vanspod 0.4.7 → 0.4.9
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 +4 -4
- package/dist/classroomApp.js +18 -9
- package/dist/start.js +2 -1
- package/dist/version.js +1 -1
- package/dist/vsCodeRouteSettings.js +21 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ npm run dist
|
|
|
38
38
|
npm pack --pack-destination dist
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
exe 產物為 `dist/VansPod.exe`,本機套件為 `dist/vanspod-0.4.
|
|
41
|
+
exe 產物為 `dist/VansPod.exe`,本機套件為 `dist/vanspod-0.4.9.tgz`;可在 Windows 用 `npm install -g <套件路徑>` 安裝測試。圖片、favicon、系統匣與移除腳本均包含在發佈產物中。更新 logo 後執行 `powershell.exe -NoProfile -File scripts/build-icon.ps1` 重建多尺寸 Windows icon。
|
|
42
42
|
|
|
43
43
|
exe 發佈管道為本專案 GitHub Releases,npm 為公開 registry 的 [`vanspod`](https://www.npmjs.com/package/vanspod) 套件。更新時不要執行完整移除,否則會清除課堂資料。
|
|
44
44
|
|
|
@@ -46,12 +46,12 @@ exe 發佈管道為本專案 GitHub Releases,npm 為公開 registry 的 [`vans
|
|
|
46
46
|
|
|
47
47
|
一般 push 不發佈;推送 `v*` tag 會在 Windows runner 安裝 Node.js 24、檢查型別、執行測試、打包並驗證 exe/npm 生命週期,全部通過後才建立 GitHub Release,最後發佈 npm 套件。學生從 Release 下載 `VansPod.exe`,同頁提供 `SHA256SUMS.txt`。
|
|
48
48
|
|
|
49
|
-
發版前同步 `package.json`、`package-lock.json` 與 `src/version.ts` 的版本;tag 必須等於 `v` 加版本號,否則流程失敗。以 `0.4.
|
|
49
|
+
發版前同步 `package.json`、`package-lock.json` 與 `src/version.ts` 的版本;tag 必須等於 `v` 加版本號,否則流程失敗。以 `0.4.9` 為例:
|
|
50
50
|
|
|
51
51
|
```powershell
|
|
52
52
|
git push origin master
|
|
53
|
-
git tag -a v0.4.
|
|
54
|
-
git push origin v0.4.
|
|
53
|
+
git tag -a v0.4.9 -m "VansPod 0.4.9"
|
|
54
|
+
git push origin v0.4.9
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
新版本使用新的版本號與 tag。相同 tag 的 Actions 重跑會更新該 Release 的產物。
|
package/dist/classroomApp.js
CHANGED
|
@@ -26,6 +26,7 @@ const KEY_REJECTED_NOTICE = {
|
|
|
26
26
|
invalid: "Classroom API Key 已失效,請按「清除連線」,再用老師給的新邀請碼重新兌換。",
|
|
27
27
|
};
|
|
28
28
|
const MODELS_UNLOADED_NOTICE = "無法載入課堂模型,請按「↻ 更新」再試。";
|
|
29
|
+
const VS_CODE_KEPT_NOTICE = "VS Code 的 VCRouter 已被修改,不再指向 VansPod,VansPod 沒有移除它。";
|
|
29
30
|
const RESTORE_FETCH_ATTEMPTS = 3;
|
|
30
31
|
const RESTORE_FETCH_RETRY_MS = 1_000;
|
|
31
32
|
const INSTALL_UNAVAILABLE = "尚未指定專案資料夾,安裝不可用。";
|
|
@@ -815,7 +816,7 @@ class ClassroomApp {
|
|
|
815
816
|
// Storage is committed: publish its identity before any client-file operation can fail.
|
|
816
817
|
if (desiredVsCodeMode === "classroom") {
|
|
817
818
|
try {
|
|
818
|
-
await this.
|
|
819
|
+
await this.restoreVsCodeRoute();
|
|
819
820
|
}
|
|
820
821
|
catch {
|
|
821
822
|
this.clientRoutes.vsCodeChat.health = "red";
|
|
@@ -1020,9 +1021,10 @@ class ClassroomApp {
|
|
|
1020
1021
|
route.mode = mode;
|
|
1021
1022
|
try {
|
|
1022
1023
|
await this.saveClientRoutePreferences();
|
|
1024
|
+
this.notice = undefined;
|
|
1023
1025
|
const result = mode === "classroom"
|
|
1024
1026
|
? await this.deps.vsCodeRouteSettings?.publish({ providers: this.modelProviders, adapter: route.adapter, origin: this.vsCodeOrigin })
|
|
1025
|
-
: await this.
|
|
1027
|
+
: await this.restoreVsCodeRoute();
|
|
1026
1028
|
if (mode === "classroom")
|
|
1027
1029
|
this.settleVsCodePublish(result?.changed);
|
|
1028
1030
|
else {
|
|
@@ -1031,7 +1033,6 @@ class ClassroomApp {
|
|
|
1031
1033
|
if (result?.changed)
|
|
1032
1034
|
this.noteModelRestart("vscode");
|
|
1033
1035
|
}
|
|
1034
|
-
this.notice = undefined;
|
|
1035
1036
|
}
|
|
1036
1037
|
catch (error) {
|
|
1037
1038
|
this.clientRoutes.vsCodeChat = previous;
|
|
@@ -1322,7 +1323,7 @@ class ClassroomApp {
|
|
|
1322
1323
|
}
|
|
1323
1324
|
if (retryingNativeRecovery) {
|
|
1324
1325
|
try {
|
|
1325
|
-
await this.
|
|
1326
|
+
await this.restoreVsCodeRoute();
|
|
1326
1327
|
this.clientRoutes.vsCodeChat.health = "green";
|
|
1327
1328
|
this.clientRoutes.vsCodeChat.restart = "ready";
|
|
1328
1329
|
}
|
|
@@ -1347,7 +1348,8 @@ class ClassroomApp {
|
|
|
1347
1348
|
if (this.clientRoutes.vsCodeChat.mode === "classroom")
|
|
1348
1349
|
this.noteClassroomAwaitingModels("vsCodeChat");
|
|
1349
1350
|
this.clientRoutes.vsCodeChat.mode = "native";
|
|
1350
|
-
await this.deps.vsCodeRouteSettings?.initializeNative()
|
|
1351
|
+
if ((await this.deps.vsCodeRouteSettings?.initializeNative())?.kept)
|
|
1352
|
+
this.notice = VS_CODE_KEPT_NOTICE;
|
|
1351
1353
|
this.clientRoutes.vsCodeChat.health = "green";
|
|
1352
1354
|
this.clientRoutes.vsCodeChat.restart = "ready";
|
|
1353
1355
|
}
|
|
@@ -1363,9 +1365,16 @@ class ClassroomApp {
|
|
|
1363
1365
|
}
|
|
1364
1366
|
catch { /* Route health remains visible. */ }
|
|
1365
1367
|
}
|
|
1368
|
+
// 不再指向 VansPod 的 VCRouter 會留在 VS Code 裡,要讓學生知道(ADR-0005 2026-10-26 補充)。
|
|
1369
|
+
async restoreVsCodeRoute() {
|
|
1370
|
+
const result = await this.deps.vsCodeRouteSettings?.restore();
|
|
1371
|
+
if (result?.kept)
|
|
1372
|
+
this.notice = VS_CODE_KEPT_NOTICE;
|
|
1373
|
+
return result;
|
|
1374
|
+
}
|
|
1366
1375
|
async failVsCodeRouteStart() {
|
|
1367
1376
|
try {
|
|
1368
|
-
await this.
|
|
1377
|
+
await this.restoreVsCodeRoute();
|
|
1369
1378
|
}
|
|
1370
1379
|
catch { /* Journal remains available for retry. */ }
|
|
1371
1380
|
this.clientRoutes.vsCodeChat = { ...this.clientRoutes.vsCodeChat, mode: "native", health: "red", restart: "ready" };
|
|
@@ -1581,7 +1590,7 @@ class ClassroomApp {
|
|
|
1581
1590
|
this.clientRoutes.claudeCode.health = "red";
|
|
1582
1591
|
}
|
|
1583
1592
|
try {
|
|
1584
|
-
await this.
|
|
1593
|
+
await this.restoreVsCodeRoute();
|
|
1585
1594
|
if (this.clientRoutes.vsCodeChat.health !== "red") {
|
|
1586
1595
|
this.clientRoutes.vsCodeChat.health = this.detectedClients.vsCodeChat ? "green" : "gray";
|
|
1587
1596
|
}
|
|
@@ -1751,7 +1760,7 @@ class ClassroomApp {
|
|
|
1751
1760
|
this.clientRoutes.claudeCode.health = "red";
|
|
1752
1761
|
}
|
|
1753
1762
|
try {
|
|
1754
|
-
await this.
|
|
1763
|
+
await this.restoreVsCodeRoute();
|
|
1755
1764
|
if (this.clientRoutes.vsCodeChat.health !== "red") {
|
|
1756
1765
|
this.clientRoutes.vsCodeChat.health = this.detectedClients.vsCodeChat ? "green" : "gray";
|
|
1757
1766
|
}
|
|
@@ -1910,7 +1919,7 @@ class ClassroomApp {
|
|
|
1910
1919
|
}
|
|
1911
1920
|
try {
|
|
1912
1921
|
if (this.deps.clientRouteRuntime) {
|
|
1913
|
-
await this.
|
|
1922
|
+
await this.restoreVsCodeRoute();
|
|
1914
1923
|
await this.deps.clientRouteRuntime.stop("vsCodeChat");
|
|
1915
1924
|
}
|
|
1916
1925
|
}
|
package/dist/start.js
CHANGED
|
@@ -41,6 +41,7 @@ const version_1 = require("./version");
|
|
|
41
41
|
const runtimeOptions = (0, runtimeOptions_1.readRuntimeOptions)(process.env);
|
|
42
42
|
const port = runtimeOptions.port;
|
|
43
43
|
const pageUrl = `http://127.0.0.1:${port}/`;
|
|
44
|
+
const CLIENT_ROUTE_LABELS = { codex: "Codex", claudeCode: "Claude Code", vsCodeChat: "VS Code Chat" };
|
|
44
45
|
const responseSlot = new node_async_hooks_1.AsyncLocalStorage();
|
|
45
46
|
const activeRequests = new Set();
|
|
46
47
|
function abortRequests() { for (const controller of activeRequests)
|
|
@@ -508,7 +509,7 @@ async function main(instance) {
|
|
|
508
509
|
res.once("finish", () => { void exit(); });
|
|
509
510
|
}
|
|
510
511
|
else
|
|
511
|
-
reply({ ok: false, message: handed.restored ? `移除未完成:${handed.error instanceof Error ? handed.error.message : "移除工具啟動失敗"}。請重試移除。` : `客戶端設定恢復失敗(${Object.entries(app.view().clientRoutes ?? {}).filter(([, route]) => route.health === "red").map(([id]) => id).join("、")}
|
|
512
|
+
reply({ ok: false, message: handed.restored ? `移除未完成:${handed.error instanceof Error ? handed.error.message : "移除工具啟動失敗"}。請重試移除。` : `客戶端設定恢復失敗(${Object.entries(app.view().clientRoutes ?? {}).filter(([, route]) => route.health === "red").map(([id]) => CLIENT_ROUTE_LABELS[id] ?? id).join("、")}):${handed.error instanceof Error ? handed.error.message : "原因不明"}。備份已保留,請重試結束。` });
|
|
512
513
|
return;
|
|
513
514
|
}
|
|
514
515
|
reply({ ok: false, message: "管理操作無效。" });
|
package/dist/version.js
CHANGED
|
@@ -79,6 +79,15 @@ function namedIndexes(providers) {
|
|
|
79
79
|
});
|
|
80
80
|
return result;
|
|
81
81
|
}
|
|
82
|
+
// VansPod 的 provider 以代理網址辨認,不比對整份內容:VS Code 會自己加欄位(例如推理強度的 settings)。
|
|
83
|
+
// 沒有模型可比網址時,只認得與寫入時完全相同的內容。
|
|
84
|
+
function pointsAtVansPod(journal) {
|
|
85
|
+
const urls = new Set((journal.intended.models ?? []).map(model => model?.url).filter((url) => typeof url === "string"));
|
|
86
|
+
return provider => (0, node_util_1.isDeepStrictEqual)(provider, journal.intended) ||
|
|
87
|
+
provider.name === "VCRouter" && provider.vendor === "customendpoint" &&
|
|
88
|
+
Array.isArray(provider.models) && provider.models.length > 0 &&
|
|
89
|
+
provider.models.every(model => !!model && typeof model === "object" && urls.has(model.url));
|
|
90
|
+
}
|
|
82
91
|
function containsOldExtensionSecret(provider) {
|
|
83
92
|
return JSON.stringify(provider).includes("${input:chat.lm.secret.");
|
|
84
93
|
}
|
|
@@ -136,19 +145,19 @@ function intendedProvider(template, adapter, origin) {
|
|
|
136
145
|
return provider;
|
|
137
146
|
}
|
|
138
147
|
function createVsCodeRouteSettings(options) {
|
|
148
|
+
// 只移除仍指向 VansPod 代理的 VCRouter;已被移除或改成別的網址的,視為不再由 VansPod 接管。
|
|
139
149
|
const restore = async () => {
|
|
140
150
|
const journal = await readJournal(options.journalFile);
|
|
141
151
|
if (!journal)
|
|
142
152
|
return { changed: false };
|
|
143
153
|
const current = await readProviders(options.settingsFile);
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
await atomicJson(options.settingsFile, next);
|
|
154
|
+
const owned = pointsAtVansPod(journal);
|
|
155
|
+
const next = current.filter(provider => !owned(provider));
|
|
156
|
+
const changed = next.length !== current.length;
|
|
157
|
+
if (changed)
|
|
158
|
+
await atomicJson(options.settingsFile, next);
|
|
150
159
|
await promises_1.default.rm(options.journalFile, { force: true });
|
|
151
|
-
return { changed: true };
|
|
160
|
+
return namedIndexes(next).length ? { changed, kept: true } : { changed };
|
|
152
161
|
};
|
|
153
162
|
return {
|
|
154
163
|
async publish({ providers, adapter, origin }) {
|
|
@@ -157,16 +166,14 @@ function createVsCodeRouteSettings(options) {
|
|
|
157
166
|
const journal = await readJournal(options.journalFile);
|
|
158
167
|
let original = null;
|
|
159
168
|
let next;
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
169
|
+
const existing = namedIndexes(current).map(index => current[index]);
|
|
170
|
+
if (journal && existing.length === 1 && pointsAtVansPod(journal)(existing[0])) {
|
|
171
|
+
// VS Code 或學生加上的欄位(例如推理強度)保留;VansPod 寫過的欄位才覆寫。
|
|
172
|
+
const added = Object.fromEntries(Object.entries(existing[0]).filter(([key]) => !(key in journal.intended) && !(key in intended)));
|
|
165
173
|
original = journal.original;
|
|
166
|
-
next = current.map(
|
|
174
|
+
next = current.map(provider => provider === existing[0] ? { ...intended, ...added } : provider);
|
|
167
175
|
}
|
|
168
176
|
else {
|
|
169
|
-
const existing = namedIndexes(current).map(index => current[index]);
|
|
170
177
|
if (existing.some(containsOldExtensionSecret)) {
|
|
171
178
|
throw new Error("偵測到舊擴充的 VCRouter provider。請先在舊擴充清除舊擴充的 Classroom Connection,再回到 VansPod 重新載入。");
|
|
172
179
|
}
|