feat(agent): support Responses steering and project-aware tools

Use the dedicated TJWATER_AGENT_URL and Responses stream protocol. Keep running
turns active while users steer or queue follow-ups and edit pending delivery.
Refresh the model catalog before generation and preserve approval mode selection.

Integrate scoped investigation messaging/presentation, geographic place selection,
current Agent composer styles and supporting workbench contracts.

Validation: 77 focused Vitest checks, 21 browser cases, lint, typecheck and
production build. Preserve direct Server/Agent routing and project authentication.
This commit is contained in:
2026-10-19 18:46:58 +08:00
parent 2c5bf15cce
commit ec23d44b02
131 changed files with 6663 additions and 1204 deletions
@@ -2,6 +2,19 @@ import { describe, expect, it } from "vitest";
import { applySessionStreamEvent, toAgentChatMessages, toAgentUiMessages } from "./agent-session-message-state";
describe("task context in persisted answers", () => {
it("inserts consumed user input once before the active assistant in live and resumed streams", () => {
const messages = toAgentUiMessages([
{ id: "original", role: "user", parts: [{ type: "text", text: "原问题" }] },
{ id: "answer", role: "assistant", parts: [{ type: "text", text: "处理中" }] }
]);
const data = { id: "new-input", text: "追加线索", delivery: "steer", status: "pending" };
expect(applySessionStreamEvent(messages, { type: "user_input", data })).toBe(messages);
const delivered = { type: "user_input" as const, data: { ...data, status: "delivered" } };
const next = applySessionStreamEvent(messages, delivered);
expect(next.map(({ id }) => id)).toEqual(["original", "new-input", "answer"]);
expect(applySessionStreamEvent(next, delivered)).toBe(next);
});
it("keeps the report reference of each answer when history is restored", () => {
const reference = {
task_id: "22222222-2222-4222-8222-222222222222",