deepseek wrote the answer as plain text in an earlier turn or as send_reply's own argument, and every path deleted it: the text became a draft, a card turn lost it, and a bare send_reply kept carrying a faulted draft until the rewrites ran out. Six production replies failed that way. - send_reply takes the message itself (message, or text as an alias), so the shape a model reaches for is the one that works - a message written beside a card goes out with the call that closes it - a review send-back clears the held text and the reminder, so a refused answer is never sent again - ask_user and suggest_next_steps answer a repeat call instead of throwing, which read as a failed closing turn and lost the whole answer - card refs the app appended are stripped from answers and from history, the way the model learned to write [question:24] itself - the review faults [proposal:] and [hook-proposal:] refs no row backs - a pending proposal for the same target is replaced across a conversation, not just its session, and confirming one replaces the others - a run queued by a tool wakes the queue and pushes, every active task is pushed and a conversation keeps polling, so a queued run is not silent - a failed run closes its bot_tasks row, so it cannot shadow later progress
25 lines
750 B
TypeScript
25 lines
750 B
TypeScript
type Params = {
|
|
text: string;
|
|
/**
|
|
* The ref's kind, as in `[file:12]`, `[task:20]` or `[suggestion:4]`.
|
|
*/
|
|
kind: "file" | "task" | "suggestion" | "question" | "plan" | "graphic" | "proposal" | "hook-proposal";
|
|
};
|
|
|
|
/**
|
|
* The ids of every `[<kind>:ID]` ref in a message, once each, in order:
|
|
* what a reply names, for checking each exists before it goes out.
|
|
*/
|
|
export default function replyRefIds({ text, kind }: Params): number[] {
|
|
const pattern = new RegExp(`\\[${kind}:\\s*(\\d+)\\s*\\]`, "gi");
|
|
const ids: number[] = [];
|
|
|
|
for (const match of text.matchAll(pattern)) {
|
|
const id = Number(match[1]);
|
|
|
|
if (Number.isInteger(id) && id > 0 && !ids.includes(id)) ids.push(id);
|
|
}
|
|
|
|
return ids;
|
|
}
|