Merge branch 'main' into web-chat-local

Resolve the C11/C12 vs C13 overlap in the chat work:
- PARITY: keep main's done C11/C12 rows and this branch's done C13 row.
- app.js/chat tests: keep both import/helper sets (notices and overrides/seen).
- ui-smoke: keep main's C11 background-task bar, C12 notice checks and the
  shared composer throwaway, and C13's row-menu rename/hide/seen checks.
  The composer throwaway stays a listed server session: C12 switches away
  and back to it and C13 reads its row, which an ephemeral create (2fe6301)
  deliberately hides from chat_sessions. The live-run graph halo check is
  best effort as its own comment says, so a run with no stage in flight at
  capture time skips instead of failing the whole smoke.
This commit is contained in:
2026-10-19 14:07:28 +01:00
13 changed files with 791 additions and 79 deletions
+59 -1
View File
@@ -20,7 +20,11 @@
// chatShowJumpToLatest, chatOpensAtNewest,
// chatFirstScroll
// ui/chat/ChatStore.kt the history page merge (dedupe by id, prepend an
// older page, replace nextCursor/hasMore)
// older page, replace nextCursor/hasMore) and the
// local command notices (append, dismiss one,
// take an offer; ChatCommandNotice)
// ui/chat/ChatCommandUi.kt the Command / Command failed labels and the
// terminal glyph of one local notice line
// ui/chat/ChatComposer.kt composerAction, composerCanSend/composerSendEnabled,
// the submit routing (command vs prompt)
// ui/chat/ChatCommands.kt CHAT_COMMANDS, parseChatInput, chatCommandSuggestions,
@@ -1624,6 +1628,60 @@ export const CHAT_QUEUED_NOTICE = "Queued — it will send when the current turn
*/
export const CHAT_COMMAND_GLYPH = ">_";
/** The two labels a local command line can carry (ChatCommandUi.kt). */
export const CHAT_COMMAND_LABEL = "Command";
export const CHAT_COMMAND_FAILED_LABEL = "Command failed";
/** The accessible name of an offerless notice's dismiss control. */
export const CHAT_COMMAND_DISMISS_LABEL = "Dismiss command notice";
/**
* The label for one command notice: `Command failed` when the command could not
* be honoured, else `Command` (ChatCommandUi.kt's own choice). The same flag
* selects the error tint on the caller's row.
*/
export function chatNoticeLabel(failed) {
return failed === true ? CHAT_COMMAND_FAILED_LABEL : CHAT_COMMAND_LABEL;
}
/**
* One local command line, the app's `ChatCommandNotice` shape: it lives beside a
* conversation, never inside its messages, so it is never sent to the agent.
* [offer] is set only for an unrecognised command, whose draft the operator can
* still choose to send as a message.
*/
export function makeChatNotice(id, text, { failed = false, offer = null } = {}) {
return {
id: str(id),
text: str(text),
failed: failed === true,
offer: offer == null ? null : str(offer),
};
}
/** Append one notice to a conversation's list, preserving order. */
export function appendChatNotice(notices, notice) {
return [...(notices ?? []), notice];
}
/** Drop one notice by id, leaving every other notice and its order untouched. */
export function dismissChatNotice(notices, noticeId) {
return (notices ?? []).filter((notice) => notice?.id !== noticeId);
}
/**
* Take the draft an unrecognised-command notice offers, removing the notice
* first (mirrors `ChatStore.takeNoticeOffer`). Returns `{notices, offer}`:
* `offer` is null — and the list is returned untouched — when the notice is
* missing, already taken or carries no offer, so a stale tap sends nothing.
*/
export function takeChatNoticeOffer(notices, noticeId) {
const list = notices ?? [];
const notice = list.find((entry) => entry?.id === noticeId);
if (!notice || notice.offer == null) return { notices: list, offer: null };
return { notices: dismissChatNotice(list, noticeId), offer: notice.offer };
}
/** The two values of [composerAction]. */
export const COMPOSER_SEND = "send";
export const COMPOSER_STOP = "stop";