dsh-desktop-enhance 0.8.1 → 0.9.0
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/lib/client.js +276 -10
- package/lib/index.d.ts +102 -26
- package/lib/index.js +575 -21
- package/lib/installer.mjs +196 -0
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -758,7 +758,31 @@ ABORT_ERR ETIMEDOUT ECONNREFUSED ECONNRESET EPIPE EADDRINUSE ENOSPC EACCES STORE
|
|
|
758
758
|
"remote.shutdownAccepted": "请求已提交,连接即将切换,远程入口将关闭。需在运行 DSH 的本机重新开启。",
|
|
759
759
|
"remote.openEntry": "打开新入口",
|
|
760
760
|
"remote.permanentAuthorization": "钥匙长期有效",
|
|
761
|
-
"remote.portSwitchWarning": "应用后连接会断开;已授权设备在新入口上仍有效,把链接里的地址改成新入口即可继续用;请确保能访问运行 DSH 的本机。"
|
|
761
|
+
"remote.portSwitchWarning": "应用后连接会断开;已授权设备在新入口上仍有效,把链接里的地址改成新入口即可继续用;请确保能访问运行 DSH 的本机。",
|
|
762
|
+
"update.title": "应用更新",
|
|
763
|
+
"update.current": "当前版本:",
|
|
764
|
+
"update.check": "检查更新",
|
|
765
|
+
"update.checking": "正在检查更新…",
|
|
766
|
+
"update.upToDate": "已是最新版本。",
|
|
767
|
+
"update.available": "发现新版本 {version}。",
|
|
768
|
+
"update.notInRollout": "上游已有 {version},但本机未进入灰度({percent}%)。等官方放量后可装,不要绕过灰度自行安装。",
|
|
769
|
+
"update.download": "下载更新",
|
|
770
|
+
"update.downloading": "正在下载更新:{percent}%",
|
|
771
|
+
"update.verifying": "正在校验并解压安装包…",
|
|
772
|
+
"update.ready": "新版本 {version} 已就绪。",
|
|
773
|
+
"update.install": "安装并重启",
|
|
774
|
+
"update.installing": "正在准备重启并安装…",
|
|
775
|
+
"update.restartNote": "安装会关闭应用并替换程序本体,期间所有会话中断;完成后应用会自动重新打开。远程页面会先断开,这是预期的。",
|
|
776
|
+
"update.confirmInstall": "现在安装并重启?应用会立即关闭,正在运行的所有会话与环境都会被中断。",
|
|
777
|
+
"update.confirmUnavailable": "当前环境无法打开确认框,未执行安装。请改用支持确认框的浏览器重试。",
|
|
778
|
+
"update.failed": "更新未完成,可重试。",
|
|
779
|
+
"update.tasksActive": "还有正在运行的任务,安装会中断它们。请等任务结束后再点「安装并重启」。",
|
|
780
|
+
"update.taskStateUnavailable": "无法确认当前任务是否空闲,未执行安装。请恢复服务后重新确认安装。",
|
|
781
|
+
"update.installFailed": "安装准备失败,更新包仍已就绪。修复原因后可重新确认安装。",
|
|
782
|
+
"update.retry": "重试",
|
|
783
|
+
"update.unavailable": "当前环境无法读取应用版本,更新不可用。",
|
|
784
|
+
"update.unauthorized": "此设备未获授权,无法执行更新。",
|
|
785
|
+
"update.requestFailed": "更新请求未能确认,请核对当前状态后再试。不会自动重新执行操作。"
|
|
762
786
|
};
|
|
763
787
|
const remoteEn = {
|
|
764
788
|
"remote.title": "Remote access",
|
|
@@ -800,7 +824,31 @@ ABORT_ERR ETIMEDOUT ECONNREFUSED ECONNRESET EPIPE EADDRINUSE ENOSPC EACCES STORE
|
|
|
800
824
|
"remote.shutdownAccepted": "Request submitted; the remote connection will close. Re-enable on the computer running DSH.",
|
|
801
825
|
"remote.openEntry": "Open new entry",
|
|
802
826
|
"remote.permanentAuthorization": "Key does not expire",
|
|
803
|
-
"remote.portSwitchWarning": "Applying will disconnect this page. Authorized devices stay valid at the new entry; change the address part of their links. Make sure you can access the computer running DSH."
|
|
827
|
+
"remote.portSwitchWarning": "Applying will disconnect this page. Authorized devices stay valid at the new entry; change the address part of their links. Make sure you can access the computer running DSH.",
|
|
828
|
+
"update.title": "App update",
|
|
829
|
+
"update.current": "Current version: ",
|
|
830
|
+
"update.check": "Check for updates",
|
|
831
|
+
"update.checking": "Checking for updates…",
|
|
832
|
+
"update.upToDate": "You are on the latest version.",
|
|
833
|
+
"update.available": "Version {version} is available.",
|
|
834
|
+
"update.notInRollout": "Upstream has {version}, but this machine is outside the {percent}% rollout. Wait for the rollout to widen; do not bypass it.",
|
|
835
|
+
"update.download": "Download update",
|
|
836
|
+
"update.downloading": "Downloading update: {percent}%",
|
|
837
|
+
"update.verifying": "Verifying and unpacking the update…",
|
|
838
|
+
"update.ready": "Version {version} is ready to install.",
|
|
839
|
+
"update.install": "Install and restart",
|
|
840
|
+
"update.installing": "Preparing to restart and install…",
|
|
841
|
+
"update.restartNote": "Installing closes the app and replaces the program itself, interrupting every session; it reopens automatically when done. The remote page disconnects first — that is expected.",
|
|
842
|
+
"update.confirmInstall": "Install and restart now? The app closes immediately and every running session is interrupted.",
|
|
843
|
+
"update.confirmUnavailable": "Confirmation is unavailable here; the install was not started. Retry in a browser that supports confirm dialogs.",
|
|
844
|
+
"update.failed": "The update did not finish; you can retry.",
|
|
845
|
+
"update.tasksActive": "Tasks are still running; installing would interrupt them. Wait for them to finish, then click Install and restart.",
|
|
846
|
+
"update.taskStateUnavailable": "Task availability could not be verified, so installation was not started. Restore the service, then confirm installation again.",
|
|
847
|
+
"update.installFailed": "Installation preparation failed; the update package is still ready. Resolve the cause, then confirm installation again.",
|
|
848
|
+
"update.retry": "Retry",
|
|
849
|
+
"update.unavailable": "The app version is unavailable here, so updates are disabled.",
|
|
850
|
+
"update.unauthorized": "This device is not authorized to run the update.",
|
|
851
|
+
"update.requestFailed": "The update request could not be confirmed. Check the current state before retrying; operations are never resent automatically."
|
|
804
852
|
};
|
|
805
853
|
//#endregion
|
|
806
854
|
//#region src/client/strings.ts
|
|
@@ -1732,6 +1780,7 @@ ABORT_ERR ETIMEDOUT ECONNREFUSED ECONNRESET EPIPE EADDRINUSE ENOSPC EACCES STORE
|
|
|
1732
1780
|
const SKILLS_ROUTE = "/api/desktop-enhance/skills";
|
|
1733
1781
|
const CONTEXT_ROUTE = "/api/desktop-enhance/context";
|
|
1734
1782
|
const SESSION_STATE_ROUTE = "/api/desktop-enhance/session-state";
|
|
1783
|
+
const UPDATE_ROUTE = "/api/desktop-enhance/update";
|
|
1735
1784
|
//#endregion
|
|
1736
1785
|
//#region src/client/settings/catalog.ts
|
|
1737
1786
|
function parseModelCatalog(body) {
|
|
@@ -8117,14 +8166,14 @@ ABORT_ERR ETIMEDOUT ECONNREFUSED ECONNRESET EPIPE EADDRINUSE ENOSPC EACCES STORE
|
|
|
8117
8166
|
}
|
|
8118
8167
|
//#endregion
|
|
8119
8168
|
//#region src/client/remote/panel.ts
|
|
8120
|
-
function isPlainRecord(value) {
|
|
8169
|
+
function isPlainRecord$1(value) {
|
|
8121
8170
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8122
8171
|
}
|
|
8123
8172
|
function isStatus(value) {
|
|
8124
|
-
if (!isPlainRecord(value)) return false;
|
|
8125
|
-
return typeof value.enabled === "boolean" && typeof value.running === "boolean" && Number.isInteger(value.port) && Number(value.port) >= 1 && Number(value.port) <= 65535 && typeof value.nativeLoopback === "boolean" && (value.management === "local" || value.management === "remote") && (value.currentDeviceId === null || typeof value.currentDeviceId === "string") && (value.error === null || typeof value.error === "string") && Array.isArray(value.devices) && value.devices.every((device) => isPlainRecord(device) && typeof device.id === "string" && typeof device.name === "string" && typeof device.userAgent === "string" && typeof device.online === "boolean" && typeof device.createdAt === "number" && Number.isSafeInteger(device.createdAt) && device.createdAt >= 0 && (device.revokedAt === void 0 || typeof device.revokedAt === "number" && Number.isSafeInteger(device.revokedAt) && device.revokedAt >= device.createdAt));
|
|
8173
|
+
if (!isPlainRecord$1(value)) return false;
|
|
8174
|
+
return typeof value.enabled === "boolean" && typeof value.running === "boolean" && Number.isInteger(value.port) && Number(value.port) >= 1 && Number(value.port) <= 65535 && typeof value.nativeLoopback === "boolean" && (value.management === "local" || value.management === "remote") && (value.currentDeviceId === null || typeof value.currentDeviceId === "string") && (value.error === null || typeof value.error === "string") && Array.isArray(value.devices) && value.devices.every((device) => isPlainRecord$1(device) && typeof device.id === "string" && typeof device.name === "string" && typeof device.userAgent === "string" && typeof device.online === "boolean" && typeof device.createdAt === "number" && Number.isSafeInteger(device.createdAt) && device.createdAt >= 0 && (device.revokedAt === void 0 || typeof device.revokedAt === "number" && Number.isSafeInteger(device.revokedAt) && device.revokedAt >= device.createdAt));
|
|
8126
8175
|
}
|
|
8127
|
-
async function request(signal, body) {
|
|
8176
|
+
async function request$1(signal, body) {
|
|
8128
8177
|
const response = await globalThis.fetch(REMOTE_MANAGEMENT_ROUTE, {
|
|
8129
8178
|
method: body ? "POST" : "GET",
|
|
8130
8179
|
credentials: "same-origin",
|
|
@@ -8193,7 +8242,7 @@ ABORT_ERR ETIMEDOUT ECONNREFUSED ECONNRESET EPIPE EADDRINUSE ENOSPC EACCES STORE
|
|
|
8193
8242
|
const controller = React.useRef(null);
|
|
8194
8243
|
const inFlight = React.useRef(true);
|
|
8195
8244
|
const refresh = async (signal) => {
|
|
8196
|
-
const { data } = await request(signal);
|
|
8245
|
+
const { data } = await request$1(signal);
|
|
8197
8246
|
if (!isStatus(data)) throw new Error("remote.requestFailed");
|
|
8198
8247
|
if (!signal.aborted) {
|
|
8199
8248
|
setStatus(data);
|
|
@@ -8279,7 +8328,7 @@ ABORT_ERR ETIMEDOUT ECONNREFUSED ECONNRESET EPIPE EADDRINUSE ENOSPC EACCES STORE
|
|
|
8279
8328
|
setEntry(null);
|
|
8280
8329
|
try {
|
|
8281
8330
|
if (body) {
|
|
8282
|
-
const { code, data } = await request(abort.signal, body);
|
|
8331
|
+
const { code, data } = await request$1(abort.signal, body);
|
|
8283
8332
|
fields.status = code;
|
|
8284
8333
|
if (abort.signal.aborted) return;
|
|
8285
8334
|
if (body.action === "configure" && code === 202) {
|
|
@@ -8467,6 +8516,222 @@ ABORT_ERR ETIMEDOUT ECONNREFUSED ECONNRESET EPIPE EADDRINUSE ENOSPC EACCES STORE
|
|
|
8467
8516
|
}, t("remote.refresh")))), h("p", null, t("remote.devicesHint")), status.devices.length === 0 ? h("p", { className: "de-remote-empty" }, t("remote.noDevices")) : h("div", { className: "de-remote-device-grid" }, ...status.devices.map(deviceCard)))) : null));
|
|
8468
8517
|
}
|
|
8469
8518
|
//#endregion
|
|
8519
|
+
//#region src/client/remote/update-panel.ts
|
|
8520
|
+
const inProgress = (phase) => [
|
|
8521
|
+
"checking",
|
|
8522
|
+
"downloading",
|
|
8523
|
+
"verifying",
|
|
8524
|
+
"installing"
|
|
8525
|
+
].includes(phase);
|
|
8526
|
+
const requestError = (caught) => caught instanceof Error && ["update.unauthorized", "update.unavailable"].includes(caught.message) ? caught.message : "update.requestFailed";
|
|
8527
|
+
function isPlainRecord(value) {
|
|
8528
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8529
|
+
}
|
|
8530
|
+
const PHASES = [
|
|
8531
|
+
"idle",
|
|
8532
|
+
"checking",
|
|
8533
|
+
"available",
|
|
8534
|
+
"downloading",
|
|
8535
|
+
"verifying",
|
|
8536
|
+
"ready",
|
|
8537
|
+
"installing",
|
|
8538
|
+
"error"
|
|
8539
|
+
];
|
|
8540
|
+
function isView(value) {
|
|
8541
|
+
if (!isPlainRecord(value)) return false;
|
|
8542
|
+
if (typeof value.currentVersion !== "string") return false;
|
|
8543
|
+
if (!PHASES.includes(value.phase)) return false;
|
|
8544
|
+
if (value.version !== void 0 && typeof value.version !== "string") return false;
|
|
8545
|
+
if (value.percent !== void 0 && typeof value.percent !== "number") return false;
|
|
8546
|
+
if (value.installable !== void 0 && typeof value.installable !== "boolean") return false;
|
|
8547
|
+
if (value.inRollout !== void 0 && typeof value.inRollout !== "boolean") return false;
|
|
8548
|
+
return true;
|
|
8549
|
+
}
|
|
8550
|
+
function readableSize(bytes) {
|
|
8551
|
+
if (bytes === void 0 || !Number.isFinite(bytes) || bytes <= 0) return "";
|
|
8552
|
+
const mb = bytes / 1048576;
|
|
8553
|
+
return mb >= 1024 ? `${(mb / 1024).toFixed(2)} GB` : `${Math.round(mb)} MB`;
|
|
8554
|
+
}
|
|
8555
|
+
async function request(signal, action) {
|
|
8556
|
+
const body = action === void 0 ? void 0 : {
|
|
8557
|
+
action,
|
|
8558
|
+
...action === "install" ? { confirm: true } : {}
|
|
8559
|
+
};
|
|
8560
|
+
const response = await globalThis.fetch(UPDATE_ROUTE, {
|
|
8561
|
+
method: action === void 0 ? "GET" : "POST",
|
|
8562
|
+
credentials: "same-origin",
|
|
8563
|
+
cache: "no-store",
|
|
8564
|
+
signal,
|
|
8565
|
+
...body === void 0 ? {} : {
|
|
8566
|
+
headers: { "Content-Type": "application/json" },
|
|
8567
|
+
body: JSON.stringify(body)
|
|
8568
|
+
}
|
|
8569
|
+
});
|
|
8570
|
+
if (!response.ok) {
|
|
8571
|
+
if (response.status === 401 || response.status === 403) throw new Error("update.unauthorized");
|
|
8572
|
+
if (response.status === 503) throw new Error("update.unavailable");
|
|
8573
|
+
throw new Error("update.requestFailed");
|
|
8574
|
+
}
|
|
8575
|
+
const data = await response.json();
|
|
8576
|
+
if (!isView(data)) throw new Error("update.requestFailed");
|
|
8577
|
+
return data;
|
|
8578
|
+
}
|
|
8579
|
+
function UpdateSettings({ t }) {
|
|
8580
|
+
const [view, setView] = React.useState(null);
|
|
8581
|
+
const [error, setError] = React.useState("");
|
|
8582
|
+
const [busy, setBusy] = React.useState(true);
|
|
8583
|
+
const run = React.useRef(() => {});
|
|
8584
|
+
React.useEffect(() => {
|
|
8585
|
+
const lifetime = new globalThis.AbortController();
|
|
8586
|
+
let latest = null;
|
|
8587
|
+
let writing = false;
|
|
8588
|
+
let read;
|
|
8589
|
+
let timer;
|
|
8590
|
+
const publish = (state) => {
|
|
8591
|
+
latest = state;
|
|
8592
|
+
setView(state);
|
|
8593
|
+
};
|
|
8594
|
+
const stopRead = () => {
|
|
8595
|
+
globalThis.clearTimeout(timer);
|
|
8596
|
+
timer = void 0;
|
|
8597
|
+
read?.abort();
|
|
8598
|
+
read = void 0;
|
|
8599
|
+
};
|
|
8600
|
+
const schedule = () => {
|
|
8601
|
+
globalThis.clearTimeout(timer);
|
|
8602
|
+
timer = void 0;
|
|
8603
|
+
if (!lifetime.signal.aborted && (writing || latest && inProgress(latest.phase))) timer = globalThis.setTimeout(() => {
|
|
8604
|
+
observe();
|
|
8605
|
+
}, 1e3);
|
|
8606
|
+
};
|
|
8607
|
+
const observe = async () => {
|
|
8608
|
+
if (lifetime.signal.aborted || read) return;
|
|
8609
|
+
const current = new globalThis.AbortController();
|
|
8610
|
+
read = current;
|
|
8611
|
+
try {
|
|
8612
|
+
const state = await request(current.signal);
|
|
8613
|
+
if (!lifetime.signal.aborted && !current.signal.aborted) publish(state);
|
|
8614
|
+
} catch (caught) {
|
|
8615
|
+
if (!lifetime.signal.aborted && !current.signal.aborted) setError(requestError(caught));
|
|
8616
|
+
} finally {
|
|
8617
|
+
if (!lifetime.signal.aborted && read === current) {
|
|
8618
|
+
read = void 0;
|
|
8619
|
+
if (!writing) setBusy(false);
|
|
8620
|
+
schedule();
|
|
8621
|
+
}
|
|
8622
|
+
}
|
|
8623
|
+
};
|
|
8624
|
+
run.current = async (action) => {
|
|
8625
|
+
if (lifetime.signal.aborted || writing || latest && inProgress(latest.phase)) return;
|
|
8626
|
+
if (action === "install") try {
|
|
8627
|
+
if (!globalThis.confirm(t("update.confirmInstall"))) return;
|
|
8628
|
+
} catch {
|
|
8629
|
+
setError("update.confirmUnavailable");
|
|
8630
|
+
return;
|
|
8631
|
+
}
|
|
8632
|
+
stopRead();
|
|
8633
|
+
writing = true;
|
|
8634
|
+
setError("");
|
|
8635
|
+
setBusy(true);
|
|
8636
|
+
schedule();
|
|
8637
|
+
let reread = false;
|
|
8638
|
+
try {
|
|
8639
|
+
const state = await request(lifetime.signal, action);
|
|
8640
|
+
if (!lifetime.signal.aborted) {
|
|
8641
|
+
stopRead();
|
|
8642
|
+
publish(state);
|
|
8643
|
+
}
|
|
8644
|
+
} catch (caught) {
|
|
8645
|
+
if (!lifetime.signal.aborted) {
|
|
8646
|
+
setError(requestError(caught));
|
|
8647
|
+
reread = true;
|
|
8648
|
+
}
|
|
8649
|
+
} finally {
|
|
8650
|
+
if (!lifetime.signal.aborted) {
|
|
8651
|
+
writing = false;
|
|
8652
|
+
setBusy(false);
|
|
8653
|
+
if (reread) observe();
|
|
8654
|
+
else schedule();
|
|
8655
|
+
}
|
|
8656
|
+
}
|
|
8657
|
+
};
|
|
8658
|
+
observe();
|
|
8659
|
+
return () => {
|
|
8660
|
+
lifetime.abort();
|
|
8661
|
+
stopRead();
|
|
8662
|
+
};
|
|
8663
|
+
}, []);
|
|
8664
|
+
const phase = view?.phase ?? "idle";
|
|
8665
|
+
const installable = view?.installable === true;
|
|
8666
|
+
const primary = () => {
|
|
8667
|
+
switch (phase) {
|
|
8668
|
+
case "available": return installable ? {
|
|
8669
|
+
label: t("update.download"),
|
|
8670
|
+
action: "download"
|
|
8671
|
+
} : {
|
|
8672
|
+
label: t("update.check"),
|
|
8673
|
+
action: "check"
|
|
8674
|
+
};
|
|
8675
|
+
case "ready": return {
|
|
8676
|
+
label: t("update.install"),
|
|
8677
|
+
action: "install"
|
|
8678
|
+
};
|
|
8679
|
+
case "error": return {
|
|
8680
|
+
label: t("update.retry"),
|
|
8681
|
+
action: view?.failedOperation === "download" ? "download" : "check"
|
|
8682
|
+
};
|
|
8683
|
+
case "checking":
|
|
8684
|
+
case "downloading":
|
|
8685
|
+
case "verifying":
|
|
8686
|
+
case "installing": return null;
|
|
8687
|
+
default: return {
|
|
8688
|
+
label: t("update.check"),
|
|
8689
|
+
action: "check"
|
|
8690
|
+
};
|
|
8691
|
+
}
|
|
8692
|
+
};
|
|
8693
|
+
const busyPhase = inProgress(phase);
|
|
8694
|
+
const action = primary();
|
|
8695
|
+
const statusLine = () => {
|
|
8696
|
+
switch (phase) {
|
|
8697
|
+
case "checking": return t("update.checking");
|
|
8698
|
+
case "downloading": return t("update.downloading").replace("{percent}", String(view?.percent ?? 0));
|
|
8699
|
+
case "verifying": return t("update.verifying");
|
|
8700
|
+
case "installing": return t("update.installing");
|
|
8701
|
+
case "ready":
|
|
8702
|
+
if (view?.message === "TASKS_ACTIVE") return t("update.tasksActive");
|
|
8703
|
+
if (view?.message === "TASK_STATE_UNAVAILABLE") return t("update.taskStateUnavailable");
|
|
8704
|
+
if (view?.failedOperation === "install") return t("update.installFailed");
|
|
8705
|
+
return t("update.ready").replace("{version}", view?.version ?? "");
|
|
8706
|
+
case "available": return installable ? t("update.available").replace("{version}", view?.version ?? "") : t("update.notInRollout").replace("{version}", view?.version ?? "").replace("{percent}", String(view?.stagingPercentage ?? 0));
|
|
8707
|
+
case "error": return t("update.failed");
|
|
8708
|
+
default: return view?.message === "TASKS_ACTIVE" ? t("update.tasksActive") : t("update.upToDate");
|
|
8709
|
+
}
|
|
8710
|
+
};
|
|
8711
|
+
const restartNote = phase === "ready" || phase === "installing";
|
|
8712
|
+
return h("section", {
|
|
8713
|
+
className: "de-update",
|
|
8714
|
+
"data-desktop-enhance-update": ""
|
|
8715
|
+
}, h("div", { className: "de-update-heading" }, h("div", {}, h("h3", {}, t("update.title")), h("p", {}, `${t("update.current")}${view?.currentVersion ?? "…"}`)), action === null ? null : h("button", {
|
|
8716
|
+
type: "button",
|
|
8717
|
+
className: "de-update-primary",
|
|
8718
|
+
"data-update-action": action.action,
|
|
8719
|
+
disabled: busy || busyPhase,
|
|
8720
|
+
onClick: () => {
|
|
8721
|
+
run.current(action.action);
|
|
8722
|
+
}
|
|
8723
|
+
}, action.label)), h("p", {
|
|
8724
|
+
className: "de-update-status",
|
|
8725
|
+
"data-update-phase": phase
|
|
8726
|
+
}, statusLine()), view?.size !== void 0 && phase === "available" ? h("p", { className: "de-update-meta" }, readableSize(view.size)) : null, restartNote ? h("p", {
|
|
8727
|
+
className: "de-update-warning",
|
|
8728
|
+
role: "note"
|
|
8729
|
+
}, t("update.restartNote")) : null, error === "" ? null : h("p", {
|
|
8730
|
+
className: "de-update-error",
|
|
8731
|
+
role: "alert"
|
|
8732
|
+
}, t(error)));
|
|
8733
|
+
}
|
|
8734
|
+
//#endregion
|
|
8470
8735
|
//#region src/client/mobile/settings.ts
|
|
8471
8736
|
const root = "[data-shortcut-modal=\"settings\"][role=\"dialog\"]";
|
|
8472
8737
|
const panel = `body.dsh-remote-portrait ${root}`;
|
|
@@ -9454,7 +9719,7 @@ ABORT_ERR ETIMEDOUT ECONNREFUSED ECONNRESET EPIPE EADDRINUSE ENOSPC EACCES STORE
|
|
|
9454
9719
|
}
|
|
9455
9720
|
//#endregion
|
|
9456
9721
|
//#region \0dsh-desktop-enhance-css:/Users/lijiechengbj/projects/AI-agents/dsh-desktop-enhance/src/client/remote/styles.css.mjs
|
|
9457
|
-
var styles_css_default$3 = "\n[data-desktop-enhance-remote] { display:flex; flex-direction:column; gap:var(--dsh-de-space-section); min-width:0; padding:var(--dsh-de-space-lg); border:1px solid var(--dsh-de-border); border-radius:var(--dsh-de-radius-card); background:var(--dsh-de-surface); }\n[data-desktop-enhance-remote] .de-remote-body,\n[data-desktop-enhance-remote] .de-remote-content { display:flex; flex-direction:column; gap:var(--dsh-de-space-lg); min-width:0; }\n[data-desktop-enhance-remote] h3,\n[data-desktop-enhance-remote] h4,\n[data-desktop-enhance-remote] p { margin:0; }\n[data-desktop-enhance-remote] h3 { font-size:var(--dsh-de-font-heading); font-weight:600; }\n[data-desktop-enhance-remote] h4 { font-size:var(--dsh-de-font-body); font-weight:600; }\n[data-desktop-enhance-remote] p { color:var(--dsh-de-muted); font-size:var(--dsh-de-font-caption); line-height:1.5; overflow-wrap:anywhere; }\n[data-desktop-enhance-remote] [role=\"alert\"] { color:var(--dsh-de-danger); }\n[data-desktop-enhance-remote] .de-remote-heading { display:flex; align-items:center; justify-content:space-between; gap:var(--dsh-de-space-lg); }\n[data-desktop-enhance-remote] .de-remote-heading > div { display:grid; gap:4px; }\n[data-desktop-enhance-remote] .de-remote-port-row,\n[data-desktop-enhance-remote] .de-remote-field,\n[data-desktop-enhance-remote] .de-remote-actions { display:flex; align-items:center; gap:var(--dsh-de-space-md); flex-wrap:wrap; }\n[data-desktop-enhance-remote] .de-remote-field { font-size:var(--dsh-de-font-caption); color:var(--dsh-de-muted); }\n[data-desktop-enhance-remote] .de-remote-devices { display:grid; gap:var(--dsh-de-space-md); border-top:1px solid var(--dsh-de-border); padding-top:var(--dsh-de-space-section); }\n[data-desktop-enhance-remote] input { box-sizing:border-box; width:104px; min-width:0; max-width:100%; min-height:var(--dsh-de-control-height); padding:6px 8px; border:1px solid var(--dsh-de-border); border-radius:var(--dsh-de-radius-control); background:var(--dsh-de-surface); color:var(--dsh-de-text); font:inherit; }\n[data-desktop-enhance-settings] [data-desktop-enhance-remote] button.de-remote-primary { color:var(--dsw-alias-label-primary-bluish); background:var(--dsw-alias-state-business-tertiary); border-color:var(--dsh-de-accent); font-weight:600; }\n[data-desktop-enhance-settings] [data-desktop-enhance-remote] button.de-remote-primary:hover:not(:disabled) { background:var(--dsw-alias-state-business-tertiary); filter:brightness(.96); }\n[data-desktop-enhance-remote] .de-remote-device-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(210px,100%),1fr)); gap:var(--dsh-de-space-md); }\n[data-desktop-enhance-remote] .de-remote-device { min-width:0; display:flex; flex-direction:column; align-items:flex-start; gap:var(--dsh-de-space-sm); padding:var(--dsh-de-space-lg); border:1px solid var(--dsh-de-border); border-radius:var(--dsh-de-radius-card); background:var(--dsh-de-surface); }\n[data-desktop-enhance-remote] .de-remote-device > .de-remote-heading { align-self:stretch; margin-bottom:4px; }\n[data-desktop-enhance-remote] .de-remote-device strong { overflow-wrap:anywhere; }\n[data-desktop-enhance-remote] .de-remote-device-icon { width:28px; height:28px; color:var(--dsh-de-muted); }\n[data-desktop-enhance-remote] .de-remote-badge { border-radius:var(--dsh-de-radius-control); padding:3px 7px; background:var(--dsh-de-hover); font-size:var(--dsh-de-font-caption); color:var(--dsh-de-muted); }\n[data-desktop-enhance-remote] .de-remote-device[data-revoked=\"true\"] { opacity:.65; }\n[data-desktop-enhance-remote] .de-remote-device-footer { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:var(--dsh-de-space-sm); align-self:stretch; margin-top:auto; padding-top:var(--dsh-de-space-md); border-top:1px solid var(--dsh-de-border); color:var(--dsh-de-muted); font-size:var(--dsh-de-font-caption); }\n[data-desktop-enhance-settings] [data-desktop-enhance-remote] button.de-remote-revoke { padding:4px 0; color:var(--dsh-de-danger); background:transparent; border-color:transparent; font-size:var(--dsh-de-font-caption); }\n[data-desktop-enhance-remote] .de-remote-empty { padding:var(--dsh-de-space-section); border:1px dashed var(--dsh-de-border); border-radius:var(--dsh-de-radius-card); }\n@media (max-width:600px) {\n [data-desktop-enhance-remote] .de-remote-device-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:var(--dsh-de-space-sm); }\n [data-desktop-enhance-remote] .de-remote-device { padding:var(--dsh-de-space-md); }\n}\n@media (max-width:360px) { [data-desktop-enhance-remote] .de-remote-device-grid { grid-template-columns:1fr; } }\n";
|
|
9722
|
+
var styles_css_default$3 = "\n[data-desktop-enhance-remote] { display:flex; flex-direction:column; gap:var(--dsh-de-space-section); min-width:0; padding:var(--dsh-de-space-lg); border:1px solid var(--dsh-de-border); border-radius:var(--dsh-de-radius-card); background:var(--dsh-de-surface); }\n[data-desktop-enhance-remote] .de-remote-body,\n[data-desktop-enhance-remote] .de-remote-content { display:flex; flex-direction:column; gap:var(--dsh-de-space-lg); min-width:0; }\n[data-desktop-enhance-remote] h3,\n[data-desktop-enhance-remote] h4,\n[data-desktop-enhance-remote] p { margin:0; }\n[data-desktop-enhance-remote] h3 { font-size:var(--dsh-de-font-heading); font-weight:600; }\n[data-desktop-enhance-remote] h4 { font-size:var(--dsh-de-font-body); font-weight:600; }\n[data-desktop-enhance-remote] p { color:var(--dsh-de-muted); font-size:var(--dsh-de-font-caption); line-height:1.5; overflow-wrap:anywhere; }\n[data-desktop-enhance-remote] [role=\"alert\"] { color:var(--dsh-de-danger); }\n[data-desktop-enhance-remote] .de-remote-heading { display:flex; align-items:center; justify-content:space-between; gap:var(--dsh-de-space-lg); }\n[data-desktop-enhance-remote] .de-remote-heading > div { display:grid; gap:4px; }\n[data-desktop-enhance-remote] .de-remote-port-row,\n[data-desktop-enhance-remote] .de-remote-field,\n[data-desktop-enhance-remote] .de-remote-actions { display:flex; align-items:center; gap:var(--dsh-de-space-md); flex-wrap:wrap; }\n[data-desktop-enhance-remote] .de-remote-field { font-size:var(--dsh-de-font-caption); color:var(--dsh-de-muted); }\n[data-desktop-enhance-remote] .de-remote-devices { display:grid; gap:var(--dsh-de-space-md); border-top:1px solid var(--dsh-de-border); padding-top:var(--dsh-de-space-section); }\n[data-desktop-enhance-remote] input { box-sizing:border-box; width:104px; min-width:0; max-width:100%; min-height:var(--dsh-de-control-height); padding:6px 8px; border:1px solid var(--dsh-de-border); border-radius:var(--dsh-de-radius-control); background:var(--dsh-de-surface); color:var(--dsh-de-text); font:inherit; }\n[data-desktop-enhance-settings] [data-desktop-enhance-remote] button.de-remote-primary { color:var(--dsw-alias-label-primary-bluish); background:var(--dsw-alias-state-business-tertiary); border-color:var(--dsh-de-accent); font-weight:600; }\n[data-desktop-enhance-settings] [data-desktop-enhance-remote] button.de-remote-primary:hover:not(:disabled) { background:var(--dsw-alias-state-business-tertiary); filter:brightness(.96); }\n[data-desktop-enhance-remote] .de-remote-device-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(210px,100%),1fr)); gap:var(--dsh-de-space-md); }\n[data-desktop-enhance-remote] .de-remote-device { min-width:0; display:flex; flex-direction:column; align-items:flex-start; gap:var(--dsh-de-space-sm); padding:var(--dsh-de-space-lg); border:1px solid var(--dsh-de-border); border-radius:var(--dsh-de-radius-card); background:var(--dsh-de-surface); }\n[data-desktop-enhance-remote] .de-remote-device > .de-remote-heading { align-self:stretch; margin-bottom:4px; }\n[data-desktop-enhance-remote] .de-remote-device strong { overflow-wrap:anywhere; }\n[data-desktop-enhance-remote] .de-remote-device-icon { width:28px; height:28px; color:var(--dsh-de-muted); }\n[data-desktop-enhance-remote] .de-remote-badge { border-radius:var(--dsh-de-radius-control); padding:3px 7px; background:var(--dsh-de-hover); font-size:var(--dsh-de-font-caption); color:var(--dsh-de-muted); }\n[data-desktop-enhance-remote] .de-remote-device[data-revoked=\"true\"] { opacity:.65; }\n[data-desktop-enhance-remote] .de-remote-device-footer { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:var(--dsh-de-space-sm); align-self:stretch; margin-top:auto; padding-top:var(--dsh-de-space-md); border-top:1px solid var(--dsh-de-border); color:var(--dsh-de-muted); font-size:var(--dsh-de-font-caption); }\n[data-desktop-enhance-settings] [data-desktop-enhance-remote] button.de-remote-revoke { padding:4px 0; color:var(--dsh-de-danger); background:transparent; border-color:transparent; font-size:var(--dsh-de-font-caption); }\n[data-desktop-enhance-remote] .de-remote-empty { padding:var(--dsh-de-space-section); border:1px dashed var(--dsh-de-border); border-radius:var(--dsh-de-radius-card); }\n@media (max-width:600px) {\n [data-desktop-enhance-remote] .de-remote-device-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:var(--dsh-de-space-sm); }\n [data-desktop-enhance-remote] .de-remote-device { padding:var(--dsh-de-space-md); }\n}\n@media (max-width:360px) { [data-desktop-enhance-remote] .de-remote-device-grid { grid-template-columns:1fr; } }\n\n\n[data-desktop-enhance-remote] .de-remote-stack { display:flex; flex-direction:column; gap:var(--dsh-de-space-section); min-width:0; }\n\n\n[data-desktop-enhance-update] { display:flex; flex-direction:column; gap:var(--dsh-de-space-md); min-width:0; padding:var(--dsh-de-space-lg); border:1px solid var(--dsh-de-border); border-radius:var(--dsh-de-radius-card); background:var(--dsh-de-surface); }\n[data-desktop-enhance-update] .de-update-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:var(--dsh-de-space-lg); flex-wrap:wrap; }\n[data-desktop-enhance-update] .de-update-heading > div { display:grid; gap:4px; min-width:0; }\n[data-desktop-enhance-update] h3 { margin:0; font-size:var(--dsh-de-font-heading); font-weight:600; }\n[data-desktop-enhance-update] p { margin:0; color:var(--dsh-de-muted); font-size:var(--dsh-de-font-caption); line-height:1.5; overflow-wrap:anywhere; }\n[data-desktop-enhance-update] .de-update-status { color:var(--dsh-de-text); }\n[data-desktop-enhance-update] .de-update-status[data-update-phase=\"error\"] { color:var(--dsh-de-danger); }\n[data-desktop-enhance-update] .de-update-warning { color:var(--dsh-de-muted); }\n[data-desktop-enhance-update] .de-update-error { color:var(--dsh-de-danger); }\n[data-desktop-enhance-settings] [data-desktop-enhance-update] button.de-update-primary { color:var(--dsw-alias-label-primary-bluish); background:var(--dsw-alias-state-business-tertiary); border-color:var(--dsh-de-accent); font-weight:600; }\n[data-desktop-enhance-settings] [data-desktop-enhance-update] button.de-update-primary:hover:not(:disabled) { background:var(--dsw-alias-state-business-tertiary); filter:brightness(.96); }\n";
|
|
9458
9723
|
//#endregion
|
|
9459
9724
|
//#region src/shared/session-model.ts
|
|
9460
9725
|
const SESSION_MODEL_PROJECTION = "desktop-enhance.session-model";
|
|
@@ -10459,7 +10724,7 @@ ABORT_ERR ETIMEDOUT ECONNREFUSED ECONNRESET EPIPE EADDRINUSE ENOSPC EACCES STORE
|
|
|
10459
10724
|
t,
|
|
10460
10725
|
getForm: () => form,
|
|
10461
10726
|
sessionState,
|
|
10462
|
-
remoteContent: h(RemoteSettings, { t })
|
|
10727
|
+
remoteContent: h("div", { className: "de-remote-stack" }, h(RemoteSettings, { t }), h(UpdateSettings, { t }))
|
|
10463
10728
|
});
|
|
10464
10729
|
ctx.inject(["configForms"], (formCtx) => {
|
|
10465
10730
|
const forms = formCtx.get("configForms");
|
|
@@ -10831,6 +11096,7 @@ ABORT_ERR ETIMEDOUT ECONNREFUSED ECONNRESET EPIPE EADDRINUSE ENOSPC EACCES STORE
|
|
|
10831
11096
|
DefaultToolsManager,
|
|
10832
11097
|
DefaultSkillsManager,
|
|
10833
11098
|
RemoteSettings,
|
|
11099
|
+
UpdateSettings,
|
|
10834
11100
|
zh,
|
|
10835
11101
|
en,
|
|
10836
11102
|
css: PLUGIN_STYLESHEET,
|
package/lib/index.d.ts
CHANGED
|
@@ -49,12 +49,12 @@ interface SessionState {
|
|
|
49
49
|
//#endregion
|
|
50
50
|
//#region src/session-state/host.d.ts
|
|
51
51
|
declare function handleSessionStateRequest(state: SessionState, request: Request, retry?: () => Promise<void>, lifetime?: AbortSignal): Promise<Response>;
|
|
52
|
-
interface HostContext$
|
|
52
|
+
interface HostContext$2 {
|
|
53
53
|
get(name: string): unknown;
|
|
54
54
|
readonly reflect: {
|
|
55
55
|
provide(name: string, value: unknown): () => void;
|
|
56
56
|
};
|
|
57
|
-
inject(deps: readonly string[], callback: (ctx: HostContext$
|
|
57
|
+
inject(deps: readonly string[], callback: (ctx: HostContext$2) => void): {
|
|
58
58
|
dispose(): Promise<unknown>;
|
|
59
59
|
};
|
|
60
60
|
effect(factory: () => unknown, label?: string): unknown;
|
|
@@ -62,7 +62,7 @@ interface HostContext$1 {
|
|
|
62
62
|
warn(message: string): void;
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
declare function installSessionState(ctx: HostContext$
|
|
65
|
+
declare function installSessionState(ctx: HostContext$2): () => Promise<void>;
|
|
66
66
|
//#endregion
|
|
67
67
|
//#region src/session-state/store.d.ts
|
|
68
68
|
declare const sessionStateDomainSpec: {
|
|
@@ -278,9 +278,9 @@ declare function installDiagnostics(ctx: DiagnosticHostContext, config: unknown)
|
|
|
278
278
|
declare function buildPrompt(template?: string): string;
|
|
279
279
|
//#endregion
|
|
280
280
|
//#region src/suggest/host.d.ts
|
|
281
|
-
interface HostContext {
|
|
281
|
+
interface HostContext$1 {
|
|
282
282
|
get(name: string): unknown;
|
|
283
|
-
inject(services: readonly string[], callback: (ctx: HostContext) => void): unknown;
|
|
283
|
+
inject(services: readonly string[], callback: (ctx: HostContext$1) => void): unknown;
|
|
284
284
|
effect(factory: () => void | (() => void), label: string): unknown;
|
|
285
285
|
readonly logger?: {
|
|
286
286
|
warn(message: string): void;
|
|
@@ -341,12 +341,12 @@ declare function routeOf(session: HostSession): {
|
|
|
341
341
|
} | null;
|
|
342
342
|
declare function buildMessages(history: readonly HostMessage$1[], instruction: string): HostMessage$1[];
|
|
343
343
|
declare function knownNamesOf(messages: readonly HostMessage$1[]): ReadonlySet<string> | null;
|
|
344
|
-
declare function handleSuggest(ctx: HostContext, request: Request, timeoutMs?: number): Promise<Response>;
|
|
344
|
+
declare function handleSuggest(ctx: HostContext$1, request: Request, timeoutMs?: number): Promise<Response>;
|
|
345
345
|
declare function quietEffortFor(llm: HostLlm, route: {
|
|
346
346
|
readonly provider: string;
|
|
347
347
|
readonly model: string;
|
|
348
348
|
}, operation?: DiagnosticOperation): Promise<string>;
|
|
349
|
-
declare function listModels(ctx: HostContext): Promise<{
|
|
349
|
+
declare function listModels(ctx: HostContext$1): Promise<{
|
|
350
350
|
providers: readonly {
|
|
351
351
|
id: string;
|
|
352
352
|
name: string;
|
|
@@ -356,14 +356,14 @@ declare function listModels(ctx: HostContext): Promise<{
|
|
|
356
356
|
}[];
|
|
357
357
|
}[];
|
|
358
358
|
}>;
|
|
359
|
-
declare function listEfforts(ctx: HostContext, provider: string, model: string): Promise<{
|
|
359
|
+
declare function listEfforts(ctx: HostContext$1, provider: string, model: string): Promise<{
|
|
360
360
|
efforts: readonly {
|
|
361
361
|
id: string;
|
|
362
362
|
name: string;
|
|
363
363
|
}[];
|
|
364
364
|
defaultEffort: string | null;
|
|
365
365
|
}>;
|
|
366
|
-
declare function registerSuggestRoute(ctx: HostContext): () => void;
|
|
366
|
+
declare function registerSuggestRoute(ctx: HostContext$1): () => void;
|
|
367
367
|
//#endregion
|
|
368
368
|
//#region src/shared/session-info.d.ts
|
|
369
369
|
interface RawSystemSection {
|
|
@@ -373,12 +373,12 @@ interface RawSystemSection {
|
|
|
373
373
|
}
|
|
374
374
|
//#endregion
|
|
375
375
|
//#region src/session-info/host.d.ts
|
|
376
|
-
declare function collectSystemPromptMetadata(ctx: HostContext, scope?: unknown, onPartial?: (error?: unknown) => void): {
|
|
376
|
+
declare function collectSystemPromptMetadata(ctx: HostContext$1, scope?: unknown, onPartial?: (error?: unknown) => void): {
|
|
377
377
|
readonly systemSections: readonly RawSystemSection[];
|
|
378
378
|
readonly pluginOwners: Readonly<Record<string, string>>;
|
|
379
379
|
};
|
|
380
|
-
declare function handleSessionInfo(ctx: HostContext, request: Request): Promise<Response>;
|
|
381
|
-
declare function registerSessionInfoRoute(ctx: HostContext): () => void;
|
|
380
|
+
declare function handleSessionInfo(ctx: HostContext$1, request: Request): Promise<Response>;
|
|
381
|
+
declare function registerSessionInfoRoute(ctx: HostContext$1): () => void;
|
|
382
382
|
//#endregion
|
|
383
383
|
//#region src/shared/tools-manager.d.ts
|
|
384
384
|
type ToolScope = 'builtin' | 'plugin';
|
|
@@ -404,18 +404,87 @@ interface HostPromptAssembly {
|
|
|
404
404
|
}[];
|
|
405
405
|
readonly [key: string]: unknown;
|
|
406
406
|
}
|
|
407
|
-
interface ToolsHostContext extends HostContext {
|
|
407
|
+
interface ToolsHostContext extends HostContext$1 {
|
|
408
408
|
on?(event: string, listener: (assembly: HostPromptAssembly, context: unknown, next: () => Promise<HostPromptAssembly>) => Promise<HostPromptAssembly>): () => void;
|
|
409
409
|
}
|
|
410
|
-
declare function resolveSessionIdFromScope(candidate: unknown, ctx?: HostContext): string | undefined;
|
|
410
|
+
declare function resolveSessionIdFromScope(candidate: unknown, ctx?: HostContext$1): string | undefined;
|
|
411
411
|
declare function readToolsConfig(config: unknown, sessionId?: string, state?: Pick<SessionState, 'read'>): ToolsPolicyState;
|
|
412
412
|
declare function resolveFiberModuleName(fiber: unknown): string | undefined;
|
|
413
413
|
declare function resolveCallerPackageFromStack(stack?: string): string | undefined;
|
|
414
|
-
declare function scanCordisFiberToolOwners(ctx: HostContext, targetOwners?: Map<string, string>): Map<string, string>;
|
|
415
|
-
declare function collectAllToolSchemas(ctx: HostContext, sessionId?: string): Promise<readonly ToolSummary[]>;
|
|
414
|
+
declare function scanCordisFiberToolOwners(ctx: HostContext$1, targetOwners?: Map<string, string>): Map<string, string>;
|
|
415
|
+
declare function collectAllToolSchemas(ctx: HostContext$1, sessionId?: string): Promise<readonly ToolSummary[]>;
|
|
416
416
|
declare function installToolsPolicy(ctx: ToolsHostContext, readState: (sessionId?: string) => ToolsPolicyState): () => void;
|
|
417
|
-
declare function handleToolsCatalog(ctx: HostContext, request?: Request): Promise<Response>;
|
|
418
|
-
declare function registerToolsRoute(ctx: HostContext): () => void;
|
|
417
|
+
declare function handleToolsCatalog(ctx: HostContext$1, request?: Request): Promise<Response>;
|
|
418
|
+
declare function registerToolsRoute(ctx: HostContext$1): () => void;
|
|
419
|
+
//#endregion
|
|
420
|
+
//#region src/remote/update.d.ts
|
|
421
|
+
type UpdatePhase = 'idle' | 'checking' | 'available' | 'downloading' | 'verifying' | 'ready' | 'installing' | 'error';
|
|
422
|
+
interface UpdateState {
|
|
423
|
+
readonly phase: UpdatePhase;
|
|
424
|
+
readonly currentVersion: string;
|
|
425
|
+
readonly version?: string;
|
|
426
|
+
readonly releaseDate?: string;
|
|
427
|
+
readonly size?: number;
|
|
428
|
+
readonly percent?: number;
|
|
429
|
+
readonly installable?: boolean;
|
|
430
|
+
readonly inRollout?: boolean;
|
|
431
|
+
readonly stagingPercentage?: number;
|
|
432
|
+
readonly failedOperation?: 'check' | 'download' | 'install';
|
|
433
|
+
readonly message?: string;
|
|
434
|
+
}
|
|
435
|
+
interface UpdateEngine {
|
|
436
|
+
state(): UpdateState;
|
|
437
|
+
check(): Promise<UpdateState>;
|
|
438
|
+
download(): Promise<UpdateState>;
|
|
439
|
+
install(confirmation: {
|
|
440
|
+
readonly confirm: boolean;
|
|
441
|
+
}): Promise<UpdateState>;
|
|
442
|
+
dispose(): Promise<void>;
|
|
443
|
+
}
|
|
444
|
+
interface UpdateDeps {
|
|
445
|
+
readonly currentVersion: string;
|
|
446
|
+
readonly stageDir: string;
|
|
447
|
+
readonly readFeed: (signal: AbortSignal) => Promise<string>;
|
|
448
|
+
readonly readUpdaterId: () => Promise<string | undefined>;
|
|
449
|
+
readonly download: (url: string, destination: string, progress: (received: number, total: number) => void, signal: AbortSignal) => Promise<string>;
|
|
450
|
+
readonly unzip: (archive: string, destination: string, signal: AbortSignal) => Promise<void>;
|
|
451
|
+
readonly stagedVersion: (app: string) => Promise<string | undefined>;
|
|
452
|
+
readonly activeTasks: () => boolean;
|
|
453
|
+
readonly spawnInstaller: (payload: {
|
|
454
|
+
version: string;
|
|
455
|
+
stageDir: string;
|
|
456
|
+
}, signal: AbortSignal) => Promise<void>;
|
|
457
|
+
}
|
|
458
|
+
declare function createUpdateEngine(deps: UpdateDeps): UpdateEngine;
|
|
459
|
+
interface HostContext {
|
|
460
|
+
get(name: string): unknown;
|
|
461
|
+
readonly logger?: {
|
|
462
|
+
warn(message: string): void;
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
declare function readInstalledVersion(app?: string): Promise<string>;
|
|
466
|
+
interface UpdateLocations {
|
|
467
|
+
readonly app: string;
|
|
468
|
+
readonly stageDir: string;
|
|
469
|
+
readonly logDir: string;
|
|
470
|
+
}
|
|
471
|
+
declare function productionDeps(ctx: HostContext, currentVersion: string, locations?: UpdateLocations): UpdateDeps;
|
|
472
|
+
declare function registerUpdateRoute(ctx: HostContext, load?: () => Promise<UpdateEngine>): {
|
|
473
|
+
dispose(): Promise<void>;
|
|
474
|
+
};
|
|
475
|
+
//#endregion
|
|
476
|
+
//#region src/shared/remote-update.d.ts
|
|
477
|
+
interface FeedEntry {
|
|
478
|
+
readonly version: string;
|
|
479
|
+
readonly url?: string;
|
|
480
|
+
readonly sha512?: string;
|
|
481
|
+
readonly size?: number;
|
|
482
|
+
readonly releaseDate?: string;
|
|
483
|
+
readonly stagingPercentage?: number;
|
|
484
|
+
}
|
|
485
|
+
declare function parseFeed(text: string): FeedEntry;
|
|
486
|
+
declare function compareVersions(left: string, right: string): number;
|
|
487
|
+
declare function stagingMatch(updaterId: string | undefined, stagingPercentage: number | undefined): boolean;
|
|
419
488
|
//#endregion
|
|
420
489
|
//#region src/shared/skills-manager.d.ts
|
|
421
490
|
type SkillScope = 'project' | 'global' | 'plugin' | 'unknown';
|
|
@@ -438,10 +507,10 @@ interface SkillsPolicyState {
|
|
|
438
507
|
readonly disabled: ReadonlySet<string>;
|
|
439
508
|
}
|
|
440
509
|
declare function readSkillsConfig(config: unknown, sessionId?: string, state?: Pick<SessionState, 'read'>): SkillsPolicyState;
|
|
441
|
-
declare function collectSkillCatalog(ctx: HostContext, sessionId?: string): Promise<readonly SkillCatalogItem[]>;
|
|
510
|
+
declare function collectSkillCatalog(ctx: HostContext$1, sessionId?: string): Promise<readonly SkillCatalogItem[]>;
|
|
442
511
|
declare function installSkillsPolicy(ctx: ToolsHostContext, readState: (sessionId?: string) => SkillsPolicyState): () => void;
|
|
443
|
-
declare function handleSkillsCatalog(ctx: HostContext, request?: Request): Promise<Response>;
|
|
444
|
-
declare function registerSkillsRoute(ctx: HostContext): () => void;
|
|
512
|
+
declare function handleSkillsCatalog(ctx: HostContext$1, request?: Request): Promise<Response>;
|
|
513
|
+
declare function registerSkillsRoute(ctx: HostContext$1): () => void;
|
|
445
514
|
//#endregion
|
|
446
515
|
//#region src/shared/context-policy.d.ts
|
|
447
516
|
type SessionCap = number | null;
|
|
@@ -530,12 +599,12 @@ interface HostSessionLike {
|
|
|
530
599
|
}
|
|
531
600
|
declare function readCap(state: Pick<SessionState, 'read'>, sessionId: string): SessionCap;
|
|
532
601
|
declare function readContextManagerEnabled(config: unknown): boolean;
|
|
533
|
-
declare function resolveTargetAgent(ctx: HostContext, sessionId: string): Promise<HostAgentLike | undefined>;
|
|
602
|
+
declare function resolveTargetAgent(ctx: HostContext$1, sessionId: string): Promise<HostAgentLike | undefined>;
|
|
534
603
|
interface ContextControlOptions {
|
|
535
604
|
readonly config: () => unknown;
|
|
536
605
|
readonly state?: Pick<SessionState, 'read' | 'change'>;
|
|
537
606
|
}
|
|
538
|
-
declare function createContextControl(ctx: HostContext, options: ContextControlOptions): {
|
|
607
|
+
declare function createContextControl(ctx: HostContext$1, options: ContextControlOptions): {
|
|
539
608
|
consumePending: (sessionId: string) => Promise<void>;
|
|
540
609
|
forgetAgent: (agent: HostAgentLike) => void;
|
|
541
610
|
dispose: () => Promise<void>;
|
|
@@ -544,8 +613,8 @@ declare function createContextControl(ctx: HostContext, options: ContextControlO
|
|
|
544
613
|
setCap: (sessionId: string, cap: SessionCap) => Promise<ContextSnapshot>;
|
|
545
614
|
};
|
|
546
615
|
declare function handleContextRequest(control: ContextControl, request?: Request): Promise<Response>;
|
|
547
|
-
declare function registerContextRoute(ctx: HostContext, control: ContextControl): () => void;
|
|
548
|
-
interface ContextHookHost extends HostContext {
|
|
616
|
+
declare function registerContextRoute(ctx: HostContext$1, control: ContextControl): () => void;
|
|
617
|
+
interface ContextHookHost extends HostContext$1 {
|
|
549
618
|
on?(event: string, listener: (...args: never[]) => unknown, options?: {
|
|
550
619
|
readonly prepend?: boolean;
|
|
551
620
|
}): () => void;
|
|
@@ -592,7 +661,7 @@ interface HostSessionEventLike {
|
|
|
592
661
|
};
|
|
593
662
|
readonly sourceEventSeqs?: readonly number[];
|
|
594
663
|
}
|
|
595
|
-
interface RecoveryHookHost extends HostContext {
|
|
664
|
+
interface RecoveryHookHost extends HostContext$1 {
|
|
596
665
|
on?(event: string, listener: (...args: never[]) => unknown, options?: {
|
|
597
666
|
readonly prepend?: boolean;
|
|
598
667
|
}): () => void;
|
|
@@ -693,6 +762,13 @@ export declare const Config: Schema<Schemastery.ObjectS<NoInfer<{
|
|
|
693
762
|
}>>, "plain">;
|
|
694
763
|
export declare function apply(ctx: ToolsHostContext, config?: unknown): void;
|
|
695
764
|
export declare const __test: {
|
|
765
|
+
createUpdateEngine: typeof createUpdateEngine;
|
|
766
|
+
productionDeps: typeof productionDeps;
|
|
767
|
+
readInstalledVersion: typeof readInstalledVersion;
|
|
768
|
+
registerUpdateRoute: typeof registerUpdateRoute;
|
|
769
|
+
parseFeed: typeof parseFeed;
|
|
770
|
+
compareVersions: typeof compareVersions;
|
|
771
|
+
stagingMatch: typeof stagingMatch;
|
|
696
772
|
createSessionState: typeof createSessionState;
|
|
697
773
|
sessionStateDomainSpec: {
|
|
698
774
|
name: string;
|