ReMe/reme_studio/desktop/tests/companion-preview.test.ts
jinliyl af597d5d57
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 components and workflows (#785)
* refactor(proactive)!: separate runtime components and workflows

* refactor(proactive)!: unify task execution with native skills

Run TASK.md and trigger inputs in one Harness query with shared proactive-record
skills, native file tools and final record validation. Remove repair queries and
obsolete task module paths.

Use explicit agent_type and schedule settings and runtime_names for Connector
recipients. Persist collection controls and routing, and share dialogue scanning
between Codex and Claude Code. Update Studio, defaults and bilingual guides.

* refactor(proactive)!: configure shared task runtimes

Move task initialization, prompts, skills and session bindings into Runtime
components. Replace domain Agent Steps and Jobs with one shared executor.

Persist task requirements before publishing definitions and validate session
bindings before creating durable task state. Preserve task files and history.

* refactor(proactive)!: simplify workflows and native skill ownership

* fix(proactive): harden recovery and simplify runtime views

* feat(proactive): add durable CloudEvents SSE connectors

* feat(proactive)!: add live workflow overview and unify source management

Show sources, inboxes, Runtime activity, workspace files and reminders in one shared animated graph with focused details.

Unify connector identities and partial updates, persist input provenance, and expose versioned overview subscriptions and execution facts. Freeze source snapshots during delivery recovery.

Remove retired connector actions, unwrapped inbox storage and duplicate UI paths.

* refactor(studio)!: unify settings and streamline workflow navigation

Use one model configuration for chat and proactive runtimes, with managed
Codex and Claude Code selection and editable service connections. Replace
notify_window with notify_windows throughout schemas, tools and clients;
default reminder periods are 09:00-12:00 and 14:00-23:00.

Integrate the overview timeline with confirmed handoff animations, simplify
task navigation and speech settings, and update mobile navigation, recording
and keyboard behavior. Remove obsolete gesture, connector and tab paths.

Validation: 4311 Python tests passed (41 skipped), 99 Studio tests passed,
pre-commit, Studio format/type checks, docs tests/build, Web build, browser
regressions and iOS build-for-testing passed. Android build is unverified
because this machine has no Android SDK. Real model and native UI integration
tests were not run.

* fix(http): keep silent streams alive and sanitize cancellation state

Send SSE comment heartbeats immediately and during silent model waits, and
disable proxy buffering. Start producers with response consumption and join
both producer and queue waiter on disconnect, including immediate disconnects.

Keep cancellation details in server logs while projecting only the interrupted
outcome to Studio. Preserve partial output and normal failure reporting.

Validate with 147 related backend tests, 27 client tests, scoped pre-commit
checks and docs tests/build. A real loopback HTTP fixture completed a 32-second
silent wait with a 20-second read idle timeout and no model calls. Restarted the
local backend and verified immediate keepalives through loopback and LAN entry.

* fix(stream): harden cancellation, recovery and native session observation

Finish owned queue and producer cleanup through repeated cancellation. Close
proxied upstream responses even if ASGI fails before consuming their body.

Refresh client idle deadlines on incoming bytes, including SSE comments, and
report malformed events as protocol errors. Let authoritative finished replies
replace stale local cancellation errors without replaying user requests.

Tolerate the native empty-metadata race only while a newly started Codex thread
is initializing. Continue to surface corrupt, inaccessible and other invalid
session metadata.

Validation: isolated Python suite 4325 passed, 41 skipped; 9 additional tests
passed for the final cancellation edge. Isolated Studio suite 105 passed;
format, type checks, pre-commit and Web build passed. No real model calls.

* fix(studio): own recording lifecycle and preserve file navigation intent

* feat(studio): refine proactive flow and workspace navigation

* fix(studio): respect mobile safe areas and refresh connection setup

* fix(proactive): preserve uncertain delivery and simplify reminder views

* fix(proactive): clarify reminders and publish readable quote snapshots

* fix(proactive): release explicitly rejected native appends
2026-11-30 15:35:28 +08:00

74 lines
2 KiB
TypeScript

import assert from "node:assert/strict";
import test from "node:test";
import { viewState } from "../src/main/view-state.ts";
import type { StudioState, DisplayMessage } from "../../client/src/protocol.ts";
import { clientInfo } from "../../client/tests/fixtures.ts";
test("the companion receives final text without tool details or full history", () => {
const message: DisplayMessage = {
id: "reply",
role: "assistant",
source: "chat",
content: "All progress and final text",
streaming: false,
completed: true,
status: null,
items: [
{
id: "intro",
type: "text",
text: "Checking",
status: "completed",
phase: "commentary",
},
{
id: "tool",
type: "tool",
name: "bash",
input: "private arguments",
output: "large tool output",
status: "completed",
actions: [{ kind: "command" }],
},
{
id: "answer",
type: "text",
text: "Done",
status: "completed",
phase: "final_answer",
},
],
};
const state = {
clientInfo,
proactive: {
overview: null,
actions: [],
sequence: 1,
live: true,
asOf: null,
error: null,
},
agents: [],
sessionId: "session",
messages: [message],
surface: {
kind: "message",
message,
presentationId: 1,
target: { kind: "message", id: message.id },
},
} as StudioState;
const companion = viewState(state, true);
assert.deepEqual(companion.messages, []);
assert.equal(companion.clientInfo, null);
assert.equal(companion.proactive, undefined);
assert.equal(viewState(state, false).proactive, state.proactive);
assert.equal(companion.surface?.kind, "message");
if (companion.surface?.kind === "message") {
assert.equal(companion.surface.message.content, "Done");
assert.equal(companion.surface.message.items, undefined);
}
assert.equal(JSON.stringify(companion).includes("private arguments"), false);
assert.equal(viewState(state, false), state);
});