mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-11-27 23:58:47 +00:00
Some checks are pending
CI / Python packages / Build and verify distributions (push) Waiting to run
CI / Python quality / GitHub Actions (push) Waiting to run
CI / Python quality / Pre-commit (push) Waiting to run
CI / Python tests / Hermes embedded - ubuntu-latest (push) Waiting to run
CI / Python tests / Hermes embedded - windows-latest (push) Waiting to run
CI / Python tests / Unit Tests - py3.11 (push) Waiting to run
CI / Python tests / Unit Tests - py3.12 (push) Waiting to run
CI / Python tests / Unit Tests - py3.13 (push) Waiting to run
CI / Python tests / Unit Tests - py3.14 (push) Waiting to run
CI / ReMe Studio / Studio checks (push) Waiting to run
CI / Windows / CLI smoke - py3.11 (push) Waiting to run
Deploy / Documentation / Build documentation (push) Waiting to run
Deploy / Documentation / deploy (push) Blocked by required conditions
Security / CodeQL / Analyze javascript-typescript (push) Waiting to run
Security / CodeQL / Analyze python (push) Waiting to run
* refactor(proactive)!: separate runtime ownership and unify delivery * refactor(proactive): finish runtime and Studio migration * test(proactive): make scheduled skip coverage deterministic * refactor(studio): unify navigation and notebook resource loading * feat(studio): edit workspace documents and update proactive task names * refactor(studio): simplify task settings and navigation * feat(studio): secure and supervise backend settings * feat(studio): unify workbench timelines and refine desktop updates Use shared timeline panes for notebook, memory, and resources. Add Todo creation ordering, persist companion visibility, and align desktop update handling and release artifacts. Recheck editor file versions at read and publication boundaries. Retry reminder detail requests from the resource view. * fix(studio): support unsigned GitHub preview releases * fix: verify container state and isolate proactive view errors Mount private supervisor state in Docker smoke tests and verify token and settings persistence. Exercise Studio startup with a loopback-only model fixture, and exclude packaged desktop output from Docker contexts. Keep Remy subscriptions and healthy tasks available when an individual task has an invalid workspace path or session history. * fix(home): align candidate Docker context exclusions * chore(deps): update openai-codex dependency to v0.172.0 - Bump openai-codex from version 0.169.0 to 0.172.0 in pyproject.toml - Keep other dependencies unchanged - Ensure compatibility with latest openai-codex features and fixes * fix(daemon): discover parent dotenv and isolate listeners Restore parent-directory environment discovery in workers while retaining system precedence. Partition the default supervisor profile and lock by the configured bind address and port.
185 lines
5.7 KiB
TypeScript
185 lines
5.7 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { EventEmitter } from "node:events";
|
|
import test from "node:test";
|
|
import type { UpdateState } from "../src/protocol.ts";
|
|
import { DesktopUpdater } from "../src/main/updater.ts";
|
|
|
|
test("desktop updates only download and install in response to their commands", async () => {
|
|
let checks = 0;
|
|
let downloads = 0;
|
|
let installs = 0;
|
|
const version = "0.4.4";
|
|
const info = { version, files: [], path: "", sha512: "", releaseDate: "" };
|
|
const published: UpdateState[] = [];
|
|
let finish = () => {};
|
|
const nativeUpdater = Object.assign(new EventEmitter(), {
|
|
autoDownload: true,
|
|
autoInstallOnAppQuit: true,
|
|
allowPrerelease: true,
|
|
disableWebInstaller: false,
|
|
async checkForUpdates() {
|
|
checks++;
|
|
if (checks === 1) throw new Error("network unavailable");
|
|
return { isUpdateAvailable: true, updateInfo: info, versionInfo: info };
|
|
},
|
|
downloadUpdate() {
|
|
downloads++;
|
|
return new Promise<string[]>((resolve) => {
|
|
finish = () => resolve([]);
|
|
});
|
|
},
|
|
quitAndInstall(silent?: boolean, restart?: boolean) {
|
|
assert.equal(silent, true);
|
|
assert.equal(restart, true);
|
|
installs++;
|
|
},
|
|
});
|
|
const updater = new DesktopUpdater(nativeUpdater, (state) =>
|
|
published.push(state),
|
|
);
|
|
assert.equal(nativeUpdater.autoDownload, false);
|
|
assert.equal(nativeUpdater.autoInstallOnAppQuit, false);
|
|
assert.deepEqual(await updater.run("check"), { status: "error" });
|
|
assert.deepEqual(await updater.run("check"), {
|
|
status: "available",
|
|
version,
|
|
});
|
|
assert.equal(downloads, 0);
|
|
await updater.run("install");
|
|
assert.equal(installs, 0);
|
|
|
|
const downloading = updater.run("download");
|
|
nativeUpdater.emit("download-progress", { percent: 37.4 });
|
|
assert.deepEqual(await updater.run("check"), {
|
|
status: "downloading",
|
|
version,
|
|
percent: 37,
|
|
});
|
|
await updater.run("download");
|
|
assert.equal(checks, 2);
|
|
assert.equal(downloads, 1);
|
|
finish();
|
|
assert.deepEqual(await downloading, { status: "ready", version });
|
|
assert.deepEqual(await updater.run("check"), { status: "ready", version });
|
|
assert.equal(checks, 2);
|
|
assert.equal(installs, 0);
|
|
|
|
assert.deepEqual(await updater.run("install"), {
|
|
status: "installing",
|
|
version,
|
|
});
|
|
await updater.run("install");
|
|
assert.equal(installs, 1);
|
|
assert.deepEqual(
|
|
published.map(({ status }) => status),
|
|
[
|
|
"checking",
|
|
"error",
|
|
"checking",
|
|
"available",
|
|
"downloading",
|
|
"downloading",
|
|
"ready",
|
|
"installing",
|
|
],
|
|
);
|
|
});
|
|
|
|
function nativeUpdater() {
|
|
const updateInfo = {
|
|
version: "1.2.3",
|
|
files: [],
|
|
path: "",
|
|
sha512: "",
|
|
releaseDate: "",
|
|
};
|
|
return Object.assign(new EventEmitter(), {
|
|
autoDownload: true,
|
|
autoInstallOnAppQuit: true,
|
|
allowPrerelease: true,
|
|
disableWebInstaller: false,
|
|
async checkForUpdates() {
|
|
return { isUpdateAvailable: true, updateInfo, versionInfo: updateInfo };
|
|
},
|
|
async downloadUpdate(): Promise<string[]> {
|
|
return [];
|
|
},
|
|
quitAndInstall(_silent?: boolean, _restart?: boolean) {},
|
|
});
|
|
}
|
|
|
|
test("builds without an update channel keep the manual update route", async () => {
|
|
const updater = new DesktopUpdater(null, () =>
|
|
assert.fail("no update event"),
|
|
);
|
|
for (const command of ["check", "download", "install"] as const) {
|
|
assert.deepEqual(await updater.run(command), { status: "manual" });
|
|
}
|
|
});
|
|
|
|
for (const settle of ["resolve", "reject"] as const) {
|
|
test(`an old update check cannot overwrite a retry when it ${settle}s`, async () => {
|
|
const native = nativeUpdater();
|
|
const result = await native.checkForUpdates();
|
|
let finish = () => {};
|
|
const pending = new Promise<typeof result>((resolve, reject) => {
|
|
finish = () =>
|
|
settle === "resolve"
|
|
? resolve({ ...result, isUpdateAvailable: false })
|
|
: reject(new Error("old request failed"));
|
|
});
|
|
let checks = 0;
|
|
native.checkForUpdates = () =>
|
|
++checks === 1 ? pending : Promise.resolve(result);
|
|
const updater = new DesktopUpdater(native, () => {});
|
|
const checking = updater.run("check");
|
|
native.emit("error", new Error("connection interrupted"));
|
|
assert.deepEqual(await updater.run("check"), {
|
|
status: "available",
|
|
version: result.updateInfo.version,
|
|
});
|
|
finish();
|
|
assert.deepEqual(await checking, {
|
|
status: "available",
|
|
version: result.updateInfo.version,
|
|
});
|
|
});
|
|
}
|
|
|
|
test("a download error cannot become ready when the old download finishes", async () => {
|
|
const native = nativeUpdater();
|
|
let finish = () => {};
|
|
native.downloadUpdate = () =>
|
|
new Promise<string[]>((resolve) => {
|
|
finish = () => resolve([]);
|
|
});
|
|
const updater = new DesktopUpdater(native, () => {});
|
|
await updater.run("check");
|
|
const downloading = updater.run("download");
|
|
native.emit("error", new Error("download interrupted"));
|
|
native.emit("download-progress", { percent: 100 });
|
|
finish();
|
|
assert.deepEqual(await downloading, { status: "error" });
|
|
assert.deepEqual(await updater.run("install"), { status: "error" });
|
|
await updater.run("check");
|
|
native.downloadUpdate = async () => [];
|
|
assert.deepEqual(await updater.run("download"), {
|
|
status: "ready",
|
|
version: "1.2.3",
|
|
});
|
|
});
|
|
|
|
test("native installation errors are visible and allow checking again", async () => {
|
|
const native = nativeUpdater();
|
|
native.quitAndInstall = () => {
|
|
native.emit("error", new Error("installer failed"));
|
|
};
|
|
const updater = new DesktopUpdater(native, () => {});
|
|
await updater.run("check");
|
|
await updater.run("download");
|
|
assert.deepEqual(await updater.run("install"), { status: "error" });
|
|
assert.deepEqual(await updater.run("check"), {
|
|
status: "available",
|
|
version: "1.2.3",
|
|
});
|
|
});
|