fix: a new message goes behind queued entries, not ahead of them
Co-Authored-By: Ovis Fast (Claude) <[email protected]>
This commit is contained in:
1 parent
cb7f7b58f5
commit
2dbb3fe23e
3 files changed
+32
-4
No files matched your search
@@ -39,7 +39,14 @@ import * as fs from "fs/promises";
|
||||
|
||||
import { createState, reduce } from "./state.js";
|
||||
import { keyIntent } from "./keys.js";
|
||||
import { decide, shouldDrain, shouldStartCountdown, parseSendArgs, sendNow as sendToTerminal } from "./delivery.js";
|
||||
import {
|
||||
decide,
|
||||
shouldDrain,
|
||||
shouldStartCountdown,
|
||||
queueBlocksDirectSend,
|
||||
parseSendArgs,
|
||||
sendNow as sendToTerminal,
|
||||
} from "./delivery.js";
|
||||
import { detect as detectTrigger, rank, merge, startsLine } from "./suggest.js";
|
||||
import * as catalog from "./catalog.js";
|
||||
import { LIMITS, validate, mention, removeMention, kindOf, formatBytes, relativeTo } from "./attachments.js";
|
||||
@@ -1055,12 +1062,11 @@ export default class Composer extends View {
|
||||
// Not before the draft and the identity of the agent were checked - the
|
||||
// person's own "send now" (Ctrl+Enter) is the exception.
|
||||
const allowed = mode === "now" || canAutoSend(this.draftReady, key);
|
||||
// A message that is on the wire, or one that counts down, goes first: the
|
||||
// A message that is on the wire, waits in the queue or counts down goes first: the
|
||||
// new one waits behind it in the queue instead of vanishing or jumping
|
||||
// the line (Ctrl+Enter is the person's own order and does jump).
|
||||
const busy =
|
||||
this.draining.has(key) ||
|
||||
(mode !== "now" && (this.state.queue[key] ?? []).some((entry) => entry.state === "countdown"));
|
||||
this.draining.has(key) || (mode !== "now" && queueBlocksDirectSend(this.state.queue[key]));
|
||||
if (decision.kind === "send" && allowed && !busy) {
|
||||
// The person's own Enter answers an agent that waits for them: it goes
|
||||
// through even though the agent is blocked (`hc send --force`). Never
|
||||
|
||||
Reference in new issue
Block a user