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.
153 lines
4.7 KiB
TypeScript
153 lines
4.7 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
import { ClientController } from "../src/controller.ts";
|
|
import { SessionModel } from "../src/session-model.ts";
|
|
import { displayMessages } from "../src/messages.ts";
|
|
import type { ClientActivity, PendingTurn } from "../src/protocol.ts";
|
|
import { message, snapshot as makeSnapshot } from "./fixtures.ts";
|
|
const snapshot = (turn: string, sessionId = "session") =>
|
|
makeSnapshot(
|
|
[
|
|
message({
|
|
id: `${turn}:assistant`,
|
|
turn_id: turn,
|
|
content: turn,
|
|
session_id: sessionId,
|
|
}),
|
|
],
|
|
sessionId,
|
|
"monitor",
|
|
);
|
|
|
|
test("automatic task inputs are distinguished from ordinary chat and task follow-ups", () => {
|
|
const model = new SessionModel();
|
|
model.apply(snapshot("turn"));
|
|
model.messages.unshift({
|
|
...model.messages[0],
|
|
id: "turn:user",
|
|
role: "user",
|
|
content: "The same text in every context",
|
|
items: [],
|
|
});
|
|
const base = {
|
|
sessionId: "session",
|
|
messages: model.messages,
|
|
pending: null,
|
|
};
|
|
const task = displayMessages({ ...base, task: true }, undefined, "zh");
|
|
const chat = displayMessages(base, undefined, "zh");
|
|
assert.equal(task[0].taskInput, true);
|
|
assert.equal(task[1].taskInput, false);
|
|
assert.equal(chat[0].taskInput, undefined);
|
|
assert.equal(task[0].content, chat[0].content);
|
|
const query = displayMessages(
|
|
{
|
|
...base,
|
|
task: true,
|
|
messages: [],
|
|
pending: {
|
|
id: "follow-up",
|
|
sessionId: "session",
|
|
query: model.messages[0].content,
|
|
streaming: true,
|
|
},
|
|
},
|
|
undefined,
|
|
"zh",
|
|
);
|
|
assert.equal(query[0].taskInput, undefined);
|
|
assert.equal(query[0].content, task[0].content);
|
|
});
|
|
|
|
test("only matching conversation activity can mark a reply completed", () => {
|
|
const model = new SessionModel();
|
|
model.apply(snapshot("turn"));
|
|
const state = {
|
|
sessionId: model.sessionId,
|
|
messages: model.messages,
|
|
pending: null,
|
|
};
|
|
const activity: ClientActivity = {
|
|
session_id: "session",
|
|
turn_id: "turn",
|
|
source: "chat",
|
|
phase: "completed",
|
|
tool: null,
|
|
started_at: null,
|
|
};
|
|
const display = (run: ClientActivity) => displayMessages(state, run, "en");
|
|
assert.equal(display(activity)[0].status?.tone, "success");
|
|
for (const mismatch of [
|
|
{ turn_id: "batch" },
|
|
{ session_id: "other-session" },
|
|
{ source: "task" },
|
|
] as const) {
|
|
const messages = display({ ...activity, ...mismatch });
|
|
assert.deepEqual(
|
|
messages.map(({ id }) => id),
|
|
["turn:assistant"],
|
|
);
|
|
assert.equal(messages[0].status, null);
|
|
assert.equal(messages[0].completed, true);
|
|
}
|
|
assert.equal(
|
|
display({ ...activity, turn_id: "preparing", phase: "working" })[1].status
|
|
?.tone,
|
|
"working",
|
|
);
|
|
assert.equal(
|
|
display({ ...activity, phase: "failed" })[0].status?.tone,
|
|
"error",
|
|
);
|
|
});
|
|
|
|
test("automatic stages preserve query errors until the next task session", async () => {
|
|
const model = new SessionModel();
|
|
model.apply(snapshot("old"));
|
|
const pending: PendingTurn = {
|
|
id: "local",
|
|
sessionId: "session",
|
|
turnId: "old",
|
|
query: "old input",
|
|
streaming: false,
|
|
error: "Request failed",
|
|
outcome: "failed",
|
|
};
|
|
const child = {
|
|
model,
|
|
pending: pending as PendingTurn | null,
|
|
connected: false,
|
|
error: null,
|
|
};
|
|
// Keep the real subscription supervisor and session projection; replace only its transport and publisher.
|
|
const controller = Object.create(ClientController.prototype) as {
|
|
children: Map<string, typeof child>;
|
|
client: () => { stream: (...args: unknown[]) => Promise<void> };
|
|
emit: () => void;
|
|
watchChild: (id: string, signal: AbortSignal) => Promise<void>;
|
|
};
|
|
const abort = new AbortController();
|
|
const observed: Array<{ pending: PendingTurn | null; messages: string[] }> =
|
|
[];
|
|
controller.children = new Map([["monitor", child]]);
|
|
controller.emit = () =>
|
|
observed.push({
|
|
pending: child.pending,
|
|
messages: child.model.messages.map((message) => message.id),
|
|
});
|
|
controller.client = () => ({
|
|
stream: async (...args) => {
|
|
const receive = args[3] as (chunk: unknown) => void;
|
|
receive({ chunk_type: "data", chunk: snapshot("old") });
|
|
receive({ chunk_type: "data", chunk: snapshot("new") });
|
|
receive({ chunk_type: "data", chunk: snapshot("next", "next-session") });
|
|
abort.abort();
|
|
},
|
|
});
|
|
await controller.watchChild("monitor", abort.signal);
|
|
assert.equal(observed[0].pending, pending);
|
|
assert.equal(observed[1].pending, pending);
|
|
assert.deepEqual(observed[1].messages, ["new:assistant"]);
|
|
assert.equal(observed[2].pending, null);
|
|
assert.deepEqual(observed[2].messages, ["next:assistant"]);
|
|
});
|