fix(chat): settle authoritative turns and make capabilities explicit
This commit is contained in:
@@ -555,6 +555,14 @@ function cancelNewChat() {
|
||||
* of the list, becomes the open conversation and loads its (empty) history; on
|
||||
* failure the server's own reason stays in the pane, which does not close.
|
||||
*/
|
||||
function reportInstructionStatus(created) {
|
||||
const status = created?.instruction_status;
|
||||
if (status === "applied") addChatNotice(created.id, "Session instructions applied.");
|
||||
else if (status === "unsupported" || status === "failed") {
|
||||
addChatNotice(created.id, `Session instructions ${status}: ${created.instruction_error || "this harness does not support preloaded instructions"}.`);
|
||||
}
|
||||
}
|
||||
|
||||
async function createNewChat() {
|
||||
const create = state.chatCreate;
|
||||
if (!create || create.creating) return;
|
||||
@@ -570,6 +578,7 @@ async function createNewChat() {
|
||||
state.chatCreate = null;
|
||||
state.chatSessions = chatCreateSucceeded(state.chatSessions, created);
|
||||
await openChatSession(created.id);
|
||||
reportInstructionStatus(created);
|
||||
await loadChatSessions();
|
||||
} catch (error) {
|
||||
if (!state.chatCreate) return;
|
||||
@@ -1559,6 +1568,7 @@ async function startChatSession(directory) {
|
||||
});
|
||||
const title = String(created.title ?? "").trim() || "New chat";
|
||||
addChatNotice(created.id, `Started a new session “${title}” in ${directory}.`);
|
||||
reportInstructionStatus(created);
|
||||
await openChatSession(created.id);
|
||||
// An ephemeral (verification) create is intentionally absent from the server's
|
||||
// list, so a refresh here would replace the just-opened conversation and drop
|
||||
@@ -1717,6 +1727,7 @@ function base64FromBuffer(buffer) {
|
||||
async function chatAttachmentPayloads(attachments) {
|
||||
const valid = (attachments ?? []).filter((attachment) => attachment?.error == null);
|
||||
if (valid.length === 0) return [];
|
||||
if (valid.length > 8) throw new Error("At most 8 attachments are allowed.");
|
||||
let total = 0;
|
||||
const payloads = [];
|
||||
for (const attachment of valid) {
|
||||
@@ -2736,6 +2747,10 @@ function renderChatModelDialog(session) {
|
||||
);
|
||||
panel.append(actions);
|
||||
overlay.append(panel);
|
||||
modal.stage("chat-model", overlay, {
|
||||
onClose: closeChatModelPicker,
|
||||
fallbackSelectors: ["#chatComposer", "#detailTitle", "#pane-main"],
|
||||
});
|
||||
return overlay;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user