Merge branch 'main' into web-chat-approvals
Resolve C10 vs C11 in the shared shell: - keep both send hooks in the smoke's WebSocket shim (recording + scripted replies + synthetic approval acknowledgement) instead of the second assignment overwriting the first; - close the .chat-approval CSS rule so the C11 background-task rules are not swallowed by it (the list lost its 3-row cap and scrolling); - assert the folding invariant directly (no adjacent agent bubbles) instead of 'agent bubbles <= user prompts', which the growing operator session now legitimately breaks; - exercise the resource clamp by scroll overflow instead of a clone measurement that the clamped frame makes unreliable.
This commit is contained in:
@@ -15,6 +15,14 @@ export const CHAT_HISTORY_LIMIT = 200;
|
||||
*/
|
||||
export const WEB_CHAT_CLIENT = "Web";
|
||||
|
||||
/**
|
||||
* The largest shell-output page the server accepts (ChatShellOutputLimit,
|
||||
* 64 KiB). The browser always reads from the page's start and never sends more
|
||||
* than this, so a background task's output can never grow unbounded on the
|
||||
* client.
|
||||
*/
|
||||
export const SHELL_OUTPUT_LIMIT = 64 << 10;
|
||||
|
||||
export class PipelinesRepository {
|
||||
#client;
|
||||
|
||||
@@ -248,6 +256,57 @@ export class PipelinesRepository {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists the currently verified shells this operator chat session owns (C11),
|
||||
* so the conversation can show a background-tasks bar while one is running.
|
||||
* The body is the session-scoped `chat_query` (like chat_messages); the reply
|
||||
* is `chat_shells`, and an older server that returns none answers with an empty
|
||||
* list. A blank session id is refused here, exactly like
|
||||
* PipelinesRepository.chatShells.
|
||||
*/
|
||||
async chatShells(sessionId) {
|
||||
if (!String(sessionId ?? "").trim()) {
|
||||
throw new ProtocolError("Select a chat session first.");
|
||||
}
|
||||
const response = await this.#client.call({
|
||||
type: Protocol.CHAT_SHELLS,
|
||||
[ChatKeys.QUERY]: { session_id: sessionId },
|
||||
});
|
||||
return response[ChatKeys.SHELLS] ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads one bounded output page from a verified shell (C11), mirroring
|
||||
* PipelinesRepository.chatShellOutput. The body is exactly
|
||||
* `chat_shell_output_query` — {session_id, shell_id, cursor, limit}, **not** the
|
||||
* `chat_query` the other session commands use — with the cursor always sent so
|
||||
* a refresh rereads from the page's start rather than appending. A blank
|
||||
* session/shell, an out-of-bounds cursor/limit or a reply with no page is
|
||||
* refused with the same reason the Android client uses.
|
||||
*/
|
||||
async chatShellOutput(sessionId, shellId, { cursor = 0, limit = SHELL_OUTPUT_LIMIT } = {}) {
|
||||
if (!String(sessionId ?? "").trim() || !String(shellId ?? "").trim()) {
|
||||
throw new ProtocolError("Select a shell first.");
|
||||
}
|
||||
if (!(cursor >= 0) || !(limit > 0) || limit > SHELL_OUTPUT_LIMIT) {
|
||||
throw new ProtocolError("Shell output bounds are invalid.");
|
||||
}
|
||||
const response = await this.#client.call({
|
||||
type: Protocol.CHAT_SHELL_OUTPUT,
|
||||
[ChatKeys.SHELL_OUTPUT_QUERY]: {
|
||||
session_id: sessionId,
|
||||
shell_id: shellId,
|
||||
cursor,
|
||||
limit,
|
||||
},
|
||||
});
|
||||
const page = response[ChatKeys.SHELL_OUTPUT];
|
||||
if (!page) {
|
||||
throw new ProtocolError("The server returned no shell output page.");
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finishes a session and records it closed on the server (nothing is
|
||||
* deleted). The reply echoes the updated session (`chat_session`) and the
|
||||
|
||||
Reference in New Issue
Block a user