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:
+39
-10
@@ -230,6 +230,7 @@ import {
|
||||
BACKGROUND_TASKS_TITLE,
|
||||
CHAT_ACTIONS_LABEL,
|
||||
CHAT_ATTACH_LABEL,
|
||||
CHAT_COMMAND_DISMISS_LABEL,
|
||||
CHAT_COMMAND_GLYPH,
|
||||
CHAT_COMPOSER_PLACEHOLDER,
|
||||
CHAT_EMPTY,
|
||||
@@ -283,6 +284,7 @@ import {
|
||||
applyChatEvent,
|
||||
applyChatOverrides,
|
||||
applyChatPermission,
|
||||
appendChatNotice,
|
||||
approvalCard,
|
||||
attachmentDisplayName,
|
||||
attachmentError,
|
||||
@@ -296,6 +298,7 @@ import {
|
||||
chatFollowsAt,
|
||||
chatHeaderMeta,
|
||||
chatNoMatchMessage,
|
||||
chatNoticeLabel,
|
||||
chatOpensAtNewest,
|
||||
chatShowJumpToLatest,
|
||||
chatStreamState,
|
||||
@@ -307,6 +310,7 @@ import {
|
||||
decodeChatOverrides,
|
||||
decodeChatSeen,
|
||||
directoryLabel,
|
||||
dismissChatNotice as dismissChatNoticeModel,
|
||||
emptyChatOverrides,
|
||||
emptyChatSeen,
|
||||
encodeChatOverrides,
|
||||
@@ -316,6 +320,7 @@ import {
|
||||
hideChatOverride,
|
||||
historyResync,
|
||||
isChatSessionUnseen,
|
||||
makeChatNotice,
|
||||
markChatUnseen,
|
||||
mergeHistoryPage,
|
||||
mergeShellFrame,
|
||||
@@ -342,6 +347,7 @@ import {
|
||||
shellCommandSummary,
|
||||
shellOutputState,
|
||||
shellsLoaded,
|
||||
takeChatNoticeOffer as takeChatNoticeOfferModel,
|
||||
formatToolDuration,
|
||||
threadElapsedMillis,
|
||||
threadPhase,
|
||||
@@ -4654,15 +4660,15 @@ function addChatNotice(sessionId, text, { failed = false, offer = null } = {}) {
|
||||
const thread = state.chatThreads.get(sessionId);
|
||||
if (!thread) return;
|
||||
chatNoticeSeq += 1;
|
||||
const notice = { id: `notice-${chatNoticeSeq}`, text, failed, offer };
|
||||
setThread(sessionId, { notices: [...(thread.notices ?? []), notice] });
|
||||
const notice = makeChatNotice(`notice-${chatNoticeSeq}`, text, { failed, offer });
|
||||
setThread(sessionId, { notices: appendChatNotice(thread.notices, notice) });
|
||||
}
|
||||
|
||||
/** Remove one local command line (the operator cancelled its offer). */
|
||||
/** Remove one local command line (the operator cancelled or dismissed it). */
|
||||
function dismissChatNotice(sessionId, noticeId) {
|
||||
const thread = state.chatThreads.get(sessionId);
|
||||
if (!thread) return;
|
||||
setThread(sessionId, { notices: (thread.notices ?? []).filter((n) => n.id !== noticeId) });
|
||||
setThread(sessionId, { notices: dismissChatNoticeModel(thread.notices, noticeId) });
|
||||
renderContent();
|
||||
}
|
||||
|
||||
@@ -4672,10 +4678,11 @@ function dismissChatNotice(sessionId, noticeId) {
|
||||
*/
|
||||
function takeChatNoticeOffer(sessionId, noticeId) {
|
||||
const thread = state.chatThreads.get(sessionId);
|
||||
const notice = (thread?.notices ?? []).find((n) => n.id === noticeId);
|
||||
if (!notice || notice.offer == null) return null;
|
||||
setThread(sessionId, { notices: (thread.notices ?? []).filter((n) => n.id !== noticeId) });
|
||||
return notice.offer;
|
||||
if (!thread) return null;
|
||||
const taken = takeChatNoticeOfferModel(thread.notices, noticeId);
|
||||
if (taken.offer == null) return null;
|
||||
setThread(sessionId, { notices: taken.notices });
|
||||
return taken.offer;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4822,7 +4829,12 @@ function applyChatCommandEffect(sessionId, session, effect) {
|
||||
async function startChatSession(directory) {
|
||||
const from = state.chatActiveId;
|
||||
try {
|
||||
const created = await repo.chatCreate("New chat", directory);
|
||||
// An automated check (the UI smoke) can mark its throwaway chat ephemeral, so
|
||||
// creating one for verification never adds a stray "New chat" to the
|
||||
// operator's list. Set only by test tooling; a normal page leaves it unset.
|
||||
const created = await repo.chatCreate("New chat", directory, undefined, {
|
||||
ephemeral: globalThis.__pipelinesEphemeralChat === true,
|
||||
});
|
||||
// The list is the server's; insert the created session so the row is present
|
||||
// before the conversation opens, then refresh from the server.
|
||||
state.chatSessions = [created, ...state.chatSessions.filter((s) => s.id !== created.id)];
|
||||
@@ -6151,6 +6163,7 @@ function renderChatCommandNotice(sessionId, notice) {
|
||||
const row = h("div", {
|
||||
class: `chat-command-notice${failed ? " chat-command-notice-failed" : ""}`,
|
||||
role: "note",
|
||||
"data-notice-id": notice?.id ?? "",
|
||||
});
|
||||
const head = h("div", { class: "chat-command-notice-head" });
|
||||
head.append(
|
||||
@@ -6163,7 +6176,7 @@ function renderChatCommandNotice(sessionId, notice) {
|
||||
}),
|
||||
);
|
||||
head.append(
|
||||
h("span", { class: "chat-command-notice-label", text: failed ? "Command failed" : "Command" }),
|
||||
h("span", { class: "chat-command-notice-label", text: chatNoticeLabel(failed) }),
|
||||
);
|
||||
row.append(head);
|
||||
row.append(h("div", { class: "chat-command-notice-text", text: notice?.text ?? "" }));
|
||||
@@ -6186,6 +6199,22 @@ function renderChatCommandNotice(sessionId, notice) {
|
||||
}),
|
||||
);
|
||||
row.append(actions);
|
||||
} else {
|
||||
// Android only offers the Send/Cancel pair on an offer-bearing notice, so a
|
||||
// `/help` or `/new` line cannot be dismissed there. The browser item requires
|
||||
// each notice to be individually dismissible; the wording and the offer pair
|
||||
// still match the app verbatim, and this extra control is stated in PARITY.
|
||||
const actions = h("div", { class: "chat-command-notice-actions" });
|
||||
actions.append(
|
||||
h("button", {
|
||||
class: "ghost chat-command-dismiss",
|
||||
type: "button",
|
||||
text: "Dismiss",
|
||||
"aria-label": CHAT_COMMAND_DISMISS_LABEL,
|
||||
onclick: () => dismissChatNotice(sessionId, notice.id),
|
||||
}),
|
||||
);
|
||||
row.append(actions);
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user